@gtkx/cli 1.2.0 → 1.2.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/dist/builder.d.ts.map +1 -1
- package/dist/builder.js +2 -0
- package/dist/builder.js.map +1 -1
- package/dist/deploy/freedesktop/copyright.d.ts +2 -2
- package/dist/deploy/freedesktop/copyright.d.ts.map +1 -1
- package/dist/deploy/freedesktop/copyright.js +105 -14
- package/dist/deploy/freedesktop/copyright.js.map +1 -1
- package/dist/deploy/node-runtime/download.d.ts +5 -1
- package/dist/deploy/node-runtime/download.d.ts.map +1 -1
- package/dist/deploy/node-runtime/download.js +6 -3
- package/dist/deploy/node-runtime/download.js.map +1 -1
- package/dist/deploy/node-runtime/index.d.ts +2 -1
- package/dist/deploy/node-runtime/index.d.ts.map +1 -1
- package/dist/deploy/node-runtime/index.js +10 -9
- package/dist/deploy/node-runtime/index.js.map +1 -1
- package/dist/deploy/node-runtime/license.d.ts +4 -0
- package/dist/deploy/node-runtime/license.d.ts.map +1 -0
- package/dist/deploy/node-runtime/license.js +19 -0
- package/dist/deploy/node-runtime/license.js.map +1 -0
- package/dist/deploy/notices/collect.d.ts +8 -0
- package/dist/deploy/notices/collect.d.ts.map +1 -0
- package/dist/deploy/notices/collect.js +17 -0
- package/dist/deploy/notices/collect.js.map +1 -0
- package/dist/deploy/notices/dependencies.d.ts +5 -0
- package/dist/deploy/notices/dependencies.d.ts.map +1 -0
- package/dist/deploy/notices/dependencies.js +39 -0
- package/dist/deploy/notices/dependencies.js.map +1 -0
- package/dist/deploy/notices/gtkx.d.ts +6 -0
- package/dist/deploy/notices/gtkx.d.ts.map +1 -0
- package/dist/deploy/notices/gtkx.js +68 -0
- package/dist/deploy/notices/gtkx.js.map +1 -0
- package/dist/deploy/notices/libraries.d.ts +4 -0
- package/dist/deploy/notices/libraries.d.ts.map +1 -0
- package/dist/deploy/notices/libraries.js +60 -0
- package/dist/deploy/notices/libraries.js.map +1 -0
- package/dist/deploy/notices/node-runtime.d.ts +4 -0
- package/dist/deploy/notices/node-runtime.d.ts.map +1 -0
- package/dist/deploy/notices/node-runtime.js +78 -0
- package/dist/deploy/notices/node-runtime.js.map +1 -0
- package/dist/deploy/notices/packages.d.ts +13 -0
- package/dist/deploy/notices/packages.d.ts.map +1 -0
- package/dist/deploy/notices/packages.js +115 -0
- package/dist/deploy/notices/packages.js.map +1 -0
- package/dist/deploy/notices/render.d.ts +4 -0
- package/dist/deploy/notices/render.d.ts.map +1 -0
- package/dist/deploy/notices/render.js +41 -0
- package/dist/deploy/notices/render.js.map +1 -0
- package/dist/deploy/notices/text.d.ts +5 -0
- package/dist/deploy/notices/text.d.ts.map +1 -0
- package/dist/deploy/notices/text.js +34 -0
- package/dist/deploy/notices/text.js.map +1 -0
- package/dist/deploy/payload/copy-tree.d.ts +2 -1
- package/dist/deploy/payload/copy-tree.d.ts.map +1 -1
- package/dist/deploy/payload/copy-tree.js +3 -1
- package/dist/deploy/payload/copy-tree.js.map +1 -1
- package/dist/deploy/payload/stage.d.ts +7 -3
- package/dist/deploy/payload/stage.d.ts.map +1 -1
- package/dist/deploy/payload/stage.js +25 -14
- package/dist/deploy/payload/stage.js.map +1 -1
- package/dist/deploy/run-deploy.d.ts.map +1 -1
- package/dist/deploy/run-deploy.js +22 -5
- package/dist/deploy/run-deploy.js.map +1 -1
- package/dist/deploy/settings/extra-files.d.ts +4 -0
- package/dist/deploy/settings/extra-files.d.ts.map +1 -0
- package/dist/deploy/settings/extra-files.js +11 -0
- package/dist/deploy/settings/extra-files.js.map +1 -0
- package/dist/deploy/settings/index.d.ts.map +1 -1
- package/dist/deploy/settings/index.js +2 -1
- package/dist/deploy/settings/index.js.map +1 -1
- package/dist/deploy/settings/package-manifest.d.ts +1 -0
- package/dist/deploy/settings/package-manifest.d.ts.map +1 -1
- package/dist/deploy/settings/package-manifest.js +7 -0
- package/dist/deploy/settings/package-manifest.js.map +1 -1
- package/dist/deploy/settings/paths.d.ts +2 -1
- package/dist/deploy/settings/paths.d.ts.map +1 -1
- package/dist/deploy/settings/paths.js +1 -1
- package/dist/deploy/settings/paths.js.map +1 -1
- package/dist/deploy/targets/flatpak-manifest.d.ts +3 -1
- package/dist/deploy/targets/flatpak-manifest.d.ts.map +1 -1
- package/dist/deploy/targets/flatpak-manifest.js +50 -4
- package/dist/deploy/targets/flatpak-manifest.js.map +1 -1
- package/dist/deploy/targets/flatpak-source.d.ts.map +1 -1
- package/dist/deploy/targets/flatpak-source.js +55 -1
- package/dist/deploy/targets/flatpak-source.js.map +1 -1
- package/dist/deploy/types.d.ts +22 -2
- package/dist/deploy/types.d.ts.map +1 -1
- package/dist/deploy/types.js.map +1 -1
- package/dist/vite-plugins/bundled-packages.d.ts +5 -0
- package/dist/vite-plugins/bundled-packages.d.ts.map +1 -0
- package/dist/vite-plugins/bundled-packages.js +63 -0
- package/dist/vite-plugins/bundled-packages.js.map +1 -0
- package/package.json +9 -9
- package/src/builder.ts +2 -0
- package/src/deploy/freedesktop/copyright.ts +153 -18
- package/src/deploy/node-runtime/download.ts +13 -4
- package/src/deploy/node-runtime/index.ts +17 -11
- package/src/deploy/node-runtime/license.ts +24 -0
- package/src/deploy/notices/collect.ts +26 -0
- package/src/deploy/notices/dependencies.ts +53 -0
- package/src/deploy/notices/gtkx.ts +92 -0
- package/src/deploy/notices/libraries.ts +81 -0
- package/src/deploy/notices/node-runtime.ts +101 -0
- package/src/deploy/notices/packages.ts +168 -0
- package/src/deploy/notices/render.ts +52 -0
- package/src/deploy/notices/text.ts +42 -0
- package/src/deploy/payload/copy-tree.ts +5 -1
- package/src/deploy/payload/stage.ts +40 -16
- package/src/deploy/run-deploy.ts +27 -5
- package/src/deploy/settings/extra-files.ts +21 -0
- package/src/deploy/settings/index.ts +2 -1
- package/src/deploy/settings/package-manifest.ts +10 -0
- package/src/deploy/settings/paths.ts +1 -1
- package/src/deploy/targets/flatpak-manifest.ts +69 -4
- package/src/deploy/targets/flatpak-source.ts +87 -1
- package/src/deploy/types.ts +27 -1
- package/src/vite-plugins/bundled-packages.ts +95 -0
- package/LICENSE +0 -373
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { sortStrings } from "@gtkx/utils";
|
|
2
|
+
import { BUNDLE_FILENAME } from "../../vite-plugins/esm-extension.js";
|
|
3
|
+
const TITLE = "GTKX";
|
|
4
|
+
const SCOPE = "@gtkx/";
|
|
5
|
+
const LICENSE_NAME = "MPL-2.0";
|
|
6
|
+
const LICENSE_URL = "https://www.mozilla.org/MPL/2.0/";
|
|
7
|
+
const REPOSITORY_URL = "https://github.com/gtkx-org/gtkx";
|
|
8
|
+
const NATIVE_FILENAME = "gtkx.node";
|
|
9
|
+
const CRATES_SUBJECT = "Rust crates linked into the GTKX native addon";
|
|
10
|
+
const CRATES_LICENSE = "MIT and Apache-2.0 and ISC and Unicode-3.0";
|
|
11
|
+
const CRATES_MANIFEST = "packages/native/Cargo.toml";
|
|
12
|
+
const isGtkxPackage = (entry) => entry.name.startsWith(SCOPE);
|
|
13
|
+
const getVersion = (packages) => packages.map((entry) => entry.version).find((version) => version !== null) ?? null;
|
|
14
|
+
const getRepository = (packages) => packages.map((entry) => entry.source).find((source) => source !== null) ?? REPOSITORY_URL;
|
|
15
|
+
const sourceFor = (packages) => {
|
|
16
|
+
const repository = getRepository(packages);
|
|
17
|
+
const version = getVersion(packages);
|
|
18
|
+
return version === null ? repository : `${repository}/tree/v${version}`;
|
|
19
|
+
};
|
|
20
|
+
const cratesSourceFor = (packages) => `${sourceFor(packages)}/${CRATES_MANIFEST}`;
|
|
21
|
+
const modulesLine = (packages) => packages.length === 0 ? [] : [`Modules: ${sortStrings(packages.map((entry) => entry.name)).join(", ")}.`];
|
|
22
|
+
const summaryFor = (settings, packages) => {
|
|
23
|
+
const lib = `lib/${settings.binaryName}`;
|
|
24
|
+
return [
|
|
25
|
+
"GTKX is the framework this application is built on. Its JavaScript is compiled into",
|
|
26
|
+
`${lib}/${BUNDLE_FILENAME}, and its native addon is ${lib}/${NATIVE_FILENAME}.`,
|
|
27
|
+
`The ${LICENSE_NAME} notice below covers the code GTKX wrote, all of which is in both files, and the`,
|
|
28
|
+
`Mozilla Public License 2.0 is published at ${LICENSE_URL}.`,
|
|
29
|
+
"Section 3.2(a) asks that whoever receives an executable form be told how to obtain the source code,",
|
|
30
|
+
"which is what the source pointer below is for: it leads to the release these files were built from.",
|
|
31
|
+
`The addon also statically links Rust crates GTKX did not write, so ${lib}/${NATIVE_FILENAME} is not`,
|
|
32
|
+
`${LICENSE_NAME} alone. The second notice below names the licenses those crates carry; it does not`,
|
|
33
|
+
`reproduce their texts, and ${CRATES_MANIFEST} in the source pointed at records which crates went in`,
|
|
34
|
+
"and at which versions.",
|
|
35
|
+
...modulesLine(packages),
|
|
36
|
+
];
|
|
37
|
+
};
|
|
38
|
+
const getText = (packages) => packages.map((entry) => entry.text).find((text) => text !== null) ?? null;
|
|
39
|
+
const getCopyright = (packages) => sortStrings(new Set(packages.flatMap((entry) => entry.copyright)));
|
|
40
|
+
const subjectFor = (packages) => {
|
|
41
|
+
const version = getVersion(packages);
|
|
42
|
+
return version === null ? TITLE : `${TITLE} ${version}`;
|
|
43
|
+
};
|
|
44
|
+
const cratesNotice = (packages) => ({
|
|
45
|
+
subject: CRATES_SUBJECT,
|
|
46
|
+
license: CRATES_LICENSE,
|
|
47
|
+
source: cratesSourceFor(packages),
|
|
48
|
+
copyright: [],
|
|
49
|
+
text: null,
|
|
50
|
+
});
|
|
51
|
+
const gtkxNotices = (settings, packages) => {
|
|
52
|
+
const own = packages.filter((entry) => isGtkxPackage(entry));
|
|
53
|
+
const lib = `lib/${settings.binaryName}`;
|
|
54
|
+
return {
|
|
55
|
+
title: TITLE,
|
|
56
|
+
files: [`${lib}/${NATIVE_FILENAME}`, `${lib}/${BUNDLE_FILENAME}`],
|
|
57
|
+
summary: summaryFor(settings, own),
|
|
58
|
+
notices: [{
|
|
59
|
+
subject: subjectFor(own),
|
|
60
|
+
license: LICENSE_NAME,
|
|
61
|
+
source: sourceFor(own),
|
|
62
|
+
copyright: getCopyright(own),
|
|
63
|
+
text: getText(own),
|
|
64
|
+
}, cratesNotice(own)],
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
export { gtkxNotices, isGtkxPackage };
|
|
68
|
+
//# sourceMappingURL=gtkx.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gtkx.js","sourceRoot":"","sources":["../../../src/deploy/notices/gtkx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG1C,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAEtE,MAAM,KAAK,GAAG,MAAM,CAAC;AACrB,MAAM,KAAK,GAAG,QAAQ,CAAC;AACvB,MAAM,YAAY,GAAG,SAAS,CAAC;AAC/B,MAAM,WAAW,GAAG,kCAAkC,CAAC;AACvD,MAAM,cAAc,GAAG,kCAAkC,CAAC;AAC1D,MAAM,eAAe,GAAG,WAAW,CAAC;AACpC,MAAM,cAAc,GAAG,+CAA+C,CAAC;AACvE,MAAM,cAAc,GAAG,4CAA4C,CAAC;AACpE,MAAM,eAAe,GAAG,4BAA4B,CAAC;AAErD,MAAM,aAAa,GAAG,CAAC,KAAqB,EAAW,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;AAEvF,MAAM,UAAU,GAAG,CAAC,QAA0B,EAAiB,EAAE,CAC7D,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,KAAK,IAAI,CAAC,IAAI,IAAI,CAAC;AAEvF,MAAM,aAAa,GAAG,CAAC,QAA0B,EAAU,EAAE,CACzD,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC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AI,eAAe,EAAE,CAAC;QACjE,OAAO,EAAE,UAAU,CAAC,QAAQ,EAAE,GAAG,CAAC;QAClC,OAAO,EAAE,CAAC;gBACN,OAAO,EAAE,UAAU,CAAC,GAAG,CAAC;gBACxB,OAAO,EAAE,YAAY;gBACrB,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC;gBACtB,SAAS,EAAE,YAAY,CAAC,GAAG,CAAC;gBAC5B,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC;aACrB,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC;KACxB,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC","sourcesContent":["import { sortStrings } from \"@gtkx/utils\";\nimport type { DeploySettings, Notice, NoticeSection } from \"../types.js\";\nimport type { BundledPackage } from \"./packages.js\";\nimport { BUNDLE_FILENAME } from \"../../vite-plugins/esm-extension.js\";\n\nconst TITLE = \"GTKX\";\nconst SCOPE = \"@gtkx/\";\nconst LICENSE_NAME = \"MPL-2.0\";\nconst LICENSE_URL = \"https://www.mozilla.org/MPL/2.0/\";\nconst REPOSITORY_URL = \"https://github.com/gtkx-org/gtkx\";\nconst NATIVE_FILENAME = \"gtkx.node\";\nconst CRATES_SUBJECT = \"Rust crates linked into the GTKX native addon\";\nconst CRATES_LICENSE = \"MIT and Apache-2.0 and ISC and Unicode-3.0\";\nconst CRATES_MANIFEST = \"packages/native/Cargo.toml\";\n\nconst isGtkxPackage = (entry: BundledPackage): boolean => entry.name.startsWith(SCOPE);\n\nconst getVersion = (packages: BundledPackage[]): string | null =>\n packages.map((entry) => entry.version).find((version) => version !== null) ?? null;\n\nconst getRepository = (packages: BundledPackage[]): string =>\n packages.map((entry) => entry.source).find((source) => source !== null) ?? REPOSITORY_URL;\n\nconst sourceFor = (packages: BundledPackage[]): string => {\n const repository = getRepository(packages);\n const version = getVersion(packages);\n\n return version === null ? repository : `${repository}/tree/v${version}`;\n};\n\nconst cratesSourceFor = (packages: BundledPackage[]): string => `${sourceFor(packages)}/${CRATES_MANIFEST}`;\n\nconst modulesLine = (packages: BundledPackage[]): string[] =>\n packages.length === 0 ? [] : [`Modules: ${sortStrings(packages.map((entry) => entry.name)).join(\", \")}.`];\n\nconst summaryFor = (settings: DeploySettings, packages: BundledPackage[]): string[] => {\n const lib = `lib/${settings.binaryName}`;\n\n return [\n \"GTKX is the framework this application is built on. Its JavaScript is compiled into\",\n `${lib}/${BUNDLE_FILENAME}, and its native addon is ${lib}/${NATIVE_FILENAME}.`,\n `The ${LICENSE_NAME} notice below covers the code GTKX wrote, all of which is in both files, and the`,\n `Mozilla Public License 2.0 is published at ${LICENSE_URL}.`,\n \"Section 3.2(a) asks that whoever receives an executable form be told how to obtain the source code,\",\n \"which is what the source pointer below is for: it leads to the release these files were built from.\",\n `The addon also statically links Rust crates GTKX did not write, so ${lib}/${NATIVE_FILENAME} is not`,\n `${LICENSE_NAME} alone. The second notice below names the licenses those crates carry; it does not`,\n `reproduce their texts, and ${CRATES_MANIFEST} in the source pointed at records which crates went in`,\n \"and at which versions.\",\n ...modulesLine(packages),\n ];\n};\n\nconst getText = (packages: BundledPackage[]): string | null =>\n packages.map((entry) => entry.text).find((text) => text !== null) ?? null;\n\nconst getCopyright = (packages: BundledPackage[]): string[] =>\n sortStrings(new Set(packages.flatMap((entry) => entry.copyright)));\n\nconst subjectFor = (packages: BundledPackage[]): string => {\n const version = getVersion(packages);\n\n return version === null ? TITLE : `${TITLE} ${version}`;\n};\n\nconst cratesNotice = (packages: BundledPackage[]): Notice => ({\n subject: CRATES_SUBJECT,\n license: CRATES_LICENSE,\n source: cratesSourceFor(packages),\n copyright: [],\n text: null,\n});\n\nconst gtkxNotices = (settings: DeploySettings, packages: BundledPackage[]): NoticeSection => {\n const own = packages.filter((entry) => isGtkxPackage(entry));\n const lib = `lib/${settings.binaryName}`;\n\n return {\n title: TITLE,\n files: [`${lib}/${NATIVE_FILENAME}`, `${lib}/${BUNDLE_FILENAME}`],\n summary: summaryFor(settings, own),\n notices: [{\n subject: subjectFor(own),\n license: LICENSE_NAME,\n source: sourceFor(own),\n copyright: getCopyright(own),\n text: getText(own),\n }, cratesNotice(own)],\n };\n};\n\nexport { gtkxNotices, isGtkxPackage };\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"libraries.d.ts","sourceRoot":"","sources":["../../../src/deploy/notices/libraries.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAU,aAAa,EAAE,MAAM,aAAa,CAAC;AAoEzE,QAAA,MAAM,cAAc,GAAI,UAAU,cAAc,KAAG,aASlD,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { sortStringsBy } from "@gtkx/utils";
|
|
2
|
+
const TITLE = "Platform libraries";
|
|
3
|
+
const GNOME_URL = "https://gitlab.gnome.org/GNOME";
|
|
4
|
+
const LGPL = "LGPL-2.1-or-later";
|
|
5
|
+
const LGPL_URL = "https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html";
|
|
6
|
+
const GLIB = {
|
|
7
|
+
subject: "GLib, GObject and GIO",
|
|
8
|
+
license: LGPL,
|
|
9
|
+
source: `${GNOME_URL}/glib`,
|
|
10
|
+
};
|
|
11
|
+
const KNOWN_LIBRARIES = {
|
|
12
|
+
"Adw-1": { subject: "libadwaita", license: LGPL, source: `${GNOME_URL}/libadwaita` },
|
|
13
|
+
"Gtk-4.0": { subject: "GTK", license: LGPL, source: `${GNOME_URL}/gtk` },
|
|
14
|
+
"GtkSource-5": { subject: "GtkSourceView", license: LGPL, source: `${GNOME_URL}/gtksourceview` },
|
|
15
|
+
"WebKit-6.0": {
|
|
16
|
+
subject: "WebKitGTK",
|
|
17
|
+
license: "LGPL-2.1-or-later and BSD-2-Clause",
|
|
18
|
+
source: "https://github.com/WebKit/WebKit",
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
const SUMMARY = [
|
|
22
|
+
"Not one of the libraries below is included in this package. GTKX reaches them through GObject",
|
|
23
|
+
"introspection, so they are resolved when the application runs: from the host system for a deb, an rpm",
|
|
24
|
+
"or an AppImage, and from the GNOME runtime for a flatpak. Your platform distributes them to you under",
|
|
25
|
+
"their own terms; this package does not distribute them at all.",
|
|
26
|
+
"The GTKX native addon does link GLib, GObject and GIO dynamically against the copies already installed",
|
|
27
|
+
"on the system, which makes the addon a work that uses those libraries, and section 6 of the LGPL asks",
|
|
28
|
+
"such a work to carry three things. This is the notice it asks for. The license itself is published at",
|
|
29
|
+
`${LGPL_URL},`,
|
|
30
|
+
"and the copyright notice of each library is published with its sources, at the address listed beside",
|
|
31
|
+
"it below. Linking against an installed shared library is the mechanism section 6(b) allows, so the",
|
|
32
|
+
"source of the libraries does not have to travel with this package.",
|
|
33
|
+
];
|
|
34
|
+
const noticeFor = (library) => ({
|
|
35
|
+
subject: library.subject,
|
|
36
|
+
license: library.license,
|
|
37
|
+
source: library.source,
|
|
38
|
+
copyright: [],
|
|
39
|
+
text: null,
|
|
40
|
+
});
|
|
41
|
+
const knownLibraries = (settings) => settings.libraries.map((library) => KNOWN_LIBRARIES[library]).filter((library) => library !== undefined);
|
|
42
|
+
const otherLibraries = (settings) => settings.libraries.filter((library) => KNOWN_LIBRARIES[library] === undefined);
|
|
43
|
+
const otherSummary = (settings) => {
|
|
44
|
+
const others = otherLibraries(settings);
|
|
45
|
+
if (others.length === 0) {
|
|
46
|
+
return [];
|
|
47
|
+
}
|
|
48
|
+
return [`This application also declares ${others.join(", ")}, resolved from the platform the same way.`];
|
|
49
|
+
};
|
|
50
|
+
const libraryNotices = (settings) => {
|
|
51
|
+
const libraries = sortStringsBy(knownLibraries(settings), (library) => library.subject);
|
|
52
|
+
return {
|
|
53
|
+
title: TITLE,
|
|
54
|
+
files: [],
|
|
55
|
+
summary: [...SUMMARY, ...otherSummary(settings)],
|
|
56
|
+
notices: [GLIB, ...libraries].map((library) => noticeFor(library)),
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
export { libraryNotices };
|
|
60
|
+
//# sourceMappingURL=libraries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"libraries.js","sourceRoot":"","sources":["../../../src/deploy/notices/libraries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAS5C,MAAM,KAAK,GAAG,oBAAoB,CAAC;AACnC,MAAM,SAAS,GAAG,gCAAgC,CAAC;AACnD,MAAM,IAAI,GAAG,mBAAmB,CAAC;AACjC,MAAM,QAAQ,GAAG,yDAAyD,CAAC;AAE3E,MAAM,IAAI,GAAoB;IAC1B,OAAO,EAAE,uBAAuB;IAChC,OAAO,EAAE,IAAI;IACb,MAAM,EAAE,GAAG,SAAS,OAAO;CAC9B,CAAC;AAEF,MAAM,eAAe,GAAoC;IACrD,OAAO,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,SAAS,aAAa,EAAE;IACpF,SAAS,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE;IACxE,aAAa,EAAE,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,SAAS,gBAAgB,EAAE;IAChG,YAAY,EAAE;QACV,OAAO,EAAE,WAAW;QACpB,OAAO,EAAE,oCAAoC;QAC7C,MAAM,EAAE,kCAAkC;KAC7C;CACJ,CAAC;AAEF,MAAM,OAAO,GAAG;IACZ,+FAA+F;IAC/F,uGAAuG;IACvG,uGAAuG;IACvG,gEAAgE;IAChE,wGAAwG;IACxG,uGAAuG;IACvG,uGAAuG;IACvG,GAAG,QAAQ,GAAG;IACd,sGAAsG;IACtG,oGAAoG;IACpG,oEAAoE;CACvE,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,OAAwB,EAAU,E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AAI,EAAE,GAAG,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;KACrE,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import { sortStringsBy } from \"@gtkx/utils\";\nimport type { DeploySettings, Notice, NoticeSection } from \"../types.js\";\n\ntype PlatformLibrary = {\n subject: string;\n license: string;\n source: string;\n};\n\nconst TITLE = \"Platform libraries\";\nconst GNOME_URL = \"https://gitlab.gnome.org/GNOME\";\nconst LGPL = \"LGPL-2.1-or-later\";\nconst LGPL_URL = \"https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html\";\n\nconst GLIB: PlatformLibrary = {\n subject: \"GLib, GObject and GIO\",\n license: LGPL,\n source: `${GNOME_URL}/glib`,\n};\n\nconst KNOWN_LIBRARIES: Record<string, PlatformLibrary> = {\n \"Adw-1\": { subject: \"libadwaita\", license: LGPL, source: `${GNOME_URL}/libadwaita` },\n \"Gtk-4.0\": { subject: \"GTK\", license: LGPL, source: `${GNOME_URL}/gtk` },\n \"GtkSource-5\": { subject: \"GtkSourceView\", license: LGPL, source: `${GNOME_URL}/gtksourceview` },\n \"WebKit-6.0\": {\n subject: \"WebKitGTK\",\n license: \"LGPL-2.1-or-later and BSD-2-Clause\",\n source: \"https://github.com/WebKit/WebKit\",\n },\n};\n\nconst SUMMARY = [\n \"Not one of the libraries below is included in this package. GTKX reaches them through GObject\",\n \"introspection, so they are resolved when the application runs: from the host system for a deb, an rpm\",\n \"or an AppImage, and from the GNOME runtime for a flatpak. Your platform distributes them to you under\",\n \"their own terms; this package does not distribute them at all.\",\n \"The GTKX native addon does link GLib, GObject and GIO dynamically against the copies already installed\",\n \"on the system, which makes the addon a work that uses those libraries, and section 6 of the LGPL asks\",\n \"such a work to carry three things. This is the notice it asks for. The license itself is published at\",\n `${LGPL_URL},`,\n \"and the copyright notice of each library is published with its sources, at the address listed beside\",\n \"it below. Linking against an installed shared library is the mechanism section 6(b) allows, so the\",\n \"source of the libraries does not have to travel with this package.\",\n];\n\nconst noticeFor = (library: PlatformLibrary): Notice => ({\n subject: library.subject,\n license: library.license,\n source: library.source,\n copyright: [],\n text: null,\n});\n\nconst knownLibraries = (settings: DeploySettings): PlatformLibrary[] =>\n settings.libraries.map((library) => KNOWN_LIBRARIES[library]).filter((library) => library !== undefined);\n\nconst otherLibraries = (settings: DeploySettings): string[] =>\n settings.libraries.filter((library) => KNOWN_LIBRARIES[library] === undefined);\n\nconst otherSummary = (settings: DeploySettings): string[] => {\n const others = otherLibraries(settings);\n\n if (others.length === 0) {\n return [];\n }\n\n return [`This application also declares ${others.join(\", \")}, resolved from the platform the same way.`];\n};\n\nconst libraryNotices = (settings: DeploySettings): NoticeSection => {\n const libraries = sortStringsBy(knownLibraries(settings), (library) => library.subject);\n\n return {\n title: TITLE,\n files: [],\n summary: [...SUMMARY, ...otherSummary(settings)],\n notices: [GLIB, ...libraries].map((library) => noticeFor(library)),\n };\n};\n\nexport { libraryNotices };\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-runtime.d.ts","sourceRoot":"","sources":["../../../src/deploy/notices/node-runtime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAiF9E,QAAA,MAAM,WAAW,GAAI,UAAU,cAAc,EAAE,MAAM,WAAW,GAAG,IAAI,KAAG,aAgBzE,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { warn } from "@gtkx/utils";
|
|
2
|
+
import { sourcePathFor } from "../node-runtime/index.js";
|
|
3
|
+
import { licenseBesideNode } from "../node-runtime/license.js";
|
|
4
|
+
import { NODE_FILENAME } from "../payload/launcher.js";
|
|
5
|
+
import { nodeLicenseDestination } from "../payload/stage.js";
|
|
6
|
+
import { copyrightLines, readLicenseText } from "./text.js";
|
|
7
|
+
const TITLE = "Node.js runtime";
|
|
8
|
+
const LICENSE_NAME = "Node.js";
|
|
9
|
+
const SOURCE_URL = "https://github.com/nodejs/node";
|
|
10
|
+
const LICENSE_URL = "https://github.com/nodejs/node/blob/main/LICENSE";
|
|
11
|
+
const SUMMARY = [
|
|
12
|
+
"This package carries the Node.js runtime that runs the application. Its license is the one Node.js",
|
|
13
|
+
"publishes as a single document, covering Node.js itself under the MIT terms together with the",
|
|
14
|
+
"components it embeds under theirs, among them V8, OpenSSL, ICU, libuv, zlib, brotli and llhttp.",
|
|
15
|
+
];
|
|
16
|
+
const CARRIED_SUMMARY = ["The notice below is that document, reproduced from the release this package bundles."];
|
|
17
|
+
const MISSING_SUMMARY = [
|
|
18
|
+
"This run had no copy of that document at hand, so the notice below names it and it is published at",
|
|
19
|
+
`${LICENSE_URL}.`,
|
|
20
|
+
];
|
|
21
|
+
const MISSING_LICENSE = "Cannot read a license file for the Node.js runtime this deploy bundles. An official release unpacks it " +
|
|
22
|
+
'next to the binary, so point `deploy.node.path` at one, or use `deploy.node.source: "download"`, and ' +
|
|
23
|
+
"the notices carry it.";
|
|
24
|
+
const isSourceMode = (settings) => settings.deploy.flatpak?.mode === "source";
|
|
25
|
+
const versionFor = (settings, node) => node?.version ?? settings.deploy.node?.version ?? process.versions.node;
|
|
26
|
+
const licenseFileFor = (settings, node) => {
|
|
27
|
+
if (node !== null) {
|
|
28
|
+
return node.licenseFile;
|
|
29
|
+
}
|
|
30
|
+
if ((settings.deploy.node?.source ?? "download") === "download") {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
return licenseBesideNode(sourcePathFor(settings));
|
|
34
|
+
};
|
|
35
|
+
const textFor = (settings, node) => {
|
|
36
|
+
const licenseFile = licenseFileFor(settings, node);
|
|
37
|
+
return licenseFile === null ? null : readLicenseText(licenseFile);
|
|
38
|
+
};
|
|
39
|
+
const extensionSummary = (settings) => [
|
|
40
|
+
"The flatpak built from source copies its runtime out of the Node SDK extension in the build sandbox.",
|
|
41
|
+
`That build installs the license file the extension ships as ${nodeLicenseDestination(settings)}, and`,
|
|
42
|
+
"installs nothing when the extension ships none, so read the text at the address above if that file is",
|
|
43
|
+
"not in the package you received.",
|
|
44
|
+
];
|
|
45
|
+
const carriedSummary = (settings, text) => {
|
|
46
|
+
if (isSourceMode(settings)) {
|
|
47
|
+
return [...MISSING_SUMMARY, ...extensionSummary(settings)];
|
|
48
|
+
}
|
|
49
|
+
return text === null ? MISSING_SUMMARY : CARRIED_SUMMARY;
|
|
50
|
+
};
|
|
51
|
+
const summaryFor = (settings, text) => [
|
|
52
|
+
...SUMMARY,
|
|
53
|
+
...carriedSummary(settings, text),
|
|
54
|
+
];
|
|
55
|
+
const warnMissingLicense = (node, text) => {
|
|
56
|
+
if (node === null || text !== null) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
warn(MISSING_LICENSE);
|
|
60
|
+
};
|
|
61
|
+
const nodeNotices = (settings, node) => {
|
|
62
|
+
const text = textFor(settings, node);
|
|
63
|
+
warnMissingLicense(node, text);
|
|
64
|
+
return {
|
|
65
|
+
title: TITLE,
|
|
66
|
+
files: [`lib/${settings.binaryName}/${NODE_FILENAME}`],
|
|
67
|
+
summary: summaryFor(settings, text),
|
|
68
|
+
notices: [{
|
|
69
|
+
subject: `Node.js ${versionFor(settings, node)}`,
|
|
70
|
+
license: LICENSE_NAME,
|
|
71
|
+
source: SOURCE_URL,
|
|
72
|
+
copyright: copyrightLines(text),
|
|
73
|
+
text,
|
|
74
|
+
}],
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
export { nodeNotices };
|
|
78
|
+
//# sourceMappingURL=node-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-runtime.js","sourceRoot":"","sources":["../../../src/deploy/notices/node-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CA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;AAEF,MAAM,WAAW,GAAG,CAAC,QAAwB,EAAE,IAAwB,EAAiB,EAAE;IACtF,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IACrC,kBAAkB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAE/B,OAAO;QACH,KAAK,EAAE,KAAK;QACZ,KAAK,EAAE,CAAC,OAAO,QAAQ,CAAC,UAAU,IAAI,aAAa,EAAE,CAAC;QACtD,OAAO,EAAE,UAAU,CAAC,QAAQ,EAAE,IAAI,CAAC;QACnC,OAAO,EAAE,CAAC;gBACN,OAAO,EAAE,WAAW,UAAU,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE;gBAChD,OAAO,EAAE,YAAY;gBACrB,MAAM,EAAE,UAAU;gBAClB,SAAS,EAAE,cAAc,CAAC,IAAI,CAAC;gBAC/B,IAAI;aACP,CAAC;KACL,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,CAAC","sourcesContent":["import { warn } from \"@gtkx/utils\";\nimport type { DeploySettings, NodeRuntime, NoticeSection } from \"../types.js\";\nimport { sourcePathFor } from \"../node-runtime/index.js\";\nimport { licenseBesideNode } from \"../node-runtime/license.js\";\nimport { NODE_FILENAME } from \"../payload/launcher.js\";\nimport { nodeLicenseDestination } from \"../payload/stage.js\";\nimport { copyrightLines, readLicenseText } from \"./text.js\";\n\nconst TITLE = \"Node.js runtime\";\nconst LICENSE_NAME = \"Node.js\";\nconst SOURCE_URL = \"https://github.com/nodejs/node\";\nconst LICENSE_URL = \"https://github.com/nodejs/node/blob/main/LICENSE\";\n\nconst SUMMARY = [\n \"This package carries the Node.js runtime that runs the application. Its license is the one Node.js\",\n \"publishes as a single document, covering Node.js itself under the MIT terms together with the\",\n \"components it embeds under theirs, among them V8, OpenSSL, ICU, libuv, zlib, brotli and llhttp.\",\n];\n\nconst CARRIED_SUMMARY = [\"The notice below is that document, reproduced from the release this package bundles.\"];\n\nconst MISSING_SUMMARY = [\n \"This run had no copy of that document at hand, so the notice below names it and it is published at\",\n `${LICENSE_URL}.`,\n];\n\nconst MISSING_LICENSE =\n \"Cannot read a license file for the Node.js runtime this deploy bundles. An official release unpacks it \" +\n 'next to the binary, so point `deploy.node.path` at one, or use `deploy.node.source: \"download\"`, and ' +\n \"the notices carry it.\";\n\nconst isSourceMode = (settings: DeploySettings): boolean => settings.deploy.flatpak?.mode === \"source\";\n\nconst versionFor = (settings: DeploySettings, node: NodeRuntime | null): string =>\n node?.version ?? settings.deploy.node?.version ?? process.versions.node;\n\nconst licenseFileFor = (settings: DeploySettings, node: NodeRuntime | null): string | null => {\n if (node !== null) {\n return node.licenseFile;\n }\n\n if ((settings.deploy.node?.source ?? \"download\") === \"download\") {\n return null;\n }\n\n return licenseBesideNode(sourcePathFor(settings));\n};\n\nconst textFor = (settings: DeploySettings, node: NodeRuntime | null): string | null => {\n const licenseFile = licenseFileFor(settings, node);\n\n return licenseFile === null ? null : readLicenseText(licenseFile);\n};\n\nconst extensionSummary = (settings: DeploySettings): string[] => [\n \"The flatpak built from source copies its runtime out of the Node SDK extension in the build sandbox.\",\n `That build installs the license file the extension ships as ${nodeLicenseDestination(settings)}, and`,\n \"installs nothing when the extension ships none, so read the text at the address above if that file is\",\n \"not in the package you received.\",\n];\n\nconst carriedSummary = (settings: DeploySettings, text: string | null): string[] => {\n if (isSourceMode(settings)) {\n return [...MISSING_SUMMARY, ...extensionSummary(settings)];\n }\n\n return text === null ? MISSING_SUMMARY : CARRIED_SUMMARY;\n};\n\nconst summaryFor = (settings: DeploySettings, text: string | null): string[] => [\n ...SUMMARY,\n ...carriedSummary(settings, text),\n];\n\nconst warnMissingLicense = (node: NodeRuntime | null, text: string | null): void => {\n if (node === null || text !== null) {\n return;\n }\n\n warn(MISSING_LICENSE);\n};\n\nconst nodeNotices = (settings: DeploySettings, node: NodeRuntime | null): NoticeSection => {\n const text = textFor(settings, node);\n warnMissingLicense(node, text);\n\n return {\n title: TITLE,\n files: [`lib/${settings.binaryName}/${NODE_FILENAME}`],\n summary: summaryFor(settings, text),\n notices: [{\n subject: `Node.js ${versionFor(settings, node)}`,\n license: LICENSE_NAME,\n source: SOURCE_URL,\n copyright: copyrightLines(text),\n text,\n }],\n };\n};\n\nexport { nodeNotices };\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { DeploySettings } from "../types.js";
|
|
2
|
+
type BundledPackage = {
|
|
3
|
+
name: string;
|
|
4
|
+
version: string | null;
|
|
5
|
+
license: string | null;
|
|
6
|
+
source: string | null;
|
|
7
|
+
copyright: string[];
|
|
8
|
+
text: string | null;
|
|
9
|
+
isPresent: boolean;
|
|
10
|
+
};
|
|
11
|
+
declare const bundledPackages: (settings: DeploySettings) => BundledPackage[];
|
|
12
|
+
export { type BundledPackage, bundledPackages };
|
|
13
|
+
//# sourceMappingURL=packages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"packages.d.ts","sourceRoot":"","sources":["../../../src/deploy/notices/packages.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAWlD,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;AAmIF,QAAA,MAAM,eAAe,GAAI,UAAU,cAAc,KAAG,cAAc,EAYjE,CAAC;AAEF,OAAO,EAAE,KAAK,cAAc,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { isRecord, sortStringsBy, warn } from "@gtkx/utils";
|
|
2
|
+
import { existsSync, readFileSync, realpathSync } from "node:fs";
|
|
3
|
+
import { join, resolve } from "node:path";
|
|
4
|
+
import { BUNDLED_PACKAGES_FILENAME } from "../../vite-plugins/bundled-packages.js";
|
|
5
|
+
import { readPackageManifest } from "../settings/package-manifest.js";
|
|
6
|
+
import { copyrightLines, licenseTextIn } from "./text.js";
|
|
7
|
+
const MANIFEST_FILENAME = "package.json";
|
|
8
|
+
const GIT_PREFIX = /^git\+/;
|
|
9
|
+
const GIT_SUFFIX = /\.git$/;
|
|
10
|
+
const GIT_SCHEME = /^git:\/\//;
|
|
11
|
+
const GITHUB_SLUG = /^(?:github:)?(?<slug>[\w.-]+\/[\w.-]+)$/;
|
|
12
|
+
const realPath = (path) => {
|
|
13
|
+
try {
|
|
14
|
+
return realpathSync(path);
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
return path;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const optionalString = (value) => (typeof value === "string" ? value : null);
|
|
21
|
+
const recordedPackage = (entry) => {
|
|
22
|
+
if (!isRecord(entry) || typeof entry.name !== "string" || typeof entry.dir !== "string") {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
return { name: entry.name, version: optionalString(entry.version), dir: entry.dir };
|
|
26
|
+
};
|
|
27
|
+
const recordedList = (value) => {
|
|
28
|
+
if (!Array.isArray(value)) {
|
|
29
|
+
return [];
|
|
30
|
+
}
|
|
31
|
+
const entries = value;
|
|
32
|
+
return entries.map((entry) => recordedPackage(entry)).filter((entry) => entry !== null);
|
|
33
|
+
};
|
|
34
|
+
const readRecordedPackages = (settings) => {
|
|
35
|
+
const path = join(settings.paths.dist, BUNDLED_PACKAGES_FILENAME);
|
|
36
|
+
if (!existsSync(path)) {
|
|
37
|
+
throw new Error(`Cannot deploy: ${path} is missing. Run \`gtkx build\` first.`);
|
|
38
|
+
}
|
|
39
|
+
const parsed = JSON.parse(readFileSync(path, "utf8"));
|
|
40
|
+
return recordedList(isRecord(parsed) ? parsed.packages : null);
|
|
41
|
+
};
|
|
42
|
+
const authorLine = (manifest) => {
|
|
43
|
+
const { name, email } = manifest.author;
|
|
44
|
+
if (name === null) {
|
|
45
|
+
return [];
|
|
46
|
+
}
|
|
47
|
+
return [email === null ? name : `${name} <${email}>`];
|
|
48
|
+
};
|
|
49
|
+
const sourceUrl = (manifest) => {
|
|
50
|
+
const configured = manifest.repository ?? manifest.homepage;
|
|
51
|
+
if (configured === null) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
const url = configured.replace(GIT_PREFIX, "").replace(GIT_SUFFIX, "").replace(GIT_SCHEME, "https://");
|
|
55
|
+
const slug = GITHUB_SLUG.exec(url)?.groups?.slug;
|
|
56
|
+
if (slug !== undefined) {
|
|
57
|
+
return `https://github.com/${slug}`;
|
|
58
|
+
}
|
|
59
|
+
return url.startsWith("http") ? url : null;
|
|
60
|
+
};
|
|
61
|
+
const missingPackage = (entry) => ({
|
|
62
|
+
name: entry.name,
|
|
63
|
+
version: entry.version,
|
|
64
|
+
license: null,
|
|
65
|
+
source: null,
|
|
66
|
+
copyright: [],
|
|
67
|
+
text: null,
|
|
68
|
+
isPresent: false,
|
|
69
|
+
});
|
|
70
|
+
const packageIn = (entry, dir) => {
|
|
71
|
+
if (!existsSync(join(dir, MANIFEST_FILENAME))) {
|
|
72
|
+
return missingPackage(entry);
|
|
73
|
+
}
|
|
74
|
+
const manifest = readPackageManifest(dir);
|
|
75
|
+
const text = licenseTextIn(dir);
|
|
76
|
+
const copyright = copyrightLines(text);
|
|
77
|
+
return {
|
|
78
|
+
name: manifest.name ?? entry.name,
|
|
79
|
+
version: manifest.version ?? entry.version,
|
|
80
|
+
license: manifest.license,
|
|
81
|
+
source: sourceUrl(manifest),
|
|
82
|
+
copyright: copyright.length === 0 ? authorLine(manifest) : copyright,
|
|
83
|
+
text,
|
|
84
|
+
isPresent: true,
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
const keyFor = (entry) => `${entry.name}@${entry.version ?? ""}`;
|
|
88
|
+
const dedupe = (entries) => {
|
|
89
|
+
const unique = new Map();
|
|
90
|
+
for (const entry of entries) {
|
|
91
|
+
unique.set(keyFor(entry), entry);
|
|
92
|
+
}
|
|
93
|
+
return sortStringsBy(unique.values(), keyFor);
|
|
94
|
+
};
|
|
95
|
+
const warnMissing = (entries) => {
|
|
96
|
+
const missing = entries.filter((entry) => !entry.isPresent);
|
|
97
|
+
if (missing.length === 0) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
warn(`The third-party notices name ${missing.map((entry) => keyFor(entry)).join(", ")} without any license: ` +
|
|
101
|
+
"`gtkx build` recorded where each package was installed and those directories are no longer there. " +
|
|
102
|
+
"Deploy from the tree the build ran in, or build again, so the notices carry their terms.");
|
|
103
|
+
};
|
|
104
|
+
const bundledPackages = (settings) => {
|
|
105
|
+
const root = realPath(settings.paths.root);
|
|
106
|
+
const entries = readRecordedPackages(settings)
|
|
107
|
+
.map((entry) => ({ entry, dir: resolve(settings.paths.dist, entry.dir) }))
|
|
108
|
+
.filter(({ dir }) => realPath(dir) !== root)
|
|
109
|
+
.map(({ entry, dir }) => packageIn(entry, dir));
|
|
110
|
+
const bundled = dedupe(entries);
|
|
111
|
+
warnMissing(bundled);
|
|
112
|
+
return bundled;
|
|
113
|
+
};
|
|
114
|
+
export { bundledPackages };
|
|
115
|
+
//# sourceMappingURL=packages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"packages.js","sourceRoot":"","sources":["../../../src/deploy/notices/packages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC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CAAC,QAAwB,EAAoB,EAAE;IACnE,MAAM,IAAI,GAAG,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAE3C,MAAM,OAAO,GAAG,oBAAoB,CAAC,QAAQ,CAAC;SACzC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;SACzE,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC;SAC3C,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC,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 { isRecord, sortStringsBy, warn } from \"@gtkx/utils\";\nimport { existsSync, readFileSync, realpathSync } from \"node:fs\";\nimport { join, resolve } from \"node:path\";\nimport type { DeploySettings } from \"../types.js\";\nimport { BUNDLED_PACKAGES_FILENAME } from \"../../vite-plugins/bundled-packages.js\";\nimport { type PackageManifest, readPackageManifest } from \"../settings/package-manifest.js\";\nimport { copyrightLines, licenseTextIn } from \"./text.js\";\n\ntype RecordedPackage = {\n name: string;\n version: string | null;\n dir: string;\n};\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\";\nconst GIT_PREFIX = /^git\\+/;\nconst GIT_SUFFIX = /\\.git$/;\nconst GIT_SCHEME = /^git:\\/\\//;\nconst GITHUB_SLUG = /^(?:github:)?(?<slug>[\\w.-]+\\/[\\w.-]+)$/;\n\nconst realPath = (path: string): string => {\n try {\n return realpathSync(path);\n } catch {\n return path;\n }\n};\n\nconst optionalString = (value: unknown): string | null => (typeof value === \"string\" ? value : null);\n\nconst recordedPackage = (entry: unknown): RecordedPackage | null => {\n if (!isRecord(entry) || typeof entry.name !== \"string\" || typeof entry.dir !== \"string\") {\n return null;\n }\n\n return { name: entry.name, version: optionalString(entry.version), dir: entry.dir };\n};\n\nconst recordedList = (value: unknown): RecordedPackage[] => {\n if (!Array.isArray(value)) {\n return [];\n }\n\n const entries: unknown[] = value;\n\n return entries.map((entry) => recordedPackage(entry)).filter((entry) => entry !== null);\n};\n\nconst readRecordedPackages = (settings: DeploySettings): RecordedPackage[] => {\n const path = join(settings.paths.dist, BUNDLED_PACKAGES_FILENAME);\n\n if (!existsSync(path)) {\n throw new Error(`Cannot deploy: ${path} is missing. Run \\`gtkx build\\` first.`);\n }\n\n const parsed: unknown = JSON.parse(readFileSync(path, \"utf8\"));\n\n return recordedList(isRecord(parsed) ? parsed.packages : null);\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_PREFIX, \"\").replace(GIT_SUFFIX, \"\").replace(GIT_SCHEME, \"https://\");\n const slug = GITHUB_SLUG.exec(url)?.groups?.slug;\n\n if (slug !== undefined) {\n return `https://github.com/${slug}`;\n }\n\n return 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): BundledPackage[] => {\n const root = realPath(settings.paths.root);\n\n const entries = readRecordedPackages(settings)\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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../../src/deploy/notices/render.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAU,aAAa,EAAE,MAAM,aAAa,CAAC;AAgDzE,QAAA,MAAM,aAAa,GAAI,UAAU,cAAc,EAAE,UAAU,aAAa,EAAE,KAAG,MAC2B,CAAC;AAEzG,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const RULE_WIDTH = 100;
|
|
2
|
+
const HEADING = "THIRD-PARTY NOTICES";
|
|
3
|
+
const SECTION_RULE = "=".repeat(RULE_WIDTH);
|
|
4
|
+
const NOTICE_RULE = "-".repeat(RULE_WIDTH);
|
|
5
|
+
const FILE_SEPARATOR = ", ";
|
|
6
|
+
const introFor = (settings) => [
|
|
7
|
+
HEADING,
|
|
8
|
+
`${settings.name} ${settings.versions.upstream}`,
|
|
9
|
+
"",
|
|
10
|
+
`This file lists the software that ships inside ${settings.name} without having been written by its`,
|
|
11
|
+
"authors, and the terms each piece of it is distributed under.",
|
|
12
|
+
];
|
|
13
|
+
const headerFor = (section) => [
|
|
14
|
+
SECTION_RULE,
|
|
15
|
+
section.title,
|
|
16
|
+
...(section.files.length === 0 ? [] : [`Files: ${section.files.join(FILE_SEPARATOR)}`]),
|
|
17
|
+
SECTION_RULE,
|
|
18
|
+
"",
|
|
19
|
+
];
|
|
20
|
+
const detailLines = (notice) => [
|
|
21
|
+
`License: ${notice.license}`,
|
|
22
|
+
...(notice.source === null ? [] : [`Source: ${notice.source}`]),
|
|
23
|
+
];
|
|
24
|
+
const bodyLines = (notice) => notice.text === null ? notice.copyright : ["", notice.text];
|
|
25
|
+
const renderNotice = (notice) => [
|
|
26
|
+
NOTICE_RULE,
|
|
27
|
+
notice.subject,
|
|
28
|
+
...detailLines(notice),
|
|
29
|
+
NOTICE_RULE,
|
|
30
|
+
...bodyLines(notice),
|
|
31
|
+
"",
|
|
32
|
+
];
|
|
33
|
+
const renderSection = (section) => [
|
|
34
|
+
...headerFor(section),
|
|
35
|
+
...section.summary,
|
|
36
|
+
"",
|
|
37
|
+
...section.notices.flatMap((notice) => renderNotice(notice)),
|
|
38
|
+
];
|
|
39
|
+
const renderNotices = (settings, sections) => [...introFor(settings), "", ...sections.flatMap((section) => renderSection(section)), ""].join("\n");
|
|
40
|
+
export { renderNotices };
|
|
41
|
+
//# sourceMappingURL=render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../../src/deploy/notices/render.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,GAAG,GAAG,CAAC;AACvB,MAAM,OAAO,GAAG,qBAAqB,CAAC;AACtC,MAAM,YAAY,GAAG,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AAC5C,MAAM,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AAC3C,MAAM,cAAc,GAAG,IAAI,CAAC;AAE5B,MAAM,QAAQ,GAAG,CAAC,QAAwB,EAAY,EAAE,CAAC;IACrD,OAAO;IACP,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE;IAChD,EAAE;IACF,kDAAkD,QAAQ,CAAC,IAAI,qCAAqC;IACpG,+DAA+D;CAClE,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,OAAsB,EAAY,EAAE,CAAC;IACpD,YAAY;IACZ,OAAO,CAAC,KAAK;IACb,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;IACvF,YAAY;IACZ,EAAE;CACL,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,MAAc,EAAY,EAAE,CAAC;IAC9C,YAAY,MAAM,CAAC,OAAO,EAAE;IAC5B,GAAG,CAAC,MAAM,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,WAAW,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;CAClE,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,MAAc,EAAY,EAAE,CAC3C,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;AAEhE,MAAM,YAAY,GAAG,CAAC,MAAc,EAAY,EAAE,CAAC;IAC/C,WAAW;IACX,MAAM,CAAC,OAAO;IACd,GAAG,WAAW,CAAC,MAAM,CAAC;IACtB,WAAW;IACX,GAAG,SAAS,CAAC,MAAM,CAAC;IACpB,EAAE;CACL,CAAC;AAEF,MAAM,aAAa,GAAG,CAAC,OAAsB,EAAY,EAAE,CAAC;IACxD,GAAG,SAAS,CAAC,OAAO,CAAC;IACrB,GAAG,OAAO,CAAC,OAAO;IAClB,EAAE;IACF,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;CAC/D,CAAC;AAEF,MAAM,aAAa,GAAG,CAAC,QAAwB,EAAE,QAAyB,EAAU,EAAE,CAClF,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEzG,OAAO,EAAE,aAAa,EAAE,CAAC","sourcesContent":["import type { DeploySettings, Notice, NoticeSection } from \"../types.js\";\n\nconst RULE_WIDTH = 100;\nconst HEADING = \"THIRD-PARTY NOTICES\";\nconst SECTION_RULE = \"=\".repeat(RULE_WIDTH);\nconst NOTICE_RULE = \"-\".repeat(RULE_WIDTH);\nconst FILE_SEPARATOR = \", \";\n\nconst introFor = (settings: DeploySettings): string[] => [\n HEADING,\n `${settings.name} ${settings.versions.upstream}`,\n \"\",\n `This file lists the software that ships inside ${settings.name} without having been written by its`,\n \"authors, and the terms each piece of it is distributed under.\",\n];\n\nconst headerFor = (section: NoticeSection): string[] => [\n SECTION_RULE,\n section.title,\n ...(section.files.length === 0 ? [] : [`Files: ${section.files.join(FILE_SEPARATOR)}`]),\n SECTION_RULE,\n \"\",\n];\n\nconst detailLines = (notice: Notice): string[] => [\n `License: ${notice.license}`,\n ...(notice.source === null ? [] : [`Source: ${notice.source}`]),\n];\n\nconst bodyLines = (notice: Notice): string[] =>\n notice.text === null ? notice.copyright : [\"\", notice.text];\n\nconst renderNotice = (notice: Notice): string[] => [\n NOTICE_RULE,\n notice.subject,\n ...detailLines(notice),\n NOTICE_RULE,\n ...bodyLines(notice),\n \"\",\n];\n\nconst renderSection = (section: NoticeSection): string[] => [\n ...headerFor(section),\n ...section.summary,\n \"\",\n ...section.notices.flatMap((notice) => renderNotice(notice)),\n];\n\nconst renderNotices = (settings: DeploySettings, sections: NoticeSection[]): string =>\n [...introFor(settings), \"\", ...sections.flatMap((section) => renderSection(section)), \"\"].join(\"\\n\");\n\nexport { renderNotices };\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
declare const readLicenseText: (path: string) => string | null;
|
|
2
|
+
declare const licenseTextIn: (dir: string) => string | null;
|
|
3
|
+
declare const copyrightLines: (text: string | null) => string[];
|
|
4
|
+
export { copyrightLines, licenseTextIn, readLicenseText };
|
|
5
|
+
//# sourceMappingURL=text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../src/deploy/notices/text.ts"],"names":[],"mappings":"AAQA,QAAA,MAAM,eAAe,GAAI,MAAM,MAAM,KAAG,MAAM,GAAG,IAMhD,CAAC;AAQF,QAAA,MAAM,aAAa,GAAI,KAAK,MAAM,KAAG,MAAM,GAAG,IAM7C,CAAC;AAEF,QAAA,MAAM,cAAc,GAAI,MAAM,MAAM,GAAG,IAAI,KAAG,MAAM,EASnD,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { readdirSync, readFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
const LICENSE_FILE = /^(?:licen[cs]e|copying|notice)(?:[-._].*)?$/i;
|
|
4
|
+
const COPYRIGHT_LINE = /^(?:Copyright\b|©)/;
|
|
5
|
+
const MAX_COPYRIGHT_LINES = 20;
|
|
6
|
+
const MORE_COPYRIGHT = "and the other holders named in the license text";
|
|
7
|
+
const readLicenseText = (path) => {
|
|
8
|
+
try {
|
|
9
|
+
return readFileSync(path, "utf8").trimEnd();
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
const licenseFilesIn = (dir) => readdirSync(dir, { withFileTypes: true })
|
|
16
|
+
.filter((entry) => entry.isFile() && LICENSE_FILE.test(entry.name))
|
|
17
|
+
.map((entry) => entry.name)
|
|
18
|
+
.toSorted((left, right) => left.localeCompare(right));
|
|
19
|
+
const licenseTextIn = (dir) => {
|
|
20
|
+
const texts = licenseFilesIn(dir)
|
|
21
|
+
.map((name) => readLicenseText(join(dir, name)))
|
|
22
|
+
.filter((text) => text !== null);
|
|
23
|
+
return texts.length === 0 ? null : texts.join("\n\n");
|
|
24
|
+
};
|
|
25
|
+
const copyrightLines = (text) => {
|
|
26
|
+
const found = (text ?? "")
|
|
27
|
+
.split("\n")
|
|
28
|
+
.map((line) => line.trim())
|
|
29
|
+
.filter((line) => COPYRIGHT_LINE.test(line));
|
|
30
|
+
const unique = [...new Set(found)];
|
|
31
|
+
return unique.length > MAX_COPYRIGHT_LINES ? [...unique.slice(0, MAX_COPYRIGHT_LINES), MORE_COPYRIGHT] : unique;
|
|
32
|
+
};
|
|
33
|
+
export { copyrightLines, licenseTextIn, readLicenseText };
|
|
34
|
+
//# sourceMappingURL=text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.js","sour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AK,IAAI,CAAC,CAAC;IAErC,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC1D,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,IAAmB,EAAY,EAAE;IACrD,MAAM,KAAK,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC;SACrB,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;SAC1B,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAEjD,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;IAEnC,OAAO,MAAM,CAAC,MAAM,GAAG,mBAAmB,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,mBAAmB,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;AACpH,CAAC,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,CAAC","sourcesContent":["import { readdirSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\nconst LICENSE_FILE = /^(?:licen[cs]e|copying|notice)(?:[-._].*)?$/i;\nconst COPYRIGHT_LINE = /^(?:Copyright\\b|©)/;\nconst MAX_COPYRIGHT_LINES = 20;\nconst MORE_COPYRIGHT = \"and the other holders named in the license text\";\n\nconst readLicenseText = (path: string): string | null => {\n try {\n return readFileSync(path, \"utf8\").trimEnd();\n } catch {\n return null;\n }\n};\n\nconst licenseFilesIn = (dir: string): string[] =>\n readdirSync(dir, { withFileTypes: true })\n .filter((entry) => entry.isFile() && LICENSE_FILE.test(entry.name))\n .map((entry) => entry.name)\n .toSorted((left, right) => left.localeCompare(right));\n\nconst licenseTextIn = (dir: string): string | null => {\n const texts = licenseFilesIn(dir)\n .map((name) => readLicenseText(join(dir, name)))\n .filter((text) => text !== null);\n\n return texts.length === 0 ? null : texts.join(\"\\n\\n\");\n};\n\nconst copyrightLines = (text: string | null): string[] => {\n const found = (text ?? \"\")\n .split(\"\\n\")\n .map((line) => line.trim())\n .filter((line) => COPYRIGHT_LINE.test(line));\n\n const unique = [...new Set(found)];\n\n return unique.length > MAX_COPYRIGHT_LINES ? [...unique.slice(0, MAX_COPYRIGHT_LINES), MORE_COPYRIGHT] : unique;\n};\n\nexport { copyrightLines, licenseTextIn, readLicenseText };\n"]}
|
|
@@ -2,6 +2,7 @@ import type { StagedFile } from "../types.js";
|
|
|
2
2
|
declare const EXECUTABLE_MODE = 493;
|
|
3
3
|
declare const copyInto: (root: string, rel: string, source: string, mode?: number) => StagedFile;
|
|
4
4
|
declare const writeInto: (root: string, rel: string, contents: string, mode?: number) => StagedFile;
|
|
5
|
+
declare const executableModeFor: (path: string) => number;
|
|
5
6
|
declare const copyTree: (root: string, relBase: string, sourceDir: string) => StagedFile[];
|
|
6
|
-
export { copyInto, copyTree, EXECUTABLE_MODE, writeInto };
|
|
7
|
+
export { copyInto, copyTree, EXECUTABLE_MODE, executableModeFor, writeInto };
|
|
7
8
|
//# sourceMappingURL=copy-tree.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copy-tree.d.ts","sourceRoot":"","sources":["../../../src/deploy/payload/copy-tree.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C,QAAA,MAAM,eAAe,MAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"copy-tree.d.ts","sourceRoot":"","sources":["../../../src/deploy/payload/copy-tree.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C,QAAA,MAAM,eAAe,MAAQ,CAAC;AA8B9B,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"}
|
|
@@ -5,6 +5,7 @@ const EXECUTABLE_MODE = 0o755;
|
|
|
5
5
|
const READABLE_MODE = 0o644;
|
|
6
6
|
const EXECUTABLE_SUFFIXES = [".node", ".so"];
|
|
7
7
|
const MODE_MASK = 0o7777;
|
|
8
|
+
const EXECUTE_MASK = 0o111;
|
|
8
9
|
const modeFor = (rel) => {
|
|
9
10
|
const name = rel.split("/").at(-1) ?? rel;
|
|
10
11
|
return EXECUTABLE_SUFFIXES.some((suffix) => name.endsWith(suffix)) ? EXECUTABLE_MODE : READABLE_MODE;
|
|
@@ -30,7 +31,8 @@ const writeInto = (root, rel, contents, mode = READABLE_MODE) => placeFile(root,
|
|
|
30
31
|
writeFileSync(target, contents);
|
|
31
32
|
});
|
|
32
33
|
const sourceMode = (path) => statSync(path).mode & MODE_MASK;
|
|
34
|
+
const executableModeFor = (path) => (sourceMode(path) & EXECUTE_MASK) === 0 ? READABLE_MODE : EXECUTABLE_MODE;
|
|
33
35
|
const copyTree = (root, relBase, sourceDir) => listFilesRecursive(sourceDir)
|
|
34
36
|
.map((file) => copyInto(root, join(relBase, file.rel), file.absPath, sourceMode(file.absPath)));
|
|
35
|
-
export { copyInto, copyTree, EXECUTABLE_MODE, writeInto };
|
|
37
|
+
export { copyInto, copyTree, EXECUTABLE_MODE, executableModeFor, writeInto };
|
|
36
38
|
//# sourceMappingURL=copy-tree.js.map
|
|
@@ -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,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtF,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAEhE,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE,MAAM,eAAe,GAAG,KAAK,CAAC;AAC9B,MAAM,aAAa,GAAG,KAAK,CAAC;AAC5B,MAAM,mBAAmB,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AAC7C,MAAM,SAAS,GAAG,MAAM,CAAC;
|
|
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,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtF,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAEhE,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE,MAAM,eAAe,GAAG,KAAK,CAAC;AAC9B,MAAM,aAAa,GAAG,KAAK,CAAC;AAC5B,MAAM,mBAAmB,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AAC7C,MAAM,SAAS,GAAG,MAAM,CAAC;AACzB,MAAM,YAAY,GAAG,KAAK,CAAC;AAE3B,MAAM,OAAO,GAAG,CAAC,GAAW,EAAU,EAA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,CAAC,EAAc,EAAE,CAC5F,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE;IAClC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AACjC,CAAC,CAAC,CAAC;AAEP,MAAM,SAAS,GAAG,CAAC,IAAY,EAAE,GAAW,EAAE,QAAgB,EAAE,IAAI,GAAG,aAAa,EAAc,EAAE,CAChG,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE;IAClC,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AACpC,CAAC,CAAC,CAAC;AAEP,MAAM,UAAU,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,GAAG,SAAS,CAAC;AAE7E,MAAM,iBAAiB,GAAG,CAAC,IAAY,EAAU,EAAE,CAC/C,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,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 { chmodSync, copyFileSync, mkdirSync, statSync, writeFileSync } from \"node:fs\";\nimport { dirname, isAbsolute, join, relative } 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 const escape = relative(root, abs);\n\n if (escape.length === 0 || escape.startsWith(\"..\") || isAbsolute(escape)) {\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"]}
|