@ipab/cli 0.0.0-stage → 0.1.0-rc.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/LICENSE +21 -0
- package/README.md +19 -2
- package/dist/app-authoring.d.ts +23 -0
- package/dist/app-authoring.d.ts.map +1 -0
- package/dist/app-authoring.js +449 -0
- package/dist/app-authoring.js.map +1 -0
- package/dist/app-definition.d.ts +109 -0
- package/dist/app-definition.d.ts.map +1 -0
- package/dist/app-definition.js +207 -0
- package/dist/app-definition.js.map +1 -0
- package/dist/app-prebuild.d.ts +12 -0
- package/dist/app-prebuild.d.ts.map +1 -0
- package/dist/app-prebuild.js +231 -0
- package/dist/app-prebuild.js.map +1 -0
- package/dist/app-templates.d.ts +13 -0
- package/dist/app-templates.d.ts.map +1 -0
- package/dist/app-templates.js +287 -0
- package/dist/app-templates.js.map +1 -0
- package/dist/authoring.d.ts +72 -0
- package/dist/authoring.d.ts.map +1 -0
- package/dist/authoring.js +440 -0
- package/dist/authoring.js.map +1 -0
- package/dist/builtins/template.node.car +0 -0
- package/dist/builtins/template.web-app.car +0 -0
- package/dist/builtins.d.ts +6 -0
- package/dist/builtins.d.ts.map +1 -0
- package/dist/builtins.js +46 -0
- package/dist/builtins.js.map +1 -0
- package/dist/child.d.ts +5 -0
- package/dist/child.d.ts.map +1 -0
- package/dist/child.js +28 -0
- package/dist/child.js.map +1 -0
- package/dist/cli.d.ts +24 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +1072 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +26 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +156 -0
- package/dist/config.js.map +1 -0
- package/dist/context.d.ts +42 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +164 -0
- package/dist/context.js.map +1 -0
- package/dist/errors.d.ts +10 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +40 -0
- package/dist/errors.js.map +1 -0
- package/dist/history.d.ts +34 -0
- package/dist/history.d.ts.map +1 -0
- package/dist/history.js +286 -0
- package/dist/history.js.map +1 -0
- package/dist/ipc.d.ts +26 -0
- package/dist/ipc.d.ts.map +1 -0
- package/dist/ipc.js +332 -0
- package/dist/ipc.js.map +1 -0
- package/dist/logs.d.ts +15 -0
- package/dist/logs.d.ts.map +1 -0
- package/dist/logs.js +118 -0
- package/dist/logs.js.map +1 -0
- package/dist/main.d.ts +3 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +4 -0
- package/dist/main.js.map +1 -0
- package/dist/pins.d.ts +33 -0
- package/dist/pins.d.ts.map +1 -0
- package/dist/pins.js +183 -0
- package/dist/pins.js.map +1 -0
- package/dist/runtime.d.ts +20 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +237 -0
- package/dist/runtime.js.map +1 -0
- package/dist/source-bundle.d.ts +16 -0
- package/dist/source-bundle.d.ts.map +1 -0
- package/dist/source-bundle.js +103 -0
- package/dist/source-bundle.js.map +1 -0
- package/dist/space.d.ts +33 -0
- package/dist/space.d.ts.map +1 -0
- package/dist/space.js +269 -0
- package/dist/space.js.map +1 -0
- package/dist/state.d.ts +92 -0
- package/dist/state.d.ts.map +1 -0
- package/dist/state.js +324 -0
- package/dist/state.js.map +1 -0
- package/dist/supported-schemas.d.ts +5 -0
- package/dist/supported-schemas.d.ts.map +1 -0
- package/dist/supported-schemas.js +90 -0
- package/dist/supported-schemas.js.map +1 -0
- package/dist/template-definition.d.ts +115 -0
- package/dist/template-definition.d.ts.map +1 -0
- package/dist/template-definition.js +188 -0
- package/dist/template-definition.js.map +1 -0
- package/dist/template-source.d.ts +12 -0
- package/dist/template-source.d.ts.map +1 -0
- package/dist/template-source.js +97 -0
- package/dist/template-source.js.map +1 -0
- package/package.json +67 -3
- package/src/app-authoring.ts +614 -0
- package/src/app-definition.ts +256 -0
- package/src/app-prebuild.ts +289 -0
- package/src/app-templates.ts +382 -0
- package/src/authoring.ts +610 -0
- package/src/builtins.ts +55 -0
- package/src/child.ts +32 -0
- package/src/cli.ts +1285 -0
- package/src/config.ts +220 -0
- package/src/context.ts +232 -0
- package/src/errors.ts +46 -0
- package/src/history.ts +391 -0
- package/src/ipc.ts +358 -0
- package/src/logs.ts +132 -0
- package/src/main.ts +4 -0
- package/src/pins.ts +214 -0
- package/src/runtime.ts +300 -0
- package/src/source-bundle.ts +136 -0
- package/src/space.ts +379 -0
- package/src/state.ts +416 -0
- package/src/supported-schemas.ts +151 -0
- package/src/template-definition.ts +242 -0
- package/src/template-source.ts +128 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 preset-pnpm-monorepo contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @ipab/cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Node subprocess host for InterPlanetary Application Bundles. **Not a sandbox**:
|
|
4
|
+
only execute Apps you trust.
|
|
5
|
+
|
|
6
|
+
The first release is being prepared as `0.1.0-rc.0`. Once published:
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
npm install --global @ipab/cli@0.1.0-rc.0
|
|
10
|
+
ipab --version
|
|
11
|
+
ipab --help
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Node.js 22.15.0 or newer is required. Built-in Node and Web App project
|
|
15
|
+
templates are validated CAR assets shipped in this package; initialization works
|
|
16
|
+
offline and does not install dependencies or run hooks.
|
|
17
|
+
|
|
18
|
+
See the [user guide](https://github.com/silvermoon-work/ipab#readme) and
|
|
19
|
+
[command reference](https://github.com/silvermoon-work/ipab/blob/main/docs/reference.md)
|
|
20
|
+
for Store configuration, execution, pins, templates and App development.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type AuthoringOptions, type BuildResult } from "./authoring.js";
|
|
2
|
+
export declare function initApp(name: string, directory?: string, options?: AuthoringOptions & {
|
|
3
|
+
template?: string;
|
|
4
|
+
parameters?: readonly string[];
|
|
5
|
+
}): Promise<{
|
|
6
|
+
kind: "app-init";
|
|
7
|
+
directory: string;
|
|
8
|
+
name: string;
|
|
9
|
+
template: string;
|
|
10
|
+
templateCid: string | null;
|
|
11
|
+
schemaCid: string;
|
|
12
|
+
files: string[];
|
|
13
|
+
}>;
|
|
14
|
+
export declare function buildApp(directory?: string, options?: AuthoringOptions & {
|
|
15
|
+
output?: string;
|
|
16
|
+
outputDir?: string;
|
|
17
|
+
replace?: boolean;
|
|
18
|
+
includeSource?: boolean;
|
|
19
|
+
}): Promise<Omit<BuildResult, "kind"> & {
|
|
20
|
+
kind: "app-bundle";
|
|
21
|
+
source?: Omit<BuildResult, "kind">;
|
|
22
|
+
}>;
|
|
23
|
+
//# sourceMappingURL=app-authoring.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-authoring.d.ts","sourceRoot":"","sources":["../src/app-authoring.ts"],"names":[],"mappings":"AAUA,OAAO,EAKL,KAAK,gBAAgB,EACrB,KAAK,WAAW,EACjB,MAAM,gBAAgB,CAAC;AAkBxB,wBAAsB,OAAO,CAC3B,IAAI,EAAE,MAAM,EACZ,SAAS,SAAO,EAChB,OAAO,GAAE,gBAAgB,GAAG;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3B;;;;;;;;GA0BP;AA6HD,wBAAsB,QAAQ,CAC5B,SAAS,SAAM,EACf,OAAO,GAAE,gBAAgB,GAAG;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;CACpB,GACL,OAAO,CACR,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,GAAG;IAC1B,IAAI,EAAE,YAAY,CAAC;IACnB,MAAM,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;CACpC,CACF,CAwZA"}
|
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { lstat, mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
3
|
+
import { isBuiltin } from "node:module";
|
|
4
|
+
import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
5
|
+
import { StringDecoder } from "node:string_decoder";
|
|
6
|
+
import { compileFunction } from "node:vm";
|
|
7
|
+
import { stringify } from "yaml";
|
|
8
|
+
import { parseData } from "@ipab/bundle";
|
|
9
|
+
import { filesystemTree } from "@ipab/bundle-builder/node";
|
|
10
|
+
import { encodeBundleCar, memoryTree, readBytes } from "@ipab/bundle-builder";
|
|
11
|
+
import { writeCar, outputAvailable, scaffoldFiles, nodeError, } from "./authoring.js";
|
|
12
|
+
import { HostError, object } from "./errors.js";
|
|
13
|
+
import { relativePath } from "./space.js";
|
|
14
|
+
import { buildSupportedSchemas, supportedSchemasPath, } from "./supported-schemas.js";
|
|
15
|
+
import { appDescription, appSchema, builtinAppSchema, } from "./app-definition.js";
|
|
16
|
+
import { appTemplate } from "./app-templates.js";
|
|
17
|
+
import { buildChain, projectBuild, runPrebuild } from "./app-prebuild.js";
|
|
18
|
+
import { captureSource, sourceFingerprint } from "./source-bundle.js";
|
|
19
|
+
const json = (value) => `${JSON.stringify(value, null, 2)}\n`;
|
|
20
|
+
export async function initApp(name, directory = name, options = {}) {
|
|
21
|
+
if (!/^[a-z0-9][a-z0-9._-]*$/.test(name) ||
|
|
22
|
+
name.length > 214 ||
|
|
23
|
+
["node_modules", "favicon.ico"].includes(name))
|
|
24
|
+
throw new HostError("App NAME must be an unscoped lowercase npm package name.");
|
|
25
|
+
const { files, cid: templateCid } = await appTemplate(options.template ?? "node", name, options);
|
|
26
|
+
const schemaCid = (await builtinAppSchema()).cid.toString();
|
|
27
|
+
const root = await scaffoldFiles(directory, files, options);
|
|
28
|
+
return {
|
|
29
|
+
kind: "app-init",
|
|
30
|
+
directory: root,
|
|
31
|
+
name,
|
|
32
|
+
template: options.template ?? "node",
|
|
33
|
+
templateCid,
|
|
34
|
+
schemaCid,
|
|
35
|
+
files: [...files.keys()],
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function within(root, path) {
|
|
39
|
+
const part = relative(root, path);
|
|
40
|
+
return !isAbsolute(part) && part !== ".." && !part.startsWith(`..${sep}`);
|
|
41
|
+
}
|
|
42
|
+
async function typecheck(root, entry, options, config = "tsconfig.json") {
|
|
43
|
+
const compiler = join(root, "node_modules", "typescript", "bin", "tsc");
|
|
44
|
+
try {
|
|
45
|
+
await lstat(compiler);
|
|
46
|
+
}
|
|
47
|
+
catch (cause) {
|
|
48
|
+
if (!nodeError(cause, "ENOENT"))
|
|
49
|
+
throw cause;
|
|
50
|
+
const error = new HostError("Project-local TypeScript is missing. Install this project's declared dependencies explicitly before ipab build.", 1, "APP_BUILD_FAILED", "validation");
|
|
51
|
+
error.cause = cause;
|
|
52
|
+
throw error;
|
|
53
|
+
}
|
|
54
|
+
await new Promise((accept, reject) => {
|
|
55
|
+
const child = spawn(process.execPath, [
|
|
56
|
+
compiler,
|
|
57
|
+
"--project",
|
|
58
|
+
join(root, ...config.split("/")),
|
|
59
|
+
"--noEmit",
|
|
60
|
+
"--incremental",
|
|
61
|
+
"false",
|
|
62
|
+
"--composite",
|
|
63
|
+
"false",
|
|
64
|
+
"--strict",
|
|
65
|
+
"--noCheck",
|
|
66
|
+
"false",
|
|
67
|
+
"--noImplicitAny",
|
|
68
|
+
"--noImplicitThis",
|
|
69
|
+
"--strictNullChecks",
|
|
70
|
+
"--strictFunctionTypes",
|
|
71
|
+
"--strictBindCallApply",
|
|
72
|
+
"--strictPropertyInitialization",
|
|
73
|
+
"--strictBuiltinIteratorReturn",
|
|
74
|
+
"--alwaysStrict",
|
|
75
|
+
"--useUnknownInCatchVariables",
|
|
76
|
+
"--pretty",
|
|
77
|
+
"false",
|
|
78
|
+
"--listFiles",
|
|
79
|
+
], { cwd: root, signal: options.signal, stdio: ["ignore", "pipe", "pipe"] });
|
|
80
|
+
let diagnostic = "";
|
|
81
|
+
let included = false;
|
|
82
|
+
const selected = resolve(root, entry);
|
|
83
|
+
const checkLine = (line) => {
|
|
84
|
+
const path = resolve(root, line);
|
|
85
|
+
if (process.platform === "win32"
|
|
86
|
+
? path.toLowerCase() === selected.toLowerCase()
|
|
87
|
+
: path === selected)
|
|
88
|
+
included = true;
|
|
89
|
+
};
|
|
90
|
+
let failure;
|
|
91
|
+
const fail = (error) => {
|
|
92
|
+
failure ??=
|
|
93
|
+
error instanceof Error
|
|
94
|
+
? error
|
|
95
|
+
: new Error("App typecheck stream failed.", { cause: error });
|
|
96
|
+
child.kill();
|
|
97
|
+
};
|
|
98
|
+
for (const stream of [child.stdout, child.stderr]) {
|
|
99
|
+
const decoder = new StringDecoder("utf8");
|
|
100
|
+
let pending = "";
|
|
101
|
+
const collect = (text) => {
|
|
102
|
+
diagnostic = (diagnostic + text).slice(-1024 * 1024);
|
|
103
|
+
const lines = (pending + text).split(/\r?\n/);
|
|
104
|
+
pending = lines.pop();
|
|
105
|
+
for (const line of lines)
|
|
106
|
+
checkLine(line);
|
|
107
|
+
};
|
|
108
|
+
stream.on("data", (chunk) => {
|
|
109
|
+
collect(decoder.write(chunk));
|
|
110
|
+
});
|
|
111
|
+
stream.once("end", () => {
|
|
112
|
+
collect(decoder.end());
|
|
113
|
+
checkLine(pending);
|
|
114
|
+
});
|
|
115
|
+
stream.once("error", fail);
|
|
116
|
+
}
|
|
117
|
+
child.once("error", fail);
|
|
118
|
+
child.once("close", (code) => {
|
|
119
|
+
if (failure)
|
|
120
|
+
reject(failure);
|
|
121
|
+
else if (options.signal?.aborted)
|
|
122
|
+
reject(options.signal.reason instanceof Error
|
|
123
|
+
? options.signal.reason
|
|
124
|
+
: new Error("App typecheck cancelled.", {
|
|
125
|
+
cause: options.signal.reason,
|
|
126
|
+
}));
|
|
127
|
+
else if (code === 0 && included)
|
|
128
|
+
accept();
|
|
129
|
+
else
|
|
130
|
+
reject(new HostError(code === 0
|
|
131
|
+
? `App entry is not included in ${config}; include the selected source before building.`
|
|
132
|
+
: `App typecheck failed (${String(code)}).\n${diagnostic
|
|
133
|
+
.split(/\r?\n/)
|
|
134
|
+
.filter((line) => line.includes("error TS") || !isAbsolute(line))
|
|
135
|
+
.join("\n")
|
|
136
|
+
.trim()}`));
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
export async function buildApp(directory = ".", options = {}) {
|
|
141
|
+
await builtinAppSchema();
|
|
142
|
+
const root = resolve(directory);
|
|
143
|
+
const stat = await lstat(root);
|
|
144
|
+
if (!stat.isDirectory() || stat.isSymbolicLink())
|
|
145
|
+
throw new HostError("App build requires a regular project directory.");
|
|
146
|
+
const chain = await buildChain(root);
|
|
147
|
+
const tree = await filesystemTree(root);
|
|
148
|
+
const configurations = await Promise.all(["ipab.yaml", "ipab.json"].map(async (name) => {
|
|
149
|
+
try {
|
|
150
|
+
await lstat(join(root, name));
|
|
151
|
+
return name;
|
|
152
|
+
}
|
|
153
|
+
catch (cause) {
|
|
154
|
+
if (nodeError(cause, "ENOENT"))
|
|
155
|
+
return undefined;
|
|
156
|
+
throw cause;
|
|
157
|
+
}
|
|
158
|
+
}));
|
|
159
|
+
const selected = configurations.filter((name) => name !== undefined);
|
|
160
|
+
if (selected.length !== 1)
|
|
161
|
+
throw new HostError(selected.length
|
|
162
|
+
? "Both ipab.yaml and legacy ipab.json exist. Keep exactly one App configuration file."
|
|
163
|
+
: "App configuration is missing. Create ipab.yaml (or keep a legacy ipab.json).");
|
|
164
|
+
const configPath = selected[0];
|
|
165
|
+
const config = object(parseData(await readBytes(tree, configPath, 64 * 1024, options), configPath === "ipab.yaml" ? "application/yaml" : "application/json"), configPath);
|
|
166
|
+
if (typeof config.entry !== "string" ||
|
|
167
|
+
!Array.isArray(config.resources) ||
|
|
168
|
+
Object.keys(config).some((key) => !["entry", "resources", "supportedSchemas", "app", "build"].includes(key)) ||
|
|
169
|
+
(config.supportedSchemas !== undefined &&
|
|
170
|
+
!Array.isArray(config.supportedSchemas)))
|
|
171
|
+
throw new HostError(`${configPath} requires entry and an explicit resources array, with optional supportedSchemas array and app metadata overrides; unknown fields are not supported.`);
|
|
172
|
+
const prebuild = projectBuild(config.build);
|
|
173
|
+
const buildOptions = config.build === undefined ? {} : object(config.build, "App build");
|
|
174
|
+
const includeSource = options.includeSource ?? buildOptions.includeSource !== false;
|
|
175
|
+
const entry = relativePath(config.entry);
|
|
176
|
+
if (!prebuild && (!entry.startsWith("src/") || !entry.endsWith(".ts")))
|
|
177
|
+
throw new HostError("App entry must be a .ts file under src/.");
|
|
178
|
+
if (prebuild && !entry.endsWith(".cjs"))
|
|
179
|
+
throw new HostError("Prebuilt App entry must be a relative .cjs file in IPAB_BUILD_DIR.");
|
|
180
|
+
if (!prebuild)
|
|
181
|
+
await readBytes(tree, entry, 16 * 1024 * 1024, options);
|
|
182
|
+
const resources = new Set();
|
|
183
|
+
for (const item of config.resources) {
|
|
184
|
+
if (typeof item !== "string")
|
|
185
|
+
throw new HostError("App resources must be explicit relative file paths.");
|
|
186
|
+
const path = relativePath(item);
|
|
187
|
+
if ((!prebuild && !path.startsWith("assets/")) ||
|
|
188
|
+
path.split("/").some((part) => part.startsWith(".")) ||
|
|
189
|
+
path === entry ||
|
|
190
|
+
(prebuild && (path === "app.cjs" || path.startsWith("app.cjs/"))) ||
|
|
191
|
+
path.startsWith(`${entry}/`) ||
|
|
192
|
+
entry.startsWith(`${path}/`) ||
|
|
193
|
+
[...resources].some((existing) => path.startsWith(`${existing}/`) || existing.startsWith(`${path}/`)) ||
|
|
194
|
+
resources.has(path))
|
|
195
|
+
throw new HostError(prebuild
|
|
196
|
+
? "Prebuilt resources must be unique, non-overlapping paths separate from the entry."
|
|
197
|
+
: "Resources must be unique non-hidden files under assets/ (no globs or directories).");
|
|
198
|
+
resources.add(path);
|
|
199
|
+
}
|
|
200
|
+
const schemas = new Set();
|
|
201
|
+
for (const item of (config.supportedSchemas ?? [])) {
|
|
202
|
+
if (typeof item !== "string")
|
|
203
|
+
throw new HostError("Supported Schemas must be explicit relative file paths.");
|
|
204
|
+
const path = relativePath(item);
|
|
205
|
+
if (!path.startsWith("schemas/") ||
|
|
206
|
+
!path.endsWith(".json") ||
|
|
207
|
+
path.split("/").some((part) => part.startsWith(".")) ||
|
|
208
|
+
schemas.has(path))
|
|
209
|
+
throw new HostError("Supported Schemas must be unique non-hidden .json files under schemas/ (no globs or directories).");
|
|
210
|
+
schemas.add(path);
|
|
211
|
+
}
|
|
212
|
+
const pkg = object(JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(await readBytes(tree, "package.json", 64 * 1024, options))), "package.json");
|
|
213
|
+
const defaults = {};
|
|
214
|
+
for (const key of ["name", "version", "description", "author", "license"])
|
|
215
|
+
if (pkg[key] !== undefined)
|
|
216
|
+
defaults[key] = pkg[key];
|
|
217
|
+
const overrides = config.app === undefined
|
|
218
|
+
? {}
|
|
219
|
+
: object(config.app, "App metadata overrides");
|
|
220
|
+
if (Object.hasOwn(overrides, "entry"))
|
|
221
|
+
throw new HostError("App metadata cannot override the compiled program entry.");
|
|
222
|
+
if (Object.hasOwn(overrides, "supportedSchemas"))
|
|
223
|
+
throw new HostError("App metadata cannot override the generated supportedSchemas declaration.");
|
|
224
|
+
if (Object.hasOwn(overrides, "source"))
|
|
225
|
+
throw new HostError("App metadata cannot override the generated source declaration.");
|
|
226
|
+
const supportedSchemas = await buildSupportedSchemas(tree, schemas, options);
|
|
227
|
+
const description = appDescription({
|
|
228
|
+
...defaults,
|
|
229
|
+
...overrides,
|
|
230
|
+
entry: appSchema.entry.defaultValue.entry,
|
|
231
|
+
...(supportedSchemas ? { supportedSchemas: supportedSchemasPath } : {}),
|
|
232
|
+
});
|
|
233
|
+
if (description.icon !== undefined) {
|
|
234
|
+
const icon = relativePath(description.icon);
|
|
235
|
+
if (!icon.startsWith("resources/") ||
|
|
236
|
+
![...resources].some((path) => icon === `resources/${path}` ||
|
|
237
|
+
(prebuild && icon.startsWith(`resources/${path}/`))))
|
|
238
|
+
throw new HostError(prebuild
|
|
239
|
+
? "App icon must reference a selected prebuilt resource file."
|
|
240
|
+
: "App icon must reference a selected resources/assets/ file.");
|
|
241
|
+
}
|
|
242
|
+
const outputDirectory = resolve(root, options.outputDir ?? "dist");
|
|
243
|
+
const output = options.output
|
|
244
|
+
? resolve(options.output)
|
|
245
|
+
: join(outputDirectory, "app.car");
|
|
246
|
+
if (!output.toLowerCase().endsWith(".car") ||
|
|
247
|
+
(within(root, output) && !within(join(root, "dist"), output)) ||
|
|
248
|
+
[...resources].some((path) => within(resolve(root, path), output)))
|
|
249
|
+
throw new HostError("App CAR output must end in .car and be inside project dist/ or outside the project; source files cannot be replaced.");
|
|
250
|
+
await outputAvailable(output, Boolean(options.replace));
|
|
251
|
+
const sourceOutput = `${output.slice(0, -4)}.source.car`;
|
|
252
|
+
if (includeSource)
|
|
253
|
+
await outputAvailable(sourceOutput, Boolean(options.replace));
|
|
254
|
+
let parent = dirname(output);
|
|
255
|
+
for (;;) {
|
|
256
|
+
try {
|
|
257
|
+
if ((await lstat(parent)).isSymbolicLink())
|
|
258
|
+
throw new HostError("App output cannot traverse symbolic links.");
|
|
259
|
+
}
|
|
260
|
+
catch (cause) {
|
|
261
|
+
if (!(cause instanceof Error &&
|
|
262
|
+
"code" in cause &&
|
|
263
|
+
cause.code === "ENOENT"))
|
|
264
|
+
throw cause;
|
|
265
|
+
}
|
|
266
|
+
const next = dirname(parent);
|
|
267
|
+
if (next === parent)
|
|
268
|
+
break;
|
|
269
|
+
parent = next;
|
|
270
|
+
}
|
|
271
|
+
const excludedOutputs = [output, sourceOutput, outputDirectory];
|
|
272
|
+
const sourceFiles = includeSource
|
|
273
|
+
? await captureSource(root, excludedOutputs, options)
|
|
274
|
+
: undefined;
|
|
275
|
+
if (sourceFiles) {
|
|
276
|
+
const required = [
|
|
277
|
+
configPath,
|
|
278
|
+
"package.json",
|
|
279
|
+
...(prebuild
|
|
280
|
+
? prebuild.typecheck.flatMap((check) => [check.config, check.entry])
|
|
281
|
+
: ["tsconfig.json", entry, ...resources]),
|
|
282
|
+
...schemas,
|
|
283
|
+
];
|
|
284
|
+
for (const path of required)
|
|
285
|
+
if (!sourceFiles.has(path))
|
|
286
|
+
throw new HostError(`Required App build input is excluded from source: ${path}. Fix .gitignore or use --without-source.`);
|
|
287
|
+
}
|
|
288
|
+
if (prebuild) {
|
|
289
|
+
for (const check of prebuild.typecheck) {
|
|
290
|
+
await readBytes(tree, check.config, 1024 * 1024, options);
|
|
291
|
+
await readBytes(tree, check.entry, 16 * 1024 * 1024, options);
|
|
292
|
+
await typecheck(root, check.entry, options, check.config);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
else
|
|
296
|
+
await typecheck(root, entry, options);
|
|
297
|
+
options.signal?.throwIfAborted();
|
|
298
|
+
const stage = await mkdtemp(join(root, ".ipab-app-"));
|
|
299
|
+
try {
|
|
300
|
+
const { build } = await import("esbuild");
|
|
301
|
+
const bundleStage = join(stage, "bundle");
|
|
302
|
+
const input = prebuild ? join(stage, "input") : root;
|
|
303
|
+
if (prebuild) {
|
|
304
|
+
await mkdir(input);
|
|
305
|
+
await runPrebuild(root, input, pkg, chain, options);
|
|
306
|
+
}
|
|
307
|
+
const inputTree = prebuild ? await filesystemTree(input) : tree;
|
|
308
|
+
const prebuiltSource = prebuild
|
|
309
|
+
? await readBytes(inputTree, entry, 8 * 1024 * 1024, options)
|
|
310
|
+
: undefined;
|
|
311
|
+
if (prebuiltSource) {
|
|
312
|
+
try {
|
|
313
|
+
const source = new TextDecoder("utf-8", { fatal: true }).decode(prebuiltSource);
|
|
314
|
+
compileFunction(source.replace(/^#![^\r\n]*/, ""), [
|
|
315
|
+
"exports",
|
|
316
|
+
"require",
|
|
317
|
+
"module",
|
|
318
|
+
"__filename",
|
|
319
|
+
"__dirname",
|
|
320
|
+
]);
|
|
321
|
+
}
|
|
322
|
+
catch (cause) {
|
|
323
|
+
const error = new HostError("Prebuilt App entry must be valid Node CommonJS; it is packaged without transformation.");
|
|
324
|
+
error.cause = cause;
|
|
325
|
+
throw error;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
await mkdir(join(bundleStage, "resources"), { recursive: true });
|
|
329
|
+
const program = await build({
|
|
330
|
+
absWorkingDir: input,
|
|
331
|
+
entryPoints: [entry],
|
|
332
|
+
outfile: join(bundleStage, "resources", "app.cjs"),
|
|
333
|
+
bundle: true,
|
|
334
|
+
platform: "node",
|
|
335
|
+
format: "cjs",
|
|
336
|
+
target: "node22.15",
|
|
337
|
+
packages: prebuild ? "external" : "bundle",
|
|
338
|
+
metafile: true,
|
|
339
|
+
write: false,
|
|
340
|
+
logLevel: "silent",
|
|
341
|
+
logOverride: {
|
|
342
|
+
"unsupported-dynamic-import": "error",
|
|
343
|
+
"unsupported-require-call": "error",
|
|
344
|
+
"indirect-require": "error",
|
|
345
|
+
},
|
|
346
|
+
});
|
|
347
|
+
if (program.outputFiles.length !== 1 ||
|
|
348
|
+
program.outputFiles[0].contents.length > 8 * 1024 * 1024 ||
|
|
349
|
+
(prebuild && Object.keys(program.metafile.inputs).length !== 1) ||
|
|
350
|
+
Object.values(program.metafile.outputs).some((file) => file.imports.some((item) => item.external && !isBuiltin(item.path))))
|
|
351
|
+
throw new HostError("App must bundle into one self-contained .cjs of at most 8 MiB; only Node builtins may remain external.");
|
|
352
|
+
if (sourceFiles && !prebuild)
|
|
353
|
+
for (const path of Object.keys(program.metafile.inputs))
|
|
354
|
+
if (!path.split(/[\\/]/).includes("node_modules") &&
|
|
355
|
+
!sourceFiles.has(relative(root, resolve(root, path)).split(sep).join("/")))
|
|
356
|
+
throw new HostError(`Compiled input is outside the source snapshot: ${path}. Include it in the project or use --without-source.`);
|
|
357
|
+
options.signal?.throwIfAborted();
|
|
358
|
+
const source = prebuiltSource ?? program.outputFiles[0].contents;
|
|
359
|
+
await writeFile(join(bundleStage, "resources", "app.cjs"), source, {
|
|
360
|
+
flag: "wx",
|
|
361
|
+
signal: options.signal,
|
|
362
|
+
});
|
|
363
|
+
await writeFile(join(bundleStage, ".bundle.yaml"), stringify(appSchema), {
|
|
364
|
+
flag: "wx",
|
|
365
|
+
signal: options.signal,
|
|
366
|
+
});
|
|
367
|
+
if (supportedSchemas)
|
|
368
|
+
await writeFile(join(bundleStage, ...supportedSchemasPath.split("/")), supportedSchemas, { flag: "wx", signal: options.signal });
|
|
369
|
+
let resourceCount = 0;
|
|
370
|
+
const copyFile = async (path) => {
|
|
371
|
+
if (++resourceCount > 4096)
|
|
372
|
+
throw new HostError("App resource file count exceeds 4096.");
|
|
373
|
+
relativePath(path);
|
|
374
|
+
if (path.split("/").some((part) => part.startsWith(".")))
|
|
375
|
+
throw new HostError("Hidden prebuilt resources are not supported.");
|
|
376
|
+
const bytes = await readBytes(inputTree, path, 16 * 1024 * 1024, options);
|
|
377
|
+
const target = join(bundleStage, "resources", ...path.split("/"));
|
|
378
|
+
await mkdir(dirname(target), { recursive: true });
|
|
379
|
+
await writeFile(target, bytes, { flag: "wx", signal: options.signal });
|
|
380
|
+
};
|
|
381
|
+
const copyDirectory = async (path) => {
|
|
382
|
+
relativePath(path);
|
|
383
|
+
if (++resourceCount > 4096)
|
|
384
|
+
throw new HostError("App resource path count exceeds 4096.");
|
|
385
|
+
if (path.split("/").some((part) => part.startsWith(".")))
|
|
386
|
+
throw new HostError("Hidden prebuilt resources are not supported.");
|
|
387
|
+
for (const item of await inputTree.list(path, options)) {
|
|
388
|
+
const child = `${path}/${item.name}`;
|
|
389
|
+
if (item.kind === "directory")
|
|
390
|
+
await copyDirectory(child);
|
|
391
|
+
else
|
|
392
|
+
await copyFile(child);
|
|
393
|
+
}
|
|
394
|
+
};
|
|
395
|
+
for (const path of resources) {
|
|
396
|
+
if (prebuild &&
|
|
397
|
+
(await lstat(join(input, ...path.split("/")))).isDirectory())
|
|
398
|
+
await copyDirectory(path);
|
|
399
|
+
else
|
|
400
|
+
await copyFile(path);
|
|
401
|
+
}
|
|
402
|
+
if (description.icon !== undefined)
|
|
403
|
+
await readBytes(await filesystemTree(bundleStage), description.icon, 16 * 1024 * 1024, options);
|
|
404
|
+
if (sourceFiles &&
|
|
405
|
+
sourceFingerprint(sourceFiles) !==
|
|
406
|
+
sourceFingerprint(await captureSource(root, excludedOutputs, options)))
|
|
407
|
+
throw new HostError("App source changed during the build. Retry with stable project inputs.");
|
|
408
|
+
const encodedSource = sourceFiles
|
|
409
|
+
? await encodeBundleCar(memoryTree(sourceFiles), options)
|
|
410
|
+
: undefined;
|
|
411
|
+
try {
|
|
412
|
+
await writeFile(join(bundleStage, "app.json"), json({
|
|
413
|
+
...description,
|
|
414
|
+
...(encodedSource
|
|
415
|
+
? { source: { cid: encodedSource.cid.toString() } }
|
|
416
|
+
: {}),
|
|
417
|
+
}), { flag: "wx", signal: options.signal });
|
|
418
|
+
const encoded = await encodeBundleCar(await filesystemTree(bundleStage), options);
|
|
419
|
+
try {
|
|
420
|
+
const source = encodedSource
|
|
421
|
+
? {
|
|
422
|
+
cid: encodedSource.cid.toString(),
|
|
423
|
+
schemaCid: encodedSource.schema.cid.toString(),
|
|
424
|
+
output: sourceOutput,
|
|
425
|
+
bytes: await writeCar(encodedSource, sourceOutput, Boolean(options.replace), options),
|
|
426
|
+
}
|
|
427
|
+
: undefined;
|
|
428
|
+
return {
|
|
429
|
+
kind: "app-bundle",
|
|
430
|
+
cid: encoded.cid.toString(),
|
|
431
|
+
schemaCid: encoded.schema.cid.toString(),
|
|
432
|
+
output,
|
|
433
|
+
bytes: await writeCar(encoded, output, Boolean(options.replace), options),
|
|
434
|
+
...(source ? { source } : {}),
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
finally {
|
|
438
|
+
await encoded.close();
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
finally {
|
|
442
|
+
await encodedSource?.close();
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
finally {
|
|
446
|
+
await rm(stage, { recursive: true, force: true });
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
//# sourceMappingURL=app-authoring.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-authoring.js","sourceRoot":"","sources":["../src/app-authoring.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EA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