@gtkx/cli 1.6.0 → 2.0.0-beta.1
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/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 +3 -5
- package/dist/codegen/run-codegen.d.ts.map +1 -1
- package/dist/codegen/run-codegen.js +23 -100
- package/dist/codegen/run-codegen.js.map +1 -1
- package/dist/codegen/store-resolver.d.ts +0 -1
- package/dist/codegen/store-resolver.d.ts.map +1 -1
- package/dist/codegen/store-resolver.js +8 -17
- package/dist/codegen/store-resolver.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/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/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/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/stage.d.ts.map +1 -1
- package/dist/deploy/payload/stage.js +1 -3
- package/dist/deploy/payload/stage.js.map +1 -1
- package/dist/deploy/settings/build-manifest.d.ts.map +1 -1
- package/dist/deploy/settings/build-manifest.js +4 -15
- package/dist/deploy/settings/build-manifest.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 +1 -2
- package/dist/deploy/settings/paths.d.ts.map +1 -1
- package/dist/deploy/settings/paths.js +5 -15
- 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 +4 -4
- 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/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 +66 -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/docs-elements.js +2 -2
- package/dist/internal/docs-elements.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/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/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/i18n.d.ts.map +1 -1
- package/dist/vite-plugins/i18n.js +2 -1
- package/dist/vite-plugins/i18n.js.map +1 -1
- package/dist/vite-plugins/index.d.ts.map +1 -1
- package/dist/vite-plugins/index.js +2 -4
- 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/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/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 +28 -145
- package/src/codegen/store-resolver.ts +8 -24
- package/src/commands/docs.ts +5 -17
- package/src/deploy/freedesktop/copyright.ts +2 -14
- package/src/deploy/freedesktop/xml.ts +24 -32
- package/src/deploy/node-runtime/license.ts +2 -8
- package/src/deploy/notices/packages.ts +3 -11
- package/src/deploy/payload/copy-tree.ts +3 -4
- package/src/deploy/payload/stage.ts +2 -6
- package/src/deploy/settings/build-manifest.ts +4 -16
- package/src/deploy/settings/libraries.ts +1 -22
- package/src/deploy/settings/paths.ts +6 -16
- package/src/deploy/settings/screenshots.ts +8 -46
- package/src/deploy/targets/flatpak-pnpm.ts +4 -4
- package/src/deploy/targets/flatpak-source.ts +4 -4
- package/src/deploy/targets/flatpak-sources.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 +77 -115
- package/src/i18n/types.ts +97 -131
- package/src/internal/docs-elements.ts +2 -2
- package/src/internal/icon-path.ts +6 -19
- package/src/internal/source-imports.ts +14 -50
- 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/i18n.ts +2 -1
- package/src/vite-plugins/index.ts +2 -4
- package/src/vite-plugins/resources.ts +37 -140
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store-resolver.d.ts","sourceRoot":"","sources":["../../src/codegen/store-resolver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAc,MAAM,cAAc,CAAC;AAMvD,KAAK,YAAY,GAAG;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,mBAAmB,GAAG,IAAI,CAAC;CACrC,CAAC;AAEF,KAAK,mBAAmB,GAAG;IACvB,OAAO,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"store-resolver.d.ts","sourceRoot":"","sources":["../../src/codegen/store-resolver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAc,MAAM,cAAc,CAAC;AAMvD,KAAK,YAAY,GAAG;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,mBAAmB,GAAG,IAAI,CAAC;CACrC,CAAC;AAEF,KAAK,mBAAmB,GAAG;IACvB,OAAO,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,KAAK,cAAc,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACtB,CAAC;AAgBF,QAAA,MAAM,mBAAmB,GAAI,KAAK,MAAM,KAAG,YAqB1C,CAAC;AAEF,QAAA,MAAM,qBAAqB,GAAU,KAAK,MAAM,EAAE,OAAO,MAAM,KAAG,OAAO,CAAC,cAAc,CAIvF,CAAC;AAEF,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,KAAK,cAAc,EAAE,KAAK,YAAY,EAAE,CAAC"}
|
|
@@ -1,36 +1,27 @@
|
|
|
1
1
|
import { resolveStore } from "@gtkx/codegen";
|
|
2
2
|
import { loadConfig } from "@gtkx/config";
|
|
3
|
-
import { existsSync
|
|
3
|
+
import { existsSync } from "node:fs";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { dirname, join } from "node:path";
|
|
6
6
|
import { pathToFileURL } from "node:url";
|
|
7
|
-
const
|
|
8
|
-
const parsed = JSON.parse(readFileSync(packageJsonPath, "utf8"));
|
|
9
|
-
return parsed.version ?? "0.0.0";
|
|
10
|
-
};
|
|
11
|
-
const resolvePackage = (require, dir, packageName) => {
|
|
7
|
+
const hasPackage = (require, dir, packageName) => {
|
|
12
8
|
try {
|
|
13
|
-
|
|
14
|
-
return
|
|
9
|
+
require.resolve(`${packageName}/package.json`);
|
|
10
|
+
return true;
|
|
15
11
|
}
|
|
16
12
|
catch {
|
|
17
13
|
const unscoped = packageName.replace(/^@[^/]+\//, "");
|
|
18
|
-
|
|
19
|
-
if (!existsSync(workspacePkg)) {
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
const real = realpathSync(workspacePkg);
|
|
23
|
-
return { dir: dirname(real), version: readVersion(real) };
|
|
14
|
+
return existsSync(join(dir, "packages", unscoped, "package.json"));
|
|
24
15
|
}
|
|
25
16
|
};
|
|
26
17
|
const siblingStore = (giDir) => join(dirname(giDir), "jsx");
|
|
27
18
|
const resolveCodegenStore = (dir) => {
|
|
28
19
|
const require = createRequire(pathToFileURL(join(dir, "__gtkx_resolver__.js")).href);
|
|
29
|
-
if (
|
|
20
|
+
if (!hasPackage(require, dir, "@gtkx/native")) {
|
|
30
21
|
throw new Error("Cannot resolve @gtkx/native from the project; is it installed?");
|
|
31
22
|
}
|
|
32
23
|
const store = resolveStore(dir);
|
|
33
|
-
const hasReactRuntime =
|
|
24
|
+
const hasReactRuntime = hasPackage(require, dir, "react");
|
|
34
25
|
return {
|
|
35
26
|
giStoreDir: store.gi.storeDir,
|
|
36
27
|
giLinkDir: store.gi.linkDir,
|
|
@@ -38,7 +29,7 @@ const resolveCodegenStore = (dir) => {
|
|
|
38
29
|
jsxLinkDir: store.jsx?.linkDir ?? siblingStore(store.gi.linkDir),
|
|
39
30
|
runtimeVersion: store.gi.version,
|
|
40
31
|
react: hasReactRuntime && store.jsx !== null
|
|
41
|
-
? { version: store.jsx.version
|
|
32
|
+
? { version: store.jsx.version }
|
|
42
33
|
: null,
|
|
43
34
|
};
|
|
44
35
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store-resolver.js","sourceRoot":"","sources":["../../src/codegen/store-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,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O,EAAE,GAAG,EAAE,cAAc,CAAC,EAAE,CAAC;QAC5C,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAC;IACtF,CAAC;IAED,MAAM,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;IAChC,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IAE1D,OAAO;QACH,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,QAAQ;QAC7B,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,OAAO;QAC3B,WAAW,EAAE,KAAK,CAAC,GAAG,EAAE,QAAQ,IAAI,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC,QAAQ,CAAC;QACnE,UAAU,EAAE,KAAK,CAAC,GAAG,EAAE,OAAO,IAAI,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,CAAC;QAChE,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,OAAO;QAChC,KAAK,EACD,eAAe,IAAI,KAAK,CAAC,GAAG,KAAK,IAAI;YACjC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE;YAChC,CAAC,CAAC,IAAI;KACjB,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,qBAAqB,GAAG,KAAK,EAAE,GAAW,EAAE,IAAa,EAA2B,EAAE;IACxF,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,UAAU,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;IAE/D,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;AAC7C,CAAC,CAAC;AAEF,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAA0C,CAAC","sourcesContent":["import { resolveStore } from \"@gtkx/codegen\";\nimport { type Config, loadConfig } from \"@gtkx/config\";\nimport { existsSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { dirname, join } from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\n\ntype CodegenStore = {\n giStoreDir: string;\n giLinkDir: string;\n jsxStoreDir: string;\n jsxLinkDir: string;\n runtimeVersion: string;\n react: CodegenReactPackage | null;\n};\n\ntype CodegenReactPackage = {\n version: string;\n};\n\ntype CodegenContext = {\n root: string;\n config: Config;\n configFile: string;\n};\n\nconst hasPackage = (require: NodeJS.Require, dir: string, packageName: string): boolean => {\n try {\n require.resolve(`${packageName}/package.json`);\n\n return true;\n } catch {\n const unscoped = packageName.replace(/^@[^/]+\\//, \"\");\n\n return existsSync(join(dir, \"packages\", unscoped, \"package.json\"));\n }\n};\n\nconst siblingStore = (giDir: string): string => join(dirname(giDir), \"jsx\");\n\nconst resolveCodegenStore = (dir: string): CodegenStore => {\n const require = createRequire(pathToFileURL(join(dir, \"__gtkx_resolver__.js\")).href);\n\n if (!hasPackage(require, dir, \"@gtkx/native\")) {\n throw new Error(\"Cannot resolve @gtkx/native from the project; is it installed?\");\n }\n\n const store = resolveStore(dir);\n const hasReactRuntime = hasPackage(require, dir, \"react\");\n\n return {\n giStoreDir: store.gi.storeDir,\n giLinkDir: store.gi.linkDir,\n jsxStoreDir: store.jsx?.storeDir ?? siblingStore(store.gi.storeDir),\n jsxLinkDir: store.jsx?.linkDir ?? siblingStore(store.gi.linkDir),\n runtimeVersion: store.gi.version,\n react:\n hasReactRuntime && store.jsx !== null\n ? { version: store.jsx.version }\n : null,\n };\n};\n\nconst resolveCodegenContext = async (cwd: string, mode?: string): Promise<CodegenContext> => {\n const { config, configFile } = await loadConfig(cwd, { mode });\n\n return { root: cwd, config, configFile };\n};\n\nexport { resolveCodegenStore, resolveCodegenContext, type CodegenContext, type CodegenStore };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/commands/docs.ts"],"names":[],"mappings":"AAUA,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/commands/docs.ts"],"names":[],"mappings":"AAUA,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;EA6ER,CAAC;AA2BH,OAAO,EAAE,IAAI,EAAE,CAAC"}
|
package/dist/commands/docs.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { mergeOmittedProps, resolveGirPath, resolveLibraries } from "@gtkx/codegen";
|
|
2
2
|
import { writeDocs } from "@gtkx/codegen/internal";
|
|
3
3
|
import { loadConfig } from "@gtkx/config";
|
|
4
|
-
import {
|
|
5
|
-
import { info } from "@gtkx/utils";
|
|
4
|
+
import { resolveOmittedProps } from "@gtkx/config/internal";
|
|
5
|
+
import { info, isPathInside } from "@gtkx/utils";
|
|
6
6
|
import { defineCommand } from "citty";
|
|
7
|
-
import {
|
|
7
|
+
import { resolve } from "node:path";
|
|
8
8
|
import { resolveDocsElements } from "../internal/docs-elements.js";
|
|
9
9
|
import { cwdArg, resolveCwd } from "../internal/entry-arg.js";
|
|
10
10
|
const docs = defineCommand({
|
|
@@ -45,8 +45,7 @@ const docs = defineCommand({
|
|
|
45
45
|
"(Linux: `sudo dnf install gobject-introspection-devel` or " +
|
|
46
46
|
"`sudo apt install libgirepository1.0-dev`), or set `girPath` in gtkx.config.ts.");
|
|
47
47
|
}
|
|
48
|
-
const
|
|
49
|
-
const libraries = resolveLibraries(config.libraries, girPath, future.isAdwaitaDefault);
|
|
48
|
+
const libraries = resolveLibraries(config.libraries);
|
|
50
49
|
const startedAt = Date.now();
|
|
51
50
|
const outDir = resolveOutDir(cwd, args.out);
|
|
52
51
|
const builtin = await resolveDocsElements(cwd);
|
|
@@ -58,11 +57,6 @@ const docs = defineCommand({
|
|
|
58
57
|
props: builtin.props,
|
|
59
58
|
omittedProps: mergeOmittedProps(builtin.omittedProps, resolveOmittedProps(config.elements)),
|
|
60
59
|
isForced: args.force,
|
|
61
|
-
isByteArrayTyped: future.isByteArrayTyped,
|
|
62
|
-
isValueUnwrapped: future.isValueUnwrapped,
|
|
63
|
-
isFinishTrimmed: future.isFinishTrimmed,
|
|
64
|
-
isInoutInPlace: future.isInoutInPlace,
|
|
65
|
-
isTreeShaken: future.isTreeShaken,
|
|
66
60
|
});
|
|
67
61
|
if (!isRegenerated) {
|
|
68
62
|
info(`docs: pages in ${outDir} are up to date`);
|
|
@@ -73,10 +67,6 @@ const docs = defineCommand({
|
|
|
73
67
|
`to ${outDir} in ${String(Date.now() - startedAt)}ms`);
|
|
74
68
|
},
|
|
75
69
|
});
|
|
76
|
-
const isBelow = (parent, child) => {
|
|
77
|
-
const path = relative(parent, child);
|
|
78
|
-
return path !== "" && path !== ".." && !path.startsWith(`..${sep}`) && !isAbsolute(path);
|
|
79
|
-
};
|
|
80
70
|
const outDirReason = (cwd, out, outDir) => {
|
|
81
71
|
if (out.trim() === "") {
|
|
82
72
|
return "it was empty, which names the project root itself";
|
|
@@ -88,7 +78,7 @@ const outDirReason = (cwd, out, outDir) => {
|
|
|
88
78
|
};
|
|
89
79
|
const resolveOutDir = (cwd, out) => {
|
|
90
80
|
const outDir = out.trim() === "" ? cwd : resolve(cwd, out);
|
|
91
|
-
if (
|
|
81
|
+
if (isPathInside(cwd, outDir)) {
|
|
92
82
|
return outDir;
|
|
93
83
|
}
|
|
94
84
|
throw new Error(`--out must name a directory below the project root ${cwd}, and ${outDirReason(cwd, out, outDir)}. ` +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.js","sourceRoot":"","sources":["../../src/commands/docs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACpF,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"docs.js","sourceRoot":"","sources":["../../src/commands/docs.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AM,CAAC,cAAc;YAC5F,MAAM,MAAM,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC,IAAI,CACxD,CAAC;IACN,CAAC;CACJ,CAAC,CAAC;AAEH,MAAM,YAAY,GAAG,CAAC,GAAW,EAAE,GAAW,EAAE,MAAc,EAAU,EAAE;IACtE,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QACpB,OAAO,mDAAmD,CAAC;IAC/D,CAAC;IAED,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;QACjB,OAAO,kCAAkC,CAAC;IAC9C,CAAC;IAED,OAAO,GAAG,MAAM,gBAAgB,CAAC;AACrC,CAAC,CAAC;AAEF,MAAM,aAAa,GAAG,CAAC,GAAW,EAAE,GAAW,EAAU,EAAE;IACvD,MAAM,MAAM,GAAG,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAE3D,IAAI,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,CAAC;QAC5B,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,MAAM,IAAI,KAAK,CACX,sDAAsD,GAAG,SAAS,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,IAAI;QACpG,2CAA2C,CAC9C,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,EAAE,IAAI,EAAE,CAAC","sourcesContent":["import { mergeOmittedProps, resolveGirPath, resolveLibraries } from \"@gtkx/codegen\";\nimport { writeDocs } from \"@gtkx/codegen/internal\";\nimport { loadConfig } from \"@gtkx/config\";\nimport { resolveOmittedProps } from \"@gtkx/config/internal\";\nimport { info, isPathInside } from \"@gtkx/utils\";\nimport { defineCommand } from \"citty\";\nimport { resolve } from \"node:path\";\nimport { resolveDocsElements } from \"../internal/docs-elements.js\";\nimport { cwdArg, resolveCwd } from \"../internal/entry-arg.js\";\n\nconst docs = defineCommand({\n meta: {\n name: \"docs\",\n description:\n \"Generate markdown reference pages for the JSX elements of the GIR libraries declared in gtkx.config.ts\",\n },\n args: {\n out: {\n type: \"string\",\n description:\n \"Output directory for the generated markdown pages, below the project root. It must be empty \" +\n \"or hold an earlier `gtkx docs` run, whose pages are replaced\",\n default: \"docs/reference\",\n },\n \"base-path\": {\n type: \"string\",\n description: \"URL base path used for links between generated pages\",\n default: \"/reference\",\n },\n force: {\n type: \"boolean\",\n description:\n \"Regenerate even when the pages are up to date with the GIR libraries, the base path, \" +\n \"and the element props the project configures\",\n default: false,\n },\n ...cwdArg,\n },\n async run({ args }) {\n const cwd = resolveCwd(args);\n const { config } = await loadConfig(cwd);\n\n if (config.codegen === false) {\n throw new Error(\n \"codegen is disabled for this project, so there are no GIR libraries to document. \" +\n \"Remove `codegen: false` from gtkx.config.ts to use `gtkx docs`.\",\n );\n }\n\n const girPath = resolveGirPath(config.girPath);\n\n if (girPath.length === 0) {\n throw new Error(\n \"No GIR search paths available. Install gobject-introspection \" +\n \"(Linux: `sudo dnf install gobject-introspection-devel` or \" +\n \"`sudo apt install libgirepository1.0-dev`), or set `girPath` in gtkx.config.ts.\",\n );\n }\n\n const libraries = resolveLibraries(config.libraries);\n const startedAt = Date.now();\n const outDir = resolveOutDir(cwd, args.out);\n const builtin = await resolveDocsElements(cwd);\n\n const { isRegenerated, namespaces } = writeDocs({\n libraries,\n girPath,\n outDir,\n basePath: args[\"base-path\"],\n props: builtin.props,\n omittedProps: mergeOmittedProps(builtin.omittedProps, resolveOmittedProps(config.elements)),\n isForced: args.force,\n });\n\n if (!isRegenerated) {\n info(`docs: pages in ${outDir} are up to date`);\n\n return;\n }\n\n const count = namespaces.reduce((total, namespace) => total + namespace.elements.length, 0);\n\n info(\n `docs: wrote ${String(count)} element pages across ${String(namespaces.length)} namespaces ` +\n `to ${outDir} in ${String(Date.now() - startedAt)}ms`,\n );\n },\n});\n\nconst outDirReason = (cwd: string, out: string, outDir: string): string => {\n if (out.trim() === \"\") {\n return \"it was empty, which names the project root itself\";\n }\n\n if (outDir === cwd) {\n return \"it names the project root itself\";\n }\n\n return `${outDir} is outside it`;\n};\n\nconst resolveOutDir = (cwd: string, out: string): string => {\n const outDir = out.trim() === \"\" ? cwd : resolve(cwd, out);\n\n if (isPathInside(cwd, outDir)) {\n return outDir;\n }\n\n throw new Error(\n `--out must name a directory below the project root ${cwd}, and ${outDirReason(cwd, out, outDir)}. ` +\n \"Pass a path such as --out=docs/reference.\",\n );\n};\n\nexport { docs };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copyright.d.ts","sourceRoot":"","sources":["../../../src/deploy/freedesktop/copyright.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"copyright.d.ts","sourceRoot":"","sources":["../../../src/deploy/freedesktop/copyright.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAU,aAAa,EAAE,MAAM,aAAa,CAAC;AAoJzE,QAAA,MAAM,eAAe,GAAI,UAAU,cAAc,EAAE,UAAU,aAAa,EAAE,KAAG,MAa9E,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { readFileSync } from "node:fs";
|
|
2
1
|
import { BUNDLE_FILENAME } from "../../vite-plugins/esm-extension.js";
|
|
2
|
+
import { readLicenseText } from "../notices/text.js";
|
|
3
3
|
const FORMAT_URL = "https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/";
|
|
4
4
|
const CONTINUATION_BLANK = " .";
|
|
5
5
|
const UNKNOWN_COPYRIGHT = "unknown";
|
|
@@ -17,17 +17,6 @@ const foldedField = (name, lines) => {
|
|
|
17
17
|
const [first, ...rest] = lines;
|
|
18
18
|
return first === undefined ? [] : [`${name}: ${first}`, ...rest.map((line) => indentLine(line))];
|
|
19
19
|
};
|
|
20
|
-
const licenseText = (licenseFile) => {
|
|
21
|
-
if (licenseFile === null) {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
try {
|
|
25
|
-
return readFileSync(licenseFile, "utf8").trimEnd();
|
|
26
|
-
}
|
|
27
|
-
catch {
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
20
|
const shortName = (license) => license
|
|
32
21
|
.replaceAll(SPDX_GROUPING, " ")
|
|
33
22
|
.replaceAll(SPDX_OPERATOR, (operator) => operator.toLowerCase())
|
|
@@ -110,7 +99,7 @@ const applicationStanza = (settings, text) => [
|
|
|
110
99
|
"",
|
|
111
100
|
];
|
|
112
101
|
const renderCopyright = (settings, sections) => {
|
|
113
|
-
const own =
|
|
102
|
+
const own = settings.paths.licenseFile === null ? null : readLicenseText(settings.paths.licenseFile);
|
|
114
103
|
const reproduced = new Set(own === null ? [] : [own]);
|
|
115
104
|
const stanzas = filePatterns(sections).flatMap((files) => fileStanza({ settings, files, sections: sectionsFor(sections, files), reproduced }));
|
|
116
105
|
return [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copyright.js","sourceRoot":"","sources":["../../../src/deploy/freedesktop/copyright.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAStE,MAAM,UAAU,GAAG,oEAAoE,CAAC;AACxF,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAChC,MAAM,iBAAiB,GAAG,SAAS,CAAC;AACpC,MAAM,eAAe,GAAG,SAAS,CAAC;AAClC,MAAM,iBAAiB,GAAG,OAAO,CAAC;AAClC,MAAM,aAAa,GAAG,OAAO,CAAC;AAC9B,MAAM,aAAa,GAAG,sBAAsB,CAAC;AAC7C,MAAM,cAAc,GAAG,QAAQ,CAAC;AAChC,MAAM,YAAY,GAAG,YAAY,CAAC;AAClC,MAAM,WAAW,GAAG,GAAG,CAAC;AACxB,MAAM,UAAU,GAAG,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AAQ,CAAC;QAClC,EAAE;QACF,GAAG,iBAAiB,CAAC,QAAQ,EAAE,GAAG,CAAC;QACnC,GAAG,OAAO;KACb,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjB,CAAC,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,CAAC","sourcesContent":["import { readFileSync } from \"node:fs\";\nimport type { DeploySettings, Notice, NoticeSection } from \"../types.js\";\nimport { BUNDLE_FILENAME } from \"../../vite-plugins/esm-extension.js\";\n\ntype FileStanza = {\n settings: DeploySettings;\n files: string;\n sections: NoticeSection[];\n reproduced: Set<string>;\n};\n\nconst FORMAT_URL = \"https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/\";\nconst CONTINUATION_BLANK = \" .\";\nconst UNKNOWN_COPYRIGHT = \"unknown\";\nconst UNKNOWN_LICENSE = \"unknown\";\nconst LICENSE_SEPARATOR = \" and \";\nconst SPDX_GROUPING = /[()]/g;\nconst SPDX_OPERATOR = /\\b(?:AND|OR|WITH)\\b/g;\nconst REPEATED_SPACE = / {2,}/g;\nconst OUTSIDE_NAME = /[^\\w.+-]+/g;\nconst NAME_JOINER = \"-\";\nconst NAME_TOKEN = /^[\\w.+-]+$/;\nconst NAME_CONNECTIVE = / (?:or|with) /;\n\nconst indentLine = (line: string): string => (line.trim().length === 0 ? CONTINUATION_BLANK : ` ${line}`);\n\nconst foldedField = (name: string, lines: string[]): string[] => {\n const [first, ...rest] = lines;\n\n return first === undefined ? [] : [`${name}: ${first}`, ...rest.map((line) => indentLine(line))];\n};\n\nconst licenseText = (licenseFile: string | null): string | null => {\n if (licenseFile === null) {\n return null;\n }\n\n try {\n return readFileSync(licenseFile, \"utf8\").trimEnd();\n } catch {\n return null;\n }\n};\n\nconst shortName = (license: string): string =>\n license\n .replaceAll(SPDX_GROUPING, \" \")\n .replaceAll(SPDX_OPERATOR, (operator) => operator.toLowerCase())\n .replaceAll(REPEATED_SPACE, \" \")\n .trim();\n\nconst isShortName = (part: string): boolean =>\n part.split(NAME_CONNECTIVE).every((token) => NAME_TOKEN.test(token));\n\nconst namePart = (part: string): string =>\n isShortName(part) ? part : part.split(OUTSIDE_NAME).filter((token) => token.length > 0).join(NAME_JOINER);\n\nconst shortNames = (license: string): string[] =>\n shortName(license).split(LICENSE_SEPARATOR).map((part) => namePart(part)).filter((part) => part.length > 0);\n\nconst licenseNames = (notices: Notice[]): string => {\n const names = [...new Set(notices.flatMap((notice) => shortNames(notice.license)))];\n\n return names.length === 0 ? UNKNOWN_LICENSE : names.join(LICENSE_SEPARATOR);\n};\n\nconst compactNotice = (notice: Notice): string => {\n const label = `${notice.subject} (${licenseNames([notice])})`;\n\n return notice.source === null ? label : `${label}: ${notice.source}`;\n};\n\nconst noticeBody = (notice: Notice, reproduced: Set<string>): string[] => {\n const head = [\n \"\",\n `${notice.subject} (${licenseNames([notice])})`,\n ...(notice.source === null ? [] : [`Source: ${notice.source}`]),\n ];\n\n if (notice.text === null || reproduced.has(notice.text)) {\n return head;\n }\n\n reproduced.add(notice.text);\n\n return [...head, \"\", ...notice.text.split(\"\\n\")];\n};\n\nconst copyrightNames = (notices: Notice[]): string[] => {\n const lines = [...new Set(notices.flatMap((notice) => notice.copyright))];\n\n return lines.length === 0 ? [UNKNOWN_COPYRIGHT] : lines;\n};\n\nconst stanzaComment = (sections: NoticeSection[]): string[] =>\n sections.flatMap((section, index) => [...(index === 0 ? [] : [\"\"]), section.title, ...section.summary]);\n\nconst sectionComment = (section: NoticeSection): string[] => [\n section.title,\n \"\",\n ...section.summary,\n \"\",\n ...section.notices.map((notice) => compactNotice(notice)),\n];\n\nconst bundlePath = (settings: DeploySettings): string => `lib/${settings.binaryName}/${BUNDLE_FILENAME}`;\n\nconst applicationNotice = (settings: DeploySettings): Notice => ({\n subject: settings.name,\n license: settings.license,\n source: settings.homepage,\n copyright: [settings.copyright],\n text: null,\n});\n\nconst stanzaNotices = (settings: DeploySettings, files: string, sections: NoticeSection[]): Notice[] => {\n const own = files === bundlePath(settings) ? [applicationNotice(settings)] : [];\n\n return [...own, ...sections.flatMap((section) => section.notices)];\n};\n\nconst fileStanza = ({ settings, files, sections, reproduced }: FileStanza): string[] => {\n const notices = stanzaNotices(settings, files, sections);\n const texts = notices.flatMap((notice) => noticeBody(notice, reproduced));\n\n return [\n `Files: ${files}`,\n ...foldedField(\"Comment\", stanzaComment(sections)),\n ...foldedField(\"Copyright\", copyrightNames(notices)),\n ...foldedField(\"License\", [licenseNames(notices), ...texts]),\n \"\",\n ];\n};\n\nconst filePatterns = (sections: NoticeSection[]): string[] =>\n [...new Set(sections.flatMap((section) => section.files))];\n\nconst sectionsFor = (sections: NoticeSection[], files: string): NoticeSection[] =>\n sections.filter((section) => section.files.includes(files));\n\nconst headerComment = (sections: NoticeSection[]): string[] =>\n sections.filter((section) => section.files.length === 0).flatMap((section) => sectionComment(section));\n\nconst headerLines = (settings: DeploySettings, sections: NoticeSection[]): string[] => [\n `Format: ${FORMAT_URL}`,\n `Upstream-Name: ${settings.name}`,\n ...(settings.homepage === null ? [] : [`Source: ${settings.homepage}`]),\n ...foldedField(\"Comment\", headerComment(sections)),\n];\n\nconst applicationStanza = (settings: DeploySettings, text: string | null): string[] => [\n \"Files: *\",\n `Copyright: ${settings.copyright}`,\n ...foldedField(\"License\", [\n licenseNames([applicationNotice(settings)]),\n ...(text === null ? [] : text.split(\"\\n\")),\n ]),\n \"\",\n];\n\nconst renderCopyright = (settings: DeploySettings, sections: NoticeSection[]): string => {\n const own = licenseText(settings.paths.licenseFile);\n const reproduced: Set<string> = new Set(own === null ? [] : [own]);\n\n const stanzas = filePatterns(sections).flatMap((files) =>\n fileStanza({ settings, files, sections: sectionsFor(sections, files), reproduced }));\n\n return [\n ...headerLines(settings, sections),\n \"\",\n ...applicationStanza(settings, own),\n ...stanzas,\n ].join(\"\\n\");\n};\n\nexport { renderCopyright };\n"]}
|
|
1
|
+
{"version":3,"file":"copyright.js","sourceRoot":"","sources":["../../../src/deploy/freedesktop/copyright.ts"],"names":[],"mappings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AC,CAAC;IAEnE,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CACrD,UAAU,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;IAEzF,OAAO;QACH,GAAG,WAAW,CAAC,QAAQ,EAAE,QAAQ,CAAC;QAClC,EAAE;QACF,GAAG,iBAAiB,CAAC,QAAQ,EAAE,GAAG,CAAC;QACnC,GAAG,OAAO;KACb,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjB,CAAC,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,CAAC","sourcesContent":["import type { DeploySettings, Notice, NoticeSection } from \"../types.js\";\nimport { BUNDLE_FILENAME } from \"../../vite-plugins/esm-extension.js\";\nimport { readLicenseText } from \"../notices/text.js\";\n\ntype FileStanza = {\n settings: DeploySettings;\n files: string;\n sections: NoticeSection[];\n reproduced: Set<string>;\n};\n\nconst FORMAT_URL = \"https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/\";\nconst CONTINUATION_BLANK = \" .\";\nconst UNKNOWN_COPYRIGHT = \"unknown\";\nconst UNKNOWN_LICENSE = \"unknown\";\nconst LICENSE_SEPARATOR = \" and \";\nconst SPDX_GROUPING = /[()]/g;\nconst SPDX_OPERATOR = /\\b(?:AND|OR|WITH)\\b/g;\nconst REPEATED_SPACE = / {2,}/g;\nconst OUTSIDE_NAME = /[^\\w.+-]+/g;\nconst NAME_JOINER = \"-\";\nconst NAME_TOKEN = /^[\\w.+-]+$/;\nconst NAME_CONNECTIVE = / (?:or|with) /;\n\nconst indentLine = (line: string): string => (line.trim().length === 0 ? CONTINUATION_BLANK : ` ${line}`);\n\nconst foldedField = (name: string, lines: string[]): string[] => {\n const [first, ...rest] = lines;\n\n return first === undefined ? [] : [`${name}: ${first}`, ...rest.map((line) => indentLine(line))];\n};\n\nconst shortName = (license: string): string =>\n license\n .replaceAll(SPDX_GROUPING, \" \")\n .replaceAll(SPDX_OPERATOR, (operator) => operator.toLowerCase())\n .replaceAll(REPEATED_SPACE, \" \")\n .trim();\n\nconst isShortName = (part: string): boolean =>\n part.split(NAME_CONNECTIVE).every((token) => NAME_TOKEN.test(token));\n\nconst namePart = (part: string): string =>\n isShortName(part) ? part : part.split(OUTSIDE_NAME).filter((token) => token.length > 0).join(NAME_JOINER);\n\nconst shortNames = (license: string): string[] =>\n shortName(license).split(LICENSE_SEPARATOR).map((part) => namePart(part)).filter((part) => part.length > 0);\n\nconst licenseNames = (notices: Notice[]): string => {\n const names = [...new Set(notices.flatMap((notice) => shortNames(notice.license)))];\n\n return names.length === 0 ? UNKNOWN_LICENSE : names.join(LICENSE_SEPARATOR);\n};\n\nconst compactNotice = (notice: Notice): string => {\n const label = `${notice.subject} (${licenseNames([notice])})`;\n\n return notice.source === null ? label : `${label}: ${notice.source}`;\n};\n\nconst noticeBody = (notice: Notice, reproduced: Set<string>): string[] => {\n const head = [\n \"\",\n `${notice.subject} (${licenseNames([notice])})`,\n ...(notice.source === null ? [] : [`Source: ${notice.source}`]),\n ];\n\n if (notice.text === null || reproduced.has(notice.text)) {\n return head;\n }\n\n reproduced.add(notice.text);\n\n return [...head, \"\", ...notice.text.split(\"\\n\")];\n};\n\nconst copyrightNames = (notices: Notice[]): string[] => {\n const lines = [...new Set(notices.flatMap((notice) => notice.copyright))];\n\n return lines.length === 0 ? [UNKNOWN_COPYRIGHT] : lines;\n};\n\nconst stanzaComment = (sections: NoticeSection[]): string[] =>\n sections.flatMap((section, index) => [...(index === 0 ? [] : [\"\"]), section.title, ...section.summary]);\n\nconst sectionComment = (section: NoticeSection): string[] => [\n section.title,\n \"\",\n ...section.summary,\n \"\",\n ...section.notices.map((notice) => compactNotice(notice)),\n];\n\nconst bundlePath = (settings: DeploySettings): string => `lib/${settings.binaryName}/${BUNDLE_FILENAME}`;\n\nconst applicationNotice = (settings: DeploySettings): Notice => ({\n subject: settings.name,\n license: settings.license,\n source: settings.homepage,\n copyright: [settings.copyright],\n text: null,\n});\n\nconst stanzaNotices = (settings: DeploySettings, files: string, sections: NoticeSection[]): Notice[] => {\n const own = files === bundlePath(settings) ? [applicationNotice(settings)] : [];\n\n return [...own, ...sections.flatMap((section) => section.notices)];\n};\n\nconst fileStanza = ({ settings, files, sections, reproduced }: FileStanza): string[] => {\n const notices = stanzaNotices(settings, files, sections);\n const texts = notices.flatMap((notice) => noticeBody(notice, reproduced));\n\n return [\n `Files: ${files}`,\n ...foldedField(\"Comment\", stanzaComment(sections)),\n ...foldedField(\"Copyright\", copyrightNames(notices)),\n ...foldedField(\"License\", [licenseNames(notices), ...texts]),\n \"\",\n ];\n};\n\nconst filePatterns = (sections: NoticeSection[]): string[] =>\n [...new Set(sections.flatMap((section) => section.files))];\n\nconst sectionsFor = (sections: NoticeSection[], files: string): NoticeSection[] =>\n sections.filter((section) => section.files.includes(files));\n\nconst headerComment = (sections: NoticeSection[]): string[] =>\n sections.filter((section) => section.files.length === 0).flatMap((section) => sectionComment(section));\n\nconst headerLines = (settings: DeploySettings, sections: NoticeSection[]): string[] => [\n `Format: ${FORMAT_URL}`,\n `Upstream-Name: ${settings.name}`,\n ...(settings.homepage === null ? [] : [`Source: ${settings.homepage}`]),\n ...foldedField(\"Comment\", headerComment(sections)),\n];\n\nconst applicationStanza = (settings: DeploySettings, text: string | null): string[] => [\n \"Files: *\",\n `Copyright: ${settings.copyright}`,\n ...foldedField(\"License\", [\n licenseNames([applicationNotice(settings)]),\n ...(text === null ? [] : text.split(\"\\n\")),\n ]),\n \"\",\n];\n\nconst renderCopyright = (settings: DeploySettings, sections: NoticeSection[]): string => {\n const own = settings.paths.licenseFile === null ? null : readLicenseText(settings.paths.licenseFile);\n const reproduced: Set<string> = new Set(own === null ? [] : [own]);\n\n const stanzas = filePatterns(sections).flatMap((files) =>\n fileStanza({ settings, files, sections: sectionsFor(sections, files), reproduced }));\n\n return [\n ...headerLines(settings, sections),\n \"\",\n ...applicationStanza(settings, own),\n ...stanzas,\n ].join(\"\\n\");\n};\n\nexport { renderCopyright };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xml.d.ts","sourceRoot":"","sources":["../../../src/deploy/freedesktop/xml.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"xml.d.ts","sourceRoot":"","sources":["../../../src/deploy/freedesktop/xml.ts"],"names":[],"mappings":"AAEA,KAAK,OAAO,GAAG;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAuBF,QAAA,MAAM,OAAO,GAAI,KAAK,MAAM,EAAE,YAAY,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,UAAU,OAAO,EAAE,KAAG,OAItF,CAAC;AAEH,QAAA,MAAM,IAAI,GAAI,KAAK,MAAM,EAAE,OAAO,MAAM,KAAG,OAAiC,CAAC;AAE7E,QAAA,MAAM,cAAc,GAAI,MAAM,OAAO,KAAG,MAI9B,CAAC;AAEX,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,KAAK,OAAO,EAAE,CAAC"}
|
|
@@ -1,33 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
.
|
|
12
|
-
|
|
1
|
+
import XMLBuilder from "fast-xml-builder";
|
|
2
|
+
const XML_ENCODING = ["UTF", "8"].join("-");
|
|
3
|
+
const builder = new XMLBuilder({
|
|
4
|
+
format: true,
|
|
5
|
+
ignoreAttributes: false,
|
|
6
|
+
indentBy: " ".repeat(4),
|
|
7
|
+
preserveOrder: true,
|
|
8
|
+
suppressEmptyNode: true,
|
|
9
|
+
});
|
|
10
|
+
const orderedNode = (node) => ({
|
|
11
|
+
[node.tag]: node.text === undefined
|
|
12
|
+
? (node.children ?? []).map((child) => orderedNode(child))
|
|
13
|
+
: [{ "#text": node.text }],
|
|
14
|
+
...(node.attributes && {
|
|
15
|
+
":@": Object.fromEntries(Object.entries(node.attributes).map(([key, value]) => [`@_${key}`, value])),
|
|
16
|
+
}),
|
|
17
|
+
});
|
|
13
18
|
const element = (tag, attributes, children) => ({
|
|
14
19
|
tag,
|
|
15
20
|
attributes,
|
|
16
21
|
children,
|
|
17
22
|
});
|
|
18
23
|
const text = (tag, value) => ({ tag, text: value });
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return [`${open}>${escapeXml(node.text)}</${node.tag}>`];
|
|
24
|
-
}
|
|
25
|
-
const children = node.children ?? [];
|
|
26
|
-
if (children.length === 0) {
|
|
27
|
-
return [`${open}/>`];
|
|
28
|
-
}
|
|
29
|
-
return [`${open}>`, ...children.flatMap((child) => renderNode(child, depth + 1)), `${padding}</${node.tag}>`];
|
|
30
|
-
};
|
|
31
|
-
const renderDocument = (root) => [XML_DECLARATION, ...renderNode(root, 0), ""].join("\n");
|
|
24
|
+
const renderDocument = (root) => `${builder.build([
|
|
25
|
+
{ "?xml": [{ "#text": "" }], ":@": { "@_version": "1.0", "@_encoding": XML_ENCODING } },
|
|
26
|
+
orderedNode(root),
|
|
27
|
+
])}\n`;
|
|
32
28
|
export { element, renderDocument, text };
|
|
33
29
|
//# sourceMappingURL=xml.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xml.js","sourceRoot":"","sources":["../../../src/deploy/freedesktop/xml.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"xml.js","sourceRoot":"","sources":["../../../src/deploy/freedesktop/xml.ts"],"names":[],"mappings":"AAAA,OA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AC,CAAC;AAE7E,MAAM,cAAc,GAAG,CAAC,IAAa,EAAU,EAAE,CAC7C,GAAG,OAAO,CAAC,KAAK,CAAC;IACb,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,EAAE;IACvF,WAAW,CAAC,IAAI,CAAC;CACpB,CAAC,IAAI,CAAC;AAEX,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,IAAI,EAAgB,CAAC","sourcesContent":["import XMLBuilder from \"fast-xml-builder\";\n\ntype XmlNode = {\n tag: string;\n attributes?: Record<string, string>;\n children?: XmlNode[];\n text?: string;\n};\n\ntype OrderedNode = Record<string, unknown>;\n\nconst XML_ENCODING = [\"UTF\", \"8\"].join(\"-\");\n\nconst builder = new XMLBuilder({\n format: true,\n ignoreAttributes: false,\n indentBy: \" \".repeat(4),\n preserveOrder: true,\n suppressEmptyNode: true,\n});\n\nconst orderedNode = (node: XmlNode): OrderedNode => ({\n [node.tag]: node.text === undefined\n ? (node.children ?? []).map((child) => orderedNode(child))\n : [{ \"#text\": node.text }],\n ...(node.attributes && {\n \":@\": Object.fromEntries(Object.entries(node.attributes).map(([key, value]) => [`@_${key}`, value])),\n }),\n});\n\nconst element = (tag: string, attributes: Record<string, string>, children: XmlNode[]): XmlNode => ({\n tag,\n attributes,\n children,\n});\n\nconst text = (tag: string, value: string): XmlNode => ({ tag, text: value });\n\nconst renderDocument = (root: XmlNode): string =>\n `${builder.build([\n { \"?xml\": [{ \"#text\": \"\" }], \":@\": { \"@_version\": \"1.0\", \"@_encoding\": XML_ENCODING } },\n orderedNode(root),\n ])}\\n`;\n\nexport { element, renderDocument, text, type XmlNode };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"license.d.ts","sourceRoot":"","sources":["../../../src/deploy/node-runtime/license.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,gBAAgB,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"license.d.ts","sourceRoot":"","sources":["../../../src/deploy/node-runtime/license.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,gBAAgB,YAAY,CAAC;AAWnC,QAAA,MAAM,iBAAiB,GAAI,QAAQ,MAAM,KAAG,MAAM,GAAG,IAC8B,CAAC;AAEpF,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -1,19 +1,12 @@
|
|
|
1
|
-
import { readFileSync } from "node:fs";
|
|
2
1
|
import { dirname, join } from "node:path";
|
|
2
|
+
import { readLicenseText } from "../notices/text.js";
|
|
3
3
|
const LICENSE_FILENAME = "LICENSE";
|
|
4
4
|
const NODE_MARKER = "Node.js";
|
|
5
5
|
const licenseCandidates = (binary) => {
|
|
6
6
|
const dir = dirname(binary);
|
|
7
7
|
return [join(dir, LICENSE_FILENAME), join(dir, "..", LICENSE_FILENAME)];
|
|
8
8
|
};
|
|
9
|
-
const isNodeLicense = (path) =>
|
|
10
|
-
try {
|
|
11
|
-
return readFileSync(path, "utf8").includes(NODE_MARKER);
|
|
12
|
-
}
|
|
13
|
-
catch {
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
};
|
|
9
|
+
const isNodeLicense = (path) => readLicenseText(path)?.includes(NODE_MARKER) === true;
|
|
17
10
|
const licenseBesideNode = (binary) => licenseCandidates(binary).find((candidate) => isNodeLicense(candidate)) ?? null;
|
|
18
11
|
export { LICENSE_FILENAME, licenseBesideNode };
|
|
19
12
|
//# sourceMappingURL=license.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"license.js","sourceRoot":"","sources":["../../../src/deploy/node-runtime/license.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"license.js","sourceRoot":"","sources":["../../../src/deploy/node-runtime/license.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,gBAAgB,GAAG,SAAS,CAAC;AACnC,MAAM,WAAW,GAAG,SAAS,CAAC;AAE9B,MAAM,iBAAiB,GAAG,CAAC,MAAc,EAAY,EAAE;IACnD,MAAM,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE5B,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,gBAAgB,CAAC,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAC5E,CAAC,CAAC;AAEF,MAAM,aAAa,GAAG,CAAC,IAAY,EAAW,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;AAEvG,MAAM,iBAAiB,GAAG,CAAC,MAAc,EAAiB,EAAE,CACxD,iBAAiB,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,IAAI,IAAI,CAAC;AAEpF,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,CAAC","sourcesContent":["import { dirname, join } from \"node:path\";\nimport { readLicenseText } from \"../notices/text.js\";\n\nconst LICENSE_FILENAME = \"LICENSE\";\nconst NODE_MARKER = \"Node.js\";\n\nconst licenseCandidates = (binary: string): string[] => {\n const dir = dirname(binary);\n\n return [join(dir, LICENSE_FILENAME), join(dir, \"..\", LICENSE_FILENAME)];\n};\n\nconst isNodeLicense = (path: string): boolean => readLicenseText(path)?.includes(NODE_MARKER) === true;\n\nconst licenseBesideNode = (binary: string): string | null =>\n licenseCandidates(binary).find((candidate) => isNodeLicense(candidate)) ?? null;\n\nexport { LICENSE_FILENAME, licenseBesideNode };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packages.d.ts","sourceRoot":"","sources":["../../../src/deploy/notices/packages.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"packages.d.ts","sourceRoot":"","sources":["../../../src/deploy/notices/packages.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAIlD,KAAK,cAAc,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;CACtB,CAAC;AA0FF,QAAA,MAAM,eAAe,GAAI,UAAU,cAAc,EAAE,UAAU,eAAe,EAAE,KAAG,cAAc,EAY9F,CAAC;AAEF,OAAO,EAAE,KAAK,cAAc,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { sortStringsBy, warn } from "@gtkx/utils";
|
|
2
|
+
import hostedGitInfo from "hosted-git-info";
|
|
2
3
|
import { existsSync, realpathSync } from "node:fs";
|
|
3
4
|
import { join, resolve } from "node:path";
|
|
4
5
|
import { readPackageManifest } from "../settings/package-manifest.js";
|
|
5
6
|
import { copyrightLines, licenseTextIn } from "./text.js";
|
|
6
7
|
const MANIFEST_FILENAME = "package.json";
|
|
7
|
-
const GIT_PREFIX = /^git\+/;
|
|
8
|
-
const GIT_SUFFIX = /\.git$/;
|
|
9
|
-
const GIT_SCHEME = /^git:\/\//;
|
|
10
|
-
const GITHUB_SLUG = /^(?:github:)?(?<slug>[\w.-]+\/[\w.-]+)$/;
|
|
11
8
|
const realPath = (path) => {
|
|
12
9
|
try {
|
|
13
10
|
return realpathSync(path);
|
|
@@ -28,12 +25,8 @@ const sourceUrl = (manifest) => {
|
|
|
28
25
|
if (configured === null) {
|
|
29
26
|
return null;
|
|
30
27
|
}
|
|
31
|
-
const url = configured.replace(
|
|
32
|
-
|
|
33
|
-
if (slug !== undefined) {
|
|
34
|
-
return `https://github.com/${slug}`;
|
|
35
|
-
}
|
|
36
|
-
return url.startsWith("http") ? url : null;
|
|
28
|
+
const url = configured.replace(/^git\+/, "").replace(/\.git$/, "").replace(/^git:\/\//, "https://");
|
|
29
|
+
return hostedGitInfo.fromUrl(url)?.browse() ?? (url.startsWith("http") ? url : null);
|
|
37
30
|
};
|
|
38
31
|
const missingPackage = (entry) => ({
|
|
39
32
|
name: entry.name,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packages.js","sourceRoot":"","sources":["../../../src/deploy/notices/packages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAG1C,OAAO,EAAwB,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC5F,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAY1D,MAAM,iBAAiB,GAAG,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"packages.js","sourceRoot":"","sources":["../../../src/deploy/notices/packages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAG1C,OAAO,EAAwB,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC5F,O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AC,CAAC,CAAC;IAEpD,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IAChC,WAAW,CAAC,OAAO,CAAC,CAAC;IAErB,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC;AAEF,OAAO,EAAuB,eAAe,EAAE,CAAC","sourcesContent":["import { sortStringsBy, warn } from \"@gtkx/utils\";\nimport hostedGitInfo from \"hosted-git-info\";\nimport { existsSync, realpathSync } from \"node:fs\";\nimport { join, resolve } from \"node:path\";\nimport type { RecordedPackage } from \"../../internal/build-manifest.js\";\nimport type { DeploySettings } from \"../types.js\";\nimport { type PackageManifest, readPackageManifest } from \"../settings/package-manifest.js\";\nimport { copyrightLines, licenseTextIn } from \"./text.js\";\n\ntype BundledPackage = {\n name: string;\n version: string | null;\n license: string | null;\n source: string | null;\n copyright: string[];\n text: string | null;\n isPresent: boolean;\n};\n\nconst MANIFEST_FILENAME = \"package.json\";\n\nconst realPath = (path: string): string => {\n try {\n return realpathSync(path);\n } catch {\n return path;\n }\n};\n\nconst authorLine = (manifest: PackageManifest): string[] => {\n const { name, email } = manifest.author;\n\n if (name === null) {\n return [];\n }\n\n return [email === null ? name : `${name} <${email}>`];\n};\n\nconst sourceUrl = (manifest: PackageManifest): string | null => {\n const configured = manifest.repository ?? manifest.homepage;\n\n if (configured === null) {\n return null;\n }\n\n const url = configured.replace(/^git\\+/, \"\").replace(/\\.git$/, \"\").replace(/^git:\\/\\//, \"https://\");\n\n return hostedGitInfo.fromUrl(url)?.browse() ?? (url.startsWith(\"http\") ? url : null);\n};\n\nconst missingPackage = (entry: RecordedPackage): BundledPackage => ({\n name: entry.name,\n version: entry.version,\n license: null,\n source: null,\n copyright: [],\n text: null,\n isPresent: false,\n});\n\nconst packageIn = (entry: RecordedPackage, dir: string): BundledPackage => {\n if (!existsSync(join(dir, MANIFEST_FILENAME))) {\n return missingPackage(entry);\n }\n\n const manifest = readPackageManifest(dir);\n const text = licenseTextIn(dir);\n const copyright = copyrightLines(text);\n\n return {\n name: manifest.name ?? entry.name,\n version: manifest.version ?? entry.version,\n license: manifest.license,\n source: sourceUrl(manifest),\n copyright: copyright.length === 0 ? authorLine(manifest) : copyright,\n text,\n isPresent: true,\n };\n};\n\nconst keyFor = (entry: BundledPackage): string => `${entry.name}@${entry.version ?? \"\"}`;\n\nconst dedupe = (entries: BundledPackage[]): BundledPackage[] => {\n const unique: Map<string, BundledPackage> = new Map();\n\n for (const entry of entries) {\n unique.set(keyFor(entry), entry);\n }\n\n return sortStringsBy(unique.values(), keyFor);\n};\n\nconst warnMissing = (entries: BundledPackage[]): void => {\n const missing = entries.filter((entry) => !entry.isPresent);\n\n if (missing.length === 0) {\n return;\n }\n\n warn(\n `The third-party notices name ${missing.map((entry) => keyFor(entry)).join(\", \")} without any license: ` +\n \"`gtkx build` recorded where each package was installed and those directories are no longer there. \" +\n \"Deploy from the tree the build ran in, or build again, so the notices carry their terms.\",\n );\n};\n\nconst bundledPackages = (settings: DeploySettings, recorded: RecordedPackage[]): BundledPackage[] => {\n const root = realPath(settings.paths.root);\n\n const entries = recorded\n .map((entry) => ({ entry, dir: resolve(settings.paths.dist, entry.dir) }))\n .filter(({ dir }) => realPath(dir) !== root)\n .map(({ entry, dir }) => packageIn(entry, dir));\n\n const bundled = dedupe(entries);\n warnMissing(bundled);\n\n return bundled;\n};\n\nexport { type BundledPackage, bundledPackages };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copy-tree.d.ts","sourceRoot":"","sources":["../../../src/deploy/payload/copy-tree.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"copy-tree.d.ts","sourceRoot":"","sources":["../../../src/deploy/payload/copy-tree.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C,QAAA,MAAM,eAAe,MAAQ,CAAC;AA4B9B,QAAA,MAAM,QAAQ,GAAI,MAAM,MAAM,EAAE,KAAK,MAAM,EAAE,QAAQ,MAAM,EAAE,aAAmB,KAAG,UAG7E,CAAC;AAEP,QAAA,MAAM,SAAS,GAAI,MAAM,MAAM,EAAE,KAAK,MAAM,EAAE,UAAU,MAAM,EAAE,aAAoB,KAAG,UAGjF,CAAC;AAIP,QAAA,MAAM,iBAAiB,GAAI,MAAM,MAAM,KAAG,MACmC,CAAC;AAE9E,QAAA,MAAM,QAAQ,GAAI,MAAM,MAAM,EAAE,SAAS,MAAM,EAAE,WAAW,MAAM,KAAG,UAAU,EAEwB,CAAC;AAExG,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,eAAe,EAAE,iBAAiB,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { isPathInside } from "@gtkx/utils";
|
|
1
2
|
import { chmodSync, copyFileSync, mkdirSync, statSync, writeFileSync } from "node:fs";
|
|
2
|
-
import { dirname,
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
3
4
|
import { listFilesRecursive } from "../../internal/list-files.js";
|
|
4
5
|
const EXECUTABLE_MODE = 0o755;
|
|
5
6
|
const READABLE_MODE = 0o644;
|
|
@@ -11,8 +12,7 @@ const modeFor = (rel) => {
|
|
|
11
12
|
return EXECUTABLE_SUFFIXES.some((suffix) => name.endsWith(suffix)) ? EXECUTABLE_MODE : READABLE_MODE;
|
|
12
13
|
};
|
|
13
14
|
const assertInsideRoot = (root, rel, abs) => {
|
|
14
|
-
|
|
15
|
-
if (escape.length === 0 || escape.startsWith("..") || isAbsolute(escape)) {
|
|
15
|
+
if (!isPathInside(root, abs)) {
|
|
16
16
|
throw new Error(`Cannot stage "${rel}": it resolves outside the staging directory`);
|
|
17
17
|
}
|
|
18
18
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copy-tree.js","sourceRoot":"","sources":["../../../src/deploy/payload/copy-tree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,QAAQ,EA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AC,eAAe,CAAC;AAE9E,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,OAAe,EAAE,SAAiB,EAAgB,EAAE,CAChF,kBAAkB,CAAC,SAAS,CAAC;KACxB,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAExG,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,eAAe,EAAE,iBAAiB,EAAE,SAAS,EAAE,CAAC","sourcesContent":["import { isPathInside } from \"@gtkx/utils\";\nimport { chmodSync, copyFileSync, mkdirSync, statSync, writeFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport type { StagedFile } from \"../types.js\";\nimport { listFilesRecursive } from \"../../internal/list-files.js\";\n\nconst EXECUTABLE_MODE = 0o755;\nconst READABLE_MODE = 0o644;\nconst EXECUTABLE_SUFFIXES = [\".node\", \".so\"];\nconst MODE_MASK = 0o7777;\nconst EXECUTE_MASK = 0o111;\n\nconst modeFor = (rel: string): number => {\n const name = rel.split(\"/\").at(-1) ?? rel;\n\n return EXECUTABLE_SUFFIXES.some((suffix) => name.endsWith(suffix)) ? EXECUTABLE_MODE : READABLE_MODE;\n};\n\nconst assertInsideRoot = (root: string, rel: string, abs: string): void => {\n if (!isPathInside(root, abs)) {\n throw new Error(`Cannot stage \"${rel}\": it resolves outside the staging directory`);\n }\n};\n\nconst placeFile = (root: string, rel: string, mode: number, write: (target: string) => void): StagedFile => {\n const abs = join(root, rel);\n assertInsideRoot(root, rel, abs);\n mkdirSync(dirname(abs), { recursive: true });\n write(abs);\n chmodSync(abs, mode);\n\n return { rel, abs, mode };\n};\n\nconst copyInto = (root: string, rel: string, source: string, mode = modeFor(rel)): StagedFile =>\n placeFile(root, rel, mode, (target) => {\n copyFileSync(source, target);\n });\n\nconst writeInto = (root: string, rel: string, contents: string, mode = READABLE_MODE): StagedFile =>\n placeFile(root, rel, mode, (target) => {\n writeFileSync(target, contents);\n });\n\nconst sourceMode = (path: string): number => statSync(path).mode & MODE_MASK;\n\nconst executableModeFor = (path: string): number =>\n (sourceMode(path) & EXECUTE_MASK) === 0 ? READABLE_MODE : EXECUTABLE_MODE;\n\nconst copyTree = (root: string, relBase: string, sourceDir: string): StagedFile[] =>\n listFilesRecursive(sourceDir)\n .map((file) => copyInto(root, join(relBase, file.rel), file.absPath, sourceMode(file.absPath)));\n\nexport { copyInto, copyTree, EXECUTABLE_MODE, executableModeFor, writeInto };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stage.d.ts","sourceRoot":"","sources":["../../../src/deploy/payload/stage.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAa5G,KAAK,YAAY,GAAG;IAChB,QAAQ,EAAE,cAAc,CAAC;IACzB,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,cAAc,CAAC;CAC5B,CAAC;AAEF,KAAK,cAAc,GAAG;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,CAAC;
|
|
1
|
+
{"version":3,"file":"stage.d.ts","sourceRoot":"","sources":["../../../src/deploy/payload/stage.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAa5G,KAAK,YAAY,GAAG;IAChB,QAAQ,EAAE,cAAc,CAAC;IACzB,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,cAAc,CAAC;CAC5B,CAAC;AAEF,KAAK,cAAc,GAAG;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,CAAC;AAGF,QAAA,MAAM,gBAAgB,wBAAwB,CAAC;AAmB/C,QAAA,MAAM,kBAAkB,GAAI,UAAU,cAAc,KAAG,MAA8C,CAAC;AACtG,QAAA,MAAM,kBAAkB,GAAI,UAAU,cAAc,KAAG,MAA0D,CAAC;AAIlH,QAAA,MAAM,sBAAsB,GAAI,UAAU,cAAc,KAAG,MACe,CAAC;AA+C3E,QAAA,MAAM,YAAY,GAAI,8BAA8B,YAAY,KAAG,UAAU,EAc5E,CAAC;AA0DF,QAAA,MAAM,aAAa,GACf,UAAU,cAAc,EACxB,SAAS,aAAa,EAAE,EACxB,UAAU,cAAc,KACzB,MAAM,CAAC,gBAAgB,EAAE,UAAU,EAAE,CAKtC,CAAC;AAEH,OAAO,EACH,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,cAAc,EACnB,aAAa,EACb,YAAY,GACf,CAAC"}
|
|
@@ -13,7 +13,6 @@ import { stageIcons } from "./icons.js";
|
|
|
13
13
|
import { NODE_FILENAME, renderLauncher } from "./launcher.js";
|
|
14
14
|
import { stageSchemas } from "./schemas.js";
|
|
15
15
|
const DIST_ICONS_DIR = "icons";
|
|
16
|
-
const LEGACY_PACKAGES_MANIFEST_FILENAME = "gtkx-packages.json";
|
|
17
16
|
const NOTICES_FILENAME = "THIRD-PARTY-NOTICES";
|
|
18
17
|
const NODE_LICENSE_FILENAME = "LICENSE";
|
|
19
18
|
const SHARE_APPLICATIONS = "share/applications";
|
|
@@ -34,7 +33,6 @@ const licenseDirFor = (settings) => `${SHARE_LICENSES}/${settings.binaryName}`;
|
|
|
34
33
|
const licenseDestination = (settings) => `${licenseDirFor(settings)}/LICENSE`;
|
|
35
34
|
const noticesDestination = (settings) => `${licenseDirFor(settings)}/${NOTICES_FILENAME}`;
|
|
36
35
|
const isIconAsset = (rel) => rel === DIST_ICONS_DIR || rel.startsWith(`${DIST_ICONS_DIR}/`);
|
|
37
|
-
const isBuildMetadata = (rel) => rel === BUILD_MANIFEST_FILENAME || rel === LEGACY_PACKAGES_MANIFEST_FILENAME;
|
|
38
36
|
const isLocaleAsset = (rel) => rel === LOCALE_DIRNAME || rel.startsWith(`${LOCALE_DIRNAME}/`);
|
|
39
37
|
const nodeLicenseDestination = (settings) => `${licenseDirFor(settings)}/${NODE_FILENAME}/${NODE_LICENSE_FILENAME}`;
|
|
40
38
|
const stageRuntimeFiles = (settings, root) => {
|
|
@@ -43,7 +41,7 @@ const stageRuntimeFiles = (settings, root) => {
|
|
|
43
41
|
throw new Error(`Cannot deploy: ${join(dist, BUNDLE_FILENAME)} is missing. Run \`gtkx build\` first.`);
|
|
44
42
|
}
|
|
45
43
|
return listFilesRecursive(dist)
|
|
46
|
-
.filter((file) => !isIconAsset(file.rel) &&
|
|
44
|
+
.filter((file) => !isIconAsset(file.rel) && file.rel !== BUILD_MANIFEST_FILENAME && !isLocaleAsset(file.rel))
|
|
47
45
|
.map((file) => copyInto(root, join(libDirFor(settings), file.rel), file.absPath));
|
|
48
46
|
};
|
|
49
47
|
const stageCatalogs = (settings, root) => listFilesRecursive(join(settings.paths.dist, LOCALE_DIRNAME))
|