@diagonal-hq/cli 0.22.0 → 0.22.1
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 +23 -0
- package/dist/cli.mjs +762 -164
- 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: () => isComment2,
|
|
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 lineStart2 = 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(lineStart2);
|
|
19734
|
+
lineStart2 = pos;
|
|
19735
19735
|
break;
|
|
19736
19736
|
default:
|
|
19737
19737
|
if (ch > 127 && isLineBreak(ch)) {
|
|
19738
|
-
result.push(
|
|
19739
|
-
|
|
19738
|
+
result.push(lineStart2);
|
|
19739
|
+
lineStart2 = pos;
|
|
19740
19740
|
}
|
|
19741
19741
|
break;
|
|
19742
19742
|
}
|
|
19743
19743
|
}
|
|
19744
|
-
result.push(
|
|
19744
|
+
result.push(lineStart2);
|
|
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, lineStart2) {
|
|
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: lineStart2, 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 lineStart2;
|
|
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
|
+
lineStart2 = linePos - output.length === 0;
|
|
28421
28421
|
} else {
|
|
28422
|
-
|
|
28422
|
+
lineStart2 = false;
|
|
28423
28423
|
}
|
|
28424
28424
|
}
|
|
28425
28425
|
function writeText(s) {
|
|
28426
28426
|
if (s && s.length) {
|
|
28427
|
-
if (
|
|
28427
|
+
if (lineStart2) {
|
|
28428
28428
|
s = getIndentString(indent3) + s;
|
|
28429
|
-
|
|
28429
|
+
lineStart2 = 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
|
+
lineStart2 = 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 (!lineStart2 || force) {
|
|
28465
28465
|
output += newLine;
|
|
28466
28466
|
lineCount++;
|
|
28467
28467
|
linePos = output.length;
|
|
28468
|
-
|
|
28468
|
+
lineStart2 = 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: () => lineStart2 ? indent3 * getIndentSize() : output.length - linePos,
|
|
28488
28488
|
getText: () => output,
|
|
28489
|
-
isAtStartOfLine: () =>
|
|
28489
|
+
isAtStartOfLine: () => lineStart2,
|
|
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 resolve8 = 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
|
+
resolve8
|
|
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()]), resolve8, 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 isMultiline2 = currentSourceFile && !nodeIsSynthesized(node) && getLineAndCharacterOfPosition(currentSourceFile, node.pos).line !== getLineAndCharacterOfPosition(currentSourceFile, node.end).line;
|
|
141001
|
+
if (isMultiline2) {
|
|
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 (isMultiline2) {
|
|
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 lineStart2 = 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(lineStart2, lineEnd);
|
|
143863
143863
|
lineContent = lineContent.trimEnd();
|
|
143864
143864
|
lineContent = lineContent.replace(/\t/g, " ");
|
|
143865
143865
|
context += indent3 + formatColorAndReset((i + 1 + "").padStart(gutterWidth), gutterStyleSequence) + gutterSeparator;
|
|
@@ -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 lineStart2 = 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
|
+
lineStart2 = pos;
|
|
151475
151475
|
continue;
|
|
151476
151476
|
}
|
|
151477
151477
|
break;
|
|
151478
151478
|
}
|
|
151479
|
-
const line = text2.substring(
|
|
151479
|
+
const line = text2.substring(lineStart2, lineEnd);
|
|
151480
151480
|
if (line.match(sourceMapCommentRegExp)) {
|
|
151481
|
-
text2 = text2.substring(0,
|
|
151481
|
+
text2 = text2.substring(0, lineStart2);
|
|
151482
151482
|
break;
|
|
151483
151483
|
} else if (!line.match(whitespaceOrMapCommentRegExp)) {
|
|
151484
151484
|
break;
|
|
151485
151485
|
}
|
|
151486
|
-
lineEnd =
|
|
151486
|
+
lineEnd = lineStart2;
|
|
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 isComment2(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 lineStart2;
|
|
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 (lineStart2) {
|
|
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
|
+
lineStart2 = 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
|
+
lineStart2 = true;
|
|
159088
159088
|
}
|
|
159089
159089
|
function resetWriter() {
|
|
159090
159090
|
displayParts = [];
|
|
159091
|
-
|
|
159091
|
+
lineStart2 = 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 lineStart2 = getLineStartPositionForPosition(position2, sourceFile);
|
|
187815
|
+
if (!/[^*|\s(/)]/.test(sourceFile.text.substring(lineStart2, position2))) {
|
|
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, position2) {
|
|
195293
195293
|
const { text: text2 } = sourceFile;
|
|
195294
|
-
const
|
|
195295
|
-
let pos =
|
|
195294
|
+
const lineStart2 = getLineStartPositionForPosition(position2, sourceFile);
|
|
195295
|
+
let pos = lineStart2;
|
|
195296
195296
|
for (; pos <= position2 && isWhiteSpaceSingleLine(text2.charCodeAt(pos)); pos++) ;
|
|
195297
|
-
return text2.slice(
|
|
195297
|
+
return text2.slice(lineStart2, pos);
|
|
195298
195298
|
}
|
|
195299
195299
|
function parameterDocComments(parameters, isJavaScriptFile, indentationStr, newLine) {
|
|
195300
195300
|
return parameters.map(({ name, dotDotDotToken }, i) => {
|
|
@@ -202982,7 +202982,7 @@ ${options2.prefix}` : "\n" : options2.prefix
|
|
|
202982
202982
|
}
|
|
202983
202983
|
function processTrivia(trivia, parent2, contextNode, dynamicIndentation) {
|
|
202984
202984
|
for (const triviaItem of trivia) {
|
|
202985
|
-
if (
|
|
202985
|
+
if (isComment2(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 @@ ${options2.prefix}` : "\n" : options2.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 && (isComment2(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 @@ ${options2.prefix}` : "\n" : options2.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 (isComment2(trivia.kind)) {
|
|
203152
203152
|
if (startPos < trivia.pos) {
|
|
203153
203153
|
trimTrailingWitespacesForPositions(startPos, trivia.pos - 1, previousRange);
|
|
203154
203154
|
}
|
|
@@ -203425,8 +203425,8 @@ ${options2.prefix}` : "\n" : options2.prefix
|
|
|
203425
203425
|
}
|
|
203426
203426
|
current--;
|
|
203427
203427
|
}
|
|
203428
|
-
const
|
|
203429
|
-
return findFirstNonWhitespaceColumn(
|
|
203428
|
+
const lineStart2 = getLineStartPositionForPosition(current, sourceFile);
|
|
203429
|
+
return findFirstNonWhitespaceColumn(lineStart2, current, sourceFile, options2);
|
|
203430
203430
|
}
|
|
203431
203431
|
function getSmartIndent(sourceFile, position2, precedingToken, lineAtPosition, assumeNewLineBeforeCloseBrace, options2) {
|
|
203432
203432
|
let previous;
|
|
@@ -203713,8 +203713,8 @@ ${options2.prefix}` : "\n" : options2.prefix
|
|
|
203713
203713
|
return -1;
|
|
203714
203714
|
}
|
|
203715
203715
|
function findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter, sourceFile, options2) {
|
|
203716
|
-
const
|
|
203717
|
-
return findFirstNonWhitespaceColumn(
|
|
203716
|
+
const lineStart2 = sourceFile.getPositionOfLineAndCharacter(lineAndCharacter.line, 0);
|
|
203717
|
+
return findFirstNonWhitespaceColumn(lineStart2, lineStart2 + lineAndCharacter.character, sourceFile, options2);
|
|
203718
203718
|
}
|
|
203719
203719
|
function findFirstNonWhitespaceCharacterAndColumn(startPos, endPos, sourceFile, options2) {
|
|
203720
203720
|
let character = 0;
|
|
@@ -205240,7 +205240,7 @@ ${options2.prefix}` : "\n" : options2.prefix
|
|
|
205240
205240
|
isCommaListExpression: () => isCommaListExpression,
|
|
205241
205241
|
isCommaSequence: () => isCommaSequence,
|
|
205242
205242
|
isCommaToken: () => isCommaToken,
|
|
205243
|
-
isComment: () =>
|
|
205243
|
+
isComment: () => isComment2,
|
|
205244
205244
|
isCommonJsExportPropertyAssignment: () => isCommonJsExportPropertyAssignment,
|
|
205245
205245
|
isCommonJsExportedExpression: () => isCommonJsExportedExpression,
|
|
205246
205246
|
isCompoundAssignment: () => isCompoundAssignment,
|
|
@@ -218987,8 +218987,8 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range
|
|
|
218987
218987
|
installPackage(options2) {
|
|
218988
218988
|
this.packageInstallId++;
|
|
218989
218989
|
const request2 = { kind: "installPackage", ...options2, 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((resolve8, reject) => {
|
|
218991
|
+
(this.packageInstalledPromise ?? (this.packageInstalledPromise = /* @__PURE__ */ new Map())).set(this.packageInstallId, { resolve: resolve8, 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 resolve8(input, base2) {
|
|
232596
232596
|
if (!input && !base2)
|
|
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 resolve8;
|
|
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 resolve8 = resolver2(mapUrl, sourceRoot);
|
|
232995
|
+
this.resolvedSources = sources.map(resolve8);
|
|
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 lineStart2 = 0;
|
|
233565
|
+
if (currentMapping !== lineStart2) {
|
|
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 - lineStart2;
|
|
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
|
+
lineStart2 = i + 1;
|
|
233581
|
+
if (currentMapping !== lineStart2) {
|
|
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 lineStart2 = 0;
|
|
233595
233595
|
for (let i = 0; i < code2.length; i++) {
|
|
233596
233596
|
if (i === currentMapping) {
|
|
233597
|
-
sourceColumns[tokenIndex] = currentMapping -
|
|
233597
|
+
sourceColumns[tokenIndex] = currentMapping - lineStart2;
|
|
233598
233598
|
tokenIndex++;
|
|
233599
233599
|
currentMapping = tokens[tokenIndex].start;
|
|
233600
233600
|
}
|
|
233601
233601
|
if (code2.charCodeAt(i) === _charcodes.charCodes.lineFeed) {
|
|
233602
|
-
|
|
233602
|
+
lineStart2 = i + 1;
|
|
233603
233603
|
}
|
|
233604
233604
|
}
|
|
233605
233605
|
return sourceColumns;
|
|
@@ -251803,7 +251803,7 @@ interface String {
|
|
|
251803
251803
|
// scripts/lib/runtime-build/check-cli.mjs
|
|
251804
251804
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
251805
251805
|
import { statSync as statSync6 } from "node:fs";
|
|
251806
|
-
import { resolve as
|
|
251806
|
+
import { resolve as resolve7 } from "node:path";
|
|
251807
251807
|
|
|
251808
251808
|
// scripts/lib/runtime-build/api-cli.mjs
|
|
251809
251809
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
@@ -253774,9 +253774,9 @@ var isAllowedNumericSeparatorSibling = {
|
|
|
253774
253774
|
dec: (ch) => ch >= 48 && ch <= 57,
|
|
253775
253775
|
hex: (ch) => ch >= 48 && ch <= 57 || ch >= 65 && ch <= 70 || ch >= 97 && ch <= 102
|
|
253776
253776
|
};
|
|
253777
|
-
function readStringContents(type, input, pos,
|
|
253777
|
+
function readStringContents(type, input, pos, lineStart2, curLine, errors) {
|
|
253778
253778
|
const initialPos = pos;
|
|
253779
|
-
const initialLineStart =
|
|
253779
|
+
const initialLineStart = lineStart2;
|
|
253780
253780
|
const initialCurLine = curLine;
|
|
253781
253781
|
let out = "";
|
|
253782
253782
|
let firstInvalidLoc = null;
|
|
@@ -253797,11 +253797,11 @@ function readStringContents(type, input, pos, lineStart, curLine, errors) {
|
|
|
253797
253797
|
}
|
|
253798
253798
|
if (ch === 92) {
|
|
253799
253799
|
out += input.slice(chunkStart, pos);
|
|
253800
|
-
const res = readEscapedChar(input, pos,
|
|
253800
|
+
const res = readEscapedChar(input, pos, lineStart2, curLine, type === "template", errors);
|
|
253801
253801
|
if (res.ch === null && !firstInvalidLoc) {
|
|
253802
253802
|
firstInvalidLoc = {
|
|
253803
253803
|
pos,
|
|
253804
|
-
lineStart,
|
|
253804
|
+
lineStart: lineStart2,
|
|
253805
253805
|
curLine
|
|
253806
253806
|
};
|
|
253807
253807
|
} else {
|
|
@@ -253809,14 +253809,14 @@ function readStringContents(type, input, pos, lineStart, curLine, errors) {
|
|
|
253809
253809
|
}
|
|
253810
253810
|
({
|
|
253811
253811
|
pos,
|
|
253812
|
-
lineStart,
|
|
253812
|
+
lineStart: lineStart2,
|
|
253813
253813
|
curLine
|
|
253814
253814
|
} = res);
|
|
253815
253815
|
chunkStart = pos;
|
|
253816
253816
|
} else if (ch === 8232 || ch === 8233) {
|
|
253817
253817
|
++pos;
|
|
253818
253818
|
++curLine;
|
|
253819
|
-
|
|
253819
|
+
lineStart2 = pos;
|
|
253820
253820
|
} else if (ch === 10 || ch === 13) {
|
|
253821
253821
|
if (type === "template") {
|
|
253822
253822
|
out += input.slice(chunkStart, pos) + "\n";
|
|
@@ -253825,7 +253825,7 @@ function readStringContents(type, input, pos, lineStart, curLine, errors) {
|
|
|
253825
253825
|
++pos;
|
|
253826
253826
|
}
|
|
253827
253827
|
++curLine;
|
|
253828
|
-
chunkStart =
|
|
253828
|
+
chunkStart = lineStart2 = pos;
|
|
253829
253829
|
} else {
|
|
253830
253830
|
errors.unterminated(initialPos, initialLineStart, initialCurLine);
|
|
253831
253831
|
}
|
|
@@ -253837,7 +253837,7 @@ function readStringContents(type, input, pos, lineStart, curLine, errors) {
|
|
|
253837
253837
|
pos,
|
|
253838
253838
|
str: out,
|
|
253839
253839
|
firstInvalidLoc,
|
|
253840
|
-
lineStart,
|
|
253840
|
+
lineStart: lineStart2,
|
|
253841
253841
|
curLine
|
|
253842
253842
|
};
|
|
253843
253843
|
}
|
|
@@ -253847,13 +253847,13 @@ function isStringEnd(type, ch, input, pos) {
|
|
|
253847
253847
|
}
|
|
253848
253848
|
return ch === (type === "double" ? 34 : 39);
|
|
253849
253849
|
}
|
|
253850
|
-
function readEscapedChar(input, pos,
|
|
253850
|
+
function readEscapedChar(input, pos, lineStart2, curLine, inTemplate, errors) {
|
|
253851
253851
|
const throwOnInvalid = !inTemplate;
|
|
253852
253852
|
pos++;
|
|
253853
253853
|
const res = (ch2) => ({
|
|
253854
253854
|
pos,
|
|
253855
253855
|
ch: ch2,
|
|
253856
|
-
lineStart,
|
|
253856
|
+
lineStart: lineStart2,
|
|
253857
253857
|
curLine
|
|
253858
253858
|
});
|
|
253859
253859
|
const ch = input.charCodeAt(pos++);
|
|
@@ -253867,7 +253867,7 @@ function readEscapedChar(input, pos, lineStart, curLine, inTemplate, errors) {
|
|
|
253867
253867
|
({
|
|
253868
253868
|
code: code2,
|
|
253869
253869
|
pos
|
|
253870
|
-
} = readHexChar(input, pos,
|
|
253870
|
+
} = readHexChar(input, pos, lineStart2, curLine, 2, false, throwOnInvalid, errors));
|
|
253871
253871
|
return res(code2 === null ? null : String.fromCharCode(code2));
|
|
253872
253872
|
}
|
|
253873
253873
|
case 117: {
|
|
@@ -253875,7 +253875,7 @@ function readEscapedChar(input, pos, lineStart, curLine, inTemplate, errors) {
|
|
|
253875
253875
|
({
|
|
253876
253876
|
code: code2,
|
|
253877
253877
|
pos
|
|
253878
|
-
} = readCodePoint(input, pos,
|
|
253878
|
+
} = readCodePoint(input, pos, lineStart2, curLine, throwOnInvalid, errors));
|
|
253879
253879
|
return res(code2 === null ? null : String.fromCodePoint(code2));
|
|
253880
253880
|
}
|
|
253881
253881
|
case 116:
|
|
@@ -253891,7 +253891,7 @@ function readEscapedChar(input, pos, lineStart, curLine, inTemplate, errors) {
|
|
|
253891
253891
|
++pos;
|
|
253892
253892
|
}
|
|
253893
253893
|
case 10:
|
|
253894
|
-
|
|
253894
|
+
lineStart2 = pos;
|
|
253895
253895
|
++curLine;
|
|
253896
253896
|
case 8232:
|
|
253897
253897
|
case 8233:
|
|
@@ -253901,7 +253901,7 @@ function readEscapedChar(input, pos, lineStart, curLine, inTemplate, errors) {
|
|
|
253901
253901
|
if (inTemplate) {
|
|
253902
253902
|
return res(null);
|
|
253903
253903
|
} else {
|
|
253904
|
-
errors.strictNumericEscape(pos - 1,
|
|
253904
|
+
errors.strictNumericEscape(pos - 1, lineStart2, curLine);
|
|
253905
253905
|
}
|
|
253906
253906
|
default:
|
|
253907
253907
|
if (ch >= 48 && ch <= 55) {
|
|
@@ -253919,7 +253919,7 @@ function readEscapedChar(input, pos, lineStart, curLine, inTemplate, errors) {
|
|
|
253919
253919
|
if (inTemplate) {
|
|
253920
253920
|
return res(null);
|
|
253921
253921
|
} else {
|
|
253922
|
-
errors.strictNumericEscape(startPos,
|
|
253922
|
+
errors.strictNumericEscape(startPos, lineStart2, curLine);
|
|
253923
253923
|
}
|
|
253924
253924
|
}
|
|
253925
253925
|
return res(String.fromCharCode(octal));
|
|
@@ -253927,16 +253927,16 @@ function readEscapedChar(input, pos, lineStart, curLine, inTemplate, errors) {
|
|
|
253927
253927
|
return res(String.fromCharCode(ch));
|
|
253928
253928
|
}
|
|
253929
253929
|
}
|
|
253930
|
-
function readHexChar(input, pos,
|
|
253930
|
+
function readHexChar(input, pos, lineStart2, curLine, len, forceLen, throwOnInvalid, errors) {
|
|
253931
253931
|
const initialPos = pos;
|
|
253932
253932
|
let n;
|
|
253933
253933
|
({
|
|
253934
253934
|
n,
|
|
253935
253935
|
pos
|
|
253936
|
-
} = readInt(input, pos,
|
|
253936
|
+
} = readInt(input, pos, lineStart2, curLine, 16, len, forceLen, false, errors, !throwOnInvalid));
|
|
253937
253937
|
if (n === null) {
|
|
253938
253938
|
if (throwOnInvalid) {
|
|
253939
|
-
errors.invalidEscapeSequence(initialPos,
|
|
253939
|
+
errors.invalidEscapeSequence(initialPos, lineStart2, curLine);
|
|
253940
253940
|
} else {
|
|
253941
253941
|
pos = initialPos - 1;
|
|
253942
253942
|
}
|
|
@@ -253946,7 +253946,7 @@ function readHexChar(input, pos, lineStart, curLine, len, forceLen, throwOnInval
|
|
|
253946
253946
|
pos
|
|
253947
253947
|
};
|
|
253948
253948
|
}
|
|
253949
|
-
function readInt(input, pos,
|
|
253949
|
+
function readInt(input, pos, lineStart2, curLine, radix, len, forceLen, allowNumSeparator, errors, bailOnError) {
|
|
253950
253950
|
const start = pos;
|
|
253951
253951
|
const forbiddenSiblings = radix === 16 ? forbiddenNumericSeparatorSiblings.hex : forbiddenNumericSeparatorSiblings.decBinOct;
|
|
253952
253952
|
const isAllowedSibling = radix === 16 ? isAllowedNumericSeparatorSibling.hex : radix === 10 ? isAllowedNumericSeparatorSibling.dec : radix === 8 ? isAllowedNumericSeparatorSibling.oct : isAllowedNumericSeparatorSibling.bin;
|
|
@@ -253963,13 +253963,13 @@ function readInt(input, pos, lineStart, curLine, radix, len, forceLen, allowNumS
|
|
|
253963
253963
|
n: null,
|
|
253964
253964
|
pos
|
|
253965
253965
|
};
|
|
253966
|
-
errors.numericSeparatorInEscapeSequence(pos,
|
|
253966
|
+
errors.numericSeparatorInEscapeSequence(pos, lineStart2, curLine);
|
|
253967
253967
|
} else if (Number.isNaN(next) || !isAllowedSibling(next) || forbiddenSiblings.has(prev)) {
|
|
253968
253968
|
if (bailOnError) return {
|
|
253969
253969
|
n: null,
|
|
253970
253970
|
pos
|
|
253971
253971
|
};
|
|
253972
|
-
errors.unexpectedNumericSeparator(pos,
|
|
253972
|
+
errors.unexpectedNumericSeparator(pos, lineStart2, curLine);
|
|
253973
253973
|
}
|
|
253974
253974
|
++pos;
|
|
253975
253975
|
continue;
|
|
@@ -253989,7 +253989,7 @@ function readInt(input, pos, lineStart, curLine, radix, len, forceLen, allowNumS
|
|
|
253989
253989
|
n: null,
|
|
253990
253990
|
pos
|
|
253991
253991
|
};
|
|
253992
|
-
errors.invalidDigit(pos,
|
|
253992
|
+
errors.invalidDigit(pos, lineStart2, curLine, radix);
|
|
253993
253993
|
val = 0;
|
|
253994
253994
|
} else if (forceLen) {
|
|
253995
253995
|
val = 0;
|
|
@@ -254012,7 +254012,7 @@ function readInt(input, pos, lineStart, curLine, radix, len, forceLen, allowNumS
|
|
|
254012
254012
|
pos
|
|
254013
254013
|
};
|
|
254014
254014
|
}
|
|
254015
|
-
function readCodePoint(input, pos,
|
|
254015
|
+
function readCodePoint(input, pos, lineStart2, curLine, throwOnInvalid, errors) {
|
|
254016
254016
|
const ch = input.charCodeAt(pos);
|
|
254017
254017
|
let code2;
|
|
254018
254018
|
if (ch === 123) {
|
|
@@ -254020,11 +254020,11 @@ function readCodePoint(input, pos, lineStart, curLine, throwOnInvalid, errors) {
|
|
|
254020
254020
|
({
|
|
254021
254021
|
code: code2,
|
|
254022
254022
|
pos
|
|
254023
|
-
} = readHexChar(input, pos,
|
|
254023
|
+
} = readHexChar(input, pos, lineStart2, curLine, input.indexOf("}", pos) - pos, true, throwOnInvalid, errors));
|
|
254024
254024
|
++pos;
|
|
254025
254025
|
if (code2 !== null && code2 > 1114111) {
|
|
254026
254026
|
if (throwOnInvalid) {
|
|
254027
|
-
errors.invalidCodePoint(pos,
|
|
254027
|
+
errors.invalidCodePoint(pos, lineStart2, curLine);
|
|
254028
254028
|
} else {
|
|
254029
254029
|
return {
|
|
254030
254030
|
code: null,
|
|
@@ -254036,7 +254036,7 @@ function readCodePoint(input, pos, lineStart, curLine, throwOnInvalid, errors) {
|
|
|
254036
254036
|
({
|
|
254037
254037
|
code: code2,
|
|
254038
254038
|
pos
|
|
254039
|
-
} = readHexChar(input, pos,
|
|
254039
|
+
} = readHexChar(input, pos, lineStart2, curLine, 4, false, throwOnInvalid, errors));
|
|
254040
254040
|
}
|
|
254041
254041
|
return {
|
|
254042
254042
|
code: code2,
|
|
@@ -265196,8 +265196,8 @@ var TraceMap = class {
|
|
|
265196
265196
|
this.sources = sources;
|
|
265197
265197
|
this.sourcesContent = sourcesContent;
|
|
265198
265198
|
this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || void 0;
|
|
265199
|
-
const
|
|
265200
|
-
this.resolvedSources = sources.map(
|
|
265199
|
+
const resolve8 = resolver(mapUrl, sourceRoot);
|
|
265200
|
+
this.resolvedSources = sources.map(resolve8);
|
|
265201
265201
|
const { mappings } = parsed;
|
|
265202
265202
|
if (typeof mappings === "string") {
|
|
265203
265203
|
this._encoded = mappings;
|
|
@@ -276152,9 +276152,9 @@ var isAllowedNumericSeparatorSibling2 = {
|
|
|
276152
276152
|
dec: (ch) => ch >= 48 && ch <= 57,
|
|
276153
276153
|
hex: (ch) => ch >= 48 && ch <= 57 || ch >= 65 && ch <= 70 || ch >= 97 && ch <= 102
|
|
276154
276154
|
};
|
|
276155
|
-
function readStringContents2(type, input, pos,
|
|
276155
|
+
function readStringContents2(type, input, pos, lineStart2, curLine, errors) {
|
|
276156
276156
|
const initialPos = pos;
|
|
276157
|
-
const initialLineStart =
|
|
276157
|
+
const initialLineStart = lineStart2;
|
|
276158
276158
|
const initialCurLine = curLine;
|
|
276159
276159
|
let out = "";
|
|
276160
276160
|
let firstInvalidLoc = null;
|
|
@@ -276175,11 +276175,11 @@ function readStringContents2(type, input, pos, lineStart, curLine, errors) {
|
|
|
276175
276175
|
}
|
|
276176
276176
|
if (ch === 92) {
|
|
276177
276177
|
out += input.slice(chunkStart, pos);
|
|
276178
|
-
const res = readEscapedChar2(input, pos,
|
|
276178
|
+
const res = readEscapedChar2(input, pos, lineStart2, curLine, type === "template", errors);
|
|
276179
276179
|
if (res.ch === null && !firstInvalidLoc) {
|
|
276180
276180
|
firstInvalidLoc = {
|
|
276181
276181
|
pos,
|
|
276182
|
-
lineStart,
|
|
276182
|
+
lineStart: lineStart2,
|
|
276183
276183
|
curLine
|
|
276184
276184
|
};
|
|
276185
276185
|
} else {
|
|
@@ -276187,14 +276187,14 @@ function readStringContents2(type, input, pos, lineStart, curLine, errors) {
|
|
|
276187
276187
|
}
|
|
276188
276188
|
({
|
|
276189
276189
|
pos,
|
|
276190
|
-
lineStart,
|
|
276190
|
+
lineStart: lineStart2,
|
|
276191
276191
|
curLine
|
|
276192
276192
|
} = res);
|
|
276193
276193
|
chunkStart = pos;
|
|
276194
276194
|
} else if (ch === 8232 || ch === 8233) {
|
|
276195
276195
|
++pos;
|
|
276196
276196
|
++curLine;
|
|
276197
|
-
|
|
276197
|
+
lineStart2 = pos;
|
|
276198
276198
|
} else if (ch === 10 || ch === 13) {
|
|
276199
276199
|
if (type === "template") {
|
|
276200
276200
|
out += input.slice(chunkStart, pos) + "\n";
|
|
@@ -276203,7 +276203,7 @@ function readStringContents2(type, input, pos, lineStart, curLine, errors) {
|
|
|
276203
276203
|
++pos;
|
|
276204
276204
|
}
|
|
276205
276205
|
++curLine;
|
|
276206
|
-
chunkStart =
|
|
276206
|
+
chunkStart = lineStart2 = pos;
|
|
276207
276207
|
} else {
|
|
276208
276208
|
errors.unterminated(initialPos, initialLineStart, initialCurLine);
|
|
276209
276209
|
}
|
|
@@ -276215,7 +276215,7 @@ function readStringContents2(type, input, pos, lineStart, curLine, errors) {
|
|
|
276215
276215
|
pos,
|
|
276216
276216
|
str: out,
|
|
276217
276217
|
firstInvalidLoc,
|
|
276218
|
-
lineStart,
|
|
276218
|
+
lineStart: lineStart2,
|
|
276219
276219
|
curLine
|
|
276220
276220
|
};
|
|
276221
276221
|
}
|
|
@@ -276225,13 +276225,13 @@ function isStringEnd2(type, ch, input, pos) {
|
|
|
276225
276225
|
}
|
|
276226
276226
|
return ch === (type === "double" ? 34 : 39);
|
|
276227
276227
|
}
|
|
276228
|
-
function readEscapedChar2(input, pos,
|
|
276228
|
+
function readEscapedChar2(input, pos, lineStart2, curLine, inTemplate, errors) {
|
|
276229
276229
|
const throwOnInvalid = !inTemplate;
|
|
276230
276230
|
pos++;
|
|
276231
276231
|
const res = (ch2) => ({
|
|
276232
276232
|
pos,
|
|
276233
276233
|
ch: ch2,
|
|
276234
|
-
lineStart,
|
|
276234
|
+
lineStart: lineStart2,
|
|
276235
276235
|
curLine
|
|
276236
276236
|
});
|
|
276237
276237
|
const ch = input.charCodeAt(pos++);
|
|
@@ -276245,7 +276245,7 @@ function readEscapedChar2(input, pos, lineStart, curLine, inTemplate, errors) {
|
|
|
276245
276245
|
({
|
|
276246
276246
|
code: code2,
|
|
276247
276247
|
pos
|
|
276248
|
-
} = readHexChar2(input, pos,
|
|
276248
|
+
} = readHexChar2(input, pos, lineStart2, curLine, 2, false, throwOnInvalid, errors));
|
|
276249
276249
|
return res(code2 === null ? null : String.fromCharCode(code2));
|
|
276250
276250
|
}
|
|
276251
276251
|
case 117: {
|
|
@@ -276253,7 +276253,7 @@ function readEscapedChar2(input, pos, lineStart, curLine, inTemplate, errors) {
|
|
|
276253
276253
|
({
|
|
276254
276254
|
code: code2,
|
|
276255
276255
|
pos
|
|
276256
|
-
} = readCodePoint2(input, pos,
|
|
276256
|
+
} = readCodePoint2(input, pos, lineStart2, curLine, throwOnInvalid, errors));
|
|
276257
276257
|
return res(code2 === null ? null : String.fromCodePoint(code2));
|
|
276258
276258
|
}
|
|
276259
276259
|
case 116:
|
|
@@ -276269,7 +276269,7 @@ function readEscapedChar2(input, pos, lineStart, curLine, inTemplate, errors) {
|
|
|
276269
276269
|
++pos;
|
|
276270
276270
|
}
|
|
276271
276271
|
case 10:
|
|
276272
|
-
|
|
276272
|
+
lineStart2 = pos;
|
|
276273
276273
|
++curLine;
|
|
276274
276274
|
case 8232:
|
|
276275
276275
|
case 8233:
|
|
@@ -276279,7 +276279,7 @@ function readEscapedChar2(input, pos, lineStart, curLine, inTemplate, errors) {
|
|
|
276279
276279
|
if (inTemplate) {
|
|
276280
276280
|
return res(null);
|
|
276281
276281
|
} else {
|
|
276282
|
-
errors.strictNumericEscape(pos - 1,
|
|
276282
|
+
errors.strictNumericEscape(pos - 1, lineStart2, curLine);
|
|
276283
276283
|
}
|
|
276284
276284
|
default:
|
|
276285
276285
|
if (ch >= 48 && ch <= 55) {
|
|
@@ -276297,7 +276297,7 @@ function readEscapedChar2(input, pos, lineStart, curLine, inTemplate, errors) {
|
|
|
276297
276297
|
if (inTemplate) {
|
|
276298
276298
|
return res(null);
|
|
276299
276299
|
} else {
|
|
276300
|
-
errors.strictNumericEscape(startPos,
|
|
276300
|
+
errors.strictNumericEscape(startPos, lineStart2, curLine);
|
|
276301
276301
|
}
|
|
276302
276302
|
}
|
|
276303
276303
|
return res(String.fromCharCode(octal));
|
|
@@ -276305,16 +276305,16 @@ function readEscapedChar2(input, pos, lineStart, curLine, inTemplate, errors) {
|
|
|
276305
276305
|
return res(String.fromCharCode(ch));
|
|
276306
276306
|
}
|
|
276307
276307
|
}
|
|
276308
|
-
function readHexChar2(input, pos,
|
|
276308
|
+
function readHexChar2(input, pos, lineStart2, curLine, len, forceLen, throwOnInvalid, errors) {
|
|
276309
276309
|
const initialPos = pos;
|
|
276310
276310
|
let n;
|
|
276311
276311
|
({
|
|
276312
276312
|
n,
|
|
276313
276313
|
pos
|
|
276314
|
-
} = readInt2(input, pos,
|
|
276314
|
+
} = readInt2(input, pos, lineStart2, curLine, 16, len, forceLen, false, errors, !throwOnInvalid));
|
|
276315
276315
|
if (n === null) {
|
|
276316
276316
|
if (throwOnInvalid) {
|
|
276317
|
-
errors.invalidEscapeSequence(initialPos,
|
|
276317
|
+
errors.invalidEscapeSequence(initialPos, lineStart2, curLine);
|
|
276318
276318
|
} else {
|
|
276319
276319
|
pos = initialPos - 1;
|
|
276320
276320
|
}
|
|
@@ -276324,7 +276324,7 @@ function readHexChar2(input, pos, lineStart, curLine, len, forceLen, throwOnInva
|
|
|
276324
276324
|
pos
|
|
276325
276325
|
};
|
|
276326
276326
|
}
|
|
276327
|
-
function readInt2(input, pos,
|
|
276327
|
+
function readInt2(input, pos, lineStart2, curLine, radix, len, forceLen, allowNumSeparator, errors, bailOnError) {
|
|
276328
276328
|
const start = pos;
|
|
276329
276329
|
const forbiddenSiblings = radix === 16 ? forbiddenNumericSeparatorSiblings2.hex : forbiddenNumericSeparatorSiblings2.decBinOct;
|
|
276330
276330
|
const isAllowedSibling = radix === 16 ? isAllowedNumericSeparatorSibling2.hex : radix === 10 ? isAllowedNumericSeparatorSibling2.dec : radix === 8 ? isAllowedNumericSeparatorSibling2.oct : isAllowedNumericSeparatorSibling2.bin;
|
|
@@ -276341,13 +276341,13 @@ function readInt2(input, pos, lineStart, curLine, radix, len, forceLen, allowNum
|
|
|
276341
276341
|
n: null,
|
|
276342
276342
|
pos
|
|
276343
276343
|
};
|
|
276344
|
-
errors.numericSeparatorInEscapeSequence(pos,
|
|
276344
|
+
errors.numericSeparatorInEscapeSequence(pos, lineStart2, curLine);
|
|
276345
276345
|
} else if (Number.isNaN(next) || !isAllowedSibling(next) || forbiddenSiblings.has(prev)) {
|
|
276346
276346
|
if (bailOnError) return {
|
|
276347
276347
|
n: null,
|
|
276348
276348
|
pos
|
|
276349
276349
|
};
|
|
276350
|
-
errors.unexpectedNumericSeparator(pos,
|
|
276350
|
+
errors.unexpectedNumericSeparator(pos, lineStart2, curLine);
|
|
276351
276351
|
}
|
|
276352
276352
|
++pos;
|
|
276353
276353
|
continue;
|
|
@@ -276367,7 +276367,7 @@ function readInt2(input, pos, lineStart, curLine, radix, len, forceLen, allowNum
|
|
|
276367
276367
|
n: null,
|
|
276368
276368
|
pos
|
|
276369
276369
|
};
|
|
276370
|
-
errors.invalidDigit(pos,
|
|
276370
|
+
errors.invalidDigit(pos, lineStart2, curLine, radix);
|
|
276371
276371
|
val = 0;
|
|
276372
276372
|
} else if (forceLen) {
|
|
276373
276373
|
val = 0;
|
|
@@ -276390,7 +276390,7 @@ function readInt2(input, pos, lineStart, curLine, radix, len, forceLen, allowNum
|
|
|
276390
276390
|
pos
|
|
276391
276391
|
};
|
|
276392
276392
|
}
|
|
276393
|
-
function readCodePoint2(input, pos,
|
|
276393
|
+
function readCodePoint2(input, pos, lineStart2, curLine, throwOnInvalid, errors) {
|
|
276394
276394
|
const ch = input.charCodeAt(pos);
|
|
276395
276395
|
let code2;
|
|
276396
276396
|
if (ch === 123) {
|
|
@@ -276398,11 +276398,11 @@ function readCodePoint2(input, pos, lineStart, curLine, throwOnInvalid, errors)
|
|
|
276398
276398
|
({
|
|
276399
276399
|
code: code2,
|
|
276400
276400
|
pos
|
|
276401
|
-
} = readHexChar2(input, pos,
|
|
276401
|
+
} = readHexChar2(input, pos, lineStart2, curLine, input.indexOf("}", pos) - pos, true, throwOnInvalid, errors));
|
|
276402
276402
|
++pos;
|
|
276403
276403
|
if (code2 !== null && code2 > 1114111) {
|
|
276404
276404
|
if (throwOnInvalid) {
|
|
276405
|
-
errors.invalidCodePoint(pos,
|
|
276405
|
+
errors.invalidCodePoint(pos, lineStart2, curLine);
|
|
276406
276406
|
} else {
|
|
276407
276407
|
return {
|
|
276408
276408
|
code: null,
|
|
@@ -276414,15 +276414,15 @@ function readCodePoint2(input, pos, lineStart, curLine, throwOnInvalid, errors)
|
|
|
276414
276414
|
({
|
|
276415
276415
|
code: code2,
|
|
276416
276416
|
pos
|
|
276417
|
-
} = readHexChar2(input, pos,
|
|
276417
|
+
} = readHexChar2(input, pos, lineStart2, curLine, 4, false, throwOnInvalid, errors));
|
|
276418
276418
|
}
|
|
276419
276419
|
return {
|
|
276420
276420
|
code: code2,
|
|
276421
276421
|
pos
|
|
276422
276422
|
};
|
|
276423
276423
|
}
|
|
276424
|
-
function buildPosition(pos,
|
|
276425
|
-
return new Position(curLine, pos -
|
|
276424
|
+
function buildPosition(pos, lineStart2, curLine) {
|
|
276425
|
+
return new Position(curLine, pos - lineStart2, pos);
|
|
276426
276426
|
}
|
|
276427
276427
|
var VALID_REGEX_FLAGS = /* @__PURE__ */ new Set([103, 109, 115, 105, 121, 117, 100, 118]);
|
|
276428
276428
|
var Token = class {
|
|
@@ -277227,10 +277227,10 @@ var Tokenizer = class extends CommentsParser {
|
|
|
277227
277227
|
str,
|
|
277228
277228
|
pos,
|
|
277229
277229
|
curLine,
|
|
277230
|
-
lineStart
|
|
277230
|
+
lineStart: lineStart2
|
|
277231
277231
|
} = readStringContents2(quote === 34 ? "double" : "single", this.input, this.state.pos + 1, this.state.lineStart, this.state.curLine, this.errorHandlers_readStringContents_string);
|
|
277232
277232
|
this.state.pos = pos + 1;
|
|
277233
|
-
this.state.lineStart =
|
|
277233
|
+
this.state.lineStart = lineStart2;
|
|
277234
277234
|
this.state.curLine = curLine;
|
|
277235
277235
|
this.finishToken(131, str);
|
|
277236
277236
|
}
|
|
@@ -277248,10 +277248,10 @@ var Tokenizer = class extends CommentsParser {
|
|
|
277248
277248
|
firstInvalidLoc,
|
|
277249
277249
|
pos,
|
|
277250
277250
|
curLine,
|
|
277251
|
-
lineStart
|
|
277251
|
+
lineStart: lineStart2
|
|
277252
277252
|
} = readStringContents2("template", this.input, this.state.pos + 1, this.state.lineStart, this.state.curLine, this.errorHandlers_readStringContents_template);
|
|
277253
277253
|
this.state.pos = pos + 1;
|
|
277254
|
-
this.state.lineStart =
|
|
277254
|
+
this.state.lineStart = lineStart2;
|
|
277255
277255
|
this.state.curLine = curLine;
|
|
277256
277256
|
if (firstInvalidLoc) {
|
|
277257
277257
|
this.state.firstInvalidTemplateEscapePos = new Position(firstInvalidLoc.curLine, firstInvalidLoc.pos - firstInvalidLoc.lineStart, this.sourceToOffsetPos(firstInvalidLoc.pos));
|
|
@@ -277371,13 +277371,13 @@ var Tokenizer = class extends CommentsParser {
|
|
|
277371
277371
|
}
|
|
277372
277372
|
}
|
|
277373
277373
|
errorBuilder(error) {
|
|
277374
|
-
return (pos,
|
|
277375
|
-
this.raise(error, buildPosition(pos,
|
|
277374
|
+
return (pos, lineStart2, curLine) => {
|
|
277375
|
+
this.raise(error, buildPosition(pos, lineStart2, curLine));
|
|
277376
277376
|
};
|
|
277377
277377
|
}
|
|
277378
277378
|
errorHandlers_readInt = {
|
|
277379
|
-
invalidDigit: (pos,
|
|
277380
|
-
this.raise(Errors.InvalidDigit, buildPosition(pos,
|
|
277379
|
+
invalidDigit: (pos, lineStart2, curLine, radix) => {
|
|
277380
|
+
this.raise(Errors.InvalidDigit, buildPosition(pos, lineStart2, curLine), {
|
|
277381
277381
|
radix
|
|
277382
277382
|
});
|
|
277383
277383
|
},
|
|
@@ -277391,18 +277391,18 @@ var Tokenizer = class extends CommentsParser {
|
|
|
277391
277391
|
};
|
|
277392
277392
|
errorHandlers_readStringContents_string = {
|
|
277393
277393
|
...this.errorHandlers_readCodePoint,
|
|
277394
|
-
strictNumericEscape: (pos,
|
|
277395
|
-
this.recordStrictModeErrors(Errors.StrictNumericEscape, buildPosition(pos,
|
|
277394
|
+
strictNumericEscape: (pos, lineStart2, curLine) => {
|
|
277395
|
+
this.recordStrictModeErrors(Errors.StrictNumericEscape, buildPosition(pos, lineStart2, curLine));
|
|
277396
277396
|
},
|
|
277397
|
-
unterminated: (pos,
|
|
277398
|
-
throw this.raise(Errors.UnterminatedString, buildPosition(pos - 1,
|
|
277397
|
+
unterminated: (pos, lineStart2, curLine) => {
|
|
277398
|
+
throw this.raise(Errors.UnterminatedString, buildPosition(pos - 1, lineStart2, curLine));
|
|
277399
277399
|
}
|
|
277400
277400
|
};
|
|
277401
277401
|
errorHandlers_readStringContents_template = {
|
|
277402
277402
|
...this.errorHandlers_readCodePoint,
|
|
277403
277403
|
strictNumericEscape: this.errorBuilder(Errors.StrictNumericEscape),
|
|
277404
|
-
unterminated: (pos,
|
|
277405
|
-
throw this.raise(Errors.UnterminatedTemplate, buildPosition(pos,
|
|
277404
|
+
unterminated: (pos, lineStart2, curLine) => {
|
|
277405
|
+
throw this.raise(Errors.UnterminatedTemplate, buildPosition(pos, lineStart2, curLine));
|
|
277406
277406
|
}
|
|
277407
277407
|
};
|
|
277408
277408
|
};
|
|
@@ -291662,7 +291662,7 @@ function cssReferences(source) {
|
|
|
291662
291662
|
let composing = false;
|
|
291663
291663
|
let nextNewline = source.indexOf("\n");
|
|
291664
291664
|
let line = 1;
|
|
291665
|
-
let
|
|
291665
|
+
let lineStart2 = 0;
|
|
291666
291666
|
const skipSpace = () => {
|
|
291667
291667
|
while (offset < source.length) {
|
|
291668
291668
|
if (/\s/.test(source[offset])) {
|
|
@@ -291688,10 +291688,10 @@ function cssReferences(source) {
|
|
|
291688
291688
|
const add = (value, start) => {
|
|
291689
291689
|
while (nextNewline !== -1 && nextNewline < start) {
|
|
291690
291690
|
line++;
|
|
291691
|
-
|
|
291692
|
-
nextNewline = source.indexOf("\n",
|
|
291691
|
+
lineStart2 = nextNewline + 1;
|
|
291692
|
+
nextNewline = source.indexOf("\n", lineStart2);
|
|
291693
291693
|
}
|
|
291694
|
-
const column = start -
|
|
291694
|
+
const column = start - lineStart2 + 1;
|
|
291695
291695
|
(importing ? imports : urls).push({ value, line, column });
|
|
291696
291696
|
importing = false;
|
|
291697
291697
|
};
|
|
@@ -304820,8 +304820,8 @@ function offsetOf(text2, line, column) {
|
|
|
304820
304820
|
}
|
|
304821
304821
|
function positionOf(text2, offset) {
|
|
304822
304822
|
const before = text2.slice(0, offset);
|
|
304823
|
-
const
|
|
304824
|
-
return { line: before.split("\n").length, column: offset -
|
|
304823
|
+
const lineStart2 = before.lastIndexOf("\n") + 1;
|
|
304824
|
+
return { line: before.split("\n").length, column: offset - lineStart2 + 1 };
|
|
304825
304825
|
}
|
|
304826
304826
|
function memberName(node, object) {
|
|
304827
304827
|
if ((node?.type === "MemberExpression" || node?.type === "OptionalMemberExpression") && node.object === object && !node.computed && node.property.type === "Identifier") {
|
|
@@ -305582,8 +305582,8 @@ export default defineAssets({
|
|
|
305582
305582
|
}
|
|
305583
305583
|
const multiline = last2.loc.end.line < definition.loc.end.line;
|
|
305584
305584
|
if (multiline) {
|
|
305585
|
-
const
|
|
305586
|
-
const indent = source.slice(
|
|
305585
|
+
const lineStart2 = source.lastIndexOf("\n", last2.start - 1) + 1;
|
|
305586
|
+
const indent = source.slice(lineStart2, last2.start).match(/^[\t ]*/)[0];
|
|
305587
305587
|
if (!trailingComma) {
|
|
305588
305588
|
edits.push({ start: last2.end, text: "," });
|
|
305589
305589
|
}
|
|
@@ -305991,8 +305991,8 @@ function readUid(object, { version = null } = {}) {
|
|
|
305991
305991
|
}
|
|
305992
305992
|
function locationAt(source, offset) {
|
|
305993
305993
|
const before = source.slice(0, offset);
|
|
305994
|
-
const
|
|
305995
|
-
return { loc: { start: { line: before.split("\n").length, column: offset -
|
|
305994
|
+
const lineStart2 = before.lastIndexOf("\n") + 1;
|
|
305995
|
+
return { loc: { start: { line: before.split("\n").length, column: offset - lineStart2 } } };
|
|
305996
305996
|
}
|
|
305997
305997
|
function readFrontMatterUid(source, { map, offset }) {
|
|
305998
305998
|
const pair = map.items.find((item) => (0, import_yaml.isScalar)(item.key) && item.key.value === "uid") ?? null;
|
|
@@ -306075,9 +306075,9 @@ function uidInsertion(source, object, uid2) {
|
|
|
306075
306075
|
if (anchor.loc.start.line === object.loc.start.line) {
|
|
306076
306076
|
return { start: anchor.start, end: anchor.start, text: `${property}, ` };
|
|
306077
306077
|
}
|
|
306078
|
-
const
|
|
306079
|
-
const indent = source.slice(
|
|
306080
|
-
const newline = source[
|
|
306078
|
+
const lineStart2 = source.lastIndexOf("\n", anchor.start - 1) + 1;
|
|
306079
|
+
const indent = source.slice(lineStart2, anchor.start);
|
|
306080
|
+
const newline = source[lineStart2 - 2] === "\r" ? "\r\n" : "\n";
|
|
306081
306081
|
return { start: anchor.start, end: anchor.start, text: `${property},${newline}${indent}` };
|
|
306082
306082
|
}
|
|
306083
306083
|
function frontMatterUidInsertion(source, { map, offset }, uid2) {
|
|
@@ -319728,7 +319728,7 @@ var SUCRASE_OPTIONS = {
|
|
|
319728
319728
|
function authoringColumns(code2) {
|
|
319729
319729
|
const { tokens } = (0, import_parser4.parse)(code2, true, true, false);
|
|
319730
319730
|
const columns = [];
|
|
319731
|
-
let
|
|
319731
|
+
let lineStart2 = 0;
|
|
319732
319732
|
let scanned = 0;
|
|
319733
319733
|
for (let index3 = 0; index3 < tokens.length; index3 += 1) {
|
|
319734
319734
|
if (tokens[index3].type !== import_types.TokenType.jsxTagStart) {
|
|
@@ -319741,11 +319741,11 @@ function authoringColumns(code2) {
|
|
|
319741
319741
|
const { start } = tokens[index3];
|
|
319742
319742
|
while (scanned < start) {
|
|
319743
319743
|
if (code2.charCodeAt(scanned) === 10) {
|
|
319744
|
-
|
|
319744
|
+
lineStart2 = scanned + 1;
|
|
319745
319745
|
}
|
|
319746
319746
|
scanned += 1;
|
|
319747
319747
|
}
|
|
319748
|
-
columns.push(start -
|
|
319748
|
+
columns.push(start - lineStart2);
|
|
319749
319749
|
}
|
|
319750
319750
|
return columns;
|
|
319751
319751
|
}
|
|
@@ -319753,7 +319753,7 @@ function addAuthoringColumns(transformed, columns, trackInsertions) {
|
|
|
319753
319753
|
let sourceIndex = 0;
|
|
319754
319754
|
let scannedOffset = 0;
|
|
319755
319755
|
let line = 0;
|
|
319756
|
-
let
|
|
319756
|
+
let lineStart2 = 0;
|
|
319757
319757
|
const insertions = [];
|
|
319758
319758
|
const code2 = transformed.replace(
|
|
319759
319759
|
/(__source:\s*\{fileName:\s*_jsxFileName,\s*lineNumber:\s*\d+)(\})/g,
|
|
@@ -319764,11 +319764,11 @@ function addAuthoringColumns(transformed, columns, trackInsertions) {
|
|
|
319764
319764
|
while (scannedOffset < insertionOffset) {
|
|
319765
319765
|
if (transformed.charCodeAt(scannedOffset) === 10) {
|
|
319766
319766
|
line += 1;
|
|
319767
|
-
|
|
319767
|
+
lineStart2 = scannedOffset + 1;
|
|
319768
319768
|
}
|
|
319769
319769
|
scannedOffset += 1;
|
|
319770
319770
|
}
|
|
319771
|
-
insertions.push({ line, column: insertionOffset -
|
|
319771
|
+
insertions.push({ line, column: insertionOffset - lineStart2, length: insertion.length });
|
|
319772
319772
|
}
|
|
319773
319773
|
return `${source}${insertion}${closingBrace}`;
|
|
319774
319774
|
}
|
|
@@ -323158,8 +323158,8 @@ function propertyValue2(objectNode, property) {
|
|
|
323158
323158
|
}
|
|
323159
323159
|
}
|
|
323160
323160
|
function lineIndent(source, offset) {
|
|
323161
|
-
const
|
|
323162
|
-
return /^[ \t]*/.exec(source.slice(
|
|
323161
|
+
const lineStart2 = source.lastIndexOf("\n", offset - 1) + 1;
|
|
323162
|
+
return /^[ \t]*/.exec(source.slice(lineStart2))[0];
|
|
323163
323163
|
}
|
|
323164
323164
|
function removalEnd(property, next) {
|
|
323165
323165
|
const comments = (next.leadingComments ?? []).filter(
|
|
@@ -327124,10 +327124,597 @@ function buildWorkspace(root, { assetCatalog = null, writeSource = false, fixSou
|
|
|
327124
327124
|
};
|
|
327125
327125
|
}
|
|
327126
327126
|
|
|
327127
|
+
// scripts/lib/runtime-build/git-cli.mjs
|
|
327128
|
+
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
327129
|
+
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
327130
|
+
import { readFileSync as readFileSync14, writeFileSync as writeFileSync5 } from "node:fs";
|
|
327131
|
+
import { join as join18, resolve as resolve6 } from "node:path";
|
|
327132
|
+
|
|
327133
|
+
// scripts/lib/runtime-build/resource-merge.mjs
|
|
327134
|
+
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
327135
|
+
var KEYED_PROPERTIES = /* @__PURE__ */ new Set(["fields", "records"]);
|
|
327136
|
+
var CLOSING_TOKENS = /* @__PURE__ */ new Set(["}", "]", ")"]);
|
|
327137
|
+
var RESOURCE_PATH = /^resources\/[^/]+\.ts$/;
|
|
327138
|
+
function isResourceFilePath(path) {
|
|
327139
|
+
return RESOURCE_PATH.test(path);
|
|
327140
|
+
}
|
|
327141
|
+
function tokenLabel(token) {
|
|
327142
|
+
return typeof token.type === "string" ? token.type : token.type.label;
|
|
327143
|
+
}
|
|
327144
|
+
function isComment(token) {
|
|
327145
|
+
return token.type === "CommentLine" || token.type === "CommentBlock";
|
|
327146
|
+
}
|
|
327147
|
+
function firstTokenAt(tokens, position2) {
|
|
327148
|
+
let low = 0;
|
|
327149
|
+
let high = tokens.length;
|
|
327150
|
+
while (low < high) {
|
|
327151
|
+
const middle = low + high >> 1;
|
|
327152
|
+
if (tokens[middle].start < position2) {
|
|
327153
|
+
low = middle + 1;
|
|
327154
|
+
} else {
|
|
327155
|
+
high = middle;
|
|
327156
|
+
}
|
|
327157
|
+
}
|
|
327158
|
+
return low;
|
|
327159
|
+
}
|
|
327160
|
+
function nextCodeToken(tokens, index3) {
|
|
327161
|
+
for (let next = index3 + 1; next < tokens.length; next++) {
|
|
327162
|
+
if (!isComment(tokens[next])) {
|
|
327163
|
+
return tokens[next];
|
|
327164
|
+
}
|
|
327165
|
+
}
|
|
327166
|
+
return null;
|
|
327167
|
+
}
|
|
327168
|
+
function normalizedText(side, start, end) {
|
|
327169
|
+
const { tokens, source } = side;
|
|
327170
|
+
const parts = [];
|
|
327171
|
+
for (let index3 = firstTokenAt(tokens, start); index3 < tokens.length; index3++) {
|
|
327172
|
+
const token = tokens[index3];
|
|
327173
|
+
if (token.end > end) {
|
|
327174
|
+
break;
|
|
327175
|
+
}
|
|
327176
|
+
const label = tokenLabel(token);
|
|
327177
|
+
if (label === "eof") {
|
|
327178
|
+
continue;
|
|
327179
|
+
}
|
|
327180
|
+
if (label === ",") {
|
|
327181
|
+
const next = nextCodeToken(tokens, index3);
|
|
327182
|
+
if (next === null || next.end > end || CLOSING_TOKENS.has(tokenLabel(next))) {
|
|
327183
|
+
continue;
|
|
327184
|
+
}
|
|
327185
|
+
}
|
|
327186
|
+
const text2 = source.slice(token.start, token.end);
|
|
327187
|
+
parts.push(isComment(token) ? text2.replace(/\s+/g, " ") : text2);
|
|
327188
|
+
}
|
|
327189
|
+
return parts.join(" ");
|
|
327190
|
+
}
|
|
327191
|
+
function lineStart(source, position2) {
|
|
327192
|
+
return source.lastIndexOf("\n", position2 - 1) + 1;
|
|
327193
|
+
}
|
|
327194
|
+
function lineIndent2(source, position2) {
|
|
327195
|
+
const start = lineStart(source, position2);
|
|
327196
|
+
return /^[ \t]*/.exec(source.slice(start, position2))[0];
|
|
327197
|
+
}
|
|
327198
|
+
function insideValueToken(tokens, position2) {
|
|
327199
|
+
const token = tokens[firstTokenAt(tokens, position2) - 1];
|
|
327200
|
+
return token !== void 0 && !isComment(token) && token.end > position2;
|
|
327201
|
+
}
|
|
327202
|
+
function reindent(ctx, entry, indent) {
|
|
327203
|
+
const { source, tokens, unit: step } = entry.side;
|
|
327204
|
+
const from = lineIndent2(source, entry.start);
|
|
327205
|
+
const lines = source.slice(entry.start, entry.end).split("\n");
|
|
327206
|
+
let position2 = entry.start;
|
|
327207
|
+
return lines.map((raw, index3) => {
|
|
327208
|
+
const start = position2;
|
|
327209
|
+
position2 += raw.length + 1;
|
|
327210
|
+
const line = index3 < lines.length - 1 && raw.endsWith("\r") ? raw.slice(0, -1) : raw;
|
|
327211
|
+
if (index3 === 0 || !line.startsWith(from) || insideValueToken(tokens, start)) {
|
|
327212
|
+
return line;
|
|
327213
|
+
}
|
|
327214
|
+
let rest = line.slice(from.length);
|
|
327215
|
+
let steps = 0;
|
|
327216
|
+
while (rest.startsWith(step)) {
|
|
327217
|
+
rest = rest.slice(step.length);
|
|
327218
|
+
steps++;
|
|
327219
|
+
}
|
|
327220
|
+
return `${indent}${ctx.unit.repeat(steps)}${rest}`;
|
|
327221
|
+
}).join(ctx.newline);
|
|
327222
|
+
}
|
|
327223
|
+
function readKey(element) {
|
|
327224
|
+
if (element.type !== "ObjectProperty" && element.type !== "ObjectMethod") {
|
|
327225
|
+
return null;
|
|
327226
|
+
}
|
|
327227
|
+
try {
|
|
327228
|
+
return propertyKey2(element);
|
|
327229
|
+
} catch (error) {
|
|
327230
|
+
if (error instanceof SourceError) {
|
|
327231
|
+
return null;
|
|
327232
|
+
}
|
|
327233
|
+
throw error;
|
|
327234
|
+
}
|
|
327235
|
+
}
|
|
327236
|
+
function readPolicyUid(element) {
|
|
327237
|
+
if (element.type !== "ObjectExpression") {
|
|
327238
|
+
return null;
|
|
327239
|
+
}
|
|
327240
|
+
const property = element.properties.find(
|
|
327241
|
+
(candidate) => candidate.type === "ObjectProperty" && !candidate.computed && readKey(candidate) === "uid"
|
|
327242
|
+
);
|
|
327243
|
+
return property?.value.type === "StringLiteral" ? property.value.value : null;
|
|
327244
|
+
}
|
|
327245
|
+
var KEY_READERS = {
|
|
327246
|
+
keyed: readKey,
|
|
327247
|
+
strings: (element) => element.type === "StringLiteral" ? element.value : null,
|
|
327248
|
+
uids: readPolicyUid
|
|
327249
|
+
};
|
|
327250
|
+
function tokenAfter(side, position2, label) {
|
|
327251
|
+
for (let index3 = firstTokenAt(side.tokens, position2); index3 < side.tokens.length; index3++) {
|
|
327252
|
+
const token = side.tokens[index3];
|
|
327253
|
+
if (tokenLabel(token) === label) {
|
|
327254
|
+
return token;
|
|
327255
|
+
}
|
|
327256
|
+
if (!isComment(token)) {
|
|
327257
|
+
return null;
|
|
327258
|
+
}
|
|
327259
|
+
}
|
|
327260
|
+
return null;
|
|
327261
|
+
}
|
|
327262
|
+
function containerOf(side, node, keyOf) {
|
|
327263
|
+
const elements = node.type === "ObjectExpression" ? node.properties : node.elements;
|
|
327264
|
+
const entries = [];
|
|
327265
|
+
const seen = /* @__PURE__ */ new Set();
|
|
327266
|
+
let boundary = node.start + 1;
|
|
327267
|
+
let boundaryLine = node.loc.start.line;
|
|
327268
|
+
for (const [index3, element] of elements.entries()) {
|
|
327269
|
+
if (element === null) {
|
|
327270
|
+
return null;
|
|
327271
|
+
}
|
|
327272
|
+
const key = keyOf(element);
|
|
327273
|
+
if (key === null || seen.has(key)) {
|
|
327274
|
+
return null;
|
|
327275
|
+
}
|
|
327276
|
+
seen.add(key);
|
|
327277
|
+
if (index3 > 0) {
|
|
327278
|
+
const comma2 = tokenAfter(side, elements[index3 - 1].end, ",");
|
|
327279
|
+
if (comma2 === null) {
|
|
327280
|
+
return null;
|
|
327281
|
+
}
|
|
327282
|
+
boundary = comma2.end;
|
|
327283
|
+
boundaryLine = comma2.loc.start.line;
|
|
327284
|
+
}
|
|
327285
|
+
const leading = (element.leadingComments ?? []).find(
|
|
327286
|
+
(comment) => comment.start >= boundary && comment.loc.start.line > boundaryLine
|
|
327287
|
+
);
|
|
327288
|
+
entries.push({
|
|
327289
|
+
side,
|
|
327290
|
+
key,
|
|
327291
|
+
index: index3,
|
|
327292
|
+
value: element.type === "ObjectProperty" ? element.value : null,
|
|
327293
|
+
start: leading?.start ?? element.start,
|
|
327294
|
+
end: element.end
|
|
327295
|
+
});
|
|
327296
|
+
}
|
|
327297
|
+
return { side, node, entries };
|
|
327298
|
+
}
|
|
327299
|
+
function readSide(source) {
|
|
327300
|
+
let ast;
|
|
327301
|
+
try {
|
|
327302
|
+
ast = parse2(source, { sourceType: "module", plugins: ["typescript"], errorRecovery: false, tokens: true });
|
|
327303
|
+
} catch (error) {
|
|
327304
|
+
if (error instanceof SyntaxError) {
|
|
327305
|
+
return null;
|
|
327306
|
+
}
|
|
327307
|
+
throw error;
|
|
327308
|
+
}
|
|
327309
|
+
const exports = ast.program.body.filter((statement2) => statement2.type === "ExportDefaultDeclaration");
|
|
327310
|
+
if (exports.length !== 1) {
|
|
327311
|
+
return null;
|
|
327312
|
+
}
|
|
327313
|
+
const call = exports[0].declaration;
|
|
327314
|
+
if (call.type !== "CallExpression" || call.callee.type !== "Identifier" || call.callee.name !== "defineResource" || call.arguments.length !== 1 || call.arguments[0].type !== "ObjectExpression") {
|
|
327315
|
+
return null;
|
|
327316
|
+
}
|
|
327317
|
+
const side = { source, tokens: ast.tokens, object: call.arguments[0], container: null, unit: " " };
|
|
327318
|
+
side.container = containerOf(side, side.object, KEY_READERS.keyed);
|
|
327319
|
+
if (side.container === null) {
|
|
327320
|
+
return null;
|
|
327321
|
+
}
|
|
327322
|
+
side.unit = indentUnit(side);
|
|
327323
|
+
return side;
|
|
327324
|
+
}
|
|
327325
|
+
function nestedKind(key, values) {
|
|
327326
|
+
if (KEYED_PROPERTIES.has(key)) {
|
|
327327
|
+
return values.every((value) => value?.type === "ObjectExpression") ? "keyed" : null;
|
|
327328
|
+
}
|
|
327329
|
+
if (!values.every((value) => value?.type === "ArrayExpression")) {
|
|
327330
|
+
return null;
|
|
327331
|
+
}
|
|
327332
|
+
const elements = values.flatMap((value) => value.elements);
|
|
327333
|
+
if (elements.length === 0) {
|
|
327334
|
+
return null;
|
|
327335
|
+
}
|
|
327336
|
+
if (elements.every((element) => element?.type === "StringLiteral")) {
|
|
327337
|
+
return "strings";
|
|
327338
|
+
}
|
|
327339
|
+
return elements.every((element) => element !== null && readPolicyUid(element) !== null) ? "uids" : null;
|
|
327340
|
+
}
|
|
327341
|
+
function decide(base2, ours, theirs, same) {
|
|
327342
|
+
if (ours !== void 0 && theirs !== void 0) {
|
|
327343
|
+
if (same(ours, theirs)) {
|
|
327344
|
+
return "ours";
|
|
327345
|
+
}
|
|
327346
|
+
if (base2 !== void 0 && same(ours, base2)) {
|
|
327347
|
+
return "theirs";
|
|
327348
|
+
}
|
|
327349
|
+
return base2 !== void 0 && same(theirs, base2) ? "ours" : "conflict";
|
|
327350
|
+
}
|
|
327351
|
+
if (ours !== void 0) {
|
|
327352
|
+
if (base2 === void 0) {
|
|
327353
|
+
return "ours";
|
|
327354
|
+
}
|
|
327355
|
+
return same(ours, base2) ? "delete" : "conflict";
|
|
327356
|
+
}
|
|
327357
|
+
if (theirs !== void 0) {
|
|
327358
|
+
if (base2 === void 0) {
|
|
327359
|
+
return "theirs";
|
|
327360
|
+
}
|
|
327361
|
+
return same(theirs, base2) ? "delete" : "conflict";
|
|
327362
|
+
}
|
|
327363
|
+
return "delete";
|
|
327364
|
+
}
|
|
327365
|
+
function entryText(entry) {
|
|
327366
|
+
return entry.side.source.slice(entry.start, entry.end);
|
|
327367
|
+
}
|
|
327368
|
+
function entryIndent(entry) {
|
|
327369
|
+
return lineIndent2(entry.side.source, entry.start);
|
|
327370
|
+
}
|
|
327371
|
+
function isMultiline(container) {
|
|
327372
|
+
const [first] = container.entries;
|
|
327373
|
+
return first !== void 0 && container.side.source.slice(container.node.start, first.start).includes("\n");
|
|
327374
|
+
}
|
|
327375
|
+
function containerLayout(ctx, ours, theirs) {
|
|
327376
|
+
const { source } = ours.side;
|
|
327377
|
+
const { node, entries } = ours;
|
|
327378
|
+
const isObject = node.type === "ObjectExpression";
|
|
327379
|
+
if (entries.length === 0) {
|
|
327380
|
+
const multiline2 = isMultiline(theirs);
|
|
327381
|
+
const outer = lineIndent2(source, node.start);
|
|
327382
|
+
const indent2 = multiline2 ? `${outer}${ctx.unit}` : outer;
|
|
327383
|
+
const padding = isObject ? " " : "";
|
|
327384
|
+
return {
|
|
327385
|
+
indent: indent2,
|
|
327386
|
+
first: multiline2 ? `${ctx.newline}${indent2}` : padding,
|
|
327387
|
+
last: multiline2 ? `${ctx.newline}${outer}` : padding,
|
|
327388
|
+
between: [],
|
|
327389
|
+
separator: multiline2 ? `,${ctx.newline}${indent2}` : ", "
|
|
327390
|
+
};
|
|
327391
|
+
}
|
|
327392
|
+
const multiline = isMultiline(ours);
|
|
327393
|
+
const indent = multiline ? entryIndent(entries[0]) : lineIndent2(source, node.start);
|
|
327394
|
+
const between = entries.map((entry, index3) => index3 === 0 ? null : source.slice(entries[index3 - 1].end, entry.start));
|
|
327395
|
+
return {
|
|
327396
|
+
indent,
|
|
327397
|
+
first: source.slice(node.start + 1, entries[0].start),
|
|
327398
|
+
last: source.slice(entries.at(-1).end, node.end - 1),
|
|
327399
|
+
between,
|
|
327400
|
+
separator: multiline ? `,${ctx.newline}${indent}` : ", "
|
|
327401
|
+
};
|
|
327402
|
+
}
|
|
327403
|
+
function conflictBlock(ctx, { ours, base: base2, hasBase, theirs }) {
|
|
327404
|
+
const lines = [`<<<<<<< ${ctx.labels.ours}`];
|
|
327405
|
+
if (ours !== null) {
|
|
327406
|
+
lines.push(ours);
|
|
327407
|
+
}
|
|
327408
|
+
if (hasBase) {
|
|
327409
|
+
lines.push(`||||||| ${ctx.labels.base}`);
|
|
327410
|
+
if (base2 !== null) {
|
|
327411
|
+
lines.push(base2);
|
|
327412
|
+
}
|
|
327413
|
+
}
|
|
327414
|
+
lines.push("=======");
|
|
327415
|
+
if (theirs !== null) {
|
|
327416
|
+
lines.push(theirs);
|
|
327417
|
+
}
|
|
327418
|
+
lines.push(`>>>>>>> ${ctx.labels.theirs}`);
|
|
327419
|
+
return lines.join(ctx.newline);
|
|
327420
|
+
}
|
|
327421
|
+
function renderContainer(ctx, ours, layout, items) {
|
|
327422
|
+
const { source } = ours.side;
|
|
327423
|
+
const { node, entries } = ours;
|
|
327424
|
+
if (items.length === 0) {
|
|
327425
|
+
return entries.length === 0 ? source.slice(node.start, node.end) : `${source[node.start]}${source[node.end - 1]}`;
|
|
327426
|
+
}
|
|
327427
|
+
let text2 = source[node.start];
|
|
327428
|
+
let separator = layout.first;
|
|
327429
|
+
for (const [position2, item] of items.entries()) {
|
|
327430
|
+
if (item.type === "conflict") {
|
|
327431
|
+
text2 += separator.replace(/[ \t]+$/, "");
|
|
327432
|
+
if (!text2.endsWith("\n")) {
|
|
327433
|
+
text2 += ctx.newline;
|
|
327434
|
+
}
|
|
327435
|
+
text2 += item.text;
|
|
327436
|
+
} else {
|
|
327437
|
+
text2 += `${separator}${item.text}`;
|
|
327438
|
+
}
|
|
327439
|
+
if (position2 === items.length - 1) {
|
|
327440
|
+
separator = layout.last;
|
|
327441
|
+
} else if (item.index !== null && item.index < entries.length - 1) {
|
|
327442
|
+
separator = layout.between[item.index + 1];
|
|
327443
|
+
} else {
|
|
327444
|
+
separator = layout.separator;
|
|
327445
|
+
}
|
|
327446
|
+
if (item.type === "conflict") {
|
|
327447
|
+
separator = separator.replace(",", "");
|
|
327448
|
+
if (!/^[ \t]*\r?\n/.test(separator)) {
|
|
327449
|
+
separator = `${ctx.newline}${separator.replace(/^[ \t]+/, "")}`;
|
|
327450
|
+
}
|
|
327451
|
+
}
|
|
327452
|
+
}
|
|
327453
|
+
return `${text2}${separator}${source[node.end - 1]}`;
|
|
327454
|
+
}
|
|
327455
|
+
function mergeContainer(ctx, { base: base2, ours, theirs }, { label, same, nested = () => null }) {
|
|
327456
|
+
const byKey = (container) => new Map((container?.entries ?? []).map((entry) => [entry.key, entry]));
|
|
327457
|
+
const baseEntries = byKey(base2);
|
|
327458
|
+
const oursEntries = byKey(ours);
|
|
327459
|
+
const theirsEntries = byKey(theirs);
|
|
327460
|
+
const layout = containerLayout(ctx, ours, theirs);
|
|
327461
|
+
const section = (entry) => `${layout.indent}${reindent(ctx, entry, layout.indent)},`;
|
|
327462
|
+
const items = /* @__PURE__ */ new Map();
|
|
327463
|
+
for (const key of /* @__PURE__ */ new Set([...oursEntries.keys(), ...theirsEntries.keys()])) {
|
|
327464
|
+
const baseEntry = baseEntries.get(key);
|
|
327465
|
+
const oursEntry = oursEntries.get(key);
|
|
327466
|
+
const theirsEntry = theirsEntries.get(key);
|
|
327467
|
+
const decision = decide(baseEntry, oursEntry, theirsEntry, same);
|
|
327468
|
+
const index3 = oursEntry?.index ?? null;
|
|
327469
|
+
if (decision === "ours") {
|
|
327470
|
+
items.set(key, { type: "entry", index: index3, text: entryText(oursEntry) });
|
|
327471
|
+
} else if (decision === "theirs") {
|
|
327472
|
+
items.set(key, { type: "entry", index: index3, text: reindent(ctx, theirsEntry, layout.indent) });
|
|
327473
|
+
} else if (decision === "conflict") {
|
|
327474
|
+
const merged = oursEntry !== void 0 && theirsEntry !== void 0 ? nested(key, baseEntry, oursEntry, theirsEntry) : null;
|
|
327475
|
+
if (merged !== null) {
|
|
327476
|
+
items.set(key, { type: "entry", index: index3, text: merged });
|
|
327477
|
+
continue;
|
|
327478
|
+
}
|
|
327479
|
+
ctx.conflicts.push(label(key));
|
|
327480
|
+
items.set(key, {
|
|
327481
|
+
type: "conflict",
|
|
327482
|
+
index: index3,
|
|
327483
|
+
text: conflictBlock(ctx, {
|
|
327484
|
+
ours: oursEntry === void 0 ? null : section(oursEntry),
|
|
327485
|
+
hasBase: baseEntry !== void 0,
|
|
327486
|
+
base: baseEntry === void 0 ? null : section(baseEntry),
|
|
327487
|
+
theirs: theirsEntry === void 0 ? null : section(theirsEntry)
|
|
327488
|
+
})
|
|
327489
|
+
});
|
|
327490
|
+
}
|
|
327491
|
+
}
|
|
327492
|
+
const order = ours.entries.map((entry) => entry.key).filter((key) => items.has(key));
|
|
327493
|
+
for (const [position2, entry] of theirs.entries.entries()) {
|
|
327494
|
+
if (oursEntries.has(entry.key) || !items.has(entry.key)) {
|
|
327495
|
+
continue;
|
|
327496
|
+
}
|
|
327497
|
+
let at = 0;
|
|
327498
|
+
for (let previous = position2 - 1; previous >= 0; previous--) {
|
|
327499
|
+
const found2 = order.indexOf(theirs.entries[previous].key);
|
|
327500
|
+
if (found2 !== -1) {
|
|
327501
|
+
at = found2 + 1;
|
|
327502
|
+
break;
|
|
327503
|
+
}
|
|
327504
|
+
}
|
|
327505
|
+
while (at < order.length && !theirsEntries.has(order[at])) {
|
|
327506
|
+
at++;
|
|
327507
|
+
}
|
|
327508
|
+
order.splice(at, 0, entry.key);
|
|
327509
|
+
}
|
|
327510
|
+
return renderContainer(
|
|
327511
|
+
ctx,
|
|
327512
|
+
ours,
|
|
327513
|
+
layout,
|
|
327514
|
+
order.map((key) => items.get(key))
|
|
327515
|
+
);
|
|
327516
|
+
}
|
|
327517
|
+
function sameEntryText() {
|
|
327518
|
+
const cache2 = /* @__PURE__ */ new Map();
|
|
327519
|
+
const text2 = (entry) => {
|
|
327520
|
+
if (!cache2.has(entry)) {
|
|
327521
|
+
cache2.set(entry, normalizedText(entry.side, entry.start, entry.end));
|
|
327522
|
+
}
|
|
327523
|
+
return cache2.get(entry);
|
|
327524
|
+
};
|
|
327525
|
+
return (left, right) => text2(left) === text2(right);
|
|
327526
|
+
}
|
|
327527
|
+
function mergeNestedOption(ctx, sides, key, baseEntry, oursEntry, theirsEntry) {
|
|
327528
|
+
const values = [baseEntry?.value, oursEntry.value, theirsEntry.value].filter((value) => value !== void 0);
|
|
327529
|
+
const kind = nestedKind(key, values);
|
|
327530
|
+
if (kind === null) {
|
|
327531
|
+
return null;
|
|
327532
|
+
}
|
|
327533
|
+
const keyOf = KEY_READERS[kind];
|
|
327534
|
+
const containers = {
|
|
327535
|
+
base: baseEntry === void 0 ? null : containerOf(sides.base, baseEntry.value, keyOf),
|
|
327536
|
+
ours: containerOf(sides.ours, oursEntry.value, keyOf),
|
|
327537
|
+
theirs: containerOf(sides.theirs, theirsEntry.value, keyOf)
|
|
327538
|
+
};
|
|
327539
|
+
if (containers.ours === null || containers.theirs === null || baseEntry !== void 0 && containers.base === null) {
|
|
327540
|
+
return null;
|
|
327541
|
+
}
|
|
327542
|
+
const same = kind === "strings" ? () => true : sameEntryText();
|
|
327543
|
+
const merged = mergeContainer(ctx, containers, { label: (entryKey) => `${key}.${entryKey}`, same });
|
|
327544
|
+
const { source } = sides.ours;
|
|
327545
|
+
return `${source.slice(oursEntry.start, oursEntry.value.start)}${merged}${source.slice(oursEntry.value.end, oursEntry.end)}`;
|
|
327546
|
+
}
|
|
327547
|
+
function mergeOutside(ctx, sides, range, label) {
|
|
327548
|
+
const versions = {};
|
|
327549
|
+
for (const name of ["base", "ours", "theirs"]) {
|
|
327550
|
+
const side = sides[name];
|
|
327551
|
+
if (side !== null) {
|
|
327552
|
+
const [start, end] = range(side);
|
|
327553
|
+
versions[name] = { text: side.source.slice(start, end), normalized: normalizedText(side, start, end) };
|
|
327554
|
+
}
|
|
327555
|
+
}
|
|
327556
|
+
const decision = decide(versions.base, versions.ours, versions.theirs, (left, right) => left.normalized === right.normalized);
|
|
327557
|
+
if (decision === "ours") {
|
|
327558
|
+
return { text: versions.ours.text, conflict: false };
|
|
327559
|
+
}
|
|
327560
|
+
if (decision === "theirs") {
|
|
327561
|
+
return { text: versions.theirs.text, conflict: false };
|
|
327562
|
+
}
|
|
327563
|
+
ctx.conflicts.push(label);
|
|
327564
|
+
const trimmed = (version) => version.text.replace(/\r?\n$/, "");
|
|
327565
|
+
return {
|
|
327566
|
+
text: conflictBlock(ctx, {
|
|
327567
|
+
ours: trimmed(versions.ours),
|
|
327568
|
+
hasBase: versions.base !== void 0,
|
|
327569
|
+
base: versions.base === void 0 ? null : trimmed(versions.base),
|
|
327570
|
+
theirs: trimmed(versions.theirs)
|
|
327571
|
+
}),
|
|
327572
|
+
conflict: true
|
|
327573
|
+
};
|
|
327574
|
+
}
|
|
327575
|
+
function indentUnit(side) {
|
|
327576
|
+
const { container, source } = side;
|
|
327577
|
+
if (!isMultiline(container)) {
|
|
327578
|
+
return " ";
|
|
327579
|
+
}
|
|
327580
|
+
const outer = lineIndent2(source, container.node.start);
|
|
327581
|
+
const inner = entryIndent(container.entries[0]);
|
|
327582
|
+
return inner.startsWith(outer) && inner.length > outer.length ? inner.slice(outer.length) : " ";
|
|
327583
|
+
}
|
|
327584
|
+
function mergeResourceSource({ base: base2, ours, theirs }, { oursLabel = "branch", baseLabel = "base", theirsLabel = "main" } = {}) {
|
|
327585
|
+
if (ours === theirs || base2 === theirs) {
|
|
327586
|
+
return { status: "merged", content: ours };
|
|
327587
|
+
}
|
|
327588
|
+
if (base2 === ours) {
|
|
327589
|
+
return { status: "merged", content: theirs };
|
|
327590
|
+
}
|
|
327591
|
+
const sides = { base: base2 === null ? null : readSide(base2), ours: readSide(ours), theirs: readSide(theirs) };
|
|
327592
|
+
if (sides.ours === null || sides.theirs === null || base2 !== null && sides.base === null) {
|
|
327593
|
+
return { status: "unsupported" };
|
|
327594
|
+
}
|
|
327595
|
+
const ctx = {
|
|
327596
|
+
conflicts: [],
|
|
327597
|
+
labels: { ours: oursLabel, base: baseLabel, theirs: theirsLabel },
|
|
327598
|
+
newline: ours.includes("\r\n") ? "\r\n" : "\n",
|
|
327599
|
+
unit: sides.ours.unit
|
|
327600
|
+
};
|
|
327601
|
+
const containers = { base: sides.base?.container ?? null, ours: sides.ours.container, theirs: sides.theirs.container };
|
|
327602
|
+
const before = mergeOutside(ctx, sides, (side) => [0, side.object.start], "module code before defineResource");
|
|
327603
|
+
const object = mergeContainer(ctx, containers, {
|
|
327604
|
+
label: (key) => key,
|
|
327605
|
+
same: sameEntryText(),
|
|
327606
|
+
nested: (key, baseEntry, oursEntry, theirsEntry) => mergeNestedOption(ctx, sides, key, baseEntry, oursEntry, theirsEntry)
|
|
327607
|
+
});
|
|
327608
|
+
const after = mergeOutside(ctx, sides, (side) => [side.object.end, side.source.length], "module code after defineResource");
|
|
327609
|
+
const content = [
|
|
327610
|
+
before.conflict ? `${before.text}${ctx.newline}` : before.text,
|
|
327611
|
+
object,
|
|
327612
|
+
after.conflict ? `${ctx.newline}${after.text}${ctx.newline}` : after.text
|
|
327613
|
+
].join("");
|
|
327614
|
+
if (ctx.conflicts.length > 0) {
|
|
327615
|
+
return { status: "conflict", content, conflicts: ctx.conflicts };
|
|
327616
|
+
}
|
|
327617
|
+
return readSide(content) === null ? { status: "unsupported" } : { status: "merged", content };
|
|
327618
|
+
}
|
|
327619
|
+
|
|
327620
|
+
// scripts/lib/runtime-build/git-cli.mjs
|
|
327621
|
+
var MERGE_DRIVER_USAGE = "Usage: diagonal merge-driver <base> <ours> <theirs> [path]";
|
|
327622
|
+
var GIT_SETUP_USAGE = "Usage: diagonal git setup";
|
|
327623
|
+
var DRIVER = "diagonal-resource";
|
|
327624
|
+
var DRIVER_COMMAND = "npx --no-install diagonal merge-driver %O %A %B %P";
|
|
327625
|
+
var ATTRIBUTES_LINE = `resources/*.ts merge=${DRIVER}`;
|
|
327626
|
+
var LABELS = { oursLabel: "branch", baseLabel: "base", theirsLabel: "main" };
|
|
327627
|
+
function git(args, cwd) {
|
|
327628
|
+
return spawnSync2("git", args, { cwd, encoding: "utf8" });
|
|
327629
|
+
}
|
|
327630
|
+
function lineMerge(base2, ours, theirs, { cwd, stderr }) {
|
|
327631
|
+
const result = git(
|
|
327632
|
+
["merge-file", "--diff3", "-L", LABELS.oursLabel, "-L", LABELS.baseLabel, "-L", LABELS.theirsLabel, ours, base2, theirs],
|
|
327633
|
+
cwd
|
|
327634
|
+
);
|
|
327635
|
+
if (result.error !== void 0 || result.status === null) {
|
|
327636
|
+
stderr.write(`git merge-file did not run: ${result.error?.message ?? result.signal}
|
|
327637
|
+
`);
|
|
327638
|
+
return 2;
|
|
327639
|
+
}
|
|
327640
|
+
return result.status;
|
|
327641
|
+
}
|
|
327642
|
+
function mergeDriver(args, { cwd, stderr }) {
|
|
327643
|
+
if (args.length < 3 || args.length > 4) {
|
|
327644
|
+
stderr.write(`${MERGE_DRIVER_USAGE}
|
|
327645
|
+
`);
|
|
327646
|
+
return 2;
|
|
327647
|
+
}
|
|
327648
|
+
const [base2, ours, theirs] = args.slice(0, 3).map((file2) => resolve6(cwd, file2));
|
|
327649
|
+
const path = args[3];
|
|
327650
|
+
if (path === void 0 || !isResourceFilePath(path)) {
|
|
327651
|
+
return lineMerge(base2, ours, theirs, { cwd, stderr });
|
|
327652
|
+
}
|
|
327653
|
+
const baseSource = readFileSync14(base2, "utf8");
|
|
327654
|
+
const result = mergeResourceSource(
|
|
327655
|
+
{ base: baseSource === "" ? null : baseSource, ours: readFileSync14(ours, "utf8"), theirs: readFileSync14(theirs, "utf8") },
|
|
327656
|
+
LABELS
|
|
327657
|
+
);
|
|
327658
|
+
if (result.status === "unsupported") {
|
|
327659
|
+
return lineMerge(base2, ours, theirs, { cwd, stderr });
|
|
327660
|
+
}
|
|
327661
|
+
writeFileSync5(ours, result.content);
|
|
327662
|
+
if (result.status === "conflict") {
|
|
327663
|
+
stderr.write(`${path}: conflict in ${result.conflicts.join(", ")}
|
|
327664
|
+
`);
|
|
327665
|
+
return 1;
|
|
327666
|
+
}
|
|
327667
|
+
return 0;
|
|
327668
|
+
}
|
|
327669
|
+
function gitSetup(args, { cwd, stdout, stderr }) {
|
|
327670
|
+
if (args.length > 0) {
|
|
327671
|
+
stderr.write(`${GIT_SETUP_USAGE}
|
|
327672
|
+
`);
|
|
327673
|
+
return 2;
|
|
327674
|
+
}
|
|
327675
|
+
const topLevel = git(["rev-parse", "--show-toplevel"], cwd);
|
|
327676
|
+
if (topLevel.status !== 0) {
|
|
327677
|
+
stderr.write("Run this command in a git repository.\n");
|
|
327678
|
+
return 2;
|
|
327679
|
+
}
|
|
327680
|
+
const root = topLevel.stdout.trim();
|
|
327681
|
+
for (const [key, value] of [
|
|
327682
|
+
[`merge.${DRIVER}.name`, "Diagonal resource merge"],
|
|
327683
|
+
[`merge.${DRIVER}.driver`, DRIVER_COMMAND]
|
|
327684
|
+
]) {
|
|
327685
|
+
const result = git(["config", key, value], root);
|
|
327686
|
+
if (result.status !== 0) {
|
|
327687
|
+
stderr.write(`git config ${key} failed: ${result.stderr.trim()}
|
|
327688
|
+
`);
|
|
327689
|
+
return 1;
|
|
327690
|
+
}
|
|
327691
|
+
}
|
|
327692
|
+
const attributesPath = join18(root, ".gitattributes");
|
|
327693
|
+
let attributes = "";
|
|
327694
|
+
try {
|
|
327695
|
+
attributes = readFileSync14(attributesPath, "utf8");
|
|
327696
|
+
} catch (error) {
|
|
327697
|
+
if (error.code !== "ENOENT") {
|
|
327698
|
+
throw error;
|
|
327699
|
+
}
|
|
327700
|
+
}
|
|
327701
|
+
stdout.write(`Registered the ${DRIVER} merge driver in the git config.
|
|
327702
|
+
`);
|
|
327703
|
+
if (attributes.split(/\r?\n/).some((line) => line.trim() === ATTRIBUTES_LINE)) {
|
|
327704
|
+
return 0;
|
|
327705
|
+
}
|
|
327706
|
+
const separator = attributes === "" || attributes.endsWith("\n") ? "" : "\n";
|
|
327707
|
+
writeFileSync5(attributesPath, `${attributes}${separator}${ATTRIBUTES_LINE}
|
|
327708
|
+
`);
|
|
327709
|
+
stdout.write(`Added "${ATTRIBUTES_LINE}" to .gitattributes. Commit .gitattributes.
|
|
327710
|
+
`);
|
|
327711
|
+
return 0;
|
|
327712
|
+
}
|
|
327713
|
+
|
|
327127
327714
|
// scripts/lib/runtime-build/migration-cli.mjs
|
|
327128
327715
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
327129
|
-
import { mkdirSync as mkdirSync3, readdirSync as readdirSync5, statSync as statSync5, writeFileSync as
|
|
327130
|
-
import { join as
|
|
327716
|
+
import { mkdirSync as mkdirSync3, readdirSync as readdirSync5, statSync as statSync5, writeFileSync as writeFileSync6 } from "node:fs";
|
|
327717
|
+
import { join as join19 } from "node:path";
|
|
327131
327718
|
var MIGRATION_USAGE = "Usage: diagonal make:migration <name>";
|
|
327132
327719
|
var NAME = /^[a-z0-9][a-z0-9_]{0,84}$/;
|
|
327133
327720
|
function makeMigration(args, { cwd, stdout, stderr }) {
|
|
@@ -327139,12 +327726,12 @@ ${MIGRATION_USAGE}
|
|
|
327139
327726
|
);
|
|
327140
327727
|
return 2;
|
|
327141
327728
|
}
|
|
327142
|
-
if (!statSync5(
|
|
327729
|
+
if (!statSync5(join19(cwd, "diagonal.config.ts"), { throwIfNoEntry: false })?.isFile()) {
|
|
327143
327730
|
stderr.write("Run this command in a workspace directory with diagonal.config.ts.\n");
|
|
327144
327731
|
return 2;
|
|
327145
327732
|
}
|
|
327146
327733
|
const name = args[0];
|
|
327147
|
-
const directory =
|
|
327734
|
+
const directory = join19(cwd, "migrations");
|
|
327148
327735
|
mkdirSync3(directory, { recursive: true });
|
|
327149
327736
|
const used = new Set(
|
|
327150
327737
|
readdirSync5(directory).filter((file2) => file2.endsWith(".ts") && !file2.endsWith(".test.ts")).map((file2) => migrationTimestamp(file2.slice(0, -3))).filter((timestamp2) => timestamp2 !== null)
|
|
@@ -327168,7 +327755,7 @@ export default defineWorkflow(
|
|
|
327168
327755
|
async () => {}
|
|
327169
327756
|
);
|
|
327170
327757
|
`;
|
|
327171
|
-
|
|
327758
|
+
writeFileSync6(join19(cwd, path), source, { flag: "wx" });
|
|
327172
327759
|
stdout.write(`Created ${path}
|
|
327173
327760
|
`);
|
|
327174
327761
|
return 0;
|
|
@@ -327184,7 +327771,9 @@ var USAGE = [
|
|
|
327184
327771
|
RUN_USAGE,
|
|
327185
327772
|
LOGS_USAGE,
|
|
327186
327773
|
ASSETS_UPLOAD_USAGE,
|
|
327187
|
-
ASSETS_LIST_USAGE
|
|
327774
|
+
ASSETS_LIST_USAGE,
|
|
327775
|
+
MERGE_DRIVER_USAGE,
|
|
327776
|
+
GIT_SETUP_USAGE
|
|
327188
327777
|
].join("\n");
|
|
327189
327778
|
function plural(count, word) {
|
|
327190
327779
|
return `${count} ${word}${count === 1 ? "" : "s"}`;
|
|
@@ -327218,7 +327807,7 @@ ${CHECK_USAGE}
|
|
|
327218
327807
|
`);
|
|
327219
327808
|
return 2;
|
|
327220
327809
|
}
|
|
327221
|
-
const root =
|
|
327810
|
+
const root = resolve7(cwd, parsed.dir);
|
|
327222
327811
|
if (!statSync6(root, { throwIfNoEntry: false })?.isDirectory()) {
|
|
327223
327812
|
stderr.write(`Not a directory: ${root}
|
|
327224
327813
|
`);
|
|
@@ -327256,6 +327845,15 @@ async function main(argv, io) {
|
|
|
327256
327845
|
if (subcommand === "list") return listAssets(assetArgs, io);
|
|
327257
327846
|
io.stderr.write(`${ASSETS_UPLOAD_USAGE}
|
|
327258
327847
|
${ASSETS_LIST_USAGE}
|
|
327848
|
+
`);
|
|
327849
|
+
return 2;
|
|
327850
|
+
}
|
|
327851
|
+
case "merge-driver":
|
|
327852
|
+
return mergeDriver(args, io);
|
|
327853
|
+
case "git": {
|
|
327854
|
+
const [subcommand, ...gitArgs] = args;
|
|
327855
|
+
if (subcommand === "setup") return gitSetup(gitArgs, io);
|
|
327856
|
+
io.stderr.write(`${GIT_SETUP_USAGE}
|
|
327259
327857
|
`);
|
|
327260
327858
|
return 2;
|
|
327261
327859
|
}
|