@tscircuit/eval 0.0.288 → 0.0.289

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/.github/workflows/bun-test.yml +20 -2
  2. package/dist/blob-url.js +1 -1
  3. package/dist/eval/index.d.ts +52 -8
  4. package/dist/lib/index.d.ts +52 -8
  5. package/dist/webworker/entrypoint.js +352 -349
  6. package/package.json +9 -7
  7. package/scripts/validate-test-matrix.js +148 -0
  8. package/tests/{example1-readme-example.test.tsx → examples/example01-readme-example.test.tsx} +1 -1
  9. package/tests/{example2-multiple-files.test.tsx → examples/example02-multiple-files.test.tsx} +1 -1
  10. package/tests/{example3-encoded-url.test.tsx → examples/example03-encoded-url.test.tsx} +1 -1
  11. package/tests/{example4-root-child-issue.test.tsx → examples/example04-root-child-issue.test.tsx} +1 -1
  12. package/tests/{example5-event-recording.test.tsx → examples/example05-event-recording.test.tsx} +1 -1
  13. package/tests/{example7-import-default-and-namespace.test.tsx → examples/example07-import-default-and-namespace.test.tsx} +2 -2
  14. package/tests/{example8-footprinter-to220.test.tsx → examples/example08-footprinter-to220.test.tsx} +1 -1
  15. package/tests/{example9-not-defined-component.test.tsx → examples/example09-not-defined-component.test.tsx} +1 -1
  16. package/tests/{example13-webworker-without-entrypoint.test.tsx → examples/example13-webworker-without-entrypoint.test.tsx} +1 -1
  17. package/tests/{example16-parts-engine.test.tsx → examples/example16-parts-engine.test.tsx} +1 -1
  18. package/tests/{example17-parse-tscircuit-config.test.tsx → examples/example17-parse-tscircuit-config.test.tsx} +1 -1
  19. package/tests/{circuit-event-forwarding.test.tsx → features/circuit-event-forwarding.test.tsx} +1 -1
  20. package/tests/{fetch-override.test.ts → features/fetch-proxy/fetch-override.test.ts} +3 -3
  21. package/tests/{fetch-proxy-validation.test.ts → features/fetch-proxy/fetch-proxy-validation.test.ts} +5 -7
  22. package/tests/{kill.test.ts → features/kill.test.ts} +5 -3
  23. package/tests/{manual-edits.test.tsx → features/manual-edits.test.tsx} +2 -2
  24. package/tests/fixtures/resourcePaths.ts +3 -0
  25. package/webworker/entrypoint.ts +1 -1
  26. /package/tests/{example6-dynamic-load-blob-url.test.tsx → examples/example06-dynamic-load-blob-url.test.tsx} +0 -0
  27. /package/tests/{example10-run-tscircuit-code.test.tsx → examples/example10-run-tscircuit-code.test.tsx} +0 -0
  28. /package/tests/{example11-flexible-import-extensions.test.tsx → examples/example11-flexible-import-extensions.test.tsx} +0 -0
  29. /package/tests/{example12-import-from-subdirectory.test.tsx → examples/example12-import-from-subdirectory.test.tsx} +0 -0
  30. /package/tests/{example14-run-tscircuit-module.test.tsx → examples/example14-run-tscircuit-module.test.tsx} +0 -0
  31. /package/tests/{example15-run-tscircuit-module-with-props.test.tsx → examples/example15-run-tscircuit-module-with-props.test.tsx} +0 -0
  32. /package/tests/{parent-directory-import.test.tsx → features/parent-directory-import.test.tsx} +0 -0
  33. /package/tests/{platform-config.test.tsx → features/platform-config.test.tsx} +0 -0
  34. /package/tests/{prioritize-default-export.test.tsx → features/prioritize-default-export.test.tsx} +0 -0
  35. /package/tests/{group-wrapper.test.tsx → repros/group-wrapper.test.tsx} +0 -0
  36. /package/tests/{nine-keyboard-default-export.test.tsx → repros/nine-keyboard-default-export.test.tsx} +0 -0
  37. /package/tests/{get-imports-from-code.test.tsx → util-fns/get-imports-from-code.test.tsx} +0 -0
  38. /package/tests/{getPossibleEntrypointComponentPaths.test.ts → util-fns/getPossibleEntrypointComponentPaths.test.ts} +0 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/eval",
