@gjsify/rolldown-plugin-gjsify 0.64.3-next.258 → 0.64.3-next.259
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/README.md +1 -1
- package/lib/app/browser.js +2 -2
- package/lib/app/nativescript.js +2 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/plugins/gschema.d.ts +12 -1
- package/lib/plugins/gschema.js +17 -4
- package/package.json +12 -12
- package/types/index.d.ts +20 -0
- package/types/gresource.d.ts +0 -9
package/README.md
CHANGED
|
@@ -53,7 +53,7 @@ For a GJS build the bundle records the addon's **package identity**, not a path
|
|
|
53
53
|
|
|
54
54
|
## `.gresource.xml` imports
|
|
55
55
|
|
|
56
|
-
`import bytes from './data/app.data.gresource.xml'` yields the compiled GResource as a `Uint8Array` ([ADR 0116](../../../docs/adr/0116-app-gresources-are-embedded-at-build-time-for-web-and-nativescript.md)). To type it, add `"@gjsify/rolldown-plugin-gjsify/types"` to your `tsconfig.json` `compilerOptions.types`.
|
|
56
|
+
`import bytes from './data/app.data.gresource.xml'` yields the compiled GResource as a `Uint8Array` ([ADR 0116](../../../docs/adr/0116-app-gresources-are-embedded-at-build-time-for-web-and-nativescript.md)). To type it, add `"@gjsify/rolldown-plugin-gjsify/types"` to your `tsconfig.json` `compilerOptions.types`. The same entry declares `*.gschema.xml?schema` ([ADR 0099](../../../docs/adr/0099-gio-settings-runs-on-the-browser-and-nativescript.md) § 1).
|
|
57
57
|
|
|
58
58
|
## License
|
|
59
59
|
|
package/lib/app/browser.js
CHANGED
|
@@ -31,7 +31,7 @@ import { giRendererPlugin } from '../plugins/gi-renderer.js';
|
|
|
31
31
|
import { blueprintTemplateExit } from '../utils/blueprint-template-exit.js';
|
|
32
32
|
import { cssAsStringPlugin } from '../plugins/css-as-string.js';
|
|
33
33
|
import { unresolvedWorkspaceImportPlugin } from '../plugins/unresolved-workspace-import.js';
|
|
34
|
-
import { gschemaPlugin } from '../plugins/gschema.js';
|
|
34
|
+
import { GSCHEMA_REGISTER, gschemaPlugin } from '../plugins/gschema.js';
|
|
35
35
|
import { gresourcePlugin } from '../plugins/gresource.js';
|
|
36
36
|
import { implicitGlobalAssignPlugin } from '../plugins/implicit-global-assign.js';
|
|
37
37
|
export const setupForBrowser = async (input) => {
|
|
@@ -145,7 +145,7 @@ export const setupForBrowser = async (input) => {
|
|
|
145
145
|
// readily as a read, so `window = {…}` would emit `globalThis = {…}` — code that
|
|
146
146
|
// replaces the whole global object. This transform runs first and leaves the define
|
|
147
147
|
// nothing to rewrite; the guarded branch stays unreachable on a page either way.
|
|
148
|
-
gschemaPlugin({ mode: 'emit' }),
|
|
148
|
+
gschemaPlugin({ mode: 'emit', register: GSCHEMA_REGISTER.browser }),
|
|
149
149
|
gresourcePlugin({ compressed: 'strip' }),
|
|
150
150
|
implicitGlobalAssignPlugin(),
|
|
151
151
|
cssAsStringPlugin(),
|
package/lib/app/nativescript.js
CHANGED
|
@@ -47,7 +47,7 @@ import { giRendererPlugin } from '../plugins/gi-renderer.js';
|
|
|
47
47
|
import { blueprintTemplateExit } from '../utils/blueprint-template-exit.js';
|
|
48
48
|
import { platformResolvePlugin, nativescriptSuffixChain, detectNativescriptPlatform, nativescriptPlatformDefines, } from '../plugins/platform-resolve.js';
|
|
49
49
|
import { unresolvedWorkspaceImportPlugin } from '../plugins/unresolved-workspace-import.js';
|
|
50
|
-
import { gschemaPlugin } from '../plugins/gschema.js';
|
|
50
|
+
import { GSCHEMA_REGISTER, gschemaPlugin } from '../plugins/gschema.js';
|
|
51
51
|
import { gresourcePlugin } from '../plugins/gresource.js';
|
|
52
52
|
import { implicitGlobalAssignPlugin } from '../plugins/implicit-global-assign.js';
|
|
53
53
|
// Never bundled: an app works only with the ONE core instance the runtime boots, and what
|
|
@@ -188,7 +188,7 @@ export const setupForNativescript = async (input) => {
|
|
|
188
188
|
// a NativeScript app gates on the absence of `window`, but a WRITE to it is a
|
|
189
189
|
// `ReferenceError` in a strict module body, not a gate. `globalThis.window = …`
|
|
190
190
|
// holds the author's intent; the guard and the absence are untouched.
|
|
191
|
-
gschemaPlugin({ mode: 'emit' }),
|
|
191
|
+
gschemaPlugin({ mode: 'emit', register: GSCHEMA_REGISTER.nativescript }),
|
|
192
192
|
gresourcePlugin({ compressed: 'strip' }),
|
|
193
193
|
implicitGlobalAssignPlugin(),
|
|
194
194
|
// NO cssAsStringPlugin — NS ships its own CSS pipeline via
|
package/lib/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export type { GiSystemProbe } from './plugins/gi-runtime-paths.js';
|
|
|
13
13
|
export type { ProcessStubPluginOptions } from './plugins/process-stub.js';
|
|
14
14
|
export { findImplicitGlobalAssignments, rewriteImplicitGlobalAssignments, implicitGlobalAssignPlugin, IMPLICIT_GLOBAL_ASSIGN_PLUGIN, } from './plugins/implicit-global-assign.js';
|
|
15
15
|
export type { ImplicitGlobalAssignment } from './plugins/implicit-global-assign.js';
|
|
16
|
-
export { gschemaPlugin, parseGschema, GSCHEMA_PLUGIN } from './plugins/gschema.js';
|
|
16
|
+
export { gschemaPlugin, parseGschema, GSCHEMA_PLUGIN, GSCHEMA_REGISTER } from './plugins/gschema.js';
|
|
17
17
|
export type { GschemaOut, GschemaKey, GschemaPluginOptions } from './plugins/gschema.js';
|
|
18
18
|
export { gresourcePlugin, compileGresource, prepareGresourceXml, gresourceModuleSource, GRESOURCE_PLUGIN, } from './plugins/gresource.js';
|
|
19
19
|
export type { GresourcePluginOptions } from './plugins/gresource.js';
|
package/lib/index.js
CHANGED
|
@@ -9,7 +9,7 @@ export { giRuntimePathsStub } from './plugins/gi-runtime-paths.js';
|
|
|
9
9
|
export { giOptionalPlugin, giOptionalShimSource, giOptionalNodeShimSource, giOptionalMarkerSource, parseOptionalGiSpecifier, GI_OPTIONAL_FLAG, GI_OPTIONAL_MARKER, } from './plugins/gi-optional.js';
|
|
10
10
|
export { bindConsoleLocally, consoleAssignPlugin, freeConsoleAssignmentInsertion, CONSOLE_LOCAL_BINDING, } from './plugins/console-assign.js';
|
|
11
11
|
export { findImplicitGlobalAssignments, rewriteImplicitGlobalAssignments, implicitGlobalAssignPlugin, IMPLICIT_GLOBAL_ASSIGN_PLUGIN, } from './plugins/implicit-global-assign.js';
|
|
12
|
-
export { gschemaPlugin, parseGschema, GSCHEMA_PLUGIN } from './plugins/gschema.js';
|
|
12
|
+
export { gschemaPlugin, parseGschema, GSCHEMA_PLUGIN, GSCHEMA_REGISTER } from './plugins/gschema.js';
|
|
13
13
|
export { gresourcePlugin, compileGresource, prepareGresourceXml, gresourceModuleSource, GRESOURCE_PLUGIN, } from './plugins/gresource.js';
|
|
14
14
|
export { cssAsStringPlugin } from './plugins/css-as-string.js';
|
|
15
15
|
export { textLoaderPlugin } from './plugins/text-loader.js';
|
package/lib/plugins/gschema.d.ts
CHANGED
|
@@ -15,6 +15,17 @@ export declare function parseGschema(xml: string, file: string): GschemaOut;
|
|
|
15
15
|
export interface GschemaPluginOptions {
|
|
16
16
|
/** `emit`: the schema object (browser, NativeScript). `ignore`: the file path, for GJS/Node. */
|
|
17
17
|
mode: 'emit' | 'ignore';
|
|
18
|
+
/**
|
|
19
|
+
* `emit` only: the module whose `Settings` the schema registers with, so the import alone is
|
|
20
|
+
* the registration and the app keeps to GIO's names. The port's `Gio` barrel re-exports the
|
|
21
|
+
* same `Settings`, so `new Gio.Settings(...)` finds the schema.
|
|
22
|
+
*/
|
|
23
|
+
register?: string;
|
|
18
24
|
}
|
|
19
|
-
|
|
25
|
+
/** The `Settings` each port's `Gio` barrel re-exports (ADR 0099). */
|
|
26
|
+
export declare const GSCHEMA_REGISTER: {
|
|
27
|
+
readonly browser: "@gjsify/app-settings/browser";
|
|
28
|
+
readonly nativescript: "@gjsify/app-settings/nativescript";
|
|
29
|
+
};
|
|
30
|
+
export declare function gschemaPlugin({ mode, register }: GschemaPluginOptions): Plugin;
|
|
20
31
|
export {};
|
package/lib/plugins/gschema.js
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
// The `.gschema.xml` stays the single source. On the targets with no Gio.Settings (browser,
|
|
4
4
|
// NativeScript) the build reads it and emits `{ id, path, keys: { name: { type, default } } }`;
|
|
5
5
|
// the runtime never parses XML. On GJS and Node the compiled schema is what GSettings reads
|
|
6
|
-
// (`gjsify gsettings` builds it), so the import evaluates to the file's path
|
|
7
|
-
// the
|
|
6
|
+
// (`gjsify gsettings` builds it), so the import evaluates to the file's path. The app builds
|
|
7
|
+
// register the schema as the module evaluates (`register`), so importing it once, before the first
|
|
8
|
+
// `new Gio.Settings`, is all an app does on every target.
|
|
8
9
|
//
|
|
9
10
|
// What the subset cannot honour is refused HERE, naming the key and the line, rather than
|
|
10
11
|
// compiled into a schema that behaves differently from GNOME's: a key type outside `b i u d s`
|
|
@@ -137,7 +138,12 @@ export function parseGschema(xml, file) {
|
|
|
137
138
|
return { id, path, keys };
|
|
138
139
|
}
|
|
139
140
|
const SUFFIX = /\.gschema\.xml\?schema(?:&|$)/;
|
|
140
|
-
|
|
141
|
+
/** The `Settings` each port's `Gio` barrel re-exports (ADR 0099). */
|
|
142
|
+
export const GSCHEMA_REGISTER = {
|
|
143
|
+
browser: '@gjsify/app-settings/browser',
|
|
144
|
+
nativescript: '@gjsify/app-settings/nativescript',
|
|
145
|
+
};
|
|
146
|
+
export function gschemaPlugin({ mode, register }) {
|
|
141
147
|
return {
|
|
142
148
|
name: GSCHEMA_PLUGIN,
|
|
143
149
|
async resolveId(source, importer) {
|
|
@@ -155,7 +161,14 @@ export function gschemaPlugin({ mode }) {
|
|
|
155
161
|
return `export default ${JSON.stringify(file)};`;
|
|
156
162
|
const schema = parseGschema(await readFile(file, 'utf8'), file);
|
|
157
163
|
this.addWatchFile(file);
|
|
158
|
-
|
|
164
|
+
if (register === undefined)
|
|
165
|
+
return `export default ${JSON.stringify(schema)};`;
|
|
166
|
+
return [
|
|
167
|
+
`import { Settings } from ${JSON.stringify(register)};`,
|
|
168
|
+
`const schema = ${JSON.stringify(schema)};`,
|
|
169
|
+
'Settings.register(schema);',
|
|
170
|
+
'export default schema;',
|
|
171
|
+
].join('\n');
|
|
159
172
|
},
|
|
160
173
|
};
|
|
161
174
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/rolldown-plugin-gjsify",
|
|
3
|
-
"version": "0.64.3-next.
|
|
3
|
+
"version": "0.64.3-next.259",
|
|
4
4
|
"description": "Rolldown / Rollup / Vite plugin orchestrator for GJS, Node, and Browser targets",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"default": "./lib/utils/runtime.js"
|
|
21
21
|
},
|
|
22
22
|
"./types": {
|
|
23
|
-
"types": "./types/
|
|
23
|
+
"types": "./types/index.d.ts"
|
|
24
24
|
},
|
|
25
25
|
"./shims/console-gjs": {
|
|
26
26
|
"default": "./lib/shims/console-gjs.js"
|
|
@@ -67,12 +67,12 @@
|
|
|
67
67
|
],
|
|
68
68
|
"license": "MIT",
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@gjsify/console": "0.64.3-next.
|
|
71
|
-
"@gjsify/resolve-npm": "0.64.3-next.
|
|
72
|
-
"@gjsify/rolldown-plugin-deepkit": "0.64.3-next.
|
|
73
|
-
"@gjsify/rolldown-plugin-pnp": "0.64.3-next.
|
|
74
|
-
"@gjsify/utils": "0.64.3-next.
|
|
75
|
-
"@gjsify/vite-plugin-blueprint": "0.64.3-next.
|
|
70
|
+
"@gjsify/console": "0.64.3-next.259",
|
|
71
|
+
"@gjsify/resolve-npm": "0.64.3-next.259",
|
|
72
|
+
"@gjsify/rolldown-plugin-deepkit": "0.64.3-next.259",
|
|
73
|
+
"@gjsify/rolldown-plugin-pnp": "0.64.3-next.259",
|
|
74
|
+
"@gjsify/utils": "0.64.3-next.259",
|
|
75
|
+
"@gjsify/vite-plugin-blueprint": "0.64.3-next.259",
|
|
76
76
|
"@rollup/pluginutils": "^5.4.0",
|
|
77
77
|
"acorn": "^8.17.0",
|
|
78
78
|
"acorn-typescript": "^1.4.13",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"sass": "^1.101.0"
|
|
83
83
|
},
|
|
84
84
|
"peerDependencies": {
|
|
85
|
-
"@gjsify/lightningcss-native": "0.64.3-next.
|
|
85
|
+
"@gjsify/lightningcss-native": "0.64.3-next.259",
|
|
86
86
|
"rolldown": "^1.1.4"
|
|
87
87
|
},
|
|
88
88
|
"peerDependenciesMeta": {
|
|
@@ -94,8 +94,8 @@
|
|
|
94
94
|
}
|
|
95
95
|
},
|
|
96
96
|
"devDependencies": {
|
|
97
|
-
"@gjsify/cli": "0.64.3-next.
|
|
98
|
-
"@gjsify/unit": "0.64.3-next.
|
|
97
|
+
"@gjsify/cli": "0.64.3-next.259",
|
|
98
|
+
"@gjsify/unit": "0.64.3-next.259",
|
|
99
99
|
"@types/node": "^25.9.2",
|
|
100
100
|
"rolldown": "^1.1.4",
|
|
101
101
|
"typescript": "^6.0.3"
|
|
@@ -108,5 +108,5 @@
|
|
|
108
108
|
"win32": "supported"
|
|
109
109
|
}
|
|
110
110
|
},
|
|
111
|
-
"gitHead": "
|
|
111
|
+
"gitHead": "84f8ece003be30456a8ace70115e480bf3220d47"
|
|
112
112
|
}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `import bytes from './data/<app-id>.data.gresource.xml'` (ADR 0116 § 1): the loader in
|
|
3
|
+
* `plugins/gresource.ts` compiles the descriptor with `glib-compile-resources` and the module's
|
|
4
|
+
* default export is the compiled GResource, for `Gio.Resource.new_from_data(bytes)`.
|
|
5
|
+
*/
|
|
6
|
+
declare module '*.gresource.xml' {
|
|
7
|
+
const bytes: Uint8Array;
|
|
8
|
+
export default bytes;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* `import './<app-id>.gschema.xml?schema'` (ADR 0099 § 1): on the browser and NativeScript the
|
|
13
|
+
* loader in `plugins/gschema.ts` parses the schema at build time and registers it with the
|
|
14
|
+
* `Gio.Settings` subset; on GJS and Node the import is the file's path and GSettings reads the
|
|
15
|
+
* compiled schema.
|
|
16
|
+
*/
|
|
17
|
+
declare module '*.gschema.xml?schema' {
|
|
18
|
+
const schema: unknown;
|
|
19
|
+
export default schema;
|
|
20
|
+
}
|
package/types/gresource.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `import bytes from './data/<app-id>.data.gresource.xml'` (ADR 0116 § 1): the loader in
|
|
3
|
-
* `plugins/gresource.ts` compiles the descriptor with `glib-compile-resources` and the module's
|
|
4
|
-
* default export is the compiled GResource, for `Gio.Resource.new_from_data(bytes)`.
|
|
5
|
-
*/
|
|
6
|
-
declare module '*.gresource.xml' {
|
|
7
|
-
const bytes: Uint8Array;
|
|
8
|
-
export default bytes;
|
|
9
|
-
}
|