@gjsify/rolldown-plugin-gjsify 0.64.52 → 0.64.54
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.
- package/lib/app/nativescript.js +4 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +1 -0
- package/lib/plugins/gi-real.d.ts +12 -0
- package/lib/plugins/gi-real.js +54 -0
- package/lib/types/plugin-options.d.ts +6 -0
- package/package.json +11 -11
package/lib/app/nativescript.js
CHANGED
|
@@ -44,6 +44,7 @@ import { ALIASES_NODE_FOR_NATIVESCRIPT, GI_RENDERERS, getDerivedAliasesSync } fr
|
|
|
44
44
|
import { globToEntryPoints } from '../utils/entry-points.js';
|
|
45
45
|
import { gjsImportsEmptyPlugin } from '../plugins/gjs-imports-empty.js';
|
|
46
46
|
import { giRendererPlugin } from '../plugins/gi-renderer.js';
|
|
47
|
+
import { giRealPlugin } from '../plugins/gi-real.js';
|
|
47
48
|
import { nativescriptLocalePlugin } from '../plugins/nativescript-locale.js';
|
|
48
49
|
import { blueprintTemplateExit } from '../utils/blueprint-template-exit.js';
|
|
49
50
|
import { platformResolvePlugin, nativescriptSuffixChain, detectNativescriptPlatform, nativescriptPlatformDefines, } from '../plugins/platform-resolve.js';
|
|
@@ -183,6 +184,9 @@ export const setupForNativescript = async (input) => {
|
|
|
183
184
|
// target. `emptyGirs` follows it: with the arm on, `@girs/<ns>-<ver>` must
|
|
184
185
|
// reach its real body so its inner `gi://` lands here instead of being
|
|
185
186
|
// stranded as `{}`.
|
|
187
|
+
...(giRenderer && input.pluginOptions.giReal?.length
|
|
188
|
+
? [giRealPlugin({ namespaces: input.pluginOptions.giReal })]
|
|
189
|
+
: []),
|
|
186
190
|
...(giRenderer ? [giRendererPlugin({ app: 'nativescript', ...giRenderer })] : []),
|
|
187
191
|
gjsImportsEmptyPlugin({ emptyGirs: !giRenderer }),
|
|
188
192
|
// Platform-specific source variants (`*.android` / `*.ios` /
|
package/lib/index.d.ts
CHANGED
|
@@ -28,6 +28,8 @@ export { aliasPlugin } from './plugins/alias.js';
|
|
|
28
28
|
export type { AliasPluginOptions } from './plugins/alias.js';
|
|
29
29
|
export { gjsImportsEmptyPlugin } from './plugins/gjs-imports-empty.js';
|
|
30
30
|
export { giRendererPlugin } from './plugins/gi-renderer.js';
|
|
31
|
+
export { giRealPlugin, giRealShimSource, GI_REAL_PLUGIN } from './plugins/gi-real.js';
|
|
32
|
+
export type { GiRealOptions } from './plugins/gi-real.js';
|
|
31
33
|
export { nativescriptLocalePlugin, collectLocaleAssets, NATIVESCRIPT_LOCALE_DIR, NATIVESCRIPT_LOCALE_PLUGIN, } from './plugins/nativescript-locale.js';
|
|
32
34
|
export type { NativescriptLocaleOptions, LocaleAsset } from './plugins/nativescript-locale.js';
|
|
33
35
|
export { nativescriptGiSelectionPlugin, NATIVESCRIPT_GI_SELECTION_PLUGIN, } from './plugins/nativescript-gi-selection.js';
|
package/lib/index.js
CHANGED
|
@@ -18,6 +18,7 @@ export { shebangPlugin, GJS_SHEBANG, NODE_SHEBANG, expandEnvTemplate, resolveShe
|
|
|
18
18
|
export { aliasPlugin } from './plugins/alias.js';
|
|
19
19
|
export { gjsImportsEmptyPlugin } from './plugins/gjs-imports-empty.js';
|
|
20
20
|
export { giRendererPlugin } from './plugins/gi-renderer.js';
|
|
21
|
+
export { giRealPlugin, giRealShimSource, GI_REAL_PLUGIN } from './plugins/gi-real.js';
|
|
21
22
|
export { nativescriptLocalePlugin, collectLocaleAssets, NATIVESCRIPT_LOCALE_DIR, NATIVESCRIPT_LOCALE_PLUGIN, } from './plugins/nativescript-locale.js';
|
|
22
23
|
export { nativescriptGiSelectionPlugin, NATIVESCRIPT_GI_SELECTION_PLUGIN, } from './plugins/nativescript-gi-selection.js';
|
|
23
24
|
export { externalsPlugin } from './plugins/externals.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Plugin } from 'rolldown';
|
|
2
|
+
export declare const GI_REAL_PLUGIN = "gjsify-gi-real";
|
|
3
|
+
export interface GiRealOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Namespaces answered by real GI, as `Ns` or `Ns-Version`. A version here is the default for
|
|
6
|
+
* an import that names none; an import that names one keeps it.
|
|
7
|
+
*/
|
|
8
|
+
namespaces: readonly string[];
|
|
9
|
+
}
|
|
10
|
+
/** The module source for one real namespace. */
|
|
11
|
+
export declare function giRealShimSource(namespace: string, version?: string): string;
|
|
12
|
+
export declare function giRealPlugin(options: GiRealOptions): Plugin;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// For `--app nativescript`: answer `gi://Ns` with the REAL namespace from `@gjsify/node-gi`
|
|
3
|
+
// instead of the widget renderer's subset arm (`gi-renderer.ts`).
|
|
4
|
+
//
|
|
5
|
+
// WHY. The renderer arm is deliberately sparse (ADR 0034 clause 3): `Gio` and `GLib` there are
|
|
6
|
+
// the subset a widget port needs (`Gio.File`, `Gio.Settings`, main-loop sources) and nothing
|
|
7
|
+
// else, so non-widget code on real GObject (ADR 0110 — a Gio TLS socket client, `GLib.get_home_dir`)
|
|
8
|
+
// reads `undefined` or is refused by name. The arm stays the default, because an app that never
|
|
9
|
+
// asked for more must not bundle `@gjsify/node-gi`; this plugin is how an app asks.
|
|
10
|
+
//
|
|
11
|
+
// ORDER. Composed AHEAD of `giRendererPlugin`, so a listed namespace never reaches it. The emitted
|
|
12
|
+
// module imports `@gjsify/node-gi/gi` as an ordinary dependency of the app (ADR 0117: the addon is
|
|
13
|
+
// bundled with the APK, never inlined), and evaluates `requireGi` eagerly — an app that lists a
|
|
14
|
+
// namespace uses it.
|
|
15
|
+
import { GJSIFY_VIRTUAL_PREFIX } from '../utils/virtual-module-id.js';
|
|
16
|
+
import { parseGiSpecifier } from './gjs-gi-node.js';
|
|
17
|
+
const GI_REAL_VIRTUAL_PREFIX = `${GJSIFY_VIRTUAL_PREFIX}gi-real:`;
|
|
18
|
+
export const GI_REAL_PLUGIN = 'gjsify-gi-real';
|
|
19
|
+
/** The module source for one real namespace. */
|
|
20
|
+
export function giRealShimSource(namespace, version) {
|
|
21
|
+
const versionArg = version ? `, ${JSON.stringify(version)}` : '';
|
|
22
|
+
return (`import requireGi from '@gjsify/node-gi/gi';\n` +
|
|
23
|
+
`export default requireGi(${JSON.stringify(namespace)}${versionArg});\n`);
|
|
24
|
+
}
|
|
25
|
+
export function giRealPlugin(options) {
|
|
26
|
+
const defaults = new Map();
|
|
27
|
+
for (const entry of options.namespaces) {
|
|
28
|
+
const dash = entry.indexOf('-');
|
|
29
|
+
if (dash === -1)
|
|
30
|
+
defaults.set(entry, undefined);
|
|
31
|
+
else
|
|
32
|
+
defaults.set(entry.slice(0, dash), entry.slice(dash + 1));
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
name: GI_REAL_PLUGIN,
|
|
36
|
+
resolveId: {
|
|
37
|
+
order: 'pre',
|
|
38
|
+
filter: { id: /^gi:\/\// },
|
|
39
|
+
handler(source) {
|
|
40
|
+
const parsed = parseGiSpecifier(source);
|
|
41
|
+
if (parsed === null || !defaults.has(parsed.namespace))
|
|
42
|
+
return null;
|
|
43
|
+
const version = parsed.version ?? defaults.get(parsed.namespace) ?? '';
|
|
44
|
+
return { id: `${GI_REAL_VIRTUAL_PREFIX}${parsed.namespace}:${version}` };
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
load(id) {
|
|
48
|
+
if (!id.startsWith(GI_REAL_VIRTUAL_PREFIX))
|
|
49
|
+
return null;
|
|
50
|
+
const [namespace, version] = id.slice(GI_REAL_VIRTUAL_PREFIX.length).split(':');
|
|
51
|
+
return { code: giRealShimSource(namespace, version || undefined), moduleSideEffects: false };
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
}
|
|
@@ -113,6 +113,12 @@ export interface PluginOptions {
|
|
|
113
113
|
* every unanswerable namespace from a silent stub into a hard build failure.
|
|
114
114
|
*/
|
|
115
115
|
giRenderer?: boolean;
|
|
116
|
+
/**
|
|
117
|
+
* `--app nativescript` with `giRenderer`: GI namespaces (`Ns` or `Ns-Version`) answered by the
|
|
118
|
+
* REAL `@gjsify/node-gi` namespace instead of the renderer's sparse arm. See
|
|
119
|
+
* `plugins/gi-real.ts`. Opt-in because the arm must not drag node-gi into apps that never asked.
|
|
120
|
+
*/
|
|
121
|
+
giReal?: string[];
|
|
116
122
|
/**
|
|
117
123
|
* `--app nativescript` only: compile this PO directory to
|
|
118
124
|
* `locale/<lang>/LC_MESSAGES/<domain>.mo` assets of the bundle, so the Android libintl
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/rolldown-plugin-gjsify",
|
|
3
|
-
"version": "0.64.
|
|
3
|
+
"version": "0.64.54",
|
|
4
4
|
"description": "Rolldown / Rollup / Vite plugin orchestrator for GJS, Node, and Browser targets",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -67,13 +67,13 @@
|
|
|
67
67
|
],
|
|
68
68
|
"license": "MIT",
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@gjsify/console": "0.64.
|
|
71
|
-
"@gjsify/resolve-npm": "0.64.
|
|
72
|
-
"@gjsify/rolldown-plugin-deepkit": "0.64.
|
|
73
|
-
"@gjsify/rolldown-plugin-pnp": "0.64.
|
|
74
|
-
"@gjsify/utils": "0.64.
|
|
75
|
-
"@gjsify/vite-plugin-blueprint": "0.64.
|
|
76
|
-
"@gjsify/vite-plugin-gettext": "0.64.
|
|
70
|
+
"@gjsify/console": "0.64.54",
|
|
71
|
+
"@gjsify/resolve-npm": "0.64.54",
|
|
72
|
+
"@gjsify/rolldown-plugin-deepkit": "0.64.54",
|
|
73
|
+
"@gjsify/rolldown-plugin-pnp": "0.64.54",
|
|
74
|
+
"@gjsify/utils": "0.64.54",
|
|
75
|
+
"@gjsify/vite-plugin-blueprint": "0.64.54",
|
|
76
|
+
"@gjsify/vite-plugin-gettext": "0.64.54",
|
|
77
77
|
"@rollup/pluginutils": "^5.4.0",
|
|
78
78
|
"acorn": "^8.17.0",
|
|
79
79
|
"acorn-typescript": "^1.4.13",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"sass": "^1.101.0"
|
|
84
84
|
},
|
|
85
85
|
"peerDependencies": {
|
|
86
|
-
"@gjsify/lightningcss-native": "0.64.
|
|
86
|
+
"@gjsify/lightningcss-native": "0.64.54",
|
|
87
87
|
"rolldown": "^1.1.4"
|
|
88
88
|
},
|
|
89
89
|
"peerDependenciesMeta": {
|
|
@@ -95,8 +95,8 @@
|
|
|
95
95
|
}
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
98
|
-
"@gjsify/cli": "0.64.
|
|
99
|
-
"@gjsify/unit": "0.64.
|
|
98
|
+
"@gjsify/cli": "0.64.54",
|
|
99
|
+
"@gjsify/unit": "0.64.54",
|
|
100
100
|
"@types/node": "^25.9.2",
|
|
101
101
|
"rolldown": "^1.1.4",
|
|
102
102
|
"typescript": "^6.0.3"
|