File tree Expand file tree Collapse file tree 3 files changed +21
-0
lines changed
Expand file tree Collapse file tree 3 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import * as tscircuitMathUtils from "@tscircuit/math-utils"
77import type { PlatformConfig } from "@tscircuit/props"
88import { getPlatformConfig } from "lib/getPlatformConfig"
99import type { TsConfig } from "lib/runner/tsconfigPaths"
10+ import * as tslib from "tslib"
1011import Debug from "debug"
1112
1213const debug = Debug ( "tsci:eval:execution-context" )
@@ -79,6 +80,7 @@ export function createExecutionContext(
7980 react : React ,
8081 "react/jsx-runtime" : ReactJsxRuntime ,
8182 debug : Debug ,
83+ tslib,
8284
8385 // This is usually used as a type import, we can remove the shim when we
8486 // ignore type imports in getImportsFromCode
Original file line number Diff line number Diff line change 121121 "sucrase" : " ^3.35.0" ,
122122 "ts-expect" : " ^1.3.0" ,
123123 "tsup" : " ^8.2.4" ,
124+ "tslib" : " ^2.8.1" ,
124125 "@tscircuit/common" : " ^0.0.20" ,
125126 "@tscircuit/copper-pour-solver" : " ^0.0.14"
126127 },
Original file line number Diff line number Diff line change 1+ import { expect , test } from "bun:test"
2+ import { CircuitRunner } from "lib/runner/CircuitRunner"
3+
4+ test ( "tslib is added to pre-supplied imports" , async ( ) => {
5+ const runner = new CircuitRunner ( )
6+
7+ await runner . execute ( `
8+ import { __assign } from "tslib"
9+
10+ const dimensions = __assign({ width: "10mm" }, { height: "10mm" })
11+
12+ circuit.add(<board {...dimensions} />)
13+ ` )
14+
15+ await runner . renderUntilSettled ( )
16+
17+ expect ( runner . _executionContext ?. preSuppliedImports . tslib ) . toBeDefined ( )
18+ } )
You can’t perform that action at this time.
0 commit comments