You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
packages/affine-vscode/mod.js is the JS-side adapter for stdlib/Vscode.affine + stdlib/VscodeLanguageClient.affine. It maps each extern fn to a real vscode / vscode-languageclient/node call and maintains the handle table.
Today the package has no package.json — only mod.js, README.adoc, and deno.json. Consumers outside this repo (currently hyperpolymath/my-lang and hyperpolymath/standards rsr-certifier; soon every other AffineScript-authored VS Code extension) vendor the adapter by copying mod.js into src/affine-vscode-adapter.cjs in their own repo.
Update protocol is implicit. There's no machine-readable version to pin, no changelog the consumer can diff against, no tooling to surface "your vendored copy is N commits behind".
Discoverability. New extension authors find the adapter only by reading existing extensions' source.
Proposed plan
Publish @hyperpolymath/affine-vscode to npm so consumers can npm install @hyperpolymath/affine-vscode and require() the adapter directly. The vendoring step in each extension's src/index.cjs collapses to:
Add packages/affine-vscode/package.json with name: "@hyperpolymath/affine-vscode", main: "./mod.js", an MIT or PMPL license entry matching the repo, peerDependencies: { vscode: "*", "vscode-languageclient": "^9.0.0" }, and a repository.directory field pointing at this subdirectory.
Pick a version (0.1.0 is fine for the first published cut).
Confirm the publishing account / token. The hyperpolymath org doesn't currently have an npm presence — decide whether to publish under that scope (needs the npm org creating) or under a personal scope.
npm publish --access public from packages/affine-vscode/. Add the publish step to a GitHub Actions workflow guarded on a tag pattern so subsequent releases are tag-driven.
Update hyperpolymath/my-lang's vscode-extension and hyperpolymath/standards's rsr-certifier to depend on @hyperpolymath/affine-vscode instead of vendoring; remove their local src/affine-vscode-adapter.cjs files.
Document the consumer pattern in packages/affine-vscode/README.adoc (the existing Usage section already gets close — just needs the vendoring escape hatch removed and the npm-install path made primary).
Acceptance criteria
@hyperpolymath/affine-vscode is resolvable via npm view.
CI publishes new versions automatically on tag push (no manual npm publish after the first one).
my-lang vscode-extension and standards rsr-certifier depend on the published package; their local affine-vscode-adapter.cjs files are removed.
packages/affine-vscode/README.adoc documents the npm-install consumer pattern as primary.
Out of scope
Cutting a major version. 0.x is fine while the binding surface is still growing organically.
Replacing the current module.exports = function (...) factory shape with ESM exports. CJS is what the vscode extension host loads.
Problem
packages/affine-vscode/mod.jsis the JS-side adapter forstdlib/Vscode.affine+stdlib/VscodeLanguageClient.affine. It maps eachextern fnto a realvscode/vscode-languageclient/nodecall and maintains the handle table.Today the package has no
package.json— onlymod.js,README.adoc, anddeno.json. Consumers outside this repo (currentlyhyperpolymath/my-langandhyperpolymath/standardsrsr-certifier; soon every other AffineScript-authored VS Code extension) vendor the adapter by copyingmod.jsintosrc/affine-vscode-adapter.cjsin their own repo.Vendoring works but has clear drawbacks:
mod.jshere requires manual re-sync in every consumer. The bindings PR (feat(vscode-bindings): expand surface for rsr-certifier port (#64) #102) added ~20 new functions; each consumer downstream had to remember to copy them across.Proposed plan
Publish
@hyperpolymath/affine-vscodeto npm so consumers cannpm install @hyperpolymath/affine-vscodeandrequire()the adapter directly. The vendoring step in each extension'ssrc/index.cjscollapses to:Steps
packages/affine-vscode/package.jsonwithname: "@hyperpolymath/affine-vscode",main: "./mod.js", an MIT or PMPL license entry matching the repo,peerDependencies: { vscode: "*", "vscode-languageclient": "^9.0.0" }, and arepository.directoryfield pointing at this subdirectory.0.1.0is fine for the first published cut).hyperpolymathorg doesn't currently have an npm presence — decide whether to publish under that scope (needs the npm org creating) or under a personal scope.npm publish --access publicfrompackages/affine-vscode/. Add the publish step to a GitHub Actions workflow guarded on a tag pattern so subsequent releases are tag-driven.hyperpolymath/my-lang's vscode-extension andhyperpolymath/standards's rsr-certifier to depend on@hyperpolymath/affine-vscodeinstead of vendoring; remove their localsrc/affine-vscode-adapter.cjsfiles.packages/affine-vscode/README.adoc(the existing Usage section already gets close — just needs the vendoring escape hatch removed and the npm-install path made primary).Acceptance criteria
@hyperpolymath/affine-vscodeis resolvable vianpm view.npm publishafter the first one).affine-vscode-adapter.cjsfiles are removed.packages/affine-vscode/README.adocdocuments the npm-install consumer pattern as primary.Out of scope
0.xis fine while the binding surface is still growing organically.module.exports = function (...)factory shape with ESM exports. CJS is what the vscode extension host loads.Related