@gtkx/cli 1.2.2 → 1.4.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.
- package/README.md +6 -4
- package/dist/builder.d.ts +0 -1
- package/dist/builder.d.ts.map +1 -1
- package/dist/builder.js +6 -6
- package/dist/builder.js.map +1 -1
- package/dist/codegen/freshness.js +1 -1
- package/dist/codegen/freshness.js.map +1 -1
- package/dist/codegen/run-codegen.d.ts +2 -2
- package/dist/codegen/run-codegen.d.ts.map +1 -1
- package/dist/codegen/run-codegen.js +28 -9
- package/dist/codegen/run-codegen.js.map +1 -1
- package/dist/commands/build.d.ts +0 -4
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +0 -5
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/codegen.d.ts.map +1 -1
- package/dist/commands/codegen.js +1 -3
- package/dist/commands/codegen.js.map +1 -1
- package/dist/commands/docs.d.ts.map +1 -1
- package/dist/commands/docs.js +3 -0
- package/dist/commands/docs.js.map +1 -1
- package/dist/deploy/depends.d.ts +2 -2
- package/dist/deploy/depends.d.ts.map +1 -1
- package/dist/deploy/depends.js +30 -15
- package/dist/deploy/depends.js.map +1 -1
- package/dist/deploy/nfpm/config.js +1 -1
- package/dist/deploy/nfpm/config.js.map +1 -1
- package/dist/deploy/node-runtime/elf.d.ts +1 -1
- package/dist/deploy/node-runtime/elf.d.ts.map +1 -1
- package/dist/deploy/node-runtime/elf.js +2 -2
- package/dist/deploy/node-runtime/elf.js.map +1 -1
- package/dist/deploy/node-runtime/index.js +2 -2
- package/dist/deploy/node-runtime/index.js.map +1 -1
- package/dist/deploy/notices/collect.d.ts +3 -1
- package/dist/deploy/notices/collect.d.ts.map +1 -1
- package/dist/deploy/notices/collect.js +2 -2
- package/dist/deploy/notices/collect.js.map +1 -1
- package/dist/deploy/notices/packages.d.ts +2 -1
- package/dist/deploy/notices/packages.d.ts.map +1 -1
- package/dist/deploy/notices/packages.js +4 -27
- package/dist/deploy/notices/packages.js.map +1 -1
- package/dist/deploy/payload/icons.d.ts +7 -3
- package/dist/deploy/payload/icons.d.ts.map +1 -1
- package/dist/deploy/payload/icons.js +46 -28
- package/dist/deploy/payload/icons.js.map +1 -1
- package/dist/deploy/payload/stage.d.ts.map +1 -1
- package/dist/deploy/payload/stage.js +3 -2
- package/dist/deploy/payload/stage.js.map +1 -1
- package/dist/deploy/run-deploy.d.ts.map +1 -1
- package/dist/deploy/run-deploy.js +63 -11
- package/dist/deploy/run-deploy.js.map +1 -1
- package/dist/deploy/settings/build-manifest.d.ts +9 -0
- package/dist/deploy/settings/build-manifest.d.ts.map +1 -0
- package/dist/deploy/settings/build-manifest.js +80 -0
- package/dist/deploy/settings/build-manifest.js.map +1 -0
- package/dist/deploy/settings/index.d.ts.map +1 -1
- package/dist/deploy/settings/index.js +9 -3
- package/dist/deploy/settings/index.js.map +1 -1
- package/dist/deploy/settings/libraries.d.ts +8 -0
- package/dist/deploy/settings/libraries.d.ts.map +1 -0
- package/dist/deploy/settings/libraries.js +39 -0
- package/dist/deploy/settings/libraries.js.map +1 -0
- package/dist/deploy/settings/paths.d.ts +3 -0
- package/dist/deploy/settings/paths.d.ts.map +1 -1
- package/dist/deploy/settings/paths.js +6 -32
- package/dist/deploy/settings/paths.js.map +1 -1
- package/dist/deploy/targets/appimage.d.ts.map +1 -1
- package/dist/deploy/targets/appimage.js +19 -13
- package/dist/deploy/targets/appimage.js.map +1 -1
- package/dist/deploy/targets/flatpak-manifest.d.ts +2 -1
- package/dist/deploy/targets/flatpak-manifest.d.ts.map +1 -1
- package/dist/deploy/targets/flatpak-manifest.js +5 -1
- package/dist/deploy/targets/flatpak-manifest.js.map +1 -1
- package/dist/deploy/targets/flatpak-pnpm.js +4 -4
- package/dist/deploy/targets/flatpak-pnpm.js.map +1 -1
- package/dist/deploy/targets/flatpak-source.d.ts.map +1 -1
- package/dist/deploy/targets/flatpak-source.js +9 -6
- package/dist/deploy/targets/flatpak-source.js.map +1 -1
- package/dist/deploy/types.d.ts +4 -4
- package/dist/deploy/types.d.ts.map +1 -1
- package/dist/deploy/types.js.map +1 -1
- package/dist/dev/icon-dir.d.ts +1 -1
- package/dist/dev/icon-dir.d.ts.map +1 -1
- package/dist/dev/icon-dir.js +20 -7
- package/dist/dev/icon-dir.js.map +1 -1
- package/dist/dev/runner-deps.d.ts.map +1 -1
- package/dist/dev/runner-deps.js +5 -1
- package/dist/dev/runner-deps.js.map +1 -1
- package/dist/dev/runner-main.js +4 -4
- package/dist/dev/runner-main.js.map +1 -1
- package/dist/dev/runner.d.ts +1 -1
- package/dist/dev/runner.d.ts.map +1 -1
- package/dist/dev/runner.js +1 -1
- package/dist/dev/runner.js.map +1 -1
- package/dist/dev/schema-dir.d.ts +1 -1
- package/dist/dev/schema-dir.d.ts.map +1 -1
- package/dist/dev/schema-dir.js +3 -1
- package/dist/dev/schema-dir.js.map +1 -1
- package/dist/internal/build-manifest.d.ts +20 -0
- package/dist/internal/build-manifest.d.ts.map +1 -0
- package/dist/internal/build-manifest.js +6 -0
- package/dist/internal/build-manifest.js.map +1 -0
- package/dist/internal/icon-path.d.ts +13 -0
- package/dist/internal/icon-path.d.ts.map +1 -0
- package/dist/internal/icon-path.js +86 -0
- package/dist/internal/icon-path.js.map +1 -0
- package/dist/internal/source-imports.d.ts +8 -0
- package/dist/internal/source-imports.d.ts.map +1 -0
- package/dist/internal/source-imports.js +144 -0
- package/dist/internal/source-imports.js.map +1 -0
- package/dist/mcp/widget-properties.d.ts.map +1 -1
- package/dist/mcp/widget-properties.js +3 -12
- package/dist/mcp/widget-properties.js.map +1 -1
- package/dist/settings/render.d.ts +7 -1
- package/dist/settings/render.d.ts.map +1 -1
- package/dist/settings/render.js +69 -20
- package/dist/settings/render.js.map +1 -1
- package/dist/settings/schema.d.ts +4 -3
- package/dist/settings/schema.d.ts.map +1 -1
- package/dist/settings/schema.js +122 -15
- package/dist/settings/schema.js.map +1 -1
- package/dist/vite-plugins/asset-emitter.d.ts +1 -1
- package/dist/vite-plugins/asset-emitter.d.ts.map +1 -1
- package/dist/vite-plugins/asset-emitter.js.map +1 -1
- package/dist/vite-plugins/asset-extensions.d.ts.map +1 -1
- package/dist/vite-plugins/asset-extensions.js +1 -0
- package/dist/vite-plugins/asset-extensions.js.map +1 -1
- package/dist/vite-plugins/asset-imports.d.ts +2 -1
- package/dist/vite-plugins/asset-imports.d.ts.map +1 -1
- package/dist/vite-plugins/asset-imports.js +37 -16
- package/dist/vite-plugins/asset-imports.js.map +1 -1
- package/dist/vite-plugins/asset-specifier.d.ts +13 -1
- package/dist/vite-plugins/asset-specifier.d.ts.map +1 -1
- package/dist/vite-plugins/asset-specifier.js +39 -1
- package/dist/vite-plugins/asset-specifier.js.map +1 -1
- package/dist/vite-plugins/build-manifest.d.ts +5 -0
- package/dist/vite-plugins/build-manifest.d.ts.map +1 -0
- package/dist/vite-plugins/{bundled-packages.js → build-manifest.js} +20 -14
- package/dist/vite-plugins/build-manifest.js.map +1 -0
- package/dist/vite-plugins/built-url.d.ts +1 -1
- package/dist/vite-plugins/built-url.d.ts.map +1 -1
- package/dist/vite-plugins/built-url.js +37 -24
- package/dist/vite-plugins/built-url.js.map +1 -1
- package/dist/vite-plugins/icons.d.ts +2 -1
- package/dist/vite-plugins/icons.d.ts.map +1 -1
- package/dist/vite-plugins/icons.js +25 -12
- package/dist/vite-plugins/icons.js.map +1 -1
- package/dist/vite-plugins/index.d.ts +2 -1
- package/dist/vite-plugins/index.d.ts.map +1 -1
- package/dist/vite-plugins/index.js +7 -5
- package/dist/vite-plugins/index.js.map +1 -1
- package/dist/vite-plugins/native.d.ts.map +1 -1
- package/dist/vite-plugins/native.js +23 -4
- package/dist/vite-plugins/native.js.map +1 -1
- package/dist/vite-plugins/resource-init-module.d.ts +7 -3
- package/dist/vite-plugins/resource-init-module.d.ts.map +1 -1
- package/dist/vite-plugins/resource-init-module.js +39 -14
- package/dist/vite-plugins/resource-init-module.js.map +1 -1
- package/dist/vite-plugins/resource-shared.d.ts +3 -1
- package/dist/vite-plugins/resource-shared.d.ts.map +1 -1
- package/dist/vite-plugins/resource-shared.js +3 -1
- package/dist/vite-plugins/resource-shared.js.map +1 -1
- package/dist/vite-plugins/resources.d.ts +1 -1
- package/dist/vite-plugins/resources.d.ts.map +1 -1
- package/dist/vite-plugins/resources.js +922 -86
- package/dist/vite-plugins/resources.js.map +1 -1
- package/dist/vite-plugins/settings-worker-env.d.ts.map +1 -1
- package/dist/vite-plugins/settings-worker-env.js +6 -3
- package/dist/vite-plugins/settings-worker-env.js.map +1 -1
- package/dist/vite-plugins/settings.d.ts +3 -1
- package/dist/vite-plugins/settings.d.ts.map +1 -1
- package/dist/vite-plugins/settings.js +63 -23
- package/dist/vite-plugins/settings.js.map +1 -1
- package/dist/vite-plugins/store-links.js +1 -1
- package/dist/vite-plugins/store-links.js.map +1 -1
- package/dist/vite-plugins/undeclared-library.d.ts.map +1 -1
- package/dist/vite-plugins/undeclared-library.js +25 -13
- package/dist/vite-plugins/undeclared-library.js.map +1 -1
- package/env.d.ts +11 -192
- package/package.json +14 -14
- package/src/builder.ts +6 -7
- package/src/codegen/freshness.ts +1 -1
- package/src/codegen/run-codegen.ts +33 -10
- package/src/commands/build.ts +0 -5
- package/src/commands/codegen.ts +1 -3
- package/src/commands/docs.ts +3 -0
- package/src/deploy/depends.ts +47 -18
- package/src/deploy/nfpm/config.ts +1 -1
- package/src/deploy/node-runtime/elf.ts +3 -3
- package/src/deploy/node-runtime/index.ts +2 -2
- package/src/deploy/notices/collect.ts +4 -2
- package/src/deploy/notices/packages.ts +5 -43
- package/src/deploy/payload/icons.ts +64 -34
- package/src/deploy/payload/stage.ts +5 -2
- package/src/deploy/run-deploy.ts +87 -12
- package/src/deploy/settings/build-manifest.ts +122 -0
- package/src/deploy/settings/index.ts +9 -4
- package/src/deploy/settings/libraries.ts +57 -0
- package/src/deploy/settings/paths.ts +10 -47
- package/src/deploy/targets/appimage.ts +32 -15
- package/src/deploy/targets/flatpak-manifest.ts +7 -1
- package/src/deploy/targets/flatpak-pnpm.ts +4 -4
- package/src/deploy/targets/flatpak-source.ts +9 -10
- package/src/deploy/types.ts +4 -4
- package/src/dev/icon-dir.ts +31 -7
- package/src/dev/runner-deps.ts +5 -1
- package/src/dev/runner-main.ts +4 -4
- package/src/dev/runner.ts +2 -2
- package/src/dev/schema-dir.ts +3 -1
- package/src/internal/build-manifest.ts +32 -0
- package/src/internal/icon-path.ts +127 -0
- package/src/internal/source-imports.ts +200 -0
- package/src/mcp/widget-properties.ts +3 -14
- package/src/settings/render.ts +99 -21
- package/src/settings/schema.ts +190 -17
- package/src/vite-plugins/asset-emitter.ts +1 -1
- package/src/vite-plugins/asset-extensions.ts +1 -0
- package/src/vite-plugins/asset-imports.ts +60 -19
- package/src/vite-plugins/asset-specifier.ts +73 -1
- package/src/vite-plugins/{bundled-packages.ts → build-manifest.ts} +30 -19
- package/src/vite-plugins/built-url.ts +49 -28
- package/src/vite-plugins/icons.ts +33 -14
- package/src/vite-plugins/index.ts +12 -5
- package/src/vite-plugins/native.ts +31 -4
- package/src/vite-plugins/resource-init-module.ts +44 -15
- package/src/vite-plugins/resource-shared.ts +4 -0
- package/src/vite-plugins/resources.ts +1459 -100
- package/src/vite-plugins/settings-worker-env.ts +7 -3
- package/src/vite-plugins/settings.ts +89 -21
- package/src/vite-plugins/store-links.ts +1 -1
- package/src/vite-plugins/undeclared-library.ts +31 -13
- package/dist/vite-plugins/bundled-packages.d.ts +0 -5
- package/dist/vite-plugins/bundled-packages.d.ts.map +0 -1
- package/dist/vite-plugins/bundled-packages.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"undeclared-library.d.ts","sourceRoot":"","sources":["../../src/vite-plugins/undeclared-library.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,MAAM,EAAc,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"undeclared-library.d.ts","sourceRoot":"","sources":["../../src/vite-plugins/undeclared-library.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,MAAM,EAAc,MAAM,MAAM,CAAC;AA2H/C,iBAAS,qBAAqB,CAAC,UAAU,GAAE,YAAmC,GAAG,MAAM,CA+BtF;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -13,6 +13,9 @@ const girSearchPaths = async (state) => {
|
|
|
13
13
|
const getNamespace = (identifier) => identifier.slice(0, identifier.indexOf("-")).toLowerCase();
|
|
14
14
|
const findGirIdentifier = (girPath, namespace) => discoverGirNamespaces(girPath).find((identifier) => getNamespace(identifier) === namespace);
|
|
15
15
|
const parseGeneratedModule = (source, importer) => {
|
|
16
|
+
if (source === "@gtkx/jsx") {
|
|
17
|
+
return { source, kind: "jsx", namespace: null, importer: importer ?? "the project's sources" };
|
|
18
|
+
}
|
|
16
19
|
const matched = GENERATED_MODULE_PATTERN.exec(source);
|
|
17
20
|
const kind = matched?.[1];
|
|
18
21
|
const namespace = matched?.[2];
|
|
@@ -30,35 +33,44 @@ const getStoreOptions = (root, kind) => {
|
|
|
30
33
|
return null;
|
|
31
34
|
}
|
|
32
35
|
};
|
|
33
|
-
const
|
|
36
|
+
const hasStoreModule = (storeDir, exportKey) => {
|
|
34
37
|
const manifest = join(storeDir, "package.json");
|
|
35
38
|
if (!existsSync(manifest)) {
|
|
36
39
|
return false;
|
|
37
40
|
}
|
|
38
41
|
const { exports } = JSON.parse(readFileSync(manifest, "utf8"));
|
|
39
|
-
return exports?.[
|
|
42
|
+
return exports?.[exportKey] !== undefined;
|
|
43
|
+
};
|
|
44
|
+
const unreachableStoreError = (generated, options) => {
|
|
45
|
+
const provided = generated.namespace === null ? "its index module" : `"${generated.namespace}"`;
|
|
46
|
+
return new Error(`Cannot resolve "${generated.source}": the generated store in ${options.storeDir} does provide ` +
|
|
47
|
+
`${provided}, but its link at ${options.linkDir} is not on the module resolution path of ` +
|
|
48
|
+
`${generated.importer}. Codegen writes the store into the node_modules the installed @gtkx packages ` +
|
|
49
|
+
"resolve from; install them where the importing file reaches them, then run gtkx codegen again.");
|
|
40
50
|
};
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const undeclaredLibraryError = (generated, girPath) => {
|
|
46
|
-
const identifier = findGirIdentifier(girPath, generated.namespace);
|
|
51
|
+
const missingIndexError = (generated) => new Error(`Cannot resolve "${generated.source}": the binding store has no index module. ` +
|
|
52
|
+
"Run gtkx codegen to regenerate the store.");
|
|
53
|
+
const undeclaredLibraryError = (source, namespace, girPath) => {
|
|
54
|
+
const identifier = findGirIdentifier(girPath, namespace);
|
|
47
55
|
if (identifier === undefined) {
|
|
48
|
-
return new Error(`Cannot resolve "${
|
|
49
|
-
`GIR data for it was found in [${girPath.join(", ")}]. If "${
|
|
56
|
+
return new Error(`Cannot resolve "${source}": the binding store has no "${namespace}" module, and no ` +
|
|
57
|
+
`GIR data for it was found in [${girPath.join(", ")}]. If "${namespace}" is a library, ` +
|
|
50
58
|
"install its gobject-introspection data package and add its GIR identifier to `libraries` in " +
|
|
51
59
|
"gtkx.config.ts. Otherwise run gtkx codegen to regenerate the store.");
|
|
52
60
|
}
|
|
53
|
-
return new Error(`Cannot resolve "${
|
|
61
|
+
return new Error(`Cannot resolve "${source}": the "${identifier}" bindings have not been generated. ` +
|
|
54
62
|
`Add "${identifier}" to \`libraries\` in gtkx.config.ts, then run gtkx dev or gtkx build again.`);
|
|
55
63
|
};
|
|
56
64
|
const unresolvedModuleError = async (state, generated) => {
|
|
57
65
|
const options = getStoreOptions(state.root, generated.kind);
|
|
58
|
-
|
|
66
|
+
const exportKey = generated.namespace === null ? "." : `./${generated.namespace}`;
|
|
67
|
+
if (options !== null && hasStoreModule(options.storeDir, exportKey)) {
|
|
59
68
|
return unreachableStoreError(generated, options);
|
|
60
69
|
}
|
|
61
|
-
|
|
70
|
+
if (generated.namespace === null) {
|
|
71
|
+
return missingIndexError(generated);
|
|
72
|
+
}
|
|
73
|
+
return undeclaredLibraryError(generated.source, generated.namespace, await girSearchPaths(state));
|
|
62
74
|
};
|
|
63
75
|
function gtkxUndeclaredLibrary(loadConfig = createConfigLoader()) {
|
|
64
76
|
const state = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"undeclared-library.js","sourceRoot":"","sources":["../../src/vite-plugins/undeclared-library.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACpF,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAejC,MAAM,wBAAwB,GAAG,gCAAgC,CAAC;AAElE,MAAM,cAAc,GAAG,KAAK,EAAE,KAAkB,EAAqB,EAAE;IACnE,IAAI,KAAK,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;QACzB,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC3D,KAAK,CAAC,OAAO,GAAG,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACnD,CAAC;IAED,OAAO,KAAK,CAAC,OAAO,CAAC;AACzB,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,UAAkB,EAAU,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;AAEhH,MAAM,iBAAiB,GAAG,CAAC,OAAiB,EAAE,SAAiB,EAAsB,EAAE,CACnF,qBAAqB,CAAC,OAAO,CAAC,CAAC,IAA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O,CAAC,CAAC;IACrD,CAAC;IAED,OAAO,sBAAsB,CAAC,SAAS,EAAE,MAAM,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC;AAC1E,CAAC,CAAC;AAEF,SAAS,qBAAqB,CAAC,aAA2B,kBAAkB,EAAE;IAC1E,MAAM,KAAK,GAAgB;QACvB,IAAI,EAAE,EAAE;QACR,UAAU;QACV,OAAO,EAAE,IAAI;KAChB,CAAC;IAEF,OAAO;QACH,IAAI,EAAE,yBAAyB;QAC/B,OAAO,EAAE,KAAK;QAEd,MAAM,CAAC,MAAkB;YACrB,KAAK,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAC9C,CAAC;QAED,KAAK,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO;YACrC,MAAM,SAAS,GAAG,oBAAoB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YAEzD,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;gBACrB,OAAO;YACX,CAAC;YAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE,GAAG,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;YAEtF,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;gBACpB,OAAO;YACX,CAAC;YAED,MAAM,MAAM,qBAAqB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QACxD,CAAC;KACJ,CAAC;AACN,CAAC;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAC","sourcesContent":["import type { StoreOptions } from \"@gtkx/codegen\";\nimport type { ConfigLoader } from \"@gtkx/config\";\nimport type { Plugin, UserConfig } from \"vite\";\nimport { discoverGirNamespaces, resolveGirPath, resolveStore } from \"@gtkx/codegen\";\nimport { createConfigLoader } from \"@gtkx/config/internal\";\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\ntype PluginState = {\n root: string;\n loadConfig: ConfigLoader;\n girPath: string[] | null;\n};\n\ntype GeneratedModule = {\n source: string;\n kind: string;\n namespace: string;\n importer: string;\n};\n\nconst GENERATED_MODULE_PATTERN = /^@gtkx\\/(gi|jsx)\\/([a-z0-9]+)$/;\n\nconst girSearchPaths = async (state: PluginState): Promise<string[]> => {\n if (state.girPath === null) {\n const { config } = await state.loadConfig.load(state.root);\n state.girPath = resolveGirPath(config.girPath);\n }\n\n return state.girPath;\n};\n\nconst getNamespace = (identifier: string): string => identifier.slice(0, identifier.indexOf(\"-\")).toLowerCase();\n\nconst findGirIdentifier = (girPath: string[], namespace: string): string | undefined =>\n discoverGirNamespaces(girPath).find((identifier) => getNamespace(identifier) === namespace);\n\nconst parseGeneratedModule = (source: string, importer: string | undefined): GeneratedModule | null => {\n const matched = GENERATED_MODULE_PATTERN.exec(source);\n const kind = matched?.[1];\n const namespace = matched?.[2];\n\n if (kind === undefined || namespace === undefined) {\n return null;\n }\n\n return { source, kind, namespace, importer: importer ?? \"the project's sources\" };\n};\n\nconst getStoreOptions = (root: string, kind: string): StoreOptions | null => {\n try {\n const store = resolveStore(root);\n\n return kind === \"gi\" ? store.gi : store.jsx;\n } catch {\n return null;\n }\n};\n\nconst hasNamespaceModule = (storeDir: string, namespace: string): boolean => {\n const manifest = join(storeDir, \"package.json\");\n\n if (!existsSync(manifest)) {\n return false;\n }\n\n const { exports } = JSON.parse(readFileSync(manifest, \"utf8\")) as { exports?: Record<string, unknown> };\n\n return exports?.[`./${namespace}`] !== undefined;\n};\n\nconst unreachableStoreError = (generated: GeneratedModule, options: StoreOptions): Error =>\n new Error(\n `Cannot resolve \"${generated.source}\": the generated store in ${options.storeDir} does provide ` +\n `\"${generated.namespace}\", but its link at ${options.linkDir} is not on the module resolution path of ` +\n `${generated.importer}. Codegen writes the store into the node_modules the installed @gtkx packages ` +\n \"resolve from; install them where the importing file reaches them, then run gtkx codegen again.\",\n );\n\nconst undeclaredLibraryError = (generated: GeneratedModule, girPath: string[]): Error => {\n const identifier = findGirIdentifier(girPath, generated.namespace);\n\n if (identifier === undefined) {\n return new Error(\n `Cannot resolve \"${generated.source}\": the binding store has no \"${generated.namespace}\" module, and no ` +\n `GIR data for it was found in [${girPath.join(\", \")}]. If \"${generated.namespace}\" is a library, ` +\n \"install its gobject-introspection data package and add its GIR identifier to `libraries` in \" +\n \"gtkx.config.ts. Otherwise run gtkx codegen to regenerate the store.\",\n );\n }\n\n return new Error(\n `Cannot resolve \"${generated.source}\": the \"${identifier}\" bindings have not been generated. ` +\n `Add \"${identifier}\" to \\`libraries\\` in gtkx.config.ts, then run gtkx dev or gtkx build again.`,\n );\n};\n\nconst unresolvedModuleError = async (state: PluginState, generated: GeneratedModule): Promise<Error> => {\n const options = getStoreOptions(state.root, generated.kind);\n\n if (options !== null && hasNamespaceModule(options.storeDir, generated.namespace)) {\n return unreachableStoreError(generated, options);\n }\n\n return undeclaredLibraryError(generated, await girSearchPaths(state));\n};\n\nfunction gtkxUndeclaredLibrary(loadConfig: ConfigLoader = createConfigLoader()): Plugin {\n const state: PluginState = {\n root: \"\",\n loadConfig,\n girPath: null,\n };\n\n return {\n name: \"gtkx:undeclared-library\",\n enforce: \"pre\",\n\n config(config: UserConfig) {\n state.root = config.root ?? process.cwd();\n },\n\n async resolveId(source, importer, options) {\n const generated = parseGeneratedModule(source, importer);\n\n if (generated === null) {\n return;\n }\n\n const resolved = await this.resolve(source, importer, { ...options, skipSelf: true });\n\n if (resolved !== null) {\n return;\n }\n\n throw await unresolvedModuleError(state, generated);\n },\n };\n}\n\nexport { gtkxUndeclaredLibrary };\n"]}
|
|
1
|
+
{"version":3,"file":"undeclared-library.js","sourceRoot":"","sources":["../../src/vite-plugins/undeclared-library.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACpF,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3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tkx/codegen\";\nimport type { ConfigLoader } from \"@gtkx/config\";\nimport type { Plugin, UserConfig } from \"vite\";\nimport { discoverGirNamespaces, resolveGirPath, resolveStore } from \"@gtkx/codegen\";\nimport { createConfigLoader } from \"@gtkx/config/internal\";\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\ntype PluginState = {\n root: string;\n loadConfig: ConfigLoader;\n girPath: string[] | null;\n};\n\ntype GeneratedModule = {\n source: string;\n kind: string;\n namespace: string | null;\n importer: string;\n};\n\nconst GENERATED_MODULE_PATTERN = /^@gtkx\\/(gi|jsx)\\/([a-z0-9]+)$/;\n\nconst girSearchPaths = async (state: PluginState): Promise<string[]> => {\n if (state.girPath === null) {\n const { config } = await state.loadConfig.load(state.root);\n state.girPath = resolveGirPath(config.girPath);\n }\n\n return state.girPath;\n};\n\nconst getNamespace = (identifier: string): string => identifier.slice(0, identifier.indexOf(\"-\")).toLowerCase();\n\nconst findGirIdentifier = (girPath: string[], namespace: string): string | undefined =>\n discoverGirNamespaces(girPath).find((identifier) => getNamespace(identifier) === namespace);\n\nconst parseGeneratedModule = (source: string, importer: string | undefined): GeneratedModule | null => {\n if (source === \"@gtkx/jsx\") {\n return { source, kind: \"jsx\", namespace: null, importer: importer ?? \"the project's sources\" };\n }\n\n const matched = GENERATED_MODULE_PATTERN.exec(source);\n const kind = matched?.[1];\n const namespace = matched?.[2];\n\n if (kind === undefined || namespace === undefined) {\n return null;\n }\n\n return { source, kind, namespace, importer: importer ?? \"the project's sources\" };\n};\n\nconst getStoreOptions = (root: string, kind: string): StoreOptions | null => {\n try {\n const store = resolveStore(root);\n\n return kind === \"gi\" ? store.gi : store.jsx;\n } catch {\n return null;\n }\n};\n\nconst hasStoreModule = (storeDir: string, exportKey: string): boolean => {\n const manifest = join(storeDir, \"package.json\");\n\n if (!existsSync(manifest)) {\n return false;\n }\n\n const { exports } = JSON.parse(readFileSync(manifest, \"utf8\")) as { exports?: Record<string, unknown> };\n\n return exports?.[exportKey] !== undefined;\n};\n\nconst unreachableStoreError = (generated: GeneratedModule, options: StoreOptions): Error => {\n const provided = generated.namespace === null ? \"its index module\" : `\"${generated.namespace}\"`;\n\n return new Error(\n `Cannot resolve \"${generated.source}\": the generated store in ${options.storeDir} does provide ` +\n `${provided}, but its link at ${options.linkDir} is not on the module resolution path of ` +\n `${generated.importer}. Codegen writes the store into the node_modules the installed @gtkx packages ` +\n \"resolve from; install them where the importing file reaches them, then run gtkx codegen again.\",\n );\n};\n\nconst missingIndexError = (generated: GeneratedModule): Error =>\n new Error(\n `Cannot resolve \"${generated.source}\": the binding store has no index module. ` +\n \"Run gtkx codegen to regenerate the store.\",\n );\n\nconst undeclaredLibraryError = (source: string, namespace: string, girPath: string[]): Error => {\n const identifier = findGirIdentifier(girPath, namespace);\n\n if (identifier === undefined) {\n return new Error(\n `Cannot resolve \"${source}\": the binding store has no \"${namespace}\" module, and no ` +\n `GIR data for it was found in [${girPath.join(\", \")}]. If \"${namespace}\" is a library, ` +\n \"install its gobject-introspection data package and add its GIR identifier to `libraries` in \" +\n \"gtkx.config.ts. Otherwise run gtkx codegen to regenerate the store.\",\n );\n }\n\n return new Error(\n `Cannot resolve \"${source}\": the \"${identifier}\" bindings have not been generated. ` +\n `Add \"${identifier}\" to \\`libraries\\` in gtkx.config.ts, then run gtkx dev or gtkx build again.`,\n );\n};\n\nconst unresolvedModuleError = async (state: PluginState, generated: GeneratedModule): Promise<Error> => {\n const options = getStoreOptions(state.root, generated.kind);\n const exportKey = generated.namespace === null ? \".\" : `./${generated.namespace}`;\n\n if (options !== null && hasStoreModule(options.storeDir, exportKey)) {\n return unreachableStoreError(generated, options);\n }\n\n if (generated.namespace === null) {\n return missingIndexError(generated);\n }\n\n return undeclaredLibraryError(generated.source, generated.namespace, await girSearchPaths(state));\n};\n\nfunction gtkxUndeclaredLibrary(loadConfig: ConfigLoader = createConfigLoader()): Plugin {\n const state: PluginState = {\n root: \"\",\n loadConfig,\n girPath: null,\n };\n\n return {\n name: \"gtkx:undeclared-library\",\n enforce: \"pre\",\n\n config(config: UserConfig) {\n state.root = config.root ?? process.cwd();\n },\n\n async resolveId(source, importer, options) {\n const generated = parseGeneratedModule(source, importer);\n\n if (generated === null) {\n return;\n }\n\n const resolved = await this.resolve(source, importer, { ...options, skipSelf: true });\n\n if (resolved !== null) {\n return;\n }\n\n throw await unresolvedModuleError(state, generated);\n },\n };\n}\n\nexport { gtkxUndeclaredLibrary };\n"]}
|
package/env.d.ts
CHANGED
|
@@ -1,204 +1,23 @@
|
|
|
1
1
|
/// <reference types="vite/client" />
|
|
2
2
|
/// <reference types="@gtkx/react/env" />
|
|
3
3
|
|
|
4
|
-
declare module "
|
|
5
|
-
/**
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
export
|
|
9
|
-
export default resourceUri;
|
|
4
|
+
declare module "*?resource" {
|
|
5
|
+
/** GResource path of the bundled asset. */
|
|
6
|
+
const path: string;
|
|
7
|
+
export { path };
|
|
8
|
+
export default path;
|
|
10
9
|
}
|
|
11
10
|
|
|
12
|
-
declare module "
|
|
13
|
-
/**
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
export const path: string;
|
|
17
|
-
export default resourceUri;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
declare module "#data/*.data" {
|
|
21
|
-
/** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
|
|
22
|
-
const resourceUri: string;
|
|
23
|
-
/** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
|
|
24
|
-
export const path: string;
|
|
25
|
-
export default resourceUri;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
declare module "#data/*.eot" {
|
|
29
|
-
/** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
|
|
30
|
-
const resourceUri: string;
|
|
31
|
-
/** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
|
|
32
|
-
export const path: string;
|
|
33
|
-
export default resourceUri;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
declare module "#data/*.flac" {
|
|
37
|
-
/** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
|
|
38
|
-
const resourceUri: string;
|
|
39
|
-
/** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
|
|
40
|
-
export const path: string;
|
|
41
|
-
export default resourceUri;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
declare module "#data/*.gif" {
|
|
45
|
-
/** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
|
|
46
|
-
const resourceUri: string;
|
|
47
|
-
/** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
|
|
48
|
-
export const path: string;
|
|
49
|
-
export default resourceUri;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
declare module "#data/*.gpa" {
|
|
53
|
-
/** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
|
|
54
|
-
const resourceUri: string;
|
|
55
|
-
/** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
|
|
56
|
-
export const path: string;
|
|
57
|
-
export default resourceUri;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
declare module "#data/*.ico" {
|
|
61
|
-
/** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
|
|
62
|
-
const resourceUri: string;
|
|
63
|
-
/** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
|
|
64
|
-
export const path: string;
|
|
65
|
-
export default resourceUri;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
declare module "#data/*.jpeg" {
|
|
69
|
-
/** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
|
|
70
|
-
const resourceUri: string;
|
|
71
|
-
/** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
|
|
72
|
-
export const path: string;
|
|
73
|
-
export default resourceUri;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
declare module "#data/*.jpg" {
|
|
77
|
-
/** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
|
|
78
|
-
const resourceUri: string;
|
|
79
|
-
/** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
|
|
80
|
-
export const path: string;
|
|
81
|
-
export default resourceUri;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
declare module "#data/*.mp3" {
|
|
85
|
-
/** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
|
|
86
|
-
const resourceUri: string;
|
|
87
|
-
/** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
|
|
88
|
-
export const path: string;
|
|
89
|
-
export default resourceUri;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
declare module "#data/*.mp4" {
|
|
93
|
-
/** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
|
|
94
|
-
const resourceUri: string;
|
|
95
|
-
/** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
|
|
96
|
-
export const path: string;
|
|
97
|
-
export default resourceUri;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
declare module "#data/*.ogg" {
|
|
101
|
-
/** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
|
|
102
|
-
const resourceUri: string;
|
|
103
|
-
/** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
|
|
104
|
-
export const path: string;
|
|
105
|
-
export default resourceUri;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
declare module "#data/*.otf" {
|
|
109
|
-
/** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
|
|
110
|
-
const resourceUri: string;
|
|
111
|
-
/** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
|
|
112
|
-
export const path: string;
|
|
113
|
-
export default resourceUri;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
declare module "#data/*.png" {
|
|
117
|
-
/** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
|
|
118
|
-
const resourceUri: string;
|
|
119
|
-
/** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
|
|
120
|
-
export const path: string;
|
|
121
|
-
export default resourceUri;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
declare module "#data/*.svg" {
|
|
125
|
-
/** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
|
|
126
|
-
const resourceUri: string;
|
|
127
|
-
/** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
|
|
128
|
-
export const path: string;
|
|
129
|
-
export default resourceUri;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
declare module "#data/*.ttf" {
|
|
133
|
-
/** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
|
|
134
|
-
const resourceUri: string;
|
|
135
|
-
/** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
|
|
136
|
-
export const path: string;
|
|
137
|
-
export default resourceUri;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
declare module "#data/*.wav" {
|
|
141
|
-
/** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
|
|
142
|
-
const resourceUri: string;
|
|
143
|
-
/** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
|
|
144
|
-
export const path: string;
|
|
145
|
-
export default resourceUri;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
declare module "#data/*.webm" {
|
|
149
|
-
/** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
|
|
150
|
-
const resourceUri: string;
|
|
151
|
-
/** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
|
|
152
|
-
export const path: string;
|
|
153
|
-
export default resourceUri;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
declare module "#data/*.webp" {
|
|
157
|
-
/** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
|
|
158
|
-
const resourceUri: string;
|
|
159
|
-
/** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
|
|
160
|
-
export const path: string;
|
|
161
|
-
export default resourceUri;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
declare module "#data/*.woff" {
|
|
165
|
-
/** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
|
|
166
|
-
const resourceUri: string;
|
|
167
|
-
/** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
|
|
168
|
-
export const path: string;
|
|
169
|
-
export default resourceUri;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
declare module "#data/*.woff2" {
|
|
173
|
-
/** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
|
|
174
|
-
const resourceUri: string;
|
|
175
|
-
/** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
|
|
176
|
-
export const path: string;
|
|
177
|
-
export default resourceUri;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
declare module "*.data" {
|
|
181
|
-
/**
|
|
182
|
-
* URL of the emitted asset: a dev server URL under `gtkx dev`, an absolute filesystem path once built.
|
|
183
|
-
* Import it under `#data/` instead for a GResource path and a `resource://` URI.
|
|
184
|
-
*/
|
|
185
|
-
const assetUrl: string;
|
|
186
|
-
export default assetUrl;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
declare module "*.gpa" {
|
|
190
|
-
/**
|
|
191
|
-
* URL of the emitted asset: a dev server URL under `gtkx dev`, an absolute filesystem path once built.
|
|
192
|
-
* Import it under `#data/` instead for a GResource path and a `resource://` URI.
|
|
193
|
-
*/
|
|
194
|
-
const assetUrl: string;
|
|
195
|
-
export default assetUrl;
|
|
11
|
+
declare module "*?icon" {
|
|
12
|
+
/** Icon-theme name of the bundled asset. */
|
|
13
|
+
const iconName: string;
|
|
14
|
+
export default iconName;
|
|
196
15
|
}
|
|
197
16
|
|
|
198
17
|
declare module "*.css?url" {
|
|
199
18
|
/**
|
|
200
|
-
*
|
|
201
|
-
*
|
|
19
|
+
* Absolute filesystem path of the source stylesheet under `gtkx dev` or the emitted stylesheet once built,
|
|
20
|
+
* imported without installing it on the default display.
|
|
202
21
|
*/
|
|
203
22
|
const styleSheetUrl: string;
|
|
204
23
|
export default styleSheetUrl;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gtkx/cli",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.4.0",
|
|
4
|
+
"description": "GTK app toolchain for React: scaffold, dev server, build, docs.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"gtkx",
|
|
7
7
|
"gtk",
|
|
@@ -66,26 +66,26 @@
|
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"@babel/core": "^8.0.1",
|
|
68
68
|
"@babel/preset-typescript": "^8.0.1",
|
|
69
|
-
"@swc/core": "^1.
|
|
69
|
+
"@swc/core": "^1.16.1",
|
|
70
70
|
"babel-plugin-react-compiler": "^1.0.0",
|
|
71
71
|
"citty": "^0.2.2",
|
|
72
|
-
"fast-xml-parser": "^5.
|
|
72
|
+
"fast-xml-parser": "^5.11.0",
|
|
73
73
|
"react-refresh": "^0.18.0",
|
|
74
|
-
"vite": "^8.2.
|
|
74
|
+
"vite": "^8.2.2",
|
|
75
75
|
"yaml": "^2.9.0",
|
|
76
|
-
"@gtkx/
|
|
77
|
-
"@gtkx/
|
|
78
|
-
"@gtkx/
|
|
79
|
-
"@gtkx/
|
|
80
|
-
"@gtkx/
|
|
81
|
-
"
|
|
82
|
-
"
|
|
76
|
+
"@gtkx/codegen": "1.4.0",
|
|
77
|
+
"@gtkx/config": "1.4.0",
|
|
78
|
+
"@gtkx/mcp": "1.4.0",
|
|
79
|
+
"@gtkx/utils": "1.4.0",
|
|
80
|
+
"@gtkx/runtime": "1.4.0",
|
|
81
|
+
"@gtkx/vitest": "1.4.0",
|
|
82
|
+
"create-gtkx": "1.4.0"
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
85
|
"@types/babel__core": "^7.20.5",
|
|
86
86
|
"@types/react-refresh": "^0.14.7",
|
|
87
|
-
"vitest": "^4.1.
|
|
88
|
-
"@gtkx/testing": "1.
|
|
87
|
+
"vitest": "^4.1.11",
|
|
88
|
+
"@gtkx/testing": "1.4.0"
|
|
89
89
|
},
|
|
90
90
|
"peerDependencies": {
|
|
91
91
|
"react": "^19"
|
package/src/builder.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { join, posix } from "node:path";
|
|
2
2
|
import { type InlineConfig, mergeConfig, build as viteBuild } from "vite";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { createBuildManifestCollector } from "./internal/build-manifest.js";
|
|
4
|
+
import { gtkxBuildManifest } from "./vite-plugins/build-manifest.js";
|
|
5
5
|
import { BUNDLE_FILENAME, ESM_EXTENSION } from "./vite-plugins/esm-extension.js";
|
|
6
6
|
import { gtkxVitePlugins } from "./vite-plugins/index.js";
|
|
7
7
|
import { gtkxNative } from "./vite-plugins/native.js";
|
|
@@ -10,7 +10,6 @@ import { gtkxWorker } from "./vite-plugins/worker.js";
|
|
|
10
10
|
|
|
11
11
|
type BuildOptions = {
|
|
12
12
|
entry: string;
|
|
13
|
-
assetBase?: string | undefined;
|
|
14
13
|
vite?: InlineConfig | undefined;
|
|
15
14
|
};
|
|
16
15
|
|
|
@@ -33,17 +32,17 @@ const buildDefaults: InlineConfig = {
|
|
|
33
32
|
};
|
|
34
33
|
|
|
35
34
|
const build = async (options: BuildOptions): Promise<string> => {
|
|
36
|
-
const { entry,
|
|
35
|
+
const { entry, vite: viteConfig } = options;
|
|
37
36
|
const root = viteConfig?.root ?? process.cwd();
|
|
38
37
|
const assetsDir = viteConfig?.build?.assetsDir ?? DEFAULT_ASSETS_DIR;
|
|
38
|
+
const buildManifest = createBuildManifestCollector();
|
|
39
39
|
|
|
40
40
|
const forced: InlineConfig = {
|
|
41
41
|
plugins: [
|
|
42
|
-
...gtkxVitePlugins(BUILD_MODE),
|
|
42
|
+
...gtkxVitePlugins(BUILD_MODE, undefined, buildManifest),
|
|
43
43
|
gtkxWorker(),
|
|
44
|
-
gtkxBuiltUrl(assetBase),
|
|
45
44
|
gtkxNative(root),
|
|
46
|
-
|
|
45
|
+
gtkxBuildManifest(root, buildManifest),
|
|
47
46
|
gtkxSelfContained(),
|
|
48
47
|
],
|
|
49
48
|
build: {
|
package/src/codegen/freshness.ts
CHANGED
|
@@ -10,7 +10,7 @@ type CodegenInputs = {
|
|
|
10
10
|
store: CodegenStore;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
const REACT_GENERATED_MODULES: string[] = ["metadata.js", join("gtk", "gtk.js")];
|
|
13
|
+
const REACT_GENERATED_MODULES: string[] = ["index.js", "metadata.js", join("gtk", "gtk.js")];
|
|
14
14
|
|
|
15
15
|
const resolveCodegenInputs = (cwd: string, config: Config): CodegenInputs => {
|
|
16
16
|
const girPath = resolveGirPath(config.girPath);
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
resolveLazyElements,
|
|
8
8
|
resolveOmittedProps,
|
|
9
9
|
} from "@gtkx/config/internal";
|
|
10
|
-
import { info } from "@gtkx/utils";
|
|
10
|
+
import { info, warn } from "@gtkx/utils";
|
|
11
11
|
import { rmSync } from "node:fs";
|
|
12
12
|
import { resolve } from "node:path";
|
|
13
13
|
import { resolveDataDir } from "../internal/data-dir.js";
|
|
@@ -32,6 +32,7 @@ type RunCodegenResult = {
|
|
|
32
32
|
isRegenerated: boolean;
|
|
33
33
|
namespaces: number;
|
|
34
34
|
intrinsicElements: number;
|
|
35
|
+
notices: string[];
|
|
35
36
|
duration: number;
|
|
36
37
|
girPath?: string[] | undefined;
|
|
37
38
|
configFile?: string | undefined;
|
|
@@ -45,6 +46,9 @@ type CodegenOptionsInput = {
|
|
|
45
46
|
girPath: string[];
|
|
46
47
|
elements: Config["elements"];
|
|
47
48
|
isByteArrayTyped: boolean;
|
|
49
|
+
isValueUnwrapped: boolean;
|
|
50
|
+
isFinishTrimmed: boolean;
|
|
51
|
+
isInoutInPlace: boolean;
|
|
48
52
|
};
|
|
49
53
|
|
|
50
54
|
type PreparedCodegen = CodegenInputs & { isForced: boolean };
|
|
@@ -73,10 +77,13 @@ const removeShadowingStores = (cwd: string): void => {
|
|
|
73
77
|
removeStores(getShadowingStorePaths(cwd));
|
|
74
78
|
};
|
|
75
79
|
|
|
76
|
-
const codegenOptions = ({ store, libraries, girPath, elements,
|
|
80
|
+
const codegenOptions = ({ store, libraries, girPath, elements, ...future }: CodegenOptionsInput) => ({
|
|
77
81
|
libraries,
|
|
78
82
|
girPath,
|
|
79
|
-
isByteArrayTyped,
|
|
83
|
+
isByteArrayTyped: future.isByteArrayTyped,
|
|
84
|
+
isValueUnwrapped: future.isValueUnwrapped,
|
|
85
|
+
isFinishTrimmed: future.isFinishTrimmed,
|
|
86
|
+
isInoutInPlace: future.isInoutInPlace,
|
|
80
87
|
gi: {
|
|
81
88
|
storeDir: store.giStoreDir,
|
|
82
89
|
linkDir: store.giLinkDir,
|
|
@@ -106,12 +113,19 @@ const disabledCodegenResult = (configFile: string): RunCodegenResult => ({
|
|
|
106
113
|
isRegenerated: false,
|
|
107
114
|
namespaces: 0,
|
|
108
115
|
intrinsicElements: 0,
|
|
116
|
+
notices: [],
|
|
109
117
|
duration: 0,
|
|
110
118
|
girPath: [],
|
|
111
119
|
configFile,
|
|
112
120
|
libraries: [],
|
|
113
121
|
});
|
|
114
122
|
|
|
123
|
+
const warnNotices = (notices: string[]): void => {
|
|
124
|
+
for (const notice of notices) {
|
|
125
|
+
warn(notice);
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
|
|
115
129
|
const regeneratedStorePaths = (store: CodegenStore): string[] => {
|
|
116
130
|
if (store.react === null) {
|
|
117
131
|
return [store.giStoreDir, store.giLinkDir];
|
|
@@ -142,6 +156,7 @@ const prepareCodegen = (options: RunCodegenOptions, cwd: string, config: Config)
|
|
|
142
156
|
const runCodegen = async (options: RunCodegenOptions = {}): Promise<RunCodegenResult> => {
|
|
143
157
|
const cwd = options.cwd ?? process.cwd();
|
|
144
158
|
const { config, configFile } = await resolveLoadedConfig(options, cwd);
|
|
159
|
+
syncSchemaEnv(cwd, config.future?.v2ResourceImports === true);
|
|
145
160
|
|
|
146
161
|
if (config.codegen === false) {
|
|
147
162
|
removeShadowingStores(cwd);
|
|
@@ -162,14 +177,20 @@ const runCodegen = async (options: RunCodegenOptions = {}): Promise<RunCodegenRe
|
|
|
162
177
|
girPath,
|
|
163
178
|
elements: config.elements,
|
|
164
179
|
isByteArrayTyped: config.future?.v2ByteArrays === true,
|
|
180
|
+
isValueUnwrapped: config.future?.v2ValueReturns === true,
|
|
181
|
+
isFinishTrimmed: config.future?.v2FinishResults === true,
|
|
182
|
+
isInoutInPlace: config.future?.v2InoutReturns === true,
|
|
165
183
|
}),
|
|
166
184
|
isForced,
|
|
167
185
|
});
|
|
168
186
|
|
|
187
|
+
warnNotices(result.notices);
|
|
188
|
+
|
|
169
189
|
return {
|
|
170
190
|
isRegenerated: result.isRegenerated,
|
|
171
191
|
namespaces: result.namespaces,
|
|
172
192
|
intrinsicElements: result.intrinsicElements,
|
|
193
|
+
notices: result.notices,
|
|
173
194
|
duration: result.duration,
|
|
174
195
|
girPath,
|
|
175
196
|
configFile,
|
|
@@ -188,8 +209,9 @@ const isCodegenDisabled = async (cwd: string, mode?: string): Promise<boolean> =
|
|
|
188
209
|
}
|
|
189
210
|
};
|
|
190
211
|
|
|
191
|
-
const syncSchemaEnv = (cwd: string): void => {
|
|
192
|
-
|
|
212
|
+
const syncSchemaEnv = (cwd: string, isV2ResourceImports = false): void => {
|
|
213
|
+
const dataDir = isV2ResourceImports ? null : resolveDataDir(cwd);
|
|
214
|
+
emitSchemaEnv(cwd, dataDir, isV2ResourceImports);
|
|
193
215
|
};
|
|
194
216
|
|
|
195
217
|
const resolveInputsOrNull = (cwd: string, config: Config): CodegenInputs | null => {
|
|
@@ -223,12 +245,14 @@ const isPreflightSkipped = (options: EnsureGeneratedOptions): boolean =>
|
|
|
223
245
|
|
|
224
246
|
/* eslint-disable-next-line unicorn/consistent-boolean-name -- the boolean reports whether codegen ran */
|
|
225
247
|
const generate = async (context: CodegenContext, options: EnsureGeneratedOptions): Promise<boolean> => {
|
|
226
|
-
syncSchemaEnv(context.root);
|
|
227
|
-
|
|
228
248
|
if (context.config.codegen === false) {
|
|
229
|
-
|
|
249
|
+
const result = await runCodegen({
|
|
250
|
+
cwd: context.root,
|
|
251
|
+
mode: options.mode,
|
|
252
|
+
resolved: { config: context.config, configFile: context.configFile },
|
|
253
|
+
});
|
|
230
254
|
|
|
231
|
-
return
|
|
255
|
+
return result.isRegenerated;
|
|
232
256
|
}
|
|
233
257
|
|
|
234
258
|
const inputs = resolveInputsOrNull(context.root, context.config);
|
|
@@ -266,7 +290,6 @@ const resolveConfigWatch = async (
|
|
|
266
290
|
export {
|
|
267
291
|
runCodegen,
|
|
268
292
|
isCodegenDisabled,
|
|
269
|
-
syncSchemaEnv,
|
|
270
293
|
ensureGenerated,
|
|
271
294
|
ensureGeneratedIn,
|
|
272
295
|
resolveConfigWatch,
|
package/src/commands/build.ts
CHANGED
|
@@ -13,10 +13,6 @@ const build = defineCommand({
|
|
|
13
13
|
},
|
|
14
14
|
args: {
|
|
15
15
|
...entryArg,
|
|
16
|
-
"asset-base": {
|
|
17
|
-
type: "string",
|
|
18
|
-
description: "Asset base path relative to executable directory (e.g., ../share/my-app)",
|
|
19
|
-
},
|
|
20
16
|
},
|
|
21
17
|
async run({ args }) {
|
|
22
18
|
const { cwd, entry } = await prepareProject(args, BUILD_MODE);
|
|
@@ -24,7 +20,6 @@ const build = defineCommand({
|
|
|
24
20
|
|
|
25
21
|
const bundlePath = await buildApp({
|
|
26
22
|
entry,
|
|
27
|
-
assetBase: args["asset-base"],
|
|
28
23
|
vite: {
|
|
29
24
|
root: cwd,
|
|
30
25
|
},
|
package/src/commands/codegen.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { info } from "@gtkx/utils";
|
|
2
2
|
import { defineCommand } from "citty";
|
|
3
3
|
import { formatCodegenResult } from "../codegen/report.js";
|
|
4
|
-
import { ensureGenerated, isCodegenDisabled, runCodegen
|
|
4
|
+
import { ensureGenerated, isCodegenDisabled, runCodegen } from "../codegen/run-codegen.js";
|
|
5
5
|
import { cwdArg, resolveCwd } from "../internal/entry-arg.js";
|
|
6
6
|
|
|
7
7
|
const FORCED_WHILE_DISABLED_MESSAGE =
|
|
@@ -29,7 +29,6 @@ const codegen = defineCommand({
|
|
|
29
29
|
|
|
30
30
|
if (isDisabled) {
|
|
31
31
|
await runCodegen({ cwd });
|
|
32
|
-
syncSchemaEnv(cwd);
|
|
33
32
|
info("codegen: disabled for this project; reusing an installed binding store");
|
|
34
33
|
|
|
35
34
|
return;
|
|
@@ -44,7 +43,6 @@ const codegen = defineCommand({
|
|
|
44
43
|
|
|
45
44
|
const startedAt = Date.now();
|
|
46
45
|
const result = await runCodegen({ cwd, isForced: true });
|
|
47
|
-
syncSchemaEnv(cwd);
|
|
48
46
|
const lines = formatCodegenResult(result, Date.now() - startedAt);
|
|
49
47
|
|
|
50
48
|
for (const line of lines) {
|
package/src/commands/docs.ts
CHANGED
|
@@ -79,6 +79,9 @@ const docs = defineCommand({
|
|
|
79
79
|
omittedProps: mergeOmittedProps(builtin.omittedProps, resolveOmittedProps(config.elements)),
|
|
80
80
|
isForced: args.force,
|
|
81
81
|
isByteArrayTyped: config.future?.v2ByteArrays === true,
|
|
82
|
+
isValueUnwrapped: config.future?.v2ValueReturns === true,
|
|
83
|
+
isFinishTrimmed: config.future?.v2FinishResults === true,
|
|
84
|
+
isInoutInPlace: config.future?.v2InoutReturns === true,
|
|
82
85
|
});
|
|
83
86
|
|
|
84
87
|
if (!isRegenerated) {
|