@diagonal-hq/cli 0.28.0 → 0.28.2
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 +56 -45
- 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:
|
|
@@ -311113,28 +311113,8 @@ function readDomains(value, nodes, domainReferences) {
|
|
|
311113
311113
|
const domains = [];
|
|
311114
311114
|
for (const [key, declaration] of Object.entries(declared)) {
|
|
311115
311115
|
const node = propertyNode(nodes.domains, key);
|
|
311116
|
-
if (!KEY_PATTERN.test(key)) {
|
|
311117
|
-
throw new SourceError(
|
|
311118
|
-
`The domain key "${key}" must start with a lower-case letter and contain only letters and digits`,
|
|
311119
|
-
node
|
|
311120
|
-
);
|
|
311121
|
-
}
|
|
311122
|
-
if (key.length > KEY_MAX_LENGTH) {
|
|
311123
|
-
throw new SourceError(`The domain key "${key}" must be at most ${KEY_MAX_LENGTH} characters`, node);
|
|
311124
|
-
}
|
|
311125
|
-
if (!isPlainObject2(declaration)) {
|
|
311126
|
-
throw new SourceError(`The domain "${key}" must be an object, such as ${key}: {}`, node);
|
|
311127
|
-
}
|
|
311128
|
-
for (const option of Object.keys(declaration)) {
|
|
311129
|
-
if (option !== "fallback") {
|
|
311130
|
-
throw new SourceError(`Unknown domain option "${option}"`, propertyNode(node, option));
|
|
311131
|
-
}
|
|
311132
|
-
}
|
|
311133
|
-
if (Object.hasOwn(declaration, "fallback") && declaration.fallback !== "primary") {
|
|
311134
|
-
throw new SourceError(`"fallback" must be 'primary'`, propertyNode(node, "fallback"));
|
|
311135
|
-
}
|
|
311136
311116
|
domainNodes[key] = node;
|
|
311137
|
-
domains.push(
|
|
311117
|
+
domains.push(readDomainDeclaration(key, declaration, node));
|
|
311138
311118
|
}
|
|
311139
311119
|
if (primary === void 0) {
|
|
311140
311120
|
throw new SourceError('Add "primaryDomain" with one of the keys of "domains"', nodes.domains);
|
|
@@ -311142,25 +311122,51 @@ function readDomains(value, nodes, domainReferences) {
|
|
|
311142
311122
|
if (!isDomainsReference(nodes.primaryDomain.value, domainReferences)) {
|
|
311143
311123
|
throw new SourceError(DOMAIN_REFERENCE_MESSAGE, nodes.primaryDomain);
|
|
311144
311124
|
}
|
|
311145
|
-
|
|
311146
|
-
|
|
311125
|
+
checkPrimaryDomain(domains, primary, nodes.primaryDomain, domainNodes);
|
|
311126
|
+
return {
|
|
311127
|
+
domains,
|
|
311128
|
+
primary_domain: primary,
|
|
311129
|
+
domainNodes,
|
|
311130
|
+
primaryDomainNode: nodes.primaryDomain
|
|
311131
|
+
};
|
|
311132
|
+
}
|
|
311133
|
+
function readDomainDeclaration(key, declaration, node = null) {
|
|
311134
|
+
if (!KEY_PATTERN.test(key)) {
|
|
311147
311135
|
throw new SourceError(
|
|
311148
|
-
|
|
311149
|
-
|
|
311136
|
+
`The domain key "${key}" must start with a lower-case letter and contain only letters and digits`,
|
|
311137
|
+
node
|
|
311150
311138
|
);
|
|
311151
311139
|
}
|
|
311152
|
-
if (
|
|
311140
|
+
if (key.length > KEY_MAX_LENGTH) {
|
|
311141
|
+
throw new SourceError(`The domain key "${key}" must be at most ${KEY_MAX_LENGTH} characters`, node);
|
|
311142
|
+
}
|
|
311143
|
+
if (!isPlainObject2(declaration)) {
|
|
311144
|
+
throw new SourceError(`The domain "${key}" must be an object, such as ${key}: {}`, node);
|
|
311145
|
+
}
|
|
311146
|
+
for (const option of Object.keys(declaration)) {
|
|
311147
|
+
if (option !== "fallback") {
|
|
311148
|
+
throw new SourceError(`Unknown domain option "${option}"`, propertyNode(node, option));
|
|
311149
|
+
}
|
|
311150
|
+
}
|
|
311151
|
+
if (Object.hasOwn(declaration, "fallback") && declaration.fallback !== "primary") {
|
|
311152
|
+
throw new SourceError(`"fallback" must be 'primary'`, propertyNode(node, "fallback"));
|
|
311153
|
+
}
|
|
311154
|
+
return { key, fallback: Object.hasOwn(declaration, "fallback") ? "primary" : null };
|
|
311155
|
+
}
|
|
311156
|
+
function checkPrimaryDomain(domains, primary, primaryNode = null, domainNodes = null) {
|
|
311157
|
+
const declaration = domains.find((domain) => domain.key === primary);
|
|
311158
|
+
if (typeof primary !== "string" || declaration === void 0) {
|
|
311159
|
+
throw new SourceError(
|
|
311160
|
+
domains.length === 0 ? '"primaryDomain" must name a key of "domains". Declare a domain in "domains"' : `"primaryDomain" must be one of: ${domains.map((domain) => domain.key).join(", ")}`,
|
|
311161
|
+
primaryNode
|
|
311162
|
+
);
|
|
311163
|
+
}
|
|
311164
|
+
if (declaration.fallback !== null) {
|
|
311153
311165
|
throw new SourceError(
|
|
311154
311166
|
`The primary domain "${primary}" cannot fall back to itself. Remove "fallback"`,
|
|
311155
|
-
propertyNode(domainNodes[primary], "fallback")
|
|
311167
|
+
domainNodes === null ? null : propertyNode(domainNodes[primary], "fallback")
|
|
311156
311168
|
);
|
|
311157
311169
|
}
|
|
311158
|
-
return {
|
|
311159
|
-
domains,
|
|
311160
|
-
primary_domain: primary,
|
|
311161
|
-
domainNodes,
|
|
311162
|
-
primaryDomainNode: nodes.primaryDomain
|
|
311163
|
-
};
|
|
311164
311170
|
}
|
|
311165
311171
|
function hostKey(domainKey, domains, primaryDomain) {
|
|
311166
311172
|
if (domainKey === null || domainKey === primaryDomain) {
|
|
@@ -324067,10 +324073,13 @@ function seoReadProblem({ key, read: read2, inTemplate }, bindings, resourcesByS
|
|
|
324067
324073
|
return null;
|
|
324068
324074
|
}
|
|
324069
324075
|
|
|
324070
|
-
// scripts/lib/runtime-build/
|
|
324071
|
-
|
|
324072
|
-
|
|
324076
|
+
// scripts/lib/runtime-build/source-literal.mjs
|
|
324077
|
+
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
324078
|
+
function quotedLiteral(value) {
|
|
324079
|
+
return `'${value.replaceAll("\\", "\\\\").replaceAll("'", "\\'").replaceAll("\r", "\\r").replaceAll("\n", "\\n").replaceAll("\u2028", "\\u2028").replaceAll("\u2029", "\\u2029")}'`;
|
|
324073
324080
|
}
|
|
324081
|
+
|
|
324082
|
+
// scripts/lib/runtime-build/page-options-migration.mjs
|
|
324074
324083
|
function movableMetaValue(value) {
|
|
324075
324084
|
if (value !== null && typeof value !== "string" && !isPlainObject2(value)) {
|
|
324076
324085
|
return void 0;
|
|
@@ -324138,13 +324147,15 @@ function migratePageOptions(source, ast) {
|
|
|
324138
324147
|
keepsAllowedResolver = true;
|
|
324139
324148
|
continue;
|
|
324140
324149
|
}
|
|
324141
|
-
const text2 = value === null ? "null" : property.value.type === "StringLiteral" && property.value.value === value ? sliceOf(source, property.value) :
|
|
324150
|
+
const text2 = value === null ? "null" : property.value.type === "StringLiteral" && property.value.value === value ? sliceOf(source, property.value) : quotedLiteral(value);
|
|
324142
324151
|
moved.push({ property, grouped, text: text2 });
|
|
324143
324152
|
}
|
|
324144
324153
|
}
|
|
324145
324154
|
if (moved.length > 0 && !keepsAllowedResolver) {
|
|
324146
324155
|
const entries = moved.toSorted((left, right) => SEO_KEYS.indexOf(left.grouped) - SEO_KEYS.indexOf(right.grouped)).map((entry) => `${entry.grouped}: ${entry.text}`);
|
|
324147
|
-
const last2 = moved.reduce(
|
|
324156
|
+
const last2 = moved.reduce(
|
|
324157
|
+
(latest, entry) => entry.property.start > latest.property.start ? entry : latest
|
|
324158
|
+
);
|
|
324148
324159
|
const singleLine = options2.loc.start.line === options2.loc.end.line;
|
|
324149
324160
|
const indent = lineIndent(source, last2.property.start);
|
|
324150
324161
|
const seoText = singleLine ? `seo: { ${entries.join(", ")} }` : `seo: {
|