prettier 3.3.2 → 3.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +35 -34
- package/doc.js +2 -2
- package/doc.mjs +2 -2
- package/index.cjs +8 -8
- package/index.d.ts +1 -2
- package/index.mjs +636 -704
- package/internal/cli.mjs +4 -4
- package/package.json +1 -1
- package/plugins/acorn.js +14 -12
- package/plugins/acorn.mjs +14 -12
- package/plugins/angular.js +1 -1
- package/plugins/angular.mjs +1 -1
- package/plugins/babel.js +10 -11
- package/plugins/babel.mjs +10 -11
- package/plugins/estree.js +27 -27
- package/plugins/estree.mjs +27 -27
- package/plugins/flow.js +15 -16
- package/plugins/flow.mjs +15 -16
- package/plugins/glimmer.js +5 -5
- package/plugins/glimmer.mjs +5 -5
- package/plugins/graphql.js +8 -8
- package/plugins/graphql.mjs +8 -8
- package/plugins/html.js +17 -17
- package/plugins/html.mjs +17 -17
- package/plugins/markdown.js +44 -44
- package/plugins/markdown.mjs +44 -44
- package/plugins/meriyah.js +4 -5
- package/plugins/meriyah.mjs +4 -5
- package/plugins/postcss.js +26 -26
- package/plugins/postcss.mjs +26 -26
- package/plugins/typescript.js +15 -20
- package/plugins/typescript.mjs +15 -20
- package/plugins/yaml.js +6 -6
- package/plugins/yaml.mjs +6 -6
- package/standalone.js +31 -30
- package/standalone.mjs +28 -27
package/index.mjs
CHANGED
|
@@ -55,538 +55,6 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
|
|
|
55
55
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
56
56
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
57
57
|
|
|
58
|
-
// node_modules/diff/lib/diff/base.js
|
|
59
|
-
var require_base = __commonJS({
|
|
60
|
-
"node_modules/diff/lib/diff/base.js"(exports) {
|
|
61
|
-
"use strict";
|
|
62
|
-
Object.defineProperty(exports, "__esModule", {
|
|
63
|
-
value: true
|
|
64
|
-
});
|
|
65
|
-
exports["default"] = Diff;
|
|
66
|
-
function Diff() {
|
|
67
|
-
}
|
|
68
|
-
Diff.prototype = {
|
|
69
|
-
/*istanbul ignore start*/
|
|
70
|
-
/*istanbul ignore end*/
|
|
71
|
-
diff: function diff(oldString, newString) {
|
|
72
|
-
var _options$timeout;
|
|
73
|
-
var options8 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
74
|
-
var callback = options8.callback;
|
|
75
|
-
if (typeof options8 === "function") {
|
|
76
|
-
callback = options8;
|
|
77
|
-
options8 = {};
|
|
78
|
-
}
|
|
79
|
-
this.options = options8;
|
|
80
|
-
var self = this;
|
|
81
|
-
function done(value) {
|
|
82
|
-
if (callback) {
|
|
83
|
-
setTimeout(function() {
|
|
84
|
-
callback(void 0, value);
|
|
85
|
-
}, 0);
|
|
86
|
-
return true;
|
|
87
|
-
} else {
|
|
88
|
-
return value;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
oldString = this.castInput(oldString);
|
|
92
|
-
newString = this.castInput(newString);
|
|
93
|
-
oldString = this.removeEmpty(this.tokenize(oldString));
|
|
94
|
-
newString = this.removeEmpty(this.tokenize(newString));
|
|
95
|
-
var newLen = newString.length, oldLen = oldString.length;
|
|
96
|
-
var editLength = 1;
|
|
97
|
-
var maxEditLength = newLen + oldLen;
|
|
98
|
-
if (options8.maxEditLength) {
|
|
99
|
-
maxEditLength = Math.min(maxEditLength, options8.maxEditLength);
|
|
100
|
-
}
|
|
101
|
-
var maxExecutionTime = (
|
|
102
|
-
/*istanbul ignore start*/
|
|
103
|
-
(_options$timeout = /*istanbul ignore end*/
|
|
104
|
-
options8.timeout) !== null && _options$timeout !== void 0 ? _options$timeout : Infinity
|
|
105
|
-
);
|
|
106
|
-
var abortAfterTimestamp = Date.now() + maxExecutionTime;
|
|
107
|
-
var bestPath = [{
|
|
108
|
-
oldPos: -1,
|
|
109
|
-
lastComponent: void 0
|
|
110
|
-
}];
|
|
111
|
-
var newPos = this.extractCommon(bestPath[0], newString, oldString, 0);
|
|
112
|
-
if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
|
|
113
|
-
return done([{
|
|
114
|
-
value: this.join(newString),
|
|
115
|
-
count: newString.length
|
|
116
|
-
}]);
|
|
117
|
-
}
|
|
118
|
-
var minDiagonalToConsider = -Infinity, maxDiagonalToConsider = Infinity;
|
|
119
|
-
function execEditLength() {
|
|
120
|
-
for (var diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) {
|
|
121
|
-
var basePath = (
|
|
122
|
-
/*istanbul ignore start*/
|
|
123
|
-
void 0
|
|
124
|
-
);
|
|
125
|
-
var removePath = bestPath[diagonalPath - 1], addPath = bestPath[diagonalPath + 1];
|
|
126
|
-
if (removePath) {
|
|
127
|
-
bestPath[diagonalPath - 1] = void 0;
|
|
128
|
-
}
|
|
129
|
-
var canAdd = false;
|
|
130
|
-
if (addPath) {
|
|
131
|
-
var addPathNewPos = addPath.oldPos - diagonalPath;
|
|
132
|
-
canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen;
|
|
133
|
-
}
|
|
134
|
-
var canRemove = removePath && removePath.oldPos + 1 < oldLen;
|
|
135
|
-
if (!canAdd && !canRemove) {
|
|
136
|
-
bestPath[diagonalPath] = void 0;
|
|
137
|
-
continue;
|
|
138
|
-
}
|
|
139
|
-
if (!canRemove || canAdd && removePath.oldPos + 1 < addPath.oldPos) {
|
|
140
|
-
basePath = self.addToPath(addPath, true, void 0, 0);
|
|
141
|
-
} else {
|
|
142
|
-
basePath = self.addToPath(removePath, void 0, true, 1);
|
|
143
|
-
}
|
|
144
|
-
newPos = self.extractCommon(basePath, newString, oldString, diagonalPath);
|
|
145
|
-
if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
|
|
146
|
-
return done(buildValues(self, basePath.lastComponent, newString, oldString, self.useLongestToken));
|
|
147
|
-
} else {
|
|
148
|
-
bestPath[diagonalPath] = basePath;
|
|
149
|
-
if (basePath.oldPos + 1 >= oldLen) {
|
|
150
|
-
maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1);
|
|
151
|
-
}
|
|
152
|
-
if (newPos + 1 >= newLen) {
|
|
153
|
-
minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
editLength++;
|
|
158
|
-
}
|
|
159
|
-
if (callback) {
|
|
160
|
-
(function exec() {
|
|
161
|
-
setTimeout(function() {
|
|
162
|
-
if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) {
|
|
163
|
-
return callback();
|
|
164
|
-
}
|
|
165
|
-
if (!execEditLength()) {
|
|
166
|
-
exec();
|
|
167
|
-
}
|
|
168
|
-
}, 0);
|
|
169
|
-
})();
|
|
170
|
-
} else {
|
|
171
|
-
while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) {
|
|
172
|
-
var ret = execEditLength();
|
|
173
|
-
if (ret) {
|
|
174
|
-
return ret;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
},
|
|
179
|
-
/*istanbul ignore start*/
|
|
180
|
-
/*istanbul ignore end*/
|
|
181
|
-
addToPath: function addToPath(path13, added, removed, oldPosInc) {
|
|
182
|
-
var last = path13.lastComponent;
|
|
183
|
-
if (last && last.added === added && last.removed === removed) {
|
|
184
|
-
return {
|
|
185
|
-
oldPos: path13.oldPos + oldPosInc,
|
|
186
|
-
lastComponent: {
|
|
187
|
-
count: last.count + 1,
|
|
188
|
-
added,
|
|
189
|
-
removed,
|
|
190
|
-
previousComponent: last.previousComponent
|
|
191
|
-
}
|
|
192
|
-
};
|
|
193
|
-
} else {
|
|
194
|
-
return {
|
|
195
|
-
oldPos: path13.oldPos + oldPosInc,
|
|
196
|
-
lastComponent: {
|
|
197
|
-
count: 1,
|
|
198
|
-
added,
|
|
199
|
-
removed,
|
|
200
|
-
previousComponent: last
|
|
201
|
-
}
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
},
|
|
205
|
-
/*istanbul ignore start*/
|
|
206
|
-
/*istanbul ignore end*/
|
|
207
|
-
extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
|
|
208
|
-
var newLen = newString.length, oldLen = oldString.length, oldPos = basePath.oldPos, newPos = oldPos - diagonalPath, commonCount = 0;
|
|
209
|
-
while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
|
|
210
|
-
newPos++;
|
|
211
|
-
oldPos++;
|
|
212
|
-
commonCount++;
|
|
213
|
-
}
|
|
214
|
-
if (commonCount) {
|
|
215
|
-
basePath.lastComponent = {
|
|
216
|
-
count: commonCount,
|
|
217
|
-
previousComponent: basePath.lastComponent
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
basePath.oldPos = oldPos;
|
|
221
|
-
return newPos;
|
|
222
|
-
},
|
|
223
|
-
/*istanbul ignore start*/
|
|
224
|
-
/*istanbul ignore end*/
|
|
225
|
-
equals: function equals(left, right) {
|
|
226
|
-
if (this.options.comparator) {
|
|
227
|
-
return this.options.comparator(left, right);
|
|
228
|
-
} else {
|
|
229
|
-
return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase();
|
|
230
|
-
}
|
|
231
|
-
},
|
|
232
|
-
/*istanbul ignore start*/
|
|
233
|
-
/*istanbul ignore end*/
|
|
234
|
-
removeEmpty: function removeEmpty(array2) {
|
|
235
|
-
var ret = [];
|
|
236
|
-
for (var i = 0; i < array2.length; i++) {
|
|
237
|
-
if (array2[i]) {
|
|
238
|
-
ret.push(array2[i]);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
return ret;
|
|
242
|
-
},
|
|
243
|
-
/*istanbul ignore start*/
|
|
244
|
-
/*istanbul ignore end*/
|
|
245
|
-
castInput: function castInput(value) {
|
|
246
|
-
return value;
|
|
247
|
-
},
|
|
248
|
-
/*istanbul ignore start*/
|
|
249
|
-
/*istanbul ignore end*/
|
|
250
|
-
tokenize: function tokenize(value) {
|
|
251
|
-
return value.split("");
|
|
252
|
-
},
|
|
253
|
-
/*istanbul ignore start*/
|
|
254
|
-
/*istanbul ignore end*/
|
|
255
|
-
join: function join2(chars) {
|
|
256
|
-
return chars.join("");
|
|
257
|
-
}
|
|
258
|
-
};
|
|
259
|
-
function buildValues(diff, lastComponent, newString, oldString, useLongestToken) {
|
|
260
|
-
var components = [];
|
|
261
|
-
var nextComponent;
|
|
262
|
-
while (lastComponent) {
|
|
263
|
-
components.push(lastComponent);
|
|
264
|
-
nextComponent = lastComponent.previousComponent;
|
|
265
|
-
delete lastComponent.previousComponent;
|
|
266
|
-
lastComponent = nextComponent;
|
|
267
|
-
}
|
|
268
|
-
components.reverse();
|
|
269
|
-
var componentPos = 0, componentLen = components.length, newPos = 0, oldPos = 0;
|
|
270
|
-
for (; componentPos < componentLen; componentPos++) {
|
|
271
|
-
var component = components[componentPos];
|
|
272
|
-
if (!component.removed) {
|
|
273
|
-
if (!component.added && useLongestToken) {
|
|
274
|
-
var value = newString.slice(newPos, newPos + component.count);
|
|
275
|
-
value = value.map(function(value2, i) {
|
|
276
|
-
var oldValue = oldString[oldPos + i];
|
|
277
|
-
return oldValue.length > value2.length ? oldValue : value2;
|
|
278
|
-
});
|
|
279
|
-
component.value = diff.join(value);
|
|
280
|
-
} else {
|
|
281
|
-
component.value = diff.join(newString.slice(newPos, newPos + component.count));
|
|
282
|
-
}
|
|
283
|
-
newPos += component.count;
|
|
284
|
-
if (!component.added) {
|
|
285
|
-
oldPos += component.count;
|
|
286
|
-
}
|
|
287
|
-
} else {
|
|
288
|
-
component.value = diff.join(oldString.slice(oldPos, oldPos + component.count));
|
|
289
|
-
oldPos += component.count;
|
|
290
|
-
if (componentPos && components[componentPos - 1].added) {
|
|
291
|
-
var tmp = components[componentPos - 1];
|
|
292
|
-
components[componentPos - 1] = components[componentPos];
|
|
293
|
-
components[componentPos] = tmp;
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
var finalComponent = components[componentLen - 1];
|
|
298
|
-
if (componentLen > 1 && typeof finalComponent.value === "string" && (finalComponent.added || finalComponent.removed) && diff.equals("", finalComponent.value)) {
|
|
299
|
-
components[componentLen - 2].value += finalComponent.value;
|
|
300
|
-
components.pop();
|
|
301
|
-
}
|
|
302
|
-
return components;
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
});
|
|
306
|
-
|
|
307
|
-
// node_modules/diff/lib/util/params.js
|
|
308
|
-
var require_params = __commonJS({
|
|
309
|
-
"node_modules/diff/lib/util/params.js"(exports) {
|
|
310
|
-
"use strict";
|
|
311
|
-
Object.defineProperty(exports, "__esModule", {
|
|
312
|
-
value: true
|
|
313
|
-
});
|
|
314
|
-
exports.generateOptions = generateOptions;
|
|
315
|
-
function generateOptions(options8, defaults) {
|
|
316
|
-
if (typeof options8 === "function") {
|
|
317
|
-
defaults.callback = options8;
|
|
318
|
-
} else if (options8) {
|
|
319
|
-
for (var name in options8) {
|
|
320
|
-
if (options8.hasOwnProperty(name)) {
|
|
321
|
-
defaults[name] = options8[name];
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
return defaults;
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
});
|
|
329
|
-
|
|
330
|
-
// node_modules/diff/lib/diff/line.js
|
|
331
|
-
var require_line = __commonJS({
|
|
332
|
-
"node_modules/diff/lib/diff/line.js"(exports) {
|
|
333
|
-
"use strict";
|
|
334
|
-
Object.defineProperty(exports, "__esModule", {
|
|
335
|
-
value: true
|
|
336
|
-
});
|
|
337
|
-
exports.diffLines = diffLines;
|
|
338
|
-
exports.diffTrimmedLines = diffTrimmedLines;
|
|
339
|
-
exports.lineDiff = void 0;
|
|
340
|
-
var _base = _interopRequireDefault(require_base());
|
|
341
|
-
var _params = require_params();
|
|
342
|
-
function _interopRequireDefault(obj) {
|
|
343
|
-
return obj && obj.__esModule ? obj : { "default": obj };
|
|
344
|
-
}
|
|
345
|
-
var lineDiff = new /*istanbul ignore start*/
|
|
346
|
-
_base[
|
|
347
|
-
/*istanbul ignore start*/
|
|
348
|
-
"default"
|
|
349
|
-
/*istanbul ignore end*/
|
|
350
|
-
]();
|
|
351
|
-
exports.lineDiff = lineDiff;
|
|
352
|
-
lineDiff.tokenize = function(value) {
|
|
353
|
-
if (this.options.stripTrailingCr) {
|
|
354
|
-
value = value.replace(/\r\n/g, "\n");
|
|
355
|
-
}
|
|
356
|
-
var retLines = [], linesAndNewlines = value.split(/(\n|\r\n)/);
|
|
357
|
-
if (!linesAndNewlines[linesAndNewlines.length - 1]) {
|
|
358
|
-
linesAndNewlines.pop();
|
|
359
|
-
}
|
|
360
|
-
for (var i = 0; i < linesAndNewlines.length; i++) {
|
|
361
|
-
var line3 = linesAndNewlines[i];
|
|
362
|
-
if (i % 2 && !this.options.newlineIsToken) {
|
|
363
|
-
retLines[retLines.length - 1] += line3;
|
|
364
|
-
} else {
|
|
365
|
-
if (this.options.ignoreWhitespace) {
|
|
366
|
-
line3 = line3.trim();
|
|
367
|
-
}
|
|
368
|
-
retLines.push(line3);
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
return retLines;
|
|
372
|
-
};
|
|
373
|
-
function diffLines(oldStr, newStr, callback) {
|
|
374
|
-
return lineDiff.diff(oldStr, newStr, callback);
|
|
375
|
-
}
|
|
376
|
-
function diffTrimmedLines(oldStr, newStr, callback) {
|
|
377
|
-
var options8 = (
|
|
378
|
-
/*istanbul ignore start*/
|
|
379
|
-
(0, /*istanbul ignore end*/
|
|
380
|
-
/*istanbul ignore start*/
|
|
381
|
-
_params.generateOptions)(callback, {
|
|
382
|
-
ignoreWhitespace: true
|
|
383
|
-
})
|
|
384
|
-
);
|
|
385
|
-
return lineDiff.diff(oldStr, newStr, options8);
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
});
|
|
389
|
-
|
|
390
|
-
// node_modules/diff/lib/patch/create.js
|
|
391
|
-
var require_create = __commonJS({
|
|
392
|
-
"node_modules/diff/lib/patch/create.js"(exports) {
|
|
393
|
-
"use strict";
|
|
394
|
-
Object.defineProperty(exports, "__esModule", {
|
|
395
|
-
value: true
|
|
396
|
-
});
|
|
397
|
-
exports.structuredPatch = structuredPatch;
|
|
398
|
-
exports.formatPatch = formatPatch;
|
|
399
|
-
exports.createTwoFilesPatch = createTwoFilesPatch2;
|
|
400
|
-
exports.createPatch = createPatch;
|
|
401
|
-
var _line = require_line();
|
|
402
|
-
function _toConsumableArray(arr) {
|
|
403
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
404
|
-
}
|
|
405
|
-
function _nonIterableSpread() {
|
|
406
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
407
|
-
}
|
|
408
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
409
|
-
if (!o) return;
|
|
410
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
411
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
412
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
413
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
414
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
415
|
-
}
|
|
416
|
-
function _iterableToArray(iter) {
|
|
417
|
-
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
|
|
418
|
-
}
|
|
419
|
-
function _arrayWithoutHoles(arr) {
|
|
420
|
-
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
421
|
-
}
|
|
422
|
-
function _arrayLikeToArray(arr, len) {
|
|
423
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
424
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
|
425
|
-
arr2[i] = arr[i];
|
|
426
|
-
}
|
|
427
|
-
return arr2;
|
|
428
|
-
}
|
|
429
|
-
function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options8) {
|
|
430
|
-
if (!options8) {
|
|
431
|
-
options8 = {};
|
|
432
|
-
}
|
|
433
|
-
if (typeof options8.context === "undefined") {
|
|
434
|
-
options8.context = 4;
|
|
435
|
-
}
|
|
436
|
-
var diff = (
|
|
437
|
-
/*istanbul ignore start*/
|
|
438
|
-
(0, /*istanbul ignore end*/
|
|
439
|
-
/*istanbul ignore start*/
|
|
440
|
-
_line.diffLines)(oldStr, newStr, options8)
|
|
441
|
-
);
|
|
442
|
-
if (!diff) {
|
|
443
|
-
return;
|
|
444
|
-
}
|
|
445
|
-
diff.push({
|
|
446
|
-
value: "",
|
|
447
|
-
lines: []
|
|
448
|
-
});
|
|
449
|
-
function contextLines(lines) {
|
|
450
|
-
return lines.map(function(entry) {
|
|
451
|
-
return " " + entry;
|
|
452
|
-
});
|
|
453
|
-
}
|
|
454
|
-
var hunks = [];
|
|
455
|
-
var oldRangeStart = 0, newRangeStart = 0, curRange = [], oldLine = 1, newLine = 1;
|
|
456
|
-
var _loop = function _loop2(i2) {
|
|
457
|
-
var current = diff[i2], lines = current.lines || current.value.replace(/\n$/, "").split("\n");
|
|
458
|
-
current.lines = lines;
|
|
459
|
-
if (current.added || current.removed) {
|
|
460
|
-
var _curRange;
|
|
461
|
-
if (!oldRangeStart) {
|
|
462
|
-
var prev = diff[i2 - 1];
|
|
463
|
-
oldRangeStart = oldLine;
|
|
464
|
-
newRangeStart = newLine;
|
|
465
|
-
if (prev) {
|
|
466
|
-
curRange = options8.context > 0 ? contextLines(prev.lines.slice(-options8.context)) : [];
|
|
467
|
-
oldRangeStart -= curRange.length;
|
|
468
|
-
newRangeStart -= curRange.length;
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
(_curRange = /*istanbul ignore end*/
|
|
472
|
-
curRange).push.apply(
|
|
473
|
-
/*istanbul ignore start*/
|
|
474
|
-
_curRange,
|
|
475
|
-
/*istanbul ignore start*/
|
|
476
|
-
_toConsumableArray(
|
|
477
|
-
/*istanbul ignore end*/
|
|
478
|
-
lines.map(function(entry) {
|
|
479
|
-
return (current.added ? "+" : "-") + entry;
|
|
480
|
-
})
|
|
481
|
-
)
|
|
482
|
-
);
|
|
483
|
-
if (current.added) {
|
|
484
|
-
newLine += lines.length;
|
|
485
|
-
} else {
|
|
486
|
-
oldLine += lines.length;
|
|
487
|
-
}
|
|
488
|
-
} else {
|
|
489
|
-
if (oldRangeStart) {
|
|
490
|
-
if (lines.length <= options8.context * 2 && i2 < diff.length - 2) {
|
|
491
|
-
var _curRange2;
|
|
492
|
-
(_curRange2 = /*istanbul ignore end*/
|
|
493
|
-
curRange).push.apply(
|
|
494
|
-
/*istanbul ignore start*/
|
|
495
|
-
_curRange2,
|
|
496
|
-
/*istanbul ignore start*/
|
|
497
|
-
_toConsumableArray(
|
|
498
|
-
/*istanbul ignore end*/
|
|
499
|
-
contextLines(lines)
|
|
500
|
-
)
|
|
501
|
-
);
|
|
502
|
-
} else {
|
|
503
|
-
var _curRange3;
|
|
504
|
-
var contextSize = Math.min(lines.length, options8.context);
|
|
505
|
-
(_curRange3 = /*istanbul ignore end*/
|
|
506
|
-
curRange).push.apply(
|
|
507
|
-
/*istanbul ignore start*/
|
|
508
|
-
_curRange3,
|
|
509
|
-
/*istanbul ignore start*/
|
|
510
|
-
_toConsumableArray(
|
|
511
|
-
/*istanbul ignore end*/
|
|
512
|
-
contextLines(lines.slice(0, contextSize))
|
|
513
|
-
)
|
|
514
|
-
);
|
|
515
|
-
var hunk = {
|
|
516
|
-
oldStart: oldRangeStart,
|
|
517
|
-
oldLines: oldLine - oldRangeStart + contextSize,
|
|
518
|
-
newStart: newRangeStart,
|
|
519
|
-
newLines: newLine - newRangeStart + contextSize,
|
|
520
|
-
lines: curRange
|
|
521
|
-
};
|
|
522
|
-
if (i2 >= diff.length - 2 && lines.length <= options8.context) {
|
|
523
|
-
var oldEOFNewline = /\n$/.test(oldStr);
|
|
524
|
-
var newEOFNewline = /\n$/.test(newStr);
|
|
525
|
-
var noNlBeforeAdds = lines.length == 0 && curRange.length > hunk.oldLines;
|
|
526
|
-
if (!oldEOFNewline && noNlBeforeAdds && oldStr.length > 0) {
|
|
527
|
-
curRange.splice(hunk.oldLines, 0, "\");
|
|
528
|
-
}
|
|
529
|
-
if (!oldEOFNewline && !noNlBeforeAdds || !newEOFNewline) {
|
|
530
|
-
curRange.push("\");
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
hunks.push(hunk);
|
|
534
|
-
oldRangeStart = 0;
|
|
535
|
-
newRangeStart = 0;
|
|
536
|
-
curRange = [];
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
oldLine += lines.length;
|
|
540
|
-
newLine += lines.length;
|
|
541
|
-
}
|
|
542
|
-
};
|
|
543
|
-
for (var i = 0; i < diff.length; i++) {
|
|
544
|
-
_loop(
|
|
545
|
-
/*istanbul ignore end*/
|
|
546
|
-
i
|
|
547
|
-
);
|
|
548
|
-
}
|
|
549
|
-
return {
|
|
550
|
-
oldFileName,
|
|
551
|
-
newFileName,
|
|
552
|
-
oldHeader,
|
|
553
|
-
newHeader,
|
|
554
|
-
hunks
|
|
555
|
-
};
|
|
556
|
-
}
|
|
557
|
-
function formatPatch(diff) {
|
|
558
|
-
if (Array.isArray(diff)) {
|
|
559
|
-
return diff.map(formatPatch).join("\n");
|
|
560
|
-
}
|
|
561
|
-
var ret = [];
|
|
562
|
-
if (diff.oldFileName == diff.newFileName) {
|
|
563
|
-
ret.push("Index: " + diff.oldFileName);
|
|
564
|
-
}
|
|
565
|
-
ret.push("===================================================================");
|
|
566
|
-
ret.push("--- " + diff.oldFileName + (typeof diff.oldHeader === "undefined" ? "" : " " + diff.oldHeader));
|
|
567
|
-
ret.push("+++ " + diff.newFileName + (typeof diff.newHeader === "undefined" ? "" : " " + diff.newHeader));
|
|
568
|
-
for (var i = 0; i < diff.hunks.length; i++) {
|
|
569
|
-
var hunk = diff.hunks[i];
|
|
570
|
-
if (hunk.oldLines === 0) {
|
|
571
|
-
hunk.oldStart -= 1;
|
|
572
|
-
}
|
|
573
|
-
if (hunk.newLines === 0) {
|
|
574
|
-
hunk.newStart -= 1;
|
|
575
|
-
}
|
|
576
|
-
ret.push("@@ -" + hunk.oldStart + "," + hunk.oldLines + " +" + hunk.newStart + "," + hunk.newLines + " @@");
|
|
577
|
-
ret.push.apply(ret, hunk.lines);
|
|
578
|
-
}
|
|
579
|
-
return ret.join("\n") + "\n";
|
|
580
|
-
}
|
|
581
|
-
function createTwoFilesPatch2(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options8) {
|
|
582
|
-
return formatPatch(structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options8));
|
|
583
|
-
}
|
|
584
|
-
function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options8) {
|
|
585
|
-
return createTwoFilesPatch2(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options8);
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
});
|
|
589
|
-
|
|
590
58
|
// node_modules/fast-glob/out/utils/array.js
|
|
591
59
|
var require_array = __commonJS({
|
|
592
60
|
"node_modules/fast-glob/out/utils/array.js"(exports) {
|
|
@@ -1202,9 +670,9 @@ var require_to_regex_range = __commonJS({
|
|
|
1202
670
|
if (!tok.isPadded) {
|
|
1203
671
|
return value;
|
|
1204
672
|
}
|
|
1205
|
-
let
|
|
673
|
+
let diff2 = Math.abs(tok.maxLen - String(value).length);
|
|
1206
674
|
let relax = options8.relaxZeros !== false;
|
|
1207
|
-
switch (
|
|
675
|
+
switch (diff2) {
|
|
1208
676
|
case 0:
|
|
1209
677
|
return "";
|
|
1210
678
|
case 1:
|
|
@@ -1212,7 +680,7 @@ var require_to_regex_range = __commonJS({
|
|
|
1212
680
|
case 2:
|
|
1213
681
|
return relax ? "0{0,2}" : "00";
|
|
1214
682
|
default: {
|
|
1215
|
-
return relax ? `0{0,${
|
|
683
|
+
return relax ? `0{0,${diff2}}` : `0{${diff2}}`;
|
|
1216
684
|
}
|
|
1217
685
|
}
|
|
1218
686
|
}
|
|
@@ -4627,14 +4095,14 @@ var require_queue = __commonJS({
|
|
|
4627
4095
|
"node_modules/fastq/queue.js"(exports, module) {
|
|
4628
4096
|
"use strict";
|
|
4629
4097
|
var reusify = require_reusify();
|
|
4630
|
-
function fastqueue(context, worker,
|
|
4098
|
+
function fastqueue(context, worker, _concurrency) {
|
|
4631
4099
|
if (typeof context === "function") {
|
|
4632
|
-
|
|
4100
|
+
_concurrency = worker;
|
|
4633
4101
|
worker = context;
|
|
4634
4102
|
context = null;
|
|
4635
4103
|
}
|
|
4636
|
-
if (
|
|
4637
|
-
throw new Error("fastqueue concurrency must be greater than 1");
|
|
4104
|
+
if (!(_concurrency >= 1)) {
|
|
4105
|
+
throw new Error("fastqueue concurrency must be equal to or greater than 1");
|
|
4638
4106
|
}
|
|
4639
4107
|
var cache3 = reusify(Task);
|
|
4640
4108
|
var queueHead = null;
|
|
@@ -4647,7 +4115,20 @@ var require_queue = __commonJS({
|
|
|
4647
4115
|
saturated: noop2,
|
|
4648
4116
|
pause,
|
|
4649
4117
|
paused: false,
|
|
4650
|
-
concurrency
|
|
4118
|
+
get concurrency() {
|
|
4119
|
+
return _concurrency;
|
|
4120
|
+
},
|
|
4121
|
+
set concurrency(value) {
|
|
4122
|
+
if (!(value >= 1)) {
|
|
4123
|
+
throw new Error("fastqueue concurrency must be equal to or greater than 1");
|
|
4124
|
+
}
|
|
4125
|
+
_concurrency = value;
|
|
4126
|
+
if (self.paused) return;
|
|
4127
|
+
for (; queueHead && _running < _concurrency; ) {
|
|
4128
|
+
_running++;
|
|
4129
|
+
release();
|
|
4130
|
+
}
|
|
4131
|
+
},
|
|
4651
4132
|
running,
|
|
4652
4133
|
resume,
|
|
4653
4134
|
idle,
|
|
@@ -4687,7 +4168,12 @@ var require_queue = __commonJS({
|
|
|
4687
4168
|
function resume() {
|
|
4688
4169
|
if (!self.paused) return;
|
|
4689
4170
|
self.paused = false;
|
|
4690
|
-
|
|
4171
|
+
if (queueHead === null) {
|
|
4172
|
+
_running++;
|
|
4173
|
+
release();
|
|
4174
|
+
return;
|
|
4175
|
+
}
|
|
4176
|
+
for (; queueHead && _running < _concurrency; ) {
|
|
4691
4177
|
_running++;
|
|
4692
4178
|
release();
|
|
4693
4179
|
}
|
|
@@ -4702,7 +4188,7 @@ var require_queue = __commonJS({
|
|
|
4702
4188
|
current.value = value;
|
|
4703
4189
|
current.callback = done || noop2;
|
|
4704
4190
|
current.errorHandler = errorHandler;
|
|
4705
|
-
if (_running
|
|
4191
|
+
if (_running >= _concurrency || self.paused) {
|
|
4706
4192
|
if (queueTail) {
|
|
4707
4193
|
queueTail.next = current;
|
|
4708
4194
|
queueTail = current;
|
|
@@ -4722,7 +4208,8 @@ var require_queue = __commonJS({
|
|
|
4722
4208
|
current.release = release;
|
|
4723
4209
|
current.value = value;
|
|
4724
4210
|
current.callback = done || noop2;
|
|
4725
|
-
|
|
4211
|
+
current.errorHandler = errorHandler;
|
|
4212
|
+
if (_running >= _concurrency || self.paused) {
|
|
4726
4213
|
if (queueHead) {
|
|
4727
4214
|
current.next = queueHead;
|
|
4728
4215
|
queueHead = current;
|
|
@@ -4741,7 +4228,7 @@ var require_queue = __commonJS({
|
|
|
4741
4228
|
cache3.release(holder);
|
|
4742
4229
|
}
|
|
4743
4230
|
var next = queueHead;
|
|
4744
|
-
if (next) {
|
|
4231
|
+
if (next && _running <= _concurrency) {
|
|
4745
4232
|
if (!self.paused) {
|
|
4746
4233
|
if (queueTail === queueHead) {
|
|
4747
4234
|
queueTail = null;
|
|
@@ -4797,9 +4284,9 @@ var require_queue = __commonJS({
|
|
|
4797
4284
|
self.release(self);
|
|
4798
4285
|
};
|
|
4799
4286
|
}
|
|
4800
|
-
function queueAsPromised(context, worker,
|
|
4287
|
+
function queueAsPromised(context, worker, _concurrency) {
|
|
4801
4288
|
if (typeof context === "function") {
|
|
4802
|
-
|
|
4289
|
+
_concurrency = worker;
|
|
4803
4290
|
worker = context;
|
|
4804
4291
|
context = null;
|
|
4805
4292
|
}
|
|
@@ -4808,7 +4295,7 @@ var require_queue = __commonJS({
|
|
|
4808
4295
|
cb(null, res);
|
|
4809
4296
|
}, cb);
|
|
4810
4297
|
}
|
|
4811
|
-
var queue = fastqueue(context, asyncWrapper,
|
|
4298
|
+
var queue = fastqueue(context, asyncWrapper, _concurrency);
|
|
4812
4299
|
var pushCb = queue.push;
|
|
4813
4300
|
var unshiftCb = queue.unshift;
|
|
4814
4301
|
queue.push = push2;
|
|
@@ -7401,9 +6888,9 @@ var require_yallist = __commonJS({
|
|
|
7401
6888
|
}
|
|
7402
6889
|
});
|
|
7403
6890
|
|
|
7404
|
-
// node_modules/
|
|
6891
|
+
// node_modules/lru-cache/index.js
|
|
7405
6892
|
var require_lru_cache = __commonJS({
|
|
7406
|
-
"node_modules/
|
|
6893
|
+
"node_modules/lru-cache/index.js"(exports, module) {
|
|
7407
6894
|
"use strict";
|
|
7408
6895
|
module.exports = LRUCache;
|
|
7409
6896
|
var Map2 = require_map();
|
|
@@ -7755,11 +7242,11 @@ var require_lru_cache = __commonJS({
|
|
|
7755
7242
|
return false;
|
|
7756
7243
|
}
|
|
7757
7244
|
var stale = false;
|
|
7758
|
-
var
|
|
7245
|
+
var diff2 = Date.now() - hit.now;
|
|
7759
7246
|
if (hit.maxAge) {
|
|
7760
|
-
stale =
|
|
7247
|
+
stale = diff2 > hit.maxAge;
|
|
7761
7248
|
} else {
|
|
7762
|
-
stale = self[MAX_AGE] &&
|
|
7249
|
+
stale = self[MAX_AGE] && diff2 > self[MAX_AGE];
|
|
7763
7250
|
}
|
|
7764
7251
|
return stale;
|
|
7765
7252
|
}
|
|
@@ -11301,7 +10788,7 @@ var require_lib2 = __commonJS({
|
|
|
11301
10788
|
}
|
|
11302
10789
|
var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
|
|
11303
10790
|
var BRACKET = /^[()[\]{}]$/;
|
|
11304
|
-
var
|
|
10791
|
+
var tokenize2;
|
|
11305
10792
|
{
|
|
11306
10793
|
const JSX_TAG = /^[a-z][\w-]*$/i;
|
|
11307
10794
|
const getTokenType = function(token2, offset, text) {
|
|
@@ -11324,7 +10811,7 @@ var require_lib2 = __commonJS({
|
|
|
11324
10811
|
}
|
|
11325
10812
|
return token2.type;
|
|
11326
10813
|
};
|
|
11327
|
-
|
|
10814
|
+
tokenize2 = function* (text) {
|
|
11328
10815
|
let match;
|
|
11329
10816
|
while (match = _jsTokens.default.exec(text)) {
|
|
11330
10817
|
const token2 = _jsTokens.matchToToken(match);
|
|
@@ -11340,7 +10827,7 @@ var require_lib2 = __commonJS({
|
|
|
11340
10827
|
for (const {
|
|
11341
10828
|
type: type2,
|
|
11342
10829
|
value
|
|
11343
|
-
} of
|
|
10830
|
+
} of tokenize2(text)) {
|
|
11344
10831
|
const colorize = defs[type2];
|
|
11345
10832
|
if (colorize) {
|
|
11346
10833
|
highlighted += value.split(NEWLINE).map((str2) => colorize(str2)).join("\n");
|
|
@@ -11463,17 +10950,17 @@ var require_lib3 = __commonJS({
|
|
|
11463
10950
|
if (endLine === -1) {
|
|
11464
10951
|
end = source2.length;
|
|
11465
10952
|
}
|
|
11466
|
-
const
|
|
10953
|
+
const lineDiff2 = endLine - startLine;
|
|
11467
10954
|
const markerLines = {};
|
|
11468
|
-
if (
|
|
11469
|
-
for (let i = 0; i <=
|
|
10955
|
+
if (lineDiff2) {
|
|
10956
|
+
for (let i = 0; i <= lineDiff2; i++) {
|
|
11470
10957
|
const lineNumber = i + startLine;
|
|
11471
10958
|
if (!startColumn) {
|
|
11472
10959
|
markerLines[lineNumber] = true;
|
|
11473
10960
|
} else if (i === 0) {
|
|
11474
10961
|
const sourceLength = source2[lineNumber - 1].length;
|
|
11475
10962
|
markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1];
|
|
11476
|
-
} else if (i ===
|
|
10963
|
+
} else if (i === lineDiff2) {
|
|
11477
10964
|
markerLines[lineNumber] = [0, endColumn];
|
|
11478
10965
|
} else {
|
|
11479
10966
|
const sourceLength = source2[lineNumber - i].length;
|
|
@@ -12069,38 +11556,6 @@ var require_readlines = __commonJS({
|
|
|
12069
11556
|
}
|
|
12070
11557
|
});
|
|
12071
11558
|
|
|
12072
|
-
// node_modules/diff/lib/diff/array.js
|
|
12073
|
-
var require_array2 = __commonJS({
|
|
12074
|
-
"node_modules/diff/lib/diff/array.js"(exports) {
|
|
12075
|
-
"use strict";
|
|
12076
|
-
Object.defineProperty(exports, "__esModule", {
|
|
12077
|
-
value: true
|
|
12078
|
-
});
|
|
12079
|
-
exports.diffArrays = diffArrays2;
|
|
12080
|
-
exports.arrayDiff = void 0;
|
|
12081
|
-
var _base = _interopRequireDefault(require_base());
|
|
12082
|
-
function _interopRequireDefault(obj) {
|
|
12083
|
-
return obj && obj.__esModule ? obj : { "default": obj };
|
|
12084
|
-
}
|
|
12085
|
-
var arrayDiff = new /*istanbul ignore start*/
|
|
12086
|
-
_base[
|
|
12087
|
-
/*istanbul ignore start*/
|
|
12088
|
-
"default"
|
|
12089
|
-
/*istanbul ignore end*/
|
|
12090
|
-
]();
|
|
12091
|
-
exports.arrayDiff = arrayDiff;
|
|
12092
|
-
arrayDiff.tokenize = function(value) {
|
|
12093
|
-
return value.slice();
|
|
12094
|
-
};
|
|
12095
|
-
arrayDiff.join = arrayDiff.removeEmpty = function(value) {
|
|
12096
|
-
return value;
|
|
12097
|
-
};
|
|
12098
|
-
function diffArrays2(oldArr, newArr, callback) {
|
|
12099
|
-
return arrayDiff.diff(oldArr, newArr, callback);
|
|
12100
|
-
}
|
|
12101
|
-
}
|
|
12102
|
-
});
|
|
12103
|
-
|
|
12104
11559
|
// src/index.js
|
|
12105
11560
|
var src_exports = {};
|
|
12106
11561
|
__export(src_exports, {
|
|
@@ -12118,7 +11573,510 @@ __export(src_exports, {
|
|
|
12118
11573
|
util: () => public_exports,
|
|
12119
11574
|
version: () => version_evaluate_default
|
|
12120
11575
|
});
|
|
12121
|
-
|
|
11576
|
+
|
|
11577
|
+
// node_modules/diff/lib/index.mjs
|
|
11578
|
+
function Diff() {
|
|
11579
|
+
}
|
|
11580
|
+
Diff.prototype = {
|
|
11581
|
+
diff: function diff(oldString, newString) {
|
|
11582
|
+
var _options$timeout;
|
|
11583
|
+
var options8 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
11584
|
+
var callback = options8.callback;
|
|
11585
|
+
if (typeof options8 === "function") {
|
|
11586
|
+
callback = options8;
|
|
11587
|
+
options8 = {};
|
|
11588
|
+
}
|
|
11589
|
+
this.options = options8;
|
|
11590
|
+
var self = this;
|
|
11591
|
+
function done(value) {
|
|
11592
|
+
if (callback) {
|
|
11593
|
+
setTimeout(function() {
|
|
11594
|
+
callback(void 0, value);
|
|
11595
|
+
}, 0);
|
|
11596
|
+
return true;
|
|
11597
|
+
} else {
|
|
11598
|
+
return value;
|
|
11599
|
+
}
|
|
11600
|
+
}
|
|
11601
|
+
oldString = this.castInput(oldString);
|
|
11602
|
+
newString = this.castInput(newString);
|
|
11603
|
+
oldString = this.removeEmpty(this.tokenize(oldString));
|
|
11604
|
+
newString = this.removeEmpty(this.tokenize(newString));
|
|
11605
|
+
var newLen = newString.length, oldLen = oldString.length;
|
|
11606
|
+
var editLength = 1;
|
|
11607
|
+
var maxEditLength = newLen + oldLen;
|
|
11608
|
+
if (options8.maxEditLength) {
|
|
11609
|
+
maxEditLength = Math.min(maxEditLength, options8.maxEditLength);
|
|
11610
|
+
}
|
|
11611
|
+
var maxExecutionTime = (_options$timeout = options8.timeout) !== null && _options$timeout !== void 0 ? _options$timeout : Infinity;
|
|
11612
|
+
var abortAfterTimestamp = Date.now() + maxExecutionTime;
|
|
11613
|
+
var bestPath = [{
|
|
11614
|
+
oldPos: -1,
|
|
11615
|
+
lastComponent: void 0
|
|
11616
|
+
}];
|
|
11617
|
+
var newPos = this.extractCommon(bestPath[0], newString, oldString, 0);
|
|
11618
|
+
if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
|
|
11619
|
+
return done([{
|
|
11620
|
+
value: this.join(newString),
|
|
11621
|
+
count: newString.length
|
|
11622
|
+
}]);
|
|
11623
|
+
}
|
|
11624
|
+
var minDiagonalToConsider = -Infinity, maxDiagonalToConsider = Infinity;
|
|
11625
|
+
function execEditLength() {
|
|
11626
|
+
for (var diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) {
|
|
11627
|
+
var basePath = void 0;
|
|
11628
|
+
var removePath = bestPath[diagonalPath - 1], addPath = bestPath[diagonalPath + 1];
|
|
11629
|
+
if (removePath) {
|
|
11630
|
+
bestPath[diagonalPath - 1] = void 0;
|
|
11631
|
+
}
|
|
11632
|
+
var canAdd = false;
|
|
11633
|
+
if (addPath) {
|
|
11634
|
+
var addPathNewPos = addPath.oldPos - diagonalPath;
|
|
11635
|
+
canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen;
|
|
11636
|
+
}
|
|
11637
|
+
var canRemove = removePath && removePath.oldPos + 1 < oldLen;
|
|
11638
|
+
if (!canAdd && !canRemove) {
|
|
11639
|
+
bestPath[diagonalPath] = void 0;
|
|
11640
|
+
continue;
|
|
11641
|
+
}
|
|
11642
|
+
if (!canRemove || canAdd && removePath.oldPos + 1 < addPath.oldPos) {
|
|
11643
|
+
basePath = self.addToPath(addPath, true, void 0, 0);
|
|
11644
|
+
} else {
|
|
11645
|
+
basePath = self.addToPath(removePath, void 0, true, 1);
|
|
11646
|
+
}
|
|
11647
|
+
newPos = self.extractCommon(basePath, newString, oldString, diagonalPath);
|
|
11648
|
+
if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
|
|
11649
|
+
return done(buildValues(self, basePath.lastComponent, newString, oldString, self.useLongestToken));
|
|
11650
|
+
} else {
|
|
11651
|
+
bestPath[diagonalPath] = basePath;
|
|
11652
|
+
if (basePath.oldPos + 1 >= oldLen) {
|
|
11653
|
+
maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1);
|
|
11654
|
+
}
|
|
11655
|
+
if (newPos + 1 >= newLen) {
|
|
11656
|
+
minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1);
|
|
11657
|
+
}
|
|
11658
|
+
}
|
|
11659
|
+
}
|
|
11660
|
+
editLength++;
|
|
11661
|
+
}
|
|
11662
|
+
if (callback) {
|
|
11663
|
+
(function exec() {
|
|
11664
|
+
setTimeout(function() {
|
|
11665
|
+
if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) {
|
|
11666
|
+
return callback();
|
|
11667
|
+
}
|
|
11668
|
+
if (!execEditLength()) {
|
|
11669
|
+
exec();
|
|
11670
|
+
}
|
|
11671
|
+
}, 0);
|
|
11672
|
+
})();
|
|
11673
|
+
} else {
|
|
11674
|
+
while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) {
|
|
11675
|
+
var ret = execEditLength();
|
|
11676
|
+
if (ret) {
|
|
11677
|
+
return ret;
|
|
11678
|
+
}
|
|
11679
|
+
}
|
|
11680
|
+
}
|
|
11681
|
+
},
|
|
11682
|
+
addToPath: function addToPath(path13, added, removed, oldPosInc) {
|
|
11683
|
+
var last = path13.lastComponent;
|
|
11684
|
+
if (last && last.added === added && last.removed === removed) {
|
|
11685
|
+
return {
|
|
11686
|
+
oldPos: path13.oldPos + oldPosInc,
|
|
11687
|
+
lastComponent: {
|
|
11688
|
+
count: last.count + 1,
|
|
11689
|
+
added,
|
|
11690
|
+
removed,
|
|
11691
|
+
previousComponent: last.previousComponent
|
|
11692
|
+
}
|
|
11693
|
+
};
|
|
11694
|
+
} else {
|
|
11695
|
+
return {
|
|
11696
|
+
oldPos: path13.oldPos + oldPosInc,
|
|
11697
|
+
lastComponent: {
|
|
11698
|
+
count: 1,
|
|
11699
|
+
added,
|
|
11700
|
+
removed,
|
|
11701
|
+
previousComponent: last
|
|
11702
|
+
}
|
|
11703
|
+
};
|
|
11704
|
+
}
|
|
11705
|
+
},
|
|
11706
|
+
extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
|
|
11707
|
+
var newLen = newString.length, oldLen = oldString.length, oldPos = basePath.oldPos, newPos = oldPos - diagonalPath, commonCount = 0;
|
|
11708
|
+
while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
|
|
11709
|
+
newPos++;
|
|
11710
|
+
oldPos++;
|
|
11711
|
+
commonCount++;
|
|
11712
|
+
}
|
|
11713
|
+
if (commonCount) {
|
|
11714
|
+
basePath.lastComponent = {
|
|
11715
|
+
count: commonCount,
|
|
11716
|
+
previousComponent: basePath.lastComponent
|
|
11717
|
+
};
|
|
11718
|
+
}
|
|
11719
|
+
basePath.oldPos = oldPos;
|
|
11720
|
+
return newPos;
|
|
11721
|
+
},
|
|
11722
|
+
equals: function equals(left, right) {
|
|
11723
|
+
if (this.options.comparator) {
|
|
11724
|
+
return this.options.comparator(left, right);
|
|
11725
|
+
} else {
|
|
11726
|
+
return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase();
|
|
11727
|
+
}
|
|
11728
|
+
},
|
|
11729
|
+
removeEmpty: function removeEmpty(array2) {
|
|
11730
|
+
var ret = [];
|
|
11731
|
+
for (var i = 0; i < array2.length; i++) {
|
|
11732
|
+
if (array2[i]) {
|
|
11733
|
+
ret.push(array2[i]);
|
|
11734
|
+
}
|
|
11735
|
+
}
|
|
11736
|
+
return ret;
|
|
11737
|
+
},
|
|
11738
|
+
castInput: function castInput(value) {
|
|
11739
|
+
return value;
|
|
11740
|
+
},
|
|
11741
|
+
tokenize: function tokenize(value) {
|
|
11742
|
+
return value.split("");
|
|
11743
|
+
},
|
|
11744
|
+
join: function join(chars) {
|
|
11745
|
+
return chars.join("");
|
|
11746
|
+
}
|
|
11747
|
+
};
|
|
11748
|
+
function buildValues(diff2, lastComponent, newString, oldString, useLongestToken) {
|
|
11749
|
+
var components = [];
|
|
11750
|
+
var nextComponent;
|
|
11751
|
+
while (lastComponent) {
|
|
11752
|
+
components.push(lastComponent);
|
|
11753
|
+
nextComponent = lastComponent.previousComponent;
|
|
11754
|
+
delete lastComponent.previousComponent;
|
|
11755
|
+
lastComponent = nextComponent;
|
|
11756
|
+
}
|
|
11757
|
+
components.reverse();
|
|
11758
|
+
var componentPos = 0, componentLen = components.length, newPos = 0, oldPos = 0;
|
|
11759
|
+
for (; componentPos < componentLen; componentPos++) {
|
|
11760
|
+
var component = components[componentPos];
|
|
11761
|
+
if (!component.removed) {
|
|
11762
|
+
if (!component.added && useLongestToken) {
|
|
11763
|
+
var value = newString.slice(newPos, newPos + component.count);
|
|
11764
|
+
value = value.map(function(value2, i) {
|
|
11765
|
+
var oldValue = oldString[oldPos + i];
|
|
11766
|
+
return oldValue.length > value2.length ? oldValue : value2;
|
|
11767
|
+
});
|
|
11768
|
+
component.value = diff2.join(value);
|
|
11769
|
+
} else {
|
|
11770
|
+
component.value = diff2.join(newString.slice(newPos, newPos + component.count));
|
|
11771
|
+
}
|
|
11772
|
+
newPos += component.count;
|
|
11773
|
+
if (!component.added) {
|
|
11774
|
+
oldPos += component.count;
|
|
11775
|
+
}
|
|
11776
|
+
} else {
|
|
11777
|
+
component.value = diff2.join(oldString.slice(oldPos, oldPos + component.count));
|
|
11778
|
+
oldPos += component.count;
|
|
11779
|
+
if (componentPos && components[componentPos - 1].added) {
|
|
11780
|
+
var tmp = components[componentPos - 1];
|
|
11781
|
+
components[componentPos - 1] = components[componentPos];
|
|
11782
|
+
components[componentPos] = tmp;
|
|
11783
|
+
}
|
|
11784
|
+
}
|
|
11785
|
+
}
|
|
11786
|
+
var finalComponent = components[componentLen - 1];
|
|
11787
|
+
if (componentLen > 1 && typeof finalComponent.value === "string" && (finalComponent.added || finalComponent.removed) && diff2.equals("", finalComponent.value)) {
|
|
11788
|
+
components[componentLen - 2].value += finalComponent.value;
|
|
11789
|
+
components.pop();
|
|
11790
|
+
}
|
|
11791
|
+
return components;
|
|
11792
|
+
}
|
|
11793
|
+
var characterDiff = new Diff();
|
|
11794
|
+
var extendedWordChars = /^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/;
|
|
11795
|
+
var reWhitespace = /\S/;
|
|
11796
|
+
var wordDiff = new Diff();
|
|
11797
|
+
wordDiff.equals = function(left, right) {
|
|
11798
|
+
if (this.options.ignoreCase) {
|
|
11799
|
+
left = left.toLowerCase();
|
|
11800
|
+
right = right.toLowerCase();
|
|
11801
|
+
}
|
|
11802
|
+
return left === right || this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right);
|
|
11803
|
+
};
|
|
11804
|
+
wordDiff.tokenize = function(value) {
|
|
11805
|
+
var tokens = value.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);
|
|
11806
|
+
for (var i = 0; i < tokens.length - 1; i++) {
|
|
11807
|
+
if (!tokens[i + 1] && tokens[i + 2] && extendedWordChars.test(tokens[i]) && extendedWordChars.test(tokens[i + 2])) {
|
|
11808
|
+
tokens[i] += tokens[i + 2];
|
|
11809
|
+
tokens.splice(i + 1, 2);
|
|
11810
|
+
i--;
|
|
11811
|
+
}
|
|
11812
|
+
}
|
|
11813
|
+
return tokens;
|
|
11814
|
+
};
|
|
11815
|
+
var lineDiff = new Diff();
|
|
11816
|
+
lineDiff.tokenize = function(value) {
|
|
11817
|
+
if (this.options.stripTrailingCr) {
|
|
11818
|
+
value = value.replace(/\r\n/g, "\n");
|
|
11819
|
+
}
|
|
11820
|
+
var retLines = [], linesAndNewlines = value.split(/(\n|\r\n)/);
|
|
11821
|
+
if (!linesAndNewlines[linesAndNewlines.length - 1]) {
|
|
11822
|
+
linesAndNewlines.pop();
|
|
11823
|
+
}
|
|
11824
|
+
for (var i = 0; i < linesAndNewlines.length; i++) {
|
|
11825
|
+
var line3 = linesAndNewlines[i];
|
|
11826
|
+
if (i % 2 && !this.options.newlineIsToken) {
|
|
11827
|
+
retLines[retLines.length - 1] += line3;
|
|
11828
|
+
} else {
|
|
11829
|
+
if (this.options.ignoreWhitespace) {
|
|
11830
|
+
line3 = line3.trim();
|
|
11831
|
+
}
|
|
11832
|
+
retLines.push(line3);
|
|
11833
|
+
}
|
|
11834
|
+
}
|
|
11835
|
+
return retLines;
|
|
11836
|
+
};
|
|
11837
|
+
function diffLines(oldStr, newStr, callback) {
|
|
11838
|
+
return lineDiff.diff(oldStr, newStr, callback);
|
|
11839
|
+
}
|
|
11840
|
+
var sentenceDiff = new Diff();
|
|
11841
|
+
sentenceDiff.tokenize = function(value) {
|
|
11842
|
+
return value.split(/(\S.+?[.!?])(?=\s+|$)/);
|
|
11843
|
+
};
|
|
11844
|
+
var cssDiff = new Diff();
|
|
11845
|
+
cssDiff.tokenize = function(value) {
|
|
11846
|
+
return value.split(/([{}:;,]|\s+)/);
|
|
11847
|
+
};
|
|
11848
|
+
function _typeof(obj) {
|
|
11849
|
+
"@babel/helpers - typeof";
|
|
11850
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
11851
|
+
_typeof = function(obj2) {
|
|
11852
|
+
return typeof obj2;
|
|
11853
|
+
};
|
|
11854
|
+
} else {
|
|
11855
|
+
_typeof = function(obj2) {
|
|
11856
|
+
return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
11857
|
+
};
|
|
11858
|
+
}
|
|
11859
|
+
return _typeof(obj);
|
|
11860
|
+
}
|
|
11861
|
+
function _toConsumableArray(arr) {
|
|
11862
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
11863
|
+
}
|
|
11864
|
+
function _arrayWithoutHoles(arr) {
|
|
11865
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
11866
|
+
}
|
|
11867
|
+
function _iterableToArray(iter) {
|
|
11868
|
+
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
|
|
11869
|
+
}
|
|
11870
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
11871
|
+
if (!o) return;
|
|
11872
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
11873
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
11874
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
11875
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
11876
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
11877
|
+
}
|
|
11878
|
+
function _arrayLikeToArray(arr, len) {
|
|
11879
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
11880
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
11881
|
+
return arr2;
|
|
11882
|
+
}
|
|
11883
|
+
function _nonIterableSpread() {
|
|
11884
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
11885
|
+
}
|
|
11886
|
+
var objectPrototypeToString = Object.prototype.toString;
|
|
11887
|
+
var jsonDiff = new Diff();
|
|
11888
|
+
jsonDiff.useLongestToken = true;
|
|
11889
|
+
jsonDiff.tokenize = lineDiff.tokenize;
|
|
11890
|
+
jsonDiff.castInput = function(value) {
|
|
11891
|
+
var _this$options = this.options, undefinedReplacement = _this$options.undefinedReplacement, _this$options$stringi = _this$options.stringifyReplacer, stringifyReplacer = _this$options$stringi === void 0 ? function(k, v) {
|
|
11892
|
+
return typeof v === "undefined" ? undefinedReplacement : v;
|
|
11893
|
+
} : _this$options$stringi;
|
|
11894
|
+
return typeof value === "string" ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, " ");
|
|
11895
|
+
};
|
|
11896
|
+
jsonDiff.equals = function(left, right) {
|
|
11897
|
+
return Diff.prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, "$1"), right.replace(/,([\r\n])/g, "$1"));
|
|
11898
|
+
};
|
|
11899
|
+
function canonicalize(obj, stack2, replacementStack, replacer, key2) {
|
|
11900
|
+
stack2 = stack2 || [];
|
|
11901
|
+
replacementStack = replacementStack || [];
|
|
11902
|
+
if (replacer) {
|
|
11903
|
+
obj = replacer(key2, obj);
|
|
11904
|
+
}
|
|
11905
|
+
var i;
|
|
11906
|
+
for (i = 0; i < stack2.length; i += 1) {
|
|
11907
|
+
if (stack2[i] === obj) {
|
|
11908
|
+
return replacementStack[i];
|
|
11909
|
+
}
|
|
11910
|
+
}
|
|
11911
|
+
var canonicalizedObj;
|
|
11912
|
+
if ("[object Array]" === objectPrototypeToString.call(obj)) {
|
|
11913
|
+
stack2.push(obj);
|
|
11914
|
+
canonicalizedObj = new Array(obj.length);
|
|
11915
|
+
replacementStack.push(canonicalizedObj);
|
|
11916
|
+
for (i = 0; i < obj.length; i += 1) {
|
|
11917
|
+
canonicalizedObj[i] = canonicalize(obj[i], stack2, replacementStack, replacer, key2);
|
|
11918
|
+
}
|
|
11919
|
+
stack2.pop();
|
|
11920
|
+
replacementStack.pop();
|
|
11921
|
+
return canonicalizedObj;
|
|
11922
|
+
}
|
|
11923
|
+
if (obj && obj.toJSON) {
|
|
11924
|
+
obj = obj.toJSON();
|
|
11925
|
+
}
|
|
11926
|
+
if (_typeof(obj) === "object" && obj !== null) {
|
|
11927
|
+
stack2.push(obj);
|
|
11928
|
+
canonicalizedObj = {};
|
|
11929
|
+
replacementStack.push(canonicalizedObj);
|
|
11930
|
+
var sortedKeys = [], _key;
|
|
11931
|
+
for (_key in obj) {
|
|
11932
|
+
if (obj.hasOwnProperty(_key)) {
|
|
11933
|
+
sortedKeys.push(_key);
|
|
11934
|
+
}
|
|
11935
|
+
}
|
|
11936
|
+
sortedKeys.sort();
|
|
11937
|
+
for (i = 0; i < sortedKeys.length; i += 1) {
|
|
11938
|
+
_key = sortedKeys[i];
|
|
11939
|
+
canonicalizedObj[_key] = canonicalize(obj[_key], stack2, replacementStack, replacer, _key);
|
|
11940
|
+
}
|
|
11941
|
+
stack2.pop();
|
|
11942
|
+
replacementStack.pop();
|
|
11943
|
+
} else {
|
|
11944
|
+
canonicalizedObj = obj;
|
|
11945
|
+
}
|
|
11946
|
+
return canonicalizedObj;
|
|
11947
|
+
}
|
|
11948
|
+
var arrayDiff = new Diff();
|
|
11949
|
+
arrayDiff.tokenize = function(value) {
|
|
11950
|
+
return value.slice();
|
|
11951
|
+
};
|
|
11952
|
+
arrayDiff.join = arrayDiff.removeEmpty = function(value) {
|
|
11953
|
+
return value;
|
|
11954
|
+
};
|
|
11955
|
+
function diffArrays(oldArr, newArr, callback) {
|
|
11956
|
+
return arrayDiff.diff(oldArr, newArr, callback);
|
|
11957
|
+
}
|
|
11958
|
+
function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options8) {
|
|
11959
|
+
if (!options8) {
|
|
11960
|
+
options8 = {};
|
|
11961
|
+
}
|
|
11962
|
+
if (typeof options8.context === "undefined") {
|
|
11963
|
+
options8.context = 4;
|
|
11964
|
+
}
|
|
11965
|
+
var diff2 = diffLines(oldStr, newStr, options8);
|
|
11966
|
+
if (!diff2) {
|
|
11967
|
+
return;
|
|
11968
|
+
}
|
|
11969
|
+
diff2.push({
|
|
11970
|
+
value: "",
|
|
11971
|
+
lines: []
|
|
11972
|
+
});
|
|
11973
|
+
function contextLines(lines) {
|
|
11974
|
+
return lines.map(function(entry) {
|
|
11975
|
+
return " " + entry;
|
|
11976
|
+
});
|
|
11977
|
+
}
|
|
11978
|
+
var hunks = [];
|
|
11979
|
+
var oldRangeStart = 0, newRangeStart = 0, curRange = [], oldLine = 1, newLine = 1;
|
|
11980
|
+
var _loop = function _loop2(i2) {
|
|
11981
|
+
var current = diff2[i2], lines = current.lines || current.value.replace(/\n$/, "").split("\n");
|
|
11982
|
+
current.lines = lines;
|
|
11983
|
+
if (current.added || current.removed) {
|
|
11984
|
+
var _curRange;
|
|
11985
|
+
if (!oldRangeStart) {
|
|
11986
|
+
var prev = diff2[i2 - 1];
|
|
11987
|
+
oldRangeStart = oldLine;
|
|
11988
|
+
newRangeStart = newLine;
|
|
11989
|
+
if (prev) {
|
|
11990
|
+
curRange = options8.context > 0 ? contextLines(prev.lines.slice(-options8.context)) : [];
|
|
11991
|
+
oldRangeStart -= curRange.length;
|
|
11992
|
+
newRangeStart -= curRange.length;
|
|
11993
|
+
}
|
|
11994
|
+
}
|
|
11995
|
+
(_curRange = curRange).push.apply(_curRange, _toConsumableArray(lines.map(function(entry) {
|
|
11996
|
+
return (current.added ? "+" : "-") + entry;
|
|
11997
|
+
})));
|
|
11998
|
+
if (current.added) {
|
|
11999
|
+
newLine += lines.length;
|
|
12000
|
+
} else {
|
|
12001
|
+
oldLine += lines.length;
|
|
12002
|
+
}
|
|
12003
|
+
} else {
|
|
12004
|
+
if (oldRangeStart) {
|
|
12005
|
+
if (lines.length <= options8.context * 2 && i2 < diff2.length - 2) {
|
|
12006
|
+
var _curRange2;
|
|
12007
|
+
(_curRange2 = curRange).push.apply(_curRange2, _toConsumableArray(contextLines(lines)));
|
|
12008
|
+
} else {
|
|
12009
|
+
var _curRange3;
|
|
12010
|
+
var contextSize = Math.min(lines.length, options8.context);
|
|
12011
|
+
(_curRange3 = curRange).push.apply(_curRange3, _toConsumableArray(contextLines(lines.slice(0, contextSize))));
|
|
12012
|
+
var hunk = {
|
|
12013
|
+
oldStart: oldRangeStart,
|
|
12014
|
+
oldLines: oldLine - oldRangeStart + contextSize,
|
|
12015
|
+
newStart: newRangeStart,
|
|
12016
|
+
newLines: newLine - newRangeStart + contextSize,
|
|
12017
|
+
lines: curRange
|
|
12018
|
+
};
|
|
12019
|
+
if (i2 >= diff2.length - 2 && lines.length <= options8.context) {
|
|
12020
|
+
var oldEOFNewline = /\n$/.test(oldStr);
|
|
12021
|
+
var newEOFNewline = /\n$/.test(newStr);
|
|
12022
|
+
var noNlBeforeAdds = lines.length == 0 && curRange.length > hunk.oldLines;
|
|
12023
|
+
if (!oldEOFNewline && noNlBeforeAdds && oldStr.length > 0) {
|
|
12024
|
+
curRange.splice(hunk.oldLines, 0, "\");
|
|
12025
|
+
}
|
|
12026
|
+
if (!oldEOFNewline && !noNlBeforeAdds || !newEOFNewline) {
|
|
12027
|
+
curRange.push("\");
|
|
12028
|
+
}
|
|
12029
|
+
}
|
|
12030
|
+
hunks.push(hunk);
|
|
12031
|
+
oldRangeStart = 0;
|
|
12032
|
+
newRangeStart = 0;
|
|
12033
|
+
curRange = [];
|
|
12034
|
+
}
|
|
12035
|
+
}
|
|
12036
|
+
oldLine += lines.length;
|
|
12037
|
+
newLine += lines.length;
|
|
12038
|
+
}
|
|
12039
|
+
};
|
|
12040
|
+
for (var i = 0; i < diff2.length; i++) {
|
|
12041
|
+
_loop(i);
|
|
12042
|
+
}
|
|
12043
|
+
return {
|
|
12044
|
+
oldFileName,
|
|
12045
|
+
newFileName,
|
|
12046
|
+
oldHeader,
|
|
12047
|
+
newHeader,
|
|
12048
|
+
hunks
|
|
12049
|
+
};
|
|
12050
|
+
}
|
|
12051
|
+
function formatPatch(diff2) {
|
|
12052
|
+
if (Array.isArray(diff2)) {
|
|
12053
|
+
return diff2.map(formatPatch).join("\n");
|
|
12054
|
+
}
|
|
12055
|
+
var ret = [];
|
|
12056
|
+
if (diff2.oldFileName == diff2.newFileName) {
|
|
12057
|
+
ret.push("Index: " + diff2.oldFileName);
|
|
12058
|
+
}
|
|
12059
|
+
ret.push("===================================================================");
|
|
12060
|
+
ret.push("--- " + diff2.oldFileName + (typeof diff2.oldHeader === "undefined" ? "" : " " + diff2.oldHeader));
|
|
12061
|
+
ret.push("+++ " + diff2.newFileName + (typeof diff2.newHeader === "undefined" ? "" : " " + diff2.newHeader));
|
|
12062
|
+
for (var i = 0; i < diff2.hunks.length; i++) {
|
|
12063
|
+
var hunk = diff2.hunks[i];
|
|
12064
|
+
if (hunk.oldLines === 0) {
|
|
12065
|
+
hunk.oldStart -= 1;
|
|
12066
|
+
}
|
|
12067
|
+
if (hunk.newLines === 0) {
|
|
12068
|
+
hunk.newStart -= 1;
|
|
12069
|
+
}
|
|
12070
|
+
ret.push("@@ -" + hunk.oldStart + "," + hunk.oldLines + " +" + hunk.newStart + "," + hunk.newLines + " @@");
|
|
12071
|
+
ret.push.apply(ret, hunk.lines);
|
|
12072
|
+
}
|
|
12073
|
+
return ret.join("\n") + "\n";
|
|
12074
|
+
}
|
|
12075
|
+
function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options8) {
|
|
12076
|
+
return formatPatch(structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options8));
|
|
12077
|
+
}
|
|
12078
|
+
|
|
12079
|
+
// src/index.js
|
|
12122
12080
|
var import_fast_glob = __toESM(require_out4(), 1);
|
|
12123
12081
|
|
|
12124
12082
|
// node_modules/vnopts/lib/descriptors/api.js
|
|
@@ -17823,11 +17781,11 @@ function getInterpreter(file) {
|
|
|
17823
17781
|
try {
|
|
17824
17782
|
const liner = new import_n_readlines.default(fd);
|
|
17825
17783
|
const firstLine = liner.next().toString("utf8");
|
|
17826
|
-
const m1 = firstLine.match(/^#!\/(?:usr\/)?bin\/env\s+(\S+)/);
|
|
17784
|
+
const m1 = firstLine.match(/^#!\/(?:usr\/)?bin\/env\s+(\S+)/u);
|
|
17827
17785
|
if (m1) {
|
|
17828
17786
|
return m1[1];
|
|
17829
17787
|
}
|
|
17830
|
-
const m2 = firstLine.match(/^#!\/(?:usr\/(?:local\/)?)?bin\/(\S+)/);
|
|
17788
|
+
const m2 = firstLine.match(/^#!\/(?:usr\/(?:local\/)?)?bin\/(\S+)/u);
|
|
17831
17789
|
if (m2) {
|
|
17832
17790
|
return m2[1];
|
|
17833
17791
|
}
|
|
@@ -17841,7 +17799,7 @@ function getInterpreter(file) {
|
|
|
17841
17799
|
var get_interpreter_default = getInterpreter;
|
|
17842
17800
|
|
|
17843
17801
|
// src/utils/infer-parser.js
|
|
17844
|
-
var getFileBasename = (file) => String(file).split(/[/\\]/).pop();
|
|
17802
|
+
var getFileBasename = (file) => String(file).split(/[/\\]/u).pop();
|
|
17845
17803
|
function getLanguageByFileName(languages2, file) {
|
|
17846
17804
|
if (!file) {
|
|
17847
17805
|
return;
|
|
@@ -17913,9 +17871,6 @@ async function getParser(file, options8) {
|
|
|
17913
17871
|
}
|
|
17914
17872
|
var get_file_info_default = getFileInfo;
|
|
17915
17873
|
|
|
17916
|
-
// src/main/core.js
|
|
17917
|
-
var import_array = __toESM(require_array2(), 1);
|
|
17918
|
-
|
|
17919
17874
|
// src/common/end-of-line.js
|
|
17920
17875
|
function guessEndOfLine(text) {
|
|
17921
17876
|
const index = text.indexOf("\r");
|
|
@@ -17938,13 +17893,13 @@ function countEndOfLineChars(text, eol) {
|
|
|
17938
17893
|
let regex;
|
|
17939
17894
|
switch (eol) {
|
|
17940
17895
|
case "\n":
|
|
17941
|
-
regex = /\n/
|
|
17896
|
+
regex = /\n/gu;
|
|
17942
17897
|
break;
|
|
17943
17898
|
case "\r":
|
|
17944
|
-
regex = /\r/
|
|
17899
|
+
regex = /\r/gu;
|
|
17945
17900
|
break;
|
|
17946
17901
|
case "\r\n":
|
|
17947
|
-
regex = /\r\n/
|
|
17902
|
+
regex = /\r\n/gu;
|
|
17948
17903
|
break;
|
|
17949
17904
|
default:
|
|
17950
17905
|
throw new Error(`Unexpected "eol" ${JSON.stringify(eol)}.`);
|
|
@@ -17957,7 +17912,7 @@ function normalizeEndOfLine(text) {
|
|
|
17957
17912
|
/* isOptionalObject */
|
|
17958
17913
|
false,
|
|
17959
17914
|
text,
|
|
17960
|
-
/\r\n?/
|
|
17915
|
+
/\r\n?/gu,
|
|
17961
17916
|
"\n"
|
|
17962
17917
|
);
|
|
17963
17918
|
}
|
|
@@ -18334,7 +18289,7 @@ function isWide(x) {
|
|
|
18334
18289
|
var _isNarrowWidth = (codePoint) => !(isFullWidth(codePoint) || isWide(codePoint));
|
|
18335
18290
|
|
|
18336
18291
|
// src/utils/get-string-width.js
|
|
18337
|
-
var notAsciiRegex = /[^\x20-\x7F]
|
|
18292
|
+
var notAsciiRegex = /[^\x20-\x7F]/u;
|
|
18338
18293
|
function getStringWidth(text) {
|
|
18339
18294
|
if (!text) {
|
|
18340
18295
|
return 0;
|
|
@@ -18524,7 +18479,7 @@ function stripTrailingHardlineFromDoc(doc2) {
|
|
|
18524
18479
|
case DOC_TYPE_ARRAY:
|
|
18525
18480
|
return stripTrailingHardlineFromParts(doc2);
|
|
18526
18481
|
case DOC_TYPE_STRING:
|
|
18527
|
-
return doc2.replace(/[\n\r]
|
|
18482
|
+
return doc2.replace(/[\n\r]*$/u, "");
|
|
18528
18483
|
case DOC_TYPE_ALIGN:
|
|
18529
18484
|
case DOC_TYPE_CURSOR:
|
|
18530
18485
|
case DOC_TYPE_TRIM:
|
|
@@ -19363,6 +19318,12 @@ var AstPath = class {
|
|
|
19363
19318
|
stack2.length = length;
|
|
19364
19319
|
}
|
|
19365
19320
|
}
|
|
19321
|
+
/**
|
|
19322
|
+
* @template {(path: AstPath) => any} T
|
|
19323
|
+
* @param {T} callback
|
|
19324
|
+
* @param {number} [count=0]
|
|
19325
|
+
* @returns {ReturnType<T>}
|
|
19326
|
+
*/
|
|
19366
19327
|
callParent(callback, count = 0) {
|
|
19367
19328
|
const stackIndex = __privateMethod(this, _AstPath_instances, getNodeStackIndex_fn).call(this, count + 1);
|
|
19368
19329
|
const parentValues = this.stack.splice(stackIndex + 1);
|
|
@@ -19560,10 +19521,10 @@ function skip(characters) {
|
|
|
19560
19521
|
return false;
|
|
19561
19522
|
};
|
|
19562
19523
|
}
|
|
19563
|
-
var skipWhitespace = skip(/\s/);
|
|
19524
|
+
var skipWhitespace = skip(/\s/u);
|
|
19564
19525
|
var skipSpaces = skip(" ");
|
|
19565
19526
|
var skipToLineEnd = skip(",; ");
|
|
19566
|
-
var skipEverythingButNewLine = skip(/[^\n\r]/);
|
|
19527
|
+
var skipEverythingButNewLine = skip(/[^\n\r]/u);
|
|
19567
19528
|
|
|
19568
19529
|
// src/utils/skip-newline.js
|
|
19569
19530
|
function skipNewline(text, startIndex, options8) {
|
|
@@ -19855,7 +19816,7 @@ function attachComments(ast, options8) {
|
|
|
19855
19816
|
}
|
|
19856
19817
|
}
|
|
19857
19818
|
}
|
|
19858
|
-
var isAllEmptyAndNoLineBreak = (text) => !/[\S\n\u2028\u2029]
|
|
19819
|
+
var isAllEmptyAndNoLineBreak = (text) => !/[\S\n\u2028\u2029]/u.test(text);
|
|
19859
19820
|
function isOwnLineComment(text, options8, decoratedComments, commentIndex) {
|
|
19860
19821
|
const { comment, precedingNode } = decoratedComments[commentIndex];
|
|
19861
19822
|
const { locStart, locEnd } = options8;
|
|
@@ -19904,7 +19865,7 @@ function breakTies(tiesToBreak, options8) {
|
|
|
19904
19865
|
assert4.strictEqual(currentCommentPrecedingNode, precedingNode);
|
|
19905
19866
|
assert4.strictEqual(currentCommentFollowingNode, followingNode);
|
|
19906
19867
|
const gap = options8.originalText.slice(options8.locEnd(comment), gapEndPos);
|
|
19907
|
-
if (((_b = (_a = options8.printer).isGap) == null ? void 0 : _b.call(_a, gap, options8)) ?? /^[\s(]
|
|
19868
|
+
if (((_b = (_a = options8.printer).isGap) == null ? void 0 : _b.call(_a, gap, options8)) ?? /^[\s(]*$/u.test(gap)) {
|
|
19908
19869
|
gapEndPos = options8.locStart(comment);
|
|
19909
19870
|
} else {
|
|
19910
19871
|
break;
|
|
@@ -20990,35 +20951,50 @@ function massageAst(ast, options8) {
|
|
|
20990
20951
|
}
|
|
20991
20952
|
var massage_ast_default = massageAst;
|
|
20992
20953
|
|
|
20954
|
+
// scripts/build/shims/array-find-last-index.js
|
|
20955
|
+
var arrayFindLastIndex = (isOptionalObject, array2, callback) => {
|
|
20956
|
+
if (isOptionalObject && (array2 === void 0 || array2 === null)) {
|
|
20957
|
+
return;
|
|
20958
|
+
}
|
|
20959
|
+
if (array2.findLastIndex) {
|
|
20960
|
+
return array2.findLastIndex(callback);
|
|
20961
|
+
}
|
|
20962
|
+
for (let index = array2.length - 1; index >= 0; index--) {
|
|
20963
|
+
const element = array2[index];
|
|
20964
|
+
if (callback(element, index, array2)) {
|
|
20965
|
+
return index;
|
|
20966
|
+
}
|
|
20967
|
+
}
|
|
20968
|
+
return -1;
|
|
20969
|
+
};
|
|
20970
|
+
var array_find_last_index_default = arrayFindLastIndex;
|
|
20971
|
+
|
|
20993
20972
|
// src/main/range-util.js
|
|
20994
20973
|
import assert5 from "assert";
|
|
20995
|
-
var isJsonParser = ({
|
|
20974
|
+
var isJsonParser = ({
|
|
20975
|
+
parser
|
|
20976
|
+
}) => parser === "json" || parser === "json5" || parser === "jsonc" || parser === "json-stringify";
|
|
20996
20977
|
function findCommonAncestor(startNodeAndParents, endNodeAndParents) {
|
|
20997
|
-
const startNodeAndAncestors = [
|
|
20998
|
-
|
|
20999
|
-
|
|
21000
|
-
];
|
|
21001
|
-
const endNodeAndAncestors = /* @__PURE__ */ new Set([
|
|
21002
|
-
endNodeAndParents.node,
|
|
21003
|
-
...endNodeAndParents.parentNodes
|
|
21004
|
-
]);
|
|
21005
|
-
return startNodeAndAncestors.find(
|
|
21006
|
-
(node) => jsonSourceElements.has(node.type) && endNodeAndAncestors.has(node)
|
|
21007
|
-
);
|
|
20978
|
+
const startNodeAndAncestors = [startNodeAndParents.node, ...startNodeAndParents.parentNodes];
|
|
20979
|
+
const endNodeAndAncestors = /* @__PURE__ */ new Set([endNodeAndParents.node, ...endNodeAndParents.parentNodes]);
|
|
20980
|
+
return startNodeAndAncestors.find((node) => jsonSourceElements.has(node.type) && endNodeAndAncestors.has(node));
|
|
21008
20981
|
}
|
|
21009
20982
|
function dropRootParents(parents) {
|
|
21010
|
-
|
|
21011
|
-
|
|
21012
|
-
|
|
21013
|
-
|
|
21014
|
-
|
|
21015
|
-
|
|
21016
|
-
|
|
21017
|
-
|
|
20983
|
+
const index = array_find_last_index_default(
|
|
20984
|
+
/* isOptionalObject */
|
|
20985
|
+
false,
|
|
20986
|
+
parents,
|
|
20987
|
+
(node) => node.type !== "Program" && node.type !== "File"
|
|
20988
|
+
);
|
|
20989
|
+
if (index === -1) {
|
|
20990
|
+
return parents;
|
|
21018
20991
|
}
|
|
21019
|
-
return parents.slice(0,
|
|
20992
|
+
return parents.slice(0, index + 1);
|
|
21020
20993
|
}
|
|
21021
|
-
function findSiblingAncestors(startNodeAndParents, endNodeAndParents, {
|
|
20994
|
+
function findSiblingAncestors(startNodeAndParents, endNodeAndParents, {
|
|
20995
|
+
locStart,
|
|
20996
|
+
locEnd
|
|
20997
|
+
}) {
|
|
21022
20998
|
let resultStartNode = startNodeAndParents.node;
|
|
21023
20999
|
let resultEndNode = endNodeAndParents.node;
|
|
21024
21000
|
if (resultStartNode === resultEndNode) {
|
|
@@ -21052,21 +21028,17 @@ function findSiblingAncestors(startNodeAndParents, endNodeAndParents, { locStart
|
|
|
21052
21028
|
};
|
|
21053
21029
|
}
|
|
21054
21030
|
function findNodeAtOffset(node, offset, options8, predicate, parentNodes = [], type2) {
|
|
21055
|
-
const {
|
|
21031
|
+
const {
|
|
21032
|
+
locStart,
|
|
21033
|
+
locEnd
|
|
21034
|
+
} = options8;
|
|
21056
21035
|
const start = locStart(node);
|
|
21057
21036
|
const end = locEnd(node);
|
|
21058
21037
|
if (offset > end || offset < start || type2 === "rangeEnd" && offset === start || type2 === "rangeStart" && offset === end) {
|
|
21059
21038
|
return;
|
|
21060
21039
|
}
|
|
21061
21040
|
for (const childNode of getSortedChildNodes(node, options8)) {
|
|
21062
|
-
const childResult = findNodeAtOffset(
|
|
21063
|
-
childNode,
|
|
21064
|
-
offset,
|
|
21065
|
-
options8,
|
|
21066
|
-
predicate,
|
|
21067
|
-
[node, ...parentNodes],
|
|
21068
|
-
type2
|
|
21069
|
-
);
|
|
21041
|
+
const childResult = findNodeAtOffset(childNode, offset, options8, predicate, [node, ...parentNodes], type2);
|
|
21070
21042
|
if (childResult) {
|
|
21071
21043
|
return childResult;
|
|
21072
21044
|
}
|
|
@@ -21081,35 +21053,8 @@ function findNodeAtOffset(node, offset, options8, predicate, parentNodes = [], t
|
|
|
21081
21053
|
function isJsSourceElement(type2, parentType) {
|
|
21082
21054
|
return parentType !== "DeclareExportDeclaration" && type2 !== "TypeParameterDeclaration" && (type2 === "Directive" || type2 === "TypeAlias" || type2 === "TSExportAssignment" || type2.startsWith("Declare") || type2.startsWith("TSDeclare") || type2.endsWith("Statement") || type2.endsWith("Declaration"));
|
|
21083
21055
|
}
|
|
21084
|
-
var jsonSourceElements = /* @__PURE__ */ new Set([
|
|
21085
|
-
|
|
21086
|
-
"ObjectExpression",
|
|
21087
|
-
"ArrayExpression",
|
|
21088
|
-
"StringLiteral",
|
|
21089
|
-
"NumericLiteral",
|
|
21090
|
-
"BooleanLiteral",
|
|
21091
|
-
"NullLiteral",
|
|
21092
|
-
"UnaryExpression",
|
|
21093
|
-
"TemplateLiteral"
|
|
21094
|
-
]);
|
|
21095
|
-
var graphqlSourceElements = /* @__PURE__ */ new Set([
|
|
21096
|
-
"OperationDefinition",
|
|
21097
|
-
"FragmentDefinition",
|
|
21098
|
-
"VariableDefinition",
|
|
21099
|
-
"TypeExtensionDefinition",
|
|
21100
|
-
"ObjectTypeDefinition",
|
|
21101
|
-
"FieldDefinition",
|
|
21102
|
-
"DirectiveDefinition",
|
|
21103
|
-
"EnumTypeDefinition",
|
|
21104
|
-
"EnumValueDefinition",
|
|
21105
|
-
"InputValueDefinition",
|
|
21106
|
-
"InputObjectTypeDefinition",
|
|
21107
|
-
"SchemaDefinition",
|
|
21108
|
-
"OperationTypeDefinition",
|
|
21109
|
-
"InterfaceTypeDefinition",
|
|
21110
|
-
"UnionTypeDefinition",
|
|
21111
|
-
"ScalarTypeDefinition"
|
|
21112
|
-
]);
|
|
21056
|
+
var jsonSourceElements = /* @__PURE__ */ new Set(["JsonRoot", "ObjectExpression", "ArrayExpression", "StringLiteral", "NumericLiteral", "BooleanLiteral", "NullLiteral", "UnaryExpression", "TemplateLiteral"]);
|
|
21057
|
+
var graphqlSourceElements = /* @__PURE__ */ new Set(["OperationDefinition", "FragmentDefinition", "VariableDefinition", "TypeExtensionDefinition", "ObjectTypeDefinition", "FieldDefinition", "DirectiveDefinition", "EnumTypeDefinition", "EnumValueDefinition", "InputValueDefinition", "InputObjectTypeDefinition", "SchemaDefinition", "OperationTypeDefinition", "InterfaceTypeDefinition", "UnionTypeDefinition", "ScalarTypeDefinition"]);
|
|
21113
21058
|
function isSourceElement(opts, node, parentNode) {
|
|
21114
21059
|
if (!node) {
|
|
21115
21060
|
return false;
|
|
@@ -21138,36 +21083,27 @@ function isSourceElement(opts, node, parentNode) {
|
|
|
21138
21083
|
return false;
|
|
21139
21084
|
}
|
|
21140
21085
|
function calculateRange(text, opts, ast) {
|
|
21141
|
-
let {
|
|
21086
|
+
let {
|
|
21087
|
+
rangeStart: start,
|
|
21088
|
+
rangeEnd: end,
|
|
21089
|
+
locStart,
|
|
21090
|
+
locEnd
|
|
21091
|
+
} = opts;
|
|
21142
21092
|
assert5.ok(end > start);
|
|
21143
|
-
const firstNonWhitespaceCharacterIndex = text.slice(start, end).search(/\S/);
|
|
21093
|
+
const firstNonWhitespaceCharacterIndex = text.slice(start, end).search(/\S/u);
|
|
21144
21094
|
const isAllWhitespace = firstNonWhitespaceCharacterIndex === -1;
|
|
21145
21095
|
if (!isAllWhitespace) {
|
|
21146
21096
|
start += firstNonWhitespaceCharacterIndex;
|
|
21147
21097
|
for (; end > start; --end) {
|
|
21148
|
-
if (/\S
|
|
21098
|
+
if (/\S/u.test(text[end - 1])) {
|
|
21149
21099
|
break;
|
|
21150
21100
|
}
|
|
21151
21101
|
}
|
|
21152
21102
|
}
|
|
21153
|
-
const startNodeAndParents = findNodeAtOffset(
|
|
21154
|
-
ast,
|
|
21155
|
-
start,
|
|
21156
|
-
opts,
|
|
21157
|
-
(node, parentNode) => isSourceElement(opts, node, parentNode),
|
|
21158
|
-
[],
|
|
21159
|
-
"rangeStart"
|
|
21160
|
-
);
|
|
21103
|
+
const startNodeAndParents = findNodeAtOffset(ast, start, opts, (node, parentNode) => isSourceElement(opts, node, parentNode), [], "rangeStart");
|
|
21161
21104
|
const endNodeAndParents = (
|
|
21162
21105
|
// No need find Node at `end`, it will be the same as `startNodeAndParents`
|
|
21163
|
-
isAllWhitespace ? startNodeAndParents : findNodeAtOffset(
|
|
21164
|
-
ast,
|
|
21165
|
-
end,
|
|
21166
|
-
opts,
|
|
21167
|
-
(node) => isSourceElement(opts, node),
|
|
21168
|
-
[],
|
|
21169
|
-
"rangeEnd"
|
|
21170
|
-
)
|
|
21106
|
+
isAllWhitespace ? startNodeAndParents : findNodeAtOffset(ast, end, opts, (node) => isSourceElement(opts, node), [], "rangeEnd")
|
|
21171
21107
|
);
|
|
21172
21108
|
if (!startNodeAndParents || !endNodeAndParents) {
|
|
21173
21109
|
return {
|
|
@@ -21178,18 +21114,14 @@ function calculateRange(text, opts, ast) {
|
|
|
21178
21114
|
let startNode;
|
|
21179
21115
|
let endNode;
|
|
21180
21116
|
if (isJsonParser(opts)) {
|
|
21181
|
-
const commonAncestor = findCommonAncestor(
|
|
21182
|
-
startNodeAndParents,
|
|
21183
|
-
endNodeAndParents
|
|
21184
|
-
);
|
|
21117
|
+
const commonAncestor = findCommonAncestor(startNodeAndParents, endNodeAndParents);
|
|
21185
21118
|
startNode = commonAncestor;
|
|
21186
21119
|
endNode = commonAncestor;
|
|
21187
21120
|
} else {
|
|
21188
|
-
({
|
|
21189
|
-
|
|
21190
|
-
|
|
21191
|
-
|
|
21192
|
-
));
|
|
21121
|
+
({
|
|
21122
|
+
startNode,
|
|
21123
|
+
endNode
|
|
21124
|
+
} = findSiblingAncestors(startNodeAndParents, endNodeAndParents, opts));
|
|
21193
21125
|
}
|
|
21194
21126
|
return {
|
|
21195
21127
|
rangeStart: Math.min(locStart(startNode), locStart(endNode)),
|
|
@@ -21257,7 +21189,7 @@ async function coreFormat(originalText, opts, addAlignmentSize = 0) {
|
|
|
21257
21189
|
const oldCursorNodeCharArray = oldCursorNodeText.split("");
|
|
21258
21190
|
oldCursorNodeCharArray.splice(cursorOffsetRelativeToOldCursorNode, 0, CURSOR);
|
|
21259
21191
|
const newCursorNodeCharArray = newCursorNodeText.split("");
|
|
21260
|
-
const cursorNodeDiff =
|
|
21192
|
+
const cursorNodeDiff = diffArrays(oldCursorNodeCharArray, newCursorNodeCharArray);
|
|
21261
21193
|
let cursorOffset = newCursorNodeStart;
|
|
21262
21194
|
for (const entry of cursorNodeDiff) {
|
|
21263
21195
|
if (entry.removed) {
|
|
@@ -21291,7 +21223,7 @@ async function formatRange(originalText, opts) {
|
|
|
21291
21223
|
} = calculateRange(text, opts, ast);
|
|
21292
21224
|
const rangeString = text.slice(rangeStart, rangeEnd);
|
|
21293
21225
|
const rangeStart2 = Math.min(rangeStart, text.lastIndexOf("\n", rangeStart) + 1);
|
|
21294
|
-
const indentString = text.slice(rangeStart2, rangeStart).match(/^\s*/)[0];
|
|
21226
|
+
const indentString = text.slice(rangeStart2, rangeStart).match(/^\s*/u)[0];
|
|
21295
21227
|
const alignmentSize = get_alignment_size_default(indentString, opts.tabWidth);
|
|
21296
21228
|
const rangeResult = await coreFormat(rangeString, {
|
|
21297
21229
|
...opts,
|
|
@@ -22563,7 +22495,7 @@ var object_omit_default = omit;
|
|
|
22563
22495
|
import * as doc from "./doc.mjs";
|
|
22564
22496
|
|
|
22565
22497
|
// src/main/version.evaluate.cjs
|
|
22566
|
-
var version_evaluate_default = "3.3.
|
|
22498
|
+
var version_evaluate_default = "3.3.3";
|
|
22567
22499
|
|
|
22568
22500
|
// src/utils/public.js
|
|
22569
22501
|
var public_exports = {};
|
|
@@ -22661,7 +22593,7 @@ function getIndentSize(value, tabWidth) {
|
|
|
22661
22593
|
}
|
|
22662
22594
|
return get_alignment_size_default(
|
|
22663
22595
|
// All the leading whitespaces
|
|
22664
|
-
value.slice(lastNewlineIndex + 1).match(/^[\t ]*/)[0],
|
|
22596
|
+
value.slice(lastNewlineIndex + 1).match(/^[\t ]*/u)[0],
|
|
22665
22597
|
tabWidth
|
|
22666
22598
|
);
|
|
22667
22599
|
}
|
|
@@ -22678,7 +22610,7 @@ function escapeStringRegexp(string) {
|
|
|
22678
22610
|
// src/utils/get-max-continuous-count.js
|
|
22679
22611
|
function getMaxContinuousCount(text, searchString) {
|
|
22680
22612
|
const results = text.match(
|
|
22681
|
-
new RegExp(`(${escapeStringRegexp(searchString)})+`, "
|
|
22613
|
+
new RegExp(`(${escapeStringRegexp(searchString)})+`, "gu")
|
|
22682
22614
|
);
|
|
22683
22615
|
if (results === null) {
|
|
22684
22616
|
return 0;
|
|
@@ -22722,7 +22654,7 @@ var has_spaces_default = hasSpaces;
|
|
|
22722
22654
|
// src/utils/make-string.js
|
|
22723
22655
|
function makeString(rawText, enclosingQuote, unescapeUnnecessaryEscapes) {
|
|
22724
22656
|
const otherQuote = enclosingQuote === '"' ? "'" : '"';
|
|
22725
|
-
const regex = /\\(.)|(["'])/
|
|
22657
|
+
const regex = /\\(.)|(["'])/gsu;
|
|
22726
22658
|
const raw = string_replace_all_default(
|
|
22727
22659
|
/* isOptionalObject */
|
|
22728
22660
|
false,
|
|
@@ -22738,7 +22670,7 @@ function makeString(rawText, enclosingQuote, unescapeUnnecessaryEscapes) {
|
|
|
22738
22670
|
if (quote) {
|
|
22739
22671
|
return quote;
|
|
22740
22672
|
}
|
|
22741
|
-
return unescapeUnnecessaryEscapes && /^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]
|
|
22673
|
+
return unescapeUnnecessaryEscapes && /^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/u.test(escaped) ? escaped : "\\" + escaped;
|
|
22742
22674
|
}
|
|
22743
22675
|
);
|
|
22744
22676
|
return enclosingQuote + raw + enclosingQuote;
|
|
@@ -22826,7 +22758,7 @@ var sharedWithCli = {
|
|
|
22826
22758
|
apiDescriptor
|
|
22827
22759
|
},
|
|
22828
22760
|
fastGlob: import_fast_glob.default,
|
|
22829
|
-
createTwoFilesPatch
|
|
22761
|
+
createTwoFilesPatch,
|
|
22830
22762
|
utils: {
|
|
22831
22763
|
isNonEmptyArray: is_non_empty_array_default,
|
|
22832
22764
|
partition: partition_default,
|