@gjsify/resolve-npm 0.13.1 → 0.14.0

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 (2) hide show
  1. package/lib/index.mjs +25 -2
  2. package/package.json +1 -1
package/lib/index.mjs CHANGED
@@ -441,8 +441,31 @@ export const ALIASES_GENERAL_FOR_NODE = {
441
441
  '@gjsify/web-globals/register/formdata': '@gjsify/empty',
442
442
  }
443
443
 
444
- /** Record of Gjs modules (build in or not) and his replacement for Node */
445
- const ALIASES_GJS_FOR_NODE = {}
444
+ /**
445
+ * Record of GJS built-in module specifiers and their replacement for the
446
+ * `--app node` target. These are the bare ESM module names a GJS source imports
447
+ * (`import System from 'system'`, `import Gettext from 'gettext'`) — GJS exposes
448
+ * them as built-in modules; Node has no equivalent, so on the node target they
449
+ * route to the `@gjsify/node-gi` reverse-bridge shims, which are kept EXTERNAL
450
+ * (resolved at runtime against the consumer's node_modules — see
451
+ * `app/node.ts`'s external set), never bundled. This is the analogue of the
452
+ * `gi://` rewrite + `@gjsify/node-gi/globals` injection, and like them it is
453
+ * NODE-TARGET-ONLY: the gjs/browser/nativescript alias maps do not include this
454
+ * record, so a bare `system` / `gettext` import keeps resolving natively (GJS
455
+ * built-in / npm package) on every other target. The risk of hijacking a real
456
+ * npm package literally named `system`/`gettext` is identical to (and bounded
457
+ * the same way as) the `gi://` design: it only applies when building a GJS/GI
458
+ * source for Node.
459
+ *
460
+ * `cairo` is intentionally NOT mapped — it needs a real Cairo binding (out of
461
+ * scope here), so it falls through to the normal resolver (a `cairo` npm package
462
+ * resolves as usual, an unresolvable bare `cairo` surfaces as a build error
463
+ * rather than silently no-op'ing).
464
+ */
465
+ const ALIASES_GJS_FOR_NODE = {
466
+ 'system': '@gjsify/node-gi/system',
467
+ 'gettext': '@gjsify/node-gi/gettext',
468
+ }
446
469
 
447
470
  export { ALIASES_GJS_FOR_NODE };
448
471
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/resolve-npm",
3
- "version": "0.13.1",
3
+ "version": "0.14.0",
4
4
  "description": "Resolve NPM package aliases",
5
5
  "type": "module",
6
6
  "main": "lib/index.mjs",