@diagonal-hq/cli 0.42.4 → 0.42.6
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/{cli-check-data-VZ52XV3R.mjs → cli-check-data-V6YHHRMU.mjs} +2 -2
- package/dist/cli-chunk-YSDTJ57P.mjs +87 -0
- package/dist/{cli-sdk-files.generated-CETMBWOK.mjs → cli-sdk-files.generated-KZHKLP6A.mjs} +3 -3
- package/dist/{cli-workflows-XIIQQSDG.mjs → cli-workflows-ZDUTSUQP.mjs} +1 -1
- package/dist/cli.mjs +65 -4
- package/dist/script-sdk.json +1 -1
- package/dist/workflow/generated/capabilities.d.ts +1 -1
- package/dist/workflow/index.d.ts +1 -1
- package/dist/workflow/input.d.ts +20 -0
- package/package.json +4 -4
- package/dist/cli-chunk-3SNILJKW.mjs +0 -87
package/dist/cli.mjs
CHANGED
|
@@ -7160,6 +7160,46 @@ function writeWholePageFile(path, file, options, resources, keep = [], { branchP
|
|
|
7160
7160
|
return { ok: false, diagnostic: diagnosticFromError(path, error) };
|
|
7161
7161
|
}
|
|
7162
7162
|
}
|
|
7163
|
+
function writePagePaused(path, source, paused, resources, { branchPaths = null, permissions = [] } = {}) {
|
|
7164
|
+
try {
|
|
7165
|
+
const ast = parseSource(source, { jsx: true });
|
|
7166
|
+
const exportStatement = ast.program.body.find(
|
|
7167
|
+
(statement) => statement.type === "ExportDefaultDeclaration"
|
|
7168
|
+
);
|
|
7169
|
+
if (exportStatement === void 0) {
|
|
7170
|
+
throw new SourceError(
|
|
7171
|
+
"A page file must export default definePage(options, function Page() { ... })",
|
|
7172
|
+
ast.program
|
|
7173
|
+
);
|
|
7174
|
+
}
|
|
7175
|
+
const [optionsNode] = expectDefineCall(exportStatement.declaration, "definePage", 2);
|
|
7176
|
+
if (optionsNode.type !== "ObjectExpression") {
|
|
7177
|
+
throw new SourceError(
|
|
7178
|
+
"The options of definePage must be an object literal to pause the page in the app. Edit the file in Files.",
|
|
7179
|
+
optionsNode
|
|
7180
|
+
);
|
|
7181
|
+
}
|
|
7182
|
+
const written = applySourceEdits(
|
|
7183
|
+
source,
|
|
7184
|
+
objectPatchEdits(
|
|
7185
|
+
source,
|
|
7186
|
+
optionsNode,
|
|
7187
|
+
{ paused: paused ? true : null },
|
|
7188
|
+
"definePage options",
|
|
7189
|
+
0
|
|
7190
|
+
)
|
|
7191
|
+
);
|
|
7192
|
+
return checkedPage(
|
|
7193
|
+
path,
|
|
7194
|
+
written,
|
|
7195
|
+
branchResourceNames(resources),
|
|
7196
|
+
branchPaths,
|
|
7197
|
+
declaredPermissionEntries(permissions)
|
|
7198
|
+
);
|
|
7199
|
+
} catch (error) {
|
|
7200
|
+
return { ok: false, diagnostic: diagnosticFromError(path, error) };
|
|
7201
|
+
}
|
|
7202
|
+
}
|
|
7163
7203
|
function writeParts(path, options, parts, { previous, readPath: readPath2, names, permissionEntries, keep, branchPaths, sourceOptions, addsCodeImports }) {
|
|
7164
7204
|
options = migrateOptionValues(options);
|
|
7165
7205
|
if (options.layout !== void 0 && !keep.includes("layout")) {
|
|
@@ -7601,6 +7641,24 @@ function writeFile({ path, data, context }) {
|
|
|
7601
7641
|
})
|
|
7602
7642
|
).source;
|
|
7603
7643
|
}
|
|
7644
|
+
function writePaused({ path, source, data, context }) {
|
|
7645
|
+
if (typeof data.paused !== "boolean") {
|
|
7646
|
+
throw new SourceTransformRequestError("paused must be a boolean.");
|
|
7647
|
+
}
|
|
7648
|
+
if (data.options !== void 0 || data.code !== void 0 || data.file !== void 0) {
|
|
7649
|
+
throw new SourceTransformRequestError("A pause write sends only paused.");
|
|
7650
|
+
}
|
|
7651
|
+
if (typeof source !== "string") {
|
|
7652
|
+
throw new SourceTransformRequestError("A pause write edits an existing page file.");
|
|
7653
|
+
}
|
|
7654
|
+
const { resources, branchPaths, permissions } = contextOf(context);
|
|
7655
|
+
return checked(
|
|
7656
|
+
writePagePaused(path, source, data.paused, resources, {
|
|
7657
|
+
branchPaths,
|
|
7658
|
+
permissions
|
|
7659
|
+
})
|
|
7660
|
+
).source;
|
|
7661
|
+
}
|
|
7604
7662
|
function checked(result) {
|
|
7605
7663
|
if (!result.ok) {
|
|
7606
7664
|
throw new SourceTransformDiagnostic(result.diagnostic);
|
|
@@ -7611,8 +7669,8 @@ var pageAdapter = Object.freeze({
|
|
|
7611
7669
|
contextFields: ["resources", "resource_slugs", "branch_paths", "permissions", "keep", "previous_path"],
|
|
7612
7670
|
// `code` is the factory body of the page function, with `options`. `file` is
|
|
7613
7671
|
// the whole file, as the page builder edits it: it is written as it is, or
|
|
7614
|
-
// with `options` in place of its own.
|
|
7615
|
-
writeFields: ["options", "code", "file"],
|
|
7672
|
+
// with `options` in place of its own. `paused` alone writes only that option.
|
|
7673
|
+
writeFields: ["options", "code", "file", "paused"],
|
|
7616
7674
|
accepts: (path) => /^pages\/.+\.tsx$/.test(path),
|
|
7617
7675
|
read({ path, source, context }) {
|
|
7618
7676
|
const { resources, branchPaths, permissions } = contextOf(context);
|
|
@@ -7620,6 +7678,9 @@ var pageAdapter = Object.freeze({
|
|
|
7620
7678
|
return { options, code, imports };
|
|
7621
7679
|
},
|
|
7622
7680
|
write({ path, source, data, context }) {
|
|
7681
|
+
if (data.paused !== void 0) {
|
|
7682
|
+
return writePaused({ path, source, data, context });
|
|
7683
|
+
}
|
|
7623
7684
|
if (data.file !== void 0) {
|
|
7624
7685
|
return writeFile({ path, data, context });
|
|
7625
7686
|
}
|
|
@@ -10921,7 +10982,7 @@ async function checkSources() {
|
|
|
10921
10982
|
if (existsSync4(DATA_FILE) && existsSync4(SDK_FILE)) {
|
|
10922
10983
|
return { dataFile: DATA_FILE, sdkFile: SDK_FILE };
|
|
10923
10984
|
}
|
|
10924
|
-
const { checkData, scriptSdk } = await import("./cli-check-data-
|
|
10985
|
+
const { checkData, scriptSdk } = await import("./cli-check-data-V6YHHRMU.mjs");
|
|
10925
10986
|
return { data: checkData(), sdk: scriptSdk() };
|
|
10926
10987
|
}
|
|
10927
10988
|
function isScriptTestPath(path) {
|
|
@@ -10941,7 +11002,7 @@ function holdsSkills(root, plan) {
|
|
|
10941
11002
|
async function checkCheckout(root, options) {
|
|
10942
11003
|
const sources = await checkSources();
|
|
10943
11004
|
const plan = composePackages(root);
|
|
10944
|
-
const testRunner = async () => (await import("./cli-workflows-
|
|
11005
|
+
const testRunner = async () => (await import("./cli-workflows-ZDUTSUQP.mjs")).runBuildTests;
|
|
10945
11006
|
const skillReader = async () => (await import("./cli-skill-file-XEFKCU5Y.mjs")).skillFrontMatter;
|
|
10946
11007
|
const finish = (checkoutRoot, buildPlan, answer, runTests2) => {
|
|
10947
11008
|
const run = hasScriptTests(answer) ? runTests2(checkoutRoot, answer.tests) : null;
|