@prisma/compute-sdk 0.48.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 +22 -2
- package/dist/service/build/build-service.d.ts +1 -1
- package/dist/service/build/build-service.d.ts.map +1 -1
- package/dist/service/build/build-service.js +14 -5
- package/dist/service/build/build-service.js.map +1 -1
- package/dist/service/index.d.ts +1 -1
- package/dist/service/index.d.ts.map +1 -1
- package/dist/service/index.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/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/package.json +1 -1
- package/src/service/build/build-service.ts +15 -8
- package/src/service/index.ts +1 -1
- 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/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/dist/service/output/write-build-output.d.ts +0 -16
- package/dist/service/output/write-build-output.d.ts.map +0 -1
- package/dist/service/output/write-build-output.js +0 -24
- package/dist/service/output/write-build-output.js.map +0 -1
- package/src/service/output/write-build-output.ts +0 -50
package/README.md
CHANGED
|
@@ -597,11 +597,31 @@ if (built.isErr()) {
|
|
|
597
597
|
|
|
598
598
|
The install command runs with `NODE_ENV=development`, because dev dependencies hold the build tools. A `NODE_ENV` in `env` does not change that. The build command runs with `NODE_ENV=production` unless `env` sets another value.
|
|
599
599
|
|
|
600
|
-
|
|
600
|
+
### What the build output holds
|
|
601
|
+
|
|
602
|
+
Compute unpacks the build output on every start, so it holds only what the Service needs to run. `output.kind` says which of three it is:
|
|
603
|
+
|
|
604
|
+
| `kind` | The folder | When |
|
|
605
|
+
| --- | --- | --- |
|
|
606
|
+
| `"static site"` | The folder of static files the build wrote | The start is a folder of static files |
|
|
607
|
+
| `"traced server"` | `.prisma/output`: the source files and the trace of the server | The start is a command |
|
|
608
|
+
| `"whole folder"` | The Service folder, with all of `node_modules` | The server cannot be traced. `output.reason` says why, and the Build settings get a note. |
|
|
609
|
+
|
|
610
|
+
The **source files** are the repository's files and the output directories of the build. The installed `node_modules` is not among them. A `node_modules` folder inside an output directory is kept, because Nuxt and Next.js put their server's packages there.
|
|
611
|
+
|
|
612
|
+
The **trace** is every file of `node_modules` that the server loads. It starts from the entrypoints that the start command runs, such as `dist/main.js` in `node dist/main.js`. A file that a runtime option preloads is an entrypoint too, such as `./setup.js` in `node --require ./setup.js server.js`:
|
|
613
|
+
|
|
614
|
+
1. The imports of the entrypoints and of the scripts in the output directories, followed with `@vercel/nft`.
|
|
615
|
+
2. Whole, the package of a bin the start command runs, such as `tsx`, with its dependencies. A bin loads its own files by path, which imports do not show. A package that a runtime option preloads goes in the same way, such as `dotenv` in `node -r dotenv/config server.js`.
|
|
616
|
+
3. An optional peer dependency of a traced package, when the Service lists it in `dependencies`. sequelize loads `pg` by a name held in a variable.
|
|
617
|
+
|
|
618
|
+
The start command is not changed. The Launcher runs it as written.
|
|
619
|
+
|
|
620
|
+
A server cannot be traced when the start command runs no file and no bin (`./run.sh`), or when it imports files from outside the Service folder, as in a workspace.
|
|
601
621
|
|
|
602
622
|
### What the caller does next
|
|
603
623
|
|
|
604
|
-
The build output is a folder (`output.dir
|
|
624
|
+
The build output is a folder (`output.dir`, a real path) and an entry file (`output.entrypoint`, relative to the folder). The caller copies or uploads the folder and tells Compute to start the entry file with Bun.
|
|
605
625
|
|
|
606
626
|
The caller leaves out every file and folder that `excludedFromBuildOutput` names, at every depth: `.git` and dotenv files (`.env`, `.env.*`). A CI checkout keeps a token in `.git`, and a dotenv file holds local secrets. Set the values the Service needs as variables on the project.
|
|
607
627
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Result } from "better-result";
|
|
2
2
|
import { ServiceBuildError } from "../../errors.ts";
|
|
3
|
-
import { type BuildOutput } from "../output/
|
|
3
|
+
import { type BuildOutput } from "../output/build-output.ts";
|
|
4
4
|
import type { Resolved, ServiceBuildSettings, ServiceConfig, Start } from "../settings/types.ts";
|
|
5
5
|
import { type BuildStep } from "./run-step.ts";
|
|
6
6
|
export interface BuildServiceOptions {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-service.d.ts","sourceRoot":"","sources":["../../../src/service/build/build-service.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,
|
|
1
|
+
{"version":3,"file":"build-service.d.ts","sourceRoot":"","sources":["../../../src/service/build/build-service.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,KAAK,WAAW,EAAoB,MAAM,2BAA2B,CAAC;AAM/E,OAAO,KAAK,EAGV,QAAQ,EACR,oBAAoB,EACpB,aAAa,EACb,KAAK,EACN,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EACL,KAAK,SAAS,EAIf,MAAM,eAAe,CAAC;AAEvB,MAAM,WAAW,mBAAmB;IAClC,0BAA0B;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,0DAA0D;IAC1D,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,0DAA0D;IAC1D,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,mDAAmD;IACnD,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;IACvB,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,MAAM,EAAE,WAAW,CAAC;CACrB;AAiBD;;;;;GAKG;AACH,wBAAsB,YAAY,CAChC,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,iBAAiB,CAAC,CAAC,CAmDlD"}
|
|
@@ -4,7 +4,8 @@ import { existsSync, readFileSync } from "node:fs";
|
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import { Result } from "better-result";
|
|
6
6
|
import { ServiceBuildError } from "../../errors.js";
|
|
7
|
-
import { writeBuildOutput
|
|
7
|
+
import { writeBuildOutput } from "../output/build-output.js";
|
|
8
|
+
import { readPackageJson } from "../settings/package-json.js";
|
|
8
9
|
import { resolveServiceBuildSettings, resolveStartAfterBuild, } from "../settings/resolve.js";
|
|
9
10
|
import { outputDirectoriesSince, snapshotFolders, } from "./output-directories.js";
|
|
10
11
|
import { runStep, } from "./run-step.js";
|
|
@@ -39,14 +40,22 @@ export async function buildService(options) {
|
|
|
39
40
|
if (start === null) {
|
|
40
41
|
return fail(NO_START);
|
|
41
42
|
}
|
|
42
|
-
const
|
|
43
|
-
const output = writeBuildOutput({
|
|
43
|
+
const output = await writeBuildOutput({
|
|
44
44
|
serviceDir: dir,
|
|
45
45
|
start: start.value,
|
|
46
|
-
port,
|
|
46
|
+
port: settings.port?.value ?? null,
|
|
47
|
+
packageJson: (await readPackageJson(read)).packageJson,
|
|
48
|
+
outputDirectories: outputDirectories.value,
|
|
49
|
+
signal: options.signal,
|
|
47
50
|
});
|
|
51
|
+
const notes = output.kind === "whole folder"
|
|
52
|
+
? [
|
|
53
|
+
...settings.notes,
|
|
54
|
+
`The build output is the whole folder, with all of node_modules: ${output.reason}.`,
|
|
55
|
+
]
|
|
56
|
+
: settings.notes;
|
|
48
57
|
return Result.ok({
|
|
49
|
-
settings: { ...settings, start },
|
|
58
|
+
settings: { ...settings, start, notes },
|
|
50
59
|
start,
|
|
51
60
|
steps,
|
|
52
61
|
output,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-service.js","sourceRoot":"","sources":["../../../src/service/build/build-service.ts"],"names":[],"mappings":"AAAA,qGAAqG;AACrG,mFAAmF;AACnF,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,
|
|
1
|
+
{"version":3,"file":"build-service.js","sourceRoot":"","sources":["../../../src/service/build/build-service.ts"],"names":[],"mappings":"AAAA,qGAAqG;AACrG,mFAAmF;AACnF,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAoB,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EACL,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAShC,OAAO,EACL,sBAAsB,EACtB,eAAe,GAChB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEL,OAAO,GAGR,MAAM,eAAe,CAAC;AAwBvB,2FAA2F;AAC3F,MAAM,aAAa,GAAG;IACpB,OAAO,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,SAAS,EAAE;IACrD,KAAK,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,OAAO,EAAE;CACvC,CAAC;AAEX,MAAM,QAAQ,GAAY;IACxB,IAAI,EAAE,UAAU;IAChB,OAAO,EACL,mGAAmG;CACtG,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,OAA4B;IAE5B,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;IACxB,MAAM,IA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AC/E,CAAC"}
|
package/dist/service/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { ServiceBuildError } from "../errors.ts";
|
|
2
2
|
export { type BuildServiceOptions, type BuiltService, buildService, } from "./build/build-service.ts";
|
|
3
3
|
export type { BuildStep } from "./build/run-step.ts";
|
|
4
|
+
export type { BuildOutput, TraceSummary } from "./output/build-output.ts";
|
|
4
5
|
export { excludedFromBuildOutput } from "./output/exclude.ts";
|
|
5
|
-
export type { BuildOutput } from "./output/write-build-output.ts";
|
|
6
6
|
export { isDevCommand, type OutputDirectories, type PackageManager, type ReadFile, type Resolved, resolveServiceBuildSettings, resolveStartAfterBuild, type ServiceBuildSettings, type ServiceConfig, type Source, type Start, } from "./settings/index.ts";
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/service/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,YAAY,EACjB,YAAY,GACb,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/service/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,YAAY,EACjB,YAAY,GACb,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EACL,YAAY,EACZ,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,2BAA2B,EAC3B,sBAAsB,EACtB,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,MAAM,EACX,KAAK,KAAK,GACX,MAAM,qBAAqB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/service/index.ts"],"names":[],"mappings":"AAAA,oIAAoI;AACpI,+DAA+D;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAGL,YAAY,GACb,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/service/index.ts"],"names":[],"mappings":"AAAA,oIAAoI;AACpI,+DAA+D;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAGL,YAAY,GACb,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EACL,YAAY,EAKZ,2BAA2B,EAC3B,sBAAsB,GAKvB,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { OutputDirectories, PackageJson, Start } from "../settings/types.ts";
|
|
2
|
+
import { type Untraceable } from "./trace/trace.ts";
|
|
3
|
+
/** Where the build output of a traced server is written, relative to the Service folder. */
|
|
4
|
+
export declare const BUILD_OUTPUT_FOLDER: string;
|
|
5
|
+
/** What a build hands to the caller: a folder and the file Compute starts in it. */
|
|
6
|
+
export type BuildOutput = {
|
|
7
|
+
/** The folder to copy or upload, without what `excludedFromBuildOutput` names. A real path: no part of it is a symbolic link. */
|
|
8
|
+
dir: string;
|
|
9
|
+
/** The file Compute starts, relative to `dir`. */
|
|
10
|
+
entrypoint: string;
|
|
11
|
+
} & ({
|
|
12
|
+
/** A folder of static files that the build wrote. Nothing else is needed to serve it. */
|
|
13
|
+
kind: "static site";
|
|
14
|
+
} | {
|
|
15
|
+
/** The source files and the trace of the server: the files of `node_modules` that it loads. */
|
|
16
|
+
kind: "traced server";
|
|
17
|
+
trace: TraceSummary;
|
|
18
|
+
} | {
|
|
19
|
+
/** The whole Service folder, with all of `node_modules`, because the server could not be traced. */
|
|
20
|
+
kind: "whole folder";
|
|
21
|
+
reason: Untraceable;
|
|
22
|
+
});
|
|
23
|
+
/** What the build output of a traced server holds, for the caller to show. Paths are relative to the Service folder. */
|
|
24
|
+
export interface TraceSummary {
|
|
25
|
+
files: number;
|
|
26
|
+
bytes: number;
|
|
27
|
+
entrypoints: string[];
|
|
28
|
+
bins: string[];
|
|
29
|
+
optionalPeerDependencies: string[];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Writes the build output for how the Service starts, with the Launcher and the Start plan in it.
|
|
33
|
+
*
|
|
34
|
+
* - Static files: the folder the build wrote.
|
|
35
|
+
* - A start command: the source files and the trace of the server it starts, in `.prisma/output`.
|
|
36
|
+
* - A start command whose server cannot be traced: the whole Service folder.
|
|
37
|
+
*/
|
|
38
|
+
export declare function writeBuildOutput(options: {
|
|
39
|
+
serviceDir: string;
|
|
40
|
+
start: Start;
|
|
41
|
+
/** The port the user stated, or null. */
|
|
42
|
+
port: number | null;
|
|
43
|
+
packageJson: PackageJson;
|
|
44
|
+
outputDirectories: OutputDirectories;
|
|
45
|
+
signal?: AbortSignal;
|
|
46
|
+
}): Promise<BuildOutput>;
|
|
47
|
+
//# sourceMappingURL=build-output.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-output.d.ts","sourceRoot":"","sources":["../../../src/service/output/build-output.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,iBAAiB,EACjB,WAAW,EACX,KAAK,EACN,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EAGL,KAAK,WAAW,EACjB,MAAM,kBAAkB,CAAC;AAE1B,4FAA4F;AAC5F,eAAO,MAAM,mBAAmB,QAAiC,CAAC;AAElE,oFAAoF;AACpF,MAAM,MAAM,WAAW,GAAG;IACxB,iIAAiI;IACjI,GAAG,EAAE,MAAM,CAAC;IACZ,kDAAkD;IAClD,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,CACA;IACE,yFAAyF;IACzF,IAAI,EAAE,aAAa,CAAC;CACrB,GACD;IACE,+FAA+F;IAC/F,IAAI,EAAE,eAAe,CAAC;IACtB,KAAK,EAAE,YAAY,CAAC;CACrB,GACD;IACE,oGAAoG;IACpG,IAAI,EAAE,cAAc,CAAC;IACrB,MAAM,EAAE,WAAW,CAAC;CACrB,CACJ,CAAC;AAEF,wHAAwH;AACxH,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,wBAAwB,EAAE,MAAM,EAAE,CAAC;CACpC;AAID;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE;IAC9C,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,KAAK,CAAC;IACb,yCAAyC;IACzC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,WAAW,EAAE,WAAW,CAAC;IACzB,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,GAAG,OAAO,CAAC,WAAW,CAAC,CA+DvB"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// The build output of a Service: the folder a build hands to the caller, and the file Compute starts in it.
|
|
2
|
+
import { copyFileSync, mkdirSync, realpathSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { rm } from "node:fs/promises";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { LAUNCHER_FILE, START_PLAN_FILE, } from "../launcher-contract/start-plan.js";
|
|
6
|
+
import { Copy } from "./copy.js";
|
|
7
|
+
import { excludedFromBuildOutput } from "./exclude.js";
|
|
8
|
+
import { launcherFile } from "./launcher-file.js";
|
|
9
|
+
import { inOutputDirectory, sourceFiles } from "./source-files.js";
|
|
10
|
+
import { traceServer, } from "./trace/trace.js";
|
|
11
|
+
/** Where the build output of a traced server is written, relative to the Service folder. */
|
|
12
|
+
export const BUILD_OUTPUT_FOLDER = path.join(".prisma", "output");
|
|
13
|
+
const SCRIPT_FILE = /\.(c|m)?js$/;
|
|
14
|
+
/**
|
|
15
|
+
* Writes the build output for how the Service starts, with the Launcher and the Start plan in it.
|
|
16
|
+
*
|
|
17
|
+
* - Static files: the folder the build wrote.
|
|
18
|
+
* - A start command: the source files and the trace of the server it starts, in `.prisma/output`.
|
|
19
|
+
* - A start command whose server cannot be traced: the whole Service folder.
|
|
20
|
+
*/
|
|
21
|
+
export async function writeBuildOutput(options) {
|
|
22
|
+
const { start } = options;
|
|
23
|
+
// The trace holds real paths, so every path here starts from the real path of the Service folder.
|
|
24
|
+
const serviceDir = realpathSync(options.serviceDir);
|
|
25
|
+
if (start.kind === "static") {
|
|
26
|
+
const dir = path.join(serviceDir, start.dir);
|
|
27
|
+
writeLauncher(dir, { kind: "static", dir: ".", port: options.port });
|
|
28
|
+
return { dir, entrypoint: LAUNCHER_FILE, kind: "static site" };
|
|
29
|
+
}
|
|
30
|
+
const plan = {
|
|
31
|
+
kind: "command",
|
|
32
|
+
command: start.command,
|
|
33
|
+
port: options.port,
|
|
34
|
+
};
|
|
35
|
+
const source = await sourceFiles(serviceDir, options.outputDirectories, options.signal);
|
|
36
|
+
const trace = await traceServer({
|
|
37
|
+
serviceDir,
|
|
38
|
+
command: start.command,
|
|
39
|
+
packageJson: options.packageJson,
|
|
40
|
+
builtScripts: source.filter((file) => SCRIPT_FILE.test(file) &&
|
|
41
|
+
inOutputDirectory(serviceDir, options.outputDirectories, file)),
|
|
42
|
+
signal: options.signal,
|
|
43
|
+
});
|
|
44
|
+
const dir = path.join(serviceDir, BUILD_OUTPUT_FOLDER);
|
|
45
|
+
// An earlier build may have written this folder. It must not stay in a whole-folder build output.
|
|
46
|
+
await rm(dir, { recursive: true, force: true });
|
|
47
|
+
if (typeof trace === "string") {
|
|
48
|
+
writeLauncher(serviceDir, plan);
|
|
49
|
+
return {
|
|
50
|
+
dir: serviceDir,
|
|
51
|
+
entrypoint: LAUNCHER_FILE,
|
|
52
|
+
kind: "whole folder",
|
|
53
|
+
reason: trace,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
const copied = await copyTracedServer(serviceDir, dir, source, trace);
|
|
57
|
+
writeLauncher(dir, plan);
|
|
58
|
+
const relative = (file) => path.relative(serviceDir, file);
|
|
59
|
+
return {
|
|
60
|
+
dir,
|
|
61
|
+
entrypoint: LAUNCHER_FILE,
|
|
62
|
+
kind: "traced server",
|
|
63
|
+
trace: {
|
|
64
|
+
files: copied.files,
|
|
65
|
+
bytes: copied.bytes,
|
|
66
|
+
entrypoints: trace.entrypoints.map(relative),
|
|
67
|
+
bins: trace.bins,
|
|
68
|
+
optionalPeerDependencies: trace.optionalPeerDependencies,
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/** Copies the source files and the trace into the build output folder, each to the place it has in the Service folder. */
|
|
73
|
+
async function copyTracedServer(serviceDir, dir, source, trace) {
|
|
74
|
+
const copy = new Copy(serviceDir, dir);
|
|
75
|
+
for (const file of source) {
|
|
76
|
+
await copy.file(file);
|
|
77
|
+
}
|
|
78
|
+
for (const file of trace.files) {
|
|
79
|
+
if (!excludedFromBuildOutput(path.basename(file))) {
|
|
80
|
+
await copy.file(file);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
for (const installed of trace.packages) {
|
|
84
|
+
await copy.file(installed.link);
|
|
85
|
+
await copy.packageFolder(installed.dir);
|
|
86
|
+
}
|
|
87
|
+
for (const bin of trace.bins) {
|
|
88
|
+
await copy.file(path.join(serviceDir, "node_modules", ".bin", bin));
|
|
89
|
+
}
|
|
90
|
+
return copy;
|
|
91
|
+
}
|
|
92
|
+
function writeLauncher(dir, plan) {
|
|
93
|
+
mkdirSync(path.join(dir, path.dirname(LAUNCHER_FILE)), { recursive: true });
|
|
94
|
+
copyFileSync(launcherFile(), path.join(dir, LAUNCHER_FILE));
|
|
95
|
+
writeFileSync(path.join(dir, START_PLAN_FILE), JSON.stringify(plan));
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=build-output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-output.js","sourceRoot":"","sources":["../../../src/service/output/build-output.ts"],"names":[],"mappings":"AAAA,4GAA4G;AAC5G,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC/E,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACL,aAAa,EACb,eAAe,GAEhB,MAAM,oCAAoC,CAAC;AAM5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAEL,WAAW,GAEZ,MAAM,kBAAkB,CAAC;AAE1B,4FAA4F;AAC5F,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;AAkClE,MAAM,WAAW,GAAG,aAAa,CAAC;AAElC;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,OAQtC;IACC,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;IAC1B,kGAAkG;IAClG,MAAM,UAAU,GAAG,YAAY,CAAC,OAAO,CAAC,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C,IAAI,CAAC,IAAI,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;IACD,KAAK,MAAM,SAAS,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;QACvC,MAAM,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAChC,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAC1C,CAAC;IACD,KAAK,MAAM,GAAG,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;QAC7B,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,aAAa,CAAC,GAAW,EAAE,IAAe;IACjD,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5E,YAAY,CAAC,YAAY,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,aAAa,CAAC,CAAC,CAAC;IAC5D,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,eAAe,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;AACvE,CAAC"}
|
|
@@ -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,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AK,EAAE,CAAC;YACb,IAAI,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,O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,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;AAC1D,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"}
|