@diagonal-hq/cli 0.28.1 → 0.28.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/cli.mjs +39 -25
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -1563,7 +1563,7 @@ var require_stringifyString = __commonJS({
|
|
|
1563
1563
|
${indent}`) + "'";
|
|
1564
1564
|
return ctx.implicitKey ? res : foldFlowLines.foldFlowLines(res, indent, foldFlowLines.FOLD_FLOW, getFoldOptions(ctx, false));
|
|
1565
1565
|
}
|
|
1566
|
-
function
|
|
1566
|
+
function quotedString(value, ctx) {
|
|
1567
1567
|
const { singleQuote } = ctx.options;
|
|
1568
1568
|
let qs;
|
|
1569
1569
|
if (singleQuote === false)
|
|
@@ -1589,7 +1589,7 @@ ${indent}`) + "'";
|
|
|
1589
1589
|
function blockString({ comment, type, value }, ctx, onComment, onChompKeep) {
|
|
1590
1590
|
const { blockQuote, commentString, lineWidth } = ctx.options;
|
|
1591
1591
|
if (!blockQuote || /\n[\t ]+$/.test(value)) {
|
|
1592
|
-
return
|
|
1592
|
+
return quotedString(value, ctx);
|
|
1593
1593
|
}
|
|
1594
1594
|
const indent = ctx.indent || (ctx.forceBlockIndent || containsDocumentMarker(value) ? " " : "");
|
|
1595
1595
|
const literal2 = blockQuote === "literal" ? true : blockQuote === "folded" || type === Scalar.Scalar.BLOCK_FOLDED ? false : type === Scalar.Scalar.BLOCK_LITERAL ? true : !lineLengthOverLimit(value, lineWidth, indent.length);
|
|
@@ -1665,10 +1665,10 @@ ${indent}${start}${value}${end}`;
|
|
|
1665
1665
|
const { type, value } = item;
|
|
1666
1666
|
const { actualString, implicitKey, indent, indentStep, inFlow } = ctx;
|
|
1667
1667
|
if (implicitKey && value.includes("\n") || inFlow && /[[\]{},]/.test(value)) {
|
|
1668
|
-
return
|
|
1668
|
+
return quotedString(value, ctx);
|
|
1669
1669
|
}
|
|
1670
1670
|
if (/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
|
|
1671
|
-
return implicitKey || inFlow || !value.includes("\n") ?
|
|
1671
|
+
return implicitKey || inFlow || !value.includes("\n") ? quotedString(value, ctx) : blockString(item, ctx, onComment, onChompKeep);
|
|
1672
1672
|
}
|
|
1673
1673
|
if (!implicitKey && !inFlow && type !== Scalar.Scalar.PLAIN && value.includes("\n")) {
|
|
1674
1674
|
return blockString(item, ctx, onComment, onChompKeep);
|
|
@@ -1678,7 +1678,7 @@ ${indent}${start}${value}${end}`;
|
|
|
1678
1678
|
ctx.forceBlockIndent = true;
|
|
1679
1679
|
return blockString(item, ctx, onComment, onChompKeep);
|
|
1680
1680
|
} else if (implicitKey && indent === indentStep) {
|
|
1681
|
-
return
|
|
1681
|
+
return quotedString(value, ctx);
|
|
1682
1682
|
}
|
|
1683
1683
|
}
|
|
1684
1684
|
const str = value.replace(/\n+/g, `$&
|
|
@@ -1687,7 +1687,7 @@ ${indent}`);
|
|
|
1687
1687
|
const test = (tag) => tag.default && tag.tag !== "tag:yaml.org,2002:str" && tag.test?.test(str);
|
|
1688
1688
|
const { compat, tags } = ctx.doc.schema;
|
|
1689
1689
|
if (tags.some(test) || compat?.some(test))
|
|
1690
|
-
return
|
|
1690
|
+
return quotedString(value, ctx);
|
|
1691
1691
|
}
|
|
1692
1692
|
return implicitKey ? str : foldFlowLines.foldFlowLines(str, indent, foldFlowLines.FOLD_FLOW, getFoldOptions(ctx, false));
|
|
1693
1693
|
}
|
|
@@ -1703,7 +1703,7 @@ ${indent}`);
|
|
|
1703
1703
|
switch (_type) {
|
|
1704
1704
|
case Scalar.Scalar.BLOCK_FOLDED:
|
|
1705
1705
|
case Scalar.Scalar.BLOCK_LITERAL:
|
|
1706
|
-
return implicitKey || inFlow ?
|
|
1706
|
+
return implicitKey || inFlow ? quotedString(ss.value, ctx) : blockString(ss, ctx, onComment, onChompKeep);
|
|
1707
1707
|
case Scalar.Scalar.QUOTE_DOUBLE:
|
|
1708
1708
|
return doubleQuotedString(ss.value, ctx);
|
|
1709
1709
|
case Scalar.Scalar.QUOTE_SINGLE:
|
|
@@ -316123,17 +316123,10 @@ function readWorkspaceField(path, argument, declared, diagnostics, generatedEntr
|
|
|
316123
316123
|
}
|
|
316124
316124
|
}
|
|
316125
316125
|
const builder2 = entry.definition;
|
|
316126
|
-
|
|
316127
|
-
throw new SourceError('"definition" must be a field.<type>({...}) call', nodes.definition ?? argument);
|
|
316128
|
-
}
|
|
316129
|
-
checkBuilderOptions(builder2);
|
|
316126
|
+
const { field: field2, metadata } = readWorkspaceFieldDefinition(key, builder2, nodes.definition ?? argument);
|
|
316130
316127
|
if (!Object.hasOwn(entry, "value")) {
|
|
316131
316128
|
throw new SourceError('Add "value". Write null for a field without a value', argument);
|
|
316132
316129
|
}
|
|
316133
|
-
const field2 = buildField(key, builder2, nodes.definition, { checkKey: false });
|
|
316134
|
-
if (field2.type === "relation") {
|
|
316135
|
-
throw new SourceError("A workspace field cannot be a relation. A workspace field has no record", builder2.node);
|
|
316136
|
-
}
|
|
316137
316130
|
const problem2 = valueProblem2(field2, entry.value);
|
|
316138
316131
|
if (problem2 !== null) {
|
|
316139
316132
|
throw new SourceError(`"value" ${problem2}`, nodes.value);
|
|
@@ -316151,15 +316144,31 @@ function readWorkspaceField(path, argument, declared, diagnostics, generatedEntr
|
|
|
316151
316144
|
return {
|
|
316152
316145
|
path,
|
|
316153
316146
|
key,
|
|
316154
|
-
|
|
316155
|
-
label: field2.label,
|
|
316156
|
-
description: field2.description,
|
|
316157
|
-
guard: [field2.required ? "required" : "nullable", ...field2.guard],
|
|
316158
|
-
settings: field2.settings,
|
|
316147
|
+
...metadata,
|
|
316159
316148
|
value: entry.value,
|
|
316160
316149
|
nodes: { definition: builder2.node, value: nodes.value }
|
|
316161
316150
|
};
|
|
316162
316151
|
}
|
|
316152
|
+
function readWorkspaceFieldDefinition(key, builder2, node) {
|
|
316153
|
+
if (!(builder2 instanceof FieldBuilderValue)) {
|
|
316154
|
+
throw new SourceError('"definition" must be a field.<type>({...}) call', node);
|
|
316155
|
+
}
|
|
316156
|
+
checkBuilderOptions(builder2);
|
|
316157
|
+
const field2 = buildField(key, builder2, node, { checkKey: false });
|
|
316158
|
+
if (field2.type === "relation") {
|
|
316159
|
+
throw new SourceError("A workspace field cannot be a relation. A workspace field has no record", builder2.node);
|
|
316160
|
+
}
|
|
316161
|
+
return {
|
|
316162
|
+
field: field2,
|
|
316163
|
+
metadata: {
|
|
316164
|
+
type: field2.type,
|
|
316165
|
+
label: field2.label,
|
|
316166
|
+
description: field2.description,
|
|
316167
|
+
guard: [field2.required ? "required" : "nullable", ...field2.guard],
|
|
316168
|
+
settings: field2.settings
|
|
316169
|
+
}
|
|
316170
|
+
};
|
|
316171
|
+
}
|
|
316163
316172
|
function checkBuilderOptions(builder2) {
|
|
316164
316173
|
const option = RESOURCE_ONLY_OPTIONS.find((item) => builder2.options[item] !== void 0);
|
|
316165
316174
|
if (option !== void 0) {
|
|
@@ -324073,10 +324082,13 @@ function seoReadProblem({ key, read: read2, inTemplate }, bindings, resourcesByS
|
|
|
324073
324082
|
return null;
|
|
324074
324083
|
}
|
|
324075
324084
|
|
|
324076
|
-
// scripts/lib/runtime-build/
|
|
324077
|
-
|
|
324078
|
-
|
|
324085
|
+
// scripts/lib/runtime-build/source-literal.mjs
|
|
324086
|
+
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
324087
|
+
function quotedLiteral(value) {
|
|
324088
|
+
return `'${value.replaceAll("\\", "\\\\").replaceAll("'", "\\'").replaceAll("\r", "\\r").replaceAll("\n", "\\n").replaceAll("\u2028", "\\u2028").replaceAll("\u2029", "\\u2029")}'`;
|
|
324079
324089
|
}
|
|
324090
|
+
|
|
324091
|
+
// scripts/lib/runtime-build/page-options-migration.mjs
|
|
324080
324092
|
function movableMetaValue(value) {
|
|
324081
324093
|
if (value !== null && typeof value !== "string" && !isPlainObject2(value)) {
|
|
324082
324094
|
return void 0;
|
|
@@ -324144,13 +324156,15 @@ function migratePageOptions(source, ast) {
|
|
|
324144
324156
|
keepsAllowedResolver = true;
|
|
324145
324157
|
continue;
|
|
324146
324158
|
}
|
|
324147
|
-
const text2 = value === null ? "null" : property.value.type === "StringLiteral" && property.value.value === value ? sliceOf(source, property.value) :
|
|
324159
|
+
const text2 = value === null ? "null" : property.value.type === "StringLiteral" && property.value.value === value ? sliceOf(source, property.value) : quotedLiteral(value);
|
|
324148
324160
|
moved.push({ property, grouped, text: text2 });
|
|
324149
324161
|
}
|
|
324150
324162
|
}
|
|
324151
324163
|
if (moved.length > 0 && !keepsAllowedResolver) {
|
|
324152
324164
|
const entries = moved.toSorted((left, right) => SEO_KEYS.indexOf(left.grouped) - SEO_KEYS.indexOf(right.grouped)).map((entry) => `${entry.grouped}: ${entry.text}`);
|
|
324153
|
-
const last2 = moved.reduce(
|
|
324165
|
+
const last2 = moved.reduce(
|
|
324166
|
+
(latest, entry) => entry.property.start > latest.property.start ? entry : latest
|
|
324167
|
+
);
|
|
324154
324168
|
const singleLine = options2.loc.start.line === options2.loc.end.line;
|
|
324155
324169
|
const indent = lineIndent(source, last2.property.start);
|
|
324156
324170
|
const seoText = singleLine ? `seo: { ${entries.join(", ")} }` : `seo: {
|