3
3
  "main": "dist/lib/index.js",
4
- "version": "0.0.288",
4
+ "version": "0.0.289",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "build": "bun run build:lib && bun run build:webworker && bun run build:blob-url && bun run build:runner && bun run build:worker-wrapper",
@@ -16,6 +16,7 @@
16
16
  "format:check": "biome format .",
17
17
  "test:playwright": "playwright test",
18
18
  "test": "bun test tests",
19
+ "test:validate-matrix": "bun run scripts/validate-test-matrix.js",
19
20
  "copy-core-versions": "bun run scripts/copy-core-versions.ts && bun install --ignore-scripts"
20
21
  },
21
22
  "exports": {
@@ -53,20 +54,20 @@
53
54
  "@biomejs/biome": "^1.8.3",
54
55
  "@playwright/test": "^1.50.1",
55
56
  "@tscircuit/capacity-autorouter": "^0.0.100",
56
- "@tscircuit/checks": "^0.0.68",
57
+ "@tscircuit/checks": "^0.0.71",
57
58
  "@tscircuit/circuit-json-flex": "^0.0.3",
58
59
  "@tscircuit/circuit-json-util": "^0.0.65",
59
- "@tscircuit/core": "^0.0.631",
60
+ "@tscircuit/core": "^0.0.641",
60
61
  "@tscircuit/footprinter": "^0.0.208",
61
62
  "@tscircuit/import-snippet": "^0.0.4",
62
63
  "@tscircuit/infgrid-ijump-astar": "^0.0.33",
63
64
  "@tscircuit/layout": "^0.0.28",
64
65
  "@tscircuit/log-soup": "^1.0.2",
65
- "@tscircuit/matchpack": "^0.0.4",
66
+ "@tscircuit/matchpack": "^0.0.9",
66
67
  "@tscircuit/math-utils": "^0.0.18",
67
68
  "@tscircuit/miniflex": "^0.0.4",
68
69
  "@tscircuit/parts-engine": "^0.0.8",
69
- "@tscircuit/props": "^0.0.286",
70
+ "@tscircuit/props": "^0.0.287",
70
71
  "@tscircuit/schematic-autolayout": "^0.0.6",
71
72
  "@tscircuit/schematic-corpus": "^0.0.110",
72
73
  "@tscircuit/schematic-match-adapt": "^0.0.16",
@@ -81,7 +82,7 @@
81
82
  "bun-match-svg": "0.0.12",
82
83
  "calculate-elbow": "^0.0.9",
83
84
  "chokidar-cli": "^3.0.0",
84
- "circuit-json": "^0.0.228",
85
+ "circuit-json": "^0.0.232",
85
86
  "circuit-json-to-bpc": "^0.0.13",
86
87
  "circuit-json-to-connectivity-map": "^0.0.22",
87
88
  "circuit-json-to-simple-3d": "^0.0.6",
@@ -99,7 +100,8 @@
99
100
  "react-dom": "^19.1.0",
100
101
  "schematic-symbols": "^0.0.180",
101
102
  "ts-expect": "^1.3.0",
102
- "tsup": "^8.2.4"
103
+ "tsup": "^8.2.4",
104
+ "minicssgrid": "^0.0.8"
103
105
  },
