@gjsify/vite-plugin-gjsify 0.51.0 → 0.52.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.js +37 -1
  2. package/package.json +6 -6
package/lib/index.js CHANGED
@@ -11,6 +11,13 @@
11
11
  // - gjsImportsEmptyPlugin() → resolve `@girs/*` / `gi://*` to an empty
12
12
  // module (GJS-only specifiers leak transitively
13
13
  // via `@gjsify/unit` etc.; no browser equivalent)
14
+ // - platformResolvePlugin() → the BROWSER platform-file chain, ADR 0032 § 9:
15
+ // `./foo.web.<ext>` ahead of `./foo.<ext>`. Not
16
+ // optional for parity — a resolution rule the
17
+ // build has and the dev server does not means the
18
+ // two disagree about WHICH FILE the module is,
19
+ // which is the one kind of difference no amount of
20
+ // matching aliases and conditions can paper over.
14
21
  // - blueprintPlugin() → compile `.blp` GNOME Blueprint files to XML
15
22
  // - deepkitPlugin() → optional Deepkit type reflection (opt-in)
16
23
  // - an inline Vite config hook supplying the browser-target resolve aliases,
@@ -31,7 +38,7 @@
31
38
  import { createRequire } from 'node:module';
32
39
  import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';
33
40
  import * as nodePath from 'node:path';
34
- import { gjsImportsEmptyPlugin, platformResolvePlugin, nativescriptSuffixChain, detectNativescriptPlatform, nativescriptPlatformDefines, cssAsStringPlugin, } from '@gjsify/rolldown-plugin-gjsify';
41
+ import { gjsImportsEmptyPlugin, platformResolvePlugin, nativescriptSuffixChain, browserSuffixChain, BROWSER_REFUSED_SUFFIXES, detectNativescriptPlatform, nativescriptPlatformDefines, cssAsStringPlugin, } from '@gjsify/rolldown-plugin-gjsify';
35
42
  import blueprintPlugin from '@gjsify/vite-plugin-blueprint';
36
43
  import { deepkitPlugin } from '@gjsify/rolldown-plugin-deepkit';
37
44
  import { ALIASES_NODE_FOR_NATIVESCRIPT } from '@gjsify/resolve-npm';
@@ -95,6 +102,35 @@ export function gjsifyBrowser(options = {}) {
95
102
  },
96
103
  };
97
104
  return [
105
+ // The browser platform-file chain, matching `app/browser.ts` — INDEX AND
106
+ // ALL, which the first draft of this line got wrong.
107
+ //
108
+ // It shipped without `siblingIndex` to keep a long-lived dev server from
109
+ // answering out of a stale listing. The freshness worry was real; turning
110
+ // the filter off was the wrong answer to it, and the e2e said so within
111
+ // one CI run. Without the index every relative import costs four real
112
+ // `this.resolve` calls (one rung + three refusals), and under Vite each
113
+ // one re-enters the whole plugin container. MEASURED on this package's own
114
+ // e2e fixture, `node --max-old-space-size=4096`:
115
+ //
116
+ // index off → 293 hook calls, 1172 probes, FATAL ERROR: Reached heap
117
+ // limit — heap out of memory (CI: 212 s, 3993 MB, job
118
+ // 106660035901). RSS passed 16 GB on a 64 GB host before
119
+ // the cap ended it.
120
+ // index on → 293 hook calls, 0 probes, 0.25 s wall, 191 MB peak RSS.
121
+ //
122
+ // The listing answers all four suffixes for a whole directory with one
123
+ // `readdirSync`, so on a variant-less tree the probe count is zero rather
124
+ // than four per import. The staleness that motivated leaving it off is
125
+ // handled where it belongs — the plugin's own `watchChange` hook drops a
126
+ // directory's listing when the watcher reports a change in it — which
127
+ // also closes the same hole on `gjsify build --watch`, where the desktop
128
+ // chain has run with this index and no invalidation all along.
129
+ platformResolvePlugin({
130
+ suffixes: browserSuffixChain(),
131
+ refusedSuffixes: BROWSER_REFUSED_SUFFIXES,
132
+ siblingIndex: true,
133
+ }),
98
134
  gjsImportsEmptyPlugin(),
99
135
  blueprintPlugin(),
100
136
  deepkitPlugin({ reflection: options.reflection }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/vite-plugin-gjsify",
3
- "version": "0.51.0",
3
+ "version": "0.52.0",
4
4
  "description": "Vite plugin presets mirroring `gjsify build --app browser` / `--app nativescript` — dev (Vite/HMR) parity with the gjsify CLI targets.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -40,11 +40,11 @@
40
40
  ],
41
41
  "license": "MIT",
42
42
  "dependencies": {
43
- "@gjsify/empty": "^0.51.0",
44
- "@gjsify/resolve-npm": "^0.51.0",
45
- "@gjsify/rolldown-plugin-deepkit": "^0.51.0",
46
- "@gjsify/rolldown-plugin-gjsify": "^0.51.0",
47
- "@gjsify/vite-plugin-blueprint": "^0.51.0"
43
+ "@gjsify/empty": "^0.52.0",
44
+ "@gjsify/resolve-npm": "^0.52.0",
45
+ "@gjsify/rolldown-plugin-deepkit": "^0.52.0",
46
+ "@gjsify/rolldown-plugin-gjsify": "^0.52.0",
47
+ "@gjsify/vite-plugin-blueprint": "^0.52.0"
48
48
  },
49
49
  "peerDependencies": {
50
50
  "vite": "^8.1.3"