Commit 0dc33aa
Building the .vsix per #62 surfaced a wiring defect: PR #58 switched the
compile to `--vscode-extension` codegen, whose auto-glue emits a top-level
`require("@hyperpolymath/affine-vscode")` — an unpublished npm package — while
the repo still routed activation through the hand-written `src/index.cjs` +
vendored `src/affine-vscode-adapter.cjs`. Result: VS Code loaded
`src/index.cjs` -> `require("../out/extension.cjs")` -> MODULE_NOT_FOUND on
`@hyperpolymath/affine-vscode`; the extension crashed on activation.
Fix, using the mechanism affinescript already provides:
- `compile`/`vscode:prepublish`: pass
`--vscode-extension-adapter=../src/affine-vscode-adapter.cjs` so the
auto-glue requires the already-vendored adapter by relative path (no npm
package, resolves offline). `affinescript compile --help` documents this
flag precisely for "vendoring a custom adapter".
- `main`: `./src/index.cjs` -> `./out/extension.cjs` — the directly-loadable
entry the `--vscode-extension` codegen is designed to produce (#58/#105's
stated end-state). `src/index.cjs` is now dead and removed.
- `vscode:prepublish`: no longer shells through `npm run` (repo CLAUDE.md
bans npm) — it is the affinescript invocation directly.
- Add `.vscodeignore` so lockfiles/build noise stay out of the .vsix.
- `.gitignore`: ignore bun/deno lockfiles and the built `*.vsix`
(distributed via GitHub Release, not git), extending the #57 policy.
Verified: `out/extension.cjs` loads standalone; from the packaged .vsix's
bundled tree `extraImports()` returns {Vscode, VscodeLanguageClient} with
only host-provided `vscode` stubbed; `activate`/`deactivate` present.
`my-lang-0.3.0.vsix` (324 files) now packages as a *functional* artifact.
Refs #62
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 0caa014 commit 0dc33aa
5 files changed
Lines changed: 21 additions & 38 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
41 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
42 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
43 | 49 | | |
44 | 50 | | |
45 | 51 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
| 101 | + | |
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
80 | | - | |
| 79 | + | |
| 80 | + | |
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| |||
This file was deleted.
0 commit comments