104
106
  "peerDependencies": {
105
107
  "typescript": "^5.0.0",
@@ -0,0 +1,148 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { readdirSync, statSync, readFileSync } from "fs"
4
+ import { join } from "path"
5
+ import { fileURLToPath } from "url"
6
+ import { dirname } from "path"
7
+
8
+ const __filename = fileURLToPath(import.meta.url)
9
+ const __dirname = dirname(__filename)
10
+
11
+ const testsDir = join(__dirname, "..", "tests")
12
+ const workflowFile = join(
13
+ __dirname,
14
+ "..",
15
+ ".github",
16
+ "workflows",
17
+ "bun-test.yml",
18
+ )
19
+
20
+ // Get all directories in tests/ that contain test files
21
+ function getTestDirectories() {
22
+ const entries = readdirSync(testsDir)
23
+ const testDirs = []
24
+
25
+ for (const entry of entries) {
26
+ const fullPath = join(testsDir, entry)
27
+
28
+ // Skip non-directories
29
+ if (!statSync(fullPath).isDirectory()) continue
30
+
31
+ // Skip hidden directories like .claude
32
+ if (entry.startsWith(".")) continue
33
+
34
+ // Check if directory contains test files
35
+ if (hasTestFiles(fullPath)) {
36
+ testDirs.push(entry)
37
+ }
38
+ }
39
+
40
+ return testDirs.sort()
41
+ }
42
+
43
+ // Check if a directory contains test files (recursively)
44
+ function hasTestFiles(dirPath) {
45
+ try {
46
+ const entries = readdirSync(dirPath)
47
+
48
+ for (const entry of entries) {
49
+ const fullPath = join(dirPath, entry)
50
+ const stat = statSync(fullPath)
51
+
52
+ if (
53
+ stat.isFile() &&
54
+ (entry.endsWith(".test.ts") || entry.endsWith(".test.tsx"))
55
+ ) {
56
+ return true
57
+ }
58
+
59
+ if (stat.isDirectory() && hasTestFiles(fullPath)) {
60
+ return true
61
+ }
62
+ }
63
+
64
+ return false
65
+ } catch (error) {
66
+ console.warn(`Warning: Could not read directory ${dirPath}`)
67
+ return false
68
+ }
69
+ }
70
+
71
+ // Extract test directories from workflow file
72
+ function getWorkflowTestDirectories() {
73
+ const workflowContent = readFileSync(workflowFile, "utf8")
74
+
75
+ // Look for the matrix test-dir configuration
76
+ const matrixMatch = workflowContent.match(/test-dir:\s*\[(.*?)\]/s)
77
+
78
+ if (!matrixMatch) {
79
+ throw new Error(
80
+ "Could not find test-dir matrix configuration in workflow file",
81
+ )
82
+ }
83
+
84
+ const matrixContent = matrixMatch[1]
85
+ const dirs = matrixContent
86
+ .split(",")
87
+ .map((dir) => dir.trim().replace(/['"]/g, ""))
88
+ .filter((dir) => dir.length > 0)
89
+ .sort()
90
+
91
+ return dirs
92
+ }
93
+
94
+ function main() {
95
+ console.log("🔍 Validating test matrix configuration...")
96
+
97
+ const actualTestDirs = getTestDirectories()
98
+ const workflowTestDirs = getWorkflowTestDirectories()
99
+
100
+ console.log(
101
+ `Found ${actualTestDirs.length} test directories:`,
102
+ actualTestDirs,
103
+ )
104
+ console.log(
105
+ `Workflow covers ${workflowTestDirs.length} directories:`,
106
+ workflowTestDirs,
107
+ )
108
+
109
+ const missing = actualTestDirs.filter(
110
+ (dir) => !workflowTestDirs.includes(dir),
111
+ )
112
+ const extra = workflowTestDirs.filter((dir) => !actualTestDirs.includes(dir))
113
+
114
+ if (missing.length > 0) {
115
+ console.error(
116
+ "❌ ERROR: The following test directories are NOT covered by the workflow matrix:",
117
+ )
118
+ for (const dir of missing) {
119
+ console.error(` - ${dir}`)
120
+ }
121
+ console.error(
122
+ "\nPlease add these directories to the test-dir matrix in .github/workflows/bun-test.yml",
123
+ )
124
+ }
125
+
126
+ if (extra.length > 0) {
127
+ console.warn(
128
+ "⚠️ WARNING: The following directories in the workflow matrix do not contain test files:",
129
+ )
130
+ for (const dir of extra) {
131
+ console.warn(` - ${dir}`)
132
+ }
133
+ console.warn(
134
+ "\nConsider removing these from the test-dir matrix in .github/workflows/bun-test.yml",
135
+ )
136
+ }
137
+
138
+ if (missing.length === 0 && extra.length === 0) {
139
+ console.log(
140
+ "✅ All test directories are properly covered by the workflow matrix!",
141
+ )
142
+ process.exit(0)
143
+ } else {
144
+ process.exit(1)
145
+ }
146
+ }
147
+
148
+ main()
@@ -3,7 +3,7 @@ import { expect, test } from "bun:test"
3
3
 
4
4
  test("example1-readme-example", async () => {
5
5
  const circuitWebWorker = await createCircuitWebWorker({
6
- webWorkerUrl: new URL("../webworker/entrypoint.ts", import.meta.url),
6
+ webWorkerUrl: new URL("../../webworker/entrypoint.ts", import.meta.url),
7
7
  })
8
8
 
9
9
  await circuitWebWorker.executeWithFsMap({
@@ -3,7 +3,7 @@ import { expect, test } from "bun:test"
3
3
 
4
4
  test("virtual filesystem with components", async () => {
5
5
  const circuitWebWorker = await createCircuitWebWorker({
6
- webWorkerUrl: new URL("../webworker/entrypoint.ts", import.meta.url),
6
+ webWorkerUrl: new URL("../../webworker/entrypoint.ts", import.meta.url),
7
7
  })
8
8
 
9
9
  await circuitWebWorker.executeWithFsMap({
@@ -1,7 +1,7 @@
1
1
  import { createCircuitWebWorker } from "lib"
2
2
  import { expect, test } from "bun:test"
3
3
  // @ts-ignore
4
- import blobUrl from "../dist/blob-url"
4
+ import blobUrl from "../../dist/blob-url"
5
5
 
6
6
  test("example3-encoded-worker-url", async () => {
7
7
  const circuitWebWorker = await createCircuitWebWorker({
@@ -15,7 +15,7 @@ test(
15
15
  "example4-root-child-issue",
16
16
  async () => {
17
17
  const circuitWebWorker = await createCircuitWebWorker({
18
- webWorkerUrl: new URL("../webworker/entrypoint.ts", import.meta.url),
18
+ webWorkerUrl: new URL("../../webworker/entrypoint.ts", import.meta.url),
19
19
  })
20
20
 
21
21
  await circuitWebWorker.executeWithFsMap({
@@ -4,7 +4,7 @@ import { createCircuitWebWorker } from "lib/index"
4
4
  // Skipped for flakiness, re-enable when flakiness is solved
5
5
  test.skip("example5-event-recording", async () => {
6
6
  const circuitWebWorker = await createCircuitWebWorker({
7
- webWorkerUrl: new URL("../webworker/entrypoint.ts", import.meta.url),
7
+ webWorkerUrl: new URL("../../webworker/entrypoint.ts", import.meta.url),
8
8
  })
9
9
 
10
10
  let eventCount = 0
@@ -3,7 +3,7 @@ import { expect, test } from "bun:test"
3
3
 
4
4
  test("namespace import syntax", async () => {
5
5
  const circuitWebWorker = await createCircuitWebWorker({
6
- webWorkerUrl: new URL("../webworker/entrypoint.ts", import.meta.url),
6
+ webWorkerUrl: new URL("../../webworker/entrypoint.ts", import.meta.url),
7
7
  })
8
8
 
9
9
  await circuitWebWorker.executeWithFsMap({
@@ -39,7 +39,7 @@ test("namespace import syntax", async () => {
39
39
 
40
40
  test("combined default and namespace import with fallback", async () => {
41
41
  const circuitWebWorker = await createCircuitWebWorker({
42
- webWorkerUrl: new URL("../webworker/entrypoint.ts", import.meta.url),
42
+ webWorkerUrl: new URL("../../webworker/entrypoint.ts", import.meta.url),
43
43
  })
44
44
 
45
45
  await circuitWebWorker.executeWithFsMap({
@@ -3,7 +3,7 @@ import { expect, test } from "bun:test"
3
3
 
4
4
  test("example8-footprinter-to220", async () => {
5
5
  const circuitWebWorker = await createCircuitWebWorker({
6
- webWorkerUrl: new URL("../webworker/entrypoint.ts", import.meta.url),
6
+ webWorkerUrl: new URL("../../webworker/entrypoint.ts", import.meta.url),
7
7
  })
8
8
 
9
9
  await circuitWebWorker.execute(`
@@ -3,7 +3,7 @@ import { expect, test } from "bun:test"
3
3
 
4
4
  test("example9-not-defined-component", async () => {
5
5
  const circuitWebWorker = await createCircuitWebWorker({
6
- webWorkerUrl: new URL("../webworker/entrypoint.ts", import.meta.url),
6
+ webWorkerUrl: new URL("../../webworker/entrypoint.ts", import.meta.url),
7
7
  })
8
8
 
9
9
  expect(async () => {
@@ -4,7 +4,7 @@ import type { SourceSimpleResistor } from "circuit-json"
4
4
 
5
5
  test("example13-webworker-without-entrypoint", async () => {
6
6
  const circuitWebWorker = await createCircuitWebWorker({
7
- webWorkerUrl: new URL("../webworker/entrypoint.ts", import.meta.url),
7
+ webWorkerUrl: new URL("../../webworker/entrypoint.ts", import.meta.url),
8
8
  })
9
9
 
10
10
  try {
@@ -4,7 +4,7 @@ import type { SourceComponentBase } from "circuit-json"
4
4
 
5
5
  test("example16-jlc-parts-engine with entrypoint", async () => {
6
6
  const circuitWebWorker = await createCircuitWebWorker({
7
- webWorkerUrl: new URL("../webworker/entrypoint.ts", import.meta.url),
7
+ webWorkerUrl: new URL("../../webworker/entrypoint.ts", import.meta.url),
8
8
  verbose: true,
9
9
  })
10
10
 
@@ -3,7 +3,7 @@ import { expect, test } from "bun:test"
3
3
 
4
4
  test("parse tscircuit.config.js with mainEntrypoint", async () => {
5
5
  const circuitWebWorker = await createCircuitWebWorker({
6
- webWorkerUrl: new URL("../webworker/entrypoint.ts", import.meta.url),
6
+ webWorkerUrl: new URL("../../webworker/entrypoint.ts", import.meta.url),
7
7
  })
8
8
 
9
9
  await circuitWebWorker.executeWithFsMap({
@@ -6,7 +6,7 @@ test("circuit-web-worker-events", async () => {
6
6
  const capturedEvents: string[] = []
7
7
 
8
8
  const circuitWebWorker = await createCircuitWebWorker({
9
- webWorkerUrl: new URL("../webworker/entrypoint.ts", import.meta.url),
9
+ webWorkerUrl: new URL("../../webworker/entrypoint.ts", import.meta.url),
10
10
  })
11
11
 
12
12
  await circuitWebWorker.execute(`
@@ -1,5 +1,6 @@
1
1
  import { describe, it, expect } from "bun:test"
2
- import { createCircuitWebWorker } from "../lib"
2
+ import { createCircuitWebWorker } from "lib"
3
+ import { repoFileUrl } from "tests/fixtures/resourcePaths"
3
4
 
4
5
  describe("fetch override", () => {
5
6
  it("allows worker to fetch via parent and propagates errors", async () => {
@@ -15,8 +16,7 @@ describe("fetch override", () => {
15
16
  globalThis.fetch = fakeFetch as any
16
17
 
17
18
  const worker = await createCircuitWebWorker({
18
- webWorkerUrl: new URL("../dist/webworker/entrypoint.js", import.meta.url)
19
- .href,
19
+ webWorkerUrl: repoFileUrl("dist/webworker/entrypoint.js").href,
20
20
  enableFetchProxy: true,
21
21
  })
22
22
 
@@ -1,11 +1,11 @@
1
1
  import { describe, it, expect } from "bun:test"
2
- import { createCircuitWebWorker } from "../lib"
2
+ import { createCircuitWebWorker } from "lib"
3
+ import { repoFileUrl } from "tests/fixtures/resourcePaths"
3
4
 
4
5
  describe("fetch proxy validation", () => {
5
6
  it("should NOT proxy fetch requests when enableFetchProxy is false (default)", async () => {
6
7
  const worker = await createCircuitWebWorker({
7
- webWorkerUrl: new URL("../dist/webworker/entrypoint.js", import.meta.url)
8
- .href,
8
+ webWorkerUrl: repoFileUrl("dist/webworker/entrypoint.js").href,
9
9
  // enableFetchProxy not set, should default to false
10
10
  })
11
11
 
@@ -31,8 +31,7 @@ fetch("https://example.com/test")
31
31
 
32
32
  it("should proxy fetch requests when enableFetchProxy is true", async () => {
33
33
  const worker = await createCircuitWebWorker({
34
- webWorkerUrl: new URL("../dist/webworker/entrypoint.js", import.meta.url)
35
- .href,
34
+ webWorkerUrl: repoFileUrl("dist/webworker/entrypoint.js").href,
36
35
  enableFetchProxy: true,
37
36
  })
38
37
 
@@ -67,8 +66,7 @@ fetch("https://example.com/test")
67
66
  globalThis.fetch = fakeFetch as any
68
67
 
69
68
  const worker = await createCircuitWebWorker({
70
- webWorkerUrl: new URL("../dist/webworker/entrypoint.js", import.meta.url)
71
- .href,
69
+ webWorkerUrl: repoFileUrl("dist/webworker/entrypoint.js").href,
72
70
  enableFetchProxy: true,
73
71
  })
74
72
 
@@ -1,11 +1,13 @@
1
1
  import { describe, it, expect } from "bun:test"
2
- import { createCircuitWebWorker } from "../lib"
2
+ import { createCircuitWebWorker } from "lib"
3
3
 
4
4
  describe("kill method", () => {
5
5
  it("should immediately terminate the worker", async () => {
6
6
  const worker = await createCircuitWebWorker({
7
- webWorkerUrl: new URL("../dist/webworker/entrypoint.js", import.meta.url)
8
- .href,
7
+ webWorkerUrl: new URL(
8
+ "../../dist/webworker/entrypoint.js",
9
+ import.meta.url,
10
+ ).href,
9
11
  })
10
12
 
11
13
  // Ensure worker is running
@@ -59,7 +59,7 @@ const example2 = {
59
59
 
60
60
  test("example1: Manual edits in entrypoint.tsx file", async () => {
61
61
  const circuitWebWorker = await createCircuitWebWorker({
62
- webWorkerUrl: new URL("../webworker/index.ts", import.meta.url),
62
+ webWorkerUrl: new URL("../../webworker/index.ts", import.meta.url),
63
63
  })
64
64
 
65
65
  await circuitWebWorker.executeWithFsMap({
@@ -89,7 +89,7 @@ test("example1: Manual edits in entrypoint.tsx file", async () => {
89
89
 
90
90
  test("example2: Manual edits in manual-edits.json file", async () => {
91
91
  const circuitWebWorker = await createCircuitWebWorker({
92
- webWorkerUrl: new URL("../webworker/index.ts", import.meta.url),
92
+ webWorkerUrl: new URL("../../webworker/index.ts", import.meta.url),
93
93
  })
94
94
 
95
95
  await circuitWebWorker.executeWithFsMap({
@@ -0,0 +1,3 @@
1
+ export const repoFileUrl = (pathFromRoot: string) => {
2
+ return new URL(`../../${pathFromRoot}`, import.meta.url)
3
+ }
@@ -11,7 +11,7 @@ import {
11
11
  type ExecutionContext,
12
12
  } from "./execution-context"
13
13
  import { importEvalPath } from "./import-eval-path"
14
- import { normalizeFsMap } from "../lib/runner/normalizeFsMap"
14
+ import { normalizeFsMap } from "lib/runner/normalizeFsMap"
15
15
  import type { RootCircuit } from "@tscircuit/core"
16
16
  import { setupDefaultEntrypointIfNeeded } from "lib/runner/setupDefaultEntrypointIfNeeded"
17
17
  import { setupFetchProxy } from "./fetchProxy"