@rebasepro/cli 0.29.1 → 0.29.3
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/{apps-Dg0NnmmJ.js → apps-MKQbgDtN.js} +3 -3
- package/dist/{apps-Dg0NnmmJ.js.map → apps-MKQbgDtN.js.map} +1 -1
- package/dist/{build-1Zo35L6a.js → build-BuKTnec8.js} +3 -3
- package/dist/{build-1Zo35L6a.js.map → build-BuKTnec8.js.map} +1 -1
- package/dist/{bundle-CTkzO2WG.js → bundle-BAH4FCju.js} +2 -2
- package/dist/{bundle-CTkzO2WG.js.map → bundle-BAH4FCju.js.map} +1 -1
- package/dist/{cloud-CFotGK2-.js → cloud-Cj5ey3l_.js} +139 -53
- package/dist/cloud-Cj5ey3l_.js.map +1 -0
- package/dist/commands/cloud/context.d.ts +1 -1
- package/dist/commands/cloud/rebuild-source.d.ts +27 -6
- package/dist/{context-DN1b9pCR.js → context-AXdAh-q8.js} +2 -2
- package/dist/{context-DN1b9pCR.js.map → context-AXdAh-q8.js.map} +1 -1
- package/dist/eject-DABcDnPN.js.map +1 -1
- package/dist/{fold-static-vbZJeo37.js → fold-static-BWzxNn06.js} +2 -2
- package/dist/{fold-static-vbZJeo37.js.map → fold-static-BWzxNn06.js.map} +1 -1
- package/dist/{generate_sdk-DCUUogIP.js → generate_sdk-DNmNuFuW.js} +2 -2
- package/dist/{generate_sdk-DCUUogIP.js.map → generate_sdk-DNmNuFuW.js.map} +1 -1
- package/dist/index.es.js +11 -11
- package/dist/{init-YzfyEffT.js → init-vL1DWOeC.js} +2 -2
- package/dist/{init-YzfyEffT.js.map → init-vL1DWOeC.js.map} +1 -1
- package/dist/manifest-BtzDy7KQ.js.map +1 -1
- package/dist/{normalize-imports-xpSL_GuU.js → normalize-imports-Bd5Y4yLp.js} +2 -2
- package/dist/{normalize-imports-xpSL_GuU.js.map → normalize-imports-Bd5Y4yLp.js.map} +1 -1
- package/dist/resources/status.d.ts +2 -2
- package/dist/{start-28EztR4R.js → start-YOr3X5Zm.js} +2 -2
- package/dist/{start-28EztR4R.js.map → start-YOr3X5Zm.js.map} +1 -1
- package/dist/status-BREvtzJm.js.map +1 -1
- package/package.json +8 -8
- package/templates/generated-schemas/blank.ts +8 -8
- package/templates/generated-schemas/blog.ts +33 -33
- package/templates/generated-schemas/ecommerce.ts +23 -23
- package/dist/cloud-CFotGK2-.js.map +0 -1
|
@@ -2,11 +2,11 @@ import { i as recordEvent, l as durationBucket } from "./telemetry-CgwJPVMO.js";
|
|
|
2
2
|
import { C as switchOn, D as unknownCommandMessage, c as findProjectRoot, p as requireProjectRoot } from "./project-CasK56vN.js";
|
|
3
3
|
import { t as cliUserAgent } from "./version-Buyyo1ut.js";
|
|
4
4
|
import { _ as selectDeployApp, d as findBackendApp, f as formatAppAddress, l as cmsMountOf, p as loadManifest } from "./manifest-BtzDy7KQ.js";
|
|
5
|
-
import { C as toolStdio, n as UNVENDORED_COST, s as buildBundle, x as unvendoredReason } from "./bundle-
|
|
6
|
-
import { $ as resolveCloudUrl, A as lookupProjectId, B as projectLinkPath, C as grantForLink, D as isKnownControlPlane, E as isJsonMode, F as printGroupHelp, G as requireClient, H as refuseDirectLink, I as printJson, J as requireKnownAction, K as requireCloudRow, L as probeToken, M as noteBlank, N as openUrl, O as keyValues, P as parseCloudArgs, Q as resolveCloudTarget, R as projectDotenvSetsAppKey, S as getContextOrg, T as initOutputMode, U as removeLink, V as readLink, W as reportError, X as requireProjectRef, Y as requireProject, Z as requireSessionClient, _ as fail, _t as orgCapabilitiesInScopes, a as billingAccountIdOf, at as storedGrantForLink, b as forgetEphemeralGrant, bt as wantsRawError, c as colorStatus, ct as writeLink, d as displayProjectRef, dt as ORG_CAPABILITY_NAMES, et as resolveProjectRef, f as dotenvSets, ft as TOKEN_CAPABILITIES, g as ephemeralGrantFor, gt as isTokenCapability, h as envToken, ht as isOrgCapability, i as appKeyExpiryNote, it as setCurrentContext, j as note, k as linkedEphemeralGrant, l as confirmDestructive, lt as ALWAYS_SCOPES, m as emitHelp, mt as capabilitiesInScopes, n as GLOBAL_HELP_FLAGS, nt as saveEphemeralGrant, o as cloudRow, ot as success, p as emit, pt as TOKEN_CAPABILITY_NAMES, q as requireInteractive, r as TOKEN_ENV, rt as setContextOrg, s as cloudRows, st as warn, t as GLOBAL_CLOUD_FLAGS, tt as resolveTimeoutMs, u as createCloudClient, ut as ORG_CAPABILITIES, v as fetchDeployTargets, vt as scopesForCapabilities, w as grantProjectOf, x as freshAccessToken, y as fetchTenantBaseDomain, yt as scopesForOrgCapabilities, z as projectHost } from "./context-
|
|
7
|
-
import { n as foldFrontendIntoBundle, r as foldableApps } from "./fold-static-
|
|
5
|
+
import { C as toolStdio, n as UNVENDORED_COST, s as buildBundle, x as unvendoredReason } from "./bundle-BAH4FCju.js";
|
|
6
|
+
import { $ as resolveCloudUrl, A as lookupProjectId, B as projectLinkPath, C as grantForLink, D as isKnownControlPlane, E as isJsonMode, F as printGroupHelp, G as requireClient, H as refuseDirectLink, I as printJson, J as requireKnownAction, K as requireCloudRow, L as probeToken, M as noteBlank, N as openUrl, O as keyValues, P as parseCloudArgs, Q as resolveCloudTarget, R as projectDotenvSetsAppKey, S as getContextOrg, T as initOutputMode, U as removeLink, V as readLink, W as reportError, X as requireProjectRef, Y as requireProject, Z as requireSessionClient, _ as fail, _t as orgCapabilitiesInScopes, a as billingAccountIdOf, at as storedGrantForLink, b as forgetEphemeralGrant, bt as wantsRawError, c as colorStatus, ct as writeLink, d as displayProjectRef, dt as ORG_CAPABILITY_NAMES, et as resolveProjectRef, f as dotenvSets, ft as TOKEN_CAPABILITIES, g as ephemeralGrantFor, gt as isTokenCapability, h as envToken, ht as isOrgCapability, i as appKeyExpiryNote, it as setCurrentContext, j as note, k as linkedEphemeralGrant, l as confirmDestructive, lt as ALWAYS_SCOPES, m as emitHelp, mt as capabilitiesInScopes, n as GLOBAL_HELP_FLAGS, nt as saveEphemeralGrant, o as cloudRow, ot as success, p as emit, pt as TOKEN_CAPABILITY_NAMES, q as requireInteractive, r as TOKEN_ENV, rt as setContextOrg, s as cloudRows, st as warn, t as GLOBAL_CLOUD_FLAGS, tt as resolveTimeoutMs, u as createCloudClient, ut as ORG_CAPABILITIES, v as fetchDeployTargets, vt as scopesForCapabilities, w as grantProjectOf, x as freshAccessToken, y as fetchTenantBaseDomain, yt as scopesForOrgCapabilities, z as projectHost } from "./context-AXdAh-q8.js";
|
|
7
|
+
import { n as foldFrontendIntoBundle, r as foldableApps } from "./fold-static-BWzxNn06.js";
|
|
8
8
|
import { n as deriveOptionsFor, r as deriveResourceGraph } from "./derive-ae9UOoOB.js";
|
|
9
|
-
import { t as buildAssetApp } from "./build-
|
|
9
|
+
import { t as buildAssetApp } from "./build-BuKTnec8.js";
|
|
10
10
|
import chalk from "chalk";
|
|
11
11
|
import arg from "arg";
|
|
12
12
|
import fs from "fs";
|
|
@@ -7453,55 +7453,62 @@ function isWithin(dir, candidate) {
|
|
|
7453
7453
|
const relative = path.relative(dir, candidate);
|
|
7454
7454
|
return relative === "" || !relative.startsWith("..") && !path.isAbsolute(relative);
|
|
7455
7455
|
}
|
|
7456
|
-
/** The deepest directory containing every path given. */
|
|
7457
|
-
function commonAncestor(paths) {
|
|
7458
|
-
let ancestor = paths[0];
|
|
7459
|
-
for (const p of paths.slice(1)) while (!isWithin(ancestor, p)) ancestor = path.dirname(ancestor);
|
|
7460
|
-
return ancestor;
|
|
7461
|
-
}
|
|
7462
7456
|
var DEPENDENCY_FIELDS = [
|
|
7463
7457
|
"dependencies",
|
|
7464
7458
|
"devDependencies",
|
|
7465
7459
|
"optionalDependencies"
|
|
7466
7460
|
];
|
|
7461
|
+
/** The directory, inside the project, that carries the repositories its links reach outside it. */
|
|
7462
|
+
var LINKED_DIR = ".rebase-linked";
|
|
7467
7463
|
/**
|
|
7468
|
-
*
|
|
7469
|
-
*
|
|
7464
|
+
* The local links of one manifest — `link:`/`file:` dependencies on a directory
|
|
7465
|
+
* that exists — or `null` when it is not a manifest that parses.
|
|
7470
7466
|
*
|
|
7471
7467
|
* `@rebasepro/*` links are not followed. They point at a local framework
|
|
7472
7468
|
* checkout, which is not the project's source and would drag a whole monorepo
|
|
7473
7469
|
* into the archive; a rebuild moves those packages to a published release
|
|
7474
7470
|
* anyway.
|
|
7475
7471
|
*/
|
|
7472
|
+
function localLinks(manifestPath) {
|
|
7473
|
+
let manifest;
|
|
7474
|
+
try {
|
|
7475
|
+
manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
|
|
7476
|
+
} catch {
|
|
7477
|
+
return null;
|
|
7478
|
+
}
|
|
7479
|
+
if (typeof manifest !== "object" || manifest === null || Array.isArray(manifest)) return null;
|
|
7480
|
+
const record = manifest;
|
|
7481
|
+
const links = [];
|
|
7482
|
+
for (const field of DEPENDENCY_FIELDS) {
|
|
7483
|
+
const deps = record[field];
|
|
7484
|
+
if (typeof deps !== "object" || deps === null) continue;
|
|
7485
|
+
for (const [name, spec] of Object.entries(deps)) {
|
|
7486
|
+
if (name.startsWith("@rebasepro/") || typeof spec !== "string") continue;
|
|
7487
|
+
const match = /^(link|file):(.+)$/.exec(spec);
|
|
7488
|
+
if (!match) continue;
|
|
7489
|
+
try {
|
|
7490
|
+
const target = fs.realpathSync(path.resolve(path.dirname(manifestPath), match[2]));
|
|
7491
|
+
if (!fs.statSync(target).isDirectory()) continue;
|
|
7492
|
+
links.push({
|
|
7493
|
+
field,
|
|
7494
|
+
name,
|
|
7495
|
+
protocol: match[1],
|
|
7496
|
+
target
|
|
7497
|
+
});
|
|
7498
|
+
} catch {}
|
|
7499
|
+
}
|
|
7500
|
+
}
|
|
7501
|
+
return {
|
|
7502
|
+
manifest: record,
|
|
7503
|
+
links
|
|
7504
|
+
};
|
|
7505
|
+
}
|
|
7506
|
+
/** Directories outside every unit that a unit's `package.json` files link to with `link:` or `file:`. */
|
|
7476
7507
|
function externalLinkTargets(units) {
|
|
7477
7508
|
const targets = /* @__PURE__ */ new Set();
|
|
7478
7509
|
for (const unit of units) for (const relative of unit.files) {
|
|
7479
7510
|
if (path.posix.basename(relative) !== "package.json") continue;
|
|
7480
|
-
|
|
7481
|
-
try {
|
|
7482
|
-
manifest = JSON.parse(fs.readFileSync(path.join(unit.root, relative), "utf8"));
|
|
7483
|
-
} catch {
|
|
7484
|
-
continue;
|
|
7485
|
-
}
|
|
7486
|
-
if (typeof manifest !== "object" || manifest === null) continue;
|
|
7487
|
-
for (const field of DEPENDENCY_FIELDS) {
|
|
7488
|
-
const deps = manifest[field];
|
|
7489
|
-
if (typeof deps !== "object" || deps === null) continue;
|
|
7490
|
-
for (const [name, spec] of Object.entries(deps)) {
|
|
7491
|
-
if (name.startsWith("@rebasepro/") || typeof spec !== "string") continue;
|
|
7492
|
-
const match = /^(?:link|file):(.+)$/.exec(spec);
|
|
7493
|
-
if (!match) continue;
|
|
7494
|
-
const target = path.resolve(unit.root, path.posix.dirname(relative), match[1]);
|
|
7495
|
-
let real;
|
|
7496
|
-
try {
|
|
7497
|
-
real = fs.realpathSync(target);
|
|
7498
|
-
if (!fs.statSync(real).isDirectory()) continue;
|
|
7499
|
-
} catch {
|
|
7500
|
-
continue;
|
|
7501
|
-
}
|
|
7502
|
-
if (!units.some((u) => isWithin(u.root, real))) targets.add(real);
|
|
7503
|
-
}
|
|
7504
|
-
}
|
|
7511
|
+
for (const link of localLinks(path.join(unit.root, relative))?.links ?? []) if (!units.some((u) => isWithin(u.root, link.target))) targets.add(link.target);
|
|
7505
7512
|
}
|
|
7506
7513
|
return [...targets];
|
|
7507
7514
|
}
|
|
@@ -7510,11 +7517,22 @@ function externalLinkTargets(units) {
|
|
|
7510
7517
|
*
|
|
7511
7518
|
* The project's repository first — or the project walked, outside git. Then
|
|
7512
7519
|
* every repository a local `link:`/`file:` dependency reaches outside it, until
|
|
7513
|
-
* nothing new is reached
|
|
7514
|
-
*
|
|
7515
|
-
*
|
|
7516
|
-
*
|
|
7517
|
-
*
|
|
7520
|
+
* nothing new is reached. That is dadaki's shape: its Rebase project is a
|
|
7521
|
+
* repository of its own, and its frontend links `../../packages/editor`, a
|
|
7522
|
+
* package of another repository on the same machine. A listing of the
|
|
7523
|
+
* project's repository alone rebuilt into "Rollup failed to resolve import
|
|
7524
|
+
* @dadaki/editor".
|
|
7525
|
+
*
|
|
7526
|
+
* Where those repositories sit on this machine says nothing about where they
|
|
7527
|
+
* sit in the archive. They used to keep their places, under the deepest
|
|
7528
|
+
* directory every one shares — which was `/` for the deploy that ran from a
|
|
7529
|
+
* scratch checkout in `/private/tmp` and reached the editor through a symlink:
|
|
7530
|
+
* the archive carried two absolute trees, and the link, read in the archive,
|
|
7531
|
+
* named nothing, so every platform rebuild failed. So each such repository is
|
|
7532
|
+
* carried inside the project, at `.rebase-linked/<name>/` — below it, where the
|
|
7533
|
+
* rebuild installs every lockfile it finds, the repository's own included — and
|
|
7534
|
+
* every manifest that links into it is pointed there, in the archive's copy
|
|
7535
|
+
* only. Nothing on disk changes.
|
|
7518
7536
|
*
|
|
7519
7537
|
* Paths are resolved through `realpath` first: git reports its top level with
|
|
7520
7538
|
* symlinks resolved (`/private/var/…` for a macOS temp directory), and a
|
|
@@ -7528,17 +7546,71 @@ function listSourceFiles(projectRoot, git = runGit) {
|
|
|
7528
7546
|
if (units.some((u) => isWithin(u.root, target))) continue;
|
|
7529
7547
|
units.push(listUnit(target, git));
|
|
7530
7548
|
}
|
|
7531
|
-
const
|
|
7549
|
+
const [project, ...linked] = units;
|
|
7550
|
+
const root = project.root;
|
|
7551
|
+
const projectPath = toPosix(path.relative(root, realRoot));
|
|
7552
|
+
if (linked.length === 0) return {
|
|
7553
|
+
root,
|
|
7554
|
+
files: [...project.files].sort(),
|
|
7555
|
+
projectPath,
|
|
7556
|
+
fromGit: project.fromGit
|
|
7557
|
+
};
|
|
7558
|
+
const taken = /* @__PURE__ */ new Set();
|
|
7559
|
+
const placed = units.map((unit, index) => {
|
|
7560
|
+
if (index === 0) return {
|
|
7561
|
+
unit,
|
|
7562
|
+
prefix: ""
|
|
7563
|
+
};
|
|
7564
|
+
const base = path.basename(unit.root) || "linked";
|
|
7565
|
+
let name = base;
|
|
7566
|
+
for (let n = 2; taken.has(name); n++) name = `${base}-${n}`;
|
|
7567
|
+
taken.add(name);
|
|
7568
|
+
return {
|
|
7569
|
+
unit,
|
|
7570
|
+
prefix: [
|
|
7571
|
+
projectPath,
|
|
7572
|
+
LINKED_DIR,
|
|
7573
|
+
name
|
|
7574
|
+
].filter(Boolean).join("/")
|
|
7575
|
+
};
|
|
7576
|
+
});
|
|
7577
|
+
const archivePathOf = (absolute) => {
|
|
7578
|
+
for (const { unit, prefix } of placed) {
|
|
7579
|
+
if (!isWithin(unit.root, absolute)) continue;
|
|
7580
|
+
return [prefix, toPosix(path.relative(unit.root, absolute))].filter(Boolean).join("/");
|
|
7581
|
+
}
|
|
7582
|
+
};
|
|
7532
7583
|
const files = /* @__PURE__ */ new Set();
|
|
7533
|
-
|
|
7534
|
-
|
|
7535
|
-
|
|
7584
|
+
const sources = {};
|
|
7585
|
+
const contents = {};
|
|
7586
|
+
for (const { unit, prefix } of placed) for (const file of unit.files) {
|
|
7587
|
+
const archivePath = prefix ? `${prefix}/${file}` : file;
|
|
7588
|
+
files.add(archivePath);
|
|
7589
|
+
if (prefix) sources[archivePath] = path.join(unit.root, file);
|
|
7590
|
+
if (path.posix.basename(file) !== "package.json") continue;
|
|
7591
|
+
const parsed = localLinks(path.join(unit.root, file));
|
|
7592
|
+
if (!parsed) continue;
|
|
7593
|
+
let changed = false;
|
|
7594
|
+
for (const link of parsed.links) {
|
|
7595
|
+
const targetPath = archivePathOf(link.target);
|
|
7596
|
+
if (targetPath === void 0) continue;
|
|
7597
|
+
const relative = path.posix.relative(path.posix.dirname(archivePath), targetPath) || ".";
|
|
7598
|
+
const spec = `${link.protocol}:${relative.startsWith(".") ? relative : `./${relative}`}`;
|
|
7599
|
+
const deps = parsed.manifest[link.field];
|
|
7600
|
+
if (deps[link.name] !== spec) {
|
|
7601
|
+
deps[link.name] = spec;
|
|
7602
|
+
changed = true;
|
|
7603
|
+
}
|
|
7604
|
+
}
|
|
7605
|
+
if (changed) contents[archivePath] = `${JSON.stringify(parsed.manifest, null, 2)}\n`;
|
|
7536
7606
|
}
|
|
7537
7607
|
return {
|
|
7538
7608
|
root,
|
|
7539
7609
|
files: [...files].sort(),
|
|
7540
|
-
projectPath
|
|
7541
|
-
fromGit: units.every((u) => u.fromGit)
|
|
7610
|
+
projectPath,
|
|
7611
|
+
fromGit: units.every((u) => u.fromGit),
|
|
7612
|
+
sources,
|
|
7613
|
+
contents
|
|
7542
7614
|
};
|
|
7543
7615
|
}
|
|
7544
7616
|
/** The per-directory file of patterns a `--source` build context leaves out, beside `.gitignore`. */
|
|
@@ -7589,14 +7661,22 @@ function listContextFiles(dir, git = runGit) {
|
|
|
7589
7661
|
function packSource(listing, outPath) {
|
|
7590
7662
|
const listPath = `${outPath}.files`;
|
|
7591
7663
|
fs.writeFileSync(listPath, listing.files.map((file) => `${file}\0`).join(""));
|
|
7664
|
+
const stage = listing.sources !== void 0 || listing.contents !== void 0 ? fs.mkdtempSync(`${outPath}.stage-`) : void 0;
|
|
7665
|
+
if (stage) for (const file of listing.files) {
|
|
7666
|
+
const at = path.join(stage, ...file.split("/"));
|
|
7667
|
+
fs.mkdirSync(path.dirname(at), { recursive: true });
|
|
7668
|
+
const content = listing.contents?.[file];
|
|
7669
|
+
if (content !== void 0) fs.writeFileSync(at, content);
|
|
7670
|
+
else fs.symlinkSync(listing.sources?.[file] ?? path.join(listing.root, file), at);
|
|
7671
|
+
}
|
|
7592
7672
|
return new Promise((resolve, reject) => {
|
|
7593
7673
|
const child = spawn("tar", [
|
|
7594
|
-
"-czf",
|
|
7674
|
+
stage ? "-czhf" : "-czf",
|
|
7595
7675
|
path.resolve(outPath),
|
|
7596
7676
|
"--no-xattrs",
|
|
7597
7677
|
"--null",
|
|
7598
7678
|
"-C",
|
|
7599
|
-
listing.root,
|
|
7679
|
+
stage ?? listing.root,
|
|
7600
7680
|
"-T",
|
|
7601
7681
|
path.resolve(listPath)
|
|
7602
7682
|
], {
|
|
@@ -7614,7 +7694,13 @@ function packSource(listing, outPath) {
|
|
|
7614
7694
|
child.stderr.on("data", (chunk) => stderr += String(chunk));
|
|
7615
7695
|
child.on("error", reject);
|
|
7616
7696
|
child.on("close", (code) => code === 0 ? resolve() : reject(new Error(stderr.trim() || `tar exited ${code}`)));
|
|
7617
|
-
}).finally(() =>
|
|
7697
|
+
}).finally(() => {
|
|
7698
|
+
fs.rmSync(listPath, { force: true });
|
|
7699
|
+
if (stage) fs.rmSync(stage, {
|
|
7700
|
+
recursive: true,
|
|
7701
|
+
force: true
|
|
7702
|
+
});
|
|
7703
|
+
});
|
|
7618
7704
|
}
|
|
7619
7705
|
/** Upload a source archive; returns the control plane's id for it. */
|
|
7620
7706
|
async function uploadRebuildSource(url, token, projectId, tarPath) {
|
|
@@ -10175,7 +10261,7 @@ async function streamBuildLogs(client, deploymentId, opts = {}) {
|
|
|
10175
10261
|
*/
|
|
10176
10262
|
function transientReadFailure(e) {
|
|
10177
10263
|
const status = typeof e === "object" && e !== null && "status" in e && typeof e.status === "number" ? e.status : void 0;
|
|
10178
|
-
return status === void 0 || status === 408 || status === 429 || status >= 500;
|
|
10264
|
+
return status === void 0 || status === 0 || status === 408 || status === 429 || status >= 500;
|
|
10179
10265
|
}
|
|
10180
10266
|
/** What `rebase cloud logs` parses. Its page pairs against this. */
|
|
10181
10267
|
var LOGS_FLAGS = {
|
|
@@ -15093,4 +15179,4 @@ function printCloudHelp() {
|
|
|
15093
15179
|
//#endregion
|
|
15094
15180
|
export { CLOUD_GROUP_NAMES, GROUP_ALIASES, cloudCommand };
|
|
15095
15181
|
|
|
15096
|
-
//# sourceMappingURL=cloud-
|
|
15182
|
+
//# sourceMappingURL=cloud-Cj5ey3l_.js.map
|