@gjsify/resolve-npm 0.48.0 → 0.49.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.
@@ -0,0 +1,46 @@
1
+ // WHICH PACKAGE ANSWERS `gi://Ns` ON A TARGET WITH NO GOBJECT INTROSPECTION — ADR 0034 stage 9.
2
+ //
3
+ // `gi://Gtk?version=4.0` is not a GJS-only specifier in this repository; it is the runtime
4
+ // axis, and every target already resolves it: `--app gjs` takes the native protocol,
5
+ // `--app node` a lazy `requireGi` proxy (`plugins/gjs-gi-node.ts`), and `--app browser` /
6
+ // `--app nativescript` an EMPTY module. The empty one is the row this table changes: a
7
+ // namespace substituted by `{}` makes `Adw.ActionRow` `undefined`, and
8
+ // `class X extends undefined` is `Class extends value undefined`, thrown far from the
9
+ // import that caused it.
10
+ //
11
+ // WHAT A RENDERER SUPPLIES. ADR 0034 clause 2 makes every widget surface export its widgets
12
+ // through `Adw` / `Gtk` namespace OBJECTS, which is exactly the shape `gi://` evaluates to
13
+ // on GJS — so the substitution is a re-export and not a translation layer.
14
+ //
15
+ // THE VERSIONS ARE A GIR FACT, NOT A RENDERER CHOICE. `Adw-1` and `Gtk-4.0` are the
16
+ // namespace versions `@gjsify/gtk-host`'s generated widget table was built against; that
17
+ // file stamps them in `GENERATED_PROVENANCE`, and `tests/e2e/gi-renderer-arms` holds this
18
+ // table against that stamp. Two derivations, one written by a generator that never reads
19
+ // this file.
20
+ //
21
+ // WHY A CURATED TABLE AND NOT A SCAN of `gjsify.widgetVocabulary`. The manifest declaration
22
+ // says which SIDE of the vocabulary comparison a package is on (`reference` / `renderer`),
23
+ // and there is more than one renderer per repo: `@gjsify/adwaita-react-native` declares
24
+ // itself one too, and it is not this table's answer for any `--app` because Metro owns a
25
+ // React Native build (root AGENTS.md § Runtime & platform model). Deriving the row from the
26
+ // declaration would have to invent that exclusion anyway.
27
+
28
+ /**
29
+ * `--app <target>` → the package whose `Adw` / `Gtk` namespace exports answer `gi://`, and
30
+ * the GIR namespace versions that arm accepts.
31
+ *
32
+ * @type {Readonly<Record<string, { renderer: string, namespaces: Readonly<Record<string, string>> }>>}
33
+ */
34
+ export const GI_RENDERERS = {
35
+ browser: {
36
+ renderer: '@gjsify/adwaita-web',
37
+ namespaces: { Adw: '1', Gtk: '4.0' },
38
+ },
39
+ nativescript: {
40
+ renderer: '@gjsify/adwaita-nativescript',
41
+ namespaces: { Adw: '1', Gtk: '4.0' },
42
+ },
43
+ };
44
+
45
+ /** The `--app` values that have an arm, for a flag that must name them when refused. */
46
+ export const GI_RENDERER_APPS = Object.freeze(Object.keys(GI_RENDERERS));
package/lib/index.d.ts CHANGED
@@ -94,3 +94,17 @@ export declare function listDeclaredRuntimes(): Promise<
94
94
  }
95
95
  >
96
96
  >;
97
+
98
+ /**
99
+ * `--app <target>` → the package whose `Adw` / `Gtk` namespace exports answer `gi://` on
100
+ * that target, and the GI namespace versions the arm accepts (ADR 0034 stage 9).
101
+ *
102
+ * A target absent from this record has no arm: `gi://*` there keeps resolving to the empty
103
+ * module, which is what every target but `gjs` and `node` did before the arms existed.
104
+ */
105
+ export declare const GI_RENDERERS: Readonly<
106
+ Record<string, { renderer: string; namespaces: Readonly<Record<string, string>> }>
107
+ >;
108
+
109
+ /** The `--app` values {@link GI_RENDERERS} has a row for, so a refused flag can name them. */
110
+ export declare const GI_RENDERER_APPS: readonly string[];
package/lib/index.mjs CHANGED
@@ -11,6 +11,12 @@ export {
11
11
  resetRuntimeAliasesCache,
12
12
  } from './runtime-aliases.mjs';
13
13
 
14
+ // Which package answers `gi://Ns` on a target with no GObject introspection — ADR 0034
15
+ // stage 9. Kept beside the other per-target routing tables for the same reason they live
16
+ // here: one source of truth per `--app`, reachable from the Vite presets as well as from
17
+ // `gjsify build`.
18
+ export { GI_RENDERERS, GI_RENDERER_APPS } from './gi-renderers.mjs';
19
+
14
20
  import { getDerivedAliasesSync as _getDerivedAliasesSync } from './runtime-aliases.mjs';
15
21
 
16
22
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/resolve-npm",
3
- "version": "0.48.0",
3
+ "version": "0.49.0",
4
4
  "description": "Resolve NPM package aliases",
5
5
  "type": "module",
6
6
  "main": "lib/index.mjs",