@prisma/compute-sdk 0.47.0 → 0.49.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -18
- package/dist/errors.d.ts +2 -2
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/service/build/build-service.d.ts +3 -3
- package/dist/service/build/build-service.d.ts.map +1 -1
- package/dist/service/build/build-service.js +32 -15
- package/dist/service/build/build-service.js.map +1 -1
- package/dist/service/build/{build-output.d.ts → output-directories.d.ts} +3 -3
- package/dist/service/build/output-directories.d.ts.map +1 -0
- package/dist/service/build/{build-output.js → output-directories.js} +2 -2
- package/dist/service/build/output-directories.js.map +1 -0
- package/dist/service/index.d.ts +3 -3
- package/dist/service/index.d.ts.map +1 -1
- package/dist/service/index.js +3 -3
- package/dist/service/index.js.map +1 -1
- package/dist/service/launcher-contract/start-plan.d.ts +3 -3
- package/dist/service/launcher-contract/start-plan.d.ts.map +1 -1
- package/dist/service/launcher-contract/start-plan.js +3 -3
- package/dist/service/launcher-contract/start-plan.js.map +1 -1
- package/dist/service/output/build-output.d.ts +47 -0
- package/dist/service/output/build-output.d.ts.map +1 -0
- package/dist/service/output/build-output.js +97 -0
- package/dist/service/output/build-output.js.map +1 -0
- package/dist/service/output/copy.d.ts +15 -0
- package/dist/service/output/copy.d.ts.map +1 -0
- package/dist/service/output/copy.js +59 -0
- package/dist/service/output/copy.js.map +1 -0
- package/dist/service/output/entrypoint.d.ts +20 -0
- package/dist/service/output/entrypoint.d.ts.map +1 -0
- package/dist/service/output/entrypoint.js +183 -0
- package/dist/service/output/entrypoint.js.map +1 -0
- package/dist/service/output/exclude.d.ts +6 -0
- package/dist/service/output/exclude.d.ts.map +1 -0
- package/dist/service/{artifact → output}/exclude.js +2 -2
- package/dist/service/output/exclude.js.map +1 -0
- package/dist/service/output/launcher-file.d.ts +3 -0
- package/dist/service/output/launcher-file.d.ts.map +1 -0
- package/dist/service/{artifact → output}/launcher-file.js +1 -1
- package/dist/service/output/launcher-file.js.map +1 -0
- package/dist/service/output/source-files.d.ts +12 -0
- package/dist/service/output/source-files.d.ts.map +1 -0
- package/dist/service/output/source-files.js +46 -0
- package/dist/service/output/source-files.js.map +1 -0
- package/dist/service/output/trace/bins.d.ts +9 -0
- package/dist/service/output/trace/bins.d.ts.map +1 -0
- package/dist/service/output/trace/bins.js +26 -0
- package/dist/service/output/trace/bins.js.map +1 -0
- package/dist/service/output/trace/imports.d.ts +8 -0
- package/dist/service/output/trace/imports.d.ts.map +1 -0
- package/dist/service/output/trace/imports.js +24 -0
- package/dist/service/output/trace/imports.js.map +1 -0
- package/dist/service/output/trace/optional-peer-dependencies.d.ts +13 -0
- package/dist/service/output/trace/optional-peer-dependencies.d.ts.map +1 -0
- package/dist/service/output/trace/optional-peer-dependencies.js +34 -0
- package/dist/service/output/trace/optional-peer-dependencies.js.map +1 -0
- package/dist/service/output/trace/packages.d.ts +22 -0
- package/dist/service/output/trace/packages.d.ts.map +1 -0
- package/dist/service/output/trace/packages.js +50 -0
- package/dist/service/output/trace/packages.js.map +1 -0
- package/dist/service/output/trace/trace.d.ts +32 -0
- package/dist/service/output/trace/trace.d.ts.map +1 -0
- package/dist/service/output/trace/trace.js +53 -0
- package/dist/service/output/trace/trace.js.map +1 -0
- package/dist/service/settings/index.d.ts +1 -1
- package/dist/service/settings/index.d.ts.map +1 -1
- package/dist/service/settings/resolve.d.ts +2 -2
- package/dist/service/settings/resolve.d.ts.map +1 -1
- package/dist/service/settings/resolve.js.map +1 -1
- package/dist/service/settings/start-order.d.ts +2 -2
- package/dist/service/settings/start-order.d.ts.map +1 -1
- package/dist/service/settings/types.d.ts +1 -1
- package/dist/service/settings/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/errors.ts +2 -2
- package/src/service/build/build-service.ts +44 -22
- package/src/service/build/{build-output.ts → output-directories.ts} +3 -3
- package/src/service/index.ts +5 -5
- package/src/service/launcher/main.ts +2 -2
- package/src/service/launcher-contract/start-plan.ts +4 -4
- package/src/service/output/build-output.ts +174 -0
- package/src/service/output/copy.ts +69 -0
- package/src/service/output/entrypoint.ts +250 -0
- package/src/service/{artifact → output}/exclude.ts +2 -2
- package/src/service/{artifact → output}/launcher-file.ts +1 -1
- package/src/service/output/source-files.ts +64 -0
- package/src/service/output/trace/bins.ts +39 -0
- package/src/service/output/trace/imports.ts +37 -0
- package/src/service/output/trace/optional-peer-dependencies.ts +50 -0
- package/src/service/output/trace/packages.ts +81 -0
- package/src/service/output/trace/trace.ts +99 -0
- package/src/service/settings/index.ts +1 -1
- package/src/service/settings/resolve.ts +2 -2
- package/src/service/settings/start-order.ts +2 -2
- package/src/service/settings/types.ts +1 -1
- package/dist/service/artifact/exclude.d.ts +0 -6
- package/dist/service/artifact/exclude.d.ts.map +0 -1
- package/dist/service/artifact/exclude.js.map +0 -1
- package/dist/service/artifact/launcher-file.d.ts +0 -3
- package/dist/service/artifact/launcher-file.d.ts.map +0 -1
- package/dist/service/artifact/launcher-file.js.map +0 -1
- package/dist/service/artifact/write-artifact.d.ts +0 -16
- package/dist/service/artifact/write-artifact.d.ts.map +0 -1
- package/dist/service/artifact/write-artifact.js +0 -24
- package/dist/service/artifact/write-artifact.js.map +0 -1
- package/dist/service/build/build-output.d.ts.map +0 -1
- package/dist/service/build/build-output.js.map +0 -1
- package/src/service/artifact/write-artifact.ts +0 -50
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Copies paths from one folder to the same relative place in another. A link stays a link. */
|
|
2
|
+
export declare class Copy {
|
|
3
|
+
#private;
|
|
4
|
+
files: number;
|
|
5
|
+
bytes: number;
|
|
6
|
+
constructor(from: string, to: string);
|
|
7
|
+
/** One file or link. A folder is only created: its files are copied when they are named. */
|
|
8
|
+
file(source: string): Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
* A package folder with everything in it, except the packages in its own `node_modules`
|
|
11
|
+
* and what `excludedFromBuildOutput` names.
|
|
12
|
+
*/
|
|
13
|
+
packageFolder(dir: string): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=copy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copy.d.ts","sourceRoot":"","sources":["../../../src/service/output/copy.ts"],"names":[],"mappings":"AAYA,+FAA+F;AAC/F,qBAAa,IAAI;;IACf,KAAK,SAAK;IACV,KAAK,SAAK;gBAKE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM;IAKpC,4FAA4F;IACtF,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAwBzC;;;OAGG;IACG,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAchD"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// Copies files of the Service folder to the same place in the build output folder.
|
|
2
|
+
import { copyFile, lstat, mkdir, readdir, readlink, symlink, } from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { excludedFromBuildOutput } from "./exclude.js";
|
|
5
|
+
/** Copies paths from one folder to the same relative place in another. A link stays a link. */
|
|
6
|
+
export class Copy {
|
|
7
|
+
files = 0;
|
|
8
|
+
bytes = 0;
|
|
9
|
+
#from;
|
|
10
|
+
#to;
|
|
11
|
+
#done = new Set();
|
|
12
|
+
constructor(from, to) {
|
|
13
|
+
this.#from = from;
|
|
14
|
+
this.#to = to;
|
|
15
|
+
}
|
|
16
|
+
/** One file or link. A folder is only created: its files are copied when they are named. */
|
|
17
|
+
async file(source) {
|
|
18
|
+
if (this.#done.has(source)) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
this.#done.add(source);
|
|
22
|
+
const info = await lstat(source).catch(() => null);
|
|
23
|
+
if (info === null) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const destination = path.join(this.#to, path.relative(this.#from, source));
|
|
27
|
+
await mkdir(path.dirname(destination), { recursive: true });
|
|
28
|
+
if (info.isSymbolicLink()) {
|
|
29
|
+
await symlink(await readlink(source), destination);
|
|
30
|
+
}
|
|
31
|
+
else if (info.isDirectory()) {
|
|
32
|
+
await mkdir(destination, { recursive: true });
|
|
33
|
+
}
|
|
34
|
+
else if (info.isFile()) {
|
|
35
|
+
await copyFile(source, destination);
|
|
36
|
+
this.files++;
|
|
37
|
+
this.bytes += info.size;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A package folder with everything in it, except the packages in its own `node_modules`
|
|
42
|
+
* and what `excludedFromBuildOutput` names.
|
|
43
|
+
*/
|
|
44
|
+
async packageFolder(dir) {
|
|
45
|
+
for (const entry of await readdir(dir, { withFileTypes: true })) {
|
|
46
|
+
const full = path.join(dir, entry.name);
|
|
47
|
+
if (excludedFromBuildOutput(entry.name)) {
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
if (!entry.isDirectory()) {
|
|
51
|
+
await this.file(full);
|
|
52
|
+
}
|
|
53
|
+
else if (entry.name !== "node_modules") {
|
|
54
|
+
await this.packageFolder(full);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=copy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copy.js","sourceRoot":"","sources":["../../../src/service/output/copy.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,OAAO,EACL,QAAQ,EACR,KAAK,EACL,KAAK,EACL,OAAO,EACP,QAAQ,EACR,OAAO,GACR,MAAM,kBAAkB,CAAC;AAC1B,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAEvD,+FAA+F;AAC/F,MAAM,OAAO,IAAI;IACf,KAAK,GAAG,CAAC,CAAC;IACV,KAAK,GAAG,CAAC,CAAC;IACD,KAAK,CAAS;IACd,GAAG,CAAS;I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I,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC;QAC1B,CAAC;IACH,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,aAAa,CAAC,GAAW;QAC7B,KAAK,MAAM,KAAK,IAAI,MAAM,OAAO,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;YAChE,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;YACxC,IAAI,uBAAuB,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;gBACxC,SAAS;YACX,CAAC;YAED,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;gBACzB,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACxB,CAAC;iBAAM,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;gBACzC,MAAM,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;YACjC,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { PackageJson } from "../settings/types.ts";
|
|
2
|
+
/** What a start command runs. */
|
|
3
|
+
export interface StartCommand {
|
|
4
|
+
/**
|
|
5
|
+
* The files the server starts from, such as `dist/main.js` in `node dist/main.js`,
|
|
6
|
+
* and the files a runtime option preloads, such as `./setup.js` in `node --require ./setup.js server.js`. Absolute.
|
|
7
|
+
*/
|
|
8
|
+
entrypoints: string[];
|
|
9
|
+
/** The names in `node_modules/.bin` that the command runs, such as `tsx` in `tsx src/index.ts`. */
|
|
10
|
+
bins: string[];
|
|
11
|
+
/** The packages a runtime option preloads by name, such as `dotenv` in `node -r dotenv/config server.js`. */
|
|
12
|
+
preloadedPackages: string[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The entrypoints, bins and preloaded packages of `command`, and of the `package.json` scripts it runs.
|
|
16
|
+
* A word that is neither a runtime, a script nor a bin is left out: it is a shell
|
|
17
|
+
* built-in or something the machine provides.
|
|
18
|
+
*/
|
|
19
|
+
export declare function readStartCommand(serviceDir: string, command: string, packageJson: PackageJson): StartCommand;
|
|
20
|
+
//# sourceMappingURL=entrypoint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entrypoint.d.ts","sourceRoot":"","sources":["../../../src/service/output/entrypoint.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGxD,iCAAiC;AACjC,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,mGAAmG;IACnG,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,6GAA6G;IAC7G,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC7B;AA4BD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,WAAW,GACvB,YAAY,CAad"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
// Reads a start command: the entrypoints of the server, and the bins it runs.
|
|
2
|
+
// The command is never changed. The Launcher runs it as written.
|
|
3
|
+
import { existsSync, realpathSync, statSync } from "node:fs";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { excludedFromBuildOutput } from "./exclude.js";
|
|
6
|
+
const SOURCE_FILE = /\.(c|m)?(j|t)sx?$/;
|
|
7
|
+
const RUNTIMES = new Set(["node", "bun", "deno", "tsx", "ts-node"]);
|
|
8
|
+
const PACKAGE_MANAGERS = new Set(["npm", "pnpm", "yarn", "bun"]);
|
|
9
|
+
/** Runtime options that preload a module before the entrypoint: `--require ./setup.js` or `--require=./setup.js`. */
|
|
10
|
+
const PRELOAD_OPTIONS = new Set([
|
|
11
|
+
"-r",
|
|
12
|
+
"--require",
|
|
13
|
+
"--import",
|
|
14
|
+
"--loader",
|
|
15
|
+
"--experimental-loader",
|
|
16
|
+
"--preload",
|
|
17
|
+
]);
|
|
18
|
+
/** Node.js reads the value of a preload option as a file only when it is a path. Any other value names a package. */
|
|
19
|
+
const FILE_PATH = /^\.{0,2}\//;
|
|
20
|
+
/** Words that run the command after them. */
|
|
21
|
+
const PREFIXES = new Set([
|
|
22
|
+
"cross-env",
|
|
23
|
+
"dotenv",
|
|
24
|
+
"dotenvx",
|
|
25
|
+
"env",
|
|
26
|
+
"exec",
|
|
27
|
+
"npx",
|
|
28
|
+
"bunx",
|
|
29
|
+
"pnpx",
|
|
30
|
+
]);
|
|
31
|
+
/**
|
|
32
|
+
* The entrypoints, bins and preloaded packages of `command`, and of the `package.json` scripts it runs.
|
|
33
|
+
* A word that is neither a runtime, a script nor a bin is left out: it is a shell
|
|
34
|
+
* built-in or something the machine provides.
|
|
35
|
+
*/
|
|
36
|
+
export function readStartCommand(serviceDir, command, packageJson) {
|
|
37
|
+
const found = {
|
|
38
|
+
entrypoints: [],
|
|
39
|
+
bins: [],
|
|
40
|
+
preloadedPackages: [],
|
|
41
|
+
};
|
|
42
|
+
read(serviceDir, command, packageJson, found, new Set());
|
|
43
|
+
return {
|
|
44
|
+
entrypoints: [...new Set(found.entrypoints)],
|
|
45
|
+
bins: [...new Set(found.bins)],
|
|
46
|
+
preloadedPackages: [...new Set(found.preloadedPackages)],
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function read(serviceDir, command, packageJson, found, seenScripts) {
|
|
50
|
+
const scripts = packageJson.scripts ?? {};
|
|
51
|
+
for (const simple of command.split(/&&|\|\||;|\|/)) {
|
|
52
|
+
const [name, ...rest] = wordsOf(simple);
|
|
53
|
+
if (name === undefined) {
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
const positional = rest.filter((word) => !word.startsWith("-"));
|
|
57
|
+
const script = scriptName(name, positional, scripts);
|
|
58
|
+
if (script !== undefined) {
|
|
59
|
+
if (!seenScripts.has(script)) {
|
|
60
|
+
seenScripts.add(script);
|
|
61
|
+
// npm runs `prestart` and `poststart` around `start`.
|
|
62
|
+
for (const hook of [`pre${script}`, script, `post${script}`]) {
|
|
63
|
+
const text = scripts[hook];
|
|
64
|
+
if (text !== undefined) {
|
|
65
|
+
read(serviceDir, text, packageJson, found, seenScripts);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
// A runtime takes one file. A bin may take several: `react-router-serve ./build/server/index.js`.
|
|
72
|
+
const runtime = RUNTIMES.has(name)
|
|
73
|
+
? readRuntimeWords(rest, (word) => resolveFile(serviceDir, word, packageJson))
|
|
74
|
+
: null;
|
|
75
|
+
const files = runtime?.files ?? positional.filter((word) => SOURCE_FILE.test(word));
|
|
76
|
+
found.preloadedPackages.push(...(runtime?.packages ?? []));
|
|
77
|
+
for (const word of files) {
|
|
78
|
+
const file = resolveFile(serviceDir, word, packageJson);
|
|
79
|
+
if (file !== null) {
|
|
80
|
+
found.entrypoints.push(file);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (existsSync(path.join(serviceDir, "node_modules", ".bin", name))) {
|
|
84
|
+
found.bins.push(name);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/** The words of one simple command, without the variable assignments and prefixes in front of it. */
|
|
89
|
+
function wordsOf(simple) {
|
|
90
|
+
let words = simple.trim().split(/\s+/).filter(Boolean);
|
|
91
|
+
for (;;) {
|
|
92
|
+
const [first] = words;
|
|
93
|
+
if (first === undefined) {
|
|
94
|
+
return [];
|
|
95
|
+
}
|
|
96
|
+
const isAssignment = /^[A-Za-z_][A-Za-z0-9_]*=/.test(first);
|
|
97
|
+
if (!isAssignment && !PREFIXES.has(first) && first !== "--") {
|
|
98
|
+
return words;
|
|
99
|
+
}
|
|
100
|
+
words = words.slice(1);
|
|
101
|
+
while (words[0]?.startsWith("-") && words[0] !== "--") {
|
|
102
|
+
words = words.slice(1);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* The files a runtime runs and the packages it preloads, from the words after its name.
|
|
108
|
+
*
|
|
109
|
+
* Its entrypoint is the first word that names a script by its extension. With none, it is the
|
|
110
|
+
* first word that names a file, as `bin/www` in `node ./bin/www`. The value of another option
|
|
111
|
+
* can come first, as `.env` in `node --env-file .env server.js`, so a script wins over it
|
|
112
|
+
* and a dotenv file is never the entrypoint.
|
|
113
|
+
*/
|
|
114
|
+
function readRuntimeWords(words, resolve) {
|
|
115
|
+
const files = [];
|
|
116
|
+
const packages = [];
|
|
117
|
+
let withoutExtension;
|
|
118
|
+
for (let index = 0; index < words.length; index++) {
|
|
119
|
+
const word = words[index] ?? "";
|
|
120
|
+
const [option = "", ...value] = word.split("=");
|
|
121
|
+
if (PRELOAD_OPTIONS.has(option)) {
|
|
122
|
+
const preloaded = value.length > 0 ? value.join("=") : words[++index];
|
|
123
|
+
if (preloaded === undefined) {
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
if (FILE_PATH.test(preloaded)) {
|
|
127
|
+
files.push(preloaded);
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
packages.push(packageNameOf(preloaded));
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
else if (!word.startsWith("-")) {
|
|
134
|
+
const file = resolve(word);
|
|
135
|
+
if (file !== null && SOURCE_FILE.test(file)) {
|
|
136
|
+
return { files: [...files, word], packages };
|
|
137
|
+
}
|
|
138
|
+
const isDotenv = excludedFromBuildOutput(path.basename(file ?? ""));
|
|
139
|
+
if (file !== null && !isDotenv) {
|
|
140
|
+
withoutExtension ??= word;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
if (withoutExtension !== undefined) {
|
|
145
|
+
files.push(withoutExtension);
|
|
146
|
+
}
|
|
147
|
+
return { files, packages };
|
|
148
|
+
}
|
|
149
|
+
/** The package a module name is in: `dotenv` for `dotenv/config`, `@scope/name` for `@scope/name/register`. */
|
|
150
|
+
function packageNameOf(moduleName) {
|
|
151
|
+
return moduleName
|
|
152
|
+
.split("/")
|
|
153
|
+
.slice(0, moduleName.startsWith("@") ? 2 : 1)
|
|
154
|
+
.join("/");
|
|
155
|
+
}
|
|
156
|
+
/** The `package.json` script that `npm run x`, `npm start` or `yarn x` runs, if the words name one. */
|
|
157
|
+
function scriptName(packageManager, positional, scripts) {
|
|
158
|
+
if (!PACKAGE_MANAGERS.has(packageManager)) {
|
|
159
|
+
return undefined;
|
|
160
|
+
}
|
|
161
|
+
const [first, second] = positional;
|
|
162
|
+
const name = first === "run" || first === "run-script" ? second : first;
|
|
163
|
+
return name !== undefined && scripts[name] !== undefined ? name : undefined;
|
|
164
|
+
}
|
|
165
|
+
/** The file a word names, as Node.js resolves a path to run: the file, with an extension added, or a folder's index. */
|
|
166
|
+
function resolveFile(serviceDir, word, packageJson) {
|
|
167
|
+
const target = path.resolve(serviceDir, word);
|
|
168
|
+
const candidates = [
|
|
169
|
+
target,
|
|
170
|
+
`${target}.js`,
|
|
171
|
+
`${target}.mjs`,
|
|
172
|
+
`${target}.cjs`,
|
|
173
|
+
`${target}.ts`,
|
|
174
|
+
path.join(target, "index.js"),
|
|
175
|
+
path.join(target, "index.mjs"),
|
|
176
|
+
];
|
|
177
|
+
if (target === serviceDir) {
|
|
178
|
+
candidates.unshift(path.resolve(serviceDir, packageJson.main ?? "index.js"));
|
|
179
|
+
}
|
|
180
|
+
const found = candidates.find((file) => existsSync(file) && statSync(file).isFile());
|
|
181
|
+
return found === undefined ? null : realpathSync(found);
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=entrypoint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entrypoint.js","sourceRoot":"","sources":["../../../src/service/output/entrypoint.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,iEAAiE;AACjE,OAAO,EAAE,UAAU,EAAE,Y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,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* True for a file or folder that never goes into a build output, at any depth.
|
|
3
|
+
* A CI checkout keeps a token in `.git`, and dotenv files hold local secrets.
|
|
4
|
+
*/
|
|
5
|
+
export declare function excludedFromBuildOutput(name: string): boolean;
|
|
6
|
+
//# sourceMappingURL=exclude.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exclude.d.ts","sourceRoot":"","sources":["../../../src/service/output/exclude.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE7D"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* True for a file or folder that never goes into
|
|
2
|
+
* True for a file or folder that never goes into a build output, at any depth.
|
|
3
3
|
* A CI checkout keeps a token in `.git`, and dotenv files hold local secrets.
|
|
4
4
|
*/
|
|
5
|
-
export function
|
|
5
|
+
export function excludedFromBuildOutput(name) {
|
|
6
6
|
return name === ".git" || name === ".env" || name.startsWith(".env.");
|
|
7
7
|
}
|
|
8
8
|
//# sourceMappingURL=exclude.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exclude.js","sourceRoot":"","sources":["../../../src/service/output/exclude.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CAAC,IAAY;IAClD,OAAO,IAAI,KAAK,MAAM,IAAI,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"launcher-file.d.ts","sourceRoot":"","sources":["../../../src/service/output/launcher-file.ts"],"names":[],"mappings":"AAMA,+EAA+E;AAC/E,wBAAgB,YAAY,IAAI,MAAM,CAUrC"}
|
|
@@ -2,7 +2,7 @@ import { existsSync } from "node:fs";
|
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
3
|
/** The one-file Launcher, relative to this folder. `src/` and `dist/` hold this folder at the same depth, so one path fits both. */
|
|
4
4
|
const BUNDLED_LAUNCHER = "../../../dist/service/launcher.mjs";
|
|
5
|
-
/** The path of the Launcher as one file, ready to copy into
|
|
5
|
+
/** The path of the Launcher as one file, ready to copy into a build output. */
|
|
6
6
|
export function launcherFile() {
|
|
7
7
|
const file = fileURLToPath(new URL(BUNDLED_LAUNCHER, import.meta.url));
|
|
8
8
|
if (!existsSync(file)) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"launcher-file.js","sourceRoot":"","sources":["../../../src/service/output/launcher-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,oIAAoI;AACpI,MAAM,gBAAgB,GAAG,oCAAoC,CAAC;AAE9D,+EAA+E;AAC/E,MAAM,UAAU,YAAY;IAC1B,MAAM,IAAI,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,gBAAgB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAEvE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CACb,8BAA8B,IAAI,uFAAuF,CAC1H,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { OutputDirectories } from "../settings/types.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Every file of the Service folder except the installed `node_modules`, `.prisma`,
|
|
4
|
+
* and what `excludedFromBuildOutput` names.
|
|
5
|
+
*
|
|
6
|
+
* An output directory is kept with a `node_modules` folder of its own: Nuxt and
|
|
7
|
+
* Next.js put the packages their server needs there. Its cache folders are left out.
|
|
8
|
+
*/
|
|
9
|
+
export declare function sourceFiles(serviceDir: string, outputDirectories: OutputDirectories, signal?: AbortSignal): Promise<string[]>;
|
|
10
|
+
/** True when `file` is in one of the output directories. */
|
|
11
|
+
export declare function inOutputDirectory(serviceDir: string, outputDirectories: OutputDirectories, file: string): boolean;
|
|
12
|
+
//# sourceMappingURL=source-files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-files.d.ts","sourceRoot":"","sources":["../../../src/service/output/source-files.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAM9D;;;;;;GAMG;AACH,wBAAsB,WAAW,CAC/B,UAAU,EAAE,MAAM,EAClB,iBAAiB,EAAE,iBAAiB,EACpC,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,MAAM,EAAE,CAAC,CAgCnB;AAED,4DAA4D;AAC5D,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,EAClB,iBAAiB,EAAE,iBAAiB,EACpC,IAAI,EAAE,MAAM,GACX,OAAO,CAIT"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// The files of a Service that are its own: the repository's files and the output directories.
|
|
2
|
+
import { readdir } from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { excludedFromBuildOutput } from "./exclude.js";
|
|
5
|
+
/** Build caches inside an output directory. Nothing reads them at run time. */
|
|
6
|
+
const CACHE_FOLDERS = new Set(["cache", ".cache"]);
|
|
7
|
+
/**
|
|
8
|
+
* Every file of the Service folder except the installed `node_modules`, `.prisma`,
|
|
9
|
+
* and what `excludedFromBuildOutput` names.
|
|
10
|
+
*
|
|
11
|
+
* An output directory is kept with a `node_modules` folder of its own: Nuxt and
|
|
12
|
+
* Next.js put the packages their server needs there. Its cache folders are left out.
|
|
13
|
+
*/
|
|
14
|
+
export async function sourceFiles(serviceDir, outputDirectories, signal) {
|
|
15
|
+
const outputDirs = new Set(outputDirectories.newDirs);
|
|
16
|
+
const found = [];
|
|
17
|
+
async function walk(dir, inOutputDir) {
|
|
18
|
+
signal?.throwIfAborted();
|
|
19
|
+
for (const entry of await readdir(dir, { withFileTypes: true })) {
|
|
20
|
+
const full = path.join(dir, entry.name);
|
|
21
|
+
if (excludedFromBuildOutput(entry.name)) {
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
if (!entry.isDirectory()) {
|
|
25
|
+
found.push(full);
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
const atRoot = dir === serviceDir;
|
|
29
|
+
const output = inOutputDir || (atRoot && outputDirs.has(entry.name));
|
|
30
|
+
const left = (entry.name === "node_modules" && !output) ||
|
|
31
|
+
(atRoot && entry.name === ".prisma") ||
|
|
32
|
+
(inOutputDir && CACHE_FOLDERS.has(entry.name));
|
|
33
|
+
if (!left) {
|
|
34
|
+
await walk(full, output);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
await walk(serviceDir, false);
|
|
39
|
+
return found;
|
|
40
|
+
}
|
|
41
|
+
/** True when `file` is in one of the output directories. */
|
|
42
|
+
export function inOutputDirectory(serviceDir, outputDirectories, file) {
|
|
43
|
+
const [top] = path.relative(serviceDir, file).split(path.sep);
|
|
44
|
+
return top !== undefined && outputDirectories.newDirs.includes(top);
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=source-files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-files.js","sourceRoot":"","sources":["../../../src/service/output/source-files.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAEvD,+EAA+E;AAC/E,MAAM,aAAa,GAAG,IAAI,GAAG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,CAAC;YAC3B,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IAE9B,OAAO,KAAK,CAAC;AACf,CAAC;AAED,4DAA4D;AAC5D,MAAM,UAAU,iBAAiB,CAC/B,UAAkB,EAClB,iBAAoC,EACpC,IAAY;IAEZ,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAE9D,OAAO,GAAG,KAAK,SAAS,IAAI,iBAAiB,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AACtE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type InstalledPackage } from "./packages.ts";
|
|
2
|
+
/**
|
|
3
|
+
* The packages of the bins, each with the packages it depends on.
|
|
4
|
+
*
|
|
5
|
+
* A bin loads its own files by path, which imports do not show: tracing `tsx` misses
|
|
6
|
+
* a file it needs. So the package of a bin goes into the build output whole.
|
|
7
|
+
*/
|
|
8
|
+
export declare function binPackages(serviceDir: string, bins: string[]): Map<string, InstalledPackage>;
|
|
9
|
+
//# sourceMappingURL=bins.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bins.d.ts","sourceRoot":"","sources":["../../../../src/service/output/trace/bins.ts"],"names":[],"mappings":"AAGA,OAAO,EAGL,KAAK,gBAAgB,EAGtB,MAAM,eAAe,CAAC;AAEvB;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EAAE,GACb,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAkB/B"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// A bin the start command runs, such as `tsx` or `react-router-serve`.
|
|
2
|
+
import { realpathSync } from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { addWithDependencies, findPackage, packageDirOf, readManifest, } from "./packages.js";
|
|
5
|
+
/**
|
|
6
|
+
* The packages of the bins, each with the packages it depends on.
|
|
7
|
+
*
|
|
8
|
+
* A bin loads its own files by path, which imports do not show: tracing `tsx` misses
|
|
9
|
+
* a file it needs. So the package of a bin goes into the build output whole.
|
|
10
|
+
*/
|
|
11
|
+
export function binPackages(serviceDir, bins) {
|
|
12
|
+
const found = new Map();
|
|
13
|
+
for (const name of bins) {
|
|
14
|
+
const bin = path.join(serviceDir, "node_modules", ".bin", name);
|
|
15
|
+
const dir = packageDirOf(realpathSync(bin));
|
|
16
|
+
if (dir === null) {
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
// Under pnpm the package is reached through a link in `node_modules`, which the bin's own link points at.
|
|
20
|
+
const packageName = readManifest(dir).name;
|
|
21
|
+
const installed = packageName === undefined ? null : findPackage(serviceDir, packageName);
|
|
22
|
+
addWithDependencies(installed ?? { link: dir, dir }, found);
|
|
23
|
+
}
|
|
24
|
+
return found;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=bins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bins.js","sourceRoot":"","sources":["../../../../src/service/output/trace/bins.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACL,mBAAmB,EACnB,WAAW,EAEX,YAAY,EACZ,YAAY,GACb,MAAM,eAAe,CAAC;AAEvB;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CACzB,UAAkB,EAClB,IAAc;IAEd,MAAM,KAAK,GAAG,IAAI,GAAG,EAA4B,CAAC;IAElD,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;QACxB,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QAChE,MAAM,GAAG,GAAG,YAAY,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;QAC5C,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;YACjB,SAAS;QACX,CAAC;QAED,0GAA0G;QAC1G,MAAM,WAAW,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;QAC3C,MAAM,SAAS,GACb,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;QAC1E,mBAAmB,CAAC,SAAS,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,KAAK,CAAC,CAAC;IAC9D,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every file that `files` import, directly or through other files. Absolute paths.
|
|
3
|
+
*
|
|
4
|
+
* Compute runs a Service with Bun, which reads a package's `bun` export condition.
|
|
5
|
+
* nft's `conditions` replaces the default set, so the imports are followed twice.
|
|
6
|
+
*/
|
|
7
|
+
export declare function traceImports(files: string[], serviceDir: string): Promise<string[]>;
|
|
8
|
+
//# sourceMappingURL=imports.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imports.d.ts","sourceRoot":"","sources":["../../../../src/service/output/trace/imports.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,wBAAsB,YAAY,CAChC,KAAK,EAAE,MAAM,EAAE,EACf,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,EAAE,CAAC,CAuBnB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Follows imports from files with `@vercel/nft`.
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { nodeFileTrace } from "@vercel/nft";
|
|
4
|
+
/**
|
|
5
|
+
* Every file that `files` import, directly or through other files. Absolute paths.
|
|
6
|
+
*
|
|
7
|
+
* Compute runs a Service with Bun, which reads a package's `bun` export condition.
|
|
8
|
+
* nft's `conditions` replaces the default set, so the imports are followed twice.
|
|
9
|
+
*/
|
|
10
|
+
export async function traceImports(files, serviceDir) {
|
|
11
|
+
if (files.length === 0) {
|
|
12
|
+
return [];
|
|
13
|
+
}
|
|
14
|
+
const base = path.parse(serviceDir).root;
|
|
15
|
+
const traces = await Promise.all([undefined, ["bun"]].map((conditions) => nodeFileTrace(files, {
|
|
16
|
+
base,
|
|
17
|
+
processCwd: serviceDir,
|
|
18
|
+
...(conditions ? { conditions } : {}),
|
|
19
|
+
})));
|
|
20
|
+
return [
|
|
21
|
+
...new Set(traces.flatMap((trace) => [...trace.fileList].map((file) => path.join(base, file)))),
|
|
22
|
+
];
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=imports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imports.js","sourceRoot":"","sources":["../../../../src/service/output/trace/imports.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,KAAe,EACf,UAAkB;IAElB,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC;IACzC,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,GAAG,CAC9B,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CACtC,aAAa,CAAC,KAAK,EAAE;QACnB,IAAI;QACJ,UAAU,EAAE,UAAU;QACtB,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACtC,CAAC,CACH,CACF,CAAC;IAEF,OAAO;QACL,GAAG,IAAI,GAAG,CACR,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CACvB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CACzD,CACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PackageJson } from "../../settings/types.ts";
|
|
2
|
+
import { type InstalledPackage } from "./packages.ts";
|
|
3
|
+
/**
|
|
4
|
+
* A package loaded by a name held in a variable does not show as an import:
|
|
5
|
+
* sequelize loads `pg` that way. Such packages are declared as optional peer dependencies.
|
|
6
|
+
*
|
|
7
|
+
* When a traced package declares one and the Service lists it in `dependencies`,
|
|
8
|
+
* the Service installed it for that package, and it belongs in the build output.
|
|
9
|
+
*/
|
|
10
|
+
export declare function optionalPeerDependencies(serviceDir: string, packageJson: PackageJson, tracedFiles: string[]): Array<InstalledPackage & {
|
|
11
|
+
name: string;
|
|
12
|
+
}>;
|
|
13
|
+
//# sourceMappingURL=optional-peer-dependencies.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optional-peer-dependencies.d.ts","sourceRoot":"","sources":["../../../../src/service/output/trace/optional-peer-dependencies.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAEL,KAAK,gBAAgB,EAGtB,MAAM,eAAe,CAAC;AAEvB;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,MAAM,EAAE,GACpB,KAAK,CAAC,gBAAgB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CA6B5C"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { findPackage, packageDirOf, readManifest, } from "./packages.js";
|
|
2
|
+
/**
|
|
3
|
+
* A package loaded by a name held in a variable does not show as an import:
|
|
4
|
+
* sequelize loads `pg` that way. Such packages are declared as optional peer dependencies.
|
|
5
|
+
*
|
|
6
|
+
* When a traced package declares one and the Service lists it in `dependencies`,
|
|
7
|
+
* the Service installed it for that package, and it belongs in the build output.
|
|
8
|
+
*/
|
|
9
|
+
export function optionalPeerDependencies(serviceDir, packageJson, tracedFiles) {
|
|
10
|
+
const listed = new Set(Object.keys(packageJson.dependencies ?? {}));
|
|
11
|
+
const tracedPackages = new Set();
|
|
12
|
+
for (const file of tracedFiles) {
|
|
13
|
+
const dir = packageDirOf(file);
|
|
14
|
+
if (dir !== null) {
|
|
15
|
+
tracedPackages.add(dir);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
const tracedNames = new Set([...tracedPackages].map((dir) => readManifest(dir).name));
|
|
19
|
+
const found = new Map();
|
|
20
|
+
for (const dir of tracedPackages) {
|
|
21
|
+
const declared = readManifest(dir).peerDependenciesMeta ?? {};
|
|
22
|
+
for (const [name, { optional }] of Object.entries(declared)) {
|
|
23
|
+
if (!optional || !listed.has(name) || tracedNames.has(name)) {
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
const installed = findPackage(serviceDir, name);
|
|
27
|
+
if (installed !== null) {
|
|
28
|
+
found.set(name, installed);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return [...found].map(([name, installed]) => ({ name, ...installed }));
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=optional-peer-dependencies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optional-peer-dependencies.js","sourceRoot":"","sources":["../../../../src/service/output/trace/optional-peer-dependencies.ts"],"names":[],"mappings":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AAS,KAAK,IAAI,EAAE,CAAC;gBACvB,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;YAC7B,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,SAAS,EAAE,CAAC,CAAC,CAAC;AACzE,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** A package as it is found: `link` is the path it is reached by, a link under pnpm. `dir` holds its files. */
|
|
2
|
+
export interface InstalledPackage {
|
|
3
|
+
link: string;
|
|
4
|
+
dir: string;
|
|
5
|
+
}
|
|
6
|
+
/** The fields of a dependency's `package.json` that tracing reads. */
|
|
7
|
+
export interface PackageManifest {
|
|
8
|
+
name?: string;
|
|
9
|
+
dependencies?: Record<string, string>;
|
|
10
|
+
optionalDependencies?: Record<string, string>;
|
|
11
|
+
peerDependenciesMeta?: Record<string, {
|
|
12
|
+
optional?: boolean;
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
15
|
+
export declare function readManifest(packageDir: string): PackageManifest;
|
|
16
|
+
/** Finds a package the way Node.js does: in the `node_modules` of `from` and of each folder above it. */
|
|
17
|
+
export declare function findPackage(from: string, name: string): InstalledPackage | null;
|
|
18
|
+
/** The folder of the package that holds `file`: the nearest folder with a `package.json` that sits in a `node_modules`. */
|
|
19
|
+
export declare function packageDirOf(file: string): string | null;
|
|
20
|
+
/** Adds a package and, in turn, every package it depends on. */
|
|
21
|
+
export declare function addWithDependencies(installed: InstalledPackage, found: Map<string, InstalledPackage>): void;
|
|
22
|
+
//# sourceMappingURL=packages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"packages.d.ts","sourceRoot":"","sources":["../../../../src/service/output/trace/packages.ts"],"names":[],"mappings":"AAIA,+GAA+G;AAC/G,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAED,sEAAsE;AACtE,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9C,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;CAC/D;AAED,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,eAAe,CAQhE;AAED,yGAAyG;AACzG,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GACX,gBAAgB,GAAG,IAAI,CASzB;AAED,2HAA2H;AAC3H,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAcxD;AAED,gEAAgE;AAChE,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,gBAAgB,EAC3B,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,GACnC,IAAI,CAgBN"}
|