@gjsify/rolldown-plugin-gjsify 0.64.1-next.243 → 0.64.1-next.244

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.
@@ -47,6 +47,19 @@ export interface WorkspaceImportGuardOptions {
47
47
  * `@gjsify/tsc/bundle` from the project first and the running CLI second for
48
48
  * exactly this reason; `tests/e2e/node-free-bootstrap` states that invariant.
49
49
  *
50
+ * TWO PROBES, in order. First the anchor itself. If that returns null, the
51
+ * `@gjsify/node-polyfills` package.json as seen from the anchor, used as the
52
+ * importer of a third resolve. The CLI does not depend on `@gjsify/module`,
53
+ * `fs`, `path`… directly: `@gjsify/node-polyfills` is the dependency that
54
+ * declares every Node substitution. A full install hoists them to the root,
55
+ * where the CLI file sees them by accident; a focused or partial install
56
+ * (`gjsify install --focus`, version conflicts) leaves them nested under
57
+ * `node_modules/@gjsify/node-polyfills/node_modules`, invisible from the CLI
58
+ * file. Measured: Learn6502's Flatpak build could not bundle `@mdx-js/rollup`
59
+ * (`cannot resolve @gjsify/module`, the substitution for `node:module`).
60
+ * `@gjsify/web-polyfills` is not a probe: the CLI depends on it directly, so
61
+ * the browser target's substitutions already resolve from the anchor.
62
+ *
50
63
  * PROJECT FIRST, ALWAYS: consulted only after normal resolution returns
51
64
  * null, so a workspace that HAS the package keeps using it and nothing about
52
65
  * a warm tree changes. A project resolve that ERRORED is not a null and is
@@ -24,6 +24,7 @@ import { dirname } from 'node:path';
24
24
  const OWN_PROBE = 'gjsify-unresolved-workspace-import/probe';
25
25
  /** Bare `@gjsify/*` package specifier — the workspace edge this guard protects. */
26
26
  const WORKSPACE_SCOPE = '@gjsify/';
27
+ const NODE_POLYFILLS = '@gjsify/node-polyfills';
27
28
  /**
28
29
  * How many reverse-looked-up source specifiers the error may name before the
29
30
  * list stops being evidence and becomes noise. A per-builtin target inverts to
@@ -278,11 +279,19 @@ export function unresolvedWorkspaceImportPlugin(options) {
278
279
  // package, and rescuing there would turn "project first, always" into
279
280
  // "project first unless the project errors".
280
281
  if (resolverFailure === undefined && toolchainAnchor !== undefined) {
281
- const fromToolchain = await this.resolve(verdict.candidate, toolchainAnchor, {
282
- skipSelf: true,
283
- kind,
284
- custom: { [OWN_PROBE]: true },
285
- });
282
+ const probe = { skipSelf: true, kind, custom: { [OWN_PROBE]: true } };
283
+ let fromToolchain = await this.resolve(verdict.candidate, toolchainAnchor, probe);
284
+ let foundVia = toolchainAnchor;
285
+ if (!fromToolchain) {
286
+ // Second probe, from `@gjsify/node-polyfills` — see `toolchainAnchor`.
287
+ // `package.json` is the one subpath it always exports, so it names the
288
+ // package's real install directory whatever the layout.
289
+ const polyfills = await this.resolve(`${NODE_POLYFILLS}/package.json`, toolchainAnchor, probe);
290
+ if (polyfills) {
291
+ fromToolchain = await this.resolve(verdict.candidate, polyfills.id, probe);
292
+ foundVia = polyfills.id;
293
+ }
294
+ }
286
295
  if (fromToolchain) {
287
296
  // The one visible trace that this artifact is MIXED — some of its
288
297
  // `@gjsify/*` from the project, this one from the CLI's own
@@ -292,7 +301,7 @@ export function unresolvedWorkspaceImportPlugin(options) {
292
301
  // `resolvedCache`: one line per (candidate, importer dir, kind).
293
302
  this.warn(`gjsify: \`${verdict.candidate}\` did not resolve from the project ` +
294
303
  `(imported by ${importer ?? '<entry>'}) — using the copy installed beside the ` +
295
- `running CLI (${toolchainAnchor}). Build the workspace package to use the ` +
304
+ `running CLI (${foundVia}). Build the workspace package to use the ` +
296
305
  `project's own copy.`);
297
306
  resolvedCache.set(key, fromToolchain);
298
307
  return fromToolchain;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/rolldown-plugin-gjsify",
3
- "version": "0.64.1-next.243",
3
+ "version": "0.64.1-next.244",
4
4
  "description": "Rolldown / Rollup / Vite plugin orchestrator for GJS, Node, and Browser targets",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -63,12 +63,12 @@
63
63
  ],
64
64
  "license": "MIT",
65
65
  "dependencies": {
66
- "@gjsify/console": "0.64.1-next.243",
67
- "@gjsify/resolve-npm": "0.64.1-next.243",
68
- "@gjsify/rolldown-plugin-deepkit": "0.64.1-next.243",
69
- "@gjsify/rolldown-plugin-pnp": "0.64.1-next.243",
70
- "@gjsify/utils": "0.64.1-next.243",
71
- "@gjsify/vite-plugin-blueprint": "0.64.1-next.243",
66
+ "@gjsify/console": "0.64.1-next.244",
67
+ "@gjsify/resolve-npm": "0.64.1-next.244",
68
+ "@gjsify/rolldown-plugin-deepkit": "0.64.1-next.244",
69
+ "@gjsify/rolldown-plugin-pnp": "0.64.1-next.244",
70
+ "@gjsify/utils": "0.64.1-next.244",
71
+ "@gjsify/vite-plugin-blueprint": "0.64.1-next.244",
72
72
  "@rollup/pluginutils": "^5.4.0",
73
73
  "acorn": "^8.17.0",
74
74
  "acorn-typescript": "^1.4.13",
@@ -78,7 +78,7 @@
78
78
  "sass": "^1.101.0"
79
79
  },
80
80
  "peerDependencies": {
81
- "@gjsify/lightningcss-native": "0.64.1-next.243",
81
+ "@gjsify/lightningcss-native": "0.64.1-next.244",
82
82
  "rolldown": "^1.1.4"
83
83
  },
84
84
  "peerDependenciesMeta": {
@@ -90,8 +90,8 @@
90
90
  }
91
91
  },
92
92
  "devDependencies": {
93
- "@gjsify/cli": "0.64.1-next.243",
94
- "@gjsify/unit": "0.64.1-next.243",
93
+ "@gjsify/cli": "0.64.1-next.244",
94
+ "@gjsify/unit": "0.64.1-next.244",
95
95
  "@types/node": "^25.9.2",
96
96
  "rolldown": "^1.1.4",
97
97
  "typescript": "^6.0.3"
@@ -104,5 +104,5 @@
104
104
  "win32": "supported"
105
105
  }
106
106
  },
107
- "gitHead": "f88c7b1074d454e211094963a9f4dc7d0982bf32"
107
+ "gitHead": "9a6ca179c1a74477f23791c5b8f6d5a7bffaee61"
108
108
  }