@gtkx/cli 1.6.0 → 2.0.0-beta.2
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 +5 -5
- package/dist/builder.d.ts +1 -0
- package/dist/builder.d.ts.map +1 -1
- package/dist/builder.js +17 -5
- package/dist/builder.js.map +1 -1
- package/dist/cli.js +2 -0
- package/dist/cli.js.map +1 -1
- package/dist/codegen/freshness.d.ts.map +1 -1
- package/dist/codegen/freshness.js +45 -16
- package/dist/codegen/freshness.js.map +1 -1
- package/dist/codegen/reference.d.ts.map +1 -1
- package/dist/codegen/reference.js +1 -7
- package/dist/codegen/reference.js.map +1 -1
- package/dist/codegen/report.d.ts.map +1 -1
- package/dist/codegen/report.js +5 -16
- package/dist/codegen/report.js.map +1 -1
- package/dist/codegen/run-codegen.d.ts +7 -7
- package/dist/codegen/run-codegen.d.ts.map +1 -1
- package/dist/codegen/run-codegen.js +35 -107
- package/dist/codegen/run-codegen.js.map +1 -1
- package/dist/codegen/store-resolver.d.ts +1 -2
- package/dist/codegen/store-resolver.d.ts.map +1 -1
- package/dist/codegen/store-resolver.js +10 -19
- package/dist/codegen/store-resolver.js.map +1 -1
- package/dist/commands/build.d.ts +5 -0
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +83 -10
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/codegen.d.ts +1 -0
- package/dist/commands/codegen.d.ts.map +1 -1
- package/dist/commands/codegen.js +6 -5
- package/dist/commands/codegen.js.map +1 -1
- package/dist/commands/deploy.d.ts +1 -0
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +4 -2
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/dev.d.ts +8 -0
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +19 -1
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/docs.d.ts.map +1 -1
- package/dist/commands/docs.js +5 -15
- package/dist/commands/docs.js.map +1 -1
- package/dist/deploy/freedesktop/copyright.d.ts.map +1 -1
- package/dist/deploy/freedesktop/copyright.js +2 -13
- package/dist/deploy/freedesktop/copyright.js.map +1 -1
- package/dist/deploy/freedesktop/metainfo.d.ts.map +1 -1
- package/dist/deploy/freedesktop/metainfo.js +41 -2
- package/dist/deploy/freedesktop/metainfo.js.map +1 -1
- package/dist/deploy/freedesktop/xml.d.ts.map +1 -1
- package/dist/deploy/freedesktop/xml.js +21 -25
- package/dist/deploy/freedesktop/xml.js.map +1 -1
- package/dist/deploy/nfpm/config.d.ts.map +1 -1
- package/dist/deploy/nfpm/config.js +5 -2
- package/dist/deploy/nfpm/config.js.map +1 -1
- package/dist/deploy/nfpm/contents.d.ts.map +1 -1
- package/dist/deploy/nfpm/contents.js +8 -0
- package/dist/deploy/nfpm/contents.js.map +1 -1
- package/dist/deploy/node-runtime/elf.d.ts +2 -1
- package/dist/deploy/node-runtime/elf.d.ts.map +1 -1
- package/dist/deploy/node-runtime/elf.js +32 -5
- package/dist/deploy/node-runtime/elf.js.map +1 -1
- package/dist/deploy/node-runtime/index.d.ts +2 -1
- package/dist/deploy/node-runtime/index.d.ts.map +1 -1
- package/dist/deploy/node-runtime/index.js +73 -4
- package/dist/deploy/node-runtime/index.js.map +1 -1
- package/dist/deploy/node-runtime/license.d.ts.map +1 -1
- package/dist/deploy/node-runtime/license.js +2 -9
- package/dist/deploy/node-runtime/license.js.map +1 -1
- package/dist/deploy/notices/node-runtime.js +2 -2
- package/dist/deploy/notices/node-runtime.js.map +1 -1
- package/dist/deploy/notices/packages.d.ts.map +1 -1
- package/dist/deploy/notices/packages.js +3 -10
- package/dist/deploy/notices/packages.js.map +1 -1
- package/dist/deploy/payload/copy-tree.d.ts.map +1 -1
- package/dist/deploy/payload/copy-tree.js +3 -3
- package/dist/deploy/payload/copy-tree.js.map +1 -1
- package/dist/deploy/payload/launcher.d.ts.map +1 -1
- package/dist/deploy/payload/launcher.js +14 -1
- package/dist/deploy/payload/launcher.js.map +1 -1
- package/dist/deploy/payload/stage.d.ts.map +1 -1
- package/dist/deploy/payload/stage.js +2 -4
- package/dist/deploy/payload/stage.js.map +1 -1
- package/dist/deploy/run-deploy.d.ts +1 -0
- package/dist/deploy/run-deploy.d.ts.map +1 -1
- package/dist/deploy/run-deploy.js +100 -14
- package/dist/deploy/run-deploy.js.map +1 -1
- package/dist/deploy/settings/build-manifest.d.ts +6 -1
- package/dist/deploy/settings/build-manifest.d.ts.map +1 -1
- package/dist/deploy/settings/build-manifest.js +17 -17
- package/dist/deploy/settings/build-manifest.js.map +1 -1
- package/dist/deploy/settings/extra-files.d.ts +1 -1
- package/dist/deploy/settings/extra-files.d.ts.map +1 -1
- package/dist/deploy/settings/extra-files.js +22 -1
- package/dist/deploy/settings/extra-files.js.map +1 -1
- package/dist/deploy/settings/index.d.ts +1 -0
- package/dist/deploy/settings/index.d.ts.map +1 -1
- package/dist/deploy/settings/index.js +2 -1
- package/dist/deploy/settings/index.js.map +1 -1
- package/dist/deploy/settings/libraries.d.ts.map +1 -1
- package/dist/deploy/settings/libraries.js +2 -19
- package/dist/deploy/settings/libraries.js.map +1 -1
- package/dist/deploy/settings/paths.d.ts +2 -2
- package/dist/deploy/settings/paths.d.ts.map +1 -1
- package/dist/deploy/settings/paths.js +110 -12
- package/dist/deploy/settings/paths.js.map +1 -1
- package/dist/deploy/settings/screenshots.d.ts.map +1 -1
- package/dist/deploy/settings/screenshots.js +6 -31
- package/dist/deploy/settings/screenshots.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 +15 -6
- package/dist/deploy/targets/flatpak-source.js.map +1 -1
- package/dist/deploy/targets/flatpak-sources.js +1 -1
- package/dist/deploy/targets/flatpak-sources.js.map +1 -1
- package/dist/deploy/types.d.ts +1 -0
- package/dist/deploy/types.d.ts.map +1 -1
- package/dist/deploy/types.js.map +1 -1
- package/dist/dev/headless.d.ts +3 -0
- package/dist/dev/headless.d.ts.map +1 -0
- package/dist/dev/headless.js +35 -0
- package/dist/dev/headless.js.map +1 -0
- package/dist/dev/runner-deps.js +1 -1
- package/dist/dev/runner-deps.js.map +1 -1
- package/dist/dev/runner-main.d.ts.map +1 -1
- package/dist/dev/runner-main.js +1 -2
- package/dist/dev/runner-main.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 +2 -4
- package/dist/dev/schema-dir.js.map +1 -1
- package/dist/i18n/catalogs.d.ts.map +1 -1
- package/dist/i18n/catalogs.js +2 -1
- package/dist/i18n/catalogs.js.map +1 -1
- package/dist/i18n/metadata-templates.d.ts.map +1 -1
- package/dist/i18n/metadata-templates.js +2 -1
- package/dist/i18n/metadata-templates.js.map +1 -1
- package/dist/i18n/source-messages.d.ts +3 -21
- package/dist/i18n/source-messages.d.ts.map +1 -1
- package/dist/i18n/source-messages.js +900 -85
- package/dist/i18n/source-messages.js.map +1 -1
- package/dist/i18n/types.d.ts +6 -7
- package/dist/i18n/types.d.ts.map +1 -1
- package/dist/i18n/types.js +83 -96
- package/dist/i18n/types.js.map +1 -1
- package/dist/internal/build-manifest.d.ts +5 -2
- package/dist/internal/build-manifest.d.ts.map +1 -1
- package/dist/internal/build-manifest.js +15 -2
- package/dist/internal/build-manifest.js.map +1 -1
- package/dist/internal/build-output.d.ts +8 -0
- package/dist/internal/build-output.d.ts.map +1 -0
- package/dist/internal/build-output.js +69 -0
- package/dist/internal/build-output.js.map +1 -0
- package/dist/internal/docs-elements.js +2 -2
- package/dist/internal/docs-elements.js.map +1 -1
- package/dist/internal/entry-arg.d.ts +4 -1
- package/dist/internal/entry-arg.d.ts.map +1 -1
- package/dist/internal/entry-arg.js +7 -1
- package/dist/internal/entry-arg.js.map +1 -1
- package/dist/internal/icon-path.d.ts.map +1 -1
- package/dist/internal/icon-path.js +5 -16
- package/dist/internal/icon-path.js.map +1 -1
- package/dist/internal/output-directory.d.ts +15 -0
- package/dist/internal/output-directory.d.ts.map +1 -0
- package/dist/internal/output-directory.js +490 -0
- package/dist/internal/output-directory.js.map +1 -0
- package/dist/internal/prepare-project.d.ts +2 -0
- package/dist/internal/prepare-project.d.ts.map +1 -1
- package/dist/internal/prepare-project.js +3 -3
- package/dist/internal/prepare-project.js.map +1 -1
- package/dist/internal/source-imports.d.ts.map +1 -1
- package/dist/internal/source-imports.js +10 -41
- package/dist/internal/source-imports.js.map +1 -1
- package/dist/mcp/client.js +2 -2
- package/dist/mcp/client.js.map +1 -1
- package/dist/settings/render.d.ts +0 -1
- package/dist/settings/render.d.ts.map +1 -1
- package/dist/settings/render.js +1 -11
- package/dist/settings/render.js.map +1 -1
- package/dist/settings/schema.d.ts +2 -2
- package/dist/settings/schema.d.ts.map +1 -1
- package/dist/settings/schema.js +21 -62
- package/dist/settings/schema.js.map +1 -1
- package/dist/vite-plugins/asset-imports.d.ts +1 -2
- package/dist/vite-plugins/asset-imports.d.ts.map +1 -1
- package/dist/vite-plugins/asset-imports.js +19 -32
- package/dist/vite-plugins/asset-imports.js.map +1 -1
- package/dist/vite-plugins/asset-specifier.d.ts +1 -3
- package/dist/vite-plugins/asset-specifier.d.ts.map +1 -1
- package/dist/vite-plugins/asset-specifier.js +1 -4
- package/dist/vite-plugins/asset-specifier.js.map +1 -1
- package/dist/vite-plugins/build-manifest.d.ts +5 -1
- package/dist/vite-plugins/build-manifest.d.ts.map +1 -1
- package/dist/vite-plugins/build-manifest.js +2 -1
- package/dist/vite-plugins/build-manifest.js.map +1 -1
- package/dist/vite-plugins/i18n.d.ts.map +1 -1
- package/dist/vite-plugins/i18n.js +59 -6
- package/dist/vite-plugins/i18n.js.map +1 -1
- package/dist/vite-plugins/index.d.ts +8 -1
- package/dist/vite-plugins/index.d.ts.map +1 -1
- package/dist/vite-plugins/index.js +8 -6
- package/dist/vite-plugins/index.js.map +1 -1
- package/dist/vite-plugins/resources.d.ts.map +1 -1
- package/dist/vite-plugins/resources.js +32 -97
- package/dist/vite-plugins/resources.js.map +1 -1
- package/dist/vite-plugins/self-contained.d.ts.map +1 -1
- package/dist/vite-plugins/self-contained.js +159 -158
- package/dist/vite-plugins/self-contained.js.map +1 -1
- package/dist/vite-plugins/settings-worker-env.d.ts.map +1 -1
- package/dist/vite-plugins/settings-worker-env.js +2 -4
- package/dist/vite-plugins/settings-worker-env.js.map +1 -1
- package/dist/vite-plugins/settings.d.ts +1 -2
- package/dist/vite-plugins/settings.d.ts.map +1 -1
- package/dist/vite-plugins/settings.js +8 -14
- package/dist/vite-plugins/settings.js.map +1 -1
- package/dist/vite-plugins/undeclared-library.d.ts.map +1 -1
- package/dist/vite-plugins/undeclared-library.js +10 -13
- package/dist/vite-plugins/undeclared-library.js.map +1 -1
- package/dist/vite-plugins/worker.d.ts.map +1 -1
- package/dist/vite-plugins/worker.js +0 -1
- package/dist/vite-plugins/worker.js.map +1 -1
- package/package.json +21 -15
- package/src/builder.ts +18 -5
- package/src/cli.ts +3 -0
- package/src/codegen/freshness.ts +66 -17
- package/src/codegen/reference.ts +1 -8
- package/src/codegen/report.ts +5 -21
- package/src/codegen/run-codegen.ts +42 -151
- package/src/codegen/store-resolver.ts +10 -26
- package/src/commands/build.ts +13 -2
- package/src/commands/codegen.ts +6 -5
- package/src/commands/deploy.ts +4 -2
- package/src/commands/dev.ts +20 -1
- package/src/commands/docs.ts +5 -17
- package/src/deploy/freedesktop/copyright.ts +2 -14
- package/src/deploy/freedesktop/metainfo.ts +73 -21
- package/src/deploy/freedesktop/xml.ts +24 -32
- package/src/deploy/nfpm/config.ts +5 -2
- package/src/deploy/nfpm/contents.ts +8 -0
- package/src/deploy/node-runtime/elf.ts +43 -5
- package/src/deploy/node-runtime/index.ts +105 -5
- package/src/deploy/node-runtime/license.ts +2 -8
- package/src/deploy/notices/node-runtime.ts +2 -2
- package/src/deploy/notices/packages.ts +3 -11
- package/src/deploy/payload/copy-tree.ts +3 -4
- package/src/deploy/payload/launcher.ts +20 -1
- package/src/deploy/payload/stage.ts +3 -7
- package/src/deploy/run-deploy.ts +56 -16
- package/src/deploy/settings/build-manifest.ts +30 -17
- package/src/deploy/settings/extra-files.ts +26 -2
- package/src/deploy/settings/index.ts +3 -1
- package/src/deploy/settings/libraries.ts +1 -22
- package/src/deploy/settings/paths.ts +68 -13
- package/src/deploy/settings/screenshots.ts +8 -46
- package/src/deploy/targets/flatpak-pnpm.ts +4 -4
- package/src/deploy/targets/flatpak-source.ts +17 -6
- package/src/deploy/targets/flatpak-sources.ts +1 -1
- package/src/deploy/types.ts +1 -0
- package/src/dev/headless.ts +40 -0
- package/src/dev/runner-deps.ts +1 -1
- package/src/dev/runner-main.ts +1 -2
- package/src/dev/schema-dir.ts +2 -4
- package/src/i18n/catalogs.ts +2 -1
- package/src/i18n/metadata-templates.ts +2 -1
- package/src/i18n/source-messages.ts +1442 -262
- package/src/i18n/types.ts +97 -131
- package/src/internal/build-manifest.ts +25 -1
- package/src/internal/build-output.ts +99 -0
- package/src/internal/docs-elements.ts +2 -2
- package/src/internal/entry-arg.ts +8 -1
- package/src/internal/icon-path.ts +6 -19
- package/src/internal/output-directory.ts +699 -0
- package/src/internal/prepare-project.ts +5 -5
- package/src/internal/source-imports.ts +14 -50
- package/src/mcp/client.ts +2 -2
- package/src/settings/render.ts +1 -13
- package/src/settings/schema.ts +19 -81
- package/src/vite-plugins/asset-imports.ts +20 -44
- package/src/vite-plugins/asset-specifier.ts +0 -5
- package/src/vite-plugins/build-manifest.ts +7 -1
- package/src/vite-plugins/i18n.ts +87 -5
- package/src/vite-plugins/index.ts +16 -11
- package/src/vite-plugins/resources.ts +37 -140
- package/src/vite-plugins/self-contained.ts +184 -185
- package/src/vite-plugins/settings-worker-env.ts +2 -4
- package/src/vite-plugins/settings.ts +11 -20
- package/src/vite-plugins/undeclared-library.ts +14 -20
- package/src/vite-plugins/worker.ts +0 -1
- package/dist/i18n/binding-extractor.d.ts +0 -30
- package/dist/i18n/binding-extractor.d.ts.map +0 -1
- package/dist/i18n/binding-extractor.js +0 -1324
- package/dist/i18n/binding-extractor.js.map +0 -1
- package/dist/i18n/extractor-plugin.d.ts +0 -8
- package/dist/i18n/extractor-plugin.d.ts.map +0 -1
- package/dist/i18n/extractor-plugin.js +0 -247
- package/dist/i18n/extractor-plugin.js.map +0 -1
- package/dist/internal/data-dir.d.ts +0 -4
- package/dist/internal/data-dir.d.ts.map +0 -1
- package/dist/internal/data-dir.js +0 -52
- package/dist/internal/data-dir.js.map +0 -1
- package/dist/vite-plugins/animated.d.ts +0 -5
- package/dist/vite-plugins/animated.d.ts.map +0 -1
- package/dist/vite-plugins/animated.js +0 -325
- package/dist/vite-plugins/animated.js.map +0 -1
- package/src/i18n/binding-extractor.ts +0 -1969
- package/src/i18n/extractor-plugin.ts +0 -413
- package/src/internal/data-dir.ts +0 -70
- package/src/vite-plugins/animated.ts +0 -486
|
@@ -2,22 +2,22 @@ import { ensureGeneratedIn } from "../codegen/run-codegen.js";
|
|
|
2
2
|
import { type CodegenContext, resolveCodegenContext } from "../codegen/store-resolver.js";
|
|
3
3
|
import { resolveCwd, resolveEntry } from "./entry-arg.js";
|
|
4
4
|
|
|
5
|
-
type ProjectArgs = { entry?: string; cwd?: string };
|
|
6
|
-
type PreparedProject = { cwd: string; entry: string };
|
|
5
|
+
type ProjectArgs = { entry?: string; cwd?: string; config?: string };
|
|
6
|
+
type PreparedProject = { cwd: string; entry: string; configFile: string };
|
|
7
7
|
type ResolvedProject = PreparedProject & { context: CodegenContext };
|
|
8
8
|
|
|
9
9
|
const resolveProject = async (args: ProjectArgs, mode: string): Promise<ResolvedProject> => {
|
|
10
10
|
const cwd = resolveCwd(args);
|
|
11
|
-
const context = await resolveCodegenContext(cwd, mode);
|
|
11
|
+
const context = await resolveCodegenContext(cwd, mode, args.config);
|
|
12
12
|
|
|
13
|
-
return { cwd, entry: resolveEntry(cwd, args.entry), context };
|
|
13
|
+
return { cwd, entry: resolveEntry(cwd, args.entry), configFile: context.configFile, context };
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
const prepareProject = async (args: ProjectArgs, mode: string): Promise<PreparedProject> => {
|
|
17
17
|
const { cwd, entry, context } = await resolveProject(args, mode);
|
|
18
18
|
await ensureGeneratedIn(context, { shouldAnnounce: true, mode });
|
|
19
19
|
|
|
20
|
-
return { cwd, entry };
|
|
20
|
+
return { cwd, entry, configFile: context.configFile };
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
export { prepareProject, resolveProject };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ESTree, ParseResult, ParserOptions } from "vite";
|
|
2
2
|
import { sortStringsBy } from "@gtkx/utils";
|
|
3
|
-
import {
|
|
3
|
+
import { globSync, readFileSync } from "node:fs";
|
|
4
4
|
import { extname, join } from "node:path";
|
|
5
5
|
import { parseSync, Visitor } from "vite";
|
|
6
6
|
|
|
@@ -13,8 +13,6 @@ type SourceLanguage = NonNullable<ParserOptions["lang"]>;
|
|
|
13
13
|
type ParsedModule = ParseResult["module"];
|
|
14
14
|
|
|
15
15
|
const SOURCE_LANGUAGES: Map<string, SourceLanguage> = new Map([
|
|
16
|
-
[".cjs", "jsx"],
|
|
17
|
-
[".cts", "ts"],
|
|
18
16
|
[".js", "jsx"],
|
|
19
17
|
[".jsx", "jsx"],
|
|
20
18
|
[".mjs", "jsx"],
|
|
@@ -23,60 +21,26 @@ const SOURCE_LANGUAGES: Map<string, SourceLanguage> = new Map([
|
|
|
23
21
|
[".tsx", "tsx"],
|
|
24
22
|
]);
|
|
25
23
|
|
|
26
|
-
const EXCLUDED_DIRECTORIES: Set<string> = new Set([
|
|
27
|
-
"build",
|
|
28
|
-
"coverage",
|
|
29
|
-
"dist",
|
|
30
|
-
"node_modules",
|
|
31
|
-
"out-tsc",
|
|
32
|
-
]);
|
|
33
|
-
|
|
34
24
|
const sourceLanguage = (path: string): SourceLanguage | undefined => {
|
|
35
|
-
if (path.endsWith(".d.ts") || path.endsWith(".d.
|
|
25
|
+
if (path.endsWith(".d.ts") || path.endsWith(".d.mts")) {
|
|
36
26
|
return undefined;
|
|
37
27
|
}
|
|
38
28
|
|
|
39
29
|
return SOURCE_LANGUAGES.get(extname(path).toLowerCase());
|
|
40
30
|
};
|
|
41
31
|
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if (entry.isFile() && sourceLanguage(path) !== undefined) {
|
|
56
|
-
found.push(path);
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
const sourceFilesIn = (dir: string, found: string[]): void => {
|
|
61
|
-
let entries: Dirent[];
|
|
62
|
-
|
|
63
|
-
try {
|
|
64
|
-
entries = readdirSync(dir, { withFileTypes: true });
|
|
65
|
-
} catch {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
for (const entry of entries) {
|
|
70
|
-
collectSourceEntry(dir, entry, found);
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
const discoverSourceFiles = (dir: string): string[] => {
|
|
75
|
-
const files: string[] = [];
|
|
76
|
-
sourceFilesIn(dir, files);
|
|
77
|
-
|
|
78
|
-
return sortStringsBy(files, (path) => path);
|
|
79
|
-
};
|
|
32
|
+
const discoverSourceFiles = (dir: string): string[] =>
|
|
33
|
+
sortStringsBy(
|
|
34
|
+
globSync("**/{*,.*}", {
|
|
35
|
+
cwd: dir,
|
|
36
|
+
exclude: ["**/{build,coverage,dist,node_modules,out-tsc}/**", "**/.gtkx-output-*/**"],
|
|
37
|
+
withFileTypes: true,
|
|
38
|
+
})
|
|
39
|
+
.filter((entry) => entry.isFile())
|
|
40
|
+
.map((entry) => join(entry.parentPath, entry.name))
|
|
41
|
+
.filter((path) => sourceLanguage(path) !== undefined),
|
|
42
|
+
(path) => path,
|
|
43
|
+
);
|
|
80
44
|
|
|
81
45
|
const staticImportSources = (module: ParsedModule): string[] => [
|
|
82
46
|
...module.staticImports.map((statement) => statement.moduleRequest.value),
|
package/src/mcp/client.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as Gio from "@gtkx/gi/gio";
|
|
2
2
|
import * as Gtk from "@gtkx/gi/gtk";
|
|
3
3
|
import {
|
|
4
|
-
DEFAULT_SOCKET_PATH,
|
|
5
4
|
isConnectionClosedError,
|
|
6
5
|
type JSONRPCRequest,
|
|
7
6
|
ProtocolConnection,
|
|
7
|
+
resolveMcpSocketPath,
|
|
8
8
|
type Result,
|
|
9
9
|
} from "@gtkx/mcp/internal";
|
|
10
10
|
import { error, errorMessage, info, normalizeError } from "@gtkx/utils";
|
|
@@ -65,7 +65,7 @@ class McpClient {
|
|
|
65
65
|
private registry = new WidgetRegistry();
|
|
66
66
|
|
|
67
67
|
constructor(options: McpClientOptions) {
|
|
68
|
-
this.socketPath = options.socketPath
|
|
68
|
+
this.socketPath = resolveMcpSocketPath(options.socketPath);
|
|
69
69
|
this.applicationId = options.applicationId;
|
|
70
70
|
}
|
|
71
71
|
|
package/src/settings/render.ts
CHANGED
|
@@ -9,7 +9,6 @@ type NamedSchema = {
|
|
|
9
9
|
type EnvAssetDeclarations = {
|
|
10
10
|
blocked: string[];
|
|
11
11
|
icons: string[];
|
|
12
|
-
legacy: string[];
|
|
13
12
|
resources: string[];
|
|
14
13
|
};
|
|
15
14
|
|
|
@@ -209,15 +208,6 @@ const renderIconModule = (specifier: string): string => [
|
|
|
209
208
|
"}",
|
|
210
209
|
].join("\n");
|
|
211
210
|
|
|
212
|
-
const renderLegacyAssetModule = (specifier: string): string => [
|
|
213
|
-
`declare module ${toJsStringLiteral(specifier)} {`,
|
|
214
|
-
" const resourceUri: string;",
|
|
215
|
-
" const path: string;",
|
|
216
|
-
" export { path };",
|
|
217
|
-
" export default resourceUri;",
|
|
218
|
-
"}",
|
|
219
|
-
].join("\n");
|
|
220
|
-
|
|
221
211
|
const renderBlockedAssetModule = (specifier: string): string => [
|
|
222
212
|
`declare module ${toJsStringLiteral(specifier)} {`,
|
|
223
213
|
" const assetImportRequiresResourceOrUrlQuery: {",
|
|
@@ -232,7 +222,7 @@ const renderEnvModule = (
|
|
|
232
222
|
assetDeclarations?: EnvAssetDeclarations,
|
|
233
223
|
options: EnvModuleOptions = {},
|
|
234
224
|
): string => {
|
|
235
|
-
const assets = assetDeclarations ?? { blocked: [], icons: [],
|
|
225
|
+
const assets = assetDeclarations ?? { blocked: [], icons: [], resources: [] };
|
|
236
226
|
const usedNames: Set<string> = new Set();
|
|
237
227
|
|
|
238
228
|
const schemas = files
|
|
@@ -241,7 +231,6 @@ const renderEnvModule = (
|
|
|
241
231
|
|
|
242
232
|
const blocked = assets.blocked.map((specifier) => renderBlockedAssetModule(specifier));
|
|
243
233
|
const icons = assets.icons.map((specifier) => renderIconModule(specifier));
|
|
244
|
-
const legacy = assets.legacy.map((specifier) => renderLegacyAssetModule(specifier));
|
|
245
234
|
const resources = assets.resources.map((specifier) => renderResourceModule(specifier));
|
|
246
235
|
const references = (options.references ?? []).map((path) => `/// <reference path=${JSON.stringify(path)} />`);
|
|
247
236
|
|
|
@@ -250,7 +239,6 @@ const renderEnvModule = (
|
|
|
250
239
|
...references,
|
|
251
240
|
...blocked,
|
|
252
241
|
...icons,
|
|
253
|
-
...legacy,
|
|
254
242
|
...resources,
|
|
255
243
|
...schemas,
|
|
256
244
|
].join("\n\n")}\n`;
|
package/src/settings/schema.ts
CHANGED
|
@@ -1,25 +1,21 @@
|
|
|
1
|
-
import { sortStrings, warn } from "@gtkx/utils";
|
|
1
|
+
import { isPathInside, sortStrings, toPosixPath, warn } from "@gtkx/utils";
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
3
|
import {
|
|
4
4
|
copyFileSync,
|
|
5
|
-
type Dirent,
|
|
6
5
|
existsSync,
|
|
7
6
|
mkdirSync,
|
|
8
7
|
mkdtempSync,
|
|
9
|
-
readdirSync,
|
|
10
8
|
readFileSync,
|
|
11
9
|
realpathSync,
|
|
12
10
|
writeFileSync,
|
|
13
11
|
} from "node:fs";
|
|
14
12
|
import { tmpdir } from "node:os";
|
|
15
|
-
import { basename, dirname,
|
|
13
|
+
import { basename, dirname, join, relative, resolve } from "node:path";
|
|
16
14
|
import { I18N_TYPES_FILENAME, i18nTypesPath } from "../i18n/types.js";
|
|
17
|
-
import { DATA_IMPORT_PREFIX } from "../internal/data-dir.js";
|
|
18
15
|
import { discoverSourceImports, type SourceImport } from "../internal/source-imports.js";
|
|
19
16
|
import { removeTempDir } from "../internal/staging-dir.js";
|
|
20
17
|
import {
|
|
21
18
|
isBareRelativeAsset,
|
|
22
|
-
isDataAsset,
|
|
23
19
|
parseIconSpecifier,
|
|
24
20
|
parseResourceSpecifier,
|
|
25
21
|
} from "../vite-plugins/asset-specifier.js";
|
|
@@ -57,27 +53,20 @@ const stageSchema = (dir: string, filePath: string): void => {
|
|
|
57
53
|
copyFileSync(filePath, join(dir, stagedSchemaName(filePath)));
|
|
58
54
|
};
|
|
59
55
|
|
|
60
|
-
const toForwardSlashes = (value: string): string => value.replaceAll(/[/\\]/g, "/");
|
|
61
|
-
|
|
62
56
|
const projectRelativeSchemaPath = (root: string, filePath: string): string | null => {
|
|
63
|
-
let
|
|
57
|
+
let projectRoot: string;
|
|
58
|
+
let path: string;
|
|
64
59
|
|
|
65
60
|
try {
|
|
66
|
-
|
|
61
|
+
projectRoot = realpathSync(root);
|
|
62
|
+
path = realpathSync(filePath);
|
|
67
63
|
} catch {
|
|
68
64
|
return null;
|
|
69
65
|
}
|
|
70
66
|
|
|
71
|
-
|
|
72
|
-
return null;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return toForwardSlashes(rel);
|
|
67
|
+
return isPathInside(projectRoot, path) ? toPosixPath(relative(projectRoot, path)) : null;
|
|
76
68
|
};
|
|
77
69
|
|
|
78
|
-
const getModuleSpecifier = (dataDirAbs: string, filePath: string): string =>
|
|
79
|
-
`${DATA_IMPORT_PREFIX}/${toForwardSlashes(relative(dataDirAbs, filePath))}`;
|
|
80
|
-
|
|
81
70
|
const getRelativeModuleSpecifier = (filePath: string): string => `*/${basename(filePath)}`;
|
|
82
71
|
|
|
83
72
|
const sourceDirFor = (root: string): string => {
|
|
@@ -99,9 +88,6 @@ const findImportedSchemaFiles = (imports: SourceImport[]): string[] => {
|
|
|
99
88
|
return sortStrings(new Set(files));
|
|
100
89
|
};
|
|
101
90
|
|
|
102
|
-
const legacyAssetSpecifier = (source: string): string | null =>
|
|
103
|
-
isDataAsset(source) ? source : null;
|
|
104
|
-
|
|
105
91
|
const blockedAssetSpecifier = (source: string): string | null => {
|
|
106
92
|
if (!isBareRelativeAsset(source)) {
|
|
107
93
|
return null;
|
|
@@ -159,21 +145,15 @@ const iconModuleSpecifier = (source: string): string | null => {
|
|
|
159
145
|
|
|
160
146
|
const findAssetModuleSpecifiers = (
|
|
161
147
|
imports: SourceImport[],
|
|
162
|
-
|
|
163
|
-
): { blocked: string[]; icons: string[]; legacy: string[]; resources: string[] } => {
|
|
148
|
+
): { blocked: string[]; icons: string[]; resources: string[] } => {
|
|
164
149
|
const collect = (getSpecifier: (source: string) => string | null): string[] =>
|
|
165
150
|
sortStrings(new Set(imports.map((entry) => getSpecifier(entry.source)).filter((value) => value !== null)));
|
|
166
151
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
resources: collect(resourceModuleSpecifier),
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
return { blocked: [], icons: [], legacy: collect(legacyAssetSpecifier), resources: [] };
|
|
152
|
+
return {
|
|
153
|
+
blocked: collect(blockedAssetSpecifier),
|
|
154
|
+
icons: collect(iconModuleSpecifier),
|
|
155
|
+
resources: collect(resourceModuleSpecifier),
|
|
156
|
+
};
|
|
177
157
|
};
|
|
178
158
|
|
|
179
159
|
const canonicalPath = (path: string): string => {
|
|
@@ -203,41 +183,10 @@ const assertUniqueSchemaBasenames = (schemaFiles: string[]): void => {
|
|
|
203
183
|
}
|
|
204
184
|
};
|
|
205
185
|
|
|
206
|
-
const
|
|
207
|
-
try {
|
|
208
|
-
return readdirSync(dir, { withFileTypes: true }).filter((entry) => !entry.name.startsWith("."));
|
|
209
|
-
} catch {
|
|
210
|
-
return [];
|
|
211
|
-
}
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
const isSchemaFile = (entry: Dirent): boolean => entry.isFile() && entry.name.endsWith(SCHEMA_SUFFIX);
|
|
215
|
-
|
|
216
|
-
const collectSchemaFiles = (dir: string, found: string[]): void => {
|
|
217
|
-
for (const entry of readVisibleEntries(dir)) {
|
|
218
|
-
const full = join(dir, entry.name);
|
|
219
|
-
|
|
220
|
-
if (entry.isDirectory()) {
|
|
221
|
-
collectSchemaFiles(full, found);
|
|
222
|
-
} else if (isSchemaFile(entry)) {
|
|
223
|
-
found.push(full);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
};
|
|
227
|
-
|
|
228
|
-
const findSchemaFiles = (dataDir: string): string[] => {
|
|
229
|
-
const found: string[] = [];
|
|
230
|
-
collectSchemaFiles(dataDir, found);
|
|
231
|
-
|
|
232
|
-
return sortStrings(found);
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
const stageAndCompileProjectSchemas = (root: string, dataDir: string | null): string | null => {
|
|
186
|
+
const stageAndCompileProjectSchemas = (root: string): string | null => {
|
|
236
187
|
const imports = discoverSourceImports(sourceDirFor(root));
|
|
237
|
-
const
|
|
238
|
-
assertUniqueSchemaBasenames(
|
|
239
|
-
const legacy = dataDir === null ? [] : findSchemaFiles(join(root, dataDir));
|
|
240
|
-
const schemaFiles = sortStrings(new Set([...legacy, ...imported]));
|
|
188
|
+
const schemaFiles = findImportedSchemaFiles(imports);
|
|
189
|
+
assertUniqueSchemaBasenames(schemaFiles);
|
|
241
190
|
|
|
242
191
|
if (schemaFiles.length === 0) {
|
|
243
192
|
return null;
|
|
@@ -307,25 +256,14 @@ const didWriteChanges = (path: string, content: string): boolean => {
|
|
|
307
256
|
return true;
|
|
308
257
|
};
|
|
309
258
|
|
|
310
|
-
const emitSchemaEnv = (
|
|
311
|
-
rootDir: string,
|
|
312
|
-
dataDir: string | null,
|
|
313
|
-
isV2ResourceImports = false,
|
|
314
|
-
): SchemaEnvResult => {
|
|
315
|
-
const dataDirAbs = dataDir === null ? null : join(rootDir, dataDir);
|
|
316
|
-
const legacyFiles = dataDirAbs === null ? [] : findSchemaFiles(dataDirAbs);
|
|
259
|
+
const emitSchemaEnv = (rootDir: string): SchemaEnvResult => {
|
|
317
260
|
const imports = discoverSourceImports(sourceDirFor(rootDir));
|
|
318
|
-
|
|
319
|
-
const legacy = dataDirAbs === null
|
|
320
|
-
? []
|
|
321
|
-
: parseProjectSchemas(legacyFiles, (filePath) => getModuleSpecifier(dataDirAbs, filePath));
|
|
322
|
-
|
|
323
261
|
const importedFiles = findImportedSchemaFiles(imports);
|
|
324
262
|
assertUniqueSchemaBasenames(importedFiles);
|
|
325
263
|
const imported = parseProjectSchemas(importedFiles, getRelativeModuleSpecifier);
|
|
326
|
-
const assets = findAssetModuleSpecifiers(imports
|
|
264
|
+
const assets = findAssetModuleSpecifiers(imports);
|
|
327
265
|
const references = existsSync(i18nTypesPath(rootDir)) ? [`./${I18N_TYPES_FILENAME}`] : [];
|
|
328
|
-
const content = renderEnvModule(
|
|
266
|
+
const content = renderEnvModule(imported, assets, { references });
|
|
329
267
|
const path = schemaEnvPath(rootDir);
|
|
330
268
|
const isWritten = didWriteChanges(path, content);
|
|
331
269
|
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ParseResult, Plugin, UserConfig } from "vite";
|
|
3
|
-
import { createConfigLoader, resolveFuture } from "@gtkx/config/internal";
|
|
1
|
+
import type { ParseResult, Plugin } from "vite";
|
|
4
2
|
import { parseSync } from "vite";
|
|
5
3
|
import { sourceLanguage } from "../internal/source-imports.js";
|
|
6
4
|
import { ASSET_MENTION_RE } from "./asset-extensions.js";
|
|
7
5
|
import {
|
|
8
|
-
DATA_PREFIX,
|
|
9
6
|
isAssetSpecifier,
|
|
10
|
-
isDataAsset,
|
|
11
7
|
isUrlSpecifier,
|
|
12
8
|
parseIconSpecifier,
|
|
13
9
|
parseResourceSpecifier,
|
|
@@ -21,18 +17,11 @@ type ExportStatement = ParsedModule["staticExports"][number];
|
|
|
21
17
|
type ExportEntry = ExportStatement["entries"][number];
|
|
22
18
|
type BindingEntry = { importName: { name: string | null }; isType: boolean };
|
|
23
19
|
type NamedBinding = { name: string; source: string };
|
|
24
|
-
type PluginState = { isV2: boolean };
|
|
25
20
|
|
|
26
21
|
const NODE_MODULES = /(?:^|\/)node_modules\//;
|
|
27
22
|
const VIRTUAL_PREFIX = "\0";
|
|
28
23
|
const DEFAULT_BINDING = "default";
|
|
29
24
|
const RESOURCE_BINDING = JSON.stringify(RESOURCE_PATH_EXPORT);
|
|
30
|
-
const DATA_IMPORT_EXAMPLE = `"${DATA_PREFIX}<path>"`;
|
|
31
|
-
const URL_FALLBACK = ", or import the default for the asset URL.";
|
|
32
|
-
|
|
33
|
-
const BUNDLE_ADVICE =
|
|
34
|
-
`An asset staged into the GResource bundle exports ${RESOURCE_BINDING} and a "resource://" default, and ` +
|
|
35
|
-
"nothing else.";
|
|
36
25
|
|
|
37
26
|
const QUERY_ADVICE =
|
|
38
27
|
`A URL asset exports only its default filesystem path; import the default instead of ${RESOURCE_BINDING}.`;
|
|
@@ -43,9 +32,7 @@ const RESOURCE_ADVICE =
|
|
|
43
32
|
const ICON_ADVICE = "An icon asset exports only its default icon-theme name, and nothing else.";
|
|
44
33
|
|
|
45
34
|
const RELATIVE_ADVICE =
|
|
46
|
-
|
|
47
|
-
`${RESOURCE_BINDING}; move the file under the data directory and import it as ` +
|
|
48
|
-
`${DATA_IMPORT_EXAMPLE}${URL_FALLBACK}`;
|
|
35
|
+
"Add ?resource for a GResource, ?icon for a themed icon, or ?url for an emitted file.";
|
|
49
36
|
|
|
50
37
|
const boundName = (entry: BindingEntry): string | null => {
|
|
51
38
|
const { name } = entry.importName;
|
|
@@ -78,50 +65,46 @@ const bindings = (parsed: ParsedModule): NamedBinding[] => [
|
|
|
78
65
|
...parsed.staticExports.flatMap((statement) => exportBindings(statement)),
|
|
79
66
|
];
|
|
80
67
|
|
|
81
|
-
const isBacked = ({ name, source }: NamedBinding
|
|
68
|
+
const isBacked = ({ name, source }: NamedBinding): boolean => {
|
|
82
69
|
if (name !== RESOURCE_PATH_EXPORT) {
|
|
83
70
|
return false;
|
|
84
71
|
}
|
|
85
72
|
|
|
86
|
-
return
|
|
73
|
+
return parseResourceSpecifier(source) !== null;
|
|
87
74
|
};
|
|
88
75
|
|
|
89
76
|
const isCheckedSpecifier = (source: string): boolean => isAssetSpecifier(source) || isUrlSpecifier(source);
|
|
90
77
|
|
|
91
|
-
const unbackedBinding = (parsed: ParsedModule
|
|
92
|
-
bindings(parsed).find((binding) => isCheckedSpecifier(binding.source) && !isBacked(binding
|
|
93
|
-
|
|
94
|
-
const isBundledResource = (source: string, isV2: boolean): boolean =>
|
|
95
|
-
isV2
|
|
96
|
-
? parseResourceSpecifier(source) !== null || parseIconSpecifier(source) !== null
|
|
97
|
-
: isDataAsset(source);
|
|
78
|
+
const unbackedBinding = (parsed: ParsedModule): NamedBinding | undefined =>
|
|
79
|
+
bindings(parsed).find((binding) => isCheckedSpecifier(binding.source) && !isBacked(binding));
|
|
98
80
|
|
|
99
|
-
const
|
|
100
|
-
|
|
81
|
+
const adviceFor = (source: string): string => {
|
|
82
|
+
if (parseResourceSpecifier(source) !== null) {
|
|
83
|
+
return RESOURCE_ADVICE;
|
|
84
|
+
}
|
|
101
85
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
return isV2 ? v2BundleAdvice(source) : BUNDLE_ADVICE;
|
|
86
|
+
if (parseIconSpecifier(source) !== null) {
|
|
87
|
+
return ICON_ADVICE;
|
|
105
88
|
}
|
|
106
89
|
|
|
107
90
|
if (isUrlSpecifier(source)) {
|
|
108
91
|
return QUERY_ADVICE;
|
|
109
92
|
}
|
|
110
93
|
|
|
111
|
-
return
|
|
94
|
+
return RELATIVE_ADVICE;
|
|
112
95
|
};
|
|
113
96
|
|
|
114
|
-
const unbackedBindingError = (path: string, binding: NamedBinding
|
|
97
|
+
const unbackedBindingError = (path: string, binding: NamedBinding): Error =>
|
|
115
98
|
new Error(
|
|
116
99
|
`${path}: ${JSON.stringify(binding.source)} does not export ${JSON.stringify(binding.name)}, which ` +
|
|
117
100
|
"gtkx build rejects and gtkx dev would bind as undefined. " +
|
|
118
|
-
|
|
101
|
+
adviceFor(binding.source),
|
|
119
102
|
);
|
|
120
103
|
|
|
121
104
|
const isCheckedSource = (path: string): boolean => !path.startsWith(VIRTUAL_PREFIX) && !NODE_MODULES.test(path);
|
|
122
105
|
const hasCheckedAssetMention = (code: string): boolean => ASSET_MENTION_RE.test(code) || code.includes("?url");
|
|
123
106
|
|
|
124
|
-
const checkAssetImports = (code: string, id: string
|
|
107
|
+
const checkAssetImports = (code: string, id: string): void => {
|
|
125
108
|
const path = stripQuery(id);
|
|
126
109
|
const lang = sourceLanguage(path);
|
|
127
110
|
|
|
@@ -135,27 +118,20 @@ const checkAssetImports = (code: string, id: string, isV2: boolean): void => {
|
|
|
135
118
|
return;
|
|
136
119
|
}
|
|
137
120
|
|
|
138
|
-
const binding = unbackedBinding(parsed.module
|
|
121
|
+
const binding = unbackedBinding(parsed.module);
|
|
139
122
|
|
|
140
123
|
if (binding !== undefined) {
|
|
141
|
-
throw unbackedBindingError(path, binding
|
|
124
|
+
throw unbackedBindingError(path, binding);
|
|
142
125
|
}
|
|
143
126
|
};
|
|
144
127
|
|
|
145
|
-
function gtkxAssetImports(
|
|
146
|
-
const state: PluginState = { isV2: false };
|
|
147
|
-
|
|
128
|
+
function gtkxAssetImports(): Plugin {
|
|
148
129
|
return {
|
|
149
130
|
name: "gtkx:asset-imports",
|
|
150
131
|
enforce: "pre",
|
|
151
132
|
|
|
152
|
-
async config(config: UserConfig) {
|
|
153
|
-
const loaded = await loadConfig.load(config.root ?? process.cwd());
|
|
154
|
-
state.isV2 = resolveFuture(loaded.config.future).isResourceImported;
|
|
155
|
-
},
|
|
156
|
-
|
|
157
133
|
transform(code, id) {
|
|
158
|
-
checkAssetImports(code, id
|
|
134
|
+
checkAssetImports(code, id);
|
|
159
135
|
},
|
|
160
136
|
};
|
|
161
137
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { DATA_IMPORT_PREFIX } from "../internal/data-dir.js";
|
|
2
1
|
import { ASSET_PATH_RE, ASSET_RE } from "./asset-extensions.js";
|
|
3
2
|
import { stripQuery } from "./strip-query.js";
|
|
4
3
|
|
|
@@ -12,7 +11,6 @@ type IconSpecifier = {
|
|
|
12
11
|
iconName: string | null;
|
|
13
12
|
};
|
|
14
13
|
|
|
15
|
-
const DATA_PREFIX = `${DATA_IMPORT_PREFIX}/`;
|
|
16
14
|
const RELATIVE_PREFIX_RE = /^\.\.?(?:\/|$)/;
|
|
17
15
|
const RESOURCE_QUERY_RE = /^resource(?:=([^&#]+))?$/;
|
|
18
16
|
const ICON_QUERY_RE = /^icon(?:=([^&#]+))?$/;
|
|
@@ -25,7 +23,6 @@ const getQuery = (source: string): string | null => {
|
|
|
25
23
|
};
|
|
26
24
|
|
|
27
25
|
const isAssetSpecifier = (source: string): boolean => ASSET_PATH_RE.test(source);
|
|
28
|
-
const isDataAsset = (source: string): boolean => source.startsWith(DATA_PREFIX) && ASSET_RE.test(source);
|
|
29
26
|
|
|
30
27
|
const isBareRelativeAsset = (source: string): boolean =>
|
|
31
28
|
getQuery(source) === null && RELATIVE_PREFIX_RE.test(source) && ASSET_RE.test(source);
|
|
@@ -71,10 +68,8 @@ const isUrlSpecifier = (source: string): boolean => {
|
|
|
71
68
|
};
|
|
72
69
|
|
|
73
70
|
export {
|
|
74
|
-
DATA_PREFIX,
|
|
75
71
|
isAssetSpecifier,
|
|
76
72
|
isBareRelativeAsset,
|
|
77
|
-
isDataAsset,
|
|
78
73
|
isUrlSpecifier,
|
|
79
74
|
parseIconSpecifier,
|
|
80
75
|
parseResourceSpecifier,
|
|
@@ -21,6 +21,11 @@ type ManifestState = {
|
|
|
21
21
|
outDir: string;
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
+
type BuildConfigIdentity = {
|
|
25
|
+
configFile: string;
|
|
26
|
+
configDigest: string;
|
|
27
|
+
};
|
|
28
|
+
|
|
24
29
|
const PACKAGE_MANIFEST_FILENAME = "package.json";
|
|
25
30
|
const DEFAULT_OUT_DIR = "dist";
|
|
26
31
|
const JSON_INDENT = 4;
|
|
@@ -73,7 +78,7 @@ const packagesFor = (outDir: string, ids: string[]): RecordedPackage[] => {
|
|
|
73
78
|
|
|
74
79
|
const renderManifest = (manifest: BuildManifest): string => `${JSON.stringify(manifest, null, JSON_INDENT)}\n`;
|
|
75
80
|
|
|
76
|
-
function gtkxBuildManifest(root: string, collector: BuildManifestCollector): Plugin {
|
|
81
|
+
function gtkxBuildManifest(root: string, collector: BuildManifestCollector, identity: BuildConfigIdentity): Plugin {
|
|
77
82
|
const state: ManifestState = { outDir: join(root, DEFAULT_OUT_DIR) };
|
|
78
83
|
|
|
79
84
|
return {
|
|
@@ -90,6 +95,7 @@ function gtkxBuildManifest(root: string, collector: BuildManifestCollector): Plu
|
|
|
90
95
|
const manifest: BuildManifest = {
|
|
91
96
|
generator: BUILD_MANIFEST_GENERATOR,
|
|
92
97
|
formatVersion: BUILD_MANIFEST_FORMAT_VERSION,
|
|
98
|
+
...identity,
|
|
93
99
|
schemas: collector.schemas,
|
|
94
100
|
packages: packagesFor(state.outDir, ids),
|
|
95
101
|
};
|