@powerhousedao/ph-cli 6.2.3-dev.95 → 6.2.3-dev.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{build-Dfrq_MIX.mjs → build-3RaSOgNk.mjs} +1182 -207
- package/dist/build-3RaSOgNk.mjs.map +1 -0
- package/dist/build-Ogg4fpe2.mjs +4 -0
- package/dist/{check-bEVuToRY.mjs → check-33uP64kE.mjs} +6 -6
- package/dist/{check-bEVuToRY.mjs.map → check-33uP64kE.mjs.map} +1 -1
- package/dist/{check-XulH7-hn.mjs → check-B9IwyWZ8.mjs} +3 -3
- package/dist/{check-d-VEsSZX.mjs → check-Cco7-UC2.mjs} +4 -4
- package/dist/{check-d-VEsSZX.mjs.map → check-Cco7-UC2.mjs.map} +1 -1
- package/dist/{cli-connect-override-BQr3yjC_.mjs → cli-connect-override-D3N3gbp_.mjs} +4 -4
- package/dist/{cli-connect-override-BQr3yjC_.mjs.map → cli-connect-override-D3N3gbp_.mjs.map} +1 -1
- package/dist/cli.mjs +4 -4
- package/dist/{compound-DO_mvh0O-D254asEo.mjs → compound-DO_mvh0O-Dp1YPhR0.mjs} +4 -4
- package/dist/{compound-DO_mvh0O-D254asEo.mjs.map → compound-DO_mvh0O-Dp1YPhR0.mjs.map} +1 -1
- package/dist/{connect-build-DrKrCMPR.mjs → connect-build-QmjuPPIg.mjs} +6 -6
- package/dist/{connect-build-DrKrCMPR.mjs.map → connect-build-QmjuPPIg.mjs.map} +1 -1
- package/dist/{connect-config-DWJf22Ro.mjs → connect-config-C6hKMsUG.mjs} +4 -4
- package/dist/{connect-config-DWJf22Ro.mjs.map → connect-config-C6hKMsUG.mjs.map} +1 -1
- package/dist/{connect-studio-DWty6fZd.mjs → connect-studio-C7Bbh50O.mjs} +4 -4
- package/dist/{connect-studio-DWty6fZd.mjs.map → connect-studio-C7Bbh50O.mjs.map} +1 -1
- package/dist/{connect-studio-DTZEwZ4C.mjs → connect-studio-xQNYl142.mjs} +3 -3
- package/dist/definitions-worker.d.mts +2 -0
- package/dist/definitions-worker.d.mts.map +1 -1
- package/dist/definitions-worker.mjs +1 -1
- package/dist/{dist-BOjmQhjX.mjs → dist-B-_lMGlB.mjs} +5 -5
- package/dist/{dist-BOjmQhjX.mjs.map → dist-B-_lMGlB.mjs.map} +1 -1
- package/dist/{evidence-BiMKzRLV.mjs → evidence-Dchpoogs.mjs} +4 -4
- package/dist/{evidence-BiMKzRLV.mjs.map → evidence-Dchpoogs.mjs.map} +1 -1
- package/dist/{explain-DKS-t7dS.mjs → explain-lynfOtDg.mjs} +5 -5
- package/dist/{explain-DKS-t7dS.mjs.map → explain-lynfOtDg.mjs.map} +1 -1
- package/dist/{export-DRw3XVfG.mjs → export-YkeGUZjR.mjs} +4 -4
- package/dist/{export-DRw3XVfG.mjs.map → export-YkeGUZjR.mjs.map} +1 -1
- package/dist/{files-D05VjxVj.mjs → files-D6_euBBn.mjs} +160 -53
- package/dist/files-D6_euBBn.mjs.map +1 -0
- package/dist/{generate-all-CMpNPpD8.mjs → generate-all-_7S0Iii2.mjs} +4 -4
- package/dist/{generate-all-CMpNPpD8.mjs.map → generate-all-_7S0Iii2.mjs.map} +1 -1
- package/dist/{generate-desktop-shell-B-Rf7ds8.mjs → generate-desktop-shell-CEcE_1gb.mjs} +5 -5
- package/dist/{generate-desktop-shell-B-Rf7ds8.mjs.map → generate-desktop-shell-CEcE_1gb.mjs.map} +1 -1
- package/dist/{get-version-qXfoI8qS.mjs → get-version-b84F8Pa8.mjs} +4 -4
- package/dist/{get-version-qXfoI8qS.mjs.map → get-version-b84F8Pa8.mjs.map} +1 -1
- package/dist/{init-Ch1rCksS.mjs → init-DV385Z92.mjs} +4 -4
- package/dist/{init-Ch1rCksS.mjs.map → init-DV385Z92.mjs.map} +1 -1
- package/dist/{inspect-DlRPzee1.mjs → inspect-BpVHe9vz.mjs} +4 -4
- package/dist/{inspect-DlRPzee1.mjs.map → inspect-BpVHe9vz.mjs.map} +1 -1
- package/dist/{mcp-BSigu-6U.mjs → mcp-GcFTEzbh.mjs} +4 -4
- package/dist/{mcp-BSigu-6U.mjs.map → mcp-GcFTEzbh.mjs.map} +1 -1
- package/dist/{migrate-B9F_cSCA.mjs → migrate-B-MM9TlS.mjs} +4 -4
- package/dist/{migrate-B9F_cSCA.mjs.map → migrate-B-MM9TlS.mjs.map} +1 -1
- package/dist/ph-cli-commands-D0LiPnEg.mjs +4 -0
- package/dist/{ph-cli-commands-XNEhuXzO.mjs → ph-cli-commands-FHSAtJu3.mjs} +96 -88
- package/dist/{ph-cli-commands-XNEhuXzO.mjs.map → ph-cli-commands-FHSAtJu3.mjs.map} +1 -1
- package/dist/{render-BinrNDU0.mjs → render-BO-Nwn2H.mjs} +6 -9
- package/dist/render-BO-Nwn2H.mjs.map +1 -0
- package/dist/render-DdieUjtg.mjs +4 -0
- package/dist/{run-sugar-yf2ggYJ9.mjs → run-sugar-D9lIzhAx.mjs} +4 -4
- package/dist/{run-sugar-yf2ggYJ9.mjs.map → run-sugar-D9lIzhAx.mjs.map} +1 -1
- package/dist/runners/connect.mjs +2 -2
- package/dist/runners/switchboard.mjs +1 -1
- package/dist/{schemas-ZQiV98u4.mjs → schemas-DzgKfQIx.mjs} +94 -4
- package/dist/{schemas-ZQiV98u4.mjs.map → schemas-DzgKfQIx.mjs.map} +1 -1
- package/dist/{verify-D16BN0dO.mjs → verify-BRwHZaDj.mjs} +21 -14
- package/dist/verify-BRwHZaDj.mjs.map +1 -0
- package/dist/{vetra-CdYsxlvS.mjs → vetra-DSFzAl_1.mjs} +6 -6
- package/dist/{vetra-CdYsxlvS.mjs.map → vetra-DSFzAl_1.mjs.map} +1 -1
- package/package.json +16 -16
- package/dist/build-BYl_Uu3s.mjs +0 -4
- package/dist/build-Dfrq_MIX.mjs.map +0 -1
- package/dist/files-D05VjxVj.mjs.map +0 -1
- package/dist/ph-cli-commands-DAqHeYm7.mjs +0 -4
- package/dist/render-BinrNDU0.mjs.map +0 -1
- package/dist/render-CTQG4359.mjs +0 -4
- package/dist/verify-D16BN0dO.mjs.map +0 -1
|
@@ -1,10 +1,24 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
3
|
-
import { c as
|
|
4
|
-
import { existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, readlinkSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
5
|
-
import { dirname, join, posix, relative, resolve, sep } from "node:path";
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="fe8bf27c-1748-57ef-aec3-baf7d689bdaa")}catch(e){}}();
|
|
3
|
+
import { _ as unknown, c as literal, d as object, f as record, h as templateLiteral, l as looseObject, m as string, n as _enum, o as discriminatedUnion, r as array } from "./schemas-DzgKfQIx.mjs";
|
|
4
|
+
import { existsSync, lstatSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, readlinkSync, realpathSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
5
|
+
import { basename, dirname, join, posix, relative, resolve, sep } from "node:path";
|
|
6
6
|
import { spawnSync } from "node:child_process";
|
|
7
7
|
import { createHash } from "node:crypto";
|
|
8
|
+
import { tmpdir } from "node:os";
|
|
9
|
+
import { gunzipSync } from "node:zlib";
|
|
10
|
+
//#region src/services/build-control.ts
|
|
11
|
+
/** Scratch space of `ph build`, per package. */
|
|
12
|
+
const BUILD_DIRECTORY = join(".ph", "build");
|
|
13
|
+
const LOCK_FILE = join(BUILD_DIRECTORY, "lock");
|
|
14
|
+
const takeoverPrefix = (lockName) => `${lockName}.takeover-`;
|
|
15
|
+
const pendingPrefix = (fileName) => `.${fileName}.`;
|
|
16
|
+
function isBuildLockFile(path) {
|
|
17
|
+
const lockName = basename(LOCK_FILE);
|
|
18
|
+
const name = posix.basename(path);
|
|
19
|
+
return posix.dirname(path) === BUILD_DIRECTORY.split(sep).join("/") && (name === lockName || name.startsWith(takeoverPrefix(lockName)) || name.startsWith(pendingPrefix(lockName)));
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
8
22
|
//#region src/services/release/revision.ts
|
|
9
23
|
/**
|
|
10
24
|
* The package revision: one digest over its files, sorted by path, bound to
|
|
@@ -40,6 +54,7 @@ const hostFinding = looseObject({
|
|
|
40
54
|
kind: _enum([
|
|
41
55
|
"scalar-unbound",
|
|
42
56
|
"scalar-mismatch",
|
|
57
|
+
"scalar-uncomparable",
|
|
43
58
|
"definition-invalid",
|
|
44
59
|
"definition-mismatch"
|
|
45
60
|
]),
|
|
@@ -172,6 +187,135 @@ function verifyReleaseApproval(approval, current) {
|
|
|
172
187
|
};
|
|
173
188
|
}
|
|
174
189
|
//#endregion
|
|
190
|
+
//#region src/services/release/pack.ts
|
|
191
|
+
const manifestSchema = looseObject({
|
|
192
|
+
name: string(),
|
|
193
|
+
version: string(),
|
|
194
|
+
main: string().optional(),
|
|
195
|
+
exports: unknown().optional(),
|
|
196
|
+
dependencies: record(string(), string()).optional(),
|
|
197
|
+
optionalDependencies: record(string(), string()).optional(),
|
|
198
|
+
peerDependencies: record(string(), string()).optional()
|
|
199
|
+
});
|
|
200
|
+
const packListing = array(object({
|
|
201
|
+
name: string(),
|
|
202
|
+
version: string(),
|
|
203
|
+
filename: string()
|
|
204
|
+
}));
|
|
205
|
+
/** npm refuses `--workspaces=false` while its configuration selects one. */
|
|
206
|
+
const SELECTS_WORKSPACE = /--no-workspaces and --workspace/;
|
|
207
|
+
const selectsAnotherPackage = (packageRoot) => `npm's configuration (a workspace setting in the environment or an .npmrc) selects a package other than the one in ${packageRoot}; the release approval covers that package only.`;
|
|
208
|
+
const BLOCK = 512;
|
|
209
|
+
function field(header, start, length) {
|
|
210
|
+
const bytes = header.subarray(start, start + length);
|
|
211
|
+
const end = bytes.indexOf(0);
|
|
212
|
+
return bytes.subarray(0, end === -1 ? length : end).toString("utf8");
|
|
213
|
+
}
|
|
214
|
+
function paxPath(body) {
|
|
215
|
+
for (let offset = 0; offset < body.length;) {
|
|
216
|
+
const space = body.indexOf(32, offset);
|
|
217
|
+
const length = Number(body.subarray(offset, space).toString("ascii"));
|
|
218
|
+
if (space === -1 || !(length > 0)) return void 0;
|
|
219
|
+
const record = body.subarray(space + 1, offset + length - 1).toString("utf8");
|
|
220
|
+
if (record.startsWith("path=")) return record.slice(5);
|
|
221
|
+
offset += length;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
function readTarball(tarball) {
|
|
225
|
+
const tar = gunzipSync(readFileSync(tarball));
|
|
226
|
+
const files = /* @__PURE__ */ new Map();
|
|
227
|
+
let longPath;
|
|
228
|
+
for (let offset = 0; offset + BLOCK <= tar.length;) {
|
|
229
|
+
const header = tar.subarray(offset, offset + BLOCK);
|
|
230
|
+
if (header.every((byte) => byte === 0)) break;
|
|
231
|
+
const size = parseInt(field(header, 124, 12).trim() || "0", 8);
|
|
232
|
+
const type = String.fromCharCode(header[156] || 48);
|
|
233
|
+
const body = tar.subarray(offset + BLOCK, offset + BLOCK + size);
|
|
234
|
+
offset += BLOCK + Math.ceil(size / BLOCK) * BLOCK;
|
|
235
|
+
if (type === "x") {
|
|
236
|
+
longPath = paxPath(body) ?? longPath;
|
|
237
|
+
continue;
|
|
238
|
+
}
|
|
239
|
+
if (type === "L") {
|
|
240
|
+
longPath = field(body, 0, body.length);
|
|
241
|
+
continue;
|
|
242
|
+
}
|
|
243
|
+
if (type === "g") continue;
|
|
244
|
+
const prefix = field(header, 345, 155);
|
|
245
|
+
const name = field(header, 0, 100);
|
|
246
|
+
const path = longPath ?? (prefix === "" ? name : `${prefix}/${name}`);
|
|
247
|
+
longPath = void 0;
|
|
248
|
+
if (type === "5") continue;
|
|
249
|
+
const inside = posix.normalize(path.split("/").slice(1).join("/"));
|
|
250
|
+
if (inside === "." || inside.startsWith("../") || posix.isAbsolute(inside)) throw new Error(`the tarball has an entry outside the package: ${path}`);
|
|
251
|
+
const bytes = type === "1" || type === "2" ? Buffer.from(field(header, 157, 100)) : Buffer.from(body);
|
|
252
|
+
files.set(inside, bytes);
|
|
253
|
+
}
|
|
254
|
+
return files;
|
|
255
|
+
}
|
|
256
|
+
function packRelease(packageRoot) {
|
|
257
|
+
const directory = realpathSync.native(mkdtempSync(join(tmpdir(), "ph-release-")));
|
|
258
|
+
const dispose = () => rmSync(directory, {
|
|
259
|
+
recursive: true,
|
|
260
|
+
force: true
|
|
261
|
+
});
|
|
262
|
+
try {
|
|
263
|
+
const packed = spawnSync("npm", [
|
|
264
|
+
"pack",
|
|
265
|
+
"--json",
|
|
266
|
+
"--ignore-scripts",
|
|
267
|
+
"--workspaces=false",
|
|
268
|
+
"--pack-destination",
|
|
269
|
+
process.platform === "win32" ? `"${directory}"` : directory
|
|
270
|
+
], {
|
|
271
|
+
cwd: packageRoot,
|
|
272
|
+
encoding: "utf8",
|
|
273
|
+
maxBuffer: 268435456,
|
|
274
|
+
stdio: [
|
|
275
|
+
"ignore",
|
|
276
|
+
"pipe",
|
|
277
|
+
"pipe"
|
|
278
|
+
],
|
|
279
|
+
shell: process.platform === "win32"
|
|
280
|
+
});
|
|
281
|
+
if (packed.status !== 0) {
|
|
282
|
+
if (SELECTS_WORKSPACE.test(`${packed.stdout}${packed.stderr}`)) throw new Error(selectsAnotherPackage(packageRoot));
|
|
283
|
+
throw new Error(`npm pack could not pack the package: ${(packed.stderr || packed.error?.message || packed.stdout).trim()}`);
|
|
284
|
+
}
|
|
285
|
+
const listings = packListing.parse(JSON.parse(packed.stdout));
|
|
286
|
+
const root = object({
|
|
287
|
+
name: string(),
|
|
288
|
+
version: string()
|
|
289
|
+
}).parse(JSON.parse(readFileSync(join(packageRoot, "package.json"), "utf8")));
|
|
290
|
+
const [listing] = listings;
|
|
291
|
+
const tarballs = readdirSync(directory);
|
|
292
|
+
if (listings.length !== 1 || listing.name !== root.name || listing.version !== root.version || tarballs.length !== 1) {
|
|
293
|
+
const packs = listings.map(({ name, version }) => `${name}@${version}`);
|
|
294
|
+
throw new Error(`npm pack packs ${packs.join(", ") || "no package"}, not ${root.name}@${root.version}: ${selectsAnotherPackage(packageRoot)}`);
|
|
295
|
+
}
|
|
296
|
+
const tarball = join(directory, tarballs[0]);
|
|
297
|
+
const files = readTarball(tarball);
|
|
298
|
+
const manifestBytes = files.get("package.json");
|
|
299
|
+
if (manifestBytes === void 0) throw new Error("npm pack wrote a tarball without a package.json");
|
|
300
|
+
return {
|
|
301
|
+
directory,
|
|
302
|
+
tarball,
|
|
303
|
+
manifest: manifestSchema.parse(JSON.parse(manifestBytes.toString("utf8"))),
|
|
304
|
+
files,
|
|
305
|
+
dispose
|
|
306
|
+
};
|
|
307
|
+
} catch (error) {
|
|
308
|
+
dispose();
|
|
309
|
+
throw error;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
function packedDigests(packed) {
|
|
313
|
+
return [...packed.files].filter(([path]) => path !== ".ph/build/release-approval.json" && !isBuildLockFile(path)).map(([path, bytes]) => ({
|
|
314
|
+
path,
|
|
315
|
+
sha256: createHash("sha256").update(bytes).digest("hex")
|
|
316
|
+
})).sort(byPath);
|
|
317
|
+
}
|
|
318
|
+
//#endregion
|
|
175
319
|
//#region src/services/release/files.ts
|
|
176
320
|
const ALWAYS_EXCLUDED = /* @__PURE__ */ new Set([
|
|
177
321
|
"node_modules",
|
|
@@ -265,56 +409,19 @@ function revisionFiles(packageRoot, excluded) {
|
|
|
265
409
|
const included = (path) => !path.split("/").some((segment) => ALWAYS_EXCLUDED.has(segment) || BUILD_SCRATCH.test(segment)) && !excluded.some((exclusion) => path === exclusion || path.startsWith(`${exclusion}/`));
|
|
266
410
|
return (insideWorkTree(packageRoot) ? gitFiles(packageRoot) : walkedFiles(packageRoot, included)).filter(included).flatMap((path) => digestOf(packageRoot, path) ?? []).sort(byPath);
|
|
267
411
|
}
|
|
268
|
-
const packListing = array(object({
|
|
269
|
-
name: string(),
|
|
270
|
-
version: string(),
|
|
271
|
-
files: array(object({ path: string() }))
|
|
272
|
-
}));
|
|
273
|
-
const packageIdentity = object({
|
|
274
|
-
name: string(),
|
|
275
|
-
version: string()
|
|
276
|
-
});
|
|
277
|
-
/** npm refuses `--workspaces=false` while its configuration selects one. */
|
|
278
|
-
const SELECTS_WORKSPACE = /--no-workspaces and --workspace/;
|
|
279
|
-
const selectsAnotherPackage = (packageRoot) => `npm's configuration (a workspace setting in the environment or an .npmrc) selects a package other than the one in ${packageRoot}; the release approval covers that package only.`;
|
|
280
412
|
/**
|
|
281
|
-
* What `npm pack`
|
|
282
|
-
*
|
|
283
|
-
*
|
|
284
|
-
*
|
|
413
|
+
* What `npm pack` publishes from the package root, with digests read from the
|
|
414
|
+
* packed tarball. Workspaces are off, so npm packs the root package or
|
|
415
|
+
* refuses; a tarball of another package than the root's package.json names
|
|
416
|
+
* throws as well.
|
|
285
417
|
*/
|
|
286
418
|
function publishedFiles(packageRoot) {
|
|
287
|
-
const packed =
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
"--workspaces=false"
|
|
293
|
-
], {
|
|
294
|
-
cwd: packageRoot,
|
|
295
|
-
encoding: "utf8",
|
|
296
|
-
maxBuffer: 268435456,
|
|
297
|
-
stdio: [
|
|
298
|
-
"ignore",
|
|
299
|
-
"pipe",
|
|
300
|
-
"pipe"
|
|
301
|
-
],
|
|
302
|
-
shell: process.platform === "win32"
|
|
303
|
-
});
|
|
304
|
-
if (packed.status !== 0) {
|
|
305
|
-
if (SELECTS_WORKSPACE.test(`${packed.stdout}${packed.stderr}`)) throw new Error(selectsAnotherPackage(packageRoot));
|
|
306
|
-
throw new Error(`npm pack could not list the published files: ${(packed.stderr || packed.error?.message || packed.stdout).trim()}`);
|
|
419
|
+
const packed = packRelease(packageRoot);
|
|
420
|
+
try {
|
|
421
|
+
return packedDigests(packed);
|
|
422
|
+
} finally {
|
|
423
|
+
packed.dispose();
|
|
307
424
|
}
|
|
308
|
-
const listings = packListing.parse(JSON.parse(packed.stdout));
|
|
309
|
-
const root = packageIdentity.parse(JSON.parse(readFileSync(join(packageRoot, "package.json"), "utf8")));
|
|
310
|
-
const packs = listings.map(({ name, version }) => `${name}@${version}`);
|
|
311
|
-
const [listing] = listings;
|
|
312
|
-
if (listings.length !== 1 || listing.name !== root.name || listing.version !== root.version) throw new Error(`npm pack lists ${packs.join(", ") || "no package"}, not ${root.name}@${root.version}: ${selectsAnotherPackage(packageRoot)}`);
|
|
313
|
-
return listing.files.map(({ path }) => posix.normalize(toPosix(path))).filter((path) => path !== ".ph" && !path.startsWith(".ph/")).flatMap((path) => {
|
|
314
|
-
const digest = digestOf(packageRoot, path);
|
|
315
|
-
if (digest === void 0) throw new Error(`npm pack lists ${path}, which cannot be read.`);
|
|
316
|
-
return [digest];
|
|
317
|
-
}).sort(byPath);
|
|
318
425
|
}
|
|
319
426
|
const approvalFile = (packageRoot) => join(packageRoot, ...RELEASE_APPROVAL_PATH.split("/"));
|
|
320
427
|
function readReleaseApproval(packageRoot) {
|
|
@@ -344,7 +451,7 @@ function writeReleaseApproval(packageRoot, approval) {
|
|
|
344
451
|
}
|
|
345
452
|
}
|
|
346
453
|
//#endregion
|
|
347
|
-
export { writeReleaseApproval as a,
|
|
454
|
+
export { pendingPrefix as _, writeReleaseApproval as a, PH_CLI_BINDING as c, listed as d, verifyReleaseApproval as f, LOCK_FILE as g, BUILD_DIRECTORY as h, revisionFiles as i, RELEASE_APPROVAL_PATH as l, packageRevision as m, publishedFiles as n, packRelease as o, changedPaths as p, readReleaseApproval as r, packedDigests as s, packagePath as t, decisionWithoutApproval as u, takeoverPrefix as v };
|
|
348
455
|
|
|
349
|
-
//# sourceMappingURL=files-
|
|
350
|
-
//# debugId=
|
|
456
|
+
//# sourceMappingURL=files-D6_euBBn.mjs.map
|
|
457
|
+
//# debugId=fe8bf27c-1748-57ef-aec3-baf7d689bdaa
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files-D6_euBBn.mjs","sources":["../src/services/build-control.ts","../src/services/release/revision.ts","../src/services/release/approval.ts","../src/services/release/pack.ts","../src/services/release/files.ts"],"sourcesContent":["import { basename, join, posix, sep } from \"node:path\";\n\n/** Scratch space of `ph build`, per package. */\nexport const BUILD_DIRECTORY = join(\".ph\", \"build\");\nexport const LOCK_FILE = join(BUILD_DIRECTORY, \"lock\");\n\nexport const takeoverPrefix = (lockName: string) => `${lockName}.takeover-`;\nexport const pendingPrefix = (fileName: string) => `.${fileName}.`;\n\nexport function isBuildLockFile(path: string): boolean {\n const lockName = basename(LOCK_FILE);\n const name = posix.basename(path);\n return (\n posix.dirname(path) === BUILD_DIRECTORY.split(sep).join(\"/\") &&\n (name === lockName ||\n name.startsWith(takeoverPrefix(lockName)) ||\n name.startsWith(pendingPrefix(lockName)))\n );\n}\n","import { createHash } from \"node:crypto\";\n\nexport type Sha256 = `sha256:${string}`;\n\n/** One file, by its POSIX path relative to the package root, and the hex sha256 of its bytes. */\nexport type FileDigest = { readonly path: string; readonly sha256: string };\n\n/**\n * The package revision: one digest over its files, sorted by path, bound to\n * the given values (the ph-cli version), so the same files under another\n * ph-cli are another revision.\n */\nexport function packageRevision(\n files: readonly FileDigest[],\n bindings: Readonly<Record<string, string>>,\n): Sha256 {\n const hash = createHash(\"sha256\");\n for (const { path, sha256 } of [...files].sort(byPath)) {\n hash.update(`${path}\\0${sha256}\\n`);\n }\n for (const key of Object.keys(bindings).sort()) {\n hash.update(`binding:${key}\\0${bindings[key]}\\n`);\n }\n return `sha256:${hash.digest(\"hex\")}`;\n}\n\nexport function byPath(left: FileDigest, right: FileDigest): number {\n return left.path < right.path ? -1 : left.path > right.path ? 1 : 0;\n}\n\n/** Paths added, removed or with other bytes in `after`, sorted. */\nexport function changedPaths(\n before: readonly FileDigest[],\n after: readonly FileDigest[],\n): string[] {\n const was = new Map(before.map(({ path, sha256 }) => [path, sha256]));\n const now = new Map(after.map(({ path, sha256 }) => [path, sha256]));\n return [...new Set([...was.keys(), ...now.keys()])]\n .filter((path) => was.get(path) !== now.get(path))\n .sort();\n}\n","import { z } from \"zod\";\nimport { type FileDigest, packageRevision } from \"./revision.js\";\n\n/** Where `ph build --release` records its approval, relative to the package root. */\nexport const RELEASE_APPROVAL_PATH = \".ph/build/release-approval.json\";\n\n/** The binding key of the ph-cli version in the package revision. */\nexport const PH_CLI_BINDING = \"ph-cli\";\n\nconst fileDigest = z.object({\n path: z.string(),\n sha256: z.string().regex(/^[0-9a-f]{64}$/),\n});\n\nconst hostFinding = z.looseObject({\n kind: z.enum([\n \"scalar-unbound\",\n \"scalar-mismatch\",\n \"scalar-uncomparable\",\n \"definition-invalid\",\n \"definition-mismatch\",\n ]),\n documentType: z.string(),\n scalar: z.string().optional(),\n});\n\nconst approvalSchema = z.object({\n kind: z.literal(\"powerhouse.release-approval\"),\n formatVersion: z.literal(1),\n phCliVersion: z.string(),\n /** POSIX, relative to the package root: the output directory the build replaced. */\n outDir: z.string(),\n packageRevision: z.object({\n digest: z.templateLiteral([\"sha256:\", z.string()]),\n /** Compiler outputs left out besides the fixed exclusions, POSIX and package relative. */\n excluded: z.array(z.string()).readonly(),\n }),\n /** What `npm pack` publishes, sorted by path. */\n publishedFiles: z.array(fileDigest).readonly(),\n report: z.object({\n profile: z.literal(\"release\"),\n status: z.enum([\"ok\", \"invalid\", \"failed\", \"skipped\"]),\n definitions: z\n .array(z.looseObject({ kind: z.string(), key: z.string() }))\n .readonly(),\n }),\n scalars: z\n .array(\n z.object({\n scalar: z.string(),\n packageName: z.string(),\n version: z.string().nullable(),\n }),\n )\n .readonly(),\n hostValidation: z.discriminatedUnion(\"completed\", [\n z.object({\n completed: z.literal(true),\n findings: z.array(hostFinding).readonly(),\n }),\n z.object({\n completed: z.literal(false),\n reason: z.string(),\n findings: z.array(hostFinding).readonly(),\n }),\n ]),\n});\n\n/** `.ph/build/release-approval.json`: what a successful `ph build --release` checked and built. */\nexport type ReleaseApproval = z.infer<typeof approvalSchema>;\n\n/** One scalar the package's models use, and the package and version that provide it. */\nexport type ScalarBinding = ReleaseApproval[\"scalars\"][number];\n\nexport type ApprovalRead =\n | { readonly kind: \"missing\" }\n | { readonly kind: \"unreadable\"; readonly reason: string }\n | { readonly kind: \"found\"; readonly approval: ReleaseApproval };\n\n/** Parses an approval file's text. */\nexport function parseReleaseApproval(\n text: string,\n): Exclude<ApprovalRead, { kind: \"missing\" }> {\n let json: unknown;\n try {\n json = JSON.parse(text);\n } catch {\n return { kind: \"unreadable\", reason: \"it is not JSON\" };\n }\n const parsed = approvalSchema.safeParse(json);\n if (parsed.success) return { kind: \"found\", approval: parsed.data };\n const [issue] = parsed.error.issues;\n const at = issue.path.length > 0 ? ` at ${issue.path.join(\".\")}` : \"\";\n return {\n kind: \"unreadable\",\n reason: `it is not an approval this ph-cli reads (${issue.message}${at})`,\n };\n}\n\n/** The package as it is now, read with the approval's output directory and exclusions. */\nexport type CurrentRelease = {\n readonly phCliVersion: string;\n /** The files the package revision reads. */\n readonly files: readonly FileDigest[];\n readonly publishedFiles: readonly FileDigest[];\n};\n\ntype Reasons = readonly [string, ...string[]];\n\n/** Whether the package may be published as the approval describes it, and why not. */\nexport type ReleaseDecision =\n | { readonly decision: \"approved\"; readonly reasons: readonly [] }\n | {\n readonly decision: \"missing\" | \"unreadable\" | \"stale\" | \"refused\";\n readonly reasons: Reasons;\n };\n\n/** The decision when there is no approval to compare. */\nexport function decisionWithoutApproval(\n read: Exclude<ApprovalRead, { kind: \"found\" }>,\n): ReleaseDecision {\n return read.kind === \"missing\"\n ? {\n decision: \"missing\",\n reasons: [\n `there is no release approval (${RELEASE_APPROVAL_PATH}); ph build --release writes one`,\n ],\n }\n : {\n decision: \"unreadable\",\n reasons: [\n `the release approval (${RELEASE_APPROVAL_PATH}) cannot be read: ${read.reason}`,\n ],\n };\n}\n\nconst LISTED = 5;\n\n/** Up to five items, then how many more. */\nexport function listed(items: readonly string[]): string {\n const shown = items.slice(0, LISTED).join(\", \");\n return items.length > LISTED\n ? `${shown} and ${items.length - LISTED} more`\n : shown;\n}\n\nconst plural = (count: number, one: string, many: string) =>\n `${count} ${count === 1 ? one : many}`;\n\nfunction describeFinding(\n finding: ReleaseApproval[\"hostValidation\"][\"findings\"][number],\n): string {\n return finding.scalar === undefined\n ? `${finding.kind} in ${finding.documentType}`\n : `${finding.kind} ${finding.scalar} in ${finding.documentType}`;\n}\n\nfunction refusalReasons(approval: ReleaseApproval): string[] {\n const { report, hostValidation } = approval;\n const reasons: string[] = [];\n if (report.status === \"invalid\" || report.status === \"failed\") {\n reasons.push(`its release check reported ${report.status}`);\n }\n if (!hostValidation.completed) {\n reasons.push(`host validation did not complete: ${hostValidation.reason}`);\n }\n if (hostValidation.findings.length > 0) {\n reasons.push(\n `host validation found ${plural(hostValidation.findings.length, \"problem\", \"problems\")}: ${listed(hostValidation.findings.map(describeFinding))}`,\n );\n }\n return reasons;\n}\n\nfunction staleReasons(\n approval: ReleaseApproval,\n current: CurrentRelease,\n): string[] {\n const reasons: string[] = [];\n if (approval.phCliVersion !== current.phCliVersion) {\n reasons.push(\n `it was made by ph-cli ${approval.phCliVersion}, and this is ph-cli ${current.phCliVersion}`,\n );\n }\n // Under the approval's own binding, so a new ph-cli alone does not read as edited files.\n const revision = packageRevision(current.files, {\n [PH_CLI_BINDING]: approval.phCliVersion,\n });\n if (revision !== approval.packageRevision.digest) {\n reasons.push(\"the package's files changed since the approval was made\");\n }\n const approved = new Map(\n approval.publishedFiles.map(({ path, sha256 }) => [path, sha256]),\n );\n const now = new Map(\n current.publishedFiles.map(({ path, sha256 }) => [path, sha256]),\n );\n const added = [...now.keys()].filter((path) => !approved.has(path));\n const removed = [...approved.keys()].filter((path) => !now.has(path));\n const changed = [...now].filter(\n ([path, sha256]) => approved.has(path) && approved.get(path) !== sha256,\n );\n const files = (paths: readonly string[], what: string) =>\n `${plural(paths.length, \"published file\", \"published files\")} ${what} since the approval was made: ${listed(paths)}`;\n if (added.length > 0) reasons.push(files(added, \"added\"));\n if (removed.length > 0) reasons.push(files(removed, \"removed\"));\n if (changed.length > 0) {\n reasons.push(\n files(\n changed.map(([path]) => path),\n \"changed\",\n ),\n );\n }\n return reasons;\n}\n\nfunction decided(\n decision: \"stale\" | \"refused\",\n reasons: readonly string[],\n): ReleaseDecision | undefined {\n if (reasons.length === 0) return undefined;\n const [first, ...rest] = reasons;\n return { decision, reasons: [first, ...rest] };\n}\n\n/**\n * Whether the package as it is now is the one the approval checked. Refused\n * when the approval records a failed check; stale when ph-cli, the package's\n * files or the published files changed since.\n */\nexport function verifyReleaseApproval(\n approval: ReleaseApproval,\n current: CurrentRelease,\n): ReleaseDecision {\n return (\n decided(\"refused\", refusalReasons(approval)) ??\n decided(\"stale\", staleReasons(approval, current)) ?? {\n decision: \"approved\",\n reasons: [],\n }\n );\n}\n","import { spawnSync } from \"node:child_process\";\nimport { createHash } from \"node:crypto\";\nimport {\n mkdtempSync,\n readdirSync,\n readFileSync,\n realpathSync,\n rmSync,\n} from \"node:fs\";\nimport { tmpdir } from \"node:os\";\nimport { join, posix } from \"node:path\";\nimport { gunzipSync } from \"node:zlib\";\nimport { z } from \"zod\";\nimport { isBuildLockFile } from \"../build-control.js\";\nimport { RELEASE_APPROVAL_PATH } from \"./approval.js\";\nimport { byPath, type FileDigest } from \"./revision.js\";\n\nexport type PackedRelease = {\n readonly directory: string;\n readonly tarball: string;\n readonly manifest: PackedManifest;\n readonly files: ReadonlyMap<string, Buffer>;\n readonly dispose: () => void;\n};\n\nconst manifestSchema = z.looseObject({\n name: z.string(),\n version: z.string(),\n main: z.string().optional(),\n exports: z.unknown().optional(),\n dependencies: z.record(z.string(), z.string()).optional(),\n optionalDependencies: z.record(z.string(), z.string()).optional(),\n peerDependencies: z.record(z.string(), z.string()).optional(),\n});\n\nexport type PackedManifest = z.infer<typeof manifestSchema>;\n\nconst packListing = z.array(\n z.object({ name: z.string(), version: z.string(), filename: z.string() }),\n);\n\n/** npm refuses `--workspaces=false` while its configuration selects one. */\nconst SELECTS_WORKSPACE = /--no-workspaces and --workspace/;\n\nexport const selectsAnotherPackage = (packageRoot: string) =>\n `npm's configuration (a workspace setting in the environment or an .npmrc) selects a package other than the one in ${packageRoot}; the release approval covers that package only.`;\n\nconst BLOCK = 512;\n\nfunction field(header: Buffer, start: number, length: number): string {\n const bytes = header.subarray(start, start + length);\n const end = bytes.indexOf(0);\n return bytes.subarray(0, end === -1 ? length : end).toString(\"utf8\");\n}\n\nfunction paxPath(body: Buffer): string | undefined {\n for (let offset = 0; offset < body.length;) {\n const space = body.indexOf(0x20, offset);\n const length = Number(body.subarray(offset, space).toString(\"ascii\"));\n if (space === -1 || !(length > 0)) return undefined;\n const record = body\n .subarray(space + 1, offset + length - 1)\n .toString(\"utf8\");\n if (record.startsWith(\"path=\")) return record.slice(\"path=\".length);\n offset += length;\n }\n return undefined;\n}\n\nexport function readTarball(tarball: string): Map<string, Buffer> {\n const tar = gunzipSync(readFileSync(tarball));\n const files = new Map<string, Buffer>();\n let longPath: string | undefined;\n for (let offset = 0; offset + BLOCK <= tar.length;) {\n const header = tar.subarray(offset, offset + BLOCK);\n if (header.every((byte) => byte === 0)) break;\n const size = parseInt(field(header, 124, 12).trim() || \"0\", 8);\n const type = String.fromCharCode(header[156] || 48);\n const body = tar.subarray(offset + BLOCK, offset + BLOCK + size);\n offset += BLOCK + Math.ceil(size / BLOCK) * BLOCK;\n if (type === \"x\") {\n longPath = paxPath(body) ?? longPath;\n continue;\n }\n if (type === \"L\") {\n longPath = field(body, 0, body.length);\n continue;\n }\n if (type === \"g\") continue;\n const prefix = field(header, 345, 155);\n const name = field(header, 0, 100);\n const path = longPath ?? (prefix === \"\" ? name : `${prefix}/${name}`);\n longPath = undefined;\n if (type === \"5\") continue;\n const inside = posix.normalize(path.split(\"/\").slice(1).join(\"/\"));\n if (\n inside === \".\" ||\n inside.startsWith(\"../\") ||\n posix.isAbsolute(inside)\n ) {\n throw new Error(`the tarball has an entry outside the package: ${path}`);\n }\n const bytes =\n type === \"1\" || type === \"2\"\n ? Buffer.from(field(header, 157, 100))\n : Buffer.from(body);\n files.set(inside, bytes);\n }\n return files;\n}\n\nexport function packRelease(packageRoot: string): PackedRelease {\n const directory = realpathSync.native(\n mkdtempSync(join(tmpdir(), \"ph-release-\")),\n );\n const dispose = () => rmSync(directory, { recursive: true, force: true });\n try {\n const packed = spawnSync(\n \"npm\",\n [\n \"pack\",\n \"--json\",\n \"--ignore-scripts\",\n \"--workspaces=false\",\n \"--pack-destination\",\n // cmd.exe splits an unquoted path at its spaces.\n process.platform === \"win32\" ? `\"${directory}\"` : directory,\n ],\n {\n cwd: packageRoot,\n encoding: \"utf8\",\n maxBuffer: 256 * 1024 * 1024,\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n shell: process.platform === \"win32\",\n },\n );\n if (packed.status !== 0) {\n if (SELECTS_WORKSPACE.test(`${packed.stdout}${packed.stderr}`)) {\n throw new Error(selectsAnotherPackage(packageRoot));\n }\n throw new Error(\n `npm pack could not pack the package: ${(packed.stderr || packed.error?.message || packed.stdout).trim()}`,\n );\n }\n const listings = packListing.parse(JSON.parse(packed.stdout));\n const root = z\n .object({ name: z.string(), version: z.string() })\n .parse(\n JSON.parse(readFileSync(join(packageRoot, \"package.json\"), \"utf8\")),\n );\n const [listing] = listings;\n const tarballs = readdirSync(directory);\n if (\n listings.length !== 1 ||\n listing.name !== root.name ||\n listing.version !== root.version ||\n tarballs.length !== 1\n ) {\n const packs = listings.map(({ name, version }) => `${name}@${version}`);\n throw new Error(\n `npm pack packs ${packs.join(\", \") || \"no package\"}, not ${root.name}@${root.version}: ${selectsAnotherPackage(packageRoot)}`,\n );\n }\n const tarball = join(directory, tarballs[0]);\n const files = readTarball(tarball);\n const manifestBytes = files.get(\"package.json\");\n if (manifestBytes === undefined) {\n throw new Error(\"npm pack wrote a tarball without a package.json\");\n }\n const manifest = manifestSchema.parse(\n JSON.parse(manifestBytes.toString(\"utf8\")),\n );\n return { directory, tarball, manifest, files, dispose };\n } catch (error) {\n dispose();\n throw error;\n }\n}\n\nexport function packedDigests(packed: PackedRelease): FileDigest[] {\n return [...packed.files]\n .filter(\n ([path]) => path !== RELEASE_APPROVAL_PATH && !isBuildLockFile(path),\n )\n .map(([path, bytes]) => ({\n path,\n sha256: createHash(\"sha256\").update(bytes).digest(\"hex\"),\n }))\n .sort(byPath);\n}\n","import { spawnSync } from \"node:child_process\";\nimport { createHash } from \"node:crypto\";\nimport {\n type Dirent,\n existsSync,\n lstatSync,\n mkdirSync,\n readdirSync,\n readFileSync,\n readlinkSync,\n renameSync,\n rmSync,\n writeFileSync,\n} from \"node:fs\";\nimport { dirname, join, relative, resolve, sep } from \"node:path\";\nimport {\n type ApprovalRead,\n parseReleaseApproval,\n RELEASE_APPROVAL_PATH,\n type ReleaseApproval,\n} from \"./approval.js\";\nimport { packedDigests, packRelease } from \"./pack.js\";\nimport { byPath, type FileDigest } from \"./revision.js\";\n\nconst ALWAYS_EXCLUDED = new Set([\"node_modules\", \".git\", \".ph\"]);\n// A build's stage and retired tree, beside its output while it runs.\nconst BUILD_SCRATCH = /^\\..+\\.ph-(stage|old)-/;\n\nconst toPosix = (path: string) => path.split(sep).join(\"/\");\n\n/** `path` relative to the package root, in POSIX form. */\nexport function packagePath(packageRoot: string, path: string): string {\n return toPosix(relative(packageRoot, resolve(packageRoot, path)));\n}\n\nfunction sha256(bytes: string | Buffer): string {\n return createHash(\"sha256\").update(bytes).digest(\"hex\");\n}\n\n/** A file's digest; a symlink's is its target text, which is not followed. */\nfunction digestOf(packageRoot: string, path: string): FileDigest | undefined {\n const absolute = join(packageRoot, ...path.split(\"/\"));\n const stat = lstatSync(absolute, { throwIfNoEntry: false });\n if (stat?.isSymbolicLink()) {\n return { path, sha256: sha256(toPosix(readlinkSync(absolute))) };\n }\n return stat?.isFile()\n ? { path, sha256: sha256(readFileSync(absolute)) }\n : undefined;\n}\n\nfunction insideWorkTree(packageRoot: string): boolean {\n const probe = spawnSync(\"git\", [\"rev-parse\", \"--is-inside-work-tree\"], {\n cwd: packageRoot,\n encoding: \"utf8\",\n stdio: [\"ignore\", \"pipe\", \"ignore\"],\n });\n return probe.status === 0 && probe.stdout.trim() === \"true\";\n}\n\n/** Tracked and untracked files git does not ignore, relative to the package root. */\nfunction gitFiles(packageRoot: string): string[] {\n const listed = spawnSync(\n \"git\",\n [\"ls-files\", \"-co\", \"--exclude-standard\", \"-z\"],\n {\n cwd: packageRoot,\n encoding: \"utf8\",\n maxBuffer: 256 * 1024 * 1024,\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n },\n );\n if (listed.status !== 0) {\n throw new Error(\n `git ls-files could not list the package's files: ${listed.stderr || listed.error?.message}`,\n );\n }\n return [...new Set(listed.stdout.split(\"\\0\").filter(Boolean))];\n}\n\n/**\n * Every file under the package root, by POSIX path, without entering a\n * directory `included` rejects. Throws when a directory cannot be read.\n */\nfunction walkedFiles(\n packageRoot: string,\n included: (path: string) => boolean,\n): string[] {\n const files: string[] = [];\n const visit = (directory: string, prefix: string) => {\n let entries: Dirent[];\n try {\n entries = readdirSync(directory, { withFileTypes: true });\n } catch (error) {\n throw new Error(\n `the package directory ${prefix || \".\"} cannot be read: ${error instanceof Error ? error.message : String(error)}`,\n { cause: error },\n );\n }\n for (const entry of entries) {\n const path = prefix === \"\" ? entry.name : `${prefix}/${entry.name}`;\n if (!included(path)) continue;\n if (entry.isDirectory()) {\n visit(join(directory, entry.name), path);\n } else {\n files.push(path);\n }\n }\n };\n visit(packageRoot, \"\");\n return files;\n}\n\n/**\n * The files the package revision reads, with their digests: what git tracks\n * or would track inside a work tree, every file otherwise. Leaves out\n * node_modules, .git, .ph, a build's stage, and each excluded path (the\n * output directory, compiler outputs) with what is under it.\n */\nexport function revisionFiles(\n packageRoot: string,\n excluded: readonly string[],\n): FileDigest[] {\n const included = (path: string) =>\n !path\n .split(\"/\")\n .some(\n (segment) =>\n ALWAYS_EXCLUDED.has(segment) || BUILD_SCRATCH.test(segment),\n ) &&\n !excluded.some(\n (exclusion) => path === exclusion || path.startsWith(`${exclusion}/`),\n );\n const paths = insideWorkTree(packageRoot)\n ? gitFiles(packageRoot)\n : walkedFiles(packageRoot, included);\n return paths\n .filter(included)\n .flatMap((path) => digestOf(packageRoot, path) ?? [])\n .sort(byPath);\n}\n\n/**\n * What `npm pack` publishes from the package root, with digests read from the\n * packed tarball. Workspaces are off, so npm packs the root package or\n * refuses; a tarball of another package than the root's package.json names\n * throws as well.\n */\nexport function publishedFiles(packageRoot: string): FileDigest[] {\n const packed = packRelease(packageRoot);\n try {\n return packedDigests(packed);\n } finally {\n packed.dispose();\n }\n}\n\nconst approvalFile = (packageRoot: string) =>\n join(packageRoot, ...RELEASE_APPROVAL_PATH.split(\"/\"));\n\nexport function readReleaseApproval(packageRoot: string): ApprovalRead {\n const file = approvalFile(packageRoot);\n if (!existsSync(file)) return { kind: \"missing\" };\n let text: string;\n try {\n text = readFileSync(file, \"utf8\");\n } catch (error) {\n return {\n kind: \"unreadable\",\n reason: error instanceof Error ? error.message : String(error),\n };\n }\n return parseReleaseApproval(text);\n}\n\n/** Replaces the approval in one rename, so a reader never sees half of one. */\nexport function writeReleaseApproval(\n packageRoot: string,\n approval: ReleaseApproval,\n): void {\n const file = approvalFile(packageRoot);\n mkdirSync(dirname(file), { recursive: true });\n const temporary = `${file}.${process.pid}.tmp`;\n try {\n writeFileSync(temporary, `${JSON.stringify(approval, null, 2)}\\n`);\n renameSync(temporary, file);\n } finally {\n rmSync(temporary, { force: true });\n }\n}\n"],"names":["z.object","z.string","z.looseObject","z.enum","z.literal","z.templateLiteral","z.array","z\n .array","z\n .array","z.discriminatedUnion","z.looseObject","z.string","z.unknown","z.record","z.array","z.object","z\n .object"],"mappings":";;;;;;;;;;;AAGA,MAAa,kBAAkB,KAAK,OAA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;EACF,OAAO,aAAa,MAAM,MAAM;CAClC,SAAS,OAAO;EACd,OAAO;GACL,MAAM;GACN,QAAQ,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;EAC/D;CACF;CACA,OAAO,qBAAqB,IAAI;AAClC;;AAGA,SAAgB,qBACd,aACA,UACM;CACN,MAAM,OAAO,aAAa,WAAW;CACrC,UAAU,QAAQ,IAAI,GAAG,EAAE,WAAW,KAAK,CAAC;CAC5C,MAAM,YAAY,GAAG,KAAK,GAAG,QAAQ,IAAI;CACzC,IAAI;EACF,cAAc,WAAW,GAAG,KAAK,UAAU,UAAU,MAAM,CAAC,EAAE,GAAG;EACjE,WAAW,WAAW,IAAI;CAC5B,UAAU;EACR,OAAO,WAAW,EAAE,OAAO,KAAK,CAAC;CACnC;AACF","debug_id":"fe8bf27c-1748-57ef-aec3-baf7d689bdaa"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="d4e58662-4f9c-5d0e-bf7e-6b0f5fb5f539")}catch(e){}}();
|
|
3
3
|
import { t as isUniformRunnersEnabled } from "./feature-flags-xwqcHEWC.mjs";
|
|
4
|
-
import { M as probeHostsFolder } from "./compound-DO_mvh0O-
|
|
4
|
+
import { M as probeHostsFolder } from "./compound-DO_mvh0O-Dp1YPhR0.mjs";
|
|
5
5
|
import { t as warnSubgraphTypeConflicts } from "./warn-subgraph-type-conflicts-BOHBmThq.mjs";
|
|
6
6
|
import { n as selectProjectModelGeneration } from "./authoring-mode-DWbbsuWh.mjs";
|
|
7
7
|
import { t as startGenerateHosts } from "./generate-hosts-BFmPIW2X.mjs";
|
|
@@ -32,5 +32,5 @@ async function startGenerateAll(args, projectDir) {
|
|
|
32
32
|
//#endregion
|
|
33
33
|
export { startGenerateAll };
|
|
34
34
|
|
|
35
|
-
//# sourceMappingURL=generate-all-
|
|
36
|
-
//# debugId=
|
|
35
|
+
//# sourceMappingURL=generate-all-_7S0Iii2.mjs.map
|
|
36
|
+
//# debugId=d4e58662-4f9c-5d0e-bf7e-6b0f5fb5f539
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-all-
|
|
1
|
+
{"version":3,"file":"generate-all-_7S0Iii2.mjs","sources":["../src/services/generate-all.ts"],"sourcesContent":["import { buildTsMorphProject } from \"@powerhousedao/codegen/utils\";\nimport { extractAllDocuments, saveSpec } from \"@powerhousedao/vetra/codegen\";\nimport { probeHostsFolder } from \"@powerhousedao/host-core\";\nimport { isUniformRunnersEnabled } from \"../utils/feature-flags.js\";\nimport { warnSubgraphTypeConflicts } from \"../utils/warn-subgraph-type-conflicts.js\";\nimport { selectProjectModelGeneration } from \"./definitions/authoring-mode.js\";\nimport { startGenerateHosts } from \"./generate-hosts.js\";\n\nexport async function startGenerateAll(\n args: { extract?: boolean },\n projectDir: string,\n) {\n const project = buildTsMorphProject(projectDir);\n if (args.extract) {\n const all = extractAllDocuments(project);\n for (const doc of [\n ...all.documentModels,\n ...all.editors,\n ...all.processors,\n ...all.subgraphs,\n ...all.apps,\n ]) {\n const path = await saveSpec(doc, projectDir);\n console.log(`Wrote ${path}`);\n }\n return;\n }\n await selectProjectModelGeneration(projectDir).generateAll(project);\n await project.save();\n await warnSubgraphTypeConflicts(projectDir);\n if (\n isUniformRunnersEnabled() &&\n probeHostsFolder(projectDir).kind === \"present\" &&\n !(await startGenerateHosts(projectDir))\n ) {\n process.exitCode = 1;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;AAQA,eAAsB,iBACpB,MACA,YACA;CACA,MAAM,UAAU,oBAAoB,UAAU;CAC9C,IAAI,KAAK,SAAS;EAChB,MAAM,MAAM,oBAAoB,OAAO;EACvC,KAAK,MAAM,OAAO;GAChB,GAAG,IAAI;GACP,GAAG,IAAI;GACP,GAAG,IAAI;GACP,GAAG,IAAI;GACP,GAAG,IAAI;EACT,GAAG;GACD,MAAM,OAAO,MAAM,SAAS,KAAK,UAAU;GAC3C,QAAQ,IAAI,SAAS,MAAM;EAC7B;EACA;CACF;CACA,MAAM,6BAA6B,UAAU,CAAC,CAAC,YAAY,OAAO;CAClE,MAAM,QAAQ,KAAK;CACnB,MAAM,0BAA0B,UAAU;CAC1C,IACE,wBAAwB,KACxB,iBAAiB,UAAU,CAAC,CAAC,SAAS,aACtC,CAAE,MAAM,mBAAmB,UAAU,GAErC,QAAQ,WAAW;AAEvB","debug_id":"d4e58662-4f9c-5d0e-bf7e-6b0f5fb5f539"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
3
|
-
import {
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="a8b6ffb6-cb4f-5e08-b62d-af05b0350b70")}catch(e){}}();
|
|
3
|
+
import { g as union, i as boolean, m as string, p as strictObject, r as array, u as number } from "./schemas-DzgKfQIx.mjs";
|
|
4
4
|
import "node:module";
|
|
5
5
|
import fs from "node:fs";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import "node:child_process";
|
|
8
8
|
import { mapBackgroundImages, validateBackground } from "@powerhousedao/shared/connect";
|
|
9
|
+
import { deflateSync } from "node:zlib";
|
|
9
10
|
import "node:url";
|
|
10
11
|
import { isPassthroughImageRef } from "@powerhousedao/shared/connect/image-ref";
|
|
11
|
-
import { deflateSync } from "node:zlib";
|
|
12
12
|
//#region ../../packages/desktop/dist/bundle-backend-CvUS8-oc.mjs
|
|
13
13
|
/**
|
|
14
14
|
* `hosts/desktop/app.json` — the builder's desktop identity (phase 7, mode 1:
|
|
@@ -319,5 +319,5 @@ function startGenerateDesktopShell(args, cwd) {
|
|
|
319
319
|
//#endregion
|
|
320
320
|
export { startGenerateDesktopShell };
|
|
321
321
|
|
|
322
|
-
//# sourceMappingURL=generate-desktop-shell-
|
|
323
|
-
//# debugId=
|
|
322
|
+
//# sourceMappingURL=generate-desktop-shell-CEcE_1gb.mjs.map
|
|
323
|
+
//# debugId=a8b6ffb6-cb4f-5e08-b62d-af05b0350b70
|