@gtkx/config 2.0.0-beta.11 → 2.0.0-beta.13
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 +2 -2
- package/dist/builtin-elements.d.ts +23 -0
- package/dist/builtin-elements.d.ts.map +1 -0
- package/dist/builtin-elements.js +366 -0
- package/dist/builtin-elements.js.map +1 -0
- package/dist/config-dependencies.d.ts +5 -3
- package/dist/config-dependencies.d.ts.map +1 -1
- package/dist/config-dependencies.js +54 -22
- package/dist/config-dependencies.js.map +1 -1
- package/dist/config-error.d.ts.map +1 -1
- package/dist/config-error.js.map +1 -1
- package/dist/config-reloader.d.ts.map +1 -1
- package/dist/config-reloader.js +2 -8
- package/dist/config-reloader.js.map +1 -1
- package/dist/config-source.d.ts +4 -2
- package/dist/config-source.d.ts.map +1 -1
- package/dist/config-source.js +26 -8
- package/dist/config-source.js.map +1 -1
- package/dist/config.d.ts +159 -45
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +28 -19
- package/dist/config.js.map +1 -1
- package/dist/deploy.d.ts +391 -13
- package/dist/deploy.d.ts.map +1 -1
- package/dist/deploy.js +16 -13
- package/dist/deploy.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +3 -3
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +3 -3
- package/dist/internal.js.map +1 -1
- package/dist/loader.d.ts +22 -4
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +59 -31
- package/dist/loader.js.map +1 -1
- package/dist/resource-base-path.d.ts.map +1 -1
- package/dist/schema-text.d.ts.map +1 -1
- package/dist/user-event-signals.d.ts.map +1 -1
- package/dist/virtual.d.ts +1 -1
- package/dist/virtual.d.ts.map +1 -1
- package/dist/virtual.js +4 -2
- package/dist/virtual.js.map +1 -1
- package/dist/vite-plugin.d.ts +2 -0
- package/dist/vite-plugin.d.ts.map +1 -1
- package/dist/vite-plugin.js +4 -3
- package/dist/vite-plugin.js.map +1 -1
- package/dist/vite-root.d.ts.map +1 -1
- package/package.json +14 -29
- package/src/builtin-elements.ts +377 -0
- package/src/config-dependencies.ts +61 -27
- package/src/config-error.ts +5 -3
- package/src/config-reloader.ts +2 -11
- package/src/config-source.ts +35 -8
- package/src/config.ts +189 -39
- package/src/deploy.ts +471 -55
- package/src/index.ts +42 -3
- package/src/internal.ts +3 -2
- package/src/loader.ts +106 -37
- package/src/virtual.ts +6 -4
- package/src/vite-plugin.ts +9 -2
- package/dist/static-dependencies.d.ts +0 -3
- package/dist/static-dependencies.d.ts.map +0 -1
- package/dist/static-dependencies.js +0 -350
- package/dist/static-dependencies.js.map +0 -1
- package/src/static-dependencies.ts +0 -464
package/dist/config-error.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-error.js","sourceRoot":"","sources":["../src/config-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,mBAAmB,GAAG,eAAe,CAAC;AAE5C,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAoC,EAAE,CAClE,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAEzE,MAAM,YAAY,GAAG,CAAC,UAAkB,EAAU,EAAE,CAAC,GAAG,UAAU,GAAG,CAAC;AAEtE,MAAM,sBAAsB,GAAG,CAAC,GAAW,EAAE,UAAmB,EAAS,EAAE,CACvE,IAAI,KAAK,
|
|
1
|
+
{"version":3,"file":"config-error.js","sourceRoot":"","sources":["../src/config-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,mBAAmB,GAAG,eAAe,CAAC;AAE5C,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAoC,EAAE,CAClE,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAEzE,MAAM,YAAY,GAAG,CAAC,UAAkB,EAAU,EAAE,CAAC,GAAG,UAAU,GAAG,CAAC;AAEtE,MAAM,sBAAsB,GAAG,CAAC,GAAW,EAAE,UAAmB,EAAS,EAAE,CACvE,IAAI,KAAK,CACL,UAAU,KAAK,SAAS;IACpB,CAAC,CAAC,GAAG,YAAY,CAAC,mBAAmB,CAAC,mCAAmC,GAAG,EAAE;IAC9E,CAAC,CAAC,GAAG,YAAY,CAAC,UAAU,CAAC,mCAAmC,GAAG,EAAE,CAC5E,CAAC;AAEN,MAAM,WAAW,GAAG,CAAC,KAAiB,EAAE,UAAU,GAAG,mBAAmB,EAAS,EAAE,CAC/E,IAAI,KAAK,CAAC,GAAG,YAAY,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAExE,OAAO,EAAE,QAAQ,EAAE,sBAAsB,EAAE,WAAW,EAAE,CAAC","sourcesContent":["import { z } from \"zod\";\n\nconst DEFAULT_CONFIG_FILE = \"gtkx.config.*\";\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst configPrefix = (configFile: string): string => `${configFile}:`;\n\nconst missingConfigFileError = (cwd: string, configFile?: string): Error =>\n new Error(\n configFile === undefined\n ? `${configPrefix(DEFAULT_CONFIG_FILE)} no configuration file found in ${cwd}`\n : `${configPrefix(configFile)} no configuration file found in ${cwd}`,\n );\n\nconst configError = (error: z.ZodError, configFile = DEFAULT_CONFIG_FILE): Error =>\n new Error(`${configPrefix(configFile)}\\n${z.prettifyError(error)}`);\n\nexport { isRecord, missingConfigFileError, configError };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-reloader.d.ts","sourceRoot":"","sources":["../src/config-reloader.ts"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,iBAAiB,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"config-reloader.d.ts","sourceRoot":"","sources":["../src/config-reloader.ts"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,iBAAiB,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAEpF,KAAK,cAAc,GAAG;IAClB,MAAM,EAAE,MAAM,OAAO,CAAC,YAAY,CAAC,CAAC;IACpC,YAAY,EAAE,MAAM,MAAM,EAAE,CAAC;CAChC,CAAC;AAEF,QAAA,MAAM,oBAAoB,QACjB,MAAM,YACF,iBAAiB,wBACL,MAAM,EAAE,KAC9B,OAAO,CAAC,cAAc,CA6BxB,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
|
package/dist/config-reloader.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { resolve } from "node:path";
|
|
2
2
|
import { configDependenciesFor } from "./config-dependencies.js";
|
|
3
3
|
import { loadConfig } from "./loader.js";
|
|
4
|
-
import { resolveConfigDependencies } from "./static-dependencies.js";
|
|
5
4
|
const createConfigReloader = async (cwd, options = {}, initialDependencies = []) => {
|
|
6
5
|
let selectedConfigFile;
|
|
7
6
|
let knownDependencies = initialDependencies;
|
|
@@ -13,13 +12,8 @@ const createConfigReloader = async (cwd, options = {}, initialDependencies = [])
|
|
|
13
12
|
else {
|
|
14
13
|
selectedConfigFile = resolve(cwd, options.configFile);
|
|
15
14
|
}
|
|
16
|
-
const selectedConfigName = relative(cwd, selectedConfigFile);
|
|
17
|
-
const resolvePaths = () => [
|
|
18
|
-
...new Set([selectedConfigFile, ...knownDependencies]
|
|
19
|
-
.flatMap((path) => resolveConfigDependencies(path, selectedConfigName, cwd))),
|
|
20
|
-
];
|
|
21
15
|
return {
|
|
22
|
-
resolvePaths,
|
|
16
|
+
resolvePaths: () => [...new Set([selectedConfigFile, ...knownDependencies])],
|
|
23
17
|
reload: async () => {
|
|
24
18
|
let loaded;
|
|
25
19
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-reloader.js","sourceRoot":"","sources":["../src/config-reloader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"config-reloader.js","sourceRoot":"","sources":["../src/config-reloader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,UAAU,EAA6C,MAAM,aAAa,CAAC;AAOpF,MAAM,oBAAoB,GAAG,KAAK,EAC9B,GAAW,EACX,OAAO,GAAsB,EAAE,EAC/B,mBAAmB,GAAa,EAAE,EACX,EAAE;IACzB,IAAI,kBAA0B,CAAC;IAC/B,IAAI,iBAAiB,GAAG,mBAAmB,CAAC;IAE5C,IAAI,OAAO,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;QACnC,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAC9C,kBAAkB,GAAG,MAAM,CAAC,UAAU,CAAC;QACvC,iBAAiB,GAAG,CAAC,GAAG,iBAAiB,EAAE,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC;IACjF,CAAC;SAAM,CAAC;QACJ,kBAAkB,GAAG,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAC1D,CAAC;IAED,OAAO;QACH,YAAY,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,kBAAkB,EAAE,GAAG,iBAAiB,CAAC,CAAC,CAAC;QAC5E,MAAM,EAAE,KAAK,IAAI,EAAE;YACf,IAAI,MAAoB,CAAC;YAEzB,IAAI,CAAC;gBACD,MAAM,GAAG,MAAM,UAAU,CAAC,GAAG,EAAE,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,CAAC,CAAC;YACnF,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,iBAAiB,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,iBAAiB,EAAE,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC1F,MAAM,KAAK,CAAC;YAChB,CAAC;YAED,iBAAiB,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;YAElD,OAAO,MAAM,CAAC;QAClB,CAAC;KACJ,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,CAAC","sourcesContent":["import { resolve } from \"node:path\";\nimport { configDependenciesFor } from \"./config-dependencies.ts\";\nimport { loadConfig, type LoadConfigOptions, type LoadedConfig } from \"./loader.ts\";\n\ntype ConfigReloader = {\n reload: () => Promise<LoadedConfig>;\n resolvePaths: () => string[];\n};\n\nconst createConfigReloader = async (\n cwd: string,\n options: LoadConfigOptions = {},\n initialDependencies: string[] = [],\n): Promise<ConfigReloader> => {\n let selectedConfigFile: string;\n let knownDependencies = initialDependencies;\n\n if (options.configFile === undefined) {\n const loaded = await loadConfig(cwd, options);\n selectedConfigFile = loaded.configFile;\n knownDependencies = [...knownDependencies, ...configDependenciesFor(loaded)];\n } else {\n selectedConfigFile = resolve(cwd, options.configFile);\n }\n\n return {\n resolvePaths: () => [...new Set([selectedConfigFile, ...knownDependencies])],\n reload: async () => {\n let loaded: LoadedConfig;\n\n try {\n loaded = await loadConfig(cwd, { ...options, configFile: selectedConfigFile });\n } catch (error) {\n knownDependencies = [...new Set([...knownDependencies, ...configDependenciesFor(error)])];\n throw error;\n }\n\n knownDependencies = configDependenciesFor(loaded);\n\n return loaded;\n },\n };\n};\n\nexport { createConfigReloader };\n"]}
|
package/dist/config-source.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ type ConfigResolutionOptions = {
|
|
|
2
2
|
configFile?: string | undefined;
|
|
3
3
|
cwd?: string | undefined;
|
|
4
4
|
};
|
|
5
|
-
declare const
|
|
6
|
-
|
|
5
|
+
declare const configCandidatePaths: (directory: string) => string[];
|
|
6
|
+
declare const configSourceCandidates: (path: string) => string[];
|
|
7
|
+
declare const localConfigSourcePaths: (source: string, options: ConfigResolutionOptions) => string[];
|
|
8
|
+
export { configCandidatePaths, configSourceCandidates, localConfigSourcePaths, type ConfigResolutionOptions };
|
|
7
9
|
//# sourceMappingURL=config-source.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-source.d.ts","sourceRoot":"","sources":["../src/config-source.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config-source.d.ts","sourceRoot":"","sources":["../src/config-source.ts"],"names":[],"mappings":"AAGA,KAAK,uBAAuB,GAAG;IAAE,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAK7F,QAAA,MAAM,oBAAoB,cAAe,MAAM,KAAG,MAAM,EAGnD,CAAC;AAEN,QAAA,MAAM,sBAAsB,SAAU,MAAM,KAAG,MAAM,EAYpD,CAAC;AAUF,QAAA,MAAM,sBAAsB,WAAY,MAAM,WAAW,uBAAuB,KAAG,MAAM,EAcxF,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,KAAK,uBAAuB,EAAE,CAAC"}
|
package/dist/config-source.js
CHANGED
|
@@ -1,17 +1,35 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SUPPORTED_EXTENSIONS } from "c12";
|
|
2
|
+
import { basename, extname, isAbsolute, join, resolve } from "node:path";
|
|
3
|
+
const CONFIG_LOCATIONS = ["gtkx.config", ".config/gtkx", ".config/gtkx.config"];
|
|
4
|
+
const CONFIG_EXTENSIONS = SUPPORTED_EXTENSIONS.filter((extension) => extension !== ".cjs" && extension !== ".cts");
|
|
5
|
+
const configCandidatePaths = (directory) => CONFIG_LOCATIONS.flatMap((location) => CONFIG_EXTENSIONS.map((extension) => join(directory, `${location}${extension}`)));
|
|
6
|
+
const configSourceCandidates = (path) => {
|
|
7
|
+
const extension = extname(path);
|
|
8
|
+
const fallback = extension === ".js" ? ".ts" : extension === ".mjs" ? ".mts" : undefined;
|
|
9
|
+
if (extension.length > 0) {
|
|
10
|
+
return fallback === undefined ? [path] : [path, `${path.slice(0, -extension.length)}${fallback}`];
|
|
11
|
+
}
|
|
12
|
+
return [
|
|
13
|
+
path,
|
|
14
|
+
...CONFIG_EXTENSIONS.flatMap((candidate) => [`${path}${candidate}`, join(path, `index${candidate}`)]),
|
|
15
|
+
];
|
|
16
|
+
};
|
|
2
17
|
const isLocalConfigSource = (source) => source.startsWith(".") || isAbsolute(source);
|
|
3
18
|
const isDirectoryConfigSource = (source) => {
|
|
4
19
|
const extension = extname(source);
|
|
5
20
|
return extension.length === 0 || extension === basename(source);
|
|
6
21
|
};
|
|
7
|
-
const
|
|
22
|
+
const localConfigSourcePaths = (source, options) => {
|
|
8
23
|
if (source === "." || !isLocalConfigSource(source)) {
|
|
9
|
-
return
|
|
24
|
+
return [];
|
|
25
|
+
}
|
|
26
|
+
const path = resolve(options.cwd ?? process.cwd(), source);
|
|
27
|
+
if (!isDirectoryConfigSource(source)) {
|
|
28
|
+
return [path];
|
|
10
29
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
: resolve(cwd, source);
|
|
30
|
+
return options.configFile === undefined || options.configFile === CONFIG_LOCATIONS[0]
|
|
31
|
+
? configCandidatePaths(path)
|
|
32
|
+
: [join(path, options.configFile)];
|
|
15
33
|
};
|
|
16
|
-
export {
|
|
34
|
+
export { configCandidatePaths, configSourceCandidates, localConfigSourcePaths };
|
|
17
35
|
//# sourceMappingURL=config-source.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-source.js","sourceRoot":"","sources":["../src/config-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"config-source.js","sourceRoot":"","sources":["../src/config-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,KAAK,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzE,MAAM,gBAAgB,GAAG,CAAC,aAAa,EAAE,cAAc,EAAE,qBAAqB,CAAC,CAAC;AAChF,MAAM,iBAAiB,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,KAAK,MAAM,IAAI,SAAS,KAAK,MAAM,CAAC,CAAC;AAEnH,MAAM,oBAAoB,GAAG,CAAC,SAAiB,EAAY,EAAE,CACzD,gBAAgB,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAClC,iBAAiB,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,QAAQ,GAAG,SAAS,EAAE,CAAC,CAAC,CACnF,CAAC;AAEN,MAAM,sBAAsB,GAAG,CAAC,IAAY,EAAY,EAAE;IACtD,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,MAAM,QAAQ,GAAG,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IAEzF,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,OAAO,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,C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C;QAC5B,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;AAC3C,CAAC,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,sBAAsB,EAAgC,CAAC","sourcesContent":["import { SUPPORTED_EXTENSIONS } from \"c12\";\nimport { basename, extname, isAbsolute, join, resolve } from \"node:path\";\n\ntype ConfigResolutionOptions = { configFile?: string | undefined; cwd?: string | undefined };\n\nconst CONFIG_LOCATIONS = [\"gtkx.config\", \".config/gtkx\", \".config/gtkx.config\"];\nconst CONFIG_EXTENSIONS = SUPPORTED_EXTENSIONS.filter((extension) => extension !== \".cjs\" && extension !== \".cts\");\n\nconst configCandidatePaths = (directory: string): string[] =>\n CONFIG_LOCATIONS.flatMap((location) =>\n CONFIG_EXTENSIONS.map((extension) => join(directory, `${location}${extension}`)),\n );\n\nconst configSourceCandidates = (path: string): string[] => {\n const extension = extname(path);\n const fallback = extension === \".js\" ? \".ts\" : extension === \".mjs\" ? \".mts\" : undefined;\n\n if (extension.length > 0) {\n return fallback === undefined ? [path] : [path, `${path.slice(0, -extension.length)}${fallback}`];\n }\n\n return [\n path,\n ...CONFIG_EXTENSIONS.flatMap((candidate) => [`${path}${candidate}`, join(path, `index${candidate}`)]),\n ];\n};\n\nconst isLocalConfigSource = (source: string): boolean => source.startsWith(\".\") || isAbsolute(source);\n\nconst isDirectoryConfigSource = (source: string): boolean => {\n const extension = extname(source);\n\n return extension.length === 0 || extension === basename(source);\n};\n\nconst localConfigSourcePaths = (source: string, options: ConfigResolutionOptions): string[] => {\n if (source === \".\" || !isLocalConfigSource(source)) {\n return [];\n }\n\n const path = resolve(options.cwd ?? process.cwd(), source);\n\n if (!isDirectoryConfigSource(source)) {\n return [path];\n }\n\n return options.configFile === undefined || options.configFile === CONFIG_LOCATIONS[0]\n ? configCandidatePaths(path)\n : [join(path, options.configFile)];\n};\n\nexport { configCandidatePaths, configSourceCandidates, localConfigSourcePaths, type ConfigResolutionOptions };\n"]}
|
package/dist/config.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { type DefineConfig } from "c12";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
+
import { type DeployOptions } from "./deploy.ts";
|
|
3
4
|
/** Object form of the `reactCompiler` config key, forwarded to `babel-plugin-react-compiler`. */
|
|
4
5
|
type ReactCompilerOptions = {
|
|
5
|
-
/** Which functions the
|
|
6
|
-
compilationMode?:
|
|
7
|
-
/** Which
|
|
8
|
-
panicThreshold?:
|
|
6
|
+
/** Which functions the React Compiler processes. */
|
|
7
|
+
compilationMode?: "all" | "annotation" | "infer" | "syntax" | undefined;
|
|
8
|
+
/** Which React Compiler diagnostics fail the build. */
|
|
9
|
+
panicThreshold?: "all_errors" | "critical_errors" | "none" | undefined;
|
|
9
10
|
};
|
|
10
11
|
/**
|
|
11
12
|
* The React Compiler options the build hands to `babel-plugin-react-compiler`, with the React version
|
|
@@ -18,9 +19,122 @@ type ResolvedReactCompilerOptions = ReactCompilerOptions & {
|
|
|
18
19
|
/**
|
|
19
20
|
* GTKX project configuration authored in `gtkx.config.ts` and validated when loaded.
|
|
20
21
|
*/
|
|
21
|
-
type Config =
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
type Config = {
|
|
23
|
+
/**
|
|
24
|
+
* Additional GIR libraries to bind, such as `WebKit-6.0`.
|
|
25
|
+
* Adwaita and GTK are included implicitly and must not be listed.
|
|
26
|
+
*/
|
|
27
|
+
libraries?: string[] | undefined;
|
|
28
|
+
/** Additional GIR search directories. Relative paths are resolved from the project root. */
|
|
29
|
+
girPath?: string[] | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* GApplication identifier, such as `com.example.Tasks`. Required to run, build or deploy the project as an
|
|
32
|
+
* application; a package that is not an application, such as a component library, leaves it out.
|
|
33
|
+
*/
|
|
34
|
+
applicationId?: string | undefined;
|
|
35
|
+
/** Whether to enable the React Compiler, or options passed to it. Enabled by default. */
|
|
36
|
+
reactCompiler?: boolean | ReactCompilerOptions | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Whether GTKX generates project bindings. Set to `false` to reuse an installed binding store.
|
|
39
|
+
* Defaults to `true`.
|
|
40
|
+
*/
|
|
41
|
+
codegen?: boolean | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Additional signals to suppress during React property updates, keyed by GLib type name.
|
|
44
|
+
* Entries extend the built-in signal lists.
|
|
45
|
+
*/
|
|
46
|
+
userEventSignals?: Record<string, string[]> | undefined;
|
|
47
|
+
/** Custom element behaviors and overrides for generated components, props, and documentation. */
|
|
48
|
+
elements?: ElementsOptions | undefined;
|
|
49
|
+
/** Path to an icon theme directory or a single application icon file, relative to the project root. */
|
|
50
|
+
applicationIcon?: string | undefined;
|
|
51
|
+
/** Application metadata, bundled runtime settings, and packaging options used by `gtkx deploy`. */
|
|
52
|
+
deploy?: DeployOptions | undefined;
|
|
53
|
+
/** Controls the project instructions and reference files generated for coding agents. */
|
|
54
|
+
agents?: AgentsOptions | undefined;
|
|
55
|
+
/** Default tool selection and access mode for the project's MCP server. Command-line flags take precedence. */
|
|
56
|
+
mcp?: McpOptions | undefined;
|
|
57
|
+
/** Controls warnings for deprecated configuration and behavior. */
|
|
58
|
+
deprecations?: DeprecationsOptions | undefined;
|
|
59
|
+
};
|
|
60
|
+
/** A {@link Config} whose `applicationId` is known, as loaded for an application. */
|
|
61
|
+
type ApplicationConfig = Config & {
|
|
62
|
+
applicationId: string;
|
|
63
|
+
};
|
|
64
|
+
/** A named export of a module, which `elements.config` entries reference for components and props. */
|
|
65
|
+
type ModuleExport = {
|
|
66
|
+
/** Module specifier containing the named export; relative paths start at the project root. */
|
|
67
|
+
module: string;
|
|
68
|
+
/** Name of the export to import from the module. */
|
|
69
|
+
export: string;
|
|
70
|
+
};
|
|
71
|
+
/** The props type an `elements.config` entry adds to a generated element, and how it combines with them. */
|
|
72
|
+
type ElementPropsExport = {
|
|
73
|
+
/** Module specifier containing the named export; relative paths start at the project root. */
|
|
74
|
+
module: string;
|
|
75
|
+
/** Name of the props type to import from the module. */
|
|
76
|
+
export: string;
|
|
77
|
+
/**
|
|
78
|
+
* How the exported props are combined: `intersection` is inherited; `factory` applies only to this type.
|
|
79
|
+
* Defaults to `intersection`.
|
|
80
|
+
*/
|
|
81
|
+
composition?: "factory" | "intersection" | undefined;
|
|
82
|
+
/** Props that can only be set when the element is created; changing them afterward throws. */
|
|
83
|
+
constructOnly?: string[] | undefined;
|
|
84
|
+
};
|
|
85
|
+
/** Overrides for one GLib type in `elements.config`, keyed by its registered type name. */
|
|
86
|
+
type ElementConfigOptions = {
|
|
87
|
+
/** Component export that wraps the generated element. */
|
|
88
|
+
component?: ModuleExport | undefined;
|
|
89
|
+
/** Additional props type to combine with the generated element props. */
|
|
90
|
+
props?: ElementPropsExport | undefined;
|
|
91
|
+
/** Whether the parent container creates this element's GObject instead of the element constructing its own. */
|
|
92
|
+
isLazy?: boolean | undefined;
|
|
93
|
+
/** Accepted child GLib type names to show in the generated element documentation. */
|
|
94
|
+
acceptedChildTypes?: string[] | undefined;
|
|
95
|
+
/** GObject properties to leave out of generated props, such as properties managed by an element behavior. */
|
|
96
|
+
omittedProps?: string[] | undefined;
|
|
97
|
+
};
|
|
98
|
+
/** The `elements` options: custom element behaviors and per-type overrides for generated elements. */
|
|
99
|
+
type ElementsOptions = {
|
|
100
|
+
/** Path, relative to the project root, of the module exporting the element behavior map. */
|
|
101
|
+
behaviors?: string | undefined;
|
|
102
|
+
/** Element configuration overrides keyed by GLib type name, such as `GtkWidget`. */
|
|
103
|
+
config?: Record<string, ElementConfigOptions> | undefined;
|
|
104
|
+
};
|
|
105
|
+
/** The `agents` options: which files codegen maintains for coding agents. */
|
|
106
|
+
type AgentsOptions = {
|
|
107
|
+
/**
|
|
108
|
+
* Whether codegen maintains the GTKX rules in `AGENTS.md` and creates a missing `CLAUDE.md` import.
|
|
109
|
+
* `false` removes rules written earlier, deleting `AGENTS.md` and the `CLAUDE.md` import when nothing else
|
|
110
|
+
* remains. Defaults to `true` for an application and `false` for a package without an `applicationId`.
|
|
111
|
+
*/
|
|
112
|
+
rules?: boolean | undefined;
|
|
113
|
+
/**
|
|
114
|
+
* Whether codegen writes the generated element reference to `.gtkx/reference` and points the rules at it.
|
|
115
|
+
* `false` removes a reference generated earlier. Defaults to `true` for an application and `false` for a
|
|
116
|
+
* package without an `applicationId`.
|
|
117
|
+
*/
|
|
118
|
+
reference?: boolean | undefined;
|
|
119
|
+
};
|
|
120
|
+
/** The `mcp` options: the tools `gtkx mcp` offers by default and whether it may interact with the app. */
|
|
121
|
+
type McpOptions = {
|
|
122
|
+
/**
|
|
123
|
+
* Tool name patterns applied in order: `*` matches any text and a leading `!` excludes matches.
|
|
124
|
+
* Omitted, empty, or exclusion-only lists start with all tools; other lists start with none.
|
|
125
|
+
*/
|
|
126
|
+
tools?: string[] | undefined;
|
|
127
|
+
/**
|
|
128
|
+
* Whether the MCP server exposes only inspection and reference tools, excluding app interactions.
|
|
129
|
+
* Defaults to `false`.
|
|
130
|
+
*/
|
|
131
|
+
readOnly?: boolean | undefined;
|
|
132
|
+
};
|
|
133
|
+
/** The `deprecations` options: which deprecation warnings stay silent. */
|
|
134
|
+
type DeprecationsOptions = {
|
|
135
|
+
/** Deprecation identifiers whose warnings are suppressed. There are currently no accepted identifiers. */
|
|
136
|
+
silence?: never[] | undefined;
|
|
137
|
+
};
|
|
24
138
|
type McpSettings = {
|
|
25
139
|
tools: string[];
|
|
26
140
|
isReadOnly: boolean;
|
|
@@ -29,6 +143,8 @@ type McpSettings = {
|
|
|
29
143
|
type ResolvedConfig = {
|
|
30
144
|
/** The GApplication identifier the app registers under. */
|
|
31
145
|
applicationId: string;
|
|
146
|
+
/** The gettext domain, which is the `applicationId` production builds use. */
|
|
147
|
+
translationDomain: string;
|
|
32
148
|
/** React Compiler options for the build, or `null` when the compiler is disabled. */
|
|
33
149
|
reactCompiler: ResolvedReactCompilerOptions | null;
|
|
34
150
|
/**
|
|
@@ -42,39 +158,23 @@ type ResolvedConfig = {
|
|
|
42
158
|
lazyElements: string[];
|
|
43
159
|
};
|
|
44
160
|
declare const APPLICATION_ID_MAX_LENGTH = 255;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
/** Panic thresholds `babel-plugin-react-compiler` accepts. */
|
|
48
|
-
declare const PANIC_THRESHOLDS: readonly ["none", "critical_errors", "all_errors"];
|
|
49
|
-
declare const moduleExportSchema: z.ZodObject<{
|
|
50
|
-
module: z.ZodString;
|
|
51
|
-
export: z.ZodString;
|
|
52
|
-
}, z.core.$strict>;
|
|
53
|
-
declare const elementPropsSchema: z.ZodObject<{
|
|
54
|
-
module: z.ZodString;
|
|
55
|
-
export: z.ZodString;
|
|
56
|
-
composition: z.ZodOptional<z.ZodEnum<{
|
|
57
|
-
intersection: "intersection";
|
|
58
|
-
factory: "factory";
|
|
59
|
-
}>>;
|
|
60
|
-
constructOnly: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
61
|
-
}, z.core.$strict>;
|
|
62
|
-
/** Schema every `gtkx.config.ts` is validated against, and the source of the {@link Config} type. */
|
|
161
|
+
declare const LIBRARY_APPLICATION_ID = "org.gtkx.Library";
|
|
162
|
+
/** Schema every `gtkx.config.ts` is validated against. */
|
|
63
163
|
declare const configSchema: z.ZodObject<{
|
|
64
164
|
libraries: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
65
165
|
girPath: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
66
|
-
applicationId: z.ZodString
|
|
166
|
+
applicationId: z.ZodOptional<z.ZodString>;
|
|
67
167
|
reactCompiler: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
68
168
|
compilationMode: z.ZodOptional<z.ZodEnum<{
|
|
169
|
+
all: "all";
|
|
170
|
+
annotation: "annotation";
|
|
69
171
|
infer: "infer";
|
|
70
172
|
syntax: "syntax";
|
|
71
|
-
annotation: "annotation";
|
|
72
|
-
all: "all";
|
|
73
173
|
}>>;
|
|
74
174
|
panicThreshold: z.ZodOptional<z.ZodEnum<{
|
|
75
|
-
none: "none";
|
|
76
|
-
critical_errors: "critical_errors";
|
|
77
175
|
all_errors: "all_errors";
|
|
176
|
+
critical_errors: "critical_errors";
|
|
177
|
+
none: "none";
|
|
78
178
|
}>>;
|
|
79
179
|
}, z.core.$strict>]>>;
|
|
80
180
|
codegen: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -90,8 +190,8 @@ declare const configSchema: z.ZodObject<{
|
|
|
90
190
|
module: z.ZodString;
|
|
91
191
|
export: z.ZodString;
|
|
92
192
|
composition: z.ZodOptional<z.ZodEnum<{
|
|
93
|
-
intersection: "intersection";
|
|
94
193
|
factory: "factory";
|
|
194
|
+
intersection: "intersection";
|
|
95
195
|
}>>;
|
|
96
196
|
constructOnly: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
97
197
|
}, z.core.$strict>>;
|
|
@@ -156,10 +256,10 @@ declare const configSchema: z.ZodObject<{
|
|
|
156
256
|
dark: z.ZodString;
|
|
157
257
|
}, z.core.$strict>>;
|
|
158
258
|
contentRating: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
|
|
159
|
-
none: "none";
|
|
160
259
|
intense: "intense";
|
|
161
260
|
mild: "mild";
|
|
162
261
|
moderate: "moderate";
|
|
262
|
+
none: "none";
|
|
163
263
|
}>>>;
|
|
164
264
|
releases: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
165
265
|
version: z.ZodString;
|
|
@@ -195,7 +295,10 @@ declare const configSchema: z.ZodObject<{
|
|
|
195
295
|
desktopEntry: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
196
296
|
metainfoExtra: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
197
297
|
isDbusActivatable: z.ZodOptional<z.ZodBoolean>;
|
|
198
|
-
extraFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.
|
|
298
|
+
extraFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
299
|
+
source: z.ZodString;
|
|
300
|
+
mode: z.ZodOptional<z.ZodString>;
|
|
301
|
+
}, z.core.$strict>]>>>;
|
|
199
302
|
minimumLibraryVersions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
200
303
|
depends: z.ZodOptional<z.ZodObject<{
|
|
201
304
|
deb: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -224,11 +327,9 @@ declare const configSchema: z.ZodObject<{
|
|
|
224
327
|
}, z.core.$strict>>;
|
|
225
328
|
breaks: z.ZodOptional<z.ZodObject<{
|
|
226
329
|
deb: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
227
|
-
rpm: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
228
330
|
}, z.core.$strict>>;
|
|
229
331
|
preDepends: z.ZodOptional<z.ZodObject<{
|
|
230
332
|
deb: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
231
|
-
rpm: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
232
333
|
}, z.core.$strict>>;
|
|
233
334
|
}, z.core.$strict>>;
|
|
234
335
|
scripts: z.ZodOptional<z.ZodObject<{
|
|
@@ -237,7 +338,20 @@ declare const configSchema: z.ZodObject<{
|
|
|
237
338
|
preRemove: z.ZodOptional<z.ZodString>;
|
|
238
339
|
postRemove: z.ZodOptional<z.ZodString>;
|
|
239
340
|
}, z.core.$strict>>;
|
|
240
|
-
node: z.ZodOptional<z.
|
|
341
|
+
node: z.ZodOptional<z.ZodObject<{
|
|
342
|
+
source: z.ZodOptional<z.ZodEnum<{
|
|
343
|
+
download: "download";
|
|
344
|
+
host: "host";
|
|
345
|
+
path: "path";
|
|
346
|
+
}>>;
|
|
347
|
+
version: z.ZodOptional<z.ZodString>;
|
|
348
|
+
path: z.ZodOptional<z.ZodString>;
|
|
349
|
+
shouldStrip: z.ZodOptional<z.ZodBoolean>;
|
|
350
|
+
shouldUseCompileCache: z.ZodOptional<z.ZodBoolean>;
|
|
351
|
+
}, z.core.$strict>>;
|
|
352
|
+
tools: z.ZodOptional<z.ZodObject<{
|
|
353
|
+
nfpm: z.ZodOptional<z.ZodString>;
|
|
354
|
+
}, z.core.$strict>>;
|
|
241
355
|
signing: z.ZodOptional<z.ZodObject<{
|
|
242
356
|
appimage: z.ZodOptional<z.ZodObject<{
|
|
243
357
|
gpgKeyId: z.ZodString;
|
|
@@ -250,9 +364,9 @@ declare const configSchema: z.ZodObject<{
|
|
|
250
364
|
"dpkg-sig": "dpkg-sig";
|
|
251
365
|
}>>;
|
|
252
366
|
type: z.ZodOptional<z.ZodEnum<{
|
|
253
|
-
origin: "origin";
|
|
254
367
|
archive: "archive";
|
|
255
368
|
maint: "maint";
|
|
369
|
+
origin: "origin";
|
|
256
370
|
}>>;
|
|
257
371
|
signer: z.ZodOptional<z.ZodString>;
|
|
258
372
|
}, z.core.$strict>>;
|
|
@@ -321,9 +435,9 @@ declare const configSchema: z.ZodObject<{
|
|
|
321
435
|
group: z.ZodOptional<z.ZodString>;
|
|
322
436
|
compression: z.ZodOptional<z.ZodEnum<{
|
|
323
437
|
gzip: "gzip";
|
|
438
|
+
lzma: "lzma";
|
|
324
439
|
xz: "xz";
|
|
325
440
|
zstd: "zstd";
|
|
326
|
-
lzma: "lzma";
|
|
327
441
|
}>>;
|
|
328
442
|
prefixes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
329
443
|
}, z.core.$strict>>;
|
|
@@ -346,7 +460,7 @@ declare const configSchema: z.ZodObject<{
|
|
|
346
460
|
*/
|
|
347
461
|
declare const defineConfig: DefineConfig<Config>;
|
|
348
462
|
declare const isValidApplicationId: (applicationId: string) => boolean;
|
|
349
|
-
declare const validateConfig: (config: unknown, configFile?: string) =>
|
|
463
|
+
declare const validateConfig: (config: unknown, configFile?: string) => asserts config is ApplicationConfig;
|
|
350
464
|
declare const graduatedFutureKeys: (config: unknown) => string[];
|
|
351
465
|
/**
|
|
352
466
|
* Deep-merges a configuration over a base. `override` wins over `base` on conflicting scalar and object keys, while
|
|
@@ -354,13 +468,13 @@ declare const graduatedFutureKeys: (config: unknown) => string[];
|
|
|
354
468
|
*/
|
|
355
469
|
declare const mergeConfig: (base: Config, override: Config) => Config;
|
|
356
470
|
declare const resolveLazyElements: (elements: Config["elements"]) => string[];
|
|
357
|
-
declare const resolveElementComponents: (elements: Config["elements"]) => Record<string, ModuleExport>;
|
|
358
|
-
declare const resolveElementProps: (elements: Config["elements"]) => Record<string, ElementPropsExport>;
|
|
471
|
+
declare const resolveElementComponents: (elements: Config["elements"], root: string) => Record<string, ModuleExport>;
|
|
472
|
+
declare const resolveElementProps: (elements: Config["elements"], root: string) => Record<string, ElementPropsExport>;
|
|
359
473
|
declare const resolveAcceptedChildTypes: (elements: Config["elements"]) => Record<string, string[]>;
|
|
360
474
|
declare const resolveOmittedProps: (elements: Config["elements"]) => Record<string, string[]>;
|
|
361
|
-
declare const isAgentRulesEnabled: (config: Config) => boolean;
|
|
362
|
-
declare const isAgentReferenceEnabled: (config: Config) => boolean;
|
|
475
|
+
declare const isAgentRulesEnabled: (config: Config, isApplication: boolean) => boolean;
|
|
476
|
+
declare const isAgentReferenceEnabled: (config: Config, isApplication: boolean) => boolean;
|
|
363
477
|
declare const resolveMcpSettings: (config: Config) => McpSettings;
|
|
364
|
-
declare const resolveConfig: (config:
|
|
365
|
-
export { APPLICATION_ID_MAX_LENGTH, defineConfig, isAgentReferenceEnabled, isAgentRulesEnabled, isValidApplicationId, graduatedFutureKeys, validateConfig, mergeConfig, resolveLazyElements, resolveElementComponents, resolveElementProps, resolveAcceptedChildTypes, resolveMcpSettings, resolveOmittedProps, resolveConfig, type McpSettings, type ResolvedReactCompilerOptions, type Config, type ResolvedConfig, };
|
|
478
|
+
declare const resolveConfig: (config: ApplicationConfig, translationDomain: string, root?: string) => ResolvedConfig;
|
|
479
|
+
export { configSchema, APPLICATION_ID_MAX_LENGTH, LIBRARY_APPLICATION_ID, defineConfig, isAgentReferenceEnabled, isAgentRulesEnabled, isValidApplicationId, graduatedFutureKeys, validateConfig, mergeConfig, resolveLazyElements, resolveElementComponents, resolveElementProps, resolveAcceptedChildTypes, resolveMcpSettings, resolveOmittedProps, resolveConfig, type AgentsOptions, type DeprecationsOptions, type ElementsOptions, type McpOptions, type McpSettings, type ReactCompilerOptions, type ResolvedReactCompilerOptions, type ApplicationConfig, type Config, type ElementConfigOptions, type ElementPropsExport, type ModuleExport, type ResolvedConfig, };
|
|
366
480
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,KAAK,CAAC;AAG5D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,KAAK,CAAC;AAG5D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,KAAK,aAAa,EAAgB,MAAM,aAAa,CAAC;AAI/D,iGAAiG;AACjG,KAAK,oBAAoB,GAAG;IACxB,oDAAoD;IACpD,eAAe,CAAC,EAAE,KAAK,GAAG,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;IACxE,uDAAuD;IACvD,cAAc,CAAC,EAAE,YAAY,GAAG,iBAAiB,GAAG,MAAM,GAAG,SAAS,CAAC;CAC1E,CAAC;AAEF;;;GAGG;AACH,KAAK,4BAA4B,GAAG,oBAAoB,GAAG;IACvD,kDAAkD;IAClD,MAAM,EAAE,IAAI,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,KAAK,MAAM,GAAG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,EAClB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,oBAAoB,EACzB,KAAK,4BAA4B,EACjC,KAAK,iBAAiB,EACtB,KAAK,MAAM,EACX,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,cAAc,GACtB,CAAC"}
|
package/dist/config.js
CHANGED
|
@@ -8,29 +8,31 @@ import { girLibrary, text } from "./schema-text.js";
|
|
|
8
8
|
import { resolveUserEventSignals } from "./user-event-signals.js";
|
|
9
9
|
const APPLICATION_ID_PATTERN = /^[A-Za-z_][A-Za-z0-9_-]*(\.[A-Za-z_][A-Za-z0-9_-]*)+$/;
|
|
10
10
|
const APPLICATION_ID_MAX_LENGTH = 255;
|
|
11
|
+
const LIBRARY_APPLICATION_ID = "org.gtkx.Library";
|
|
11
12
|
const IMPLICIT_LIBRARIES = new Set(["Adw-1", "Gtk-4.0"]);
|
|
12
13
|
/** Compilation modes `babel-plugin-react-compiler` accepts. */
|
|
13
14
|
const COMPILATION_MODES = ["infer", "syntax", "annotation", "all"];
|
|
14
15
|
/** Panic thresholds `babel-plugin-react-compiler` accepts. */
|
|
15
16
|
const PANIC_THRESHOLDS = ["none", "critical_errors", "all_errors"];
|
|
16
17
|
const REACT_COMPILER_TARGET = "19";
|
|
17
|
-
const librarySchema = girLibrary('must be of the form "Name-Version", such as "Adw-1"')
|
|
18
|
-
.refine((library) => !IMPLICIT_LIBRARIES.has(library), { error: "is bound implicitly; remove it" });
|
|
18
|
+
const librarySchema = girLibrary('must be of the form "Name-Version", such as "Adw-1"').refine((library) => !IMPLICIT_LIBRARIES.has(library), { error: "is bound implicitly; remove it" });
|
|
19
19
|
const librariesSchema = z
|
|
20
20
|
.array(librarySchema, { error: "must be a non-empty string array or omitted" })
|
|
21
21
|
.min(1, { error: "must be a non-empty string array or omitted" });
|
|
22
22
|
const applicationIdSchema = z
|
|
23
|
-
.string({
|
|
23
|
+
.string({
|
|
24
|
+
error: (issue) => issue.input === undefined
|
|
25
|
+
? 'is required to run, build or deploy an application, such as "org.example.MyApp"'
|
|
26
|
+
: "must satisfy g_application_id_is_valid",
|
|
27
|
+
})
|
|
24
28
|
.refine((value) => isValidApplicationId(value), {
|
|
25
29
|
error: 'must satisfy g_application_id_is_valid, such as "org.example.MyApp"',
|
|
26
30
|
});
|
|
27
|
-
const
|
|
28
|
-
z.
|
|
29
|
-
z.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}),
|
|
33
|
-
]);
|
|
31
|
+
const reactCompilerOptionsSchema = z.strictObject({
|
|
32
|
+
compilationMode: z.enum(COMPILATION_MODES).optional(),
|
|
33
|
+
panicThreshold: z.enum(PANIC_THRESHOLDS).optional(),
|
|
34
|
+
});
|
|
35
|
+
const reactCompilerSchema = z.union([z.boolean(), reactCompilerOptionsSchema]);
|
|
34
36
|
const userEventSignalsSchema = z.record(z.string(), z.array(z.string({ error: "must be a non-empty signal name" }).min(1, { error: "must be a non-empty signal name" }), {
|
|
35
37
|
error: "must be an array of signal names",
|
|
36
38
|
}), { error: "must be a record of GLib type names to signal name arrays" });
|
|
@@ -90,11 +92,11 @@ const deprecationsSchema = z.strictObject({
|
|
|
90
92
|
})
|
|
91
93
|
.optional(),
|
|
92
94
|
});
|
|
93
|
-
/** Schema every `gtkx.config.ts` is validated against
|
|
95
|
+
/** Schema every `gtkx.config.ts` is validated against. */
|
|
94
96
|
const configSchema = z.strictObject({
|
|
95
97
|
libraries: librariesSchema.optional(),
|
|
96
98
|
girPath: z.array(z.string(), { error: "must be an array of strings if provided" }).optional(),
|
|
97
|
-
applicationId: applicationIdSchema,
|
|
99
|
+
applicationId: applicationIdSchema.optional(),
|
|
98
100
|
reactCompiler: reactCompilerSchema.optional(),
|
|
99
101
|
codegen: z.boolean({ error: "must be a boolean" }).optional(),
|
|
100
102
|
userEventSignals: userEventSignalsSchema.optional(),
|
|
@@ -110,7 +112,10 @@ const configSchema = z.strictObject({
|
|
|
110
112
|
* autocompletion and type checking.
|
|
111
113
|
*/
|
|
112
114
|
const defineConfig = createDefineConfig();
|
|
113
|
-
const validationSchema = configSchema.extend({
|
|
115
|
+
const validationSchema = configSchema.extend({
|
|
116
|
+
applicationId: applicationIdSchema,
|
|
117
|
+
future: graduatedFutureSchema.optional(),
|
|
118
|
+
});
|
|
114
119
|
const isValidApplicationId = (applicationId) => applicationId.length <= APPLICATION_ID_MAX_LENGTH && APPLICATION_ID_PATTERN.test(applicationId);
|
|
115
120
|
const resolveReactCompilerOptions = (setting) => {
|
|
116
121
|
if (setting === false) {
|
|
@@ -153,22 +158,26 @@ const elementEntryValues = (elements, pick) => Object.fromEntries(Object.entries
|
|
|
153
158
|
const value = pick(entry);
|
|
154
159
|
return value === undefined ? [] : [[type, value]];
|
|
155
160
|
}));
|
|
156
|
-
const
|
|
157
|
-
|
|
161
|
+
const resolveModuleSpecifier = (reference, root) => reference.module.startsWith("./") || reference.module.startsWith("../")
|
|
162
|
+
? { ...reference, module: resolve(root, reference.module) }
|
|
163
|
+
: reference;
|
|
164
|
+
const resolveElementComponents = (elements, root) => elementEntryValues(elements, (entry) => entry.component && resolveModuleSpecifier(entry.component, root));
|
|
165
|
+
const resolveElementProps = (elements, root) => elementEntryValues(elements, (entry) => entry.props && resolveModuleSpecifier(entry.props, root));
|
|
158
166
|
const resolveAcceptedChildTypes = (elements) => elementEntryValues(elements, (entry) => entry.acceptedChildTypes);
|
|
159
167
|
const resolveOmittedProps = (elements) => elementEntryValues(elements, (entry) => entry.omittedProps);
|
|
160
|
-
const isAgentRulesEnabled = (config) => config.agents?.rules
|
|
161
|
-
const isAgentReferenceEnabled = (config) => config.agents?.reference
|
|
168
|
+
const isAgentRulesEnabled = (config, isApplication) => config.agents?.rules ?? isApplication;
|
|
169
|
+
const isAgentReferenceEnabled = (config, isApplication) => config.agents?.reference ?? isApplication;
|
|
162
170
|
const resolveMcpSettings = (config) => ({
|
|
163
171
|
tools: config.mcp?.tools ?? [],
|
|
164
172
|
isReadOnly: config.mcp?.readOnly === true,
|
|
165
173
|
});
|
|
166
|
-
const resolveConfig = (config, root) => ({
|
|
174
|
+
const resolveConfig = (config, translationDomain, root) => ({
|
|
167
175
|
applicationId: config.applicationId,
|
|
176
|
+
translationDomain,
|
|
168
177
|
reactCompiler: resolveReactCompilerOptions(config.reactCompiler),
|
|
169
178
|
userEventSignals: resolveUserEventSignals(config.userEventSignals),
|
|
170
179
|
elements: resolveElementsModule(config.elements?.behaviors, root),
|
|
171
180
|
lazyElements: resolveLazyElements(config.elements),
|
|
172
181
|
});
|
|
173
|
-
export { APPLICATION_ID_MAX_LENGTH, defineConfig, isAgentReferenceEnabled, isAgentRulesEnabled, isValidApplicationId, graduatedFutureKeys, validateConfig, mergeConfig, resolveLazyElements, resolveElementComponents, resolveElementProps, resolveAcceptedChildTypes, resolveMcpSettings, resolveOmittedProps, resolveConfig, };
|
|
182
|
+
export { configSchema, APPLICATION_ID_MAX_LENGTH, LIBRARY_APPLICATION_ID, defineConfig, isAgentReferenceEnabled, isAgentRulesEnabled, isValidApplicationId, graduatedFutureKeys, validateConfig, mergeConfig, resolveLazyElements, resolveElementComponents, resolveElementProps, resolveAcceptedChildTypes, resolveMcpSettings, resolveOmittedProps, resolveConfig, };
|
|
174
183
|
//# sourceMappingURL=config.js.map
|