Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
run:
shell: bash
env:
# rslib.config.mts keys the staged `@yuku-parser/binding-*` napi payload
# rslib.config.mts keys the staged `@yuku-core/binding-*` napi payload
# off this variable (`linux-*` → `-gnu`, `alpine-*` → `linux-*-musl`).
VSCE_TARGET: ${{ matrix.vsce-target }}
steps:
Expand All @@ -88,7 +88,7 @@ jobs:
cache-dependency-path: pnpm-lock.yaml

# `supportedArchitectures` must be set BEFORE `pnpm install` so pnpm also
# fetches the cross-target optional `@yuku-parser/binding-*` package.
# fetches the cross-target optional `@yuku-core/binding-*` package.
# musl is always listed so the alpine-* legs get Yuku's `-musl` binding;
# on the glibc Linux legs that is a few extra optional downloads, and the
# macOS/Windows legs are unaffected because pnpm still filters by os.
Expand Down
2 changes: 1 addition & 1 deletion packages/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@
"vscode-jsonrpc": "^8.2.1",
"vscode-languageclient": "^9.0.1",
"webpack-license-plugin": "^4.5.1",
"yuku-parser": "^0.12.0"
"yuku-parser": "^0.19.0"
},
"engines": {
"vscode": "^1.97.0"
Expand Down
17 changes: 9 additions & 8 deletions packages/vscode/rslib.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ const require = createRequire(import.meta.url);
const rootDir = path.dirname(fileURLToPath(import.meta.url));

// The VSIX is platform-targeted for exactly one reason: Rstest's AST test-case
// collection loads the `yuku-parser` napi binding. Everything else in this
// extension is platform neutral (the Rslint Go binary and its napi parser are
// resolved from the project at runtime and never ship in the VSIX).
// collection loads the `yuku-core` napi binding (via `yuku-parser`). Everything
// else in this extension is platform neutral (the Rslint Go binary and its napi
// parser are resolved from the project at runtime and never ship in the VSIX).
// On musl Linux (Alpine), set `VSCE_TARGET=alpine-<arch>` explicitly.
const vsceTarget =
process.env.VSCE_TARGET ?? `${process.platform}-${process.arch}`;
Expand All @@ -21,11 +21,12 @@ const LINUX_LIBC: Record<string, string> = { linux: 'gnu', alpine: 'musl' };
const [targetOs, targetArch] = vsceTarget.split('-');
const libc = LINUX_LIBC[targetOs];
const yukuBindingSuffix = libc ? `linux-${targetArch}-${libc}` : vsceTarget;
const yukuRequire = createRequire(require.resolve('yuku-parser'));
// Yuku computes this package name at runtime, so Rspack cannot discover it.
const yukuBindingPath = yukuRequire.resolve(
`@yuku-parser/binding-${yukuBindingSuffix}`,
const yukuCoreRequire = createRequire(
createRequire(require.resolve('yuku-parser')).resolve('yuku-core'),
);
// Yuku computes this package name at runtime, so Rspack cannot discover it.
const yukuBindingPackage = `@yuku-core/binding-${yukuBindingSuffix}`;
const yukuBindingPath = yukuCoreRequire.resolve(yukuBindingPackage);

/**
* Packages that are always resolved from the user's project at runtime, never
Expand Down Expand Up @@ -69,7 +70,7 @@ const libs: LibConfig[] = [
patterns: [
{
from: yukuBindingPath,
to: `@yuku-parser/binding-${yukuBindingSuffix}/yuku-parser.node`,
to: `${yukuBindingPackage}/${path.basename(yukuBindingPath)}`,
},
{
// The VSIX must carry a LICENSE (`.vscodeignore` keeps it), and
Expand Down
6 changes: 3 additions & 3 deletions packages/vscode/scripts/packageTargets.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Builds and packages one platform-targeted VSIX per supported target.
//
// The extension is platform targeted for a single reason: Rstest's AST test
// collection loads the `yuku-parser` napi binding, which `rslib.config.mts`
// stages into `dist/` based on `VSCE_TARGET`.
// collection loads the `yuku-core` napi binding (via `yuku-parser`), which
// `rslib.config.mts` stages into `dist/` based on `VSCE_TARGET`.
//
// Packaging a target other than the host platform requires the matching
// optional `@yuku-parser/binding-*` package to be installed locally, e.g.:
// optional `@yuku-core/binding-*` package to be installed locally, e.g.:
//
// pnpm config set --location=project --json supportedArchitectures \
// '{"cpu":["current","arm64"]}' && pnpm install
Expand Down
136 changes: 67 additions & 69 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading