@tscircuit/eval 0.0.362 → 0.0.364

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 (108) hide show
  1. package/dist/blob-url.js +1 -1
  2. package/dist/webworker/entrypoint.js +120 -120
  3. package/package.json +7 -4
  4. package/.github/workflows/bun-formatcheck.yml +0 -27
  5. package/.github/workflows/bun-pver-release.yml +0 -70
  6. package/.github/workflows/bun-test.yml +0 -87
  7. package/.github/workflows/bun-typecheck.yml +0 -27
  8. package/.github/workflows/playwright.yml +0 -40
  9. package/.github/workflows/update-deps.yml +0 -47
  10. package/.github/workflows/update-tscircuit-core.yml +0 -59
  11. package/biome.json +0 -50
  12. package/browser-tests/browser.test.ts +0 -15
  13. package/browser-tests/browsertest.html +0 -15
  14. package/browser-tests/browsertest.ts +0 -53
  15. package/bunfig.toml +0 -6
  16. package/lib/getPlatformConfig.ts +0 -41
  17. package/lib/getPossibleEntrypointComponentPaths.ts +0 -42
  18. package/lib/index.ts +0 -5
  19. package/lib/runner/CircuitRunner.ts +0 -201
  20. package/lib/runner/index.ts +0 -4
  21. package/lib/runner/normalizeFsMap.ts +0 -20
  22. package/lib/runner/resolveFilePath.ts +0 -90
  23. package/lib/runner/runTscircuitCode.ts +0 -30
  24. package/lib/runner/runTscircuitModule.ts +0 -37
  25. package/lib/runner/setupDefaultEntrypointIfNeeded.ts +0 -81
  26. package/lib/shared/static-asset-extensions.ts +0 -10
  27. package/lib/shared/types.ts +0 -79
  28. package/lib/utils/dirname.ts +0 -21
  29. package/lib/utils/get-imports-from-code.ts +0 -23
  30. package/lib/utils/index.ts +0 -1
  31. package/lib/utils/resolve-node-module.ts +0 -193
  32. package/lib/worker.ts +0 -246
  33. package/playwright.config.ts +0 -23
  34. package/scripts/build-worker-blob-url.ts +0 -27
  35. package/scripts/copy-core-versions.ts +0 -81
  36. package/scripts/validate-test-matrix.js +0 -148
  37. package/tests/circuit-runner/circuitrunner1-readme-example.test.tsx +0 -29
  38. package/tests/custom-component-with-fsmap/should-reject-invalid-main-component-path.test.ts +0 -26
  39. package/tests/custom-component-with-fsmap/should-render-multiple-components-from-fsmap.test.ts +0 -46
  40. package/tests/custom-component-with-fsmap/should-render-single-component-from-fsmap.test.ts +0 -38
  41. package/tests/examples/__snapshots__/example18-kicad-footprint-server.snap.svg +0 -1
  42. package/tests/examples/example01-readme-example.test.tsx +0 -30
  43. package/tests/examples/example02-multiple-files.test.tsx +0 -45
  44. package/tests/examples/example03-encoded-url.test.tsx +0 -28
  45. package/tests/examples/example04-root-child-issue.test.tsx +0 -37
  46. package/tests/examples/example05-event-recording.test.tsx +0 -44
  47. package/tests/examples/example06-dynamic-load-blob-url.test.tsx +0 -29
  48. package/tests/examples/example07-import-default-and-namespace.test.tsx +0 -74
  49. package/tests/examples/example08-footprinter-to220.test.tsx +0 -30
  50. package/tests/examples/example09-not-defined-component.test.tsx +0 -24
  51. package/tests/examples/example10-run-tscircuit-code.test.tsx +0 -14
  52. package/tests/examples/example11-flexible-import-extensions.test.tsx +0 -20
  53. package/tests/examples/example12-import-from-subdirectory.test.tsx +0 -26
  54. package/tests/examples/example13-webworker-without-entrypoint.test.tsx +0 -32
  55. package/tests/examples/example14-run-tscircuit-module.test.tsx +0 -20
  56. package/tests/examples/example15-run-tscircuit-module-with-props.test.tsx +0 -24
  57. package/tests/examples/example16-parts-engine.test.tsx +0 -118
  58. package/tests/examples/example17-parse-tscircuit-config.test.tsx +0 -49
  59. package/tests/examples/example18-kicad-footprint-server.test.tsx +0 -39
  60. package/tests/examples/example19-support-backwards-compat.test.tsx +0 -31
  61. package/tests/examples/example20-kicad-import.test.tsx +0 -48
  62. package/tests/features/circuit-event-forwarding.test.tsx +0 -45
  63. package/tests/features/enable-debug.test.ts +0 -26
  64. package/tests/features/execute-component-runner.test.tsx +0 -47
  65. package/tests/features/execute-component-worker.test.tsx +0 -25
  66. package/tests/features/fetch-proxy/fetch-override.test.ts +0 -46
  67. package/tests/features/fetch-proxy/fetch-proxy-validation.test.ts +0 -95
  68. package/tests/features/kill.test.ts +0 -24
  69. package/tests/features/manual-edits.test.tsx +0 -118
  70. package/tests/features/npm-import.test.tsx +0 -47
  71. package/tests/features/parent-directory-import.test.tsx +0 -26
  72. package/tests/features/platform-config.test.tsx +0 -23
  73. package/tests/features/prioritize-default-export.test.tsx +0 -27
  74. package/tests/features/project-config.test.tsx +0 -25
  75. package/tests/features/static-file-imports/static-file-import.test.ts +0 -50
  76. package/tests/fixtures/preload.ts +0 -10
  77. package/tests/fixtures/resourcePaths.ts +0 -3
  78. package/tests/node-resolution/node-module-resolution-1.test.tsx +0 -32
  79. package/tests/node-resolution/node-module-resolution-10.test.tsx +0 -30
  80. package/tests/node-resolution/node-module-resolution-11.test.tsx +0 -41
  81. package/tests/node-resolution/node-module-resolution-2.test.tsx +0 -33
  82. package/tests/node-resolution/node-module-resolution-3.test.tsx +0 -38
  83. package/tests/node-resolution/node-module-resolution-4.test.tsx +0 -29
  84. package/tests/node-resolution/node-module-resolution-5.test.tsx +0 -38
  85. package/tests/node-resolution/node-module-resolution-6.test.tsx +0 -40
  86. package/tests/node-resolution/node-module-resolution-7.test.tsx +0 -43
  87. package/tests/node-resolution/node-module-resolution-8.test.tsx +0 -32
  88. package/tests/node-resolution/node-module-resolution-9.test.tsx +0 -29
  89. package/tests/node-resolution/node-modules-resolution-12.test.tsx +0 -30
  90. package/tests/repros/group-wrapper.test.tsx +0 -18
  91. package/tests/repros/nine-keyboard-default-export.test.tsx +0 -26
  92. package/tests/util-fns/get-imports-from-code.test.tsx +0 -93
  93. package/tests/util-fns/getPossibleEntrypointComponentPaths.test.ts +0 -35
  94. package/tsconfig.json +0 -34
  95. package/tsup-lib.config.ts +0 -11
  96. package/tsup-runner.config.ts +0 -12
  97. package/tsup-webworker.config.ts +0 -21
  98. package/webworker/entrypoint.ts +0 -227
  99. package/webworker/eval-compiled-js.ts +0 -61
  100. package/webworker/execution-context.ts +0 -64
  101. package/webworker/fetchProxy.ts +0 -83
  102. package/webworker/import-eval-path.ts +0 -78
  103. package/webworker/import-local-file.ts +0 -93
  104. package/webworker/import-node-module.ts +0 -54
  105. package/webworker/import-npm-package.ts +0 -77
  106. package/webworker/import-snippet.ts +0 -30
  107. package/webworker/index.ts +0 -1
  108. package/webworker/transform-with-sucrase.ts +0 -68
package/package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "name": "@tscircuit/eval",
3
3
  "main": "dist/lib/index.js",
4
- "version": "0.0.362",
4
+ "version": "0.0.364",
5
5
  "type": "module",
6
+ "files": [
7
+ "dist"
8
+ ],
6
9
  "scripts": {
7
10
  "build": "bun run build:lib && bun run build:webworker && bun run build:blob-url && bun run build:runner && bun run build:worker-wrapper",
8
11
  "build:lib": "tsup-node --config tsup-lib.config.ts",
@@ -56,7 +59,7 @@
56
59
  "@tscircuit/checks": "^0.0.79",
57
60
  "@tscircuit/circuit-json-flex": "^0.0.3",
58
61
  "@tscircuit/circuit-json-util": "^0.0.67",
59
- "@tscircuit/core": "^0.0.761",
62
+ "@tscircuit/core": "^0.0.762",
60
63
  "@tscircuit/footprinter": "^0.0.236",
61
64
  "@tscircuit/import-snippet": "^0.0.4",
62
65
  "@tscircuit/infgrid-ijump-astar": "^0.0.33",
@@ -65,7 +68,7 @@
65
68
  "@tscircuit/math-utils": "^0.0.21",
66
69
  "@tscircuit/miniflex": "^0.0.4",
67
70
  "@tscircuit/parts-engine": "^0.0.11",
68
- "@tscircuit/props": "0.0.343",
71
+ "@tscircuit/props": "0.0.346",
69
72
  "@tscircuit/schematic-autolayout": "^0.0.6",
70
73
  "@tscircuit/schematic-match-adapt": "^0.0.16",
71
74
  "@tscircuit/schematic-trace-solver": "^0.0.40",
@@ -79,7 +82,7 @@
79
82
  "bun-match-svg": "0.0.12",
80
83
  "calculate-elbow": "^0.0.12",
81
84
  "chokidar-cli": "^3.0.0",
82
- "circuit-json": "^0.0.267",
85
+ "circuit-json": "^0.0.268",
83
86
  "circuit-json-to-bpc": "^0.0.13",
84
87
  "circuit-json-to-connectivity-map": "^0.0.22",
85
88
  "circuit-json-to-simple-3d": "^0.0.9",
@@ -1,27 +0,0 @@
1
- # Created using @tscircuit/plop (npm install -g @tscircuit/plop)
2
- name: Format Check
3
-
4
- on:
5
- push:
6
- branches: [main]
7
- pull_request:
8
- branches: [main]
9
-
10
- jobs:
11
- format-check:
12
- runs-on: ubuntu-latest
13
- if: "${{ github.event_name != 'pull_request' || github.event.pull_request.title != 'chore: bump version' }}"
14
-
15
- steps:
16
- - uses: actions/checkout@v4
17
-
18
- - name: Setup bun
19
- uses: oven-sh/setup-bun@v2
20
- with:
21
- bun-version: latest
22
-
23
- - name: Install dependencies
24
- run: bun install
25
-
26
- - name: Run format check
27
- run: bun run format:check
@@ -1,70 +0,0 @@
1
- # Created using @tscircuit/plop (npm install -g @tscircuit/plop)
2
- name: Publish to npm
3
- on:
4
- push:
5
- branches:
6
- - main
7
- workflow_dispatch:
8
-
9
- env:
10
- UPSTREAM_REPOS: "runframe" # for example: "eval,runframe"
11
- PACKAGE_NAMES: "@tscircuit/eval" # comma-separated list, e.g. "@tscircuit/core,@tscircuit/props"
12
-
13
- jobs:
14
- publish:
15
- runs-on: ubuntu-latest
16
- steps:
17
- - uses: actions/checkout@v4
18
- with:
19
- token: ${{ secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }}
20
- - name: Setup bun
21
- uses: oven-sh/setup-bun@v2
22
- with:
23
- bun-version: latest
24
- - uses: actions/setup-node@v4
25
- with:
26
- node-version: 22
27
- registry-url: https://registry.npmjs.org/
28
- - run: npm install -g pver
29
- - run: bun install --frozen-lockfile
30
- - run: bun run build
31
- - run: pver release --no-push-main
32
- env:
33
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
34
- GITHUB_TOKEN: ${{ secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }}
35
-
36
- - name: Create Pull Request
37
- id: create-pr
38
- uses: peter-evans/create-pull-request@v5
39
- with:
40
- commit-message: "chore: bump version"
41
- title: "chore: bump version"
42
- body: "Automated package update"
43
- branch: bump-version-${{ github.run_number }}
44
- base: main
45
- token: ${{ secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }}
46
- committer: tscircuitbot <githubbot@tscircuit.com>
47
- author: tscircuitbot <githubbot@tscircuit.com>
48
-
49
- - name: Enable auto-merge
50
- if: steps.create-pr.outputs.pull-request-number != ''
51
- run: |
52
- gh pr merge ${{ steps.create-pr.outputs.pull-request-number }} --auto --squash --delete-branch
53
- env:
54
- GH_TOKEN: ${{ secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }}
55
-
56
- - name: Trigger upstream repo updates
57
- if: env.UPSTREAM_REPOS && env.PACKAGE_NAMES
58
- run: |
59
- IFS=',' read -ra REPOS <<< "${{ env.UPSTREAM_REPOS }}"
60
- for repo in "${REPOS[@]}"; do
61
- if [[ -n "$repo" ]]; then
62
- echo "Triggering update for repo: $repo"
63
- curl -X POST \
64
- -H "Accept: application/vnd.github.v3+json" \
65
- -H "Authorization: token ${{ secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }}" \
66
- -H "Content-Type: application/json" \
67
- "https://api.github.com/repos/tscircuit/$repo/actions/workflows/update-package.yml/dispatches" \
68
- -d "{\"ref\":\"main\",\"inputs\":{\"package_names\":\"${{ env.PACKAGE_NAMES }}\"}}"
69
- fi
70
- done
@@ -1,87 +0,0 @@
1
- # Created using @tscircuit/plop (npm install -g @tscircuit/plop)
2
- name: Bun Test
3
-
4
- on:
5
- pull_request:
6
-
7
- env:
8
- SKIP_PR_TITLE: "chore: bump version"
9
-
10
- jobs:
11
- validate-test-matrix:
12
- runs-on: ubuntu-latest
13
- steps:
14
- - name: Check if should skip
15
- id: should-skip
16
- run: |
17
- if [[ "${{ github.event.pull_request.title }}" == "${{ env.SKIP_PR_TITLE }}" ]]; then
18
- echo "Skipping validation - this is a version bump PR"
19
- exit 0
20
- fi
21
-
22
- - name: Checkout code
23
- if: github.event.pull_request.title != env.SKIP_PR_TITLE
24
- uses: actions/checkout@v4
25
-
26
- - name: Setup bun
27
- if: github.event.pull_request.title != env.SKIP_PR_TITLE
28
- uses: oven-sh/setup-bun@v2
29
- with:
30
- bun-version: latest
31
-
32
- - name: Validate test matrix covers all directories
33
- if: github.event.pull_request.title != env.SKIP_PR_TITLE
34
- run: bun run scripts/validate-test-matrix.js
35
-
36
- test:
37
- runs-on: ubuntu-latest
38
- timeout-minutes: 5
39
- needs: validate-test-matrix
40
- strategy:
41
- matrix:
42
- test-dir: [circuit-runner, custom-component-with-fsmap, examples, features, node-resolution, repros, util-fns]
43
-
44
- steps:
45
- - name: Check if should skip
46
- id: should-skip
47
- run: |
48
- if [[ "${{ github.event.pull_request.title }}" == "${{ env.SKIP_PR_TITLE }}" ]]; then
49
- echo "Skipping tests - this is a version bump PR"
50
- exit 0
51
- fi
52
-
53
- - name: Checkout code
54
- if: github.event.pull_request.title != env.SKIP_PR_TITLE
55
- uses: actions/checkout@v4
56
-
57
- - name: Setup bun
58
- if: github.event.pull_request.title != env.SKIP_PR_TITLE
59
- uses: oven-sh/setup-bun@v2
60
- with:
61
- bun-version: latest
62
-
63
- - name: Install dependencies
64
- if: github.event.pull_request.title != env.SKIP_PR_TITLE
65
- run: bun install
66
-
67
- - name: Build project
68
- if: github.event.pull_request.title != env.SKIP_PR_TITLE
69
- run: bun run build
70
-
71
- - name: Run tests for ${{ matrix.test-dir }}
72
- if: github.event.pull_request.title != env.SKIP_PR_TITLE
73
- run: |
74
- set +e
75
- for i in 1 2 3 4; do
76
- bun test tests/${{ matrix.test-dir }} --timeout 30000
77
- code=$?
78
- if [ $code -eq 0 ]; then
79
- exit 0
80
- fi
81
- if [ $code -ne 139 ]; then
82
- exit $code
83
- fi
84
- echo "Segmentation fault detected, retrying ($i/4)..."
85
- done
86
- echo "Tests failed due to segmentation fault after 4 attempts."
87
- exit 139
@@ -1,27 +0,0 @@
1
- # Created using @tscircuit/plop (npm install -g @tscircuit/plop)
2
- name: Type Check
3
-
4
- on:
5
- push:
6
- branches: [main]
7
- pull_request:
8
- branches: [main]
9
-
10
- jobs:
11
- type-check:
12
- runs-on: ubuntu-latest
13
- if: "${{ github.event_name != 'pull_request' || github.event.pull_request.title != 'chore: bump version' }}"
14
-
15
- steps:
16
- - uses: actions/checkout@v4
17
-
18
- - name: Setup bun
19
- uses: oven-sh/setup-bun@v2
20
- with:
21
- bun-version: latest
22
-
23
- - name: Install dependencies
24
- run: bun i
25
-
26
- - name: Run type check
27
- run: bunx tsc --noEmit
@@ -1,40 +0,0 @@
1
- name: Playwright Tests
2
-
3
- on:
4
- push:
5
- branches: [ main ]
6
- pull_request:
7
- branches: [ main ]
8
-
9
- jobs:
10
- test:
11
- timeout-minutes: 60
12
- runs-on: ubuntu-latest
13
- if: "${{ github.event_name != 'pull_request' || github.event.pull_request.title != 'chore: bump version' }}"
14
- steps:
15
- - uses: actions/checkout@v4
16
-
17
- - name: Setup Bun
18
- uses: oven-sh/setup-bun@v2
19
- with:
20
- bun-version: latest
21
-
22
- - name: Install dependencies
23
- run: bun install
24
-
25
- - name: Install Playwright browsers
26
- run: bunx playwright install --with-deps chromium
27
-
28
- - name: Build
29
- run: bun run build
30
-
31
- - name: Run Playwright tests
32
- run: bun run test:playwright
33
-
34
- - name: Upload Playwright report
35
- uses: actions/upload-artifact@v4
36
- if: always()
37
- with:
38
- name: playwright-report
39
- path: playwright-report/
40
- retention-days: 30
@@ -1,47 +0,0 @@
1
- name: Update Dependencies
2
-
3
- on:
4
- schedule:
5
- - cron: "0 15 * * *" # 8 AM PT (15:00 UTC)
6
- workflow_dispatch:
7
-
8
- jobs:
9
- update-deps:
10
- runs-on: ubuntu-latest
11
- steps:
12
- - name: Checkout repository
13
- uses: actions/checkout@v4
14
- with:
15
- token: ${{ secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }}
16
-
17
- - name: Setup Bun
18
- uses: oven-sh/setup-bun@v1
19
- with:
20
- bun-version: latest
21
-
22
- - name: Configure git
23
- run: |
24
- git config --global user.name "tscircuitbot"
25
- git config --global user.email "bot@tscircuit.com"
26
-
27
- - name: Update specific dependencies
28
- run: |
29
- bun update --latest @tscircuit/core @tscircuit/cli @tscircuit/eval
30
-
31
- - name: Run copy-core-versions script
32
- run: bun run copy-core-versions
33
-
34
- - name: Check for changes
35
- id: git-check
36
- run: |
37
- git diff --exit-code || echo "changes=true" >> $GITHUB_OUTPUT
38
-
39
- - name: Commit and push changes
40
- if: steps.git-check.outputs.changes == 'true'
41
- run: |
42
- git add .
43
- git commit -m "chore: update @tscircuit dependencies
44
-
45
- 🤖 Generated with automated dependency updater"
46
- git push origin main
47
-
@@ -1,59 +0,0 @@
1
- name: Update @tscircuit/core
2
-
3
- on:
4
- workflow_dispatch:
5
-
6
- jobs:
7
- update-core:
8
- runs-on: ubuntu-latest
9
-
10
- steps:
11
- - name: Checkout code
12
- uses: actions/checkout@v4
13
-
14
- - name: Setup Bun
15
- uses: oven-sh/setup-bun@v2
16
-
17
- - name: Close existing PRs
18
- run: |
19
- gh pr list --repo ${{ github.repository }} --state open --json number,title --jq '.[] | select(.title | contains("update @tscircuit/core")) | .number' | xargs -I{} gh pr close {} --comment "Closing in favor of a new update PR"
20
- env:
21
- GH_TOKEN: ${{ secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }}
22
-
23
- - name: Update @tscircuit/core
24
- run: bun update --latest @tscircuit/core
25
-
26
- - name: Copy core dependencies (update to versions that core uses)
27
- run: bun scripts/copy-core-versions.ts
28
-
29
- - name: Get new version
30
- id: get-version
31
- run: |
32
- NEW_VERSION=$(node -e "console.log(require('./package.json').devDependencies['@tscircuit/core'].replace(/^\^/, ''))")
33
- echo "new_version=${NEW_VERSION}" >> $GITHUB_OUTPUT
34
-
35
- - name: Check for changes
36
- id: git-check
37
- run: |
38
- git diff --exit-code || echo "changes=true" >> $GITHUB_OUTPUT
39
-
40
- - name: Create Pull Request
41
- if: steps.git-check.outputs.changes == 'true'
42
- id: create-pr
43
- uses: peter-evans/create-pull-request@v5
44
- with:
45
- commit-message: "chore: update packages ${{ env.PACKAGE_NAMES }}"
46
- title: "chore: update packages ${{ env.PACKAGE_NAMES }}"
47
- body: "Automated package update"
48
- branch: update-packages-${{ github.run_number }}
49
- base: main
50
- token: ${{ secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }}
51
- committer: tscircuitbot <githubbot@tscircuit.com>
52
- author: tscircuitbot <githubbot@tscircuit.com>
53
-
54
- - name: Enable auto-merge with CI checks
55
- if: steps.create-pr.outputs.pull-request-number != ''
56
- run: |
57
- gh pr merge ${{ steps.create-pr.outputs.pull-request-number }} --auto --squash --delete-branch
58
- env:
59
- GH_TOKEN: ${{ secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }}
package/biome.json DELETED
@@ -1,50 +0,0 @@
1
- {
2
- "$schema": "https://biomejs.dev/schemas/1.9.3/schema.json",
3
- "organizeImports": {
4
- "enabled": true
5
- },
6
- "formatter": {
7
- "enabled": true,
8
- "indentStyle": "space"
9
- },
10
- "files": {
11
- "ignore": ["cosmos-export", "dist", "package.json"]
12
- },
13
- "javascript": {
14
- "formatter": {
15
- "jsxQuoteStyle": "double",
16
- "quoteProperties": "asNeeded",
17
- "trailingCommas": "all",
18
- "semicolons": "asNeeded",
19
- "arrowParentheses": "always",
20
- "bracketSpacing": true,
21
- "bracketSameLine": false
22
- }
23
- },
24
- "linter": {
25
- "enabled": true,
26
- "rules": {
27
- "recommended": true,
28
- "suspicious": {
29
- "noExplicitAny": "off"
30
- },
31
- "complexity": {
32
- "noForEach": "info"
33
- },
34
- "style": {
35
- "noUselessElse": "off",
36
- "noNonNullAssertion": "off",
37
- "useNumberNamespace": "off",
38
- "noParameterAssign": "off",
39
- "useFilenamingConvention": {
40
- "level": "error",
41
- "options": {
42
- "strictCase": true,
43
- "requireAscii": true,
44
- "filenameCases": ["kebab-case", "export"]
45
- }
46
- }
47
- }
48
- }
49
- }
50
- }
@@ -1,15 +0,0 @@
1
- import { test, expect } from "@playwright/test"
2
- import { spawn } from "node:child_process"
3
-
4
- test("browser test server shows Success", async ({ page }) => {
5
- // Wait for server to start
6
- await new Promise((resolve) => setTimeout(resolve, 1000))
7
-
8
- // Navigate to the page
9
- await page.goto("http://localhost:3070")
10
-
11
- // Wait for the success message or timeout
12
- await expect(page.locator("#output")).toContainText("Success", {
13
- timeout: 10000,
14
- })
15
- })
@@ -1,15 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Test Server</title>
7
- </head>
8
- <body>
9
- <h1>Browser Test for @tscircuit/eval. Wait for message below</h1>
10
- <div id="output">loading...</div>
11
-
12
- <script src="./browsertest.ts"></script>
13
-
14
- </body>
15
- </html>
@@ -1,53 +0,0 @@
1
- import { createCircuitWebWorker } from "lib/worker"
2
- // @ts-ignore
3
- import blobUrl from "../dist/blob-url"
4
-
5
- async function runTest() {
6
- try {
7
- // Create a circuit web worker
8
- console.log("creating worker...")
9
- console.log("blobUrl", blobUrl)
10
- const circuitWebWorker = await createCircuitWebWorker({
11
- webWorkerBlobUrl: blobUrl,
12
- verbose: true,
13
- })
14
-
15
- console.log("asking for version...")
16
- const version = await circuitWebWorker.version()
17
- console.log("version", version)
18
-
19
- // Execute some example circuit code
20
- await circuitWebWorker.execute(`
21
- circuit.add(
22
- <board width="10mm" height="10mm">
23
- <resistor name="R1" resistance="1k" footprint="0402" />
24
- </board>
25
- )
26
- `)
27
-
28
- // Wait for rendering to complete
29
- await circuitWebWorker.renderUntilSettled()
30
-
31
- // Get the circuit JSON
32
- const circuitJson = await circuitWebWorker.getCircuitJson()
33
-
34
- // Validate the circuit elements
35
- const resistor = circuitJson.find((el: any) => el.name === "R1")
36
-
37
- if (resistor && resistor.type === "source_component") {
38
- document.getElementById("output")!.textContent =
39
- "Success: Resistor found and valid"
40
- console.log("Test succeeded:", resistor)
41
- } else {
42
- document.getElementById("output")!.textContent =
43
- "Fail: Resistor not found or invalid"
44
- console.error("Test failed: Resistor not found or invalid")
45
- }
46
- } catch (error) {
47
- document.getElementById("output")!.textContent = "Fail: Test error occurred"
48
- console.error("Test failed with error:", error)
49
- }
50
- }
51
-
52
- // Run the test when the page loads
53
- window.addEventListener("DOMContentLoaded", runTest)
package/bunfig.toml DELETED
@@ -1,6 +0,0 @@
1
- [install.lockfile]
2
- save = false
3
-
4
- [test]
5
- root = "./tests"
6
- preload = ["./tests/fixtures/preload.ts"]
@@ -1,41 +0,0 @@
1
- import type { PlatformConfig } from "@tscircuit/props"
2
- import { jlcPartsEngine } from "@tscircuit/parts-engine"
3
- import { parseKicadModToCircuitJson } from "kicad-component-converter"
4
- const KICAD_FOOTPRINT_CACHE_URL = "https://kicad-mod-cache.tscircuit.com"
5
-
6
- export const getPlatformConfig = (): PlatformConfig => ({
7
- partsEngine: jlcPartsEngine,
8
- footprintLibraryMap: {
9
- kicad: async (footprintName: string) => {
10
- const baseUrl = `${KICAD_FOOTPRINT_CACHE_URL}/${footprintName}`
11
- const circuitJsonUrl = `${baseUrl}.circuit.json`
12
- const res = await fetch(circuitJsonUrl)
13
- const raw = await res.json()
14
- // Filter pcb_silkscreen_text to only keep entries with text === "REF**"
15
- // Apply filtering only to elements coming from the kicad_mod_server response
16
- const filtered = Array.isArray(raw)
17
- ? raw.filter((el) =>
18
- el?.type === "pcb_silkscreen_text" ? el?.text === "REF**" : true,
19
- )
20
- : raw
21
- const wrlUrl = `${baseUrl}.wrl`
22
- return {
23
- footprintCircuitJson: filtered,
24
- cadModel: { wrlUrl, modelUnitToMmScale: 2.54 },
25
- }
26
- },
27
- },
28
- footprintFileParserMap: {
29
- kicad_mod: {
30
- loadFromUrl: async (url: string) => {
31
- const kicadContent = await fetch(url).then((res) => res.text())
32
- const kicadJson = await parseKicadModToCircuitJson(kicadContent)
33
- return {
34
- footprintCircuitJson: Array.isArray(kicadJson)
35
- ? kicadJson
36
- : [kicadJson],
37
- }
38
- },
39
- },
40
- },
41
- })
@@ -1,42 +0,0 @@
1
- import { normalizeFilePath } from "./runner/normalizeFsMap"
2
-
3
- export const getPossibleEntrypointComponentPaths = (
4
- fsMap: Record<string, string>,
5
- ): string[] => {
6
- const normalizedFsMap: Record<string, string> = {}
7
- for (const [path, content] of Object.entries(fsMap)) {
8
- normalizedFsMap[normalizeFilePath(path)] = content
9
- }
10
-
11
- const possible = new Set<string>()
12
-
13
- if ("tscircuit.config.json" in normalizedFsMap) {
14
- try {
15
- const config = JSON.parse(normalizedFsMap["tscircuit.config.json"])
16
- if (typeof config.mainEntrypoint === "string") {
17
- possible.add(normalizeFilePath(config.mainEntrypoint))
18
- }
19
- } catch {
20
- /* ignore */
21
- }
22
- }
23
-
24
- if (normalizedFsMap["index.tsx"]) possible.add("index.tsx")
25
- if (normalizedFsMap["index.ts"]) possible.add("index.ts")
26
-
27
- const circuitFiles = Object.keys(normalizedFsMap).filter((k) =>
28
- k.endsWith(".circuit.tsx"),
29
- )
30
- for (const file of circuitFiles) {
31
- possible.add(file)
32
- }
33
-
34
- const tsxFiles = Object.keys(normalizedFsMap).filter((k) =>
35
- k.endsWith(".tsx"),
36
- )
37
- if (tsxFiles.length === 1) {
38
- possible.add(tsxFiles[0])
39
- }
40
-
41
- return Array.from(possible)
42
- }
package/lib/index.ts DELETED
@@ -1,5 +0,0 @@
1
- export * from "./runner"
2
- export * from "./worker"
3
- export * from "./getPossibleEntrypointComponentPaths"
4
- export * from "./getPlatformConfig"
5
- export * from "./shared/static-asset-extensions"