@diagonal-hq/cli 0.32.1 → 0.33.0
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/README.md +126 -95
- package/dist/cli.mjs +574 -970
- package/dist/index.d.ts +75 -17
- package/dist/index.js +4 -0
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -8983,7 +8983,7 @@ var require_typescript = __commonJS({
|
|
|
8983
8983
|
isCommaListExpression: () => isCommaListExpression,
|
|
8984
8984
|
isCommaSequence: () => isCommaSequence,
|
|
8985
8985
|
isCommaToken: () => isCommaToken,
|
|
8986
|
-
isComment: () =>
|
|
8986
|
+
isComment: () => isComment,
|
|
8987
8987
|
isCommonJsExportPropertyAssignment: () => isCommonJsExportPropertyAssignment,
|
|
8988
8988
|
isCommonJsExportedExpression: () => isCommonJsExportedExpression,
|
|
8989
8989
|
isCompoundAssignment: () => isCompoundAssignment,
|
|
@@ -19719,7 +19719,7 @@ ${lanes.join("\n")}
|
|
|
19719
19719
|
function computeLineStarts(text2) {
|
|
19720
19720
|
const result = [];
|
|
19721
19721
|
let pos = 0;
|
|
19722
|
-
let
|
|
19722
|
+
let lineStart = 0;
|
|
19723
19723
|
while (pos < text2.length) {
|
|
19724
19724
|
const ch = text2.charCodeAt(pos);
|
|
19725
19725
|
pos++;
|
|
@@ -19730,18 +19730,18 @@ ${lanes.join("\n")}
|
|
|
19730
19730
|
}
|
|
19731
19731
|
// falls through
|
|
19732
19732
|
case 10:
|
|
19733
|
-
result.push(
|
|
19734
|
-
|
|
19733
|
+
result.push(lineStart);
|
|
19734
|
+
lineStart = pos;
|
|
19735
19735
|
break;
|
|
19736
19736
|
default:
|
|
19737
19737
|
if (ch > 127 && isLineBreak(ch)) {
|
|
19738
|
-
result.push(
|
|
19739
|
-
|
|
19738
|
+
result.push(lineStart);
|
|
19739
|
+
lineStart = pos;
|
|
19740
19740
|
}
|
|
19741
19741
|
break;
|
|
19742
19742
|
}
|
|
19743
19743
|
}
|
|
19744
|
-
result.push(
|
|
19744
|
+
result.push(lineStart);
|
|
19745
19745
|
return result;
|
|
19746
19746
|
}
|
|
19747
19747
|
function getPositionOfLineAndCharacter(sourceFile, line, character, allowEdits) {
|
|
@@ -22412,7 +22412,7 @@ ${lanes.join("\n")}
|
|
|
22412
22412
|
error2(Diagnostics.This_regular_expression_flag_is_only_available_when_targeting_0_or_later, pos, size, getNameOfScriptTarget(availableFrom));
|
|
22413
22413
|
}
|
|
22414
22414
|
}
|
|
22415
|
-
function appendIfCommentDirective(commentDirectives2, text22, commentDirectiveRegEx,
|
|
22415
|
+
function appendIfCommentDirective(commentDirectives2, text22, commentDirectiveRegEx, lineStart) {
|
|
22416
22416
|
const type = getDirectiveFromComment(text22.trimStart(), commentDirectiveRegEx);
|
|
22417
22417
|
if (type === void 0) {
|
|
22418
22418
|
return commentDirectives2;
|
|
@@ -22420,7 +22420,7 @@ ${lanes.join("\n")}
|
|
|
22420
22420
|
return append(
|
|
22421
22421
|
commentDirectives2,
|
|
22422
22422
|
{
|
|
22423
|
-
range: { pos:
|
|
22423
|
+
range: { pos: lineStart, end: pos },
|
|
22424
22424
|
type
|
|
22425
22425
|
}
|
|
22426
22426
|
);
|
|
@@ -28408,7 +28408,7 @@ ${lanes.join("\n")}
|
|
|
28408
28408
|
function createTextWriter(newLine) {
|
|
28409
28409
|
var output;
|
|
28410
28410
|
var indent3;
|
|
28411
|
-
var
|
|
28411
|
+
var lineStart;
|
|
28412
28412
|
var lineCount;
|
|
28413
28413
|
var linePos;
|
|
28414
28414
|
var hasTrailingComment = false;
|
|
@@ -28417,16 +28417,16 @@ ${lanes.join("\n")}
|
|
|
28417
28417
|
if (lineStartsOfS.length > 1) {
|
|
28418
28418
|
lineCount = lineCount + lineStartsOfS.length - 1;
|
|
28419
28419
|
linePos = output.length - s.length + last2(lineStartsOfS);
|
|
28420
|
-
|
|
28420
|
+
lineStart = linePos - output.length === 0;
|
|
28421
28421
|
} else {
|
|
28422
|
-
|
|
28422
|
+
lineStart = false;
|
|
28423
28423
|
}
|
|
28424
28424
|
}
|
|
28425
28425
|
function writeText(s) {
|
|
28426
28426
|
if (s && s.length) {
|
|
28427
|
-
if (
|
|
28427
|
+
if (lineStart) {
|
|
28428
28428
|
s = getIndentString(indent3) + s;
|
|
28429
|
-
|
|
28429
|
+
lineStart = false;
|
|
28430
28430
|
}
|
|
28431
28431
|
output += s;
|
|
28432
28432
|
updateLineCountAndPosFor(s);
|
|
@@ -28443,7 +28443,7 @@ ${lanes.join("\n")}
|
|
|
28443
28443
|
function reset2() {
|
|
28444
28444
|
output = "";
|
|
28445
28445
|
indent3 = 0;
|
|
28446
|
-
|
|
28446
|
+
lineStart = true;
|
|
28447
28447
|
lineCount = 0;
|
|
28448
28448
|
linePos = 0;
|
|
28449
28449
|
hasTrailingComment = false;
|
|
@@ -28461,11 +28461,11 @@ ${lanes.join("\n")}
|
|
|
28461
28461
|
}
|
|
28462
28462
|
}
|
|
28463
28463
|
function writeLine(force) {
|
|
28464
|
-
if (!
|
|
28464
|
+
if (!lineStart || force) {
|
|
28465
28465
|
output += newLine;
|
|
28466
28466
|
lineCount++;
|
|
28467
28467
|
linePos = output.length;
|
|
28468
|
-
|
|
28468
|
+
lineStart = true;
|
|
28469
28469
|
hasTrailingComment = false;
|
|
28470
28470
|
}
|
|
28471
28471
|
}
|
|
@@ -28484,9 +28484,9 @@ ${lanes.join("\n")}
|
|
|
28484
28484
|
getIndent: () => indent3,
|
|
28485
28485
|
getTextPos: () => output.length,
|
|
28486
28486
|
getLine: () => lineCount,
|
|
28487
|
-
getColumn: () =>
|
|
28487
|
+
getColumn: () => lineStart ? indent3 * getIndentSize() : output.length - linePos,
|
|
28488
28488
|
getText: () => output,
|
|
28489
|
-
isAtStartOfLine: () =>
|
|
28489
|
+
isAtStartOfLine: () => lineStart,
|
|
28490
28490
|
hasTrailingComment: () => hasTrailingComment,
|
|
28491
28491
|
hasTrailingWhitespace: () => !!output.length && isWhiteSpaceLike(output.charCodeAt(output.length - 1)),
|
|
28492
28492
|
clear: reset2,
|
|
@@ -132030,7 +132030,7 @@ ${lanes.join("\n")}
|
|
|
132030
132030
|
}
|
|
132031
132031
|
}
|
|
132032
132032
|
function createImportCallExpressionAMD(arg, containsLexicalThis) {
|
|
132033
|
-
const
|
|
132033
|
+
const resolve7 = factory2.createUniqueName("resolve");
|
|
132034
132034
|
const reject = factory2.createUniqueName("reject");
|
|
132035
132035
|
const parameters = [
|
|
132036
132036
|
factory2.createParameterDeclaration(
|
|
@@ -132039,7 +132039,7 @@ ${lanes.join("\n")}
|
|
|
132039
132039
|
/*dotDotDotToken*/
|
|
132040
132040
|
void 0,
|
|
132041
132041
|
/*name*/
|
|
132042
|
-
|
|
132042
|
+
resolve7
|
|
132043
132043
|
),
|
|
132044
132044
|
factory2.createParameterDeclaration(
|
|
132045
132045
|
/*modifiers*/
|
|
@@ -132056,7 +132056,7 @@ ${lanes.join("\n")}
|
|
|
132056
132056
|
factory2.createIdentifier("require"),
|
|
132057
132057
|
/*typeArguments*/
|
|
132058
132058
|
void 0,
|
|
132059
|
-
[factory2.createArrayLiteralExpression([arg || factory2.createOmittedExpression()]),
|
|
132059
|
+
[factory2.createArrayLiteralExpression([arg || factory2.createOmittedExpression()]), resolve7, reject]
|
|
132060
132060
|
)
|
|
132061
132061
|
)
|
|
132062
132062
|
]);
|
|
@@ -140997,15 +140997,15 @@ ${lanes.join("\n")}
|
|
|
140997
140997
|
function emitJsxExpression(node) {
|
|
140998
140998
|
var _a;
|
|
140999
140999
|
if (node.expression || !commentsDisabled && !nodeIsSynthesized(node) && hasCommentsAtPosition(node.pos)) {
|
|
141000
|
-
const
|
|
141001
|
-
if (
|
|
141000
|
+
const isMultiline = currentSourceFile && !nodeIsSynthesized(node) && getLineAndCharacterOfPosition(currentSourceFile, node.pos).line !== getLineAndCharacterOfPosition(currentSourceFile, node.end).line;
|
|
141001
|
+
if (isMultiline) {
|
|
141002
141002
|
writer.increaseIndent();
|
|
141003
141003
|
}
|
|
141004
141004
|
const end = emitTokenWithComment(19, node.pos, writePunctuation, node);
|
|
141005
141005
|
emit(node.dotDotDotToken);
|
|
141006
141006
|
emitExpression(node.expression);
|
|
141007
141007
|
emitTokenWithComment(20, ((_a = node.expression) == null ? void 0 : _a.end) || end, writePunctuation, node);
|
|
141008
|
-
if (
|
|
141008
|
+
if (isMultiline) {
|
|
141009
141009
|
writer.decreaseIndent();
|
|
141010
141010
|
}
|
|
141011
141011
|
}
|
|
@@ -143857,9 +143857,9 @@ ${lanes.join("\n")}
|
|
|
143857
143857
|
context += indent3 + formatColorAndReset(ellipsis.padStart(gutterWidth), gutterStyleSequence) + gutterSeparator + host.getNewLine();
|
|
143858
143858
|
i = lastLine - 1;
|
|
143859
143859
|
}
|
|
143860
|
-
const
|
|
143860
|
+
const lineStart = getPositionOfLineAndCharacter(file2, i, 0);
|
|
143861
143861
|
const lineEnd = i < lastLineInFile ? getPositionOfLineAndCharacter(file2, i + 1, 0) : file2.text.length;
|
|
143862
|
-
let lineContent = file2.text.slice(
|
|
143862
|
+
let lineContent = file2.text.slice(lineStart, lineEnd);
|
|
143863
143863
|
lineContent = lineContent.trimEnd();
|
|
143864
143864
|
lineContent = lineContent.replace(/\t/g, " ");
|
|
143865
143865
|
context += indent3 + formatColorAndReset((i + 1 + "").padStart(gutterWidth), gutterStyleSequence) + gutterSeparator;
|
|
@@ -144867,9 +144867,9 @@ ${lanes.join("\n")}
|
|
|
144867
144867
|
/*ignoreCase*/
|
|
144868
144868
|
false
|
|
144869
144869
|
)) {
|
|
144870
|
-
const
|
|
144871
|
-
if (
|
|
144872
|
-
const name = removeSuffix(removePrefix(
|
|
144870
|
+
const basename14 = getBaseFileName(a.fileName);
|
|
144871
|
+
if (basename14 === "lib.d.ts" || basename14 === "lib.es6.d.ts") return 0;
|
|
144872
|
+
const name = removeSuffix(removePrefix(basename14, "lib."), ".d.ts");
|
|
144873
144873
|
const index3 = libs.indexOf(name);
|
|
144874
144874
|
if (index3 !== -1) return index3 + 1;
|
|
144875
144875
|
}
|
|
@@ -151458,7 +151458,7 @@ ${lanes.join("\n")}
|
|
|
151458
151458
|
function getSourceFileVersionAsHashFromText(host, text2) {
|
|
151459
151459
|
if (text2.match(sourceMapCommentRegExpDontCareLineStart)) {
|
|
151460
151460
|
let lineEnd = text2.length;
|
|
151461
|
-
let
|
|
151461
|
+
let lineStart = lineEnd;
|
|
151462
151462
|
for (let pos = lineEnd - 1; pos >= 0; pos--) {
|
|
151463
151463
|
const ch = text2.charCodeAt(pos);
|
|
151464
151464
|
switch (ch) {
|
|
@@ -151471,19 +151471,19 @@ ${lanes.join("\n")}
|
|
|
151471
151471
|
break;
|
|
151472
151472
|
default:
|
|
151473
151473
|
if (ch < 127 || !isLineBreak(ch)) {
|
|
151474
|
-
|
|
151474
|
+
lineStart = pos;
|
|
151475
151475
|
continue;
|
|
151476
151476
|
}
|
|
151477
151477
|
break;
|
|
151478
151478
|
}
|
|
151479
|
-
const line = text2.substring(
|
|
151479
|
+
const line = text2.substring(lineStart, lineEnd);
|
|
151480
151480
|
if (line.match(sourceMapCommentRegExp)) {
|
|
151481
|
-
text2 = text2.substring(0,
|
|
151481
|
+
text2 = text2.substring(0, lineStart);
|
|
151482
151482
|
break;
|
|
151483
151483
|
} else if (!line.match(whitespaceOrMapCommentRegExp)) {
|
|
151484
151484
|
break;
|
|
151485
151485
|
}
|
|
151486
|
-
lineEnd =
|
|
151486
|
+
lineEnd = lineStart;
|
|
151487
151487
|
}
|
|
151488
151488
|
}
|
|
151489
151489
|
return (host.createHash || generateDjb2Hash)(text2);
|
|
@@ -158538,7 +158538,7 @@ ${lanes.join("\n")}
|
|
|
158538
158538
|
}
|
|
158539
158539
|
return void 0;
|
|
158540
158540
|
}
|
|
158541
|
-
function
|
|
158541
|
+
function isComment(kind) {
|
|
158542
158542
|
return kind === 2 || kind === 3;
|
|
158543
158543
|
}
|
|
158544
158544
|
function isStringOrRegularExpressionOrTemplateLiteral(kind) {
|
|
@@ -158959,7 +158959,7 @@ ${lanes.join("\n")}
|
|
|
158959
158959
|
function getDisplayPartWriterWorker(maximumLength) {
|
|
158960
158960
|
const absoluteMaximumLength = maximumLength * 10;
|
|
158961
158961
|
let displayParts;
|
|
158962
|
-
let
|
|
158962
|
+
let lineStart;
|
|
158963
158963
|
let indent3;
|
|
158964
158964
|
let length2;
|
|
158965
158965
|
resetWriter();
|
|
@@ -159055,7 +159055,7 @@ ${lanes.join("\n")}
|
|
|
159055
159055
|
};
|
|
159056
159056
|
function writeIndent() {
|
|
159057
159057
|
if (length2 > absoluteMaximumLength) return;
|
|
159058
|
-
if (
|
|
159058
|
+
if (lineStart) {
|
|
159059
159059
|
const indentString = getIndentString(indent3);
|
|
159060
159060
|
if (indentString) {
|
|
159061
159061
|
length2 += indentString.length;
|
|
@@ -159065,7 +159065,7 @@ ${lanes.join("\n")}
|
|
|
159065
159065
|
/* space */
|
|
159066
159066
|
));
|
|
159067
159067
|
}
|
|
159068
|
-
|
|
159068
|
+
lineStart = false;
|
|
159069
159069
|
}
|
|
159070
159070
|
}
|
|
159071
159071
|
function writeKind(text2, kind) {
|
|
@@ -159084,11 +159084,11 @@ ${lanes.join("\n")}
|
|
|
159084
159084
|
if (length2 > absoluteMaximumLength) return;
|
|
159085
159085
|
length2 += 1;
|
|
159086
159086
|
displayParts.push(lineBreakPart());
|
|
159087
|
-
|
|
159087
|
+
lineStart = true;
|
|
159088
159088
|
}
|
|
159089
159089
|
function resetWriter() {
|
|
159090
159090
|
displayParts = [];
|
|
159091
|
-
|
|
159091
|
+
lineStart = true;
|
|
159092
159092
|
indent3 = 0;
|
|
159093
159093
|
length2 = 0;
|
|
159094
159094
|
}
|
|
@@ -187811,8 +187811,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
187811
187811
|
/* JsDocTagName */
|
|
187812
187812
|
};
|
|
187813
187813
|
} else {
|
|
187814
|
-
const
|
|
187815
|
-
if (!/[^*|\s(/)]/.test(sourceFile.text.substring(
|
|
187814
|
+
const lineStart = getLineStartPositionForPosition(position, sourceFile);
|
|
187815
|
+
if (!/[^*|\s(/)]/.test(sourceFile.text.substring(lineStart, position))) {
|
|
187816
187816
|
return {
|
|
187817
187817
|
kind: 2
|
|
187818
187818
|
/* JsDocTag */
|
|
@@ -195291,10 +195291,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
195291
195291
|
}
|
|
195292
195292
|
function getIndentationStringAtPosition(sourceFile, position) {
|
|
195293
195293
|
const { text: text2 } = sourceFile;
|
|
195294
|
-
const
|
|
195295
|
-
let pos =
|
|
195294
|
+
const lineStart = getLineStartPositionForPosition(position, sourceFile);
|
|
195295
|
+
let pos = lineStart;
|
|
195296
195296
|
for (; pos <= position && isWhiteSpaceSingleLine(text2.charCodeAt(pos)); pos++) ;
|
|
195297
|
-
return text2.slice(
|
|
195297
|
+
return text2.slice(lineStart, pos);
|
|
195298
195298
|
}
|
|
195299
195299
|
function parameterDocComments(parameters, isJavaScriptFile, indentationStr, newLine) {
|
|
195300
195300
|
return parameters.map(({ name, dotDotDotToken }, i) => {
|
|
@@ -202982,7 +202982,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
202982
202982
|
}
|
|
202983
202983
|
function processTrivia(trivia, parent2, contextNode, dynamicIndentation) {
|
|
202984
202984
|
for (const triviaItem of trivia) {
|
|
202985
|
-
if (
|
|
202985
|
+
if (isComment(triviaItem.kind) && rangeContainsRange(originalRange, triviaItem)) {
|
|
202986
202986
|
const triviaItemStart = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos);
|
|
202987
202987
|
processRange(triviaItem, triviaItemStart, parent2, contextNode, dynamicIndentation);
|
|
202988
202988
|
}
|
|
@@ -203125,7 +203125,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
203125
203125
|
for (let line = line1; line < line2; line++) {
|
|
203126
203126
|
const lineStartPosition = getStartPositionOfLine(line, sourceFile);
|
|
203127
203127
|
const lineEndPosition = getEndLinePosition(line, sourceFile);
|
|
203128
|
-
if (range && (
|
|
203128
|
+
if (range && (isComment(range.kind) || isStringOrRegularExpressionOrTemplateLiteral(range.kind)) && range.pos <= lineEndPosition && range.end > lineEndPosition) {
|
|
203129
203129
|
continue;
|
|
203130
203130
|
}
|
|
203131
203131
|
const whitespaceStart = getTrailingWhitespaceStartPosition(lineStartPosition, lineEndPosition);
|
|
@@ -203148,7 +203148,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
203148
203148
|
function trimTrailingWhitespacesForRemainingRange(trivias) {
|
|
203149
203149
|
let startPos = previousRange ? previousRange.end : originalRange.pos;
|
|
203150
203150
|
for (const trivia of trivias) {
|
|
203151
|
-
if (
|
|
203151
|
+
if (isComment(trivia.kind)) {
|
|
203152
203152
|
if (startPos < trivia.pos) {
|
|
203153
203153
|
trimTrailingWitespacesForPositions(startPos, trivia.pos - 1, previousRange);
|
|
203154
203154
|
}
|
|
@@ -203425,8 +203425,8 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
203425
203425
|
}
|
|
203426
203426
|
current--;
|
|
203427
203427
|
}
|
|
203428
|
-
const
|
|
203429
|
-
return findFirstNonWhitespaceColumn(
|
|
203428
|
+
const lineStart = getLineStartPositionForPosition(current, sourceFile);
|
|
203429
|
+
return findFirstNonWhitespaceColumn(lineStart, current, sourceFile, options);
|
|
203430
203430
|
}
|
|
203431
203431
|
function getSmartIndent(sourceFile, position, precedingToken, lineAtPosition, assumeNewLineBeforeCloseBrace, options) {
|
|
203432
203432
|
let previous;
|
|
@@ -203713,8 +203713,8 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
203713
203713
|
return -1;
|
|
203714
203714
|
}
|
|
203715
203715
|
function findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter, sourceFile, options) {
|
|
203716
|
-
const
|
|
203717
|
-
return findFirstNonWhitespaceColumn(
|
|
203716
|
+
const lineStart = sourceFile.getPositionOfLineAndCharacter(lineAndCharacter.line, 0);
|
|
203717
|
+
return findFirstNonWhitespaceColumn(lineStart, lineStart + lineAndCharacter.character, sourceFile, options);
|
|
203718
203718
|
}
|
|
203719
203719
|
function findFirstNonWhitespaceCharacterAndColumn(startPos, endPos, sourceFile, options) {
|
|
203720
203720
|
let character = 0;
|
|
@@ -205240,7 +205240,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
205240
205240
|
isCommaListExpression: () => isCommaListExpression,
|
|
205241
205241
|
isCommaSequence: () => isCommaSequence,
|
|
205242
205242
|
isCommaToken: () => isCommaToken,
|
|
205243
|
-
isComment: () =>
|
|
205243
|
+
isComment: () => isComment,
|
|
205244
205244
|
isCommonJsExportPropertyAssignment: () => isCommonJsExportPropertyAssignment,
|
|
205245
205245
|
isCommonJsExportedExpression: () => isCommonJsExportedExpression,
|
|
205246
205246
|
isCompoundAssignment: () => isCompoundAssignment,
|
|
@@ -208815,8 +208815,8 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
208815
208815
|
}
|
|
208816
208816
|
};
|
|
208817
208817
|
for (const file2 of files) {
|
|
208818
|
-
const
|
|
208819
|
-
if (
|
|
208818
|
+
const basename14 = getBaseFileName(file2);
|
|
208819
|
+
if (basename14 === "package.json" || basename14 === "bower.json") {
|
|
208820
208820
|
createProjectWatcher(
|
|
208821
208821
|
file2,
|
|
208822
208822
|
"FileWatcher"
|
|
@@ -212500,8 +212500,8 @@ All files are: ${JSON.stringify(names2)}`,
|
|
|
212500
212500
|
var _a;
|
|
212501
212501
|
const fileOrDirectoryPath = removeIgnoredPath(this.toPath(fileOrDirectory));
|
|
212502
212502
|
if (!fileOrDirectoryPath) return;
|
|
212503
|
-
const
|
|
212504
|
-
if (((_a = result.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a.size) && (
|
|
212503
|
+
const basename14 = getBaseFileName(fileOrDirectoryPath);
|
|
212504
|
+
if (((_a = result.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a.size) && (basename14 === "package.json" || basename14 === "node_modules")) {
|
|
212505
212505
|
result.affectedModuleSpecifierCacheProjects.forEach((project) => {
|
|
212506
212506
|
var _a2;
|
|
212507
212507
|
(_a2 = project.getModuleSpecifierCache()) == null ? void 0 : _a2.clear();
|
|
@@ -218987,8 +218987,8 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range
|
|
|
218987
218987
|
installPackage(options) {
|
|
218988
218988
|
this.packageInstallId++;
|
|
218989
218989
|
const request2 = { kind: "installPackage", ...options, id: this.packageInstallId };
|
|
218990
|
-
const promise = new Promise((
|
|
218991
|
-
(this.packageInstalledPromise ?? (this.packageInstalledPromise = /* @__PURE__ */ new Map())).set(this.packageInstallId, { resolve:
|
|
218990
|
+
const promise = new Promise((resolve7, reject) => {
|
|
218991
|
+
(this.packageInstalledPromise ?? (this.packageInstalledPromise = /* @__PURE__ */ new Map())).set(this.packageInstallId, { resolve: resolve7, reject });
|
|
218992
218992
|
});
|
|
218993
218993
|
this.installer.send(request2);
|
|
218994
218994
|
return promise;
|
|
@@ -232592,7 +232592,7 @@ var require_resolve_uri_umd = __commonJS({
|
|
|
232592
232592
|
}
|
|
232593
232593
|
url.path = path;
|
|
232594
232594
|
}
|
|
232595
|
-
function
|
|
232595
|
+
function resolve7(input, base) {
|
|
232596
232596
|
if (!input && !base)
|
|
232597
232597
|
return "";
|
|
232598
232598
|
const url = parseUrl2(input);
|
|
@@ -232645,7 +232645,7 @@ var require_resolve_uri_umd = __commonJS({
|
|
|
232645
232645
|
return url.scheme + "//" + url.user + url.host + url.port + url.path + queryHash;
|
|
232646
232646
|
}
|
|
232647
232647
|
}
|
|
232648
|
-
return
|
|
232648
|
+
return resolve7;
|
|
232649
232649
|
}));
|
|
232650
232650
|
}
|
|
232651
232651
|
});
|
|
@@ -232991,8 +232991,8 @@ var require_trace_mapping_umd = __commonJS({
|
|
|
232991
232991
|
this.sources = sources;
|
|
232992
232992
|
this.sourcesContent = sourcesContent;
|
|
232993
232993
|
this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || void 0;
|
|
232994
|
-
const
|
|
232995
|
-
this.resolvedSources = sources.map(
|
|
232994
|
+
const resolve7 = resolver2(mapUrl, sourceRoot);
|
|
232995
|
+
this.resolvedSources = sources.map(resolve7);
|
|
232996
232996
|
const { mappings } = parsed;
|
|
232997
232997
|
if (typeof mappings === "string") {
|
|
232998
232998
|
this._encoded = mappings;
|
|
@@ -233561,13 +233561,13 @@ var require_computeSourceMap = __commonJS({
|
|
|
233561
233561
|
currentMapping = rawMappings[tokenIndex];
|
|
233562
233562
|
}
|
|
233563
233563
|
let line = 0;
|
|
233564
|
-
let
|
|
233565
|
-
if (currentMapping !==
|
|
233564
|
+
let lineStart = 0;
|
|
233565
|
+
if (currentMapping !== lineStart) {
|
|
233566
233566
|
_genmapping.maybeAddSegment.call(void 0, map, line, 0, filePath, line, 0);
|
|
233567
233567
|
}
|
|
233568
233568
|
for (let i = 0; i < generatedCode.length; i++) {
|
|
233569
233569
|
if (i === currentMapping) {
|
|
233570
|
-
const genColumn = currentMapping -
|
|
233570
|
+
const genColumn = currentMapping - lineStart;
|
|
233571
233571
|
const sourceColumn = sourceColumns[tokenIndex];
|
|
233572
233572
|
_genmapping.maybeAddSegment.call(void 0, map, line, genColumn, filePath, line, sourceColumn);
|
|
233573
233573
|
while ((currentMapping === i || currentMapping === void 0) && tokenIndex < rawMappings.length - 1) {
|
|
@@ -233577,8 +233577,8 @@ var require_computeSourceMap = __commonJS({
|
|
|
233577
233577
|
}
|
|
233578
233578
|
if (generatedCode.charCodeAt(i) === _charcodes.charCodes.lineFeed) {
|
|
233579
233579
|
line++;
|
|
233580
|
-
|
|
233581
|
-
if (currentMapping !==
|
|
233580
|
+
lineStart = i + 1;
|
|
233581
|
+
if (currentMapping !== lineStart) {
|
|
233582
233582
|
_genmapping.maybeAddSegment.call(void 0, map, line, 0, filePath, line, 0);
|
|
233583
233583
|
}
|
|
233584
233584
|
}
|
|
@@ -233591,15 +233591,15 @@ var require_computeSourceMap = __commonJS({
|
|
|
233591
233591
|
const sourceColumns = new Array(tokens.length);
|
|
233592
233592
|
let tokenIndex = 0;
|
|
233593
233593
|
let currentMapping = tokens[tokenIndex].start;
|
|
233594
|
-
let
|
|
233594
|
+
let lineStart = 0;
|
|
233595
233595
|
for (let i = 0; i < code2.length; i++) {
|
|
233596
233596
|
if (i === currentMapping) {
|
|
233597
|
-
sourceColumns[tokenIndex] = currentMapping -
|
|
233597
|
+
sourceColumns[tokenIndex] = currentMapping - lineStart;
|
|
233598
233598
|
tokenIndex++;
|
|
233599
233599
|
currentMapping = tokens[tokenIndex].start;
|
|
233600
233600
|
}
|
|
233601
233601
|
if (code2.charCodeAt(i) === _charcodes.charCodes.lineFeed) {
|
|
233602
|
-
|
|
233602
|
+
lineStart = i + 1;
|
|
233603
233603
|
}
|
|
233604
233604
|
}
|
|
233605
233605
|
return sourceColumns;
|
|
@@ -248778,7 +248778,7 @@ export type BindingSource = { context: BrowserContext, page: Page, frame: Frame
|
|
|
248778
248778
|
// scripts/lib/runtime-build/check-cli.mjs
|
|
248779
248779
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
248780
248780
|
import { statSync as statSync6 } from "node:fs";
|
|
248781
|
-
import { resolve as
|
|
248781
|
+
import { resolve as resolve6 } from "node:path";
|
|
248782
248782
|
|
|
248783
248783
|
// scripts/lib/runtime-build/api-cli.mjs
|
|
248784
248784
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
@@ -249109,7 +249109,7 @@ ${LOGS_USAGE}
|
|
|
249109
249109
|
// scripts/lib/runtime-build/assets-cli.mjs
|
|
249110
249110
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
249111
249111
|
import { readFileSync, statSync as statSync2, writeFileSync } from "node:fs";
|
|
249112
|
-
import { basename as
|
|
249112
|
+
import { basename as basename2, join as join2, resolve as resolve3 } from "node:path";
|
|
249113
249113
|
|
|
249114
249114
|
// scripts/lib/runtime-build/assets-file.mjs
|
|
249115
249115
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
@@ -250750,9 +250750,9 @@ var isAllowedNumericSeparatorSibling = {
|
|
|
250750
250750
|
dec: (ch) => ch >= 48 && ch <= 57,
|
|
250751
250751
|
hex: (ch) => ch >= 48 && ch <= 57 || ch >= 65 && ch <= 70 || ch >= 97 && ch <= 102
|
|
250752
250752
|
};
|
|
250753
|
-
function readStringContents(type, input, pos,
|
|
250753
|
+
function readStringContents(type, input, pos, lineStart, curLine, errors) {
|
|
250754
250754
|
const initialPos = pos;
|
|
250755
|
-
const initialLineStart =
|
|
250755
|
+
const initialLineStart = lineStart;
|
|
250756
250756
|
const initialCurLine = curLine;
|
|
250757
250757
|
let out = "";
|
|
250758
250758
|
let firstInvalidLoc = null;
|
|
@@ -250773,11 +250773,11 @@ function readStringContents(type, input, pos, lineStart2, curLine, errors) {
|
|
|
250773
250773
|
}
|
|
250774
250774
|
if (ch === 92) {
|
|
250775
250775
|
out += input.slice(chunkStart, pos);
|
|
250776
|
-
const res = readEscapedChar(input, pos,
|
|
250776
|
+
const res = readEscapedChar(input, pos, lineStart, curLine, type === "template", errors);
|
|
250777
250777
|
if (res.ch === null && !firstInvalidLoc) {
|
|
250778
250778
|
firstInvalidLoc = {
|
|
250779
250779
|
pos,
|
|
250780
|
-
lineStart
|
|
250780
|
+
lineStart,
|
|
250781
250781
|
curLine
|
|
250782
250782
|
};
|
|
250783
250783
|
} else {
|
|
@@ -250785,14 +250785,14 @@ function readStringContents(type, input, pos, lineStart2, curLine, errors) {
|
|
|
250785
250785
|
}
|
|
250786
250786
|
({
|
|
250787
250787
|
pos,
|
|
250788
|
-
lineStart
|
|
250788
|
+
lineStart,
|
|
250789
250789
|
curLine
|
|
250790
250790
|
} = res);
|
|
250791
250791
|
chunkStart = pos;
|
|
250792
250792
|
} else if (ch === 8232 || ch === 8233) {
|
|
250793
250793
|
++pos;
|
|
250794
250794
|
++curLine;
|
|
250795
|
-
|
|
250795
|
+
lineStart = pos;
|
|
250796
250796
|
} else if (ch === 10 || ch === 13) {
|
|
250797
250797
|
if (type === "template") {
|
|
250798
250798
|
out += input.slice(chunkStart, pos) + "\n";
|
|
@@ -250801,7 +250801,7 @@ function readStringContents(type, input, pos, lineStart2, curLine, errors) {
|
|
|
250801
250801
|
++pos;
|
|
250802
250802
|
}
|
|
250803
250803
|
++curLine;
|
|
250804
|
-
chunkStart =
|
|
250804
|
+
chunkStart = lineStart = pos;
|
|
250805
250805
|
} else {
|
|
250806
250806
|
errors.unterminated(initialPos, initialLineStart, initialCurLine);
|
|
250807
250807
|
}
|
|
@@ -250813,7 +250813,7 @@ function readStringContents(type, input, pos, lineStart2, curLine, errors) {
|
|
|
250813
250813
|
pos,
|
|
250814
250814
|
str: out,
|
|
250815
250815
|
firstInvalidLoc,
|
|
250816
|
-
lineStart
|
|
250816
|
+
lineStart,
|
|
250817
250817
|
curLine
|
|
250818
250818
|
};
|
|
250819
250819
|
}
|
|
@@ -250823,13 +250823,13 @@ function isStringEnd(type, ch, input, pos) {
|
|
|
250823
250823
|
}
|
|
250824
250824
|
return ch === (type === "double" ? 34 : 39);
|
|
250825
250825
|
}
|
|
250826
|
-
function readEscapedChar(input, pos,
|
|
250826
|
+
function readEscapedChar(input, pos, lineStart, curLine, inTemplate, errors) {
|
|
250827
250827
|
const throwOnInvalid = !inTemplate;
|
|
250828
250828
|
pos++;
|
|
250829
250829
|
const res = (ch2) => ({
|
|
250830
250830
|
pos,
|
|
250831
250831
|
ch: ch2,
|
|
250832
|
-
lineStart
|
|
250832
|
+
lineStart,
|
|
250833
250833
|
curLine
|
|
250834
250834
|
});
|
|
250835
250835
|
const ch = input.charCodeAt(pos++);
|
|
@@ -250843,7 +250843,7 @@ function readEscapedChar(input, pos, lineStart2, curLine, inTemplate, errors) {
|
|
|
250843
250843
|
({
|
|
250844
250844
|
code: code2,
|
|
250845
250845
|
pos
|
|
250846
|
-
} = readHexChar(input, pos,
|
|
250846
|
+
} = readHexChar(input, pos, lineStart, curLine, 2, false, throwOnInvalid, errors));
|
|
250847
250847
|
return res(code2 === null ? null : String.fromCharCode(code2));
|
|
250848
250848
|
}
|
|
250849
250849
|
case 117: {
|
|
@@ -250851,7 +250851,7 @@ function readEscapedChar(input, pos, lineStart2, curLine, inTemplate, errors) {
|
|
|
250851
250851
|
({
|
|
250852
250852
|
code: code2,
|
|
250853
250853
|
pos
|
|
250854
|
-
} = readCodePoint(input, pos,
|
|
250854
|
+
} = readCodePoint(input, pos, lineStart, curLine, throwOnInvalid, errors));
|
|
250855
250855
|
return res(code2 === null ? null : String.fromCodePoint(code2));
|
|
250856
250856
|
}
|
|
250857
250857
|
case 116:
|
|
@@ -250867,7 +250867,7 @@ function readEscapedChar(input, pos, lineStart2, curLine, inTemplate, errors) {
|
|
|
250867
250867
|
++pos;
|
|
250868
250868
|
}
|
|
250869
250869
|
case 10:
|
|
250870
|
-
|
|
250870
|
+
lineStart = pos;
|
|
250871
250871
|
++curLine;
|
|
250872
250872
|
case 8232:
|
|
250873
250873
|
case 8233:
|
|
@@ -250877,7 +250877,7 @@ function readEscapedChar(input, pos, lineStart2, curLine, inTemplate, errors) {
|
|
|
250877
250877
|
if (inTemplate) {
|
|
250878
250878
|
return res(null);
|
|
250879
250879
|
} else {
|
|
250880
|
-
errors.strictNumericEscape(pos - 1,
|
|
250880
|
+
errors.strictNumericEscape(pos - 1, lineStart, curLine);
|
|
250881
250881
|
}
|
|
250882
250882
|
default:
|
|
250883
250883
|
if (ch >= 48 && ch <= 55) {
|
|
@@ -250895,7 +250895,7 @@ function readEscapedChar(input, pos, lineStart2, curLine, inTemplate, errors) {
|
|
|
250895
250895
|
if (inTemplate) {
|
|
250896
250896
|
return res(null);
|
|
250897
250897
|
} else {
|
|
250898
|
-
errors.strictNumericEscape(startPos,
|
|
250898
|
+
errors.strictNumericEscape(startPos, lineStart, curLine);
|
|
250899
250899
|
}
|
|
250900
250900
|
}
|
|
250901
250901
|
return res(String.fromCharCode(octal));
|
|
@@ -250903,16 +250903,16 @@ function readEscapedChar(input, pos, lineStart2, curLine, inTemplate, errors) {
|
|
|
250903
250903
|
return res(String.fromCharCode(ch));
|
|
250904
250904
|
}
|
|
250905
250905
|
}
|
|
250906
|
-
function readHexChar(input, pos,
|
|
250906
|
+
function readHexChar(input, pos, lineStart, curLine, len, forceLen, throwOnInvalid, errors) {
|
|
250907
250907
|
const initialPos = pos;
|
|
250908
250908
|
let n;
|
|
250909
250909
|
({
|
|
250910
250910
|
n,
|
|
250911
250911
|
pos
|
|
250912
|
-
} = readInt(input, pos,
|
|
250912
|
+
} = readInt(input, pos, lineStart, curLine, 16, len, forceLen, false, errors, !throwOnInvalid));
|
|
250913
250913
|
if (n === null) {
|
|
250914
250914
|
if (throwOnInvalid) {
|
|
250915
|
-
errors.invalidEscapeSequence(initialPos,
|
|
250915
|
+
errors.invalidEscapeSequence(initialPos, lineStart, curLine);
|
|
250916
250916
|
} else {
|
|
250917
250917
|
pos = initialPos - 1;
|
|
250918
250918
|
}
|
|
@@ -250922,7 +250922,7 @@ function readHexChar(input, pos, lineStart2, curLine, len, forceLen, throwOnInva
|
|
|
250922
250922
|
pos
|
|
250923
250923
|
};
|
|
250924
250924
|
}
|
|
250925
|
-
function readInt(input, pos,
|
|
250925
|
+
function readInt(input, pos, lineStart, curLine, radix, len, forceLen, allowNumSeparator, errors, bailOnError) {
|
|
250926
250926
|
const start = pos;
|
|
250927
250927
|
const forbiddenSiblings = radix === 16 ? forbiddenNumericSeparatorSiblings.hex : forbiddenNumericSeparatorSiblings.decBinOct;
|
|
250928
250928
|
const isAllowedSibling = radix === 16 ? isAllowedNumericSeparatorSibling.hex : radix === 10 ? isAllowedNumericSeparatorSibling.dec : radix === 8 ? isAllowedNumericSeparatorSibling.oct : isAllowedNumericSeparatorSibling.bin;
|
|
@@ -250939,13 +250939,13 @@ function readInt(input, pos, lineStart2, curLine, radix, len, forceLen, allowNum
|
|
|
250939
250939
|
n: null,
|
|
250940
250940
|
pos
|
|
250941
250941
|
};
|
|
250942
|
-
errors.numericSeparatorInEscapeSequence(pos,
|
|
250942
|
+
errors.numericSeparatorInEscapeSequence(pos, lineStart, curLine);
|
|
250943
250943
|
} else if (Number.isNaN(next) || !isAllowedSibling(next) || forbiddenSiblings.has(prev)) {
|
|
250944
250944
|
if (bailOnError) return {
|
|
250945
250945
|
n: null,
|
|
250946
250946
|
pos
|
|
250947
250947
|
};
|
|
250948
|
-
errors.unexpectedNumericSeparator(pos,
|
|
250948
|
+
errors.unexpectedNumericSeparator(pos, lineStart, curLine);
|
|
250949
250949
|
}
|
|
250950
250950
|
++pos;
|
|
250951
250951
|
continue;
|
|
@@ -250965,7 +250965,7 @@ function readInt(input, pos, lineStart2, curLine, radix, len, forceLen, allowNum
|
|
|
250965
250965
|
n: null,
|
|
250966
250966
|
pos
|
|
250967
250967
|
};
|
|
250968
|
-
errors.invalidDigit(pos,
|
|
250968
|
+
errors.invalidDigit(pos, lineStart, curLine, radix);
|
|
250969
250969
|
val = 0;
|
|
250970
250970
|
} else if (forceLen) {
|
|
250971
250971
|
val = 0;
|
|
@@ -250988,7 +250988,7 @@ function readInt(input, pos, lineStart2, curLine, radix, len, forceLen, allowNum
|
|
|
250988
250988
|
pos
|
|
250989
250989
|
};
|
|
250990
250990
|
}
|
|
250991
|
-
function readCodePoint(input, pos,
|
|
250991
|
+
function readCodePoint(input, pos, lineStart, curLine, throwOnInvalid, errors) {
|
|
250992
250992
|
const ch = input.charCodeAt(pos);
|
|
250993
250993
|
let code2;
|
|
250994
250994
|
if (ch === 123) {
|
|
@@ -250996,11 +250996,11 @@ function readCodePoint(input, pos, lineStart2, curLine, throwOnInvalid, errors)
|
|
|
250996
250996
|
({
|
|
250997
250997
|
code: code2,
|
|
250998
250998
|
pos
|
|
250999
|
-
} = readHexChar(input, pos,
|
|
250999
|
+
} = readHexChar(input, pos, lineStart, curLine, input.indexOf("}", pos) - pos, true, throwOnInvalid, errors));
|
|
251000
251000
|
++pos;
|
|
251001
251001
|
if (code2 !== null && code2 > 1114111) {
|
|
251002
251002
|
if (throwOnInvalid) {
|
|
251003
|
-
errors.invalidCodePoint(pos,
|
|
251003
|
+
errors.invalidCodePoint(pos, lineStart, curLine);
|
|
251004
251004
|
} else {
|
|
251005
251005
|
return {
|
|
251006
251006
|
code: null,
|
|
@@ -251012,7 +251012,7 @@ function readCodePoint(input, pos, lineStart2, curLine, throwOnInvalid, errors)
|
|
|
251012
251012
|
({
|
|
251013
251013
|
code: code2,
|
|
251014
251014
|
pos
|
|
251015
|
-
} = readHexChar(input, pos,
|
|
251015
|
+
} = readHexChar(input, pos, lineStart, curLine, 4, false, throwOnInvalid, errors));
|
|
251016
251016
|
}
|
|
251017
251017
|
return {
|
|
251018
251018
|
code: code2,
|
|
@@ -262254,8 +262254,8 @@ var TraceMap = class {
|
|
|
262254
262254
|
this.sources = sources;
|
|
262255
262255
|
this.sourcesContent = sourcesContent;
|
|
262256
262256
|
this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || void 0;
|
|
262257
|
-
const
|
|
262258
|
-
this.resolvedSources = sources.map(
|
|
262257
|
+
const resolve7 = resolver(mapUrl, sourceRoot);
|
|
262258
|
+
this.resolvedSources = sources.map(resolve7);
|
|
262259
262259
|
const { mappings } = parsed;
|
|
262260
262260
|
if (typeof mappings === "string") {
|
|
262261
262261
|
this._encoded = mappings;
|
|
@@ -273414,9 +273414,9 @@ var isAllowedNumericSeparatorSibling2 = {
|
|
|
273414
273414
|
dec: (ch) => ch >= 48 && ch <= 57,
|
|
273415
273415
|
hex: (ch) => ch >= 48 && ch <= 57 || ch >= 65 && ch <= 70 || ch >= 97 && ch <= 102
|
|
273416
273416
|
};
|
|
273417
|
-
function readStringContents2(type, input, pos,
|
|
273417
|
+
function readStringContents2(type, input, pos, lineStart, curLine, errors) {
|
|
273418
273418
|
const initialPos = pos;
|
|
273419
|
-
const initialLineStart =
|
|
273419
|
+
const initialLineStart = lineStart;
|
|
273420
273420
|
const initialCurLine = curLine;
|
|
273421
273421
|
let out = "";
|
|
273422
273422
|
let firstInvalidLoc = null;
|
|
@@ -273437,11 +273437,11 @@ function readStringContents2(type, input, pos, lineStart2, curLine, errors) {
|
|
|
273437
273437
|
}
|
|
273438
273438
|
if (ch === 92) {
|
|
273439
273439
|
out += input.slice(chunkStart, pos);
|
|
273440
|
-
const res = readEscapedChar2(input, pos,
|
|
273440
|
+
const res = readEscapedChar2(input, pos, lineStart, curLine, type === "template", errors);
|
|
273441
273441
|
if (res.ch === null && !firstInvalidLoc) {
|
|
273442
273442
|
firstInvalidLoc = {
|
|
273443
273443
|
pos,
|
|
273444
|
-
lineStart
|
|
273444
|
+
lineStart,
|
|
273445
273445
|
curLine
|
|
273446
273446
|
};
|
|
273447
273447
|
} else {
|
|
@@ -273449,14 +273449,14 @@ function readStringContents2(type, input, pos, lineStart2, curLine, errors) {
|
|
|
273449
273449
|
}
|
|
273450
273450
|
({
|
|
273451
273451
|
pos,
|
|
273452
|
-
lineStart
|
|
273452
|
+
lineStart,
|
|
273453
273453
|
curLine
|
|
273454
273454
|
} = res);
|
|
273455
273455
|
chunkStart = pos;
|
|
273456
273456
|
} else if (ch === 8232 || ch === 8233) {
|
|
273457
273457
|
++pos;
|
|
273458
273458
|
++curLine;
|
|
273459
|
-
|
|
273459
|
+
lineStart = pos;
|
|
273460
273460
|
} else if (ch === 10 || ch === 13) {
|
|
273461
273461
|
if (type === "template") {
|
|
273462
273462
|
out += input.slice(chunkStart, pos) + "\n";
|
|
@@ -273465,7 +273465,7 @@ function readStringContents2(type, input, pos, lineStart2, curLine, errors) {
|
|
|
273465
273465
|
++pos;
|
|
273466
273466
|
}
|
|
273467
273467
|
++curLine;
|
|
273468
|
-
chunkStart =
|
|
273468
|
+
chunkStart = lineStart = pos;
|
|
273469
273469
|
} else {
|
|
273470
273470
|
errors.unterminated(initialPos, initialLineStart, initialCurLine);
|
|
273471
273471
|
}
|
|
@@ -273477,7 +273477,7 @@ function readStringContents2(type, input, pos, lineStart2, curLine, errors) {
|
|
|
273477
273477
|
pos,
|
|
273478
273478
|
str: out,
|
|
273479
273479
|
firstInvalidLoc,
|
|
273480
|
-
lineStart
|
|
273480
|
+
lineStart,
|
|
273481
273481
|
curLine
|
|
273482
273482
|
};
|
|
273483
273483
|
}
|
|
@@ -273487,13 +273487,13 @@ function isStringEnd2(type, ch, input, pos) {
|
|
|
273487
273487
|
}
|
|
273488
273488
|
return ch === (type === "double" ? 34 : 39);
|
|
273489
273489
|
}
|
|
273490
|
-
function readEscapedChar2(input, pos,
|
|
273490
|
+
function readEscapedChar2(input, pos, lineStart, curLine, inTemplate, errors) {
|
|
273491
273491
|
const throwOnInvalid = !inTemplate;
|
|
273492
273492
|
pos++;
|
|
273493
273493
|
const res = (ch2) => ({
|
|
273494
273494
|
pos,
|
|
273495
273495
|
ch: ch2,
|
|
273496
|
-
lineStart
|
|
273496
|
+
lineStart,
|
|
273497
273497
|
curLine
|
|
273498
273498
|
});
|
|
273499
273499
|
const ch = input.charCodeAt(pos++);
|
|
@@ -273507,7 +273507,7 @@ function readEscapedChar2(input, pos, lineStart2, curLine, inTemplate, errors) {
|
|
|
273507
273507
|
({
|
|
273508
273508
|
code: code2,
|
|
273509
273509
|
pos
|
|
273510
|
-
} = readHexChar2(input, pos,
|
|
273510
|
+
} = readHexChar2(input, pos, lineStart, curLine, 2, false, throwOnInvalid, errors));
|
|
273511
273511
|
return res(code2 === null ? null : String.fromCharCode(code2));
|
|
273512
273512
|
}
|
|
273513
273513
|
case 117: {
|
|
@@ -273515,7 +273515,7 @@ function readEscapedChar2(input, pos, lineStart2, curLine, inTemplate, errors) {
|
|
|
273515
273515
|
({
|
|
273516
273516
|
code: code2,
|
|
273517
273517
|
pos
|
|
273518
|
-
} = readCodePoint2(input, pos,
|
|
273518
|
+
} = readCodePoint2(input, pos, lineStart, curLine, throwOnInvalid, errors));
|
|
273519
273519
|
return res(code2 === null ? null : String.fromCodePoint(code2));
|
|
273520
273520
|
}
|
|
273521
273521
|
case 116:
|
|
@@ -273531,7 +273531,7 @@ function readEscapedChar2(input, pos, lineStart2, curLine, inTemplate, errors) {
|
|
|
273531
273531
|
++pos;
|
|
273532
273532
|
}
|
|
273533
273533
|
case 10:
|
|
273534
|
-
|
|
273534
|
+
lineStart = pos;
|
|
273535
273535
|
++curLine;
|
|
273536
273536
|
case 8232:
|
|
273537
273537
|
case 8233:
|
|
@@ -273541,7 +273541,7 @@ function readEscapedChar2(input, pos, lineStart2, curLine, inTemplate, errors) {
|
|
|
273541
273541
|
if (inTemplate) {
|
|
273542
273542
|
return res(null);
|
|
273543
273543
|
} else {
|
|
273544
|
-
errors.strictNumericEscape(pos - 1,
|
|
273544
|
+
errors.strictNumericEscape(pos - 1, lineStart, curLine);
|
|
273545
273545
|
}
|
|
273546
273546
|
default:
|
|
273547
273547
|
if (ch >= 48 && ch <= 55) {
|
|
@@ -273559,7 +273559,7 @@ function readEscapedChar2(input, pos, lineStart2, curLine, inTemplate, errors) {
|
|
|
273559
273559
|
if (inTemplate) {
|
|
273560
273560
|
return res(null);
|
|
273561
273561
|
} else {
|
|
273562
|
-
errors.strictNumericEscape(startPos,
|
|
273562
|
+
errors.strictNumericEscape(startPos, lineStart, curLine);
|
|
273563
273563
|
}
|
|
273564
273564
|
}
|
|
273565
273565
|
return res(String.fromCharCode(octal));
|
|
@@ -273567,16 +273567,16 @@ function readEscapedChar2(input, pos, lineStart2, curLine, inTemplate, errors) {
|
|
|
273567
273567
|
return res(String.fromCharCode(ch));
|
|
273568
273568
|
}
|
|
273569
273569
|
}
|
|
273570
|
-
function readHexChar2(input, pos,
|
|
273570
|
+
function readHexChar2(input, pos, lineStart, curLine, len, forceLen, throwOnInvalid, errors) {
|
|
273571
273571
|
const initialPos = pos;
|
|
273572
273572
|
let n;
|
|
273573
273573
|
({
|
|
273574
273574
|
n,
|
|
273575
273575
|
pos
|
|
273576
|
-
} = readInt2(input, pos,
|
|
273576
|
+
} = readInt2(input, pos, lineStart, curLine, 16, len, forceLen, false, errors, !throwOnInvalid));
|
|
273577
273577
|
if (n === null) {
|
|
273578
273578
|
if (throwOnInvalid) {
|
|
273579
|
-
errors.invalidEscapeSequence(initialPos,
|
|
273579
|
+
errors.invalidEscapeSequence(initialPos, lineStart, curLine);
|
|
273580
273580
|
} else {
|
|
273581
273581
|
pos = initialPos - 1;
|
|
273582
273582
|
}
|
|
@@ -273586,7 +273586,7 @@ function readHexChar2(input, pos, lineStart2, curLine, len, forceLen, throwOnInv
|
|
|
273586
273586
|
pos
|
|
273587
273587
|
};
|
|
273588
273588
|
}
|
|
273589
|
-
function readInt2(input, pos,
|
|
273589
|
+
function readInt2(input, pos, lineStart, curLine, radix, len, forceLen, allowNumSeparator, errors, bailOnError) {
|
|
273590
273590
|
const start = pos;
|
|
273591
273591
|
const forbiddenSiblings = radix === 16 ? forbiddenNumericSeparatorSiblings2.hex : forbiddenNumericSeparatorSiblings2.decBinOct;
|
|
273592
273592
|
const isAllowedSibling = radix === 16 ? isAllowedNumericSeparatorSibling2.hex : radix === 10 ? isAllowedNumericSeparatorSibling2.dec : radix === 8 ? isAllowedNumericSeparatorSibling2.oct : isAllowedNumericSeparatorSibling2.bin;
|
|
@@ -273603,13 +273603,13 @@ function readInt2(input, pos, lineStart2, curLine, radix, len, forceLen, allowNu
|
|
|
273603
273603
|
n: null,
|
|
273604
273604
|
pos
|
|
273605
273605
|
};
|
|
273606
|
-
errors.numericSeparatorInEscapeSequence(pos,
|
|
273606
|
+
errors.numericSeparatorInEscapeSequence(pos, lineStart, curLine);
|
|
273607
273607
|
} else if (Number.isNaN(next) || !isAllowedSibling(next) || forbiddenSiblings.has(prev)) {
|
|
273608
273608
|
if (bailOnError) return {
|
|
273609
273609
|
n: null,
|
|
273610
273610
|
pos
|
|
273611
273611
|
};
|
|
273612
|
-
errors.unexpectedNumericSeparator(pos,
|
|
273612
|
+
errors.unexpectedNumericSeparator(pos, lineStart, curLine);
|
|
273613
273613
|
}
|
|
273614
273614
|
++pos;
|
|
273615
273615
|
continue;
|
|
@@ -273629,7 +273629,7 @@ function readInt2(input, pos, lineStart2, curLine, radix, len, forceLen, allowNu
|
|
|
273629
273629
|
n: null,
|
|
273630
273630
|
pos
|
|
273631
273631
|
};
|
|
273632
|
-
errors.invalidDigit(pos,
|
|
273632
|
+
errors.invalidDigit(pos, lineStart, curLine, radix);
|
|
273633
273633
|
val = 0;
|
|
273634
273634
|
} else if (forceLen) {
|
|
273635
273635
|
val = 0;
|
|
@@ -273652,7 +273652,7 @@ function readInt2(input, pos, lineStart2, curLine, radix, len, forceLen, allowNu
|
|
|
273652
273652
|
pos
|
|
273653
273653
|
};
|
|
273654
273654
|
}
|
|
273655
|
-
function readCodePoint2(input, pos,
|
|
273655
|
+
function readCodePoint2(input, pos, lineStart, curLine, throwOnInvalid, errors) {
|
|
273656
273656
|
const ch = input.charCodeAt(pos);
|
|
273657
273657
|
let code2;
|
|
273658
273658
|
if (ch === 123) {
|
|
@@ -273660,11 +273660,11 @@ function readCodePoint2(input, pos, lineStart2, curLine, throwOnInvalid, errors)
|
|
|
273660
273660
|
({
|
|
273661
273661
|
code: code2,
|
|
273662
273662
|
pos
|
|
273663
|
-
} = readHexChar2(input, pos,
|
|
273663
|
+
} = readHexChar2(input, pos, lineStart, curLine, input.indexOf("}", pos) - pos, true, throwOnInvalid, errors));
|
|
273664
273664
|
++pos;
|
|
273665
273665
|
if (code2 !== null && code2 > 1114111) {
|
|
273666
273666
|
if (throwOnInvalid) {
|
|
273667
|
-
errors.invalidCodePoint(pos,
|
|
273667
|
+
errors.invalidCodePoint(pos, lineStart, curLine);
|
|
273668
273668
|
} else {
|
|
273669
273669
|
return {
|
|
273670
273670
|
code: null,
|
|
@@ -273676,15 +273676,15 @@ function readCodePoint2(input, pos, lineStart2, curLine, throwOnInvalid, errors)
|
|
|
273676
273676
|
({
|
|
273677
273677
|
code: code2,
|
|
273678
273678
|
pos
|
|
273679
|
-
} = readHexChar2(input, pos,
|
|
273679
|
+
} = readHexChar2(input, pos, lineStart, curLine, 4, false, throwOnInvalid, errors));
|
|
273680
273680
|
}
|
|
273681
273681
|
return {
|
|
273682
273682
|
code: code2,
|
|
273683
273683
|
pos
|
|
273684
273684
|
};
|
|
273685
273685
|
}
|
|
273686
|
-
function buildPosition(pos,
|
|
273687
|
-
return new Position(curLine, pos -
|
|
273686
|
+
function buildPosition(pos, lineStart, curLine) {
|
|
273687
|
+
return new Position(curLine, pos - lineStart, pos);
|
|
273688
273688
|
}
|
|
273689
273689
|
var VALID_REGEX_FLAGS = /* @__PURE__ */ new Set([103, 109, 115, 105, 121, 117, 100, 118]);
|
|
273690
273690
|
var Token = class {
|
|
@@ -274517,10 +274517,10 @@ var Tokenizer = class extends CommentsParser {
|
|
|
274517
274517
|
str,
|
|
274518
274518
|
pos,
|
|
274519
274519
|
curLine,
|
|
274520
|
-
lineStart
|
|
274520
|
+
lineStart
|
|
274521
274521
|
} = readStringContents2(quote === 34 ? "double" : "single", this.input, this.state.pos + 1, this.state.lineStart, this.state.curLine, this.errorHandlers_readStringContents_string);
|
|
274522
274522
|
this.state.pos = pos + 1;
|
|
274523
|
-
this.state.lineStart =
|
|
274523
|
+
this.state.lineStart = lineStart;
|
|
274524
274524
|
this.state.curLine = curLine;
|
|
274525
274525
|
this.finishToken(133, str);
|
|
274526
274526
|
}
|
|
@@ -274538,10 +274538,10 @@ var Tokenizer = class extends CommentsParser {
|
|
|
274538
274538
|
firstInvalidLoc,
|
|
274539
274539
|
pos,
|
|
274540
274540
|
curLine,
|
|
274541
|
-
lineStart
|
|
274541
|
+
lineStart
|
|
274542
274542
|
} = readStringContents2("template", this.input, this.state.pos + 1, this.state.lineStart, this.state.curLine, this.errorHandlers_readStringContents_template);
|
|
274543
274543
|
this.state.pos = pos + 1;
|
|
274544
|
-
this.state.lineStart =
|
|
274544
|
+
this.state.lineStart = lineStart;
|
|
274545
274545
|
this.state.curLine = curLine;
|
|
274546
274546
|
if (firstInvalidLoc) {
|
|
274547
274547
|
this.state.firstInvalidTemplateEscapePos = new Position(firstInvalidLoc.curLine, firstInvalidLoc.pos - firstInvalidLoc.lineStart, this.sourceToOffsetPos(firstInvalidLoc.pos));
|
|
@@ -274662,13 +274662,13 @@ var Tokenizer = class extends CommentsParser {
|
|
|
274662
274662
|
}
|
|
274663
274663
|
}
|
|
274664
274664
|
errorBuilder(error) {
|
|
274665
|
-
return (pos,
|
|
274666
|
-
this.raise(error, buildPosition(pos,
|
|
274665
|
+
return (pos, lineStart, curLine) => {
|
|
274666
|
+
this.raise(error, buildPosition(pos, lineStart, curLine));
|
|
274667
274667
|
};
|
|
274668
274668
|
}
|
|
274669
274669
|
errorHandlers_readInt = {
|
|
274670
|
-
invalidDigit: (pos,
|
|
274671
|
-
this.raise(Errors.InvalidDigit, buildPosition(pos,
|
|
274670
|
+
invalidDigit: (pos, lineStart, curLine, radix) => {
|
|
274671
|
+
this.raise(Errors.InvalidDigit, buildPosition(pos, lineStart, curLine), {
|
|
274672
274672
|
radix
|
|
274673
274673
|
});
|
|
274674
274674
|
},
|
|
@@ -274682,18 +274682,18 @@ var Tokenizer = class extends CommentsParser {
|
|
|
274682
274682
|
};
|
|
274683
274683
|
errorHandlers_readStringContents_string = {
|
|
274684
274684
|
...this.errorHandlers_readCodePoint,
|
|
274685
|
-
strictNumericEscape: (pos,
|
|
274686
|
-
this.recordStrictModeErrors(Errors.StrictNumericEscape, buildPosition(pos,
|
|
274685
|
+
strictNumericEscape: (pos, lineStart, curLine) => {
|
|
274686
|
+
this.recordStrictModeErrors(Errors.StrictNumericEscape, buildPosition(pos, lineStart, curLine));
|
|
274687
274687
|
},
|
|
274688
|
-
unterminated: (pos,
|
|
274689
|
-
throw this.raise(Errors.UnterminatedString, buildPosition(pos - 1,
|
|
274688
|
+
unterminated: (pos, lineStart, curLine) => {
|
|
274689
|
+
throw this.raise(Errors.UnterminatedString, buildPosition(pos - 1, lineStart, curLine));
|
|
274690
274690
|
}
|
|
274691
274691
|
};
|
|
274692
274692
|
errorHandlers_readStringContents_template = {
|
|
274693
274693
|
...this.errorHandlers_readCodePoint,
|
|
274694
274694
|
strictNumericEscape: this.errorBuilder(Errors.StrictNumericEscape),
|
|
274695
|
-
unterminated: (pos,
|
|
274696
|
-
throw this.raise(Errors.UnterminatedTemplate, buildPosition(pos,
|
|
274695
|
+
unterminated: (pos, lineStart, curLine) => {
|
|
274696
|
+
throw this.raise(Errors.UnterminatedTemplate, buildPosition(pos, lineStart, curLine));
|
|
274697
274697
|
}
|
|
274698
274698
|
};
|
|
274699
274699
|
};
|
|
@@ -288230,7 +288230,6 @@ init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
|
288230
288230
|
|
|
288231
288231
|
// scripts/lib/runtime-build/resource-references.mjs
|
|
288232
288232
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
288233
|
-
import { basename as basename2, extname } from "node:path";
|
|
288234
288233
|
|
|
288235
288234
|
// app/pages/resources/js/pageRuntime/sdk/generatedNames.ts
|
|
288236
288235
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
@@ -288272,6 +288271,34 @@ function memberPathSegments(node) {
|
|
|
288272
288271
|
return null;
|
|
288273
288272
|
}
|
|
288274
288273
|
|
|
288274
|
+
// scripts/lib/runtime-build/resource-paths.mjs
|
|
288275
|
+
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
288276
|
+
var CHILD_KINDS = Object.freeze({
|
|
288277
|
+
fields: "resource_field",
|
|
288278
|
+
policies: "resource_policy",
|
|
288279
|
+
records: "resource_record"
|
|
288280
|
+
});
|
|
288281
|
+
var DEFINITION_PATH = /^resources\/([^/]+)\/resource\.ts$/;
|
|
288282
|
+
var CHILD_PATH = /^resources\/([^/]+)\/(fields|policies|records)\/([^/]+)\.ts$/;
|
|
288283
|
+
var LEGACY_PATH = /^resources\/([^/]+)\.ts$/;
|
|
288284
|
+
function isResourcePath(path) {
|
|
288285
|
+
return DEFINITION_PATH.test(path);
|
|
288286
|
+
}
|
|
288287
|
+
function resourceChildOf(path) {
|
|
288288
|
+
const match = CHILD_PATH.exec(path);
|
|
288289
|
+
if (match === null) {
|
|
288290
|
+
return null;
|
|
288291
|
+
}
|
|
288292
|
+
const [, folder, directory, key] = match;
|
|
288293
|
+
return { folder, kind: CHILD_KINDS[directory], key, definitionPath: `resources/${folder}/resource.ts` };
|
|
288294
|
+
}
|
|
288295
|
+
function resourceFolderOf(path) {
|
|
288296
|
+
return DEFINITION_PATH.exec(path)?.[1] ?? null;
|
|
288297
|
+
}
|
|
288298
|
+
function legacyResourceFolder(path) {
|
|
288299
|
+
return LEGACY_PATH.exec(path)?.[1] ?? null;
|
|
288300
|
+
}
|
|
288301
|
+
|
|
288275
288302
|
// scripts/lib/runtime-build/source-module.mjs
|
|
288276
288303
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
288277
288304
|
|
|
@@ -289226,7 +289253,7 @@ function cssReferences(source) {
|
|
|
289226
289253
|
let composing = false;
|
|
289227
289254
|
let nextNewline = source.indexOf("\n");
|
|
289228
289255
|
let line = 1;
|
|
289229
|
-
let
|
|
289256
|
+
let lineStart = 0;
|
|
289230
289257
|
const skipSpace = () => {
|
|
289231
289258
|
while (offset < source.length) {
|
|
289232
289259
|
if (/\s/.test(source[offset])) {
|
|
@@ -289252,10 +289279,10 @@ function cssReferences(source) {
|
|
|
289252
289279
|
const add = (value, start) => {
|
|
289253
289280
|
while (nextNewline !== -1 && nextNewline < start) {
|
|
289254
289281
|
line++;
|
|
289255
|
-
|
|
289256
|
-
nextNewline = source.indexOf("\n",
|
|
289282
|
+
lineStart = nextNewline + 1;
|
|
289283
|
+
nextNewline = source.indexOf("\n", lineStart);
|
|
289257
289284
|
}
|
|
289258
|
-
const column = start -
|
|
289285
|
+
const column = start - lineStart + 1;
|
|
289259
289286
|
(importing ? imports : urls).push({ value, line, column });
|
|
289260
289287
|
importing = false;
|
|
289261
289288
|
};
|
|
@@ -289337,7 +289364,7 @@ function diagnostic(path, line, column, message, { stage = BUILD_STAGE, severity
|
|
|
289337
289364
|
}
|
|
289338
289365
|
function diagnosticAt(path, node, message, options) {
|
|
289339
289366
|
const start = node?.loc?.start;
|
|
289340
|
-
return diagnostic(path, start ? start.line : 1, start ? start.column + 1 : 1, message, options);
|
|
289367
|
+
return diagnostic(node?.loc?.filename ?? path, start ? start.line : 1, start ? start.column + 1 : 1, message, options);
|
|
289341
289368
|
}
|
|
289342
289369
|
function hasErrors(diagnostics) {
|
|
289343
289370
|
return diagnostics.some((diagnostic2) => diagnostic2.severity === "error");
|
|
@@ -289356,11 +289383,12 @@ function diagnosticFromError(path, error) {
|
|
|
289356
289383
|
}
|
|
289357
289384
|
throw error;
|
|
289358
289385
|
}
|
|
289359
|
-
function parseSource(source, { jsx: jsx2 }) {
|
|
289386
|
+
function parseSource(source, { jsx: jsx2, path }) {
|
|
289360
289387
|
return parse2(source, {
|
|
289361
289388
|
sourceType: "module",
|
|
289362
289389
|
plugins: jsx2 ? ["typescript", "jsx"] : ["typescript"],
|
|
289363
|
-
errorRecovery: false
|
|
289390
|
+
errorRecovery: false,
|
|
289391
|
+
...path === void 0 ? {} : { sourceFilename: path }
|
|
289364
289392
|
});
|
|
289365
289393
|
}
|
|
289366
289394
|
function isTypeOnlyStatement(statement2) {
|
|
@@ -302061,6 +302089,7 @@ function scriptWorkspaceDeclarations(resources, builtInResources = [], notificat
|
|
|
302061
302089
|
var traverse4 = traverse3.default ?? traverse3;
|
|
302062
302090
|
var GENERATED_RESOURCES_PATH = "generated/resources.ts";
|
|
302063
302091
|
var GENERATED_RESOURCES_MODULE = "@app/generated/resources";
|
|
302092
|
+
var GENERATED_RESOURCE_FOLDERS_PATH = "generated/resource-folders.ts";
|
|
302064
302093
|
var RESOURCES_EXPORT = "Resources";
|
|
302065
302094
|
var WORKFLOW_MODULE = "@diagonal/workflow";
|
|
302066
302095
|
var WORKFLOW_PACKAGE = "@diagonal-hq/workflows";
|
|
@@ -302100,20 +302129,23 @@ function resourceNames(files, diagnostics) {
|
|
|
302100
302129
|
namesBySlug.set(slug, studlyName(slug));
|
|
302101
302130
|
}
|
|
302102
302131
|
for (const { path, slug: declared = null, node = null, problem: problem2 = null } of files) {
|
|
302103
|
-
const fileName =
|
|
302132
|
+
const fileName = resourceFolderOf(path);
|
|
302133
|
+
if (fileName === null) {
|
|
302134
|
+
throw new Error(`resourceNames() takes the resources/<folder>/resource.ts path of each resource, not ${path}`);
|
|
302135
|
+
}
|
|
302104
302136
|
if (BUILT_IN_RESOURCE_SLUGS.has(fileName)) {
|
|
302105
302137
|
diagnostics.push(
|
|
302106
302138
|
diagnosticAt(
|
|
302107
302139
|
path,
|
|
302108
302140
|
null,
|
|
302109
|
-
"Delete this
|
|
302141
|
+
"Delete this folder. The build always generates Resources.Roles and Resources.Permissions."
|
|
302110
302142
|
)
|
|
302111
302143
|
);
|
|
302112
302144
|
continue;
|
|
302113
302145
|
}
|
|
302114
302146
|
if (!RESOURCE_SLUG_PATTERN.test(fileName)) {
|
|
302115
302147
|
const role = declared === null ? "is the resource slug" : "gives the Resources name of the resource";
|
|
302116
|
-
diagnostics.push(diagnosticAt(path, null, `The
|
|
302148
|
+
diagnostics.push(diagnosticAt(path, null, `The folder name "${fileName}" ${role}, so it must ${SLUG_RULE}`));
|
|
302117
302149
|
continue;
|
|
302118
302150
|
}
|
|
302119
302151
|
if (problem2 !== null) {
|
|
@@ -302141,7 +302173,7 @@ function resourceNames(files, diagnostics) {
|
|
|
302141
302173
|
const otherName = pathsByName.get(name);
|
|
302142
302174
|
if (otherName === void 0 && slugsByName.has(name)) {
|
|
302143
302175
|
diagnostics.push(
|
|
302144
|
-
diagnosticAt(path, null, `The
|
|
302176
|
+
diagnosticAt(path, null, `The folder name "${fileName}" has the name Resources.${name} of a built-in resource. Rename the folder`)
|
|
302145
302177
|
);
|
|
302146
302178
|
continue;
|
|
302147
302179
|
}
|
|
@@ -302150,7 +302182,7 @@ function resourceNames(files, diagnostics) {
|
|
|
302150
302182
|
diagnosticAt(
|
|
302151
302183
|
path,
|
|
302152
302184
|
null,
|
|
302153
|
-
`The
|
|
302185
|
+
`The folder names "${resourceFolderOf(otherName)}" and "${fileName}" both have the name Resources.${name}. Rename one of the folders`,
|
|
302154
302186
|
{ relatedPath: otherName }
|
|
302155
302187
|
)
|
|
302156
302188
|
);
|
|
@@ -302162,7 +302194,7 @@ function resourceNames(files, diagnostics) {
|
|
|
302162
302194
|
diagnosticAt(
|
|
302163
302195
|
path,
|
|
302164
302196
|
node,
|
|
302165
|
-
`The
|
|
302197
|
+
`The resources ${otherSlug} and ${path} have the same slug "${slug}". Change the slug of one of them`,
|
|
302166
302198
|
{ relatedPath: otherSlug }
|
|
302167
302199
|
)
|
|
302168
302200
|
);
|
|
@@ -302186,15 +302218,15 @@ function staticRecordValues(resource, record) {
|
|
|
302186
302218
|
}
|
|
302187
302219
|
return values;
|
|
302188
302220
|
}
|
|
302189
|
-
function policyKey(
|
|
302190
|
-
const key = studlyName(
|
|
302221
|
+
function policyKey(fileKey) {
|
|
302222
|
+
const key = studlyName(fileKey);
|
|
302191
302223
|
return /^[0-9]/.test(key) ? `Policy${key}` : key;
|
|
302192
302224
|
}
|
|
302193
302225
|
function policyKeys(policies) {
|
|
302194
302226
|
const policiesByKey = /* @__PURE__ */ new Map();
|
|
302195
302227
|
const unnamed = [];
|
|
302196
302228
|
for (const policy of policies) {
|
|
302197
|
-
const key = policyKey(policy.
|
|
302229
|
+
const key = policyKey(policy.key);
|
|
302198
302230
|
if (key === "" || policiesByKey.has(key)) {
|
|
302199
302231
|
unnamed.push({ policy, key });
|
|
302200
302232
|
continue;
|
|
@@ -302209,8 +302241,11 @@ function policyKeyWarnings(resources, { namesBySlug }) {
|
|
|
302209
302241
|
const name = namesBySlug.get(resource.slug);
|
|
302210
302242
|
const { policiesByKey, unnamed } = policyKeys(resource.policies ?? []);
|
|
302211
302243
|
for (const { policy, key } of unnamed) {
|
|
302212
|
-
const
|
|
302213
|
-
|
|
302244
|
+
const first = policiesByKey.get(key);
|
|
302245
|
+
const message = first === void 0 ? `The policy file "${policy.key}" has no key in Resources.${name}.policies, because its name has no letters or digits. Rename the file` : `The policy files "${first.key}" and "${policy.key}" both have the key Resources.${name}.policies.${key}, so it names "${first.key}". Rename one of the files`;
|
|
302246
|
+
diagnostics.push(
|
|
302247
|
+
diagnosticAt(policy.path, null, message, first === void 0 ? { severity: "warning" } : { severity: "warning", relatedPath: first.path })
|
|
302248
|
+
);
|
|
302214
302249
|
}
|
|
302215
302250
|
}
|
|
302216
302251
|
return diagnostics;
|
|
@@ -302292,6 +302327,23 @@ function generatedResourcesSource(names2, resources, { workflowPackageDeclared =
|
|
|
302292
302327
|
workflowPackageDeclared
|
|
302293
302328
|
});
|
|
302294
302329
|
}
|
|
302330
|
+
function generatedResourceFoldersSource(names2, resources) {
|
|
302331
|
+
const folders = resources.filter((resource) => names2.namesBySlug.has(resource.slug)).map((resource) => {
|
|
302332
|
+
const folder = resourceFolderOf(resource.path);
|
|
302333
|
+
return ` ${IDENTIFIER_KEY.test(folder) ? folder : quoted(folder)}: typeof ${RESOURCES_EXPORT}.${names2.namesBySlug.get(resource.slug)};`;
|
|
302334
|
+
});
|
|
302335
|
+
return [
|
|
302336
|
+
GENERATED_HEADER,
|
|
302337
|
+
`import type { ${RESOURCES_EXPORT} } from './resources';`,
|
|
302338
|
+
"",
|
|
302339
|
+
`declare module '${AUTHORING_MODULE}' {`,
|
|
302340
|
+
" interface WorkspaceResourceFolders {",
|
|
302341
|
+
...folders,
|
|
302342
|
+
" }",
|
|
302343
|
+
"}",
|
|
302344
|
+
""
|
|
302345
|
+
].join("\n");
|
|
302346
|
+
}
|
|
302295
302347
|
function generatedWorkflowTypesSource(name, entries, declarations, { augment, workflowPackageDeclared }) {
|
|
302296
302348
|
const modules = [WORKFLOW_MODULE, ...workflowPackageDeclared ? [WORKFLOW_PACKAGE] : []];
|
|
302297
302349
|
const augmentations = modules.map((module) => augment(module)).join("");
|
|
@@ -302310,7 +302362,13 @@ export const ${name} = ${printLiteral(entries, 0)} as const;
|
|
|
302310
302362
|
`;
|
|
302311
302363
|
}
|
|
302312
302364
|
function resourceValues(entries) {
|
|
302313
|
-
return {
|
|
302365
|
+
return {
|
|
302366
|
+
entries,
|
|
302367
|
+
exportName: RESOURCES_EXPORT,
|
|
302368
|
+
noun: "resource",
|
|
302369
|
+
directory: "resources/",
|
|
302370
|
+
unknownName: (path, key, depth) => depth === 0 ? `Unknown resource "${path}.${key}". Each name in ${path} is a folder in resources/ with a resource.ts` : null
|
|
302371
|
+
};
|
|
302314
302372
|
}
|
|
302315
302373
|
function inlineGeneratedValues(source, ast, generatedModuleOf, { typescript: typescript2 = false, typeChecked = false } = {}) {
|
|
302316
302374
|
const mode = typescript2 ? typeChecked ? "call" : "cast" : null;
|
|
@@ -302479,8 +302537,8 @@ function offsetOf(text2, line, column) {
|
|
|
302479
302537
|
}
|
|
302480
302538
|
function positionOf(text2, offset) {
|
|
302481
302539
|
const before = text2.slice(0, offset);
|
|
302482
|
-
const
|
|
302483
|
-
return { line: before.split("\n").length, column: offset -
|
|
302540
|
+
const lineStart = before.lastIndexOf("\n") + 1;
|
|
302541
|
+
return { line: before.split("\n").length, column: offset - lineStart + 1 };
|
|
302484
302542
|
}
|
|
302485
302543
|
function memberName(node, object) {
|
|
302486
302544
|
if ((node?.type === "MemberExpression" || node?.type === "OptionalMemberExpression") && node.object === object && !node.computed && node.property.type === "Identifier") {
|
|
@@ -302766,7 +302824,7 @@ function camelKey(name) {
|
|
|
302766
302824
|
return `${name.charAt(0).toLowerCase()}${name.slice(1)}`;
|
|
302767
302825
|
}
|
|
302768
302826
|
var GENERATED_REFERENCES = [
|
|
302769
|
-
{ option: "resources", values: "slugsByName", noun: "resource", directory: "resources/", property: "slug" },
|
|
302827
|
+
{ option: "resources", values: "slugsByName", noun: "resource", directory: "resources/", names: "is a folder in resources/ with a resource.ts", property: "slug" },
|
|
302770
302828
|
{
|
|
302771
302829
|
option: "assets",
|
|
302772
302830
|
values: "keysByName",
|
|
@@ -303242,8 +303300,8 @@ export default defineAssets({
|
|
|
303242
303300
|
}
|
|
303243
303301
|
const multiline = last2.loc.end.line < definition.loc.end.line;
|
|
303244
303302
|
if (multiline) {
|
|
303245
|
-
const
|
|
303246
|
-
const indent = source.slice(
|
|
303303
|
+
const lineStart = source.lastIndexOf("\n", last2.start - 1) + 1;
|
|
303304
|
+
const indent = source.slice(lineStart, last2.start).match(/^[\t ]*/)[0];
|
|
303247
303305
|
if (!trailingComma) {
|
|
303248
303306
|
edits.push({ start: last2.end, text: "," });
|
|
303249
303307
|
}
|
|
@@ -303387,7 +303445,7 @@ ${ASSETS_UPLOAD_USAGE}
|
|
|
303387
303445
|
assetId = lookup.body.asset.id;
|
|
303388
303446
|
}
|
|
303389
303447
|
const form = new FormData();
|
|
303390
|
-
form.append("file", new Blob([bytes]),
|
|
303448
|
+
form.append("file", new Blob([bytes]), basename2(file2));
|
|
303391
303449
|
const uploaded = await request(target, "POST", "/api/files/uploads", form, stderr);
|
|
303392
303450
|
if (uploaded === null) return 1;
|
|
303393
303451
|
const result = await request(
|
|
@@ -303524,7 +303582,7 @@ init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
|
303524
303582
|
// scripts/lib/runtime-build/record-bindings.mjs
|
|
303525
303583
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
303526
303584
|
import { readFileSync as readFileSync2 } from "node:fs";
|
|
303527
|
-
import { basename as
|
|
303585
|
+
import { basename as basename3, join as join4 } from "node:path";
|
|
303528
303586
|
|
|
303529
303587
|
// scripts/lib/runtime-build/definition-uid.mjs
|
|
303530
303588
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
@@ -303654,8 +303712,8 @@ function readUid(object, { version = null } = {}) {
|
|
|
303654
303712
|
}
|
|
303655
303713
|
function locationAt(source, offset) {
|
|
303656
303714
|
const before = source.slice(0, offset);
|
|
303657
|
-
const
|
|
303658
|
-
return { loc: { start: { line: before.split("\n").length, column: offset -
|
|
303715
|
+
const lineStart = before.lastIndexOf("\n") + 1;
|
|
303716
|
+
return { loc: { start: { line: before.split("\n").length, column: offset - lineStart } } };
|
|
303659
303717
|
}
|
|
303660
303718
|
function readFrontMatterUid(source, { map, offset }) {
|
|
303661
303719
|
const pair = map.items.find((item) => (0, import_yaml.isScalar)(item.key) && item.key.value === "uid") ?? null;
|
|
@@ -303738,9 +303796,9 @@ function uidInsertion(source, object, uid2) {
|
|
|
303738
303796
|
if (anchor.loc.start.line === object.loc.start.line) {
|
|
303739
303797
|
return { start: anchor.start, end: anchor.start, text: `${property}, ` };
|
|
303740
303798
|
}
|
|
303741
|
-
const
|
|
303742
|
-
const indent = source.slice(
|
|
303743
|
-
const newline = source[
|
|
303799
|
+
const lineStart = source.lastIndexOf("\n", anchor.start - 1) + 1;
|
|
303800
|
+
const indent = source.slice(lineStart, anchor.start);
|
|
303801
|
+
const newline = source[lineStart - 2] === "\r" ? "\r\n" : "\n";
|
|
303744
303802
|
return { start: anchor.start, end: anchor.start, text: `${property},${newline}${indent}` };
|
|
303745
303803
|
}
|
|
303746
303804
|
function frontMatterUidInsertion(source, { map, offset }, uid2) {
|
|
@@ -303888,7 +303946,7 @@ function readRecordBindings(root, paths, names2, resources, diagnostics, { write
|
|
|
303888
303946
|
throw new SourceError(`Unknown record binding option "${key2}"`, node);
|
|
303889
303947
|
}
|
|
303890
303948
|
}
|
|
303891
|
-
const key = studlyName(
|
|
303949
|
+
const key = studlyName(basename3(path, ".ts"));
|
|
303892
303950
|
if (!/^[A-Za-z][A-Za-z0-9_]*$/.test(key)) {
|
|
303893
303951
|
throw new SourceError(`Invalid RecordBindings name "${key}". Rename the file`, node);
|
|
303894
303952
|
}
|
|
@@ -304013,7 +304071,7 @@ function recordBindingUsages(root, paths, entries) {
|
|
|
304013
304071
|
|
|
304014
304072
|
// scripts/lib/runtime-build/build-workspace.mjs
|
|
304015
304073
|
import { existsSync as existsSync9, mkdirSync as mkdirSync3, readFileSync as readFileSync14, writeFileSync as writeFileSync5 } from "node:fs";
|
|
304016
|
-
import { basename as
|
|
304074
|
+
import { basename as basename13, dirname as dirname9, extname as extname2, join as join18 } from "node:path";
|
|
304017
304075
|
|
|
304018
304076
|
// scripts/lib/runtime-build/brand-kit.mjs
|
|
304019
304077
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
@@ -308309,8 +308367,27 @@ function composePackages(root) {
|
|
|
308309
308367
|
dependencies: [...packageDependencies].toSorted()
|
|
308310
308368
|
});
|
|
308311
308369
|
}
|
|
308370
|
+
diagnostics.push(...resourceOwnershipProblems(files));
|
|
308312
308371
|
return { packages, files, dependencies, diagnostics };
|
|
308313
308372
|
}
|
|
308373
|
+
function resourceOwnershipProblems(files) {
|
|
308374
|
+
const diagnostics = [];
|
|
308375
|
+
for (const [path, { name, source }] of files) {
|
|
308376
|
+
const child = resourceChildOf(path);
|
|
308377
|
+
if (child === null || child.kind === "resource_field" || files.get(child.definitionPath)?.name === name) {
|
|
308378
|
+
continue;
|
|
308379
|
+
}
|
|
308380
|
+
const kind = child.kind === "resource_policy" ? "policy" : "record";
|
|
308381
|
+
diagnostics.push(
|
|
308382
|
+
diagnosticAt(
|
|
308383
|
+
source,
|
|
308384
|
+
null,
|
|
308385
|
+
`The package "${name}" does not provide ${child.definitionPath}, so it cannot add a ${kind} to that resource. A package adds only fields to a resource of another tree`
|
|
308386
|
+
)
|
|
308387
|
+
);
|
|
308388
|
+
}
|
|
308389
|
+
return diagnostics;
|
|
308390
|
+
}
|
|
308314
308391
|
function materializePackages(root, plan) {
|
|
308315
308392
|
for (const [path, { source }] of plan.files) {
|
|
308316
308393
|
const target = join7(root, path);
|
|
@@ -308551,7 +308628,7 @@ function refuseUnknownOptions(value, options, node, owner) {
|
|
|
308551
308628
|
|
|
308552
308629
|
// scripts/lib/runtime-build/migrations.mjs
|
|
308553
308630
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
308554
|
-
import { basename as
|
|
308631
|
+
import { basename as basename11 } from "node:path";
|
|
308555
308632
|
|
|
308556
308633
|
// scripts/lib/runtime-build/migration-file.mjs
|
|
308557
308634
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
@@ -310816,7 +310893,7 @@ function fieldTypeList(fieldTypes) {
|
|
|
310816
310893
|
|
|
310817
310894
|
// scripts/lib/runtime-build/workflow-references.mjs
|
|
310818
310895
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
310819
|
-
import { basename as
|
|
310896
|
+
import { basename as basename4 } from "node:path";
|
|
310820
310897
|
|
|
310821
310898
|
// scripts/lib/workflow-script/constants.mjs
|
|
310822
310899
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
@@ -310851,7 +310928,7 @@ function workflowNames(paths, diagnostics) {
|
|
|
310851
310928
|
for (const path of paths.toSorted(byteOrder2)) {
|
|
310852
310929
|
const name = pathName(
|
|
310853
310930
|
path,
|
|
310854
|
-
|
|
310931
|
+
basename4(path, ".ts"),
|
|
310855
310932
|
{ exportName: WORKFLOWS_EXPORT, label: "workflow", showText: false, severity: "warning" },
|
|
310856
310933
|
diagnostics
|
|
310857
310934
|
);
|
|
@@ -310879,7 +310956,7 @@ function workflowEntries({ pathsByName }, metadataByPath) {
|
|
|
310879
310956
|
const entries = /* @__PURE__ */ Object.create(null);
|
|
310880
310957
|
for (const name of [...pathsByName.keys()].toSorted(byteOrder2)) {
|
|
310881
310958
|
const path = pathsByName.get(name);
|
|
310882
|
-
const { uid: uid2 = null, slug =
|
|
310959
|
+
const { uid: uid2 = null, slug = basename4(path, ".ts"), ...metadata } = metadataByPath.get(path) ?? {};
|
|
310883
310960
|
entries[name] = { uid: uid2, slug, ...metadata };
|
|
310884
310961
|
}
|
|
310885
310962
|
return entries;
|
|
@@ -311039,7 +311116,7 @@ function pageWorkflowReferenceDiagnostics(path, ast, entries, options = {}) {
|
|
|
311039
311116
|
const pathError = workflowPathError(
|
|
311040
311117
|
path,
|
|
311041
311118
|
value,
|
|
311042
|
-
(workflowPath) => namesBySlug.get(
|
|
311119
|
+
(workflowPath) => namesBySlug.get(basename4(workflowPath, ".ts")) ?? null,
|
|
311043
311120
|
options
|
|
311044
311121
|
);
|
|
311045
311122
|
if (pathError !== null) {
|
|
@@ -311791,7 +311868,7 @@ var import_typescript2 = __toESM(require_typescript(), 1);
|
|
|
311791
311868
|
import { spawnSync } from "node:child_process";
|
|
311792
311869
|
import { mkdirSync as mkdirSync2, mkdtempSync as mkdtempSync2, realpathSync as realpathSync2, rmSync as rmSync2, writeFileSync as writeFileSync4 } from "node:fs";
|
|
311793
311870
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
311794
|
-
import { basename as
|
|
311871
|
+
import { basename as basename9, dirname as dirname5, join as join13, relative as relative5 } from "node:path";
|
|
311795
311872
|
|
|
311796
311873
|
// scripts/lib/runtime-build/app-modules.mjs
|
|
311797
311874
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
@@ -311813,6 +311890,8 @@ __export(cli_exports, {
|
|
|
311813
311890
|
defineNotificationType: () => defineNotificationType,
|
|
311814
311891
|
definePage: () => definePage,
|
|
311815
311892
|
definePermission: () => definePermission,
|
|
311893
|
+
definePolicy: () => definePolicy,
|
|
311894
|
+
defineRecord: () => defineRecord,
|
|
311816
311895
|
defineRecordBinding: () => defineRecordBinding,
|
|
311817
311896
|
defineRedirects: () => defineRedirects,
|
|
311818
311897
|
defineResource: () => defineResource,
|
|
@@ -311916,6 +311995,8 @@ var defineWorkspaceField = (field2) => field2;
|
|
|
311916
311995
|
var definePermission = (permission) => permission;
|
|
311917
311996
|
var defineRole = (role) => role;
|
|
311918
311997
|
var defineResource = (resource) => resource;
|
|
311998
|
+
var definePolicy = (policy) => policy;
|
|
311999
|
+
var defineRecord = (record) => record;
|
|
311919
312000
|
var definePage = (page, _component) => page;
|
|
311920
312001
|
var text = {
|
|
311921
312002
|
template: (template, values) => ({ $type: "text.template", template, values })
|
|
@@ -311952,7 +312033,7 @@ function sha256(value) {
|
|
|
311952
312033
|
|
|
311953
312034
|
// scripts/lib/runtime-build/permission-references.mjs
|
|
311954
312035
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
311955
|
-
import { basename as
|
|
312036
|
+
import { basename as basename5, extname } from "node:path";
|
|
311956
312037
|
var PERMISSIONS_DIRECTORY = "permissions";
|
|
311957
312038
|
var LEGACY_PERMISSIONS_PATH = "permissions.ts";
|
|
311958
312039
|
var GENERATED_PERMISSIONS_PATH = "generated/permissions.ts";
|
|
@@ -311974,7 +312055,7 @@ function isDefinitionSlug(slug) {
|
|
|
311974
312055
|
return SLUG_PATTERN2.test(slug) && slug.length <= MAX_LENGTH;
|
|
311975
312056
|
}
|
|
311976
312057
|
function definitionFileSlug(path, definition, { noun, exportName }) {
|
|
311977
|
-
const fileName =
|
|
312058
|
+
const fileName = basename5(path, extname(path));
|
|
311978
312059
|
const declared = declaredSlug(definition);
|
|
311979
312060
|
if (declared.problem !== null) {
|
|
311980
312061
|
throw new SourceError(declared.problem, declared.node);
|
|
@@ -312384,7 +312465,7 @@ function roleValues(entries) {
|
|
|
312384
312465
|
|
|
312385
312466
|
// scripts/lib/runtime-build/skill-references.mjs
|
|
312386
312467
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
312387
|
-
import { basename as
|
|
312468
|
+
import { basename as basename6 } from "node:path";
|
|
312388
312469
|
var GENERATED_SKILLS_PATH = "generated/skills.ts";
|
|
312389
312470
|
var SKILLS_EXPORT = "Skills";
|
|
312390
312471
|
function skillNames(paths, diagnostics) {
|
|
@@ -312392,7 +312473,7 @@ function skillNames(paths, diagnostics) {
|
|
|
312392
312473
|
for (const path of paths.toSorted(byteOrder2)) {
|
|
312393
312474
|
const name = pathName(
|
|
312394
312475
|
path,
|
|
312395
|
-
|
|
312476
|
+
basename6(path, ".md"),
|
|
312396
312477
|
{ exportName: SKILLS_EXPORT, label: "skill", showText: false, severity: "warning" },
|
|
312397
312478
|
diagnostics
|
|
312398
312479
|
);
|
|
@@ -312632,12 +312713,12 @@ function objectExpressions(node) {
|
|
|
312632
312713
|
|
|
312633
312714
|
// scripts/lib/runtime-build/workspace-field-references.mjs
|
|
312634
312715
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
312635
|
-
import { basename as
|
|
312716
|
+
import { basename as basename8 } from "node:path";
|
|
312636
312717
|
|
|
312637
312718
|
// scripts/lib/runtime-build/workspace-fields.mjs
|
|
312638
312719
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
312639
312720
|
import { readFileSync as readFileSync5 } from "node:fs";
|
|
312640
|
-
import { basename as
|
|
312721
|
+
import { basename as basename7, join as join8 } from "node:path";
|
|
312641
312722
|
|
|
312642
312723
|
// packages/cli/workspace-settings-catalog.json
|
|
312643
312724
|
var workspace_settings_catalog_default = {
|
|
@@ -312882,7 +312963,7 @@ var RESERVED_KEYS = /* @__PURE__ */ new Set([
|
|
|
312882
312963
|
...Object.keys(workspace_settings_catalog_default.refused),
|
|
312883
312964
|
...FIELD_CATALOG.record_meta_fields
|
|
312884
312965
|
]);
|
|
312885
|
-
var ENTRY_KEYS = /* @__PURE__ */ new Set(["uid", "key", "definition", "value"]);
|
|
312966
|
+
var ENTRY_KEYS = /* @__PURE__ */ new Set(["uid", "key", "section", "definition", "value"]);
|
|
312886
312967
|
var RESOURCE_ONLY_OPTIONS = ["uid", "unique", "index", "computed", "getter", "setter", "setterWhenEmpty"];
|
|
312887
312968
|
var EMAIL_PATTERN = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
312888
312969
|
var DATE_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
|
|
@@ -312899,7 +312980,7 @@ function readWorkspaceFields(root, paths, diagnostics, { write = false, recordBi
|
|
|
312899
312980
|
const ast = parseSource(source, { jsx: false });
|
|
312900
312981
|
const argument = defineWorkspaceFieldArgument(ast);
|
|
312901
312982
|
const declared = declaredSlug(argument, "key");
|
|
312902
|
-
keysByPath.set(path, declared.slug ??
|
|
312983
|
+
keysByPath.set(path, declared.slug ?? basename7(path, ".ts"));
|
|
312903
312984
|
const field2 = readWorkspaceField(path, argument, declared, diagnostics, recordBindingsBinding(ast, recordBindingEntries));
|
|
312904
312985
|
read2.push({ field: field2, uidDefinition: { type: "workspace field", path, source, node: argument } });
|
|
312905
312986
|
} catch (error) {
|
|
@@ -312921,7 +313002,7 @@ function isWorkspaceFieldFileName(name) {
|
|
|
312921
313002
|
return FIELD_KEY_PATTERN.test(name);
|
|
312922
313003
|
}
|
|
312923
313004
|
function workspaceFieldKeyProblem(path, key, declared) {
|
|
312924
|
-
const fileName =
|
|
313005
|
+
const fileName = basename7(path, ".ts");
|
|
312925
313006
|
if (!isWorkspaceFieldFileName(fileName)) {
|
|
312926
313007
|
const suggestion = fileName.toLowerCase().replaceAll("-", "_");
|
|
312927
313008
|
const hint = isWorkspaceFieldFileName(suggestion) ? `. Rename the file to ${suggestion}.ts` : "";
|
|
@@ -312940,7 +313021,7 @@ function readWorkspaceField(path, argument, declared, diagnostics, generatedEntr
|
|
|
312940
313021
|
if (declared.problem !== null) {
|
|
312941
313022
|
throw new SourceError(declared.problem, declared.node);
|
|
312942
313023
|
}
|
|
312943
|
-
const key = declared.slug ??
|
|
313024
|
+
const key = declared.slug ?? basename7(path, ".ts");
|
|
312944
313025
|
const keyProblem = workspaceFieldKeyProblem(path, key, declared.slug !== null);
|
|
312945
313026
|
if (keyProblem !== null) {
|
|
312946
313027
|
throw new SourceError(keyProblem, declared.node);
|
|
@@ -312951,9 +313032,12 @@ function readWorkspaceField(path, argument, declared, diagnostics, generatedEntr
|
|
|
312951
313032
|
throw new SourceError('Remove "slug". A workspace field sets its key with "key"', nodes.slug);
|
|
312952
313033
|
}
|
|
312953
313034
|
if (!ENTRY_KEYS.has(option)) {
|
|
312954
|
-
throw new SourceError(`Unknown option "${option}". Use "uid", "key", "definition", and "value"`, nodes[option]);
|
|
313035
|
+
throw new SourceError(`Unknown option "${option}". Use "uid", "key", "section", "definition", and "value"`, nodes[option]);
|
|
312955
313036
|
}
|
|
312956
313037
|
}
|
|
313038
|
+
if (entry.section !== void 0 && (typeof entry.section !== "string" || entry.section.length > 255)) {
|
|
313039
|
+
throw new SourceError('"section" must be a string with at most 255 characters', nodes.section);
|
|
313040
|
+
}
|
|
312957
313041
|
const builder = entry.definition;
|
|
312958
313042
|
const { field: field2, metadata } = readWorkspaceFieldDefinition(key, builder, nodes.definition ?? argument);
|
|
312959
313043
|
if (!Object.hasOwn(entry, "value")) {
|
|
@@ -312977,6 +313061,7 @@ function readWorkspaceField(path, argument, declared, diagnostics, generatedEntr
|
|
|
312977
313061
|
path,
|
|
312978
313062
|
key,
|
|
312979
313063
|
...metadata,
|
|
313064
|
+
section: entry.section ?? null,
|
|
312980
313065
|
value: entry.value,
|
|
312981
313066
|
nodes: { definition: builder.node, value: nodes.value }
|
|
312982
313067
|
};
|
|
@@ -313086,7 +313171,7 @@ function workspaceFieldNames(paths, keysByPath, diagnostics) {
|
|
|
313086
313171
|
const pathsByName = /* @__PURE__ */ new Map();
|
|
313087
313172
|
const pathsByKey = /* @__PURE__ */ new Map();
|
|
313088
313173
|
for (const path of paths.toSorted(byteOrder2)) {
|
|
313089
|
-
const fileName =
|
|
313174
|
+
const fileName = basename8(path, ".ts");
|
|
313090
313175
|
if (!isWorkspaceFieldFileName(fileName)) {
|
|
313091
313176
|
continue;
|
|
313092
313177
|
}
|
|
@@ -314183,7 +314268,7 @@ function importDiagnostics(test, scriptNames, workspaceRoot, subject) {
|
|
|
314183
314268
|
}
|
|
314184
314269
|
function compiledScriptModule(script) {
|
|
314185
314270
|
const prefix2 = sandboxPrefix(script.path);
|
|
314186
|
-
const source = JSON.stringify(`./${
|
|
314271
|
+
const source = JSON.stringify(`./${basename9(script.path, ".ts")}.mjs`);
|
|
314187
314272
|
return [
|
|
314188
314273
|
`import * as script from ${source};`,
|
|
314189
314274
|
`import { registerCompiledScript } from ${JSON.stringify(`${prefix2}sdk/quickjs-testing.js`)};`,
|
|
@@ -314407,7 +314492,7 @@ function runScriptTests({
|
|
|
314407
314492
|
|
|
314408
314493
|
// scripts/lib/runtime-build/workflows.mjs
|
|
314409
314494
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
314410
|
-
import { basename as
|
|
314495
|
+
import { basename as basename10 } from "node:path";
|
|
314411
314496
|
|
|
314412
314497
|
// scripts/lib/workflow-script/compile.mjs
|
|
314413
314498
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
@@ -314826,7 +314911,7 @@ function buildWorkflows({
|
|
|
314826
314911
|
entry: {
|
|
314827
314912
|
path,
|
|
314828
314913
|
uid: uidsByPath.get(path) ?? null,
|
|
314829
|
-
slug: config?.slug ??
|
|
314914
|
+
slug: config?.slug ?? basename10(path, ".ts"),
|
|
314830
314915
|
title: config?.title ?? null,
|
|
314831
314916
|
description: config?.description ?? null,
|
|
314832
314917
|
type: config?.type ?? null,
|
|
@@ -314879,7 +314964,7 @@ function buildMigrations({ migrations, ...input }) {
|
|
|
314879
314964
|
const diagnostics = [];
|
|
314880
314965
|
const timestamps = /* @__PURE__ */ new Map();
|
|
314881
314966
|
for (const { path, ast } of migrations) {
|
|
314882
|
-
const id =
|
|
314967
|
+
const id = basename11(path, ".ts");
|
|
314883
314968
|
const timestamp = migrationTimestamp(id);
|
|
314884
314969
|
const slug = declaredSlug(workflowConfigObject(ast));
|
|
314885
314970
|
if (slug.node !== null) {
|
|
@@ -314944,7 +315029,7 @@ function buildMigrations({ migrations, ...input }) {
|
|
|
314944
315029
|
}
|
|
314945
315030
|
}
|
|
314946
315031
|
return {
|
|
314947
|
-
migrations: built.workflows.map((workflow) => ({ ...workflow, id:
|
|
315032
|
+
migrations: built.workflows.map((workflow) => ({ ...workflow, id: basename11(workflow.path, ".ts") })).toSorted((left, right) => left.id.localeCompare(right.id)),
|
|
314948
315033
|
migrationTests: built.workflowTests,
|
|
314949
315034
|
diagnostics
|
|
314950
315035
|
};
|
|
@@ -316897,7 +316982,7 @@ var SUCRASE_OPTIONS = {
|
|
|
316897
316982
|
function authoringColumns(code2) {
|
|
316898
316983
|
const { tokens } = (0, import_parser4.parse)(code2, true, true, false);
|
|
316899
316984
|
const columns = [];
|
|
316900
|
-
let
|
|
316985
|
+
let lineStart = 0;
|
|
316901
316986
|
let scanned = 0;
|
|
316902
316987
|
for (let index3 = 0; index3 < tokens.length; index3 += 1) {
|
|
316903
316988
|
if (tokens[index3].type !== import_types.TokenType.jsxTagStart) {
|
|
@@ -316910,11 +316995,11 @@ function authoringColumns(code2) {
|
|
|
316910
316995
|
const { start } = tokens[index3];
|
|
316911
316996
|
while (scanned < start) {
|
|
316912
316997
|
if (code2.charCodeAt(scanned) === 10) {
|
|
316913
|
-
|
|
316998
|
+
lineStart = scanned + 1;
|
|
316914
316999
|
}
|
|
316915
317000
|
scanned += 1;
|
|
316916
317001
|
}
|
|
316917
|
-
columns.push(start -
|
|
317002
|
+
columns.push(start - lineStart);
|
|
316918
317003
|
}
|
|
316919
317004
|
return columns;
|
|
316920
317005
|
}
|
|
@@ -316922,7 +317007,7 @@ function addAuthoringColumns(transformed, columns, trackInsertions) {
|
|
|
316922
317007
|
let sourceIndex = 0;
|
|
316923
317008
|
let scannedOffset = 0;
|
|
316924
317009
|
let line = 0;
|
|
316925
|
-
let
|
|
317010
|
+
let lineStart = 0;
|
|
316926
317011
|
const insertions = [];
|
|
316927
317012
|
const code2 = transformed.replace(
|
|
316928
317013
|
/(__source:\s*\{fileName:\s*_jsxFileName,\s*lineNumber:\s*\d+)(\})/g,
|
|
@@ -316933,11 +317018,11 @@ function addAuthoringColumns(transformed, columns, trackInsertions) {
|
|
|
316933
317018
|
while (scannedOffset < insertionOffset) {
|
|
316934
317019
|
if (transformed.charCodeAt(scannedOffset) === 10) {
|
|
316935
317020
|
line += 1;
|
|
316936
|
-
|
|
317021
|
+
lineStart = scannedOffset + 1;
|
|
316937
317022
|
}
|
|
316938
317023
|
scannedOffset += 1;
|
|
316939
317024
|
}
|
|
316940
|
-
insertions.push({ line, column: insertionOffset -
|
|
317025
|
+
insertions.push({ line, column: insertionOffset - lineStart, length: insertion.length });
|
|
316941
317026
|
}
|
|
316942
317027
|
return `${source}${insertion}${closingBrace}`;
|
|
316943
317028
|
}
|
|
@@ -320331,8 +320416,8 @@ function propertyValue2(objectNode, property) {
|
|
|
320331
320416
|
}
|
|
320332
320417
|
}
|
|
320333
320418
|
function lineIndent(source, offset) {
|
|
320334
|
-
const
|
|
320335
|
-
return /^[ \t]*/.exec(source.slice(
|
|
320419
|
+
const lineStart = source.lastIndexOf("\n", offset - 1) + 1;
|
|
320420
|
+
return /^[ \t]*/.exec(source.slice(lineStart))[0];
|
|
320336
320421
|
}
|
|
320337
320422
|
function removalEnd(property, next) {
|
|
320338
320423
|
const comments = (next.leadingComments ?? []).filter(
|
|
@@ -320602,15 +320687,18 @@ var RESOURCE_KEYS = /* @__PURE__ */ new Set([
|
|
|
320602
320687
|
"displayField",
|
|
320603
320688
|
"searchableFields",
|
|
320604
320689
|
"fieldOrder",
|
|
320605
|
-
"fields",
|
|
320606
320690
|
"indexes",
|
|
320607
320691
|
"embeddings",
|
|
320608
320692
|
"dataApi",
|
|
320609
320693
|
"static",
|
|
320610
|
-
"records",
|
|
320611
|
-
"policies",
|
|
320612
320694
|
"capabilities"
|
|
320613
320695
|
]);
|
|
320696
|
+
var CHILD_OPTIONS = {
|
|
320697
|
+
fields: "Move each field to fields/<key>.ts in the folder of the resource, as export default field.<type>({...})",
|
|
320698
|
+
policies: "Move each policy to policies/<key>.ts in the folder of the resource, as export default definePolicy({...})",
|
|
320699
|
+
records: "Move each record to records/<key>.ts in the folder of the resource, as export default defineRecord({...})"
|
|
320700
|
+
};
|
|
320701
|
+
var RESOURCE_FILE_IMPORTS = [GENERATED_RESOURCES_MODULE, GENERATED_PAGES_MODULE, GENERATED_RECORD_BINDINGS_MODULE];
|
|
320614
320702
|
var INDEX_KEYS = /* @__PURE__ */ new Set(["fields", "unique"]);
|
|
320615
320703
|
var EMBEDDINGS_KEYS = /* @__PURE__ */ new Set(["enabled", "fields"]);
|
|
320616
320704
|
var DEFAULT_SEARCHABLE_TYPES = /* @__PURE__ */ new Set(["text", "markdown"]);
|
|
@@ -320669,12 +320757,17 @@ function buildIndexes(indexes, node, fieldsByKey) {
|
|
|
320669
320757
|
return { fields: index3.fields, unique: index3.unique ?? false };
|
|
320670
320758
|
});
|
|
320671
320759
|
}
|
|
320672
|
-
function orderFields(
|
|
320760
|
+
function orderFields(declared, fieldOrder, node) {
|
|
320761
|
+
if (fieldOrder !== void 0) {
|
|
320762
|
+
stringList(fieldOrder, "fieldOrder", node);
|
|
320763
|
+
}
|
|
320764
|
+
const unlisted = declared.filter(({ field: field2 }) => fieldOrder === void 0 || !fieldOrder.includes(field2.key)).toSorted(
|
|
320765
|
+
(left, right) => Number(left.uid === null) - Number(right.uid === null) || byteOrder3(left.uid ?? "", right.uid ?? "") || byteOrder3(left.field.key, right.field.key)
|
|
320766
|
+
).map(({ field: field2 }) => field2);
|
|
320673
320767
|
if (fieldOrder === void 0) {
|
|
320674
|
-
return
|
|
320768
|
+
return unlisted;
|
|
320675
320769
|
}
|
|
320676
|
-
|
|
320677
|
-
const fieldsByKey = new Map(fields.map((field2) => [field2.key, field2]));
|
|
320770
|
+
const fieldsByKey = new Map(declared.map(({ field: field2 }) => [field2.key, field2]));
|
|
320678
320771
|
fieldOrder.forEach((key, position) => {
|
|
320679
320772
|
if (!fieldsByKey.has(key)) {
|
|
320680
320773
|
throw new SourceError(
|
|
@@ -320683,11 +320776,10 @@ function orderFields(fields, fieldOrder, node) {
|
|
|
320683
320776
|
);
|
|
320684
320777
|
}
|
|
320685
320778
|
});
|
|
320686
|
-
|
|
320687
|
-
|
|
320688
|
-
|
|
320689
|
-
|
|
320690
|
-
return fieldOrder.map((key) => fieldsByKey.get(key));
|
|
320779
|
+
return [...fieldOrder.map((key) => fieldsByKey.get(key)), ...unlisted];
|
|
320780
|
+
}
|
|
320781
|
+
function byteOrder3(left, right) {
|
|
320782
|
+
return left < right ? -1 : left > right ? 1 : 0;
|
|
320691
320783
|
}
|
|
320692
320784
|
function defaultSearchableFields(fields, displayField) {
|
|
320693
320785
|
const keys2 = /* @__PURE__ */ new Set();
|
|
@@ -320889,31 +320981,25 @@ function staticRelationValue(key, field2, value, valueNode) {
|
|
|
320889
320981
|
function isEmptyValue(value) {
|
|
320890
320982
|
return value === void 0 || value === null || value === "" || Array.isArray(value) && value.length === 0;
|
|
320891
320983
|
}
|
|
320892
|
-
function buildStaticRecords(value, nodes,
|
|
320984
|
+
function buildStaticRecords(value, nodes, fields) {
|
|
320893
320985
|
if (value.static !== true) {
|
|
320894
|
-
if (value.records
|
|
320895
|
-
throw new SourceError(
|
|
320986
|
+
if (Object.keys(value.records).length > 0) {
|
|
320987
|
+
throw new SourceError(
|
|
320988
|
+
'A record file needs "static: true" in resource.ts. Only a static resource declares its records',
|
|
320989
|
+
nodes.records.value.properties[0]
|
|
320990
|
+
);
|
|
320896
320991
|
}
|
|
320897
320992
|
return null;
|
|
320898
320993
|
}
|
|
320899
|
-
if (value.records === void 0) {
|
|
320900
|
-
throw new SourceError(
|
|
320901
|
-
'A static resource declares all of its records in "records". Use "records: {}" for a resource with no records',
|
|
320902
|
-
nodes.static ?? definitionNode
|
|
320903
|
-
);
|
|
320904
|
-
}
|
|
320905
320994
|
if (value.capabilities !== void 0 && Object.keys(value.capabilities ?? {}).length > 0) {
|
|
320906
320995
|
throw new SourceError("A static resource cannot have capabilities, because they write to its records", nodes.capabilities);
|
|
320907
320996
|
}
|
|
320908
320997
|
for (const field2 of fields) {
|
|
320909
320998
|
if (field2.key === "uid") {
|
|
320910
|
-
throw new SourceError('A static resource cannot have a field with the key "uid". Each record uses "uid" for its id', nodes.
|
|
320999
|
+
throw new SourceError('A static resource cannot have a field with the key "uid". Each record uses "uid" for its id', nodes.fieldNodes.get(field2.key));
|
|
320911
321000
|
}
|
|
320912
321001
|
}
|
|
320913
321002
|
const recordsNode = nodes.records.value;
|
|
320914
|
-
if (recordsNode.type !== "ObjectExpression" || !isPlainObject2(value.records)) {
|
|
320915
|
-
throw new SourceError('"records" must be an object literal of records, keyed by record key', nodes.records);
|
|
320916
|
-
}
|
|
320917
321003
|
const fieldsByKey = new Map(fields.map((field2) => [field2.key, field2]));
|
|
320918
321004
|
const entryNodes = new Map(recordsNode.properties.map((property) => [propertyKey2(property), property]));
|
|
320919
321005
|
return Object.entries(value.records).map(([key, entry]) => {
|
|
@@ -320959,9 +321045,39 @@ function buildStaticRecords(value, nodes, definitionNode, fields) {
|
|
|
320959
321045
|
});
|
|
320960
321046
|
}
|
|
320961
321047
|
function defineResourceArgument(ast) {
|
|
320962
|
-
const { declaration } = defaultExportOf(ast, { extraImports:
|
|
321048
|
+
const { declaration } = defaultExportOf(ast, { extraImports: RESOURCE_FILE_IMPORTS });
|
|
320963
321049
|
return expectDefineCall(declaration, "defineResource", 1)[0];
|
|
320964
321050
|
}
|
|
321051
|
+
function folderTypeArgumentProblem(ast, folder) {
|
|
321052
|
+
const { declaration } = defaultExportOf(ast, { extraImports: RESOURCE_FILE_IMPORTS });
|
|
321053
|
+
const typeArguments = declaration?.typeArguments ?? declaration?.typeParameters;
|
|
321054
|
+
if (typeArguments === void 0 || typeArguments === null) {
|
|
321055
|
+
return null;
|
|
321056
|
+
}
|
|
321057
|
+
const [argument] = typeArguments.params;
|
|
321058
|
+
const named = argument?.type === "TSLiteralType" && argument.literal.type === "StringLiteral" ? argument.literal.value : null;
|
|
321059
|
+
if (typeArguments.params.length === 1 && named === folder) {
|
|
321060
|
+
return null;
|
|
321061
|
+
}
|
|
321062
|
+
const define2 = declaration.callee?.name ?? "define";
|
|
321063
|
+
return {
|
|
321064
|
+
node: typeArguments,
|
|
321065
|
+
message: `The type argument names another folder, so the editor types this file with the fields of that resource. Use ${define2}<'${folder}'>(...)`
|
|
321066
|
+
};
|
|
321067
|
+
}
|
|
321068
|
+
function resourceChildArgument(kind, ast) {
|
|
321069
|
+
const { declaration } = defaultExportOf(ast, { extraImports: RESOURCE_FILE_IMPORTS });
|
|
321070
|
+
switch (kind) {
|
|
321071
|
+
case "resource_field":
|
|
321072
|
+
return declaration;
|
|
321073
|
+
case "resource_policy":
|
|
321074
|
+
return expectDefineCall(declaration, "definePolicy", 1)[0];
|
|
321075
|
+
case "resource_record":
|
|
321076
|
+
return expectDefineCall(declaration, "defineRecord", 1)[0];
|
|
321077
|
+
default:
|
|
321078
|
+
throw new Error(`Unknown resource file kind "${kind}"`);
|
|
321079
|
+
}
|
|
321080
|
+
}
|
|
320965
321081
|
function resourceSlugOption(ast) {
|
|
320966
321082
|
try {
|
|
320967
321083
|
return declaredSlug(defineResourceArgument(ast));
|
|
@@ -320972,8 +321088,8 @@ function resourceSlugOption(ast) {
|
|
|
320972
321088
|
throw error;
|
|
320973
321089
|
}
|
|
320974
321090
|
}
|
|
320975
|
-
function buildResource(path, definitionNode, { slug, resources, pages = null, generatedEntries = [] }) {
|
|
320976
|
-
const { value, nodes } = staticObject(definitionNode, { fieldBuilders:
|
|
321091
|
+
function buildResource(path, definitionNode, { slug, resources, pages = null, generatedEntries = [], children = [] }) {
|
|
321092
|
+
const { value, nodes } = staticObject(definitionNode, { fieldBuilders: false, resources, pages, generatedEntries });
|
|
320977
321093
|
if (Object.hasOwn(value, "platform")) {
|
|
320978
321094
|
throw new SourceError(
|
|
320979
321095
|
"Platform resource files are no longer supported. Declare the resource with its fields, or delete the file.",
|
|
@@ -320984,25 +321100,25 @@ function buildResource(path, definitionNode, { slug, resources, pages = null, ge
|
|
|
320984
321100
|
if (key === "id") {
|
|
320985
321101
|
throw new SourceError('Remove "id". The platform gives each resource its id', nodes.id);
|
|
320986
321102
|
}
|
|
321103
|
+
if (Object.hasOwn(CHILD_OPTIONS, key)) {
|
|
321104
|
+
throw new SourceError(`Remove "${key}" from resource.ts. ${CHILD_OPTIONS[key]}`, nodes[key]);
|
|
321105
|
+
}
|
|
320987
321106
|
if (!RESOURCE_KEYS.has(key)) {
|
|
320988
321107
|
throw new SourceError(`Unknown resource option "${key}"`, nodes[key]);
|
|
320989
321108
|
}
|
|
320990
321109
|
}
|
|
320991
321110
|
const name = requireString(value, "name", nodes.name ?? definitionNode);
|
|
320992
321111
|
const singularName = requireString(value, "singularName", nodes.singularName ?? definitionNode);
|
|
320993
|
-
|
|
320994
|
-
|
|
320995
|
-
|
|
320996
|
-
|
|
320997
|
-
);
|
|
320998
|
-
|
|
320999
|
-
|
|
321000
|
-
|
|
321001
|
-
|
|
321002
|
-
);
|
|
321003
|
-
const declaredFields = Object.entries(value.fields).map(
|
|
321004
|
-
([key, builder]) => buildField(key, builder, fieldKeyNodes.get(key) ?? fieldsNode)
|
|
321005
|
-
);
|
|
321112
|
+
const ordered = children.toSorted((left, right) => byteOrder3(left.path, right.path));
|
|
321113
|
+
const fieldNodes = /* @__PURE__ */ new Map();
|
|
321114
|
+
const declaredFields = ordered.filter((child) => child.kind === "resource_field").map((child) => {
|
|
321115
|
+
const builder = staticValue(child.node, { ...child.bindings, fieldBuilders: true });
|
|
321116
|
+
fieldNodes.set(child.key, child.node);
|
|
321117
|
+
return {
|
|
321118
|
+
field: { ...buildField(child.key, builder, child.node), path: child.path },
|
|
321119
|
+
uid: typeof builder?.options?.uid === "string" ? builder.options.uid : null
|
|
321120
|
+
};
|
|
321121
|
+
});
|
|
321006
321122
|
const fields = orderFields(declaredFields, value.fieldOrder, nodes.fieldOrder);
|
|
321007
321123
|
const fieldsByKey = new Map(fields.map((field2) => [field2.key, field2]));
|
|
321008
321124
|
const displayField = requireString(value, "displayField", nodes.displayField, { optional: true });
|
|
@@ -321017,7 +321133,37 @@ function buildResource(path, definitionNode, { slug, resources, pages = null, ge
|
|
|
321017
321133
|
}
|
|
321018
321134
|
const searchableFields = value.searchableFields === void 0 ? defaultSearchableFields(fields, displayField) : stringList(value.searchableFields, "searchableFields", nodes.searchableFields);
|
|
321019
321135
|
const embeddings = buildEmbeddings(value.embeddings, nodes.embeddings);
|
|
321020
|
-
const
|
|
321136
|
+
const recordFiles = ordered.filter((child) => child.kind === "resource_record");
|
|
321137
|
+
const records = buildStaticRecords(
|
|
321138
|
+
{
|
|
321139
|
+
static: value.static,
|
|
321140
|
+
capabilities: value.capabilities,
|
|
321141
|
+
records: Object.fromEntries(
|
|
321142
|
+
recordFiles.map((child) => [child.key, staticValue(child.node, { ...child.bindings, fieldBuilders: false })])
|
|
321143
|
+
)
|
|
321144
|
+
},
|
|
321145
|
+
{
|
|
321146
|
+
...nodes,
|
|
321147
|
+
fieldNodes,
|
|
321148
|
+
records: {
|
|
321149
|
+
value: {
|
|
321150
|
+
type: "ObjectExpression",
|
|
321151
|
+
properties: recordFiles.map((child) => ({
|
|
321152
|
+
type: "ObjectProperty",
|
|
321153
|
+
key: { type: "Identifier", name: child.key, loc: child.node.loc },
|
|
321154
|
+
value: child.node,
|
|
321155
|
+
loc: child.node.loc
|
|
321156
|
+
}))
|
|
321157
|
+
}
|
|
321158
|
+
}
|
|
321159
|
+
},
|
|
321160
|
+
fields
|
|
321161
|
+
);
|
|
321162
|
+
const policyFiles = ordered.filter((child) => child.kind === "resource_policy");
|
|
321163
|
+
const policies = buildPolicies(
|
|
321164
|
+
policyFiles.map((child) => staticValue(child.node, { ...child.bindings, fieldBuilders: false })),
|
|
321165
|
+
{ type: "ArrayExpression", elements: policyFiles.map((child) => child.node) }
|
|
321166
|
+
).map((policy, position) => ({ ...policy, key: policyFiles[position].key, path: policyFiles[position].path }));
|
|
321021
321167
|
return {
|
|
321022
321168
|
path,
|
|
321023
321169
|
slug,
|
|
@@ -321031,7 +321177,7 @@ function buildResource(path, definitionNode, { slug, resources, pages = null, ge
|
|
|
321031
321177
|
data_api: buildDataApi(value.dataApi, nodes.dataApi),
|
|
321032
321178
|
static: value.static ?? false,
|
|
321033
321179
|
records,
|
|
321034
|
-
policies
|
|
321180
|
+
policies,
|
|
321035
321181
|
capabilities: readCapabilities(value.capabilities, nodes.capabilities),
|
|
321036
321182
|
pathNodes: {
|
|
321037
321183
|
searchableFields: value.searchableFields === void 0 ? null : nodes.searchableFields,
|
|
@@ -321054,8 +321200,8 @@ function addInverseFields(resources, diagnostics) {
|
|
|
321054
321200
|
}
|
|
321055
321201
|
const existing = target.fields.find((item) => item.key === inverse.key);
|
|
321056
321202
|
if (existing !== void 0) {
|
|
321057
|
-
const owner = existing.inverse_of === void 0 ?
|
|
321058
|
-
const ownerPath = existing.
|
|
321203
|
+
const owner = existing.inverse_of === void 0 ? existing.path : "another relation";
|
|
321204
|
+
const ownerPath = existing.path;
|
|
321059
321205
|
diagnostics.push(
|
|
321060
321206
|
diagnosticAt(
|
|
321061
321207
|
resource.path,
|
|
@@ -321100,7 +321246,8 @@ function addInverseFields(resources, diagnostics) {
|
|
|
321100
321246
|
computed: null,
|
|
321101
321247
|
guard: [],
|
|
321102
321248
|
settings,
|
|
321103
|
-
inverse_of: { resource: resource.slug, key: field2.key }
|
|
321249
|
+
inverse_of: { resource: resource.slug, key: field2.key },
|
|
321250
|
+
path: field2.path
|
|
321104
321251
|
});
|
|
321105
321252
|
}
|
|
321106
321253
|
}
|
|
@@ -321170,9 +321317,9 @@ function withoutBuildNodes(resource) {
|
|
|
321170
321317
|
const { pathNodes: _pathNodes, ...rest } = resource;
|
|
321171
321318
|
return {
|
|
321172
321319
|
...rest,
|
|
321173
|
-
fields: rest.fields.map(({ relationNode: _relationNode, ...field2 }) => field2),
|
|
321320
|
+
fields: rest.fields.map(({ relationNode: _relationNode, path: _path, ...field2 }) => field2),
|
|
321174
321321
|
records: rest.records?.map(({ uidLiteral: _uidLiteral, valueNodes: _valueNodes, ...record }) => record) ?? rest.records,
|
|
321175
|
-
policies: rest.policies.map(({ resourceNode: _resourceNode, ...policy }) => policy)
|
|
321322
|
+
policies: rest.policies.map(({ resourceNode: _resourceNode, path: _path, ...policy }) => policy)
|
|
321176
321323
|
};
|
|
321177
321324
|
}
|
|
321178
321325
|
|
|
@@ -321384,7 +321531,7 @@ function checkSkillFiles(files, { root = null, write = false } = {}) {
|
|
|
321384
321531
|
|
|
321385
321532
|
// scripts/lib/runtime-build/test-suites.mjs
|
|
321386
321533
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
321387
|
-
import { basename as
|
|
321534
|
+
import { basename as basename12, dirname as dirname8 } from "node:path";
|
|
321388
321535
|
|
|
321389
321536
|
// scripts/lib/test-code/embedded-files.mjs
|
|
321390
321537
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
@@ -321624,7 +321771,7 @@ function readSuite(file2, report) {
|
|
|
321624
321771
|
}
|
|
321625
321772
|
const read2 = readConfig(
|
|
321626
321773
|
node,
|
|
321627
|
-
{ allowed: SUITE_PROPERTIES, noun: "test suite", fallbackName:
|
|
321774
|
+
{ allowed: SUITE_PROPERTIES, noun: "test suite", fallbackName: basename12(dirname8(file2.path)) },
|
|
321628
321775
|
report
|
|
321629
321776
|
);
|
|
321630
321777
|
if (read2 === null) {
|
|
@@ -322256,7 +322403,7 @@ function isTypeOnlySpecifier(statement2, specifier) {
|
|
|
322256
322403
|
function importedName(specifier) {
|
|
322257
322404
|
return specifier.imported.type === "StringLiteral" ? specifier.imported.value : specifier.imported.name;
|
|
322258
322405
|
}
|
|
322259
|
-
function foreignBindingText(statement2, { lint: lint2, resolve:
|
|
322406
|
+
function foreignBindingText(statement2, { lint: lint2, resolve: resolve7 }) {
|
|
322260
322407
|
const specifier = statement2.source.value;
|
|
322261
322408
|
const kind = importKind(specifier);
|
|
322262
322409
|
const statements2 = [];
|
|
@@ -322302,7 +322449,7 @@ function foreignBindingText(statement2, { lint: lint2, resolve: resolve8 }) {
|
|
|
322302
322449
|
);
|
|
322303
322450
|
continue;
|
|
322304
322451
|
}
|
|
322305
|
-
const value = kind === "package" ? packageExpression(specifier) : kind === "style_module" ? styleModuleExpression(
|
|
322452
|
+
const value = kind === "package" ? packageExpression(specifier) : kind === "style_module" ? styleModuleExpression(resolve7(specifier)) : null;
|
|
322306
322453
|
if (value === null) {
|
|
322307
322454
|
statements2.push(`const ${local} = undefined;`);
|
|
322308
322455
|
} else if (item.type === "ImportSpecifier") {
|
|
@@ -322334,12 +322481,12 @@ function foreignTypeAliases(statement2) {
|
|
|
322334
322481
|
return `type ${local} = ${SDK_TYPE_DECLARATIONS[local] ?? "any"};`;
|
|
322335
322482
|
});
|
|
322336
322483
|
}
|
|
322337
|
-
function foreignBindings(source, ast, imports,
|
|
322484
|
+
function foreignBindings(source, ast, imports, resolve7) {
|
|
322338
322485
|
return ast.program.body.filter((statement2) => statement2.type === "ImportDeclaration").filter((statement2) => !imports.some((item) => item.statement === statement2)).filter((statement2) => !isAuthoringModule(statement2.source.value)).map((statement2) => ({
|
|
322339
322486
|
start: statement2.start,
|
|
322340
322487
|
end: statement2.end,
|
|
322341
|
-
text: foreignBindingText(statement2, { lint: false, resolve:
|
|
322342
|
-
lintText: foreignBindingText(statement2, { lint: true, resolve:
|
|
322488
|
+
text: foreignBindingText(statement2, { lint: false, resolve: resolve7 }),
|
|
322489
|
+
lintText: foreignBindingText(statement2, { lint: true, resolve: resolve7 }),
|
|
322343
322490
|
original: sliceOf(source, statement2)
|
|
322344
322491
|
})).filter((binding) => binding.text !== "" || binding.lintText !== "");
|
|
322345
322492
|
}
|
|
@@ -322838,14 +322985,14 @@ var ENTRY_TYPES = /* @__PURE__ */ new Map([
|
|
|
322838
322985
|
var MODULE_ENTITY_EXTENSIONS = /* @__PURE__ */ new Set([".tsx", ".ts", ".jsx", ".js"]);
|
|
322839
322986
|
function moduleEntityType(path) {
|
|
322840
322987
|
const type = MODULE_ENTITY_TYPES[topDirectory(path)] ?? null;
|
|
322841
|
-
if (type === null || !MODULE_ENTITY_EXTENSIONS.has(
|
|
322988
|
+
if (type === null || !MODULE_ENTITY_EXTENSIONS.has(extname2(path)) || /\.(test|spec|d)\.[a-z]+$/.test(path)) {
|
|
322842
322989
|
return null;
|
|
322843
322990
|
}
|
|
322844
322991
|
return type;
|
|
322845
322992
|
}
|
|
322846
322993
|
function moduleUidDefinition(type, path, source) {
|
|
322847
322994
|
try {
|
|
322848
|
-
const ast = parseSource(source, { jsx:
|
|
322995
|
+
const ast = parseSource(source, { jsx: extname2(path) === ".tsx" || extname2(path) === ".jsx" });
|
|
322849
322996
|
return { type, path, source, program: ast.program, optional: true };
|
|
322850
322997
|
} catch (error) {
|
|
322851
322998
|
if (error instanceof SourceError || error instanceof SyntaxError) {
|
|
@@ -322862,7 +323009,7 @@ function isDirectChild(path, directory) {
|
|
|
322862
323009
|
return path.startsWith(`${directory}/`) && !path.slice(directory.length + 1).includes("/");
|
|
322863
323010
|
}
|
|
322864
323011
|
function stem(path) {
|
|
322865
|
-
return
|
|
323012
|
+
return basename13(path, extname2(path));
|
|
322866
323013
|
}
|
|
322867
323014
|
function buildConfig(ast, resources, pages, pagesByUid, assetEntries2, domainReferences, diagnostics, recordBindingEntries) {
|
|
322868
323015
|
const { declaration } = defaultExportOf(ast, {
|
|
@@ -322980,7 +323127,7 @@ function checkMenuModule(ast) {
|
|
|
322980
323127
|
}
|
|
322981
323128
|
}
|
|
322982
323129
|
function isUnitSupportFile(path) {
|
|
322983
|
-
const extension =
|
|
323130
|
+
const extension = extname2(path).toLowerCase();
|
|
322984
323131
|
return extension === ".ts" || extension === ".css";
|
|
322985
323132
|
}
|
|
322986
323133
|
function classify(path) {
|
|
@@ -322997,13 +323144,21 @@ function classify(path) {
|
|
|
322997
323144
|
return "config";
|
|
322998
323145
|
}
|
|
322999
323146
|
const directory = topDirectory(path);
|
|
323000
|
-
const extension =
|
|
323147
|
+
const extension = extname2(path);
|
|
323001
323148
|
if (directory === "pages" && isUnitSupportFile(path)) {
|
|
323002
323149
|
return "ignored";
|
|
323003
323150
|
}
|
|
323004
323151
|
switch (directory) {
|
|
323005
|
-
case "resources":
|
|
323006
|
-
|
|
323152
|
+
case "resources": {
|
|
323153
|
+
if (isResourcePath(path)) {
|
|
323154
|
+
return "resource";
|
|
323155
|
+
}
|
|
323156
|
+
const child = resourceChildOf(path);
|
|
323157
|
+
if (child !== null) {
|
|
323158
|
+
return child.kind;
|
|
323159
|
+
}
|
|
323160
|
+
return legacyResourceFolder(path) === null ? "unknown" : "legacy_resource";
|
|
323161
|
+
}
|
|
323007
323162
|
case PERMISSIONS_DIRECTORY:
|
|
323008
323163
|
return isDirectChild(path, directory) && extension === ".ts" ? "permission" : "unknown";
|
|
323009
323164
|
case ROLES_DIRECTORY:
|
|
@@ -323440,63 +323595,38 @@ function withoutTypeAssertions(node) {
|
|
|
323440
323595
|
}
|
|
323441
323596
|
return current;
|
|
323442
323597
|
}
|
|
323443
|
-
function fieldUidNodes(definition) {
|
|
323444
|
-
const
|
|
323445
|
-
if (
|
|
323598
|
+
function fieldUidNodes(field2, definition) {
|
|
323599
|
+
const call = withoutTypeAssertions(definition);
|
|
323600
|
+
if (call?.type !== "CallExpression") {
|
|
323446
323601
|
return [];
|
|
323447
323602
|
}
|
|
323448
|
-
const
|
|
323449
|
-
|
|
323450
|
-
|
|
323451
|
-
continue;
|
|
323452
|
-
}
|
|
323453
|
-
const call = withoutTypeAssertions(property.value);
|
|
323454
|
-
if (call.type !== "CallExpression") {
|
|
323455
|
-
continue;
|
|
323456
|
-
}
|
|
323457
|
-
const field2 = propertyKey2(property);
|
|
323458
|
-
const [argument] = call.arguments;
|
|
323459
|
-
if (argument === void 0) {
|
|
323460
|
-
nodes.push({ type: "field", node: call, field: field2, inverse: false });
|
|
323461
|
-
continue;
|
|
323462
|
-
}
|
|
323463
|
-
const options = withoutTypeAssertions(argument);
|
|
323464
|
-
if (options.type !== "ObjectExpression") {
|
|
323465
|
-
continue;
|
|
323466
|
-
}
|
|
323467
|
-
nodes.push({ type: "field", node: options, field: field2, inverse: false });
|
|
323468
|
-
const settings = withoutTypeAssertions(objectProperty2(options, "settings")?.value);
|
|
323469
|
-
const inverse = settings?.type === "ObjectExpression" ? withoutTypeAssertions(objectProperty2(settings, "inverse")?.value) : void 0;
|
|
323470
|
-
if (inverse?.type === "ObjectExpression") {
|
|
323471
|
-
nodes.push({ type: "field", node: inverse, field: field2, inverse: true });
|
|
323472
|
-
}
|
|
323603
|
+
const [argument] = call.arguments;
|
|
323604
|
+
if (argument === void 0) {
|
|
323605
|
+
return [{ type: "field", node: call, field: field2, inverse: false }];
|
|
323473
323606
|
}
|
|
323474
|
-
|
|
323475
|
-
|
|
323476
|
-
function policyUidNodes(definition) {
|
|
323477
|
-
const policies = withoutTypeAssertions(objectProperty2(definition, "policies")?.value);
|
|
323478
|
-
if (policies?.type !== "ArrayExpression") {
|
|
323607
|
+
const options = withoutTypeAssertions(argument);
|
|
323608
|
+
if (options.type !== "ObjectExpression") {
|
|
323479
323609
|
return [];
|
|
323480
323610
|
}
|
|
323481
|
-
|
|
323482
|
-
|
|
323483
|
-
|
|
323484
|
-
|
|
323485
|
-
}
|
|
323486
|
-
|
|
323487
|
-
return
|
|
323611
|
+
const nodes = [{ type: "field", node: options, field: field2, inverse: false }];
|
|
323612
|
+
const settings = withoutTypeAssertions(objectProperty2(options, "settings")?.value);
|
|
323613
|
+
const inverse = settings?.type === "ObjectExpression" ? withoutTypeAssertions(objectProperty2(settings, "inverse")?.value) : void 0;
|
|
323614
|
+
if (inverse?.type === "ObjectExpression") {
|
|
323615
|
+
nodes.push({ type: "field", node: inverse, field: field2, inverse: true });
|
|
323616
|
+
}
|
|
323617
|
+
return nodes;
|
|
323488
323618
|
}
|
|
323489
323619
|
function fieldUidPosition(path, field2, inverse) {
|
|
323490
323620
|
return `${path}\0${field2}\0${inverse ? "inverse" : "field"}`;
|
|
323491
323621
|
}
|
|
323492
|
-
function checkInverseFieldUids(resources,
|
|
323622
|
+
function checkInverseFieldUids(resources, fieldPaths, diagnostics) {
|
|
323493
323623
|
for (const resource of resources) {
|
|
323494
323624
|
const firstByUid = /* @__PURE__ */ new Map();
|
|
323495
|
-
for (const field2 of resource.fields) {
|
|
323625
|
+
for (const [position, field2] of resource.fields.entries()) {
|
|
323496
323626
|
if (field2.uid === null) {
|
|
323497
323627
|
continue;
|
|
323498
323628
|
}
|
|
323499
|
-
const path =
|
|
323629
|
+
const path = fieldPaths.get(resource.path)[position];
|
|
323500
323630
|
const first = firstByUid.get(field2.uid);
|
|
323501
323631
|
if (first === void 0) {
|
|
323502
323632
|
firstByUid.set(field2.uid, { field: field2, path });
|
|
@@ -323516,17 +323646,6 @@ function checkInverseFieldUids(resources, pathsBySlug, diagnostics) {
|
|
|
323516
323646
|
}
|
|
323517
323647
|
}
|
|
323518
323648
|
}
|
|
323519
|
-
function staticRecordNodes(definition) {
|
|
323520
|
-
const records = definition.properties.find(
|
|
323521
|
-
(property) => property.type === "ObjectProperty" && propertyKey2(property) === "records"
|
|
323522
|
-
);
|
|
323523
|
-
if (records?.value.type !== "ObjectExpression") {
|
|
323524
|
-
return [];
|
|
323525
|
-
}
|
|
323526
|
-
return records.value.properties.filter(
|
|
323527
|
-
(property) => property.type === "ObjectProperty" && property.value.type === "ObjectExpression"
|
|
323528
|
-
).map((property) => ({ key: propertyKey2(property), node: property.value }));
|
|
323529
|
-
}
|
|
323530
323649
|
function uidDefinitionNodes(kind, path, ast) {
|
|
323531
323650
|
switch (kind) {
|
|
323532
323651
|
case "resource": {
|
|
@@ -323534,23 +323653,29 @@ function uidDefinitionNodes(kind, path, ast) {
|
|
|
323534
323653
|
if (node.type !== "ObjectExpression") {
|
|
323535
323654
|
return [{ type: "resource", node }];
|
|
323536
323655
|
}
|
|
323537
|
-
if (objectProperty2(node, "platform") !== null || BUILT_IN_RESOURCE_SLUGS.has(
|
|
323656
|
+
if (objectProperty2(node, "platform") !== null || BUILT_IN_RESOURCE_SLUGS.has(resourceFolderOf(path))) {
|
|
323538
323657
|
return [];
|
|
323539
323658
|
}
|
|
323540
|
-
return [
|
|
323541
|
-
|
|
323542
|
-
|
|
323659
|
+
return [{ type: "resource", node }];
|
|
323660
|
+
}
|
|
323661
|
+
case "resource_field":
|
|
323662
|
+
case "resource_policy":
|
|
323663
|
+
case "resource_record": {
|
|
323664
|
+
const { folder, key, definitionPath } = resourceChildOf(path);
|
|
323665
|
+
if (BUILT_IN_RESOURCE_SLUGS.has(folder)) {
|
|
323666
|
+
return [];
|
|
323667
|
+
}
|
|
323668
|
+
const node = resourceChildArgument(kind, ast);
|
|
323669
|
+
if (kind === "resource_field") {
|
|
323670
|
+
return fieldUidNodes(key, node).map((field2) => ({
|
|
323543
323671
|
...field2,
|
|
323544
|
-
scope: field2.inverse ? fieldUidPosition(
|
|
323545
|
-
}))
|
|
323546
|
-
|
|
323547
|
-
|
|
323548
|
-
|
|
323549
|
-
|
|
323550
|
-
|
|
323551
|
-
version: 7
|
|
323552
|
-
}))
|
|
323553
|
-
];
|
|
323672
|
+
scope: field2.inverse ? fieldUidPosition(definitionPath, key, true) : definitionPath
|
|
323673
|
+
}));
|
|
323674
|
+
}
|
|
323675
|
+
if (node.type !== "ObjectExpression") {
|
|
323676
|
+
return [];
|
|
323677
|
+
}
|
|
323678
|
+
return kind === "resource_policy" ? [{ type: "policy", node, scope: definitionPath }] : [{ type: "static record", node, recordKey: key, version: 7 }];
|
|
323554
323679
|
}
|
|
323555
323680
|
case "permission":
|
|
323556
323681
|
return [{ type: "permission", node: definePermissionArgument(ast), version: 7 }];
|
|
@@ -323588,6 +323713,7 @@ function uidPositionKey(path, recordKey = null) {
|
|
|
323588
323713
|
return recordKey === null ? path : `${path}\0${recordKey}`;
|
|
323589
323714
|
}
|
|
323590
323715
|
var ENTITY_UID_TYPES = /* @__PURE__ */ new Set(["page", "workflow", "layout", "component", NOTIFICATION_DEFINITIONS.email_layout.type]);
|
|
323716
|
+
var RESOURCE_FILE_KINDS = /* @__PURE__ */ new Set(["resource", "resource_field", "resource_policy", "resource_record"]);
|
|
323591
323717
|
function buildWorkspace(root, options = {}) {
|
|
323592
323718
|
const plan = composePackages(root);
|
|
323593
323719
|
return plan.files.size > 0 ? buildComposedCheckout(root, plan, options, buildMaterializedWorkspace) : buildMaterializedWorkspace(root, plan, options);
|
|
@@ -323652,17 +323778,38 @@ function buildMaterializedWorkspace(root, plan, { assetCatalog = null, writeSour
|
|
|
323652
323778
|
);
|
|
323653
323779
|
}
|
|
323654
323780
|
const resourceSources = /* @__PURE__ */ new Map();
|
|
323655
|
-
|
|
323781
|
+
const resourceChildren = /* @__PURE__ */ new Map();
|
|
323782
|
+
for (const path of files.filter((item) => RESOURCE_FILE_KINDS.has(classify(item)))) {
|
|
323656
323783
|
const source = readFileSync14(join18(root, path), "utf8");
|
|
323657
323784
|
let ast = null;
|
|
323658
323785
|
try {
|
|
323659
|
-
ast = parseSource(source, { jsx: false });
|
|
323786
|
+
ast = parseSource(source, { jsx: false, path });
|
|
323660
323787
|
} catch (error) {
|
|
323661
323788
|
if (!(error instanceof SourceError || error instanceof SyntaxError)) {
|
|
323662
323789
|
throw error;
|
|
323663
323790
|
}
|
|
323791
|
+
if (classify(path) !== "resource") {
|
|
323792
|
+
diagnostics.push(diagnosticFromError(path, error));
|
|
323793
|
+
}
|
|
323794
|
+
}
|
|
323795
|
+
if (classify(path) === "resource") {
|
|
323796
|
+
resourceSources.set(path, { source, ast });
|
|
323797
|
+
continue;
|
|
323798
|
+
}
|
|
323799
|
+
const child = resourceChildOf(path);
|
|
323800
|
+
const children = resourceChildren.get(child.definitionPath) ?? [];
|
|
323801
|
+
children.push({ ...child, path, source, ast });
|
|
323802
|
+
resourceChildren.set(child.definitionPath, children);
|
|
323803
|
+
}
|
|
323804
|
+
for (const [definitionPath, children] of resourceChildren) {
|
|
323805
|
+
if (resourceSources.has(definitionPath)) {
|
|
323806
|
+
continue;
|
|
323807
|
+
}
|
|
323808
|
+
for (const { path } of children) {
|
|
323809
|
+
diagnostics.push(
|
|
323810
|
+
diagnosticAt(path, null, `This file belongs to a resource, so its folder needs ${definitionPath}. Add the file, or move this file`)
|
|
323811
|
+
);
|
|
323664
323812
|
}
|
|
323665
|
-
resourceSources.set(path, { source, ast });
|
|
323666
323813
|
}
|
|
323667
323814
|
const names2 = resourceNames(
|
|
323668
323815
|
[...resourceSources].map(
|
|
@@ -323688,7 +323835,7 @@ function buildMaterializedWorkspace(root, plan, { assetCatalog = null, writeSour
|
|
|
323688
323835
|
diagnosticAt(
|
|
323689
323836
|
path,
|
|
323690
323837
|
null,
|
|
323691
|
-
BINARY_EXTENSIONS.has(
|
|
323838
|
+
BINARY_EXTENSIONS.has(extname2(path).toLowerCase()) ? BINARY_FILE_MESSAGE : "The build does not know this file. Move or rename it"
|
|
323692
323839
|
)
|
|
323693
323840
|
);
|
|
323694
323841
|
return;
|
|
@@ -323696,6 +323843,20 @@ function buildMaterializedWorkspace(root, plan, { assetCatalog = null, writeSour
|
|
|
323696
323843
|
if (kind === "skill" || NOTIFICATION_KINDS.has(kind)) {
|
|
323697
323844
|
return;
|
|
323698
323845
|
}
|
|
323846
|
+
if (RESOURCE_FILE_KINDS.has(kind) && kind !== "resource") {
|
|
323847
|
+
return;
|
|
323848
|
+
}
|
|
323849
|
+
if (kind === "legacy_resource") {
|
|
323850
|
+
const folder = legacyResourceFolder(path);
|
|
323851
|
+
diagnostics.push(
|
|
323852
|
+
diagnosticAt(
|
|
323853
|
+
path,
|
|
323854
|
+
null,
|
|
323855
|
+
`A resource is a folder. Move the settings of this file to resources/${folder}/resource.ts, and each field, policy, and record to a file of its own in resources/${folder}/fields/, policies/, and records/`
|
|
323856
|
+
)
|
|
323857
|
+
);
|
|
323858
|
+
return;
|
|
323859
|
+
}
|
|
323699
323860
|
if (kind === "legacy_authorization") {
|
|
323700
323861
|
diagnostics.push(
|
|
323701
323862
|
diagnosticAt(
|
|
@@ -323709,7 +323870,7 @@ function buildMaterializedWorkspace(root, plan, { assetCatalog = null, writeSour
|
|
|
323709
323870
|
const parsed = resourceSources.get(path);
|
|
323710
323871
|
const source = parsed?.source ?? readFileSync14(join18(root, path), "utf8");
|
|
323711
323872
|
try {
|
|
323712
|
-
const ast = parsed?.ast ?? parseSource(source, { jsx:
|
|
323873
|
+
const ast = parsed?.ast ?? parseSource(source, { jsx: extname2(path) === ".tsx" });
|
|
323713
323874
|
if (kind === "page") {
|
|
323714
323875
|
diagnostics.push(...rowMenuReads(path, ast));
|
|
323715
323876
|
}
|
|
@@ -323749,32 +323910,70 @@ function buildMaterializedWorkspace(root, plan, { assetCatalog = null, writeSour
|
|
|
323749
323910
|
if (slug === void 0) {
|
|
323750
323911
|
break;
|
|
323751
323912
|
}
|
|
323913
|
+
const childFiles = resourceChildren.get(path) ?? [];
|
|
323914
|
+
const children = [];
|
|
323915
|
+
for (const child of childFiles) {
|
|
323916
|
+
if (child.ast === null) {
|
|
323917
|
+
continue;
|
|
323918
|
+
}
|
|
323919
|
+
try {
|
|
323920
|
+
const typeProblem2 = child.kind === "resource_field" ? null : folderTypeArgumentProblem(child.ast, child.folder);
|
|
323921
|
+
if (typeProblem2 !== null) {
|
|
323922
|
+
diagnostics.push(diagnosticAt(child.path, typeProblem2.node, typeProblem2.message, { severity: "warning" }));
|
|
323923
|
+
}
|
|
323924
|
+
children.push({
|
|
323925
|
+
path: child.path,
|
|
323926
|
+
kind: child.kind,
|
|
323927
|
+
key: child.key,
|
|
323928
|
+
ast: child.ast,
|
|
323929
|
+
source: child.source,
|
|
323930
|
+
node: resourceChildArgument(child.kind, child.ast),
|
|
323931
|
+
bindings: {
|
|
323932
|
+
resources: resourcesBinding(child.ast, names2),
|
|
323933
|
+
pages: pagesBinding(child.ast, generatedPages.entries, generatedPages.pathsByName),
|
|
323934
|
+
generatedEntries: recordBindingsBinding(child.ast, recordBindings.entries)
|
|
323935
|
+
}
|
|
323936
|
+
});
|
|
323937
|
+
} catch (error) {
|
|
323938
|
+
diagnostics.push(diagnosticFromError(child.path, error));
|
|
323939
|
+
}
|
|
323940
|
+
}
|
|
323941
|
+
if (children.length !== childFiles.length) {
|
|
323942
|
+
break;
|
|
323943
|
+
}
|
|
323944
|
+
const typeProblem = folderTypeArgumentProblem(ast, resourceFolderOf(path));
|
|
323945
|
+
if (typeProblem !== null) {
|
|
323946
|
+
diagnostics.push(diagnosticAt(path, typeProblem.node, typeProblem.message, { severity: "warning" }));
|
|
323947
|
+
}
|
|
323752
323948
|
const definition = defineResourceArgument(ast);
|
|
323753
323949
|
const resource = buildResource(path, definition, {
|
|
323754
323950
|
slug,
|
|
323755
323951
|
resources: resourcesBinding(ast, names2),
|
|
323756
323952
|
pages: pagesBinding(ast, generatedPages.entries, generatedPages.pathsByName),
|
|
323757
|
-
generatedEntries: recordBindingsBinding(ast, recordBindings.entries)
|
|
323953
|
+
generatedEntries: recordBindingsBinding(ast, recordBindings.entries),
|
|
323954
|
+
children
|
|
323758
323955
|
});
|
|
323759
323956
|
output.resources.push(resource);
|
|
323760
|
-
for (const {
|
|
323761
|
-
type,
|
|
323762
|
-
scope: scope2,
|
|
323763
|
-
node,
|
|
323764
|
-
field: field2,
|
|
323765
|
-
inverse,
|
|
323766
|
-
policy,
|
|
323767
|
-
recordKey,
|
|
323768
|
-
version
|
|
323769
|
-
} of uidDefinitionNodes(kind, path, ast)) {
|
|
323957
|
+
for (const { type, scope: scope2, node, version } of uidDefinitionNodes(kind, path, ast)) {
|
|
323770
323958
|
const position = resourceUidDefinitions.push({ type, scope: scope2, path, source, node, version }) - 1;
|
|
323771
|
-
|
|
323772
|
-
|
|
323773
|
-
|
|
323774
|
-
|
|
323775
|
-
|
|
323776
|
-
|
|
323959
|
+
resourceUidPositions.set(uidPositionKey(path), position);
|
|
323960
|
+
}
|
|
323961
|
+
for (const child of children) {
|
|
323962
|
+
for (const { type, scope: scope2, node, field: field2, inverse, recordKey, version } of uidDefinitionNodes(
|
|
323963
|
+
child.kind,
|
|
323964
|
+
child.path,
|
|
323965
|
+
child.ast
|
|
323966
|
+
)) {
|
|
323967
|
+
const position = resourceUidDefinitions.push({ type, scope: scope2, path: child.path, source: child.source, node, version }) - 1;
|
|
323968
|
+
if (field2 !== void 0) {
|
|
323969
|
+
fieldUidPositions.set(fieldUidPosition(path, field2, inverse), position);
|
|
323970
|
+
} else if (child.kind === "resource_policy") {
|
|
323971
|
+
policyUidPositions.set(child.path, position);
|
|
323972
|
+
} else {
|
|
323973
|
+
resourceUidPositions.set(uidPositionKey(path, recordKey), position);
|
|
323974
|
+
}
|
|
323777
323975
|
}
|
|
323976
|
+
diagnostics.push(...slugStringWarnings(child.path, child.node, names2));
|
|
323778
323977
|
}
|
|
323779
323978
|
diagnostics.push(...slugStringWarnings(path, definition, names2));
|
|
323780
323979
|
break;
|
|
@@ -323859,7 +324058,7 @@ function buildMaterializedWorkspace(root, plan, { assetCatalog = null, writeSour
|
|
|
323859
324058
|
const resourceFiles = files.filter((path) => topDirectory(path) === "resources");
|
|
323860
324059
|
const assetPaths = files.filter((path) => classify(path) === "assets");
|
|
323861
324060
|
const otherFiles = files.filter(
|
|
323862
|
-
(path) =>
|
|
324061
|
+
(path) => topDirectory(path) !== "resources" && !["permission", "role", "config"].includes(classify(path)) && !assetPaths.includes(path)
|
|
323863
324062
|
);
|
|
323864
324063
|
for (const path of resourceFiles) {
|
|
323865
324064
|
buildFile(path);
|
|
@@ -323880,6 +324079,9 @@ function buildMaterializedWorkspace(root, plan, { assetCatalog = null, writeSour
|
|
|
323880
324079
|
);
|
|
323881
324080
|
checkPolicyResources(output.resources, BUILT_IN_RESOURCE_SLUGS, names2, diagnostics);
|
|
323882
324081
|
}
|
|
324082
|
+
diagnostics.push(...policyKeyWarnings(output.resources, names2));
|
|
324083
|
+
const policyPaths = new Map(output.resources.map((resource) => [resource.path, resource.policies.map((policy) => policy.path)]));
|
|
324084
|
+
const fieldPaths = new Map(output.resources.map((resource) => [resource.path, resource.fields.map((field2) => field2.path)]));
|
|
323883
324085
|
output.resources = output.resources.map(withoutBuildNodes);
|
|
323884
324086
|
const resourceUidCheck = checkDefinitionUids(root, resourceUidDefinitions, {
|
|
323885
324087
|
write: writeSource
|
|
@@ -323900,11 +324102,10 @@ function buildMaterializedWorkspace(root, plan, { assetCatalog = null, writeSour
|
|
|
323900
324102
|
record.uid = resourceUidCheck.uids[resourceUidPositions.get(uidPositionKey(resource.path, record.key))] ?? null;
|
|
323901
324103
|
}
|
|
323902
324104
|
resource.policies.forEach((policy, position) => {
|
|
323903
|
-
policy.uid = resourceUidCheck.uids[policyUidPositions.get(
|
|
324105
|
+
policy.uid = resourceUidCheck.uids[policyUidPositions.get(policyPaths.get(resource.path)[position])] ?? null;
|
|
323904
324106
|
});
|
|
323905
324107
|
}
|
|
323906
|
-
checkInverseFieldUids(output.resources,
|
|
323907
|
-
diagnostics.push(...policyKeyWarnings(output.resources, names2));
|
|
324108
|
+
checkInverseFieldUids(output.resources, fieldPaths, diagnostics);
|
|
323908
324109
|
const workflowPackageDeclared = Object.hasOwn(sdkPackages(packageFiles), "@diagonal-hq/workflows");
|
|
323909
324110
|
writeGeneratedModule(
|
|
323910
324111
|
root,
|
|
@@ -323912,6 +324113,7 @@ function buildMaterializedWorkspace(root, plan, { assetCatalog = null, writeSour
|
|
|
323912
324113
|
generatedResourcesSource(names2, output.resources, { workflowPackageDeclared }),
|
|
323913
324114
|
true
|
|
323914
324115
|
);
|
|
324116
|
+
writeGeneratedModule(root, GENERATED_RESOURCE_FOLDERS_PATH, generatedResourceFoldersSource(names2, output.resources), output.resources.length > 0);
|
|
323915
324117
|
const entries = resourceEntries(names2, output.resources);
|
|
323916
324118
|
for (const path of assetPaths) {
|
|
323917
324119
|
buildFile(path);
|
|
@@ -324265,597 +324467,10 @@ function buildMaterializedWorkspace(root, plan, { assetCatalog = null, writeSour
|
|
|
324265
324467
|
};
|
|
324266
324468
|
}
|
|
324267
324469
|
|
|
324268
|
-
// scripts/lib/runtime-build/git-cli.mjs
|
|
324269
|
-
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
324270
|
-
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
324271
|
-
import { readFileSync as readFileSync15, writeFileSync as writeFileSync6 } from "node:fs";
|
|
324272
|
-
import { join as join19, resolve as resolve6 } from "node:path";
|
|
324273
|
-
|
|
324274
|
-
// scripts/lib/runtime-build/resource-merge.mjs
|
|
324275
|
-
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
324276
|
-
var KEYED_PROPERTIES = /* @__PURE__ */ new Set(["fields", "records"]);
|
|
324277
|
-
var CLOSING_TOKENS = /* @__PURE__ */ new Set(["}", "]", ")"]);
|
|
324278
|
-
var RESOURCE_PATH = /^resources\/[^/]+\.ts$/;
|
|
324279
|
-
function isResourceFilePath(path) {
|
|
324280
|
-
return RESOURCE_PATH.test(path);
|
|
324281
|
-
}
|
|
324282
|
-
function tokenLabel(token) {
|
|
324283
|
-
return typeof token.type === "string" ? token.type : token.type.label;
|
|
324284
|
-
}
|
|
324285
|
-
function isComment(token) {
|
|
324286
|
-
return token.type === "CommentLine" || token.type === "CommentBlock";
|
|
324287
|
-
}
|
|
324288
|
-
function firstTokenAt(tokens, position) {
|
|
324289
|
-
let low = 0;
|
|
324290
|
-
let high = tokens.length;
|
|
324291
|
-
while (low < high) {
|
|
324292
|
-
const middle = low + high >> 1;
|
|
324293
|
-
if (tokens[middle].start < position) {
|
|
324294
|
-
low = middle + 1;
|
|
324295
|
-
} else {
|
|
324296
|
-
high = middle;
|
|
324297
|
-
}
|
|
324298
|
-
}
|
|
324299
|
-
return low;
|
|
324300
|
-
}
|
|
324301
|
-
function nextCodeToken(tokens, index3) {
|
|
324302
|
-
for (let next = index3 + 1; next < tokens.length; next++) {
|
|
324303
|
-
if (!isComment(tokens[next])) {
|
|
324304
|
-
return tokens[next];
|
|
324305
|
-
}
|
|
324306
|
-
}
|
|
324307
|
-
return null;
|
|
324308
|
-
}
|
|
324309
|
-
function normalizedText(side, start, end) {
|
|
324310
|
-
const { tokens, source } = side;
|
|
324311
|
-
const parts = [];
|
|
324312
|
-
for (let index3 = firstTokenAt(tokens, start); index3 < tokens.length; index3++) {
|
|
324313
|
-
const token = tokens[index3];
|
|
324314
|
-
if (token.end > end) {
|
|
324315
|
-
break;
|
|
324316
|
-
}
|
|
324317
|
-
const label = tokenLabel(token);
|
|
324318
|
-
if (label === "eof") {
|
|
324319
|
-
continue;
|
|
324320
|
-
}
|
|
324321
|
-
if (label === ",") {
|
|
324322
|
-
const next = nextCodeToken(tokens, index3);
|
|
324323
|
-
if (next === null || next.end > end || CLOSING_TOKENS.has(tokenLabel(next))) {
|
|
324324
|
-
continue;
|
|
324325
|
-
}
|
|
324326
|
-
}
|
|
324327
|
-
const text2 = source.slice(token.start, token.end);
|
|
324328
|
-
parts.push(isComment(token) ? text2.replace(/\s+/g, " ") : text2);
|
|
324329
|
-
}
|
|
324330
|
-
return parts.join(" ");
|
|
324331
|
-
}
|
|
324332
|
-
function lineStart(source, position) {
|
|
324333
|
-
return source.lastIndexOf("\n", position - 1) + 1;
|
|
324334
|
-
}
|
|
324335
|
-
function lineIndent2(source, position) {
|
|
324336
|
-
const start = lineStart(source, position);
|
|
324337
|
-
return /^[ \t]*/.exec(source.slice(start, position))[0];
|
|
324338
|
-
}
|
|
324339
|
-
function insideValueToken(tokens, position) {
|
|
324340
|
-
const token = tokens[firstTokenAt(tokens, position) - 1];
|
|
324341
|
-
return token !== void 0 && !isComment(token) && token.end > position;
|
|
324342
|
-
}
|
|
324343
|
-
function reindent(ctx, entry, indent) {
|
|
324344
|
-
const { source, tokens, unit: step } = entry.side;
|
|
324345
|
-
const from = lineIndent2(source, entry.start);
|
|
324346
|
-
const lines = source.slice(entry.start, entry.end).split("\n");
|
|
324347
|
-
let position = entry.start;
|
|
324348
|
-
return lines.map((raw, index3) => {
|
|
324349
|
-
const start = position;
|
|
324350
|
-
position += raw.length + 1;
|
|
324351
|
-
const line = index3 < lines.length - 1 && raw.endsWith("\r") ? raw.slice(0, -1) : raw;
|
|
324352
|
-
if (index3 === 0 || !line.startsWith(from) || insideValueToken(tokens, start)) {
|
|
324353
|
-
return line;
|
|
324354
|
-
}
|
|
324355
|
-
let rest = line.slice(from.length);
|
|
324356
|
-
let steps = 0;
|
|
324357
|
-
while (rest.startsWith(step)) {
|
|
324358
|
-
rest = rest.slice(step.length);
|
|
324359
|
-
steps++;
|
|
324360
|
-
}
|
|
324361
|
-
return `${indent}${ctx.unit.repeat(steps)}${rest}`;
|
|
324362
|
-
}).join(ctx.newline);
|
|
324363
|
-
}
|
|
324364
|
-
function readKey(element) {
|
|
324365
|
-
if (element.type !== "ObjectProperty" && element.type !== "ObjectMethod") {
|
|
324366
|
-
return null;
|
|
324367
|
-
}
|
|
324368
|
-
try {
|
|
324369
|
-
return propertyKey2(element);
|
|
324370
|
-
} catch (error) {
|
|
324371
|
-
if (error instanceof SourceError) {
|
|
324372
|
-
return null;
|
|
324373
|
-
}
|
|
324374
|
-
throw error;
|
|
324375
|
-
}
|
|
324376
|
-
}
|
|
324377
|
-
function readPolicyUid(element) {
|
|
324378
|
-
if (element.type !== "ObjectExpression") {
|
|
324379
|
-
return null;
|
|
324380
|
-
}
|
|
324381
|
-
const property = element.properties.find(
|
|
324382
|
-
(candidate) => candidate.type === "ObjectProperty" && !candidate.computed && readKey(candidate) === "uid"
|
|
324383
|
-
);
|
|
324384
|
-
return property?.value.type === "StringLiteral" ? property.value.value : null;
|
|
324385
|
-
}
|
|
324386
|
-
var KEY_READERS = {
|
|
324387
|
-
keyed: readKey,
|
|
324388
|
-
strings: (element) => element.type === "StringLiteral" ? element.value : null,
|
|
324389
|
-
uids: readPolicyUid
|
|
324390
|
-
};
|
|
324391
|
-
function tokenAfter(side, position, label) {
|
|
324392
|
-
for (let index3 = firstTokenAt(side.tokens, position); index3 < side.tokens.length; index3++) {
|
|
324393
|
-
const token = side.tokens[index3];
|
|
324394
|
-
if (tokenLabel(token) === label) {
|
|
324395
|
-
return token;
|
|
324396
|
-
}
|
|
324397
|
-
if (!isComment(token)) {
|
|
324398
|
-
return null;
|
|
324399
|
-
}
|
|
324400
|
-
}
|
|
324401
|
-
return null;
|
|
324402
|
-
}
|
|
324403
|
-
function containerOf(side, node, keyOf) {
|
|
324404
|
-
const elements = node.type === "ObjectExpression" ? node.properties : node.elements;
|
|
324405
|
-
const entries = [];
|
|
324406
|
-
const seen = /* @__PURE__ */ new Set();
|
|
324407
|
-
let boundary = node.start + 1;
|
|
324408
|
-
let boundaryLine = node.loc.start.line;
|
|
324409
|
-
for (const [index3, element] of elements.entries()) {
|
|
324410
|
-
if (element === null) {
|
|
324411
|
-
return null;
|
|
324412
|
-
}
|
|
324413
|
-
const key = keyOf(element);
|
|
324414
|
-
if (key === null || seen.has(key)) {
|
|
324415
|
-
return null;
|
|
324416
|
-
}
|
|
324417
|
-
seen.add(key);
|
|
324418
|
-
if (index3 > 0) {
|
|
324419
|
-
const comma2 = tokenAfter(side, elements[index3 - 1].end, ",");
|
|
324420
|
-
if (comma2 === null) {
|
|
324421
|
-
return null;
|
|
324422
|
-
}
|
|
324423
|
-
boundary = comma2.end;
|
|
324424
|
-
boundaryLine = comma2.loc.start.line;
|
|
324425
|
-
}
|
|
324426
|
-
const leading = (element.leadingComments ?? []).find(
|
|
324427
|
-
(comment) => comment.start >= boundary && comment.loc.start.line > boundaryLine
|
|
324428
|
-
);
|
|
324429
|
-
entries.push({
|
|
324430
|
-
side,
|
|
324431
|
-
key,
|
|
324432
|
-
index: index3,
|
|
324433
|
-
value: element.type === "ObjectProperty" ? element.value : null,
|
|
324434
|
-
start: leading?.start ?? element.start,
|
|
324435
|
-
end: element.end
|
|
324436
|
-
});
|
|
324437
|
-
}
|
|
324438
|
-
return { side, node, entries };
|
|
324439
|
-
}
|
|
324440
|
-
function readSide(source) {
|
|
324441
|
-
let ast;
|
|
324442
|
-
try {
|
|
324443
|
-
ast = parse2(source, { sourceType: "module", plugins: ["typescript"], errorRecovery: false, tokens: true });
|
|
324444
|
-
} catch (error) {
|
|
324445
|
-
if (error instanceof SyntaxError) {
|
|
324446
|
-
return null;
|
|
324447
|
-
}
|
|
324448
|
-
throw error;
|
|
324449
|
-
}
|
|
324450
|
-
const exports = ast.program.body.filter((statement2) => statement2.type === "ExportDefaultDeclaration");
|
|
324451
|
-
if (exports.length !== 1) {
|
|
324452
|
-
return null;
|
|
324453
|
-
}
|
|
324454
|
-
const call = exports[0].declaration;
|
|
324455
|
-
if (call.type !== "CallExpression" || call.callee.type !== "Identifier" || call.callee.name !== "defineResource" || call.arguments.length !== 1 || call.arguments[0].type !== "ObjectExpression") {
|
|
324456
|
-
return null;
|
|
324457
|
-
}
|
|
324458
|
-
const side = { source, tokens: ast.tokens, object: call.arguments[0], container: null, unit: " " };
|
|
324459
|
-
side.container = containerOf(side, side.object, KEY_READERS.keyed);
|
|
324460
|
-
if (side.container === null) {
|
|
324461
|
-
return null;
|
|
324462
|
-
}
|
|
324463
|
-
side.unit = indentUnit(side);
|
|
324464
|
-
return side;
|
|
324465
|
-
}
|
|
324466
|
-
function nestedKind(key, values) {
|
|
324467
|
-
if (KEYED_PROPERTIES.has(key)) {
|
|
324468
|
-
return values.every((value) => value?.type === "ObjectExpression") ? "keyed" : null;
|
|
324469
|
-
}
|
|
324470
|
-
if (!values.every((value) => value?.type === "ArrayExpression")) {
|
|
324471
|
-
return null;
|
|
324472
|
-
}
|
|
324473
|
-
const elements = values.flatMap((value) => value.elements);
|
|
324474
|
-
if (elements.length === 0) {
|
|
324475
|
-
return null;
|
|
324476
|
-
}
|
|
324477
|
-
if (elements.every((element) => element?.type === "StringLiteral")) {
|
|
324478
|
-
return "strings";
|
|
324479
|
-
}
|
|
324480
|
-
return elements.every((element) => element !== null && readPolicyUid(element) !== null) ? "uids" : null;
|
|
324481
|
-
}
|
|
324482
|
-
function decide(base, ours, theirs, same) {
|
|
324483
|
-
if (ours !== void 0 && theirs !== void 0) {
|
|
324484
|
-
if (same(ours, theirs)) {
|
|
324485
|
-
return "ours";
|
|
324486
|
-
}
|
|
324487
|
-
if (base !== void 0 && same(ours, base)) {
|
|
324488
|
-
return "theirs";
|
|
324489
|
-
}
|
|
324490
|
-
return base !== void 0 && same(theirs, base) ? "ours" : "conflict";
|
|
324491
|
-
}
|
|
324492
|
-
if (ours !== void 0) {
|
|
324493
|
-
if (base === void 0) {
|
|
324494
|
-
return "ours";
|
|
324495
|
-
}
|
|
324496
|
-
return same(ours, base) ? "delete" : "conflict";
|
|
324497
|
-
}
|
|
324498
|
-
if (theirs !== void 0) {
|
|
324499
|
-
if (base === void 0) {
|
|
324500
|
-
return "theirs";
|
|
324501
|
-
}
|
|
324502
|
-
return same(theirs, base) ? "delete" : "conflict";
|
|
324503
|
-
}
|
|
324504
|
-
return "delete";
|
|
324505
|
-
}
|
|
324506
|
-
function entryText(entry) {
|
|
324507
|
-
return entry.side.source.slice(entry.start, entry.end);
|
|
324508
|
-
}
|
|
324509
|
-
function entryIndent(entry) {
|
|
324510
|
-
return lineIndent2(entry.side.source, entry.start);
|
|
324511
|
-
}
|
|
324512
|
-
function isMultiline(container) {
|
|
324513
|
-
const [first] = container.entries;
|
|
324514
|
-
return first !== void 0 && container.side.source.slice(container.node.start, first.start).includes("\n");
|
|
324515
|
-
}
|
|
324516
|
-
function containerLayout(ctx, ours, theirs) {
|
|
324517
|
-
const { source } = ours.side;
|
|
324518
|
-
const { node, entries } = ours;
|
|
324519
|
-
const isObject = node.type === "ObjectExpression";
|
|
324520
|
-
if (entries.length === 0) {
|
|
324521
|
-
const multiline2 = isMultiline(theirs);
|
|
324522
|
-
const outer = lineIndent2(source, node.start);
|
|
324523
|
-
const indent2 = multiline2 ? `${outer}${ctx.unit}` : outer;
|
|
324524
|
-
const padding = isObject ? " " : "";
|
|
324525
|
-
return {
|
|
324526
|
-
indent: indent2,
|
|
324527
|
-
first: multiline2 ? `${ctx.newline}${indent2}` : padding,
|
|
324528
|
-
last: multiline2 ? `${ctx.newline}${outer}` : padding,
|
|
324529
|
-
between: [],
|
|
324530
|
-
separator: multiline2 ? `,${ctx.newline}${indent2}` : ", "
|
|
324531
|
-
};
|
|
324532
|
-
}
|
|
324533
|
-
const multiline = isMultiline(ours);
|
|
324534
|
-
const indent = multiline ? entryIndent(entries[0]) : lineIndent2(source, node.start);
|
|
324535
|
-
const between = entries.map((entry, index3) => index3 === 0 ? null : source.slice(entries[index3 - 1].end, entry.start));
|
|
324536
|
-
return {
|
|
324537
|
-
indent,
|
|
324538
|
-
first: source.slice(node.start + 1, entries[0].start),
|
|
324539
|
-
last: source.slice(entries.at(-1).end, node.end - 1),
|
|
324540
|
-
between,
|
|
324541
|
-
separator: multiline ? `,${ctx.newline}${indent}` : ", "
|
|
324542
|
-
};
|
|
324543
|
-
}
|
|
324544
|
-
function conflictBlock(ctx, { ours, base, hasBase, theirs }) {
|
|
324545
|
-
const lines = [`<<<<<<< ${ctx.labels.ours}`];
|
|
324546
|
-
if (ours !== null) {
|
|
324547
|
-
lines.push(ours);
|
|
324548
|
-
}
|
|
324549
|
-
if (hasBase) {
|
|
324550
|
-
lines.push(`||||||| ${ctx.labels.base}`);
|
|
324551
|
-
if (base !== null) {
|
|
324552
|
-
lines.push(base);
|
|
324553
|
-
}
|
|
324554
|
-
}
|
|
324555
|
-
lines.push("=======");
|
|
324556
|
-
if (theirs !== null) {
|
|
324557
|
-
lines.push(theirs);
|
|
324558
|
-
}
|
|
324559
|
-
lines.push(`>>>>>>> ${ctx.labels.theirs}`);
|
|
324560
|
-
return lines.join(ctx.newline);
|
|
324561
|
-
}
|
|
324562
|
-
function renderContainer(ctx, ours, layout, items) {
|
|
324563
|
-
const { source } = ours.side;
|
|
324564
|
-
const { node, entries } = ours;
|
|
324565
|
-
if (items.length === 0) {
|
|
324566
|
-
return entries.length === 0 ? source.slice(node.start, node.end) : `${source[node.start]}${source[node.end - 1]}`;
|
|
324567
|
-
}
|
|
324568
|
-
let text2 = source[node.start];
|
|
324569
|
-
let separator = layout.first;
|
|
324570
|
-
for (const [position, item] of items.entries()) {
|
|
324571
|
-
if (item.type === "conflict") {
|
|
324572
|
-
text2 += separator.replace(/[ \t]+$/, "");
|
|
324573
|
-
if (!text2.endsWith("\n")) {
|
|
324574
|
-
text2 += ctx.newline;
|
|
324575
|
-
}
|
|
324576
|
-
text2 += item.text;
|
|
324577
|
-
} else {
|
|
324578
|
-
text2 += `${separator}${item.text}`;
|
|
324579
|
-
}
|
|
324580
|
-
if (position === items.length - 1) {
|
|
324581
|
-
separator = layout.last;
|
|
324582
|
-
} else if (item.index !== null && item.index < entries.length - 1) {
|
|
324583
|
-
separator = layout.between[item.index + 1];
|
|
324584
|
-
} else {
|
|
324585
|
-
separator = layout.separator;
|
|
324586
|
-
}
|
|
324587
|
-
if (item.type === "conflict") {
|
|
324588
|
-
separator = separator.replace(",", "");
|
|
324589
|
-
if (!/^[ \t]*\r?\n/.test(separator)) {
|
|
324590
|
-
separator = `${ctx.newline}${separator.replace(/^[ \t]+/, "")}`;
|
|
324591
|
-
}
|
|
324592
|
-
}
|
|
324593
|
-
}
|
|
324594
|
-
return `${text2}${separator}${source[node.end - 1]}`;
|
|
324595
|
-
}
|
|
324596
|
-
function mergeContainer(ctx, { base, ours, theirs }, { label, same, nested = () => null }) {
|
|
324597
|
-
const byKey = (container) => new Map((container?.entries ?? []).map((entry) => [entry.key, entry]));
|
|
324598
|
-
const baseEntries = byKey(base);
|
|
324599
|
-
const oursEntries = byKey(ours);
|
|
324600
|
-
const theirsEntries = byKey(theirs);
|
|
324601
|
-
const layout = containerLayout(ctx, ours, theirs);
|
|
324602
|
-
const section = (entry) => `${layout.indent}${reindent(ctx, entry, layout.indent)},`;
|
|
324603
|
-
const items = /* @__PURE__ */ new Map();
|
|
324604
|
-
for (const key of /* @__PURE__ */ new Set([...oursEntries.keys(), ...theirsEntries.keys()])) {
|
|
324605
|
-
const baseEntry = baseEntries.get(key);
|
|
324606
|
-
const oursEntry = oursEntries.get(key);
|
|
324607
|
-
const theirsEntry = theirsEntries.get(key);
|
|
324608
|
-
const decision = decide(baseEntry, oursEntry, theirsEntry, same);
|
|
324609
|
-
const index3 = oursEntry?.index ?? null;
|
|
324610
|
-
if (decision === "ours") {
|
|
324611
|
-
items.set(key, { type: "entry", index: index3, text: entryText(oursEntry) });
|
|
324612
|
-
} else if (decision === "theirs") {
|
|
324613
|
-
items.set(key, { type: "entry", index: index3, text: reindent(ctx, theirsEntry, layout.indent) });
|
|
324614
|
-
} else if (decision === "conflict") {
|
|
324615
|
-
const merged = oursEntry !== void 0 && theirsEntry !== void 0 ? nested(key, baseEntry, oursEntry, theirsEntry) : null;
|
|
324616
|
-
if (merged !== null) {
|
|
324617
|
-
items.set(key, { type: "entry", index: index3, text: merged });
|
|
324618
|
-
continue;
|
|
324619
|
-
}
|
|
324620
|
-
ctx.conflicts.push(label(key));
|
|
324621
|
-
items.set(key, {
|
|
324622
|
-
type: "conflict",
|
|
324623
|
-
index: index3,
|
|
324624
|
-
text: conflictBlock(ctx, {
|
|
324625
|
-
ours: oursEntry === void 0 ? null : section(oursEntry),
|
|
324626
|
-
hasBase: baseEntry !== void 0,
|
|
324627
|
-
base: baseEntry === void 0 ? null : section(baseEntry),
|
|
324628
|
-
theirs: theirsEntry === void 0 ? null : section(theirsEntry)
|
|
324629
|
-
})
|
|
324630
|
-
});
|
|
324631
|
-
}
|
|
324632
|
-
}
|
|
324633
|
-
const order = ours.entries.map((entry) => entry.key).filter((key) => items.has(key));
|
|
324634
|
-
for (const [position, entry] of theirs.entries.entries()) {
|
|
324635
|
-
if (oursEntries.has(entry.key) || !items.has(entry.key)) {
|
|
324636
|
-
continue;
|
|
324637
|
-
}
|
|
324638
|
-
let at = 0;
|
|
324639
|
-
for (let previous = position - 1; previous >= 0; previous--) {
|
|
324640
|
-
const found2 = order.indexOf(theirs.entries[previous].key);
|
|
324641
|
-
if (found2 !== -1) {
|
|
324642
|
-
at = found2 + 1;
|
|
324643
|
-
break;
|
|
324644
|
-
}
|
|
324645
|
-
}
|
|
324646
|
-
while (at < order.length && !theirsEntries.has(order[at])) {
|
|
324647
|
-
at++;
|
|
324648
|
-
}
|
|
324649
|
-
order.splice(at, 0, entry.key);
|
|
324650
|
-
}
|
|
324651
|
-
return renderContainer(
|
|
324652
|
-
ctx,
|
|
324653
|
-
ours,
|
|
324654
|
-
layout,
|
|
324655
|
-
order.map((key) => items.get(key))
|
|
324656
|
-
);
|
|
324657
|
-
}
|
|
324658
|
-
function sameEntryText() {
|
|
324659
|
-
const cache2 = /* @__PURE__ */ new Map();
|
|
324660
|
-
const text2 = (entry) => {
|
|
324661
|
-
if (!cache2.has(entry)) {
|
|
324662
|
-
cache2.set(entry, normalizedText(entry.side, entry.start, entry.end));
|
|
324663
|
-
}
|
|
324664
|
-
return cache2.get(entry);
|
|
324665
|
-
};
|
|
324666
|
-
return (left, right) => text2(left) === text2(right);
|
|
324667
|
-
}
|
|
324668
|
-
function mergeNestedOption(ctx, sides, key, baseEntry, oursEntry, theirsEntry) {
|
|
324669
|
-
const values = [baseEntry?.value, oursEntry.value, theirsEntry.value].filter((value) => value !== void 0);
|
|
324670
|
-
const kind = nestedKind(key, values);
|
|
324671
|
-
if (kind === null) {
|
|
324672
|
-
return null;
|
|
324673
|
-
}
|
|
324674
|
-
const keyOf = KEY_READERS[kind];
|
|
324675
|
-
const containers = {
|
|
324676
|
-
base: baseEntry === void 0 ? null : containerOf(sides.base, baseEntry.value, keyOf),
|
|
324677
|
-
ours: containerOf(sides.ours, oursEntry.value, keyOf),
|
|
324678
|
-
theirs: containerOf(sides.theirs, theirsEntry.value, keyOf)
|
|
324679
|
-
};
|
|
324680
|
-
if (containers.ours === null || containers.theirs === null || baseEntry !== void 0 && containers.base === null) {
|
|
324681
|
-
return null;
|
|
324682
|
-
}
|
|
324683
|
-
const same = kind === "strings" ? () => true : sameEntryText();
|
|
324684
|
-
const merged = mergeContainer(ctx, containers, { label: (entryKey) => `${key}.${entryKey}`, same });
|
|
324685
|
-
const { source } = sides.ours;
|
|
324686
|
-
return `${source.slice(oursEntry.start, oursEntry.value.start)}${merged}${source.slice(oursEntry.value.end, oursEntry.end)}`;
|
|
324687
|
-
}
|
|
324688
|
-
function mergeOutside(ctx, sides, range, label) {
|
|
324689
|
-
const versions = {};
|
|
324690
|
-
for (const name of ["base", "ours", "theirs"]) {
|
|
324691
|
-
const side = sides[name];
|
|
324692
|
-
if (side !== null) {
|
|
324693
|
-
const [start, end] = range(side);
|
|
324694
|
-
versions[name] = { text: side.source.slice(start, end), normalized: normalizedText(side, start, end) };
|
|
324695
|
-
}
|
|
324696
|
-
}
|
|
324697
|
-
const decision = decide(versions.base, versions.ours, versions.theirs, (left, right) => left.normalized === right.normalized);
|
|
324698
|
-
if (decision === "ours") {
|
|
324699
|
-
return { text: versions.ours.text, conflict: false };
|
|
324700
|
-
}
|
|
324701
|
-
if (decision === "theirs") {
|
|
324702
|
-
return { text: versions.theirs.text, conflict: false };
|
|
324703
|
-
}
|
|
324704
|
-
ctx.conflicts.push(label);
|
|
324705
|
-
const trimmed = (version) => version.text.replace(/\r?\n$/, "");
|
|
324706
|
-
return {
|
|
324707
|
-
text: conflictBlock(ctx, {
|
|
324708
|
-
ours: trimmed(versions.ours),
|
|
324709
|
-
hasBase: versions.base !== void 0,
|
|
324710
|
-
base: versions.base === void 0 ? null : trimmed(versions.base),
|
|
324711
|
-
theirs: trimmed(versions.theirs)
|
|
324712
|
-
}),
|
|
324713
|
-
conflict: true
|
|
324714
|
-
};
|
|
324715
|
-
}
|
|
324716
|
-
function indentUnit(side) {
|
|
324717
|
-
const { container, source } = side;
|
|
324718
|
-
if (!isMultiline(container)) {
|
|
324719
|
-
return " ";
|
|
324720
|
-
}
|
|
324721
|
-
const outer = lineIndent2(source, container.node.start);
|
|
324722
|
-
const inner = entryIndent(container.entries[0]);
|
|
324723
|
-
return inner.startsWith(outer) && inner.length > outer.length ? inner.slice(outer.length) : " ";
|
|
324724
|
-
}
|
|
324725
|
-
function mergeResourceSource({ base, ours, theirs }, { oursLabel = "branch", baseLabel = "base", theirsLabel = "main" } = {}) {
|
|
324726
|
-
if (ours === theirs || base === theirs) {
|
|
324727
|
-
return { status: "merged", content: ours };
|
|
324728
|
-
}
|
|
324729
|
-
if (base === ours) {
|
|
324730
|
-
return { status: "merged", content: theirs };
|
|
324731
|
-
}
|
|
324732
|
-
const sides = { base: base === null ? null : readSide(base), ours: readSide(ours), theirs: readSide(theirs) };
|
|
324733
|
-
if (sides.ours === null || sides.theirs === null || base !== null && sides.base === null) {
|
|
324734
|
-
return { status: "unsupported" };
|
|
324735
|
-
}
|
|
324736
|
-
const ctx = {
|
|
324737
|
-
conflicts: [],
|
|
324738
|
-
labels: { ours: oursLabel, base: baseLabel, theirs: theirsLabel },
|
|
324739
|
-
newline: ours.includes("\r\n") ? "\r\n" : "\n",
|
|
324740
|
-
unit: sides.ours.unit
|
|
324741
|
-
};
|
|
324742
|
-
const containers = { base: sides.base?.container ?? null, ours: sides.ours.container, theirs: sides.theirs.container };
|
|
324743
|
-
const before = mergeOutside(ctx, sides, (side) => [0, side.object.start], "module code before defineResource");
|
|
324744
|
-
const object = mergeContainer(ctx, containers, {
|
|
324745
|
-
label: (key) => key,
|
|
324746
|
-
same: sameEntryText(),
|
|
324747
|
-
nested: (key, baseEntry, oursEntry, theirsEntry) => mergeNestedOption(ctx, sides, key, baseEntry, oursEntry, theirsEntry)
|
|
324748
|
-
});
|
|
324749
|
-
const after = mergeOutside(ctx, sides, (side) => [side.object.end, side.source.length], "module code after defineResource");
|
|
324750
|
-
const content = [
|
|
324751
|
-
before.conflict ? `${before.text}${ctx.newline}` : before.text,
|
|
324752
|
-
object,
|
|
324753
|
-
after.conflict ? `${ctx.newline}${after.text}${ctx.newline}` : after.text
|
|
324754
|
-
].join("");
|
|
324755
|
-
if (ctx.conflicts.length > 0) {
|
|
324756
|
-
return { status: "conflict", content, conflicts: ctx.conflicts };
|
|
324757
|
-
}
|
|
324758
|
-
return readSide(content) === null ? { status: "unsupported" } : { status: "merged", content };
|
|
324759
|
-
}
|
|
324760
|
-
|
|
324761
|
-
// scripts/lib/runtime-build/git-cli.mjs
|
|
324762
|
-
var MERGE_DRIVER_USAGE = "Usage: diagonal merge-driver <base> <ours> <theirs> [path]";
|
|
324763
|
-
var GIT_SETUP_USAGE = "Usage: diagonal git setup";
|
|
324764
|
-
var DRIVER = "diagonal-resource";
|
|
324765
|
-
var DRIVER_COMMAND = "npx --no-install diagonal merge-driver %O %A %B %P";
|
|
324766
|
-
var ATTRIBUTES_LINE = `resources/*.ts merge=${DRIVER}`;
|
|
324767
|
-
var LABELS = { oursLabel: "branch", baseLabel: "base", theirsLabel: "main" };
|
|
324768
|
-
function git(args, cwd) {
|
|
324769
|
-
return spawnSync3("git", args, { cwd, encoding: "utf8" });
|
|
324770
|
-
}
|
|
324771
|
-
function lineMerge(base, ours, theirs, { cwd, stderr }) {
|
|
324772
|
-
const result = git(
|
|
324773
|
-
["merge-file", "--diff3", "-L", LABELS.oursLabel, "-L", LABELS.baseLabel, "-L", LABELS.theirsLabel, ours, base, theirs],
|
|
324774
|
-
cwd
|
|
324775
|
-
);
|
|
324776
|
-
if (result.error !== void 0 || result.status === null) {
|
|
324777
|
-
stderr.write(`git merge-file did not run: ${result.error?.message ?? result.signal}
|
|
324778
|
-
`);
|
|
324779
|
-
return 2;
|
|
324780
|
-
}
|
|
324781
|
-
return result.status;
|
|
324782
|
-
}
|
|
324783
|
-
function mergeDriver(args, { cwd, stderr }) {
|
|
324784
|
-
if (args.length < 3 || args.length > 4) {
|
|
324785
|
-
stderr.write(`${MERGE_DRIVER_USAGE}
|
|
324786
|
-
`);
|
|
324787
|
-
return 2;
|
|
324788
|
-
}
|
|
324789
|
-
const [base, ours, theirs] = args.slice(0, 3).map((file2) => resolve6(cwd, file2));
|
|
324790
|
-
const path = args[3];
|
|
324791
|
-
if (path === void 0 || !isResourceFilePath(path)) {
|
|
324792
|
-
return lineMerge(base, ours, theirs, { cwd, stderr });
|
|
324793
|
-
}
|
|
324794
|
-
const baseSource = readFileSync15(base, "utf8");
|
|
324795
|
-
const result = mergeResourceSource(
|
|
324796
|
-
{ base: baseSource === "" ? null : baseSource, ours: readFileSync15(ours, "utf8"), theirs: readFileSync15(theirs, "utf8") },
|
|
324797
|
-
LABELS
|
|
324798
|
-
);
|
|
324799
|
-
if (result.status === "unsupported") {
|
|
324800
|
-
return lineMerge(base, ours, theirs, { cwd, stderr });
|
|
324801
|
-
}
|
|
324802
|
-
writeFileSync6(ours, result.content);
|
|
324803
|
-
if (result.status === "conflict") {
|
|
324804
|
-
stderr.write(`${path}: conflict in ${result.conflicts.join(", ")}
|
|
324805
|
-
`);
|
|
324806
|
-
return 1;
|
|
324807
|
-
}
|
|
324808
|
-
return 0;
|
|
324809
|
-
}
|
|
324810
|
-
function gitSetup(args, { cwd, stdout, stderr }) {
|
|
324811
|
-
if (args.length > 0) {
|
|
324812
|
-
stderr.write(`${GIT_SETUP_USAGE}
|
|
324813
|
-
`);
|
|
324814
|
-
return 2;
|
|
324815
|
-
}
|
|
324816
|
-
const topLevel = git(["rev-parse", "--show-toplevel"], cwd);
|
|
324817
|
-
if (topLevel.status !== 0) {
|
|
324818
|
-
stderr.write("Run this command in a git repository.\n");
|
|
324819
|
-
return 2;
|
|
324820
|
-
}
|
|
324821
|
-
const root = topLevel.stdout.trim();
|
|
324822
|
-
for (const [key, value] of [
|
|
324823
|
-
[`merge.${DRIVER}.name`, "Diagonal resource merge"],
|
|
324824
|
-
[`merge.${DRIVER}.driver`, DRIVER_COMMAND]
|
|
324825
|
-
]) {
|
|
324826
|
-
const result = git(["config", key, value], root);
|
|
324827
|
-
if (result.status !== 0) {
|
|
324828
|
-
stderr.write(`git config ${key} failed: ${result.stderr.trim()}
|
|
324829
|
-
`);
|
|
324830
|
-
return 1;
|
|
324831
|
-
}
|
|
324832
|
-
}
|
|
324833
|
-
const attributesPath = join19(root, ".gitattributes");
|
|
324834
|
-
let attributes = "";
|
|
324835
|
-
try {
|
|
324836
|
-
attributes = readFileSync15(attributesPath, "utf8");
|
|
324837
|
-
} catch (error) {
|
|
324838
|
-
if (error.code !== "ENOENT") {
|
|
324839
|
-
throw error;
|
|
324840
|
-
}
|
|
324841
|
-
}
|
|
324842
|
-
stdout.write(`Registered the ${DRIVER} merge driver in the git config.
|
|
324843
|
-
`);
|
|
324844
|
-
if (attributes.split(/\r?\n/).some((line) => line.trim() === ATTRIBUTES_LINE)) {
|
|
324845
|
-
return 0;
|
|
324846
|
-
}
|
|
324847
|
-
const separator = attributes === "" || attributes.endsWith("\n") ? "" : "\n";
|
|
324848
|
-
writeFileSync6(attributesPath, `${attributes}${separator}${ATTRIBUTES_LINE}
|
|
324849
|
-
`);
|
|
324850
|
-
stdout.write(`Added "${ATTRIBUTES_LINE}" to .gitattributes. Commit .gitattributes.
|
|
324851
|
-
`);
|
|
324852
|
-
return 0;
|
|
324853
|
-
}
|
|
324854
|
-
|
|
324855
324470
|
// scripts/lib/runtime-build/migration-cli.mjs
|
|
324856
324471
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
324857
|
-
import { mkdirSync as mkdirSync4, readdirSync as readdirSync4, statSync as statSync5, writeFileSync as
|
|
324858
|
-
import { join as
|
|
324472
|
+
import { mkdirSync as mkdirSync4, readdirSync as readdirSync4, statSync as statSync5, writeFileSync as writeFileSync6 } from "node:fs";
|
|
324473
|
+
import { join as join19 } from "node:path";
|
|
324859
324474
|
var MIGRATION_USAGE = "Usage: diagonal make:migration <name>";
|
|
324860
324475
|
var NAME = /^[a-z0-9][a-z0-9_]{0,84}$/;
|
|
324861
324476
|
function makeMigration(args, { cwd, stdout, stderr }) {
|
|
@@ -324867,12 +324482,12 @@ ${MIGRATION_USAGE}
|
|
|
324867
324482
|
);
|
|
324868
324483
|
return 2;
|
|
324869
324484
|
}
|
|
324870
|
-
if (!statSync5(
|
|
324485
|
+
if (!statSync5(join19(cwd, "diagonal.config.ts"), { throwIfNoEntry: false })?.isFile()) {
|
|
324871
324486
|
stderr.write("Run this command in a workspace directory with diagonal.config.ts.\n");
|
|
324872
324487
|
return 2;
|
|
324873
324488
|
}
|
|
324874
324489
|
const name = args[0];
|
|
324875
|
-
const directory =
|
|
324490
|
+
const directory = join19(cwd, "migrations");
|
|
324876
324491
|
mkdirSync4(directory, { recursive: true });
|
|
324877
324492
|
const used = new Set(
|
|
324878
324493
|
readdirSync4(directory).filter((file2) => file2.endsWith(".ts") && !file2.endsWith(".test.ts")).map((file2) => migrationTimestamp(file2.slice(0, -3))).filter((timestamp2) => timestamp2 !== null)
|
|
@@ -324896,7 +324511,7 @@ export default defineWorkflow(
|
|
|
324896
324511
|
async () => {}
|
|
324897
324512
|
);
|
|
324898
324513
|
`;
|
|
324899
|
-
|
|
324514
|
+
writeFileSync6(join19(cwd, path), source, { flag: "wx" });
|
|
324900
324515
|
stdout.write(`Created ${path}
|
|
324901
324516
|
`);
|
|
324902
324517
|
return 0;
|
|
@@ -324912,9 +324527,7 @@ var USAGE = [
|
|
|
324912
324527
|
RUN_USAGE,
|
|
324913
324528
|
LOGS_USAGE,
|
|
324914
324529
|
ASSETS_UPLOAD_USAGE,
|
|
324915
|
-
ASSETS_LIST_USAGE
|
|
324916
|
-
MERGE_DRIVER_USAGE,
|
|
324917
|
-
GIT_SETUP_USAGE
|
|
324530
|
+
ASSETS_LIST_USAGE
|
|
324918
324531
|
].join("\n");
|
|
324919
324532
|
function plural(count, word) {
|
|
324920
324533
|
return `${count} ${word}${count === 1 ? "" : "s"}`;
|
|
@@ -324948,7 +324561,7 @@ ${CHECK_USAGE}
|
|
|
324948
324561
|
`);
|
|
324949
324562
|
return 2;
|
|
324950
324563
|
}
|
|
324951
|
-
const root =
|
|
324564
|
+
const root = resolve6(cwd, parsed.dir);
|
|
324952
324565
|
if (!statSync6(root, { throwIfNoEntry: false })?.isDirectory()) {
|
|
324953
324566
|
stderr.write(`Not a directory: ${root}
|
|
324954
324567
|
`);
|
|
@@ -324986,15 +324599,6 @@ async function main(argv, io) {
|
|
|
324986
324599
|
if (subcommand === "list") return listAssets(assetArgs, io);
|
|
324987
324600
|
io.stderr.write(`${ASSETS_UPLOAD_USAGE}
|
|
324988
324601
|
${ASSETS_LIST_USAGE}
|
|
324989
|
-
`);
|
|
324990
|
-
return 2;
|
|
324991
|
-
}
|
|
324992
|
-
case "merge-driver":
|
|
324993
|
-
return mergeDriver(args, io);
|
|
324994
|
-
case "git": {
|
|
324995
|
-
const [subcommand, ...gitArgs] = args;
|
|
324996
|
-
if (subcommand === "setup") return gitSetup(gitArgs, io);
|
|
324997
|
-
io.stderr.write(`${GIT_SETUP_USAGE}
|
|
324998
324602
|
`);
|
|
324999
324603
|
return 2;
|
|
325000
324604
|
}
|