@tinacms/mdx 0.0.0-20220718181631 → 0.60.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +887 -738
- package/dist/index.d.ts +21 -1
- package/dist/index.es.js +546 -406
- package/dist/{parse/plate-spec.d.ts → index.js} +4 -2
- package/dist/mdx.es.js +1092 -0
- package/dist/mdx.umd.js +1097 -0
- package/dist/parse/acorn.d.ts +2 -3
- package/dist/parse/acorn.js +201 -0
- package/dist/parse/index.d.ts +8 -2
- package/dist/parse/index.js +144 -0
- package/dist/parse/mdx.js +75 -0
- package/dist/parse/plate.d.ts +15 -2
- package/dist/parse/plate.js +1 -0
- package/dist/parse/remarkToPlate.d.ts +16 -1
- package/dist/parse/remarkToPlate.js +380 -0
- package/dist/stringify/acorn.d.ts +7 -2
- package/dist/stringify/acorn.js +241 -0
- package/dist/stringify/index.d.ts +15 -0
- package/dist/stringify/index.js +195 -0
- package/dist/stringify/marks.js +250 -0
- package/dist/tests/autotest/_config.d.ts +4 -0
- package/dist/tests/autotest/_config.js +159 -0
- package/dist/tests/autotest/_runner.test.d.ts +1 -0
- package/dist/tests/autotest/_runner.test.js +77 -0
- package/dist/tests/autotest/autoformat block elements in list items.test.d.ts +1 -0
- package/dist/tests/autotest/autoformat block elements in list items.test.js +33 -0
- package/dist/tests/autotest/autoformat blockquote.result.test.d.ts +1 -0
- package/dist/tests/autotest/autoformat blockquote.result.test.js +18 -0
- package/dist/tests/autotest/autoformat blockquote.test.d.ts +1 -0
- package/dist/tests/autotest/autoformat blockquote.test.js +18 -0
- package/dist/tests/autotest/autoformat list item.test.d.ts +1 -0
- package/dist/tests/autotest/autoformat list item.test.js +31 -0
- package/dist/tests/autotest/autoformat mdx with nested null children.test.d.ts +1 -0
- package/dist/tests/autotest/autoformat mdx with nested null children.test.js +23 -0
- package/dist/tests/autotest/autoformat syntax changes.test.d.ts +1 -0
- package/dist/tests/autotest/autoformat syntax changes.test.js +90 -0
- package/dist/tests/autotest/blockquote.test.d.ts +1 -0
- package/dist/tests/autotest/blockquote.test.js +17 -0
- package/dist/tests/autotest/break.test.d.ts +1 -0
- package/dist/tests/autotest/break.test.js +26 -0
- package/dist/tests/autotest/code block.test.d.ts +1 -0
- package/dist/tests/autotest/code block.test.js +27 -0
- package/dist/tests/autotest/image.test.d.ts +1 -0
- package/dist/tests/autotest/image.test.js +52 -0
- package/dist/tests/autotest/invalid mdx with a closing tag.test.d.ts +1 -0
- package/dist/tests/autotest/invalid mdx with a closing tag.test.js +27 -0
- package/dist/tests/autotest/invalid mdx with a const expression.test.d.ts +1 -0
- package/dist/tests/autotest/invalid mdx with a const expression.test.js +27 -0
- package/dist/tests/autotest/invalid mdx with an expression {{}}.test.d.ts +1 -0
- package/dist/tests/autotest/invalid mdx with an expression {{}}.test.js +27 -0
- package/dist/tests/autotest/invalid mdx with an expression.test.d.ts +1 -0
- package/dist/tests/autotest/invalid mdx with an expression.test.js +27 -0
- package/dist/tests/autotest/invalid mdx with an import statment.test.d.ts +1 -0
- package/dist/tests/autotest/invalid mdx with an import statment.test.js +27 -0
- package/dist/tests/autotest/kitchen sink.test.d.ts +1 -0
- package/dist/tests/autotest/kitchen sink.test.js +144 -0
- package/dist/tests/autotest/links.test.d.ts +1 -0
- package/dist/tests/autotest/links.test.js +29 -0
- package/dist/tests/autotest/lists.test.d.ts +1 -0
- package/dist/tests/autotest/lists.test.js +110 -0
- package/dist/tests/autotest/marks.test.d.ts +1 -0
- package/dist/tests/autotest/marks.test.js +102 -0
- package/dist/tests/autotest/mdx field with a scalar field as a list.test.d.ts +1 -0
- package/dist/tests/autotest/mdx field with a scalar field as a list.test.js +22 -0
- package/dist/tests/autotest/mdx which hasnt been registered returns html.test.d.ts +1 -0
- package/dist/tests/autotest/mdx which hasnt been registered returns html.test.js +26 -0
- package/dist/tests/autotest/mdx with a boolean field.test.d.ts +1 -0
- package/dist/tests/autotest/mdx with a boolean field.test.js +22 -0
- package/dist/tests/autotest/mdx with a number field.test.d.ts +1 -0
- package/dist/tests/autotest/mdx with a number field.test.js +22 -0
- package/dist/tests/autotest/mdx with a srtring field.test.d.ts +1 -0
- package/dist/tests/autotest/mdx with a srtring field.test.js +28 -0
- package/dist/tests/autotest/mdx with multiple rich-text fields.test.d.ts +1 -0
- package/dist/tests/autotest/mdx with multiple rich-text fields.test.js +53 -0
- package/dist/tests/autotest/mdx with nested children.test.d.ts +1 -0
- package/dist/tests/autotest/mdx with nested children.test.js +35 -0
- package/dist/tests/autotest/mdx with nested null children.test.d.ts +1 -0
- package/dist/tests/autotest/mdx with nested null children.test.js +23 -0
- package/dist/tests/autotest/mdx with number list field.test.d.ts +1 -0
- package/dist/tests/autotest/mdx with number list field.test.js +22 -0
- package/dist/tests/autotest/mdx with object list field.test.d.ts +1 -0
- package/dist/tests/autotest/mdx with object list field.test.js +25 -0
- package/dist/tests/autotest/mdx with object with templates.test.d.ts +1 -0
- package/dist/tests/autotest/mdx with object with templates.test.js +41 -0
- package/dist/tests/autotest/shortcodes.test.d.ts +1 -0
- package/dist/tests/autotest/shortcodes.test.js +51 -0
- package/dist/tests/setup.d.ts +14 -0
- package/dist/tests/setup.js +70 -0
- package/package.json +13 -14
- package/dist/stringify/mdx.d.ts +0 -38
package/dist/index.cjs
CHANGED
|
@@ -59,7 +59,7 @@ var require_extend = __commonJS({
|
|
|
59
59
|
var toStr = Object.prototype.toString;
|
|
60
60
|
var defineProperty = Object.defineProperty;
|
|
61
61
|
var gOPD = Object.getOwnPropertyDescriptor;
|
|
62
|
-
var
|
|
62
|
+
var isArray3 = function isArray4(arr) {
|
|
63
63
|
if (typeof Array.isArray === "function") {
|
|
64
64
|
return Array.isArray(arr);
|
|
65
65
|
}
|
|
@@ -122,10 +122,10 @@ var require_extend = __commonJS({
|
|
|
122
122
|
src = getProperty(target, name);
|
|
123
123
|
copy = getProperty(options, name);
|
|
124
124
|
if (target !== copy) {
|
|
125
|
-
if (deep && copy && (isPlainObject2(copy) || (copyIsArray =
|
|
125
|
+
if (deep && copy && (isPlainObject2(copy) || (copyIsArray = isArray3(copy)))) {
|
|
126
126
|
if (copyIsArray) {
|
|
127
127
|
copyIsArray = false;
|
|
128
|
-
clone = src &&
|
|
128
|
+
clone = src && isArray3(src) ? src : [];
|
|
129
129
|
} else {
|
|
130
130
|
clone = src && isPlainObject2(src) ? src : {};
|
|
131
131
|
}
|
|
@@ -614,12 +614,12 @@ var require_acorn = __commonJS({
|
|
|
614
614
|
var nonASCIIwhitespace2 = /[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/;
|
|
615
615
|
var skipWhiteSpace2 = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
|
|
616
616
|
var ref2 = Object.prototype;
|
|
617
|
-
var
|
|
617
|
+
var hasOwnProperty5 = ref2.hasOwnProperty;
|
|
618
618
|
var toString3 = ref2.toString;
|
|
619
619
|
var hasOwn2 = Object.hasOwn || function(obj, propName) {
|
|
620
|
-
return
|
|
620
|
+
return hasOwnProperty5.call(obj, propName);
|
|
621
621
|
};
|
|
622
|
-
var
|
|
622
|
+
var isArray3 = Array.isArray || function(obj) {
|
|
623
623
|
return toString3.call(obj) === "[object Array]";
|
|
624
624
|
};
|
|
625
625
|
function wordsRegexp2(words) {
|
|
@@ -697,22 +697,22 @@ var require_acorn = __commonJS({
|
|
|
697
697
|
if (options.allowReserved == null) {
|
|
698
698
|
options.allowReserved = options.ecmaVersion < 5;
|
|
699
699
|
}
|
|
700
|
-
if (
|
|
700
|
+
if (isArray3(options.onToken)) {
|
|
701
701
|
var tokens = options.onToken;
|
|
702
702
|
options.onToken = function(token) {
|
|
703
703
|
return tokens.push(token);
|
|
704
704
|
};
|
|
705
705
|
}
|
|
706
|
-
if (
|
|
706
|
+
if (isArray3(options.onComment)) {
|
|
707
707
|
options.onComment = pushComment2(options, options.onComment);
|
|
708
708
|
}
|
|
709
709
|
return options;
|
|
710
710
|
}
|
|
711
711
|
function pushComment2(options, array) {
|
|
712
|
-
return function(block,
|
|
712
|
+
return function(block, text5, start3, end, startLoc, endLoc) {
|
|
713
713
|
var comment = {
|
|
714
714
|
type: block ? "Block" : "Line",
|
|
715
|
-
value:
|
|
715
|
+
value: text5,
|
|
716
716
|
start: start3,
|
|
717
717
|
end
|
|
718
718
|
};
|
|
@@ -5550,82 +5550,6 @@ var require_acorn_jsx = __commonJS({
|
|
|
5550
5550
|
}
|
|
5551
5551
|
});
|
|
5552
5552
|
|
|
5553
|
-
// ../../../node_modules/.pnpm/lodash.flatten@4.4.0/node_modules/lodash.flatten/index.js
|
|
5554
|
-
var require_lodash = __commonJS({
|
|
5555
|
-
"../../../node_modules/.pnpm/lodash.flatten@4.4.0/node_modules/lodash.flatten/index.js"(exports, module2) {
|
|
5556
|
-
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
5557
|
-
var argsTag = "[object Arguments]";
|
|
5558
|
-
var funcTag = "[object Function]";
|
|
5559
|
-
var genTag = "[object GeneratorFunction]";
|
|
5560
|
-
var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
|
|
5561
|
-
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
5562
|
-
var root2 = freeGlobal || freeSelf || Function("return this")();
|
|
5563
|
-
function arrayPush(array, values) {
|
|
5564
|
-
var index2 = -1, length = values.length, offset2 = array.length;
|
|
5565
|
-
while (++index2 < length) {
|
|
5566
|
-
array[offset2 + index2] = values[index2];
|
|
5567
|
-
}
|
|
5568
|
-
return array;
|
|
5569
|
-
}
|
|
5570
|
-
var objectProto = Object.prototype;
|
|
5571
|
-
var hasOwnProperty3 = objectProto.hasOwnProperty;
|
|
5572
|
-
var objectToString = objectProto.toString;
|
|
5573
|
-
var Symbol2 = root2.Symbol;
|
|
5574
|
-
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
|
5575
|
-
var spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : void 0;
|
|
5576
|
-
function baseFlatten(array, depth, predicate, isStrict, result) {
|
|
5577
|
-
var index2 = -1, length = array.length;
|
|
5578
|
-
predicate || (predicate = isFlattenable);
|
|
5579
|
-
result || (result = []);
|
|
5580
|
-
while (++index2 < length) {
|
|
5581
|
-
var value = array[index2];
|
|
5582
|
-
if (depth > 0 && predicate(value)) {
|
|
5583
|
-
if (depth > 1) {
|
|
5584
|
-
baseFlatten(value, depth - 1, predicate, isStrict, result);
|
|
5585
|
-
} else {
|
|
5586
|
-
arrayPush(result, value);
|
|
5587
|
-
}
|
|
5588
|
-
} else if (!isStrict) {
|
|
5589
|
-
result[result.length] = value;
|
|
5590
|
-
}
|
|
5591
|
-
}
|
|
5592
|
-
return result;
|
|
5593
|
-
}
|
|
5594
|
-
function isFlattenable(value) {
|
|
5595
|
-
return isArray2(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
|
|
5596
|
-
}
|
|
5597
|
-
function flatten2(array) {
|
|
5598
|
-
var length = array ? array.length : 0;
|
|
5599
|
-
return length ? baseFlatten(array, 1) : [];
|
|
5600
|
-
}
|
|
5601
|
-
function isArguments(value) {
|
|
5602
|
-
return isArrayLikeObject(value) && hasOwnProperty3.call(value, "callee") && (!propertyIsEnumerable.call(value, "callee") || objectToString.call(value) == argsTag);
|
|
5603
|
-
}
|
|
5604
|
-
var isArray2 = Array.isArray;
|
|
5605
|
-
function isArrayLike(value) {
|
|
5606
|
-
return value != null && isLength(value.length) && !isFunction(value);
|
|
5607
|
-
}
|
|
5608
|
-
function isArrayLikeObject(value) {
|
|
5609
|
-
return isObjectLike(value) && isArrayLike(value);
|
|
5610
|
-
}
|
|
5611
|
-
function isFunction(value) {
|
|
5612
|
-
var tag = isObject(value) ? objectToString.call(value) : "";
|
|
5613
|
-
return tag == funcTag || tag == genTag;
|
|
5614
|
-
}
|
|
5615
|
-
function isLength(value) {
|
|
5616
|
-
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
5617
|
-
}
|
|
5618
|
-
function isObject(value) {
|
|
5619
|
-
var type = typeof value;
|
|
5620
|
-
return !!value && (type == "object" || type == "function");
|
|
5621
|
-
}
|
|
5622
|
-
function isObjectLike(value) {
|
|
5623
|
-
return !!value && typeof value == "object";
|
|
5624
|
-
}
|
|
5625
|
-
module2.exports = flatten2;
|
|
5626
|
-
}
|
|
5627
|
-
});
|
|
5628
|
-
|
|
5629
5553
|
// ../../../node_modules/.pnpm/prettier@2.7.1/node_modules/prettier/package.json
|
|
5630
5554
|
var require_package = __commonJS({
|
|
5631
5555
|
"../../../node_modules/.pnpm/prettier@2.7.1/node_modules/prettier/package.json"(exports, module2) {
|
|
@@ -5662,8 +5586,8 @@ var require_doc = __commonJS({
|
|
|
5662
5586
|
} else if (typeof define === "function" && define.amd) {
|
|
5663
5587
|
define(factory);
|
|
5664
5588
|
} else {
|
|
5665
|
-
var
|
|
5666
|
-
|
|
5589
|
+
var root3 = typeof globalThis !== "undefined" ? globalThis : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : this || {};
|
|
5590
|
+
root3.doc = factory();
|
|
5667
5591
|
}
|
|
5668
5592
|
})(function() {
|
|
5669
5593
|
"use strict";
|
|
@@ -5916,10 +5840,10 @@ var require_doc = __commonJS({
|
|
|
5916
5840
|
"src/common/end-of-line.js"(exports22, module22) {
|
|
5917
5841
|
"use strict";
|
|
5918
5842
|
init_define_process();
|
|
5919
|
-
function guessEndOfLine(
|
|
5920
|
-
const index2 =
|
|
5843
|
+
function guessEndOfLine(text5) {
|
|
5844
|
+
const index2 = text5.indexOf("\r");
|
|
5921
5845
|
if (index2 >= 0) {
|
|
5922
|
-
return
|
|
5846
|
+
return text5.charAt(index2 + 1) === "\n" ? "crlf" : "cr";
|
|
5923
5847
|
}
|
|
5924
5848
|
return "lf";
|
|
5925
5849
|
}
|
|
@@ -5933,7 +5857,7 @@ var require_doc = __commonJS({
|
|
|
5933
5857
|
return "\n";
|
|
5934
5858
|
}
|
|
5935
5859
|
}
|
|
5936
|
-
function countEndOfLineChars(
|
|
5860
|
+
function countEndOfLineChars(text5, eol2) {
|
|
5937
5861
|
let regex;
|
|
5938
5862
|
switch (eol2) {
|
|
5939
5863
|
case "\n":
|
|
@@ -5948,11 +5872,11 @@ var require_doc = __commonJS({
|
|
|
5948
5872
|
default:
|
|
5949
5873
|
throw new Error('Unexpected "eol" '.concat(JSON.stringify(eol2), "."));
|
|
5950
5874
|
}
|
|
5951
|
-
const endOfLines =
|
|
5875
|
+
const endOfLines = text5.match(regex);
|
|
5952
5876
|
return endOfLines ? endOfLines.length : 0;
|
|
5953
5877
|
}
|
|
5954
|
-
function normalizeEndOfLine(
|
|
5955
|
-
return
|
|
5878
|
+
function normalizeEndOfLine(text5) {
|
|
5879
|
+
return text5.replace(/\r\n?/g, "\n");
|
|
5956
5880
|
}
|
|
5957
5881
|
module22.exports = {
|
|
5958
5882
|
guessEndOfLine,
|
|
@@ -6058,14 +5982,14 @@ var require_doc = __commonJS({
|
|
|
6058
5982
|
init_define_process();
|
|
6059
5983
|
var stringWidth2 = (init_string_width(), __toCommonJS(string_width_exports)).default;
|
|
6060
5984
|
var notAsciiRegex = /[^\x20-\x7F]/;
|
|
6061
|
-
function getStringWidth(
|
|
6062
|
-
if (!
|
|
5985
|
+
function getStringWidth(text5) {
|
|
5986
|
+
if (!text5) {
|
|
6063
5987
|
return 0;
|
|
6064
5988
|
}
|
|
6065
|
-
if (!notAsciiRegex.test(
|
|
6066
|
-
return
|
|
5989
|
+
if (!notAsciiRegex.test(text5)) {
|
|
5990
|
+
return text5.length;
|
|
6067
5991
|
}
|
|
6068
|
-
return stringWidth2(
|
|
5992
|
+
return stringWidth2(text5);
|
|
6069
5993
|
}
|
|
6070
5994
|
module22.exports = getStringWidth;
|
|
6071
5995
|
}
|
|
@@ -6388,9 +6312,9 @@ var require_doc = __commonJS({
|
|
|
6388
6312
|
function replaceEndOfLine(doc) {
|
|
6389
6313
|
return mapDoc(doc, (currentDoc) => typeof currentDoc === "string" && currentDoc.includes("\n") ? replaceTextEndOfLine(currentDoc) : currentDoc);
|
|
6390
6314
|
}
|
|
6391
|
-
function replaceTextEndOfLine(
|
|
6315
|
+
function replaceTextEndOfLine(text5) {
|
|
6392
6316
|
let replacement = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : literalline;
|
|
6393
|
-
return join2(replacement,
|
|
6317
|
+
return join2(replacement, text5.split("\n")).parts;
|
|
6394
6318
|
}
|
|
6395
6319
|
function canBreakFn(doc) {
|
|
6396
6320
|
if (doc.type === "line") {
|
|
@@ -9199,12 +9123,12 @@ var require_third_party = __commonJS({
|
|
|
9199
9123
|
var tokenize;
|
|
9200
9124
|
{
|
|
9201
9125
|
const JSX_TAG = /^[a-z][\w-]*$/i;
|
|
9202
|
-
const getTokenType = function(token, offset2,
|
|
9126
|
+
const getTokenType = function(token, offset2, text5) {
|
|
9203
9127
|
if (token.type === "name") {
|
|
9204
9128
|
if ((0, _helperValidatorIdentifier.isKeyword)(token.value) || (0, _helperValidatorIdentifier.isStrictReservedWord)(token.value, true) || sometimesKeywords.has(token.value)) {
|
|
9205
9129
|
return "keyword";
|
|
9206
9130
|
}
|
|
9207
|
-
if (JSX_TAG.test(token.value) && (
|
|
9131
|
+
if (JSX_TAG.test(token.value) && (text5[offset2 - 1] === "<" || text5.substr(offset2 - 2, 2) == "</")) {
|
|
9208
9132
|
return "jsxIdentifier";
|
|
9209
9133
|
}
|
|
9210
9134
|
if (token.value[0] !== token.value[0].toLowerCase()) {
|
|
@@ -9219,23 +9143,23 @@ var require_third_party = __commonJS({
|
|
|
9219
9143
|
}
|
|
9220
9144
|
return token.type;
|
|
9221
9145
|
};
|
|
9222
|
-
tokenize = function* (
|
|
9146
|
+
tokenize = function* (text5) {
|
|
9223
9147
|
let match;
|
|
9224
|
-
while (match = _jsTokens.default.exec(
|
|
9148
|
+
while (match = _jsTokens.default.exec(text5)) {
|
|
9225
9149
|
const token = _jsTokens.matchToToken(match);
|
|
9226
9150
|
yield {
|
|
9227
|
-
type: getTokenType(token, match.index,
|
|
9151
|
+
type: getTokenType(token, match.index, text5),
|
|
9228
9152
|
value: token.value
|
|
9229
9153
|
};
|
|
9230
9154
|
}
|
|
9231
9155
|
};
|
|
9232
9156
|
}
|
|
9233
|
-
function highlightTokens(defs,
|
|
9157
|
+
function highlightTokens(defs, text5) {
|
|
9234
9158
|
let highlighted = "";
|
|
9235
9159
|
for (const {
|
|
9236
9160
|
type,
|
|
9237
9161
|
value
|
|
9238
|
-
} of tokenize(
|
|
9162
|
+
} of tokenize(text5)) {
|
|
9239
9163
|
const colorize = defs[type];
|
|
9240
9164
|
if (colorize) {
|
|
9241
9165
|
highlighted += value.split(NEWLINE).map((str) => colorize(str)).join("\n");
|
|
@@ -12270,17 +12194,17 @@ ${ctx.indent}`;
|
|
|
12270
12194
|
var FOLD_FLOW = "flow";
|
|
12271
12195
|
var FOLD_BLOCK = "block";
|
|
12272
12196
|
var FOLD_QUOTED = "quoted";
|
|
12273
|
-
var consumeMoreIndentedLines = (
|
|
12274
|
-
let ch =
|
|
12197
|
+
var consumeMoreIndentedLines = (text5, i) => {
|
|
12198
|
+
let ch = text5[i + 1];
|
|
12275
12199
|
while (ch === " " || ch === " ") {
|
|
12276
12200
|
do {
|
|
12277
|
-
ch =
|
|
12201
|
+
ch = text5[i += 1];
|
|
12278
12202
|
} while (ch && ch !== "\n");
|
|
12279
|
-
ch =
|
|
12203
|
+
ch = text5[i + 1];
|
|
12280
12204
|
}
|
|
12281
12205
|
return i;
|
|
12282
12206
|
};
|
|
12283
|
-
function foldFlowLines(
|
|
12207
|
+
function foldFlowLines(text5, indent, mode, {
|
|
12284
12208
|
indentAtStart,
|
|
12285
12209
|
lineWidth = 80,
|
|
12286
12210
|
minContentWidth = 20,
|
|
@@ -12288,10 +12212,10 @@ ${ctx.indent}`;
|
|
|
12288
12212
|
onOverflow
|
|
12289
12213
|
}) {
|
|
12290
12214
|
if (!lineWidth || lineWidth < 0)
|
|
12291
|
-
return
|
|
12215
|
+
return text5;
|
|
12292
12216
|
const endStep = Math.max(1 + minContentWidth, 1 + lineWidth - indent.length);
|
|
12293
|
-
if (
|
|
12294
|
-
return
|
|
12217
|
+
if (text5.length <= endStep)
|
|
12218
|
+
return text5;
|
|
12295
12219
|
const folds = [];
|
|
12296
12220
|
const escapedFolds = {};
|
|
12297
12221
|
let end = lineWidth - indent.length;
|
|
@@ -12308,14 +12232,14 @@ ${ctx.indent}`;
|
|
|
12308
12232
|
let escStart = -1;
|
|
12309
12233
|
let escEnd = -1;
|
|
12310
12234
|
if (mode === FOLD_BLOCK) {
|
|
12311
|
-
i = consumeMoreIndentedLines(
|
|
12235
|
+
i = consumeMoreIndentedLines(text5, i);
|
|
12312
12236
|
if (i !== -1)
|
|
12313
12237
|
end = i + endStep;
|
|
12314
12238
|
}
|
|
12315
|
-
for (let ch; ch =
|
|
12239
|
+
for (let ch; ch = text5[i += 1]; ) {
|
|
12316
12240
|
if (mode === FOLD_QUOTED && ch === "\\") {
|
|
12317
12241
|
escStart = i;
|
|
12318
|
-
switch (
|
|
12242
|
+
switch (text5[i + 1]) {
|
|
12319
12243
|
case "x":
|
|
12320
12244
|
i += 3;
|
|
12321
12245
|
break;
|
|
@@ -12332,12 +12256,12 @@ ${ctx.indent}`;
|
|
|
12332
12256
|
}
|
|
12333
12257
|
if (ch === "\n") {
|
|
12334
12258
|
if (mode === FOLD_BLOCK)
|
|
12335
|
-
i = consumeMoreIndentedLines(
|
|
12259
|
+
i = consumeMoreIndentedLines(text5, i);
|
|
12336
12260
|
end = i + endStep;
|
|
12337
12261
|
split = void 0;
|
|
12338
12262
|
} else {
|
|
12339
12263
|
if (ch === " " && prev && prev !== " " && prev !== "\n" && prev !== " ") {
|
|
12340
|
-
const next =
|
|
12264
|
+
const next = text5[i + 1];
|
|
12341
12265
|
if (next && next !== " " && next !== "\n" && next !== " ")
|
|
12342
12266
|
split = i;
|
|
12343
12267
|
}
|
|
@@ -12349,12 +12273,12 @@ ${ctx.indent}`;
|
|
|
12349
12273
|
} else if (mode === FOLD_QUOTED) {
|
|
12350
12274
|
while (prev === " " || prev === " ") {
|
|
12351
12275
|
prev = ch;
|
|
12352
|
-
ch =
|
|
12276
|
+
ch = text5[i += 1];
|
|
12353
12277
|
overflow = true;
|
|
12354
12278
|
}
|
|
12355
12279
|
const j = i > escEnd + 1 ? i - 2 : escStart - 1;
|
|
12356
12280
|
if (escapedFolds[j])
|
|
12357
|
-
return
|
|
12281
|
+
return text5;
|
|
12358
12282
|
folds.push(j);
|
|
12359
12283
|
escapedFolds[j] = true;
|
|
12360
12284
|
end = j + endStep;
|
|
@@ -12369,21 +12293,21 @@ ${ctx.indent}`;
|
|
|
12369
12293
|
if (overflow && onOverflow)
|
|
12370
12294
|
onOverflow();
|
|
12371
12295
|
if (folds.length === 0)
|
|
12372
|
-
return
|
|
12296
|
+
return text5;
|
|
12373
12297
|
if (onFold)
|
|
12374
12298
|
onFold();
|
|
12375
|
-
let res =
|
|
12299
|
+
let res = text5.slice(0, folds[0]);
|
|
12376
12300
|
for (let i2 = 0; i2 < folds.length; ++i2) {
|
|
12377
12301
|
const fold = folds[i2];
|
|
12378
|
-
const end2 = folds[i2 + 1] ||
|
|
12302
|
+
const end2 = folds[i2 + 1] || text5.length;
|
|
12379
12303
|
if (fold === 0)
|
|
12380
12304
|
res = `
|
|
12381
|
-
${indent}${
|
|
12305
|
+
${indent}${text5.slice(0, end2)}`;
|
|
12382
12306
|
else {
|
|
12383
12307
|
if (mode === FOLD_QUOTED && escapedFolds[fold])
|
|
12384
|
-
res += `${
|
|
12308
|
+
res += `${text5[fold]}\\`;
|
|
12385
12309
|
res += `
|
|
12386
|
-
${indent}${
|
|
12310
|
+
${indent}${text5.slice(fold + 1, end2)}`;
|
|
12387
12311
|
}
|
|
12388
12312
|
}
|
|
12389
12313
|
return res;
|
|
@@ -192028,7 +191952,7 @@ var require_prettier = __commonJS({
|
|
|
192028
191952
|
var $propertyIsEnumerable = {}.propertyIsEnumerable;
|
|
192029
191953
|
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
192030
191954
|
var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1);
|
|
192031
|
-
exports2.f = NASHORN_BUG ? function
|
|
191955
|
+
exports2.f = NASHORN_BUG ? function propertyIsEnumerable2(V) {
|
|
192032
191956
|
var descriptor = getOwnPropertyDescriptor(this, V);
|
|
192033
191957
|
return !!descriptor && descriptor.enumerable;
|
|
192034
191958
|
} : $propertyIsEnumerable;
|
|
@@ -192314,9 +192238,9 @@ var require_prettier = __commonJS({
|
|
|
192314
192238
|
"node_modules/core-js/internals/has-own-property.js"(exports2, module22) {
|
|
192315
192239
|
var uncurryThis = require_function_uncurry_this();
|
|
192316
192240
|
var toObject = require_to_object();
|
|
192317
|
-
var
|
|
192241
|
+
var hasOwnProperty5 = uncurryThis({}.hasOwnProperty);
|
|
192318
192242
|
module22.exports = Object.hasOwn || function hasOwn2(it, key) {
|
|
192319
|
-
return
|
|
192243
|
+
return hasOwnProperty5(toObject(it), key);
|
|
192320
192244
|
};
|
|
192321
192245
|
}
|
|
192322
192246
|
});
|
|
@@ -192340,14 +192264,14 @@ var require_prettier = __commonJS({
|
|
|
192340
192264
|
var NATIVE_SYMBOL = require_native_symbol();
|
|
192341
192265
|
var USE_SYMBOL_AS_UID = require_use_symbol_as_uid();
|
|
192342
192266
|
var WellKnownSymbolsStore = shared("wks");
|
|
192343
|
-
var
|
|
192344
|
-
var symbolFor =
|
|
192345
|
-
var createWellKnownSymbol = USE_SYMBOL_AS_UID ?
|
|
192267
|
+
var Symbol22 = global2.Symbol;
|
|
192268
|
+
var symbolFor = Symbol22 && Symbol22["for"];
|
|
192269
|
+
var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol22 : Symbol22 && Symbol22.withoutSetter || uid;
|
|
192346
192270
|
module22.exports = function(name) {
|
|
192347
192271
|
if (!hasOwn2(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == "string")) {
|
|
192348
192272
|
var description = "Symbol." + name;
|
|
192349
|
-
if (NATIVE_SYMBOL && hasOwn2(
|
|
192350
|
-
WellKnownSymbolsStore[name] =
|
|
192273
|
+
if (NATIVE_SYMBOL && hasOwn2(Symbol22, name)) {
|
|
192274
|
+
WellKnownSymbolsStore[name] = Symbol22[name];
|
|
192351
192275
|
} else if (USE_SYMBOL_AS_UID && symbolFor) {
|
|
192352
192276
|
WellKnownSymbolsStore[name] = symbolFor(description);
|
|
192353
192277
|
} else {
|
|
@@ -192935,7 +192859,7 @@ var require_prettier = __commonJS({
|
|
|
192935
192859
|
var require_is_array = __commonJS2({
|
|
192936
192860
|
"node_modules/core-js/internals/is-array.js"(exports2, module22) {
|
|
192937
192861
|
var classof = require_classof_raw();
|
|
192938
|
-
module22.exports = Array.isArray || function
|
|
192862
|
+
module22.exports = Array.isArray || function isArray3(argument) {
|
|
192939
192863
|
return classof(argument) == "Array";
|
|
192940
192864
|
};
|
|
192941
192865
|
}
|
|
@@ -192958,7 +192882,7 @@ var require_prettier = __commonJS({
|
|
|
192958
192882
|
"node_modules/core-js/internals/flatten-into-array.js"(exports2, module22) {
|
|
192959
192883
|
"use strict";
|
|
192960
192884
|
var global2 = require_global();
|
|
192961
|
-
var
|
|
192885
|
+
var isArray3 = require_is_array();
|
|
192962
192886
|
var lengthOfArrayLike = require_length_of_array_like();
|
|
192963
192887
|
var bind = require_function_bind_context();
|
|
192964
192888
|
var TypeError2 = global2.TypeError;
|
|
@@ -192970,7 +192894,7 @@ var require_prettier = __commonJS({
|
|
|
192970
192894
|
while (sourceIndex < sourceLen) {
|
|
192971
192895
|
if (sourceIndex in source) {
|
|
192972
192896
|
element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex];
|
|
192973
|
-
if (depth > 0 &&
|
|
192897
|
+
if (depth > 0 && isArray3(element)) {
|
|
192974
192898
|
elementLen = lengthOfArrayLike(element);
|
|
192975
192899
|
targetIndex = flattenIntoArray(target, original, element, elementLen, targetIndex, depth - 1) - 1;
|
|
192976
192900
|
} else {
|
|
@@ -193072,7 +192996,7 @@ var require_prettier = __commonJS({
|
|
|
193072
192996
|
var require_array_species_constructor = __commonJS2({
|
|
193073
192997
|
"node_modules/core-js/internals/array-species-constructor.js"(exports2, module22) {
|
|
193074
192998
|
var global2 = require_global();
|
|
193075
|
-
var
|
|
192999
|
+
var isArray3 = require_is_array();
|
|
193076
193000
|
var isConstructor = require_is_constructor();
|
|
193077
193001
|
var isObject = require_is_object();
|
|
193078
193002
|
var wellKnownSymbol = require_well_known_symbol();
|
|
@@ -193080,9 +193004,9 @@ var require_prettier = __commonJS({
|
|
|
193080
193004
|
var Array2 = global2.Array;
|
|
193081
193005
|
module22.exports = function(originalArray) {
|
|
193082
193006
|
var C;
|
|
193083
|
-
if (
|
|
193007
|
+
if (isArray3(originalArray)) {
|
|
193084
193008
|
C = originalArray.constructor;
|
|
193085
|
-
if (isConstructor(C) && (C === Array2 ||
|
|
193009
|
+
if (isConstructor(C) && (C === Array2 || isArray3(C.prototype)))
|
|
193086
193010
|
C = void 0;
|
|
193087
193011
|
else if (isObject(C)) {
|
|
193088
193012
|
C = C[SPECIES];
|
|
@@ -194652,14 +194576,14 @@ var require_prettier = __commonJS({
|
|
|
194652
194576
|
"use strict";
|
|
194653
194577
|
var stringWidth2 = (init_string_width(), __toCommonJS(string_width_exports)).default;
|
|
194654
194578
|
var notAsciiRegex = /[^\x20-\x7F]/;
|
|
194655
|
-
function getStringWidth(
|
|
194656
|
-
if (!
|
|
194579
|
+
function getStringWidth(text5) {
|
|
194580
|
+
if (!text5) {
|
|
194657
194581
|
return 0;
|
|
194658
194582
|
}
|
|
194659
|
-
if (!notAsciiRegex.test(
|
|
194660
|
-
return
|
|
194583
|
+
if (!notAsciiRegex.test(text5)) {
|
|
194584
|
+
return text5.length;
|
|
194661
194585
|
}
|
|
194662
|
-
return stringWidth2(
|
|
194586
|
+
return stringWidth2(text5);
|
|
194663
194587
|
}
|
|
194664
194588
|
module22.exports = getStringWidth;
|
|
194665
194589
|
}
|
|
@@ -194668,17 +194592,17 @@ var require_prettier = __commonJS({
|
|
|
194668
194592
|
"src/utils/text/skip.js"(exports2, module22) {
|
|
194669
194593
|
"use strict";
|
|
194670
194594
|
function skip(chars) {
|
|
194671
|
-
return (
|
|
194595
|
+
return (text5, index2, opts) => {
|
|
194672
194596
|
const backwards = opts && opts.backwards;
|
|
194673
194597
|
if (index2 === false) {
|
|
194674
194598
|
return false;
|
|
194675
194599
|
}
|
|
194676
194600
|
const {
|
|
194677
194601
|
length
|
|
194678
|
-
} =
|
|
194602
|
+
} = text5;
|
|
194679
194603
|
let cursor = index2;
|
|
194680
194604
|
while (cursor >= 0 && cursor < length) {
|
|
194681
|
-
const c =
|
|
194605
|
+
const c = text5.charAt(cursor);
|
|
194682
194606
|
if (chars instanceof RegExp) {
|
|
194683
194607
|
if (!chars.test(c)) {
|
|
194684
194608
|
return cursor;
|
|
@@ -194709,13 +194633,13 @@ var require_prettier = __commonJS({
|
|
|
194709
194633
|
var require_skip_inline_comment = __commonJS22({
|
|
194710
194634
|
"src/utils/text/skip-inline-comment.js"(exports2, module22) {
|
|
194711
194635
|
"use strict";
|
|
194712
|
-
function skipInlineComment(
|
|
194636
|
+
function skipInlineComment(text5, index2) {
|
|
194713
194637
|
if (index2 === false) {
|
|
194714
194638
|
return false;
|
|
194715
194639
|
}
|
|
194716
|
-
if (
|
|
194717
|
-
for (let i = index2 + 2; i <
|
|
194718
|
-
if (
|
|
194640
|
+
if (text5.charAt(index2) === "/" && text5.charAt(index2 + 1) === "*") {
|
|
194641
|
+
for (let i = index2 + 2; i < text5.length; ++i) {
|
|
194642
|
+
if (text5.charAt(i) === "*" && text5.charAt(i + 1) === "/") {
|
|
194719
194643
|
return i + 2;
|
|
194720
194644
|
}
|
|
194721
194645
|
}
|
|
@@ -194731,12 +194655,12 @@ var require_prettier = __commonJS({
|
|
|
194731
194655
|
var {
|
|
194732
194656
|
skipEverythingButNewLine
|
|
194733
194657
|
} = require_skip();
|
|
194734
|
-
function skipTrailingComment(
|
|
194658
|
+
function skipTrailingComment(text5, index2) {
|
|
194735
194659
|
if (index2 === false) {
|
|
194736
194660
|
return false;
|
|
194737
194661
|
}
|
|
194738
|
-
if (
|
|
194739
|
-
return skipEverythingButNewLine(
|
|
194662
|
+
if (text5.charAt(index2) === "/" && text5.charAt(index2 + 1) === "/") {
|
|
194663
|
+
return skipEverythingButNewLine(text5, index2);
|
|
194740
194664
|
}
|
|
194741
194665
|
return index2;
|
|
194742
194666
|
}
|
|
@@ -194746,21 +194670,21 @@ var require_prettier = __commonJS({
|
|
|
194746
194670
|
var require_skip_newline = __commonJS22({
|
|
194747
194671
|
"src/utils/text/skip-newline.js"(exports2, module22) {
|
|
194748
194672
|
"use strict";
|
|
194749
|
-
function skipNewline(
|
|
194673
|
+
function skipNewline(text5, index2, opts) {
|
|
194750
194674
|
const backwards = opts && opts.backwards;
|
|
194751
194675
|
if (index2 === false) {
|
|
194752
194676
|
return false;
|
|
194753
194677
|
}
|
|
194754
|
-
const atIndex =
|
|
194678
|
+
const atIndex = text5.charAt(index2);
|
|
194755
194679
|
if (backwards) {
|
|
194756
|
-
if (
|
|
194680
|
+
if (text5.charAt(index2 - 1) === "\r" && atIndex === "\n") {
|
|
194757
194681
|
return index2 - 2;
|
|
194758
194682
|
}
|
|
194759
194683
|
if (atIndex === "\n" || atIndex === "\r" || atIndex === "\u2028" || atIndex === "\u2029") {
|
|
194760
194684
|
return index2 - 1;
|
|
194761
194685
|
}
|
|
194762
194686
|
} else {
|
|
194763
|
-
if (atIndex === "\r" &&
|
|
194687
|
+
if (atIndex === "\r" && text5.charAt(index2 + 1) === "\n") {
|
|
194764
194688
|
return index2 + 2;
|
|
194765
194689
|
}
|
|
194766
194690
|
if (atIndex === "\n" || atIndex === "\r" || atIndex === "\u2028" || atIndex === "\u2029") {
|
|
@@ -194781,15 +194705,15 @@ var require_prettier = __commonJS({
|
|
|
194781
194705
|
var {
|
|
194782
194706
|
skipSpaces
|
|
194783
194707
|
} = require_skip();
|
|
194784
|
-
function getNextNonSpaceNonCommentCharacterIndexWithStartIndex(
|
|
194708
|
+
function getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text5, idx) {
|
|
194785
194709
|
let oldIdx = null;
|
|
194786
194710
|
let nextIdx = idx;
|
|
194787
194711
|
while (nextIdx !== oldIdx) {
|
|
194788
194712
|
oldIdx = nextIdx;
|
|
194789
|
-
nextIdx = skipSpaces(
|
|
194790
|
-
nextIdx = skipInlineComment(
|
|
194791
|
-
nextIdx = skipTrailingComment(
|
|
194792
|
-
nextIdx = skipNewline(
|
|
194713
|
+
nextIdx = skipSpaces(text5, nextIdx);
|
|
194714
|
+
nextIdx = skipInlineComment(text5, nextIdx);
|
|
194715
|
+
nextIdx = skipTrailingComment(text5, nextIdx);
|
|
194716
|
+
nextIdx = skipNewline(text5, nextIdx);
|
|
194793
194717
|
}
|
|
194794
194718
|
return nextIdx;
|
|
194795
194719
|
}
|
|
@@ -194820,17 +194744,17 @@ var require_prettier = __commonJS({
|
|
|
194820
194744
|
var getNextNonSpaceNonCommentCharacterIndexWithStartIndex = require_get_next_non_space_non_comment_character_index_with_start_index();
|
|
194821
194745
|
var getPenultimate = (arr) => arr[arr.length - 2];
|
|
194822
194746
|
function skip(chars) {
|
|
194823
|
-
return (
|
|
194747
|
+
return (text5, index2, opts) => {
|
|
194824
194748
|
const backwards = opts && opts.backwards;
|
|
194825
194749
|
if (index2 === false) {
|
|
194826
194750
|
return false;
|
|
194827
194751
|
}
|
|
194828
194752
|
const {
|
|
194829
194753
|
length
|
|
194830
|
-
} =
|
|
194754
|
+
} = text5;
|
|
194831
194755
|
let cursor = index2;
|
|
194832
194756
|
while (cursor >= 0 && cursor < length) {
|
|
194833
|
-
const c =
|
|
194757
|
+
const c = text5.charAt(cursor);
|
|
194834
194758
|
if (chars instanceof RegExp) {
|
|
194835
194759
|
if (!chars.test(c)) {
|
|
194836
194760
|
return cursor;
|
|
@@ -194846,59 +194770,59 @@ var require_prettier = __commonJS({
|
|
|
194846
194770
|
return false;
|
|
194847
194771
|
};
|
|
194848
194772
|
}
|
|
194849
|
-
function hasNewline(
|
|
194850
|
-
const idx = skipSpaces(
|
|
194851
|
-
const idx2 = skipNewline(
|
|
194773
|
+
function hasNewline(text5, index2, opts = {}) {
|
|
194774
|
+
const idx = skipSpaces(text5, opts.backwards ? index2 - 1 : index2, opts);
|
|
194775
|
+
const idx2 = skipNewline(text5, idx, opts);
|
|
194852
194776
|
return idx !== idx2;
|
|
194853
194777
|
}
|
|
194854
|
-
function hasNewlineInRange(
|
|
194778
|
+
function hasNewlineInRange(text5, start3, end) {
|
|
194855
194779
|
for (let i = start3; i < end; ++i) {
|
|
194856
|
-
if (
|
|
194780
|
+
if (text5.charAt(i) === "\n") {
|
|
194857
194781
|
return true;
|
|
194858
194782
|
}
|
|
194859
194783
|
}
|
|
194860
194784
|
return false;
|
|
194861
194785
|
}
|
|
194862
|
-
function isPreviousLineEmpty(
|
|
194786
|
+
function isPreviousLineEmpty(text5, node, locStart) {
|
|
194863
194787
|
let idx = locStart(node) - 1;
|
|
194864
|
-
idx = skipSpaces(
|
|
194788
|
+
idx = skipSpaces(text5, idx, {
|
|
194865
194789
|
backwards: true
|
|
194866
194790
|
});
|
|
194867
|
-
idx = skipNewline(
|
|
194791
|
+
idx = skipNewline(text5, idx, {
|
|
194868
194792
|
backwards: true
|
|
194869
194793
|
});
|
|
194870
|
-
idx = skipSpaces(
|
|
194794
|
+
idx = skipSpaces(text5, idx, {
|
|
194871
194795
|
backwards: true
|
|
194872
194796
|
});
|
|
194873
|
-
const idx2 = skipNewline(
|
|
194797
|
+
const idx2 = skipNewline(text5, idx, {
|
|
194874
194798
|
backwards: true
|
|
194875
194799
|
});
|
|
194876
194800
|
return idx !== idx2;
|
|
194877
194801
|
}
|
|
194878
|
-
function isNextLineEmptyAfterIndex(
|
|
194802
|
+
function isNextLineEmptyAfterIndex(text5, index2) {
|
|
194879
194803
|
let oldIdx = null;
|
|
194880
194804
|
let idx = index2;
|
|
194881
194805
|
while (idx !== oldIdx) {
|
|
194882
194806
|
oldIdx = idx;
|
|
194883
|
-
idx = skipToLineEnd(
|
|
194884
|
-
idx = skipInlineComment(
|
|
194885
|
-
idx = skipSpaces(
|
|
194807
|
+
idx = skipToLineEnd(text5, idx);
|
|
194808
|
+
idx = skipInlineComment(text5, idx);
|
|
194809
|
+
idx = skipSpaces(text5, idx);
|
|
194886
194810
|
}
|
|
194887
|
-
idx = skipTrailingComment(
|
|
194888
|
-
idx = skipNewline(
|
|
194889
|
-
return idx !== false && hasNewline(
|
|
194811
|
+
idx = skipTrailingComment(text5, idx);
|
|
194812
|
+
idx = skipNewline(text5, idx);
|
|
194813
|
+
return idx !== false && hasNewline(text5, idx);
|
|
194890
194814
|
}
|
|
194891
|
-
function isNextLineEmpty(
|
|
194892
|
-
return isNextLineEmptyAfterIndex(
|
|
194815
|
+
function isNextLineEmpty(text5, node, locEnd) {
|
|
194816
|
+
return isNextLineEmptyAfterIndex(text5, locEnd(node));
|
|
194893
194817
|
}
|
|
194894
|
-
function getNextNonSpaceNonCommentCharacterIndex(
|
|
194895
|
-
return getNextNonSpaceNonCommentCharacterIndexWithStartIndex(
|
|
194818
|
+
function getNextNonSpaceNonCommentCharacterIndex(text5, node, locEnd) {
|
|
194819
|
+
return getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text5, locEnd(node));
|
|
194896
194820
|
}
|
|
194897
|
-
function getNextNonSpaceNonCommentCharacter(
|
|
194898
|
-
return
|
|
194821
|
+
function getNextNonSpaceNonCommentCharacter(text5, node, locEnd) {
|
|
194822
|
+
return text5.charAt(getNextNonSpaceNonCommentCharacterIndex(text5, node, locEnd));
|
|
194899
194823
|
}
|
|
194900
|
-
function hasSpaces(
|
|
194901
|
-
const idx = skipSpaces(
|
|
194824
|
+
function hasSpaces(text5, index2, opts = {}) {
|
|
194825
|
+
const idx = skipSpaces(text5, opts.backwards ? index2 - 1 : index2, opts);
|
|
194902
194826
|
return idx !== index2;
|
|
194903
194827
|
}
|
|
194904
194828
|
function getAlignmentSize(value, tabWidth, startIndex = 0) {
|
|
@@ -195094,10 +195018,10 @@ var require_prettier = __commonJS({
|
|
|
195094
195018
|
var require_end_of_line = __commonJS22({
|
|
195095
195019
|
"src/common/end-of-line.js"(exports2, module22) {
|
|
195096
195020
|
"use strict";
|
|
195097
|
-
function guessEndOfLine(
|
|
195098
|
-
const index2 =
|
|
195021
|
+
function guessEndOfLine(text5) {
|
|
195022
|
+
const index2 = text5.indexOf("\r");
|
|
195099
195023
|
if (index2 >= 0) {
|
|
195100
|
-
return
|
|
195024
|
+
return text5.charAt(index2 + 1) === "\n" ? "crlf" : "cr";
|
|
195101
195025
|
}
|
|
195102
195026
|
return "lf";
|
|
195103
195027
|
}
|
|
@@ -195111,7 +195035,7 @@ var require_prettier = __commonJS({
|
|
|
195111
195035
|
return "\n";
|
|
195112
195036
|
}
|
|
195113
195037
|
}
|
|
195114
|
-
function countEndOfLineChars(
|
|
195038
|
+
function countEndOfLineChars(text5, eol2) {
|
|
195115
195039
|
let regex;
|
|
195116
195040
|
switch (eol2) {
|
|
195117
195041
|
case "\n":
|
|
@@ -195126,11 +195050,11 @@ var require_prettier = __commonJS({
|
|
|
195126
195050
|
default:
|
|
195127
195051
|
throw new Error(`Unexpected "eol" ${JSON.stringify(eol2)}.`);
|
|
195128
195052
|
}
|
|
195129
|
-
const endOfLines =
|
|
195053
|
+
const endOfLines = text5.match(regex);
|
|
195130
195054
|
return endOfLines ? endOfLines.length : 0;
|
|
195131
195055
|
}
|
|
195132
|
-
function normalizeEndOfLine(
|
|
195133
|
-
return
|
|
195056
|
+
function normalizeEndOfLine(text5) {
|
|
195057
|
+
return text5.replace(/\r\n?/g, "\n");
|
|
195134
195058
|
}
|
|
195135
195059
|
module22.exports = {
|
|
195136
195060
|
guessEndOfLine,
|
|
@@ -198868,12 +198792,12 @@ var require_prettier = __commonJS({
|
|
|
198868
198792
|
var tokenize;
|
|
198869
198793
|
{
|
|
198870
198794
|
const JSX_TAG = /^[a-z][\w-]*$/i;
|
|
198871
|
-
const getTokenType = function(token, offset2,
|
|
198795
|
+
const getTokenType = function(token, offset2, text5) {
|
|
198872
198796
|
if (token.type === "name") {
|
|
198873
198797
|
if ((0, _helperValidatorIdentifier.isKeyword)(token.value) || (0, _helperValidatorIdentifier.isStrictReservedWord)(token.value, true) || sometimesKeywords.has(token.value)) {
|
|
198874
198798
|
return "keyword";
|
|
198875
198799
|
}
|
|
198876
|
-
if (JSX_TAG.test(token.value) && (
|
|
198800
|
+
if (JSX_TAG.test(token.value) && (text5[offset2 - 1] === "<" || text5.substr(offset2 - 2, 2) == "</")) {
|
|
198877
198801
|
return "jsxIdentifier";
|
|
198878
198802
|
}
|
|
198879
198803
|
if (token.value[0] !== token.value[0].toLowerCase()) {
|
|
@@ -198888,23 +198812,23 @@ var require_prettier = __commonJS({
|
|
|
198888
198812
|
}
|
|
198889
198813
|
return token.type;
|
|
198890
198814
|
};
|
|
198891
|
-
tokenize = function* (
|
|
198815
|
+
tokenize = function* (text5) {
|
|
198892
198816
|
let match;
|
|
198893
|
-
while (match = _jsTokens.default.exec(
|
|
198817
|
+
while (match = _jsTokens.default.exec(text5)) {
|
|
198894
198818
|
const token = _jsTokens.matchToToken(match);
|
|
198895
198819
|
yield {
|
|
198896
|
-
type: getTokenType(token, match.index,
|
|
198820
|
+
type: getTokenType(token, match.index, text5),
|
|
198897
198821
|
value: token.value
|
|
198898
198822
|
};
|
|
198899
198823
|
}
|
|
198900
198824
|
};
|
|
198901
198825
|
}
|
|
198902
|
-
function highlightTokens(defs,
|
|
198826
|
+
function highlightTokens(defs, text5) {
|
|
198903
198827
|
let highlighted = "";
|
|
198904
198828
|
for (const {
|
|
198905
198829
|
type,
|
|
198906
198830
|
value
|
|
198907
|
-
} of tokenize(
|
|
198831
|
+
} of tokenize(text5)) {
|
|
198908
198832
|
const colorize = defs[type];
|
|
198909
198833
|
if (colorize) {
|
|
198910
198834
|
highlighted += value.split(NEWLINE).map((str) => colorize(str)).join("\n");
|
|
@@ -199123,7 +199047,7 @@ ${frame}`;
|
|
|
199123
199047
|
return loadParser(opts.parser);
|
|
199124
199048
|
}
|
|
199125
199049
|
}
|
|
199126
|
-
function parse4(
|
|
199050
|
+
function parse4(text5, opts) {
|
|
199127
199051
|
const parsers = getParsers(opts);
|
|
199128
199052
|
const parsersForCustomParserApi = Object.defineProperties({}, Object.fromEntries(Object.keys(parsers).map((parserName) => [parserName, {
|
|
199129
199053
|
enumerable: true,
|
|
@@ -199134,11 +199058,11 @@ ${frame}`;
|
|
|
199134
199058
|
const parser = resolveParser(opts, parsers);
|
|
199135
199059
|
try {
|
|
199136
199060
|
if (parser.preprocess) {
|
|
199137
|
-
|
|
199061
|
+
text5 = parser.preprocess(text5, opts);
|
|
199138
199062
|
}
|
|
199139
199063
|
return {
|
|
199140
|
-
text:
|
|
199141
|
-
ast: parser.parse(
|
|
199064
|
+
text: text5,
|
|
199065
|
+
ast: parser.parse(text5, parsersForCustomParserApi, opts)
|
|
199142
199066
|
};
|
|
199143
199067
|
} catch (error) {
|
|
199144
199068
|
const {
|
|
@@ -199148,7 +199072,7 @@ ${frame}`;
|
|
|
199148
199072
|
const {
|
|
199149
199073
|
codeFrameColumns
|
|
199150
199074
|
} = require_lib5();
|
|
199151
|
-
error.codeFrame = codeFrameColumns(
|
|
199075
|
+
error.codeFrame = codeFrameColumns(text5, loc, {
|
|
199152
199076
|
highlightCode: true
|
|
199153
199077
|
});
|
|
199154
199078
|
error.message += "\n" + error.codeFrame;
|
|
@@ -199569,7 +199493,7 @@ ${frame}`;
|
|
|
199569
199493
|
};
|
|
199570
199494
|
}
|
|
199571
199495
|
var returnFalse = () => false;
|
|
199572
|
-
function attach(comments, ast,
|
|
199496
|
+
function attach(comments, ast, text5, options) {
|
|
199573
199497
|
if (!Array.isArray(comments)) {
|
|
199574
199498
|
return;
|
|
199575
199499
|
}
|
|
@@ -199589,7 +199513,7 @@ ${frame}`;
|
|
|
199589
199513
|
} = handleComments;
|
|
199590
199514
|
const decoratedComments = comments.map((comment, index2) => Object.assign(Object.assign({}, decorateComment(ast, comment, options)), {}, {
|
|
199591
199515
|
comment,
|
|
199592
|
-
text:
|
|
199516
|
+
text: text5,
|
|
199593
199517
|
options,
|
|
199594
199518
|
ast,
|
|
199595
199519
|
isLastComment: comments.length - 1 === index2
|
|
@@ -199671,7 +199595,7 @@ ${frame}`;
|
|
|
199671
199595
|
}
|
|
199672
199596
|
}
|
|
199673
199597
|
}
|
|
199674
|
-
breakTies(tiesToBreak,
|
|
199598
|
+
breakTies(tiesToBreak, text5, options);
|
|
199675
199599
|
if (!avoidAstMutation) {
|
|
199676
199600
|
for (const comment of comments) {
|
|
199677
199601
|
delete comment.precedingNode;
|
|
@@ -199680,8 +199604,8 @@ ${frame}`;
|
|
|
199680
199604
|
}
|
|
199681
199605
|
}
|
|
199682
199606
|
}
|
|
199683
|
-
var isAllEmptyAndNoLineBreak = (
|
|
199684
|
-
function isOwnLineComment(
|
|
199607
|
+
var isAllEmptyAndNoLineBreak = (text5) => !/[\S\n\u2028\u2029]/.test(text5);
|
|
199608
|
+
function isOwnLineComment(text5, options, decoratedComments, commentIndex) {
|
|
199685
199609
|
const {
|
|
199686
199610
|
comment,
|
|
199687
199611
|
precedingNode
|
|
@@ -199697,17 +199621,17 @@ ${frame}`;
|
|
|
199697
199621
|
comment: comment2,
|
|
199698
199622
|
precedingNode: currentCommentPrecedingNode
|
|
199699
199623
|
} = decoratedComments[index2];
|
|
199700
|
-
if (currentCommentPrecedingNode !== precedingNode || !isAllEmptyAndNoLineBreak(
|
|
199624
|
+
if (currentCommentPrecedingNode !== precedingNode || !isAllEmptyAndNoLineBreak(text5.slice(locEnd(comment2), start3))) {
|
|
199701
199625
|
break;
|
|
199702
199626
|
}
|
|
199703
199627
|
start3 = locStart(comment2);
|
|
199704
199628
|
}
|
|
199705
199629
|
}
|
|
199706
|
-
return hasNewline(
|
|
199630
|
+
return hasNewline(text5, start3, {
|
|
199707
199631
|
backwards: true
|
|
199708
199632
|
});
|
|
199709
199633
|
}
|
|
199710
|
-
function isEndOfLineComment(
|
|
199634
|
+
function isEndOfLineComment(text5, options, decoratedComments, commentIndex) {
|
|
199711
199635
|
const {
|
|
199712
199636
|
comment,
|
|
199713
199637
|
followingNode
|
|
@@ -199723,15 +199647,15 @@ ${frame}`;
|
|
|
199723
199647
|
comment: comment2,
|
|
199724
199648
|
followingNode: currentCommentFollowingNode
|
|
199725
199649
|
} = decoratedComments[index2];
|
|
199726
|
-
if (currentCommentFollowingNode !== followingNode || !isAllEmptyAndNoLineBreak(
|
|
199650
|
+
if (currentCommentFollowingNode !== followingNode || !isAllEmptyAndNoLineBreak(text5.slice(end, locStart(comment2)))) {
|
|
199727
199651
|
break;
|
|
199728
199652
|
}
|
|
199729
199653
|
end = locEnd(comment2);
|
|
199730
199654
|
}
|
|
199731
199655
|
}
|
|
199732
|
-
return hasNewline(
|
|
199656
|
+
return hasNewline(text5, end);
|
|
199733
199657
|
}
|
|
199734
|
-
function breakTies(tiesToBreak,
|
|
199658
|
+
function breakTies(tiesToBreak, text5, options) {
|
|
199735
199659
|
const tieCount = tiesToBreak.length;
|
|
199736
199660
|
if (tieCount === 0) {
|
|
199737
199661
|
return;
|
|
@@ -199752,7 +199676,7 @@ ${frame}`;
|
|
|
199752
199676
|
} = tiesToBreak[indexOfFirstLeadingComment - 1];
|
|
199753
199677
|
assert.strictEqual(currentCommentPrecedingNode, precedingNode);
|
|
199754
199678
|
assert.strictEqual(currentCommentFollowingNode, followingNode);
|
|
199755
|
-
const gap =
|
|
199679
|
+
const gap = text5.slice(options.locEnd(comment), gapEndPos);
|
|
199756
199680
|
if (gapRegExp.test(gap)) {
|
|
199757
199681
|
gapEndPos = options.locStart(comment);
|
|
199758
199682
|
} else {
|
|
@@ -200089,26 +200013,26 @@ ${frame}`;
|
|
|
200089
200013
|
var comments = require_comments();
|
|
200090
200014
|
function printSubtree(path, print, options, printAstToDoc) {
|
|
200091
200015
|
if (options.printer.embed && options.embeddedLanguageFormatting === "auto") {
|
|
200092
|
-
return options.printer.embed(path, print, (
|
|
200016
|
+
return options.printer.embed(path, print, (text5, partialNextOptions, textToDocOptions) => textToDoc(text5, partialNextOptions, options, printAstToDoc, textToDocOptions), options);
|
|
200093
200017
|
}
|
|
200094
200018
|
}
|
|
200095
|
-
function textToDoc(
|
|
200019
|
+
function textToDoc(text5, partialNextOptions, parentOptions, printAstToDoc, {
|
|
200096
200020
|
stripTrailingHardline: shouldStripTrailingHardline = false
|
|
200097
200021
|
} = {}) {
|
|
200098
200022
|
const nextOptions = normalize(Object.assign(Object.assign(Object.assign({}, parentOptions), partialNextOptions), {}, {
|
|
200099
200023
|
parentParser: parentOptions.parser,
|
|
200100
|
-
originalText:
|
|
200024
|
+
originalText: text5
|
|
200101
200025
|
}), {
|
|
200102
200026
|
passThrough: true
|
|
200103
200027
|
});
|
|
200104
|
-
const result = require_parser().parse(
|
|
200028
|
+
const result = require_parser().parse(text5, nextOptions);
|
|
200105
200029
|
const {
|
|
200106
200030
|
ast
|
|
200107
200031
|
} = result;
|
|
200108
|
-
|
|
200032
|
+
text5 = result.text;
|
|
200109
200033
|
const astComments = ast.comments;
|
|
200110
200034
|
delete ast.comments;
|
|
200111
|
-
comments.attach(astComments, ast,
|
|
200035
|
+
comments.attach(astComments, ast, text5, nextOptions);
|
|
200112
200036
|
nextOptions[Symbol.for("comments")] = astComments || [];
|
|
200113
200037
|
nextOptions[Symbol.for("tokens")] = ast.tokens || [];
|
|
200114
200038
|
const doc2 = printAstToDoc(ast, nextOptions);
|
|
@@ -200347,7 +200271,7 @@ ${frame}`;
|
|
|
200347
200271
|
}
|
|
200348
200272
|
return false;
|
|
200349
200273
|
}
|
|
200350
|
-
function calculateRange(
|
|
200274
|
+
function calculateRange(text5, opts, ast) {
|
|
200351
200275
|
let {
|
|
200352
200276
|
rangeStart: start3,
|
|
200353
200277
|
rangeEnd: end,
|
|
@@ -200355,12 +200279,12 @@ ${frame}`;
|
|
|
200355
200279
|
locEnd
|
|
200356
200280
|
} = opts;
|
|
200357
200281
|
assert.ok(end > start3);
|
|
200358
|
-
const firstNonWhitespaceCharacterIndex =
|
|
200282
|
+
const firstNonWhitespaceCharacterIndex = text5.slice(start3, end).search(/\S/);
|
|
200359
200283
|
const isAllWhitespace = firstNonWhitespaceCharacterIndex === -1;
|
|
200360
200284
|
if (!isAllWhitespace) {
|
|
200361
200285
|
start3 += firstNonWhitespaceCharacterIndex;
|
|
200362
200286
|
for (; end > start3; --end) {
|
|
200363
|
-
if (/\S/.test(
|
|
200287
|
+
if (/\S/.test(text5[end - 1])) {
|
|
200364
200288
|
break;
|
|
200365
200289
|
}
|
|
200366
200290
|
}
|
|
@@ -200427,15 +200351,15 @@ ${frame}`;
|
|
|
200427
200351
|
var rangeUtil = require_range_util();
|
|
200428
200352
|
var BOM = "\uFEFF";
|
|
200429
200353
|
var CURSOR = Symbol("cursor");
|
|
200430
|
-
function attachComments(
|
|
200354
|
+
function attachComments(text5, ast, opts) {
|
|
200431
200355
|
const astComments = ast.comments;
|
|
200432
200356
|
if (astComments) {
|
|
200433
200357
|
delete ast.comments;
|
|
200434
|
-
comments.attach(astComments, ast,
|
|
200358
|
+
comments.attach(astComments, ast, text5, opts);
|
|
200435
200359
|
}
|
|
200436
200360
|
opts[Symbol.for("comments")] = astComments || [];
|
|
200437
200361
|
opts[Symbol.for("tokens")] = ast.tokens || [];
|
|
200438
|
-
opts.originalText =
|
|
200362
|
+
opts.originalText = text5;
|
|
200439
200363
|
return astComments;
|
|
200440
200364
|
}
|
|
200441
200365
|
function coreFormat(originalText, opts, addAlignmentSize = 0) {
|
|
@@ -200448,7 +200372,7 @@ ${frame}`;
|
|
|
200448
200372
|
}
|
|
200449
200373
|
const {
|
|
200450
200374
|
ast,
|
|
200451
|
-
text:
|
|
200375
|
+
text: text5
|
|
200452
200376
|
} = parser.parse(originalText, opts);
|
|
200453
200377
|
if (opts.cursorOffset >= 0) {
|
|
200454
200378
|
const nodeResult = rangeUtil.findNodeAtOffset(ast, opts.cursorOffset, opts);
|
|
@@ -200456,7 +200380,7 @@ ${frame}`;
|
|
|
200456
200380
|
opts.cursorNode = nodeResult.node;
|
|
200457
200381
|
}
|
|
200458
200382
|
}
|
|
200459
|
-
const astComments = attachComments(
|
|
200383
|
+
const astComments = attachComments(text5, ast, opts);
|
|
200460
200384
|
const doc2 = printAstToDoc(ast, opts, addAlignmentSize);
|
|
200461
200385
|
const result = printDocToString(doc2, opts);
|
|
200462
200386
|
comments.ensureAllCommentsPrinted(astComments);
|
|
@@ -200475,13 +200399,13 @@ ${frame}`;
|
|
|
200475
200399
|
let newCursorNodeText;
|
|
200476
200400
|
if (opts.cursorNode && result.cursorNodeText) {
|
|
200477
200401
|
oldCursorNodeStart = opts.locStart(opts.cursorNode);
|
|
200478
|
-
oldCursorNodeText =
|
|
200402
|
+
oldCursorNodeText = text5.slice(oldCursorNodeStart, opts.locEnd(opts.cursorNode));
|
|
200479
200403
|
cursorOffsetRelativeToOldCursorNode = opts.cursorOffset - oldCursorNodeStart;
|
|
200480
200404
|
newCursorNodeStart = result.cursorNodeStart;
|
|
200481
200405
|
newCursorNodeText = result.cursorNodeText;
|
|
200482
200406
|
} else {
|
|
200483
200407
|
oldCursorNodeStart = 0;
|
|
200484
|
-
oldCursorNodeText =
|
|
200408
|
+
oldCursorNodeText = text5;
|
|
200485
200409
|
cursorOffsetRelativeToOldCursorNode = opts.cursorOffset;
|
|
200486
200410
|
newCursorNodeStart = 0;
|
|
200487
200411
|
newCursorNodeText = result.formatted;
|
|
@@ -200522,15 +200446,15 @@ ${frame}`;
|
|
|
200522
200446
|
function formatRange(originalText, opts) {
|
|
200523
200447
|
const {
|
|
200524
200448
|
ast,
|
|
200525
|
-
text:
|
|
200449
|
+
text: text5
|
|
200526
200450
|
} = parser.parse(originalText, opts);
|
|
200527
200451
|
const {
|
|
200528
200452
|
rangeStart,
|
|
200529
200453
|
rangeEnd
|
|
200530
|
-
} = rangeUtil.calculateRange(
|
|
200531
|
-
const rangeString =
|
|
200532
|
-
const rangeStart2 = Math.min(rangeStart,
|
|
200533
|
-
const indentString =
|
|
200454
|
+
} = rangeUtil.calculateRange(text5, opts, ast);
|
|
200455
|
+
const rangeString = text5.slice(rangeStart, rangeEnd);
|
|
200456
|
+
const rangeStart2 = Math.min(rangeStart, text5.lastIndexOf("\n", rangeStart) + 1);
|
|
200457
|
+
const indentString = text5.slice(rangeStart2, rangeStart).match(/^\s*/)[0];
|
|
200534
200458
|
const alignmentSize = getAlignmentSize(indentString, opts.tabWidth);
|
|
200535
200459
|
const rangeResult = coreFormat(rangeString, Object.assign(Object.assign({}, opts), {}, {
|
|
200536
200460
|
rangeStart: 0,
|
|
@@ -200547,7 +200471,7 @@ ${frame}`;
|
|
|
200547
200471
|
} else if (rangeResult.cursorOffset >= 0) {
|
|
200548
200472
|
cursorOffset = rangeResult.cursorOffset + rangeStart;
|
|
200549
200473
|
}
|
|
200550
|
-
let formatted =
|
|
200474
|
+
let formatted = text5.slice(0, rangeStart) + rangeTrimmed + text5.slice(rangeEnd);
|
|
200551
200475
|
if (opts.endOfLine !== "lf") {
|
|
200552
200476
|
const eol2 = convertEndOfLineToChars(opts.endOfLine);
|
|
200553
200477
|
if (cursorOffset >= 0 && eol2 === "\r\n") {
|
|
@@ -200561,55 +200485,55 @@ ${frame}`;
|
|
|
200561
200485
|
comments: rangeResult.comments
|
|
200562
200486
|
};
|
|
200563
200487
|
}
|
|
200564
|
-
function ensureIndexInText(
|
|
200565
|
-
if (typeof index2 !== "number" || Number.isNaN(index2) || index2 < 0 || index2 >
|
|
200488
|
+
function ensureIndexInText(text5, index2, defaultValue) {
|
|
200489
|
+
if (typeof index2 !== "number" || Number.isNaN(index2) || index2 < 0 || index2 > text5.length) {
|
|
200566
200490
|
return defaultValue;
|
|
200567
200491
|
}
|
|
200568
200492
|
return index2;
|
|
200569
200493
|
}
|
|
200570
|
-
function normalizeIndexes(
|
|
200494
|
+
function normalizeIndexes(text5, options) {
|
|
200571
200495
|
let {
|
|
200572
200496
|
cursorOffset,
|
|
200573
200497
|
rangeStart,
|
|
200574
200498
|
rangeEnd
|
|
200575
200499
|
} = options;
|
|
200576
|
-
cursorOffset = ensureIndexInText(
|
|
200577
|
-
rangeStart = ensureIndexInText(
|
|
200578
|
-
rangeEnd = ensureIndexInText(
|
|
200500
|
+
cursorOffset = ensureIndexInText(text5, cursorOffset, -1);
|
|
200501
|
+
rangeStart = ensureIndexInText(text5, rangeStart, 0);
|
|
200502
|
+
rangeEnd = ensureIndexInText(text5, rangeEnd, text5.length);
|
|
200579
200503
|
return Object.assign(Object.assign({}, options), {}, {
|
|
200580
200504
|
cursorOffset,
|
|
200581
200505
|
rangeStart,
|
|
200582
200506
|
rangeEnd
|
|
200583
200507
|
});
|
|
200584
200508
|
}
|
|
200585
|
-
function normalizeInputAndOptions(
|
|
200509
|
+
function normalizeInputAndOptions(text5, options) {
|
|
200586
200510
|
let {
|
|
200587
200511
|
cursorOffset,
|
|
200588
200512
|
rangeStart,
|
|
200589
200513
|
rangeEnd,
|
|
200590
200514
|
endOfLine
|
|
200591
|
-
} = normalizeIndexes(
|
|
200592
|
-
const hasBOM =
|
|
200515
|
+
} = normalizeIndexes(text5, options);
|
|
200516
|
+
const hasBOM = text5.charAt(0) === BOM;
|
|
200593
200517
|
if (hasBOM) {
|
|
200594
|
-
|
|
200518
|
+
text5 = text5.slice(1);
|
|
200595
200519
|
cursorOffset--;
|
|
200596
200520
|
rangeStart--;
|
|
200597
200521
|
rangeEnd--;
|
|
200598
200522
|
}
|
|
200599
200523
|
if (endOfLine === "auto") {
|
|
200600
|
-
endOfLine = guessEndOfLine(
|
|
200524
|
+
endOfLine = guessEndOfLine(text5);
|
|
200601
200525
|
}
|
|
200602
|
-
if (
|
|
200603
|
-
const countCrlfBefore = (index2) => countEndOfLineChars(
|
|
200526
|
+
if (text5.includes("\r")) {
|
|
200527
|
+
const countCrlfBefore = (index2) => countEndOfLineChars(text5.slice(0, Math.max(index2, 0)), "\r\n");
|
|
200604
200528
|
cursorOffset -= countCrlfBefore(cursorOffset);
|
|
200605
200529
|
rangeStart -= countCrlfBefore(rangeStart);
|
|
200606
200530
|
rangeEnd -= countCrlfBefore(rangeEnd);
|
|
200607
|
-
|
|
200531
|
+
text5 = normalizeEndOfLine(text5);
|
|
200608
200532
|
}
|
|
200609
200533
|
return {
|
|
200610
200534
|
hasBOM,
|
|
200611
|
-
text:
|
|
200612
|
-
options: normalizeIndexes(
|
|
200535
|
+
text: text5,
|
|
200536
|
+
options: normalizeIndexes(text5, Object.assign(Object.assign({}, options), {}, {
|
|
200613
200537
|
cursorOffset,
|
|
200614
200538
|
rangeStart,
|
|
200615
200539
|
rangeEnd,
|
|
@@ -200617,17 +200541,17 @@ ${frame}`;
|
|
|
200617
200541
|
}))
|
|
200618
200542
|
};
|
|
200619
200543
|
}
|
|
200620
|
-
function hasPragma(
|
|
200544
|
+
function hasPragma(text5, options) {
|
|
200621
200545
|
const selectedParser = parser.resolveParser(options);
|
|
200622
|
-
return !selectedParser.hasPragma || selectedParser.hasPragma(
|
|
200546
|
+
return !selectedParser.hasPragma || selectedParser.hasPragma(text5);
|
|
200623
200547
|
}
|
|
200624
200548
|
function formatWithCursor2(originalText, originalOptions) {
|
|
200625
200549
|
let {
|
|
200626
200550
|
hasBOM,
|
|
200627
|
-
text:
|
|
200551
|
+
text: text5,
|
|
200628
200552
|
options
|
|
200629
200553
|
} = normalizeInputAndOptions(originalText, normalizeOptions(originalOptions));
|
|
200630
|
-
if (options.rangeStart >= options.rangeEnd &&
|
|
200554
|
+
if (options.rangeStart >= options.rangeEnd && text5 !== "" || options.requirePragma && !hasPragma(text5, options)) {
|
|
200631
200555
|
return {
|
|
200632
200556
|
formatted: originalText,
|
|
200633
200557
|
cursorOffset: originalOptions.cursorOffset,
|
|
@@ -200635,13 +200559,13 @@ ${frame}`;
|
|
|
200635
200559
|
};
|
|
200636
200560
|
}
|
|
200637
200561
|
let result;
|
|
200638
|
-
if (options.rangeStart > 0 || options.rangeEnd <
|
|
200639
|
-
result = formatRange(
|
|
200562
|
+
if (options.rangeStart > 0 || options.rangeEnd < text5.length) {
|
|
200563
|
+
result = formatRange(text5, options);
|
|
200640
200564
|
} else {
|
|
200641
|
-
if (!options.requirePragma && options.insertPragma && options.printer.insertPragma && !hasPragma(
|
|
200642
|
-
|
|
200565
|
+
if (!options.requirePragma && options.insertPragma && options.printer.insertPragma && !hasPragma(text5, options)) {
|
|
200566
|
+
text5 = options.printer.insertPragma(text5);
|
|
200643
200567
|
}
|
|
200644
|
-
result = coreFormat(
|
|
200568
|
+
result = coreFormat(text5, options);
|
|
200645
200569
|
}
|
|
200646
200570
|
if (hasBOM) {
|
|
200647
200571
|
result.formatted = BOM + result.formatted;
|
|
@@ -200655,10 +200579,10 @@ ${frame}`;
|
|
|
200655
200579
|
formatWithCursor: formatWithCursor2,
|
|
200656
200580
|
parse(originalText, originalOptions, massage) {
|
|
200657
200581
|
const {
|
|
200658
|
-
text:
|
|
200582
|
+
text: text5,
|
|
200659
200583
|
options
|
|
200660
200584
|
} = normalizeInputAndOptions(originalText, normalizeOptions(originalOptions));
|
|
200661
|
-
const parsed = parser.parse(
|
|
200585
|
+
const parsed = parser.parse(text5, options);
|
|
200662
200586
|
if (massage) {
|
|
200663
200587
|
parsed.ast = massageAST(parsed.ast, options);
|
|
200664
200588
|
}
|
|
@@ -200678,9 +200602,9 @@ ${frame}`;
|
|
|
200678
200602
|
options = normalizeOptions(options);
|
|
200679
200603
|
const {
|
|
200680
200604
|
ast,
|
|
200681
|
-
text:
|
|
200605
|
+
text: text5
|
|
200682
200606
|
} = parser.parse(originalText, options);
|
|
200683
|
-
attachComments(
|
|
200607
|
+
attachComments(text5, ast, options);
|
|
200684
200608
|
return printAstToDoc(ast, options);
|
|
200685
200609
|
},
|
|
200686
200610
|
printDocToString(doc2, options) {
|
|
@@ -203949,7 +203873,7 @@ ${frame}`;
|
|
|
203949
203873
|
}
|
|
203950
203874
|
var _type = Symbol("type");
|
|
203951
203875
|
var _declared = Symbol("declared");
|
|
203952
|
-
var
|
|
203876
|
+
var hasOwnProperty5 = Object.prototype.hasOwnProperty;
|
|
203953
203877
|
var defineProperty = Object.defineProperty;
|
|
203954
203878
|
var descriptor = {
|
|
203955
203879
|
configurable: true,
|
|
@@ -203958,7 +203882,7 @@ ${frame}`;
|
|
|
203958
203882
|
value: void 0
|
|
203959
203883
|
};
|
|
203960
203884
|
function hasKey(obj, key) {
|
|
203961
|
-
if (
|
|
203885
|
+
if (hasOwnProperty5.call(obj, key))
|
|
203962
203886
|
return true;
|
|
203963
203887
|
if (key === "__proto__")
|
|
203964
203888
|
defineProperty(obj, "__proto__", descriptor);
|
|
@@ -205298,9 +205222,9 @@ ${error.message}`;
|
|
|
205298
205222
|
var column;
|
|
205299
205223
|
var token;
|
|
205300
205224
|
var key;
|
|
205301
|
-
var
|
|
205302
|
-
module22.exports = function parse4(
|
|
205303
|
-
source = String(
|
|
205225
|
+
var root3;
|
|
205226
|
+
module22.exports = function parse4(text5, reviver) {
|
|
205227
|
+
source = String(text5);
|
|
205304
205228
|
parseState = "start";
|
|
205305
205229
|
stack = [];
|
|
205306
205230
|
pos = 0;
|
|
@@ -205308,17 +205232,17 @@ ${error.message}`;
|
|
|
205308
205232
|
column = 0;
|
|
205309
205233
|
token = void 0;
|
|
205310
205234
|
key = void 0;
|
|
205311
|
-
|
|
205235
|
+
root3 = void 0;
|
|
205312
205236
|
do {
|
|
205313
205237
|
token = lex();
|
|
205314
205238
|
parseStates[parseState]();
|
|
205315
205239
|
} while (token.type !== "eof");
|
|
205316
205240
|
if (typeof reviver === "function") {
|
|
205317
205241
|
return internalize({
|
|
205318
|
-
"":
|
|
205242
|
+
"": root3
|
|
205319
205243
|
}, "", reviver);
|
|
205320
205244
|
}
|
|
205321
|
-
return
|
|
205245
|
+
return root3;
|
|
205322
205246
|
};
|
|
205323
205247
|
function internalize(holder, name, reviver) {
|
|
205324
205248
|
const value = holder[name];
|
|
@@ -206020,8 +205944,8 @@ ${error.message}`;
|
|
|
206020
205944
|
value = token.value;
|
|
206021
205945
|
break;
|
|
206022
205946
|
}
|
|
206023
|
-
if (
|
|
206024
|
-
|
|
205947
|
+
if (root3 === void 0) {
|
|
205948
|
+
root3 = value;
|
|
206025
205949
|
} else {
|
|
206026
205950
|
const parent = stack[stack.length - 1];
|
|
206027
205951
|
if (Array.isArray(parent)) {
|
|
@@ -207789,7 +207713,7 @@ ${fromBody}`;
|
|
|
207789
207713
|
});
|
|
207790
207714
|
var require_pseudomap = __commonJS22({
|
|
207791
207715
|
"node_modules/pseudomap/pseudomap.js"(exports2, module22) {
|
|
207792
|
-
var
|
|
207716
|
+
var hasOwnProperty5 = Object.prototype.hasOwnProperty;
|
|
207793
207717
|
module22.exports = PseudoMap;
|
|
207794
207718
|
function PseudoMap(set2) {
|
|
207795
207719
|
if (!(this instanceof PseudoMap))
|
|
@@ -207863,13 +207787,13 @@ ${fromBody}`;
|
|
|
207863
207787
|
this._index = i;
|
|
207864
207788
|
}
|
|
207865
207789
|
function find(data2, k) {
|
|
207866
|
-
for (var i = 0, s = "_" + k, key = s;
|
|
207790
|
+
for (var i = 0, s = "_" + k, key = s; hasOwnProperty5.call(data2, key); key = s + i++) {
|
|
207867
207791
|
if (same(data2[key].key, k))
|
|
207868
207792
|
return data2[key];
|
|
207869
207793
|
}
|
|
207870
207794
|
}
|
|
207871
207795
|
function set(data2, k, v) {
|
|
207872
|
-
for (var i = 0, s = "_" + k, key = s;
|
|
207796
|
+
for (var i = 0, s = "_" + k, key = s; hasOwnProperty5.call(data2, key); key = s + i++) {
|
|
207873
207797
|
if (same(data2[key].key, k)) {
|
|
207874
207798
|
data2[key].value = v;
|
|
207875
207799
|
return;
|
|
@@ -212462,8 +212386,8 @@ ${fromBody}`;
|
|
|
212462
212386
|
this._walkStream = fsWalk.walkStream;
|
|
212463
212387
|
this._stat = fsStat.stat;
|
|
212464
212388
|
}
|
|
212465
|
-
dynamic(
|
|
212466
|
-
return this._walkStream(
|
|
212389
|
+
dynamic(root3, options) {
|
|
212390
|
+
return this._walkStream(root3, options);
|
|
212467
212391
|
}
|
|
212468
212392
|
static(patterns, options) {
|
|
212469
212393
|
const filepaths = patterns.map(this._getFullEntryPath, this);
|
|
@@ -212844,19 +212768,19 @@ ${fromBody}`;
|
|
|
212844
212768
|
this._reader = new stream_1.default(this._settings);
|
|
212845
212769
|
}
|
|
212846
212770
|
read(task) {
|
|
212847
|
-
const
|
|
212771
|
+
const root3 = this._getRootDirectory(task);
|
|
212848
212772
|
const options = this._getReaderOptions(task);
|
|
212849
212773
|
const entries = [];
|
|
212850
212774
|
return new Promise((resolve, reject) => {
|
|
212851
|
-
const stream = this.api(
|
|
212775
|
+
const stream = this.api(root3, task, options);
|
|
212852
212776
|
stream.once("error", reject);
|
|
212853
212777
|
stream.on("data", (entry) => entries.push(options.transform(entry)));
|
|
212854
212778
|
stream.once("end", () => resolve(entries));
|
|
212855
212779
|
});
|
|
212856
212780
|
}
|
|
212857
|
-
api(
|
|
212781
|
+
api(root3, task, options) {
|
|
212858
212782
|
if (task.dynamic) {
|
|
212859
|
-
return this._reader.dynamic(
|
|
212783
|
+
return this._reader.dynamic(root3, options);
|
|
212860
212784
|
}
|
|
212861
212785
|
return this._reader.static(task.patterns, options);
|
|
212862
212786
|
}
|
|
@@ -212879,9 +212803,9 @@ ${fromBody}`;
|
|
|
212879
212803
|
this._reader = new stream_2.default(this._settings);
|
|
212880
212804
|
}
|
|
212881
212805
|
read(task) {
|
|
212882
|
-
const
|
|
212806
|
+
const root3 = this._getRootDirectory(task);
|
|
212883
212807
|
const options = this._getReaderOptions(task);
|
|
212884
|
-
const source = this.api(
|
|
212808
|
+
const source = this.api(root3, task, options);
|
|
212885
212809
|
const destination = new stream_1.Readable({
|
|
212886
212810
|
objectMode: true,
|
|
212887
212811
|
read: () => {
|
|
@@ -212891,9 +212815,9 @@ ${fromBody}`;
|
|
|
212891
212815
|
destination.once("close", () => source.destroy());
|
|
212892
212816
|
return destination;
|
|
212893
212817
|
}
|
|
212894
|
-
api(
|
|
212818
|
+
api(root3, task, options) {
|
|
212895
212819
|
if (task.dynamic) {
|
|
212896
|
-
return this._reader.dynamic(
|
|
212820
|
+
return this._reader.dynamic(root3, options);
|
|
212897
212821
|
}
|
|
212898
212822
|
return this._reader.static(task.patterns, options);
|
|
212899
212823
|
}
|
|
@@ -212916,8 +212840,8 @@ ${fromBody}`;
|
|
|
212916
212840
|
this._walkSync = fsWalk.walkSync;
|
|
212917
212841
|
this._statSync = fsStat.statSync;
|
|
212918
212842
|
}
|
|
212919
|
-
dynamic(
|
|
212920
|
-
return this._walkSync(
|
|
212843
|
+
dynamic(root3, options) {
|
|
212844
|
+
return this._walkSync(root3, options);
|
|
212921
212845
|
}
|
|
212922
212846
|
static(patterns, options) {
|
|
212923
212847
|
const entries = [];
|
|
@@ -212963,14 +212887,14 @@ ${fromBody}`;
|
|
|
212963
212887
|
this._reader = new sync_1.default(this._settings);
|
|
212964
212888
|
}
|
|
212965
212889
|
read(task) {
|
|
212966
|
-
const
|
|
212890
|
+
const root3 = this._getRootDirectory(task);
|
|
212967
212891
|
const options = this._getReaderOptions(task);
|
|
212968
|
-
const entries = this.api(
|
|
212892
|
+
const entries = this.api(root3, task, options);
|
|
212969
212893
|
return entries.map(options.transform);
|
|
212970
212894
|
}
|
|
212971
|
-
api(
|
|
212895
|
+
api(root3, task, options) {
|
|
212972
212896
|
if (task.dynamic) {
|
|
212973
|
-
return this._reader.dynamic(
|
|
212897
|
+
return this._reader.dynamic(root3, options);
|
|
212974
212898
|
}
|
|
212975
212899
|
return this._reader.static(task.patterns, options);
|
|
212976
212900
|
}
|
|
@@ -213709,16 +213633,16 @@ ${fromBody}`;
|
|
|
213709
213633
|
}
|
|
213710
213634
|
return keyword;
|
|
213711
213635
|
}
|
|
213712
|
-
function isFlowAnnotationComment(
|
|
213636
|
+
function isFlowAnnotationComment(text5, typeAnnotation) {
|
|
213713
213637
|
const start3 = locStart(typeAnnotation);
|
|
213714
|
-
const end = skipWhitespace(
|
|
213715
|
-
return end !== false &&
|
|
213638
|
+
const end = skipWhitespace(text5, locEnd(typeAnnotation));
|
|
213639
|
+
return end !== false && text5.slice(start3, start3 + 2) === "/*" && text5.slice(end, end + 2) === "*/";
|
|
213716
213640
|
}
|
|
213717
|
-
function hasLeadingOwnLineComment(
|
|
213641
|
+
function hasLeadingOwnLineComment(text5, node) {
|
|
213718
213642
|
if (isJsxNode(node)) {
|
|
213719
213643
|
return hasNodeIgnoreComment(node);
|
|
213720
213644
|
}
|
|
213721
|
-
return hasComment(node, CommentCheckFlags.Leading, (comment) => hasNewline(
|
|
213645
|
+
return hasComment(node, CommentCheckFlags.Leading, (comment) => hasNewline(text5, locEnd(comment)));
|
|
213722
213646
|
}
|
|
213723
213647
|
function isStringPropSafeToUnquote(node, options) {
|
|
213724
213648
|
return options.parser !== "json" && isStringLiteral(node.key) && rawText(node.key).slice(1, -1) === node.key.value && (isIdentifierName(node.key.value) && !(options.parser === "babel-ts" && node.type === "ClassProperty" || options.parser === "typescript" && node.type === "PropertyDefinition") || isSimpleNumber(node.key.value) && String(Number(node.key.value)) === node.key.value && (options.parser === "babel" || options.parser === "acorn" || options.parser === "espree" || options.parser === "meriyah" || options.parser === "__babel_estree"));
|
|
@@ -213733,8 +213657,8 @@ ${fromBody}`;
|
|
|
213733
213657
|
function templateLiteralHasNewLines(template) {
|
|
213734
213658
|
return template.quasis.some((quasi) => quasi.value.raw.includes("\n"));
|
|
213735
213659
|
}
|
|
213736
|
-
function isTemplateOnItsOwnLine(node,
|
|
213737
|
-
return (node.type === "TemplateLiteral" && templateLiteralHasNewLines(node) || node.type === "TaggedTemplateExpression" && templateLiteralHasNewLines(node.quasi)) && !hasNewline(
|
|
213660
|
+
function isTemplateOnItsOwnLine(node, text5) {
|
|
213661
|
+
return (node.type === "TemplateLiteral" && templateLiteralHasNewLines(node) || node.type === "TaggedTemplateExpression" && templateLiteralHasNewLines(node.quasi)) && !hasNewline(text5, locStart(node), {
|
|
213738
213662
|
backwards: true
|
|
213739
213663
|
});
|
|
213740
213664
|
}
|
|
@@ -214272,13 +214196,13 @@ ${fromBody}`;
|
|
|
214272
214196
|
} = require_template_literal();
|
|
214273
214197
|
function format2(path, print, textToDoc) {
|
|
214274
214198
|
const node = path.getValue();
|
|
214275
|
-
let
|
|
214276
|
-
const indentation = getIndentation(
|
|
214199
|
+
let text5 = node.quasis[0].value.raw.replace(/((?:\\\\)*)\\`/g, (_, backslashes) => "\\".repeat(backslashes.length / 2) + "`");
|
|
214200
|
+
const indentation = getIndentation(text5);
|
|
214277
214201
|
const hasIndent = indentation !== "";
|
|
214278
214202
|
if (hasIndent) {
|
|
214279
|
-
|
|
214203
|
+
text5 = text5.replace(new RegExp(`^${indentation}`, "gm"), "");
|
|
214280
214204
|
}
|
|
214281
|
-
const doc2 = escapeTemplateCharacters(textToDoc(
|
|
214205
|
+
const doc2 = escapeTemplateCharacters(textToDoc(text5, {
|
|
214282
214206
|
parser: "markdown",
|
|
214283
214207
|
__inJsTemplate: true
|
|
214284
214208
|
}, {
|
|
@@ -214318,8 +214242,8 @@ ${fromBody}`;
|
|
|
214318
214242
|
const node = path.getValue();
|
|
214319
214243
|
const rawQuasis = node.quasis.map((q) => q.value.raw);
|
|
214320
214244
|
let placeholderID = 0;
|
|
214321
|
-
const
|
|
214322
|
-
const doc2 = textToDoc(
|
|
214245
|
+
const text5 = rawQuasis.reduce((prevVal, currVal, idx) => idx === 0 ? currVal : prevVal + "@prettier-placeholder-" + placeholderID++ + "-id" + currVal, "");
|
|
214246
|
+
const doc2 = textToDoc(text5, {
|
|
214323
214247
|
parser: "scss"
|
|
214324
214248
|
}, {
|
|
214325
214249
|
stripTrailingHardline: true
|
|
@@ -214386,8 +214310,8 @@ ${fromBody}`;
|
|
|
214386
214310
|
const templateElement = node.quasis[i];
|
|
214387
214311
|
const isFirst = i === 0;
|
|
214388
214312
|
const isLast = i === numQuasis - 1;
|
|
214389
|
-
const
|
|
214390
|
-
const lines =
|
|
214313
|
+
const text5 = templateElement.value.cooked;
|
|
214314
|
+
const lines = text5.split("\n");
|
|
214391
214315
|
const numLines = lines.length;
|
|
214392
214316
|
const expressionDoc = expressionDocs[i];
|
|
214393
214317
|
const startsWithBlankLine = numLines > 2 && lines[0].trim() === "" && lines[1].trim() === "";
|
|
@@ -214400,7 +214324,7 @@ ${fromBody}`;
|
|
|
214400
214324
|
if (commentsAndWhitespaceOnly) {
|
|
214401
214325
|
doc2 = printGraphqlComments(lines);
|
|
214402
214326
|
} else {
|
|
214403
|
-
doc2 = textToDoc(
|
|
214327
|
+
doc2 = textToDoc(text5, {
|
|
214404
214328
|
parser: "graphql"
|
|
214405
214329
|
}, {
|
|
214406
214330
|
stripTrailingHardline: true
|
|
@@ -214470,17 +214394,17 @@ ${fromBody}`;
|
|
|
214470
214394
|
const counter = htmlTemplateLiteralCounter;
|
|
214471
214395
|
htmlTemplateLiteralCounter = htmlTemplateLiteralCounter + 1 >>> 0;
|
|
214472
214396
|
const composePlaceholder = (index2) => `PRETTIER_HTML_PLACEHOLDER_${index2}_${counter}_IN_JS`;
|
|
214473
|
-
const
|
|
214397
|
+
const text5 = node.quasis.map((quasi, index2, quasis) => index2 === quasis.length - 1 ? quasi.value.cooked : quasi.value.cooked + composePlaceholder(index2)).join("");
|
|
214474
214398
|
const expressionDocs = printTemplateExpressions(path, print);
|
|
214475
|
-
if (expressionDocs.length === 0 &&
|
|
214399
|
+
if (expressionDocs.length === 0 && text5.trim().length === 0) {
|
|
214476
214400
|
return "``";
|
|
214477
214401
|
}
|
|
214478
214402
|
const placeholderRegex = new RegExp(composePlaceholder("(\\d+)"), "g");
|
|
214479
214403
|
let topLevelCount = 0;
|
|
214480
|
-
const doc2 = textToDoc(
|
|
214404
|
+
const doc2 = textToDoc(text5, {
|
|
214481
214405
|
parser,
|
|
214482
|
-
__onHtmlRoot(
|
|
214483
|
-
topLevelCount =
|
|
214406
|
+
__onHtmlRoot(root3) {
|
|
214407
|
+
topLevelCount = root3.children.length;
|
|
214484
214408
|
}
|
|
214485
214409
|
}, {
|
|
214486
214410
|
stripTrailingHardline: true
|
|
@@ -214508,8 +214432,8 @@ ${fromBody}`;
|
|
|
214508
214432
|
}
|
|
214509
214433
|
return parts;
|
|
214510
214434
|
});
|
|
214511
|
-
const leadingWhitespace = /^\s/.test(
|
|
214512
|
-
const trailingWhitespace = /\s$/.test(
|
|
214435
|
+
const leadingWhitespace = /^\s/.test(text5) ? " " : "";
|
|
214436
|
+
const trailingWhitespace = /\s$/.test(text5) ? " " : "";
|
|
214513
214437
|
const linebreak = options.htmlWhitespaceSensitivity === "ignore" ? hardline : leadingWhitespace && trailingWhitespace ? line : null;
|
|
214514
214438
|
if (linebreak) {
|
|
214515
214439
|
return group(["`", indent([linebreak, group(contentDoc)]), linebreak, "`"]);
|
|
@@ -214864,15 +214788,15 @@ ${fromBody}`;
|
|
|
214864
214788
|
var require_get_shebang = __commonJS22({
|
|
214865
214789
|
"src/language-js/utils/get-shebang.js"(exports2, module22) {
|
|
214866
214790
|
"use strict";
|
|
214867
|
-
function getShebang(
|
|
214868
|
-
if (!
|
|
214791
|
+
function getShebang(text5) {
|
|
214792
|
+
if (!text5.startsWith("#!")) {
|
|
214869
214793
|
return "";
|
|
214870
214794
|
}
|
|
214871
|
-
const index2 =
|
|
214795
|
+
const index2 = text5.indexOf("\n");
|
|
214872
214796
|
if (index2 === -1) {
|
|
214873
|
-
return
|
|
214797
|
+
return text5;
|
|
214874
214798
|
}
|
|
214875
|
-
return
|
|
214799
|
+
return text5.slice(0, index2);
|
|
214876
214800
|
}
|
|
214877
214801
|
module22.exports = getShebang;
|
|
214878
214802
|
}
|
|
@@ -214890,35 +214814,35 @@ ${fromBody}`;
|
|
|
214890
214814
|
normalizeEndOfLine
|
|
214891
214815
|
} = require_end_of_line();
|
|
214892
214816
|
var getShebang = require_get_shebang();
|
|
214893
|
-
function parseDocBlock(
|
|
214894
|
-
const shebang = getShebang(
|
|
214817
|
+
function parseDocBlock(text5) {
|
|
214818
|
+
const shebang = getShebang(text5);
|
|
214895
214819
|
if (shebang) {
|
|
214896
|
-
|
|
214820
|
+
text5 = text5.slice(shebang.length + 1);
|
|
214897
214821
|
}
|
|
214898
|
-
const docBlock = extract(
|
|
214822
|
+
const docBlock = extract(text5);
|
|
214899
214823
|
const {
|
|
214900
214824
|
pragmas,
|
|
214901
214825
|
comments
|
|
214902
214826
|
} = parseWithComments(docBlock);
|
|
214903
214827
|
return {
|
|
214904
214828
|
shebang,
|
|
214905
|
-
text:
|
|
214829
|
+
text: text5,
|
|
214906
214830
|
pragmas,
|
|
214907
214831
|
comments
|
|
214908
214832
|
};
|
|
214909
214833
|
}
|
|
214910
|
-
function hasPragma(
|
|
214911
|
-
const pragmas = Object.keys(parseDocBlock(
|
|
214834
|
+
function hasPragma(text5) {
|
|
214835
|
+
const pragmas = Object.keys(parseDocBlock(text5).pragmas);
|
|
214912
214836
|
return pragmas.includes("prettier") || pragmas.includes("format");
|
|
214913
214837
|
}
|
|
214914
214838
|
function insertPragma(originalText) {
|
|
214915
214839
|
const {
|
|
214916
214840
|
shebang,
|
|
214917
|
-
text:
|
|
214841
|
+
text: text5,
|
|
214918
214842
|
pragmas,
|
|
214919
214843
|
comments
|
|
214920
214844
|
} = parseDocBlock(originalText);
|
|
214921
|
-
const strippedText = strip(
|
|
214845
|
+
const strippedText = strip(text5);
|
|
214922
214846
|
const docBlock = print({
|
|
214923
214847
|
pragmas: Object.assign({
|
|
214924
214848
|
format: ""
|
|
@@ -215012,12 +214936,12 @@ ${fromBody}`;
|
|
|
215012
214936
|
precedingNode,
|
|
215013
214937
|
enclosingNode,
|
|
215014
214938
|
followingNode,
|
|
215015
|
-
text:
|
|
214939
|
+
text: text5
|
|
215016
214940
|
}) {
|
|
215017
214941
|
if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) !== "IfStatement" || !followingNode) {
|
|
215018
214942
|
return false;
|
|
215019
214943
|
}
|
|
215020
|
-
const nextCharacter = getNextNonSpaceNonCommentCharacter(
|
|
214944
|
+
const nextCharacter = getNextNonSpaceNonCommentCharacter(text5, comment, locEnd);
|
|
215021
214945
|
if (nextCharacter === ")") {
|
|
215022
214946
|
addTrailingComment(precedingNode, comment);
|
|
215023
214947
|
return true;
|
|
@@ -215055,12 +214979,12 @@ ${fromBody}`;
|
|
|
215055
214979
|
precedingNode,
|
|
215056
214980
|
enclosingNode,
|
|
215057
214981
|
followingNode,
|
|
215058
|
-
text:
|
|
214982
|
+
text: text5
|
|
215059
214983
|
}) {
|
|
215060
214984
|
if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) !== "WhileStatement" || !followingNode) {
|
|
215061
214985
|
return false;
|
|
215062
214986
|
}
|
|
215063
|
-
const nextCharacter = getNextNonSpaceNonCommentCharacter(
|
|
214987
|
+
const nextCharacter = getNextNonSpaceNonCommentCharacter(text5, comment, locEnd);
|
|
215064
214988
|
if (nextCharacter === ")") {
|
|
215065
214989
|
addTrailingComment(precedingNode, comment);
|
|
215066
214990
|
return true;
|
|
@@ -215118,9 +215042,9 @@ ${fromBody}`;
|
|
|
215118
215042
|
precedingNode,
|
|
215119
215043
|
enclosingNode,
|
|
215120
215044
|
followingNode,
|
|
215121
|
-
text:
|
|
215045
|
+
text: text5
|
|
215122
215046
|
}) {
|
|
215123
|
-
const isSameLineAsPrecedingNode = precedingNode && !hasNewlineInRange(
|
|
215047
|
+
const isSameLineAsPrecedingNode = precedingNode && !hasNewlineInRange(text5, locEnd(precedingNode), locStart(comment));
|
|
215124
215048
|
if ((!precedingNode || !isSameLineAsPrecedingNode) && ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ConditionalExpression" || (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "TSConditionalType") && followingNode) {
|
|
215125
215049
|
addLeadingComment(followingNode, comment);
|
|
215126
215050
|
return true;
|
|
@@ -215178,9 +215102,9 @@ ${fromBody}`;
|
|
|
215178
215102
|
comment,
|
|
215179
215103
|
precedingNode,
|
|
215180
215104
|
enclosingNode,
|
|
215181
|
-
text:
|
|
215105
|
+
text: text5
|
|
215182
215106
|
}) {
|
|
215183
|
-
if (enclosingNode && precedingNode && getNextNonSpaceNonCommentCharacter(
|
|
215107
|
+
if (enclosingNode && precedingNode && getNextNonSpaceNonCommentCharacter(text5, comment, locEnd) === "(" && (enclosingNode.type === "Property" || enclosingNode.type === "TSDeclareMethod" || enclosingNode.type === "TSAbstractMethodDefinition") && precedingNode.type === "Identifier" && enclosingNode.key === precedingNode && getNextNonSpaceNonCommentCharacter(text5, precedingNode, locEnd) !== ":") {
|
|
215184
215108
|
addTrailingComment(precedingNode, comment);
|
|
215185
215109
|
return true;
|
|
215186
215110
|
}
|
|
@@ -215195,9 +215119,9 @@ ${fromBody}`;
|
|
|
215195
215119
|
comment,
|
|
215196
215120
|
precedingNode,
|
|
215197
215121
|
enclosingNode,
|
|
215198
|
-
text:
|
|
215122
|
+
text: text5
|
|
215199
215123
|
}) {
|
|
215200
|
-
if (getNextNonSpaceNonCommentCharacter(
|
|
215124
|
+
if (getNextNonSpaceNonCommentCharacter(text5, comment, locEnd) !== "(") {
|
|
215201
215125
|
return false;
|
|
215202
215126
|
}
|
|
215203
215127
|
if (precedingNode && functionLikeNodeTypes.has(enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type)) {
|
|
@@ -215209,13 +215133,13 @@ ${fromBody}`;
|
|
|
215209
215133
|
function handleCommentAfterArrowParams({
|
|
215210
215134
|
comment,
|
|
215211
215135
|
enclosingNode,
|
|
215212
|
-
text:
|
|
215136
|
+
text: text5
|
|
215213
215137
|
}) {
|
|
215214
215138
|
if (!((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ArrowFunctionExpression")) {
|
|
215215
215139
|
return false;
|
|
215216
215140
|
}
|
|
215217
|
-
const index2 = getNextNonSpaceNonCommentCharacterIndex(
|
|
215218
|
-
if (index2 !== false &&
|
|
215141
|
+
const index2 = getNextNonSpaceNonCommentCharacterIndex(text5, comment, locEnd);
|
|
215142
|
+
if (index2 !== false && text5.slice(index2, index2 + 2) === "=>") {
|
|
215219
215143
|
addDanglingComment(enclosingNode, comment);
|
|
215220
215144
|
return true;
|
|
215221
215145
|
}
|
|
@@ -215224,9 +215148,9 @@ ${fromBody}`;
|
|
|
215224
215148
|
function handleCommentInEmptyParens({
|
|
215225
215149
|
comment,
|
|
215226
215150
|
enclosingNode,
|
|
215227
|
-
text:
|
|
215151
|
+
text: text5
|
|
215228
215152
|
}) {
|
|
215229
|
-
if (getNextNonSpaceNonCommentCharacter(
|
|
215153
|
+
if (getNextNonSpaceNonCommentCharacter(text5, comment, locEnd) !== ")") {
|
|
215230
215154
|
return false;
|
|
215231
215155
|
}
|
|
215232
215156
|
if (enclosingNode && (isRealFunctionLikeNode(enclosingNode) && getFunctionParameters(enclosingNode).length === 0 || isCallLikeExpression(enclosingNode) && getCallArguments(enclosingNode).length === 0)) {
|
|
@@ -215244,13 +215168,13 @@ ${fromBody}`;
|
|
|
215244
215168
|
precedingNode,
|
|
215245
215169
|
enclosingNode,
|
|
215246
215170
|
followingNode,
|
|
215247
|
-
text:
|
|
215171
|
+
text: text5
|
|
215248
215172
|
}) {
|
|
215249
215173
|
if ((precedingNode === null || precedingNode === void 0 ? void 0 : precedingNode.type) === "FunctionTypeParam" && (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "FunctionTypeAnnotation" && (followingNode === null || followingNode === void 0 ? void 0 : followingNode.type) !== "FunctionTypeParam") {
|
|
215250
215174
|
addTrailingComment(precedingNode, comment);
|
|
215251
215175
|
return true;
|
|
215252
215176
|
}
|
|
215253
|
-
if (((precedingNode === null || precedingNode === void 0 ? void 0 : precedingNode.type) === "Identifier" || (precedingNode === null || precedingNode === void 0 ? void 0 : precedingNode.type) === "AssignmentPattern") && enclosingNode && isRealFunctionLikeNode(enclosingNode) && getNextNonSpaceNonCommentCharacter(
|
|
215177
|
+
if (((precedingNode === null || precedingNode === void 0 ? void 0 : precedingNode.type) === "Identifier" || (precedingNode === null || precedingNode === void 0 ? void 0 : precedingNode.type) === "AssignmentPattern") && enclosingNode && isRealFunctionLikeNode(enclosingNode) && getNextNonSpaceNonCommentCharacter(text5, comment, locEnd) === ")") {
|
|
215254
215178
|
addTrailingComment(precedingNode, comment);
|
|
215255
215179
|
return true;
|
|
215256
215180
|
}
|
|
@@ -215258,10 +215182,10 @@ ${fromBody}`;
|
|
|
215258
215182
|
const functionParamRightParenIndex = (() => {
|
|
215259
215183
|
const parameters = getFunctionParameters(enclosingNode);
|
|
215260
215184
|
if (parameters.length > 0) {
|
|
215261
|
-
return getNextNonSpaceNonCommentCharacterIndexWithStartIndex(
|
|
215185
|
+
return getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text5, locEnd(getLast(parameters)));
|
|
215262
215186
|
}
|
|
215263
|
-
const functionParamLeftParenIndex = getNextNonSpaceNonCommentCharacterIndexWithStartIndex(
|
|
215264
|
-
return functionParamLeftParenIndex !== false && getNextNonSpaceNonCommentCharacterIndexWithStartIndex(
|
|
215187
|
+
const functionParamLeftParenIndex = getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text5, locEnd(enclosingNode.id));
|
|
215188
|
+
return functionParamLeftParenIndex !== false && getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text5, functionParamLeftParenIndex + 1);
|
|
215265
215189
|
})();
|
|
215266
215190
|
if (locStart(comment) > functionParamRightParenIndex) {
|
|
215267
215191
|
addBlockStatementFirstComment(followingNode, comment);
|
|
@@ -215377,7 +215301,7 @@ ${fromBody}`;
|
|
|
215377
215301
|
comment,
|
|
215378
215302
|
precedingNode,
|
|
215379
215303
|
enclosingNode,
|
|
215380
|
-
text:
|
|
215304
|
+
text: text5
|
|
215381
215305
|
}) {
|
|
215382
215306
|
if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ImportSpecifier" || (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ExportSpecifier") {
|
|
215383
215307
|
addLeadingComment(enclosingNode, comment);
|
|
@@ -215385,7 +215309,7 @@ ${fromBody}`;
|
|
|
215385
215309
|
}
|
|
215386
215310
|
const isImportDeclaration = (precedingNode === null || precedingNode === void 0 ? void 0 : precedingNode.type) === "ImportSpecifier" && (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ImportDeclaration";
|
|
215387
215311
|
const isExportDeclaration = (precedingNode === null || precedingNode === void 0 ? void 0 : precedingNode.type) === "ExportSpecifier" && (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ExportNamedDeclaration";
|
|
215388
|
-
if ((isImportDeclaration || isExportDeclaration) && hasNewline(
|
|
215312
|
+
if ((isImportDeclaration || isExportDeclaration) && hasNewline(text5, locEnd(comment))) {
|
|
215389
215313
|
addTrailingComment(precedingNode, comment);
|
|
215390
215314
|
return true;
|
|
215391
215315
|
}
|
|
@@ -215418,9 +215342,9 @@ ${fromBody}`;
|
|
|
215418
215342
|
comment,
|
|
215419
215343
|
enclosingNode,
|
|
215420
215344
|
followingNode,
|
|
215421
|
-
text:
|
|
215345
|
+
text: text5
|
|
215422
215346
|
}) {
|
|
215423
|
-
if (!followingNode && ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "TSMethodSignature" || (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "TSDeclareFunction" || (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "TSAbstractMethodDefinition") && getNextNonSpaceNonCommentCharacter(
|
|
215347
|
+
if (!followingNode && ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "TSMethodSignature" || (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "TSDeclareFunction" || (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "TSAbstractMethodDefinition") && getNextNonSpaceNonCommentCharacter(text5, comment, locEnd) === ";") {
|
|
215424
215348
|
addTrailingComment(enclosingNode, comment);
|
|
215425
215349
|
return true;
|
|
215426
215350
|
}
|
|
@@ -216455,9 +216379,9 @@ ${fromBody}`;
|
|
|
216455
216379
|
path.each((childPath, i, children) => {
|
|
216456
216380
|
const child = childPath.getValue();
|
|
216457
216381
|
if (isLiteral(child)) {
|
|
216458
|
-
const
|
|
216382
|
+
const text5 = rawText(child);
|
|
216459
216383
|
if (isMeaningfulJsxText(child)) {
|
|
216460
|
-
const words =
|
|
216384
|
+
const words = text5.split(matchJsxWhitespaceRegex);
|
|
216461
216385
|
if (words[0] === "") {
|
|
216462
216386
|
parts.push("");
|
|
216463
216387
|
words.shift();
|
|
@@ -216495,8 +216419,8 @@ ${fromBody}`;
|
|
|
216495
216419
|
const next = children[i + 1];
|
|
216496
216420
|
parts.push(separatorNoWhitespace(isFacebookTranslationTag, getLast(parts), child, next));
|
|
216497
216421
|
}
|
|
216498
|
-
} else if (/\n/.test(
|
|
216499
|
-
if (
|
|
216422
|
+
} else if (/\n/.test(text5)) {
|
|
216423
|
+
if (text5.match(/\n/g).length > 1) {
|
|
216500
216424
|
parts.push("", hardline);
|
|
216501
216425
|
}
|
|
216502
216426
|
} else {
|
|
@@ -216694,7 +216618,7 @@ ${fromBody}`;
|
|
|
216694
216618
|
var jsxWhitespaceChars = " \n\r ";
|
|
216695
216619
|
var matchJsxWhitespaceRegex = new RegExp("([" + jsxWhitespaceChars + "]+)");
|
|
216696
216620
|
var containsNonJsxWhitespaceRegex = new RegExp("[^" + jsxWhitespaceChars + "]");
|
|
216697
|
-
var trimJsxWhitespace = (
|
|
216621
|
+
var trimJsxWhitespace = (text5) => text5.replace(new RegExp("(?:^" + matchJsxWhitespaceRegex.source + "|" + matchJsxWhitespaceRegex.source + "$)"), "");
|
|
216698
216622
|
function isEmptyJsxElement(node) {
|
|
216699
216623
|
if (node.children.length === 0) {
|
|
216700
216624
|
return true;
|
|
@@ -221636,11 +221560,11 @@ ${fromBody}`;
|
|
|
221636
221560
|
"src/utils/front-matter/parse.js"(exports2, module22) {
|
|
221637
221561
|
"use strict";
|
|
221638
221562
|
var frontMatterRegex = new RegExp("^(?<startDelimiter>-{3}|\\+{3})(?<language>[^\\n]*)\\n(?:|(?<value>.*?)\\n)(?<endDelimiter>\\k<startDelimiter>|\\.{3})[^\\S\\n]*(?:\\n|$)", "s");
|
|
221639
|
-
function parse4(
|
|
221640
|
-
const match =
|
|
221563
|
+
function parse4(text5) {
|
|
221564
|
+
const match = text5.match(frontMatterRegex);
|
|
221641
221565
|
if (!match) {
|
|
221642
221566
|
return {
|
|
221643
|
-
content:
|
|
221567
|
+
content: text5
|
|
221644
221568
|
};
|
|
221645
221569
|
}
|
|
221646
221570
|
const {
|
|
@@ -221655,7 +221579,7 @@ ${fromBody}`;
|
|
|
221655
221579
|
}
|
|
221656
221580
|
if (lang !== "yaml" && startDelimiter !== endDelimiter) {
|
|
221657
221581
|
return {
|
|
221658
|
-
content:
|
|
221582
|
+
content: text5
|
|
221659
221583
|
};
|
|
221660
221584
|
}
|
|
221661
221585
|
const [raw] = match;
|
|
@@ -221669,7 +221593,7 @@ ${fromBody}`;
|
|
|
221669
221593
|
};
|
|
221670
221594
|
return {
|
|
221671
221595
|
frontMatter,
|
|
221672
|
-
content: raw.replace(/[^\n]/g, " ") +
|
|
221596
|
+
content: raw.replace(/[^\n]/g, " ") + text5.slice(raw.length)
|
|
221673
221597
|
};
|
|
221674
221598
|
}
|
|
221675
221599
|
module22.exports = parse4;
|
|
@@ -221680,14 +221604,14 @@ ${fromBody}`;
|
|
|
221680
221604
|
"use strict";
|
|
221681
221605
|
var jsPragma = require_pragma();
|
|
221682
221606
|
var parseFrontMatter = require_parse4();
|
|
221683
|
-
function hasPragma(
|
|
221684
|
-
return jsPragma.hasPragma(parseFrontMatter(
|
|
221607
|
+
function hasPragma(text5) {
|
|
221608
|
+
return jsPragma.hasPragma(parseFrontMatter(text5).content);
|
|
221685
221609
|
}
|
|
221686
|
-
function insertPragma(
|
|
221610
|
+
function insertPragma(text5) {
|
|
221687
221611
|
const {
|
|
221688
221612
|
frontMatter,
|
|
221689
221613
|
content: content3
|
|
221690
|
-
} = parseFrontMatter(
|
|
221614
|
+
} = parseFrontMatter(text5);
|
|
221691
221615
|
return (frontMatter ? frontMatter.raw + "\n\n" : "") + jsPragma.insertPragma(content3);
|
|
221692
221616
|
}
|
|
221693
221617
|
module22.exports = {
|
|
@@ -221900,8 +221824,8 @@ ${fromBody}`;
|
|
|
221900
221824
|
}
|
|
221901
221825
|
return colorAdjusterFunctions.has(node.value.toLowerCase());
|
|
221902
221826
|
}
|
|
221903
|
-
function lastLineHasInlineComment(
|
|
221904
|
-
return /\/\//.test(
|
|
221827
|
+
function lastLineHasInlineComment(text5) {
|
|
221828
|
+
return /\/\//.test(text5.split(/[\n\r]/).pop());
|
|
221905
221829
|
}
|
|
221906
221830
|
function isAtWordPlaceholderNode(node) {
|
|
221907
221831
|
return (node === null || node === void 0 ? void 0 : node.type) === "value-atword" && node.value.startsWith("prettier-placeholder-");
|
|
@@ -221979,10 +221903,10 @@ ${fromBody}`;
|
|
|
221979
221903
|
var require_line_column_to_index = __commonJS22({
|
|
221980
221904
|
"src/utils/line-column-to-index.js"(exports2, module22) {
|
|
221981
221905
|
"use strict";
|
|
221982
|
-
module22.exports = function(lineColumn,
|
|
221906
|
+
module22.exports = function(lineColumn, text5) {
|
|
221983
221907
|
let index2 = 0;
|
|
221984
221908
|
for (let i = 0; i < lineColumn.line - 1; ++i) {
|
|
221985
|
-
index2 =
|
|
221909
|
+
index2 = text5.indexOf("\n", index2) + 1;
|
|
221986
221910
|
}
|
|
221987
221911
|
return index2 + lineColumn.column;
|
|
221988
221912
|
};
|
|
@@ -221996,29 +221920,29 @@ ${fromBody}`;
|
|
|
221996
221920
|
} = require_skip();
|
|
221997
221921
|
var getLast = require_get_last();
|
|
221998
221922
|
var lineColumnToIndex = require_line_column_to_index();
|
|
221999
|
-
function calculateLocStart(node,
|
|
221923
|
+
function calculateLocStart(node, text5) {
|
|
222000
221924
|
if (typeof node.sourceIndex === "number") {
|
|
222001
221925
|
return node.sourceIndex;
|
|
222002
221926
|
}
|
|
222003
|
-
return node.source ? lineColumnToIndex(node.source.start,
|
|
221927
|
+
return node.source ? lineColumnToIndex(node.source.start, text5) - 1 : null;
|
|
222004
221928
|
}
|
|
222005
|
-
function calculateLocEnd(node,
|
|
221929
|
+
function calculateLocEnd(node, text5) {
|
|
222006
221930
|
if (node.type === "css-comment" && node.inline) {
|
|
222007
|
-
return skipEverythingButNewLine(
|
|
221931
|
+
return skipEverythingButNewLine(text5, node.source.startOffset);
|
|
222008
221932
|
}
|
|
222009
221933
|
const endNode = node.nodes && getLast(node.nodes);
|
|
222010
221934
|
if (endNode && node.source && !node.source.end) {
|
|
222011
221935
|
node = endNode;
|
|
222012
221936
|
}
|
|
222013
221937
|
if (node.source && node.source.end) {
|
|
222014
|
-
return lineColumnToIndex(node.source.end,
|
|
221938
|
+
return lineColumnToIndex(node.source.end, text5);
|
|
222015
221939
|
}
|
|
222016
221940
|
return null;
|
|
222017
221941
|
}
|
|
222018
|
-
function calculateLoc(node,
|
|
221942
|
+
function calculateLoc(node, text5) {
|
|
222019
221943
|
if (node.source) {
|
|
222020
|
-
node.source.startOffset = calculateLocStart(node,
|
|
222021
|
-
node.source.endOffset = calculateLocEnd(node,
|
|
221944
|
+
node.source.startOffset = calculateLocStart(node, text5);
|
|
221945
|
+
node.source.endOffset = calculateLocEnd(node, text5);
|
|
222022
221946
|
}
|
|
222023
221947
|
for (const key in node) {
|
|
222024
221948
|
const child = node[key];
|
|
@@ -222028,21 +221952,21 @@ ${fromBody}`;
|
|
|
222028
221952
|
if (child.type === "value-root" || child.type === "value-unknown") {
|
|
222029
221953
|
calculateValueNodeLoc(child, getValueRootOffset(node), child.text || child.value);
|
|
222030
221954
|
} else {
|
|
222031
|
-
calculateLoc(child,
|
|
221955
|
+
calculateLoc(child, text5);
|
|
222032
221956
|
}
|
|
222033
221957
|
}
|
|
222034
221958
|
}
|
|
222035
|
-
function calculateValueNodeLoc(node, rootOffset,
|
|
221959
|
+
function calculateValueNodeLoc(node, rootOffset, text5) {
|
|
222036
221960
|
if (node.source) {
|
|
222037
|
-
node.source.startOffset = calculateLocStart(node,
|
|
222038
|
-
node.source.endOffset = calculateLocEnd(node,
|
|
221961
|
+
node.source.startOffset = calculateLocStart(node, text5) + rootOffset;
|
|
221962
|
+
node.source.endOffset = calculateLocEnd(node, text5) + rootOffset;
|
|
222039
221963
|
}
|
|
222040
221964
|
for (const key in node) {
|
|
222041
221965
|
const child = node[key];
|
|
222042
221966
|
if (key === "source" || !child || typeof child !== "object") {
|
|
222043
221967
|
continue;
|
|
222044
221968
|
}
|
|
222045
|
-
calculateValueNodeLoc(child, rootOffset,
|
|
221969
|
+
calculateValueNodeLoc(child, rootOffset, text5);
|
|
222046
221970
|
}
|
|
222047
221971
|
}
|
|
222048
221972
|
function getValueRootOffset(node) {
|
|
@@ -222058,14 +221982,14 @@ ${fromBody}`;
|
|
|
222058
221982
|
}
|
|
222059
221983
|
return result;
|
|
222060
221984
|
}
|
|
222061
|
-
function replaceQuotesInInlineComments(
|
|
221985
|
+
function replaceQuotesInInlineComments(text5) {
|
|
222062
221986
|
let state = "initial";
|
|
222063
221987
|
let stateToReturnFromQuotes = "initial";
|
|
222064
221988
|
let inlineCommentStartIndex;
|
|
222065
221989
|
let inlineCommentContainsQuotes = false;
|
|
222066
221990
|
const inlineCommentsToReplace = [];
|
|
222067
|
-
for (let i = 0; i <
|
|
222068
|
-
const c =
|
|
221991
|
+
for (let i = 0; i < text5.length; i++) {
|
|
221992
|
+
const c = text5[i];
|
|
222069
221993
|
switch (state) {
|
|
222070
221994
|
case "initial":
|
|
222071
221995
|
if (c === "'") {
|
|
@@ -222076,37 +222000,37 @@ ${fromBody}`;
|
|
|
222076
222000
|
state = "double-quotes";
|
|
222077
222001
|
continue;
|
|
222078
222002
|
}
|
|
222079
|
-
if ((c === "u" || c === "U") &&
|
|
222003
|
+
if ((c === "u" || c === "U") && text5.slice(i, i + 4).toLowerCase() === "url(") {
|
|
222080
222004
|
state = "url";
|
|
222081
222005
|
i += 3;
|
|
222082
222006
|
continue;
|
|
222083
222007
|
}
|
|
222084
|
-
if (c === "*" &&
|
|
222008
|
+
if (c === "*" && text5[i - 1] === "/") {
|
|
222085
222009
|
state = "comment-block";
|
|
222086
222010
|
continue;
|
|
222087
222011
|
}
|
|
222088
|
-
if (c === "/" &&
|
|
222012
|
+
if (c === "/" && text5[i - 1] === "/") {
|
|
222089
222013
|
state = "comment-inline";
|
|
222090
222014
|
inlineCommentStartIndex = i - 1;
|
|
222091
222015
|
continue;
|
|
222092
222016
|
}
|
|
222093
222017
|
continue;
|
|
222094
222018
|
case "single-quotes":
|
|
222095
|
-
if (c === "'" &&
|
|
222019
|
+
if (c === "'" && text5[i - 1] !== "\\") {
|
|
222096
222020
|
state = stateToReturnFromQuotes;
|
|
222097
222021
|
stateToReturnFromQuotes = "initial";
|
|
222098
222022
|
}
|
|
222099
222023
|
if (c === "\n" || c === "\r") {
|
|
222100
|
-
return
|
|
222024
|
+
return text5;
|
|
222101
222025
|
}
|
|
222102
222026
|
continue;
|
|
222103
222027
|
case "double-quotes":
|
|
222104
|
-
if (c === '"' &&
|
|
222028
|
+
if (c === '"' && text5[i - 1] !== "\\") {
|
|
222105
222029
|
state = stateToReturnFromQuotes;
|
|
222106
222030
|
stateToReturnFromQuotes = "initial";
|
|
222107
222031
|
}
|
|
222108
222032
|
if (c === "\n" || c === "\r") {
|
|
222109
|
-
return
|
|
222033
|
+
return text5;
|
|
222110
222034
|
}
|
|
222111
222035
|
continue;
|
|
222112
222036
|
case "url":
|
|
@@ -222114,7 +222038,7 @@ ${fromBody}`;
|
|
|
222114
222038
|
state = "initial";
|
|
222115
222039
|
}
|
|
222116
222040
|
if (c === "\n" || c === "\r") {
|
|
222117
|
-
return
|
|
222041
|
+
return text5;
|
|
222118
222042
|
}
|
|
222119
222043
|
if (c === "'") {
|
|
222120
222044
|
state = "single-quotes";
|
|
@@ -222128,7 +222052,7 @@ ${fromBody}`;
|
|
|
222128
222052
|
}
|
|
222129
222053
|
continue;
|
|
222130
222054
|
case "comment-block":
|
|
222131
|
-
if (c === "/" &&
|
|
222055
|
+
if (c === "/" && text5[i - 1] === "*") {
|
|
222132
222056
|
state = "initial";
|
|
222133
222057
|
}
|
|
222134
222058
|
continue;
|
|
@@ -222147,9 +222071,9 @@ ${fromBody}`;
|
|
|
222147
222071
|
}
|
|
222148
222072
|
}
|
|
222149
222073
|
for (const [start3, end] of inlineCommentsToReplace) {
|
|
222150
|
-
|
|
222074
|
+
text5 = text5.slice(0, start3) + text5.slice(start3, end).replace(/["'*]/g, " ") + text5.slice(end);
|
|
222151
222075
|
}
|
|
222152
|
-
return
|
|
222076
|
+
return text5;
|
|
222153
222077
|
}
|
|
222154
222078
|
function locStart(node) {
|
|
222155
222079
|
return node.source.startOffset;
|
|
@@ -222177,10 +222101,10 @@ ${fromBody}`;
|
|
|
222177
222101
|
var require_is_scss = __commonJS22({
|
|
222178
222102
|
"src/language-css/utils/is-scss.js"(exports2, module22) {
|
|
222179
222103
|
"use strict";
|
|
222180
|
-
function isSCSS(parser,
|
|
222104
|
+
function isSCSS(parser, text5) {
|
|
222181
222105
|
const hasExplicitParserChoice = parser === "less" || parser === "scss";
|
|
222182
222106
|
const IS_POSSIBLY_SCSS = /(?:\w\s*:\s*[^:}]+|#){|@import[^\n]+(?:url|,)/;
|
|
222183
|
-
return hasExplicitParserChoice ? parser === "scss" : IS_POSSIBLY_SCSS.test(
|
|
222107
|
+
return hasExplicitParserChoice ? parser === "scss" : IS_POSSIBLY_SCSS.test(text5);
|
|
222184
222108
|
}
|
|
222185
222109
|
module22.exports = isSCSS;
|
|
222186
222110
|
}
|
|
@@ -222367,8 +222291,8 @@ ${fromBody}`;
|
|
|
222367
222291
|
}
|
|
222368
222292
|
case "css-comment": {
|
|
222369
222293
|
const isInlineComment = node.inline || node.raws.inline;
|
|
222370
|
-
const
|
|
222371
|
-
return isInlineComment ?
|
|
222294
|
+
const text5 = options.originalText.slice(locStart(node), locEnd(node));
|
|
222295
|
+
return isInlineComment ? text5.trimEnd() : text5;
|
|
222372
222296
|
}
|
|
222373
222297
|
case "css-rule": {
|
|
222374
222298
|
return [print("selector"), node.important ? " !important" : "", node.nodes ? [node.selector && node.selector.type === "selector-unknown" && lastLineHasInlineComment(node.selector.value) ? line : " ", "{", node.nodes.length > 0 ? indent([hardline, printNodeSequence(path, options, print)]) : "", hardline, "}", isDetachedRulesetDeclarationNode(node) ? ";" : ""] : ";"];
|
|
@@ -223153,27 +223077,27 @@ ${fromBody}`;
|
|
|
223153
223077
|
return [node.key, "=", print2("value")];
|
|
223154
223078
|
}
|
|
223155
223079
|
case "TextNode": {
|
|
223156
|
-
let
|
|
223080
|
+
let text5 = node.chars.replace(/{{/g, "\\{{");
|
|
223157
223081
|
const attrName = getCurrentAttributeName(path);
|
|
223158
223082
|
if (attrName) {
|
|
223159
223083
|
if (attrName === "class") {
|
|
223160
|
-
const formattedClasses =
|
|
223084
|
+
const formattedClasses = text5.trim().split(/\s+/).join(" ");
|
|
223161
223085
|
let leadingSpace2 = false;
|
|
223162
223086
|
let trailingSpace2 = false;
|
|
223163
223087
|
if (isParentOfSomeType(path, ["ConcatStatement"])) {
|
|
223164
|
-
if (isPreviousNodeOfSomeType(path, ["MustacheStatement"]) && /^\s/.test(
|
|
223088
|
+
if (isPreviousNodeOfSomeType(path, ["MustacheStatement"]) && /^\s/.test(text5)) {
|
|
223165
223089
|
leadingSpace2 = true;
|
|
223166
223090
|
}
|
|
223167
|
-
if (isNextNodeOfSomeType(path, ["MustacheStatement"]) && /\s$/.test(
|
|
223091
|
+
if (isNextNodeOfSomeType(path, ["MustacheStatement"]) && /\s$/.test(text5) && formattedClasses !== "") {
|
|
223168
223092
|
trailingSpace2 = true;
|
|
223169
223093
|
}
|
|
223170
223094
|
}
|
|
223171
223095
|
return [leadingSpace2 ? line : "", formattedClasses, trailingSpace2 ? line : ""];
|
|
223172
223096
|
}
|
|
223173
|
-
return replaceTextEndOfLine(
|
|
223097
|
+
return replaceTextEndOfLine(text5);
|
|
223174
223098
|
}
|
|
223175
223099
|
const whitespacesOnlyRE = /^[\t\n\f\r ]*$/;
|
|
223176
|
-
const isWhitespaceOnly = whitespacesOnlyRE.test(
|
|
223100
|
+
const isWhitespaceOnly = whitespacesOnlyRE.test(text5);
|
|
223177
223101
|
const isFirstElement = !getPreviousNode(path);
|
|
223178
223102
|
const isLastElement = !getNextNode(path);
|
|
223179
223103
|
if (options.htmlWhitespaceSensitivity !== "ignore") {
|
|
@@ -223186,7 +223110,7 @@ ${fromBody}`;
|
|
|
223186
223110
|
return "";
|
|
223187
223111
|
}
|
|
223188
223112
|
let breaks = [line];
|
|
223189
|
-
const newlines = countNewLines(
|
|
223113
|
+
const newlines = countNewLines(text5);
|
|
223190
223114
|
if (newlines) {
|
|
223191
223115
|
breaks = generateHardlines(newlines);
|
|
223192
223116
|
}
|
|
@@ -223195,8 +223119,8 @@ ${fromBody}`;
|
|
|
223195
223119
|
}
|
|
223196
223120
|
return breaks;
|
|
223197
223121
|
}
|
|
223198
|
-
const [lead] =
|
|
223199
|
-
const [tail] =
|
|
223122
|
+
const [lead] = text5.match(leadingWhitespacesRE);
|
|
223123
|
+
const [tail] = text5.match(trailingWhitespacesRE);
|
|
223200
223124
|
let leadBreaks = [];
|
|
223201
223125
|
if (lead) {
|
|
223202
223126
|
leadBreaks = [line];
|
|
@@ -223204,7 +223128,7 @@ ${fromBody}`;
|
|
|
223204
223128
|
if (leadingNewlines) {
|
|
223205
223129
|
leadBreaks = generateHardlines(leadingNewlines);
|
|
223206
223130
|
}
|
|
223207
|
-
|
|
223131
|
+
text5 = text5.replace(leadingWhitespacesRE, "");
|
|
223208
223132
|
}
|
|
223209
223133
|
let trailBreaks = [];
|
|
223210
223134
|
if (tail) {
|
|
@@ -223218,13 +223142,13 @@ ${fromBody}`;
|
|
|
223218
223142
|
trailBreaks = trailBreaks.map((hardline2) => dedent(hardline2));
|
|
223219
223143
|
}
|
|
223220
223144
|
}
|
|
223221
|
-
|
|
223145
|
+
text5 = text5.replace(trailingWhitespacesRE, "");
|
|
223222
223146
|
}
|
|
223223
|
-
return [...leadBreaks, fill(getTextValueParts(
|
|
223147
|
+
return [...leadBreaks, fill(getTextValueParts(text5)), ...trailBreaks];
|
|
223224
223148
|
}
|
|
223225
|
-
const lineBreaksCount = countNewLines(
|
|
223226
|
-
let leadingLineBreaksCount = countLeadingNewLines(
|
|
223227
|
-
let trailingLineBreaksCount = countTrailingNewLines(
|
|
223149
|
+
const lineBreaksCount = countNewLines(text5);
|
|
223150
|
+
let leadingLineBreaksCount = countLeadingNewLines(text5);
|
|
223151
|
+
let trailingLineBreaksCount = countTrailingNewLines(text5);
|
|
223228
223152
|
if ((isFirstElement || isLastElement) && isWhitespaceOnly && isParentOfSomeType(path, ["Block", "ElementNode", "Template"])) {
|
|
223229
223153
|
return "";
|
|
223230
223154
|
}
|
|
@@ -223255,8 +223179,8 @@ ${fromBody}`;
|
|
|
223255
223179
|
trailingLineBreaksCount = 0;
|
|
223256
223180
|
trailingSpace = "";
|
|
223257
223181
|
}
|
|
223258
|
-
|
|
223259
|
-
return [...generateHardlines(leadingLineBreaksCount), fill(getTextValueParts(
|
|
223182
|
+
text5 = text5.replace(/^[\t\n\f\r ]+/g, leadingSpace).replace(/[\t\n\f\r ]+$/, trailingSpace);
|
|
223183
|
+
return [...generateHardlines(leadingLineBreaksCount), fill(getTextValueParts(text5)), ...generateHardlines(trailingLineBreaksCount)];
|
|
223260
223184
|
}
|
|
223261
223185
|
case "MustacheCommentStatement": {
|
|
223262
223186
|
const start3 = locStart(node);
|
|
@@ -223579,11 +223503,11 @@ ${fromBody}`;
|
|
|
223579
223503
|
var require_pragma3 = __commonJS22({
|
|
223580
223504
|
"src/language-graphql/pragma.js"(exports2, module22) {
|
|
223581
223505
|
"use strict";
|
|
223582
|
-
function hasPragma(
|
|
223583
|
-
return /^\s*#[^\S\n]*@(?:format|prettier)\s*(?:\n|$)/.test(
|
|
223506
|
+
function hasPragma(text5) {
|
|
223507
|
+
return /^\s*#[^\S\n]*@(?:format|prettier)\s*(?:\n|$)/.test(text5);
|
|
223584
223508
|
}
|
|
223585
|
-
function insertPragma(
|
|
223586
|
-
return "# @format\n\n" +
|
|
223509
|
+
function insertPragma(text5) {
|
|
223510
|
+
return "# @format\n\n" + text5;
|
|
223587
223511
|
}
|
|
223588
223512
|
module22.exports = {
|
|
223589
223513
|
hasPragma,
|
|
@@ -223951,13 +223875,13 @@ ${fromBody}`;
|
|
|
223951
223875
|
var INLINE_NODE_WRAPPER_TYPES = [...INLINE_NODE_TYPES, "tableCell", "paragraph", "heading"];
|
|
223952
223876
|
var kRegex = new RegExp(kPattern);
|
|
223953
223877
|
var punctuationRegex = new RegExp(punctuationPattern);
|
|
223954
|
-
function splitText(
|
|
223878
|
+
function splitText(text5, options) {
|
|
223955
223879
|
const KIND_NON_CJK = "non-cjk";
|
|
223956
223880
|
const KIND_CJ_LETTER = "cj-letter";
|
|
223957
223881
|
const KIND_K_LETTER = "k-letter";
|
|
223958
223882
|
const KIND_CJK_PUNCTUATION = "cjk-punctuation";
|
|
223959
223883
|
const nodes = [];
|
|
223960
|
-
const tokens = (options.proseWrap === "preserve" ?
|
|
223884
|
+
const tokens = (options.proseWrap === "preserve" ? text5 : text5.replace(new RegExp(`(${cjkPattern})
|
|
223961
223885
|
(${cjkPattern})`, "g"), "$1$2")).split(/([\t\n ]+)/);
|
|
223962
223886
|
for (const [index2, token] of tokens.entries()) {
|
|
223963
223887
|
if (index2 % 2 === 1) {
|
|
@@ -224151,7 +224075,7 @@ ${fromBody}`;
|
|
|
224151
224075
|
"use strict";
|
|
224152
224076
|
var parseFrontMatter = require_parse4();
|
|
224153
224077
|
var pragmas = ["format", "prettier"];
|
|
224154
|
-
function startWithPragma(
|
|
224078
|
+
function startWithPragma(text5) {
|
|
224155
224079
|
const pragma = `@(${pragmas.join("|")})`;
|
|
224156
224080
|
const regex = new RegExp([`<!--\\s*${pragma}\\s*-->`, `{\\s*\\/\\*\\s*${pragma}\\s*\\*\\/\\s*}`, `<!--.*\r?
|
|
224157
224081
|
[\\s\\S]*(^|
|
|
@@ -224160,14 +224084,14 @@ ${fromBody}`;
|
|
|
224160
224084
|
]*($|
|
|
224161
224085
|
)[\\s\\S]*
|
|
224162
224086
|
.*-->`].join("|"), "m");
|
|
224163
|
-
const matched =
|
|
224087
|
+
const matched = text5.match(regex);
|
|
224164
224088
|
return (matched === null || matched === void 0 ? void 0 : matched.index) === 0;
|
|
224165
224089
|
}
|
|
224166
224090
|
module22.exports = {
|
|
224167
224091
|
startWithPragma,
|
|
224168
|
-
hasPragma: (
|
|
224169
|
-
insertPragma: (
|
|
224170
|
-
const extracted = parseFrontMatter(
|
|
224092
|
+
hasPragma: (text5) => startWithPragma(parseFrontMatter(text5).content.trimStart()),
|
|
224093
|
+
insertPragma: (text5) => {
|
|
224094
|
+
const extracted = parseFrontMatter(text5);
|
|
224171
224095
|
const pragma = `<!-- @${pragmas[0]} -->`;
|
|
224172
224096
|
return extracted.frontMatter ? `${extracted.frontMatter.raw}
|
|
224173
224097
|
|
|
@@ -224696,11 +224620,11 @@ ${extracted.content}`;
|
|
|
224696
224620
|
const node = path.getValue();
|
|
224697
224621
|
const columnMaxWidths = [];
|
|
224698
224622
|
const contents = path.map((rowPath) => rowPath.map((cellPath, columnIndex) => {
|
|
224699
|
-
const
|
|
224700
|
-
const width = getStringWidth(
|
|
224623
|
+
const text5 = printDocToString(print(), options).formatted;
|
|
224624
|
+
const width = getStringWidth(text5);
|
|
224701
224625
|
columnMaxWidths[columnIndex] = Math.max(columnMaxWidths[columnIndex] || 3, width);
|
|
224702
224626
|
return {
|
|
224703
|
-
text:
|
|
224627
|
+
text: text5,
|
|
224704
224628
|
width
|
|
224705
224629
|
};
|
|
224706
224630
|
}, "children"), "children");
|
|
@@ -224729,11 +224653,11 @@ ${extracted.content}`;
|
|
|
224729
224653
|
}
|
|
224730
224654
|
function printRow(rowContents, isCompact) {
|
|
224731
224655
|
const columns = rowContents.map(({
|
|
224732
|
-
text:
|
|
224656
|
+
text: text5,
|
|
224733
224657
|
width
|
|
224734
224658
|
}, columnIndex) => {
|
|
224735
224659
|
if (isCompact) {
|
|
224736
|
-
return
|
|
224660
|
+
return text5;
|
|
224737
224661
|
}
|
|
224738
224662
|
const spaces = columnMaxWidths[columnIndex] - width;
|
|
224739
224663
|
const align2 = node.align[columnIndex];
|
|
@@ -224744,7 +224668,7 @@ ${extracted.content}`;
|
|
|
224744
224668
|
before = Math.floor(spaces / 2);
|
|
224745
224669
|
}
|
|
224746
224670
|
const after = spaces - before;
|
|
224747
|
-
return `${" ".repeat(before)}${
|
|
224671
|
+
return `${" ".repeat(before)}${text5}${" ".repeat(after)}`;
|
|
224748
224672
|
});
|
|
224749
224673
|
return `| ${columns.join(" | ")} |`;
|
|
224750
224674
|
}
|
|
@@ -225175,11 +225099,11 @@ ${extracted.content}`;
|
|
|
225175
225099
|
var splitByHtmlWhitespace = (string3) => string3.split(/[\t\n\f\r ]+/);
|
|
225176
225100
|
var getLeadingHtmlWhitespace = (string3) => string3.match(/^[\t\n\f\r ]*/)[0];
|
|
225177
225101
|
var getLeadingAndTrailingHtmlWhitespace = (string3) => {
|
|
225178
|
-
const [, leadingWhitespace,
|
|
225102
|
+
const [, leadingWhitespace, text5, trailingWhitespace] = string3.match(/^([\t\n\f\r ]*)(.*?)([\t\n\f\r ]*)$/s);
|
|
225179
225103
|
return {
|
|
225180
225104
|
leadingWhitespace,
|
|
225181
225105
|
trailingWhitespace,
|
|
225182
|
-
text:
|
|
225106
|
+
text: text5
|
|
225183
225107
|
};
|
|
225184
225108
|
};
|
|
225185
225109
|
var hasHtmlWhitespace = (string3) => /[\t\n\f\r ]/.test(string3);
|
|
@@ -225448,9 +225372,9 @@ ${extracted.content}`;
|
|
|
225448
225372
|
function getNodeCssStyleWhiteSpace(node) {
|
|
225449
225373
|
return node.type === "element" && (!node.namespace || isUnknownNamespace(node)) && CSS_WHITE_SPACE_TAGS[node.name] || CSS_WHITE_SPACE_DEFAULT;
|
|
225450
225374
|
}
|
|
225451
|
-
function getMinIndentation(
|
|
225375
|
+
function getMinIndentation(text5) {
|
|
225452
225376
|
let minIndentation = Number.POSITIVE_INFINITY;
|
|
225453
|
-
for (const lineText of
|
|
225377
|
+
for (const lineText of text5.split("\n")) {
|
|
225454
225378
|
if (lineText.length === 0) {
|
|
225455
225379
|
continue;
|
|
225456
225380
|
}
|
|
@@ -225467,20 +225391,20 @@ ${extracted.content}`;
|
|
|
225467
225391
|
}
|
|
225468
225392
|
return minIndentation === Number.POSITIVE_INFINITY ? 0 : minIndentation;
|
|
225469
225393
|
}
|
|
225470
|
-
function dedentString(
|
|
225471
|
-
return minIndent === 0 ?
|
|
225394
|
+
function dedentString(text5, minIndent = getMinIndentation(text5)) {
|
|
225395
|
+
return minIndent === 0 ? text5 : text5.split("\n").map((lineText) => lineText.slice(minIndent)).join("\n");
|
|
225472
225396
|
}
|
|
225473
|
-
function countChars(
|
|
225397
|
+
function countChars(text5, char) {
|
|
225474
225398
|
let counter = 0;
|
|
225475
|
-
for (let i = 0; i <
|
|
225476
|
-
if (
|
|
225399
|
+
for (let i = 0; i < text5.length; i++) {
|
|
225400
|
+
if (text5[i] === char) {
|
|
225477
225401
|
counter++;
|
|
225478
225402
|
}
|
|
225479
225403
|
}
|
|
225480
225404
|
return counter;
|
|
225481
225405
|
}
|
|
225482
|
-
function unescapeQuoteEntities(
|
|
225483
|
-
return
|
|
225406
|
+
function unescapeQuoteEntities(text5) {
|
|
225407
|
+
return text5.replace(/'/g, "'").replace(/"/g, '"');
|
|
225484
225408
|
}
|
|
225485
225409
|
var vueRootElementsSet = /* @__PURE__ */ new Set(["template", "style", "script"]);
|
|
225486
225410
|
function isVueCustomBlock(node, options) {
|
|
@@ -226520,11 +226444,11 @@ ${extracted.content}`;
|
|
|
226520
226444
|
function removeIgnorableFirstLf(ast) {
|
|
226521
226445
|
ast.walk((node) => {
|
|
226522
226446
|
if (node.type === "element" && node.tagDefinition.ignoreFirstLf && node.children.length > 0 && node.children[0].type === "text" && node.children[0].value[0] === "\n") {
|
|
226523
|
-
const
|
|
226524
|
-
if (
|
|
226525
|
-
node.removeChild(
|
|
226447
|
+
const text5 = node.children[0];
|
|
226448
|
+
if (text5.value.length === 1) {
|
|
226449
|
+
node.removeChild(text5);
|
|
226526
226450
|
} else {
|
|
226527
|
-
|
|
226451
|
+
text5.value = text5.value.slice(1);
|
|
226528
226452
|
}
|
|
226529
226453
|
}
|
|
226530
226454
|
});
|
|
@@ -226665,12 +226589,12 @@ ${extracted.content}`;
|
|
|
226665
226589
|
}
|
|
226666
226590
|
const {
|
|
226667
226591
|
leadingWhitespace,
|
|
226668
|
-
text:
|
|
226592
|
+
text: text5,
|
|
226669
226593
|
trailingWhitespace
|
|
226670
226594
|
} = getLeadingAndTrailingHtmlWhitespace(child.value);
|
|
226671
226595
|
const prevChild = child.prev;
|
|
226672
226596
|
const nextChild = child.next;
|
|
226673
|
-
if (!
|
|
226597
|
+
if (!text5) {
|
|
226674
226598
|
node.removeChild(child);
|
|
226675
226599
|
i--;
|
|
226676
226600
|
if (leadingWhitespace || trailingWhitespace) {
|
|
@@ -226682,7 +226606,7 @@ ${extracted.content}`;
|
|
|
226682
226606
|
}
|
|
226683
226607
|
}
|
|
226684
226608
|
} else {
|
|
226685
|
-
child.value =
|
|
226609
|
+
child.value = text5;
|
|
226686
226610
|
child.sourceSpan = new ParseSourceSpan(child.sourceSpan.start.moveBy(leadingWhitespace.length), child.sourceSpan.end.moveBy(-trailingWhitespace.length));
|
|
226687
226611
|
if (leadingWhitespace) {
|
|
226688
226612
|
if (prevChild) {
|
|
@@ -226764,11 +226688,11 @@ ${extracted.content}`;
|
|
|
226764
226688
|
var require_pragma5 = __commonJS22({
|
|
226765
226689
|
"src/language-html/pragma.js"(exports2, module22) {
|
|
226766
226690
|
"use strict";
|
|
226767
|
-
function hasPragma(
|
|
226768
|
-
return /^\s*<!--\s*@(?:format|prettier)\s*-->/.test(
|
|
226691
|
+
function hasPragma(text5) {
|
|
226692
|
+
return /^\s*<!--\s*@(?:format|prettier)\s*-->/.test(text5);
|
|
226769
226693
|
}
|
|
226770
|
-
function insertPragma(
|
|
226771
|
-
return "<!-- @format -->\n\n" +
|
|
226694
|
+
function insertPragma(text5) {
|
|
226695
|
+
return "<!-- @format -->\n\n" + text5.replace(/^\s*\n/, "");
|
|
226772
226696
|
}
|
|
226773
226697
|
module22.exports = {
|
|
226774
226698
|
hasPragma,
|
|
@@ -226990,13 +226914,13 @@ ${extracted.content}`;
|
|
|
226990
226914
|
});
|
|
226991
226915
|
var require_parse_srcset = __commonJS22({
|
|
226992
226916
|
"node_modules/parse-srcset/src/parse-srcset.js"(exports2, module22) {
|
|
226993
|
-
(function(
|
|
226917
|
+
(function(root3, factory) {
|
|
226994
226918
|
if (typeof define === "function" && define.amd) {
|
|
226995
226919
|
define([], factory);
|
|
226996
226920
|
} else if (typeof module22 === "object" && module22.exports) {
|
|
226997
226921
|
module22.exports = factory();
|
|
226998
226922
|
} else {
|
|
226999
|
-
|
|
226923
|
+
root3.parseSrcset = factory();
|
|
227000
226924
|
}
|
|
227001
226925
|
})(exports2, function() {
|
|
227002
226926
|
return function(input, options) {
|
|
@@ -227359,8 +227283,8 @@ ${extracted.content}`;
|
|
|
227359
227283
|
const isKeyMatched = (patterns) => new RegExp(patterns.join("|")).test(node.fullName);
|
|
227360
227284
|
const getValue = () => unescapeQuoteEntities(node.value);
|
|
227361
227285
|
let shouldHug = false;
|
|
227362
|
-
const __onHtmlBindingRoot = (
|
|
227363
|
-
const rootNode =
|
|
227286
|
+
const __onHtmlBindingRoot = (root3, options2) => {
|
|
227287
|
+
const rootNode = root3.type === "NGRoot" ? root3.node.type === "NGMicrosyntax" && root3.node.body.length === 1 && root3.node.body[0].type === "NGMicrosyntaxExpression" ? root3.node.body[0].expression : root3.node : root3.type === "JsExpressionRoot" ? root3.node : root3;
|
|
227364
227288
|
if (rootNode && (rootNode.type === "ObjectExpression" || rootNode.type === "ArrayExpression" || options2.parser === "__vue_expression" && (rootNode.type === "TemplateLiteral" || rootNode.type === "StringLiteral"))) {
|
|
227365
227289
|
shouldHug = true;
|
|
227366
227290
|
}
|
|
@@ -228018,16 +227942,16 @@ ${extracted.content}`;
|
|
|
228018
227942
|
var require_pragma6 = __commonJS22({
|
|
228019
227943
|
"src/language-yaml/pragma.js"(exports2, module22) {
|
|
228020
227944
|
"use strict";
|
|
228021
|
-
function isPragma(
|
|
228022
|
-
return /^\s*@(?:prettier|format)\s*$/.test(
|
|
227945
|
+
function isPragma(text5) {
|
|
227946
|
+
return /^\s*@(?:prettier|format)\s*$/.test(text5);
|
|
228023
227947
|
}
|
|
228024
|
-
function hasPragma(
|
|
228025
|
-
return /^\s*#[^\S\n]*@(?:prettier|format)\s*?(?:\n|$)/.test(
|
|
227948
|
+
function hasPragma(text5) {
|
|
227949
|
+
return /^\s*#[^\S\n]*@(?:prettier|format)\s*?(?:\n|$)/.test(text5);
|
|
228026
227950
|
}
|
|
228027
|
-
function insertPragma(
|
|
227951
|
+
function insertPragma(text5) {
|
|
228028
227952
|
return `# @format
|
|
228029
227953
|
|
|
228030
|
-
${
|
|
227954
|
+
${text5}`;
|
|
228031
227955
|
}
|
|
228032
227956
|
module22.exports = {
|
|
228033
227957
|
isPragma,
|
|
@@ -228097,11 +228021,11 @@ ${text4}`;
|
|
|
228097
228021
|
enumerable: false
|
|
228098
228022
|
});
|
|
228099
228023
|
}
|
|
228100
|
-
function isNextLineEmpty(node,
|
|
228024
|
+
function isNextLineEmpty(node, text5) {
|
|
228101
228025
|
let newlineCount = 0;
|
|
228102
|
-
const textLength =
|
|
228026
|
+
const textLength = text5.length;
|
|
228103
228027
|
for (let i = node.position.end.offset - 1; i < textLength; i++) {
|
|
228104
|
-
const char =
|
|
228028
|
+
const char = text5[i];
|
|
228105
228029
|
if (char === "\n") {
|
|
228106
228030
|
newlineCount++;
|
|
228107
228031
|
}
|
|
@@ -228167,10 +228091,10 @@ ${text4}`;
|
|
|
228167
228091
|
function hasEndComments(node) {
|
|
228168
228092
|
return isNonEmptyArray(node === null || node === void 0 ? void 0 : node.endComments);
|
|
228169
228093
|
}
|
|
228170
|
-
function splitWithSingleSpace(
|
|
228094
|
+
function splitWithSingleSpace(text5) {
|
|
228171
228095
|
const parts = [];
|
|
228172
228096
|
let lastPart;
|
|
228173
|
-
for (const part of
|
|
228097
|
+
for (const part of text5.split(/( +)/)) {
|
|
228174
228098
|
if (part !== " ") {
|
|
228175
228099
|
if (lastPart === " ") {
|
|
228176
228100
|
parts.push(part);
|
|
@@ -228320,13 +228244,13 @@ ${text4}`;
|
|
|
228320
228244
|
var printedEmptyLineCache = /* @__PURE__ */ new WeakMap();
|
|
228321
228245
|
function printNextEmptyLine(path, originalText) {
|
|
228322
228246
|
const node = path.getValue();
|
|
228323
|
-
const
|
|
228247
|
+
const root3 = path.stack[0];
|
|
228324
228248
|
let isNextEmptyLinePrintedSet;
|
|
228325
|
-
if (printedEmptyLineCache.has(
|
|
228326
|
-
isNextEmptyLinePrintedSet = printedEmptyLineCache.get(
|
|
228249
|
+
if (printedEmptyLineCache.has(root3)) {
|
|
228250
|
+
isNextEmptyLinePrintedSet = printedEmptyLineCache.get(root3);
|
|
228327
228251
|
} else {
|
|
228328
228252
|
isNextEmptyLinePrintedSet = /* @__PURE__ */ new Set();
|
|
228329
|
-
printedEmptyLineCache.set(
|
|
228253
|
+
printedEmptyLineCache.set(root3, isNextEmptyLinePrintedSet);
|
|
228330
228254
|
}
|
|
228331
228255
|
if (!isNextEmptyLinePrintedSet.has(node.position.end.line)) {
|
|
228332
228256
|
isNextEmptyLinePrintedSet.add(node.position.end.line);
|
|
@@ -228820,8 +228744,8 @@ ${text4}`;
|
|
|
228820
228744
|
function shouldPrintDocumentEndMarker(document4, nextDocument) {
|
|
228821
228745
|
return hasTrailingComment(document4) || nextDocument && (nextDocument.head.children.length > 0 || hasEndComments(nextDocument.head));
|
|
228822
228746
|
}
|
|
228823
|
-
function shouldPrintDocumentHeadEndMarker(document4, nextDocument,
|
|
228824
|
-
if (
|
|
228747
|
+
function shouldPrintDocumentHeadEndMarker(document4, nextDocument, root3, options) {
|
|
228748
|
+
if (root3.children[0] === document4 && /---(?:\s|$)/.test(options.originalText.slice(locStart(document4), locStart(document4) + 4)) || document4.head.children.length > 0 || hasEndComments(document4.head) || hasTrailingComment(document4.head)) {
|
|
228825
228749
|
return "head";
|
|
228826
228750
|
}
|
|
228827
228751
|
if (shouldPrintDocumentEndMarker(document4, nextDocument)) {
|
|
@@ -229046,14 +228970,14 @@ ${text4}`;
|
|
|
229046
228970
|
var formatWithCursor = withPlugins(core2.formatWithCursor);
|
|
229047
228971
|
module2.exports = {
|
|
229048
228972
|
formatWithCursor,
|
|
229049
|
-
format(
|
|
229050
|
-
return formatWithCursor(
|
|
228973
|
+
format(text5, opts) {
|
|
228974
|
+
return formatWithCursor(text5, opts).formatted;
|
|
229051
228975
|
},
|
|
229052
|
-
check(
|
|
228976
|
+
check(text5, opts) {
|
|
229053
228977
|
const {
|
|
229054
228978
|
formatted
|
|
229055
|
-
} = formatWithCursor(
|
|
229056
|
-
return formatted ===
|
|
228979
|
+
} = formatWithCursor(text5, opts);
|
|
228980
|
+
return formatted === text5;
|
|
229057
228981
|
},
|
|
229058
228982
|
doc,
|
|
229059
228983
|
resolveConfig: config.resolveConfig,
|
|
@@ -230120,7 +230044,7 @@ function resolveAllAttention(events, context) {
|
|
|
230120
230044
|
let index2 = -1;
|
|
230121
230045
|
let open;
|
|
230122
230046
|
let group;
|
|
230123
|
-
let
|
|
230047
|
+
let text5;
|
|
230124
230048
|
let openingSequence;
|
|
230125
230049
|
let closingSequence;
|
|
230126
230050
|
let use;
|
|
@@ -230149,7 +230073,7 @@ function resolveAllAttention(events, context) {
|
|
|
230149
230073
|
start: Object.assign({}, events[index2][1].start),
|
|
230150
230074
|
end
|
|
230151
230075
|
};
|
|
230152
|
-
|
|
230076
|
+
text5 = {
|
|
230153
230077
|
type: use > 1 ? "strongText" : "emphasisText",
|
|
230154
230078
|
start: Object.assign({}, events[open][1].end),
|
|
230155
230079
|
end: Object.assign({}, events[index2][1].start)
|
|
@@ -230172,11 +230096,11 @@ function resolveAllAttention(events, context) {
|
|
|
230172
230096
|
["enter", group, context],
|
|
230173
230097
|
["enter", openingSequence, context],
|
|
230174
230098
|
["exit", openingSequence, context],
|
|
230175
|
-
["enter",
|
|
230099
|
+
["enter", text5, context]
|
|
230176
230100
|
]);
|
|
230177
230101
|
nextEvents = push(nextEvents, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open + 1, index2), context));
|
|
230178
230102
|
nextEvents = push(nextEvents, [
|
|
230179
|
-
["exit",
|
|
230103
|
+
["exit", text5, context],
|
|
230180
230104
|
["enter", closingSequence, context],
|
|
230181
230105
|
["exit", closingSequence, context],
|
|
230182
230106
|
["exit", group, context]
|
|
@@ -233475,7 +233399,7 @@ function resolveHeadingAtx(events, context) {
|
|
|
233475
233399
|
let contentEnd = events.length - 2;
|
|
233476
233400
|
let contentStart = 3;
|
|
233477
233401
|
let content3;
|
|
233478
|
-
let
|
|
233402
|
+
let text5;
|
|
233479
233403
|
if (events[contentStart][1].type === "whitespace") {
|
|
233480
233404
|
contentStart += 2;
|
|
233481
233405
|
}
|
|
@@ -233491,7 +233415,7 @@ function resolveHeadingAtx(events, context) {
|
|
|
233491
233415
|
start: events[contentStart][1].start,
|
|
233492
233416
|
end: events[contentEnd][1].end
|
|
233493
233417
|
};
|
|
233494
|
-
|
|
233418
|
+
text5 = {
|
|
233495
233419
|
type: "chunkText",
|
|
233496
233420
|
start: events[contentStart][1].start,
|
|
233497
233421
|
end: events[contentEnd][1].end,
|
|
@@ -233499,8 +233423,8 @@ function resolveHeadingAtx(events, context) {
|
|
|
233499
233423
|
};
|
|
233500
233424
|
splice(events, contentStart, contentEnd - contentStart + 1, [
|
|
233501
233425
|
["enter", content3, context],
|
|
233502
|
-
["enter",
|
|
233503
|
-
["exit",
|
|
233426
|
+
["enter", text5, context],
|
|
233427
|
+
["exit", text5, context],
|
|
233504
233428
|
["exit", content3, context]
|
|
233505
233429
|
]);
|
|
233506
233430
|
}
|
|
@@ -234365,7 +234289,7 @@ function resolveToLabelEnd(events, context) {
|
|
|
234365
234289
|
start: Object.assign({}, events[open][1].start),
|
|
234366
234290
|
end: Object.assign({}, events[close][1].end)
|
|
234367
234291
|
};
|
|
234368
|
-
const
|
|
234292
|
+
const text5 = {
|
|
234369
234293
|
type: "labelText",
|
|
234370
234294
|
start: Object.assign({}, events[open + offset2 + 2][1].end),
|
|
234371
234295
|
end: Object.assign({}, events[close - 2][1].start)
|
|
@@ -234375,10 +234299,10 @@ function resolveToLabelEnd(events, context) {
|
|
|
234375
234299
|
["enter", label, context]
|
|
234376
234300
|
];
|
|
234377
234301
|
media = push(media, events.slice(open + 1, open + offset2 + 3));
|
|
234378
|
-
media = push(media, [["enter",
|
|
234302
|
+
media = push(media, [["enter", text5, context]]);
|
|
234379
234303
|
media = push(media, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open + offset2 + 4, close - 3), context));
|
|
234380
234304
|
media = push(media, [
|
|
234381
|
-
["exit",
|
|
234305
|
+
["exit", text5, context],
|
|
234382
234306
|
events[close - 2],
|
|
234383
234307
|
events[close - 1],
|
|
234384
234308
|
["exit", label, context]
|
|
@@ -234738,7 +234662,7 @@ var setextUnderline = {
|
|
|
234738
234662
|
function resolveToSetextUnderline(events, context) {
|
|
234739
234663
|
let index2 = events.length;
|
|
234740
234664
|
let content3;
|
|
234741
|
-
let
|
|
234665
|
+
let text5;
|
|
234742
234666
|
let definition3;
|
|
234743
234667
|
while (index2--) {
|
|
234744
234668
|
if (events[index2][0] === "enter") {
|
|
@@ -234747,7 +234671,7 @@ function resolveToSetextUnderline(events, context) {
|
|
|
234747
234671
|
break;
|
|
234748
234672
|
}
|
|
234749
234673
|
if (events[index2][1].type === "paragraph") {
|
|
234750
|
-
|
|
234674
|
+
text5 = index2;
|
|
234751
234675
|
}
|
|
234752
234676
|
} else {
|
|
234753
234677
|
if (events[index2][1].type === "content") {
|
|
@@ -234760,12 +234684,12 @@ function resolveToSetextUnderline(events, context) {
|
|
|
234760
234684
|
}
|
|
234761
234685
|
const heading2 = {
|
|
234762
234686
|
type: "setextHeading",
|
|
234763
|
-
start: Object.assign({}, events[
|
|
234687
|
+
start: Object.assign({}, events[text5][1].start),
|
|
234764
234688
|
end: Object.assign({}, events[events.length - 1][1].end)
|
|
234765
234689
|
};
|
|
234766
|
-
events[
|
|
234690
|
+
events[text5][1].type = "setextHeadingText";
|
|
234767
234691
|
if (definition3) {
|
|
234768
|
-
events.splice(
|
|
234692
|
+
events.splice(text5, 0, ["enter", heading2, context]);
|
|
234769
234693
|
events.splice(definition3 + 1, 0, ["exit", events[content3][1], context]);
|
|
234770
234694
|
events[content3][1].end = Object.assign({}, events[definition3][1].end);
|
|
234771
234695
|
} else {
|
|
@@ -234858,10 +234782,10 @@ function initializeFactory(field) {
|
|
|
234858
234782
|
function initializeText(effects) {
|
|
234859
234783
|
const self2 = this;
|
|
234860
234784
|
const constructs2 = this.parser.constructs[field];
|
|
234861
|
-
const
|
|
234785
|
+
const text5 = effects.attempt(constructs2, start3, notText);
|
|
234862
234786
|
return start3;
|
|
234863
234787
|
function start3(code2) {
|
|
234864
|
-
return atBreak(code2) ?
|
|
234788
|
+
return atBreak(code2) ? text5(code2) : notText(code2);
|
|
234865
234789
|
}
|
|
234866
234790
|
function notText(code2) {
|
|
234867
234791
|
if (code2 === null) {
|
|
@@ -234875,7 +234799,7 @@ function initializeFactory(field) {
|
|
|
234875
234799
|
function data2(code2) {
|
|
234876
234800
|
if (atBreak(code2)) {
|
|
234877
234801
|
effects.exit("data");
|
|
234878
|
-
return
|
|
234802
|
+
return text5(code2);
|
|
234879
234803
|
}
|
|
234880
234804
|
effects.consume(code2);
|
|
234881
234805
|
return data2;
|
|
@@ -235867,7 +235791,7 @@ function compiler(options = {}) {
|
|
|
235867
235791
|
const parent = this.stack[this.stack.length - 1];
|
|
235868
235792
|
let tail = parent.children[parent.children.length - 1];
|
|
235869
235793
|
if (!tail || tail.type !== "text") {
|
|
235870
|
-
tail =
|
|
235794
|
+
tail = text5();
|
|
235871
235795
|
tail.position = {
|
|
235872
235796
|
start: point2(token.start)
|
|
235873
235797
|
};
|
|
@@ -236102,7 +236026,7 @@ function compiler(options = {}) {
|
|
|
236102
236026
|
children: []
|
|
236103
236027
|
};
|
|
236104
236028
|
}
|
|
236105
|
-
function
|
|
236029
|
+
function text5() {
|
|
236106
236030
|
return {
|
|
236107
236031
|
type: "text",
|
|
236108
236032
|
value: ""
|
|
@@ -237030,11 +236954,11 @@ function linkReference(node, _, context, safeOptions) {
|
|
|
237030
236954
|
let subexit = context.enter("label");
|
|
237031
236955
|
const tracker = track(safeOptions);
|
|
237032
236956
|
let value = tracker.move("[");
|
|
237033
|
-
const
|
|
236957
|
+
const text5 = containerPhrasing(node, context, __spreadValues({
|
|
237034
236958
|
before: value,
|
|
237035
236959
|
after: "]"
|
|
237036
236960
|
}, tracker.current()));
|
|
237037
|
-
value += tracker.move(
|
|
236961
|
+
value += tracker.move(text5 + "][");
|
|
237038
236962
|
subexit();
|
|
237039
236963
|
const stack = context.stack;
|
|
237040
236964
|
context.stack = [];
|
|
@@ -237046,7 +236970,7 @@ function linkReference(node, _, context, safeOptions) {
|
|
|
237046
236970
|
subexit();
|
|
237047
236971
|
context.stack = stack;
|
|
237048
236972
|
exit2();
|
|
237049
|
-
if (type === "full" || !
|
|
236973
|
+
if (type === "full" || !text5 || text5 !== reference) {
|
|
237050
236974
|
value += tracker.move(reference + "]");
|
|
237051
236975
|
} else if (type === "shortcut") {
|
|
237052
236976
|
value = value.slice(0, -1);
|
|
@@ -237763,10 +237687,10 @@ function getOptions(opts) {
|
|
|
237763
237687
|
return options;
|
|
237764
237688
|
}
|
|
237765
237689
|
function pushComment(options, array) {
|
|
237766
|
-
return function(block,
|
|
237690
|
+
return function(block, text5, start3, end, startLoc, endLoc) {
|
|
237767
237691
|
var comment = {
|
|
237768
237692
|
type: block ? "Block" : "Line",
|
|
237769
|
-
value:
|
|
237693
|
+
value: text5,
|
|
237770
237694
|
start: start3,
|
|
237771
237695
|
end
|
|
237772
237696
|
};
|
|
@@ -244057,8 +243981,135 @@ function remarkMdx(options = {}) {
|
|
|
244057
243981
|
}
|
|
244058
243982
|
}
|
|
244059
243983
|
|
|
244060
|
-
//
|
|
244061
|
-
var
|
|
243984
|
+
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_freeGlobal.js
|
|
243985
|
+
var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
|
|
243986
|
+
var freeGlobal_default = freeGlobal;
|
|
243987
|
+
|
|
243988
|
+
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_root.js
|
|
243989
|
+
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
243990
|
+
var root2 = freeGlobal_default || freeSelf || Function("return this")();
|
|
243991
|
+
var root_default = root2;
|
|
243992
|
+
|
|
243993
|
+
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Symbol.js
|
|
243994
|
+
var Symbol2 = root_default.Symbol;
|
|
243995
|
+
var Symbol_default = Symbol2;
|
|
243996
|
+
|
|
243997
|
+
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getRawTag.js
|
|
243998
|
+
var objectProto = Object.prototype;
|
|
243999
|
+
var hasOwnProperty3 = objectProto.hasOwnProperty;
|
|
244000
|
+
var nativeObjectToString = objectProto.toString;
|
|
244001
|
+
var symToStringTag = Symbol_default ? Symbol_default.toStringTag : void 0;
|
|
244002
|
+
function getRawTag(value) {
|
|
244003
|
+
var isOwn = hasOwnProperty3.call(value, symToStringTag), tag = value[symToStringTag];
|
|
244004
|
+
try {
|
|
244005
|
+
value[symToStringTag] = void 0;
|
|
244006
|
+
var unmasked = true;
|
|
244007
|
+
} catch (e) {
|
|
244008
|
+
}
|
|
244009
|
+
var result = nativeObjectToString.call(value);
|
|
244010
|
+
if (unmasked) {
|
|
244011
|
+
if (isOwn) {
|
|
244012
|
+
value[symToStringTag] = tag;
|
|
244013
|
+
} else {
|
|
244014
|
+
delete value[symToStringTag];
|
|
244015
|
+
}
|
|
244016
|
+
}
|
|
244017
|
+
return result;
|
|
244018
|
+
}
|
|
244019
|
+
var getRawTag_default = getRawTag;
|
|
244020
|
+
|
|
244021
|
+
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_objectToString.js
|
|
244022
|
+
var objectProto2 = Object.prototype;
|
|
244023
|
+
var nativeObjectToString2 = objectProto2.toString;
|
|
244024
|
+
function objectToString(value) {
|
|
244025
|
+
return nativeObjectToString2.call(value);
|
|
244026
|
+
}
|
|
244027
|
+
var objectToString_default = objectToString;
|
|
244028
|
+
|
|
244029
|
+
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGetTag.js
|
|
244030
|
+
var nullTag = "[object Null]";
|
|
244031
|
+
var undefinedTag = "[object Undefined]";
|
|
244032
|
+
var symToStringTag2 = Symbol_default ? Symbol_default.toStringTag : void 0;
|
|
244033
|
+
function baseGetTag(value) {
|
|
244034
|
+
if (value == null) {
|
|
244035
|
+
return value === void 0 ? undefinedTag : nullTag;
|
|
244036
|
+
}
|
|
244037
|
+
return symToStringTag2 && symToStringTag2 in Object(value) ? getRawTag_default(value) : objectToString_default(value);
|
|
244038
|
+
}
|
|
244039
|
+
var baseGetTag_default = baseGetTag;
|
|
244040
|
+
|
|
244041
|
+
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObjectLike.js
|
|
244042
|
+
function isObjectLike(value) {
|
|
244043
|
+
return value != null && typeof value == "object";
|
|
244044
|
+
}
|
|
244045
|
+
var isObjectLike_default = isObjectLike;
|
|
244046
|
+
|
|
244047
|
+
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArray.js
|
|
244048
|
+
var isArray2 = Array.isArray;
|
|
244049
|
+
var isArray_default = isArray2;
|
|
244050
|
+
|
|
244051
|
+
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsArguments.js
|
|
244052
|
+
var argsTag = "[object Arguments]";
|
|
244053
|
+
function baseIsArguments(value) {
|
|
244054
|
+
return isObjectLike_default(value) && baseGetTag_default(value) == argsTag;
|
|
244055
|
+
}
|
|
244056
|
+
var baseIsArguments_default = baseIsArguments;
|
|
244057
|
+
|
|
244058
|
+
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArguments.js
|
|
244059
|
+
var objectProto3 = Object.prototype;
|
|
244060
|
+
var hasOwnProperty4 = objectProto3.hasOwnProperty;
|
|
244061
|
+
var propertyIsEnumerable = objectProto3.propertyIsEnumerable;
|
|
244062
|
+
var isArguments = baseIsArguments_default(function() {
|
|
244063
|
+
return arguments;
|
|
244064
|
+
}()) ? baseIsArguments_default : function(value) {
|
|
244065
|
+
return isObjectLike_default(value) && hasOwnProperty4.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
|
|
244066
|
+
};
|
|
244067
|
+
var isArguments_default = isArguments;
|
|
244068
|
+
|
|
244069
|
+
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayPush.js
|
|
244070
|
+
function arrayPush(array, values) {
|
|
244071
|
+
var index2 = -1, length = values.length, offset2 = array.length;
|
|
244072
|
+
while (++index2 < length) {
|
|
244073
|
+
array[offset2 + index2] = values[index2];
|
|
244074
|
+
}
|
|
244075
|
+
return array;
|
|
244076
|
+
}
|
|
244077
|
+
var arrayPush_default = arrayPush;
|
|
244078
|
+
|
|
244079
|
+
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isFlattenable.js
|
|
244080
|
+
var spreadableSymbol = Symbol_default ? Symbol_default.isConcatSpreadable : void 0;
|
|
244081
|
+
function isFlattenable(value) {
|
|
244082
|
+
return isArray_default(value) || isArguments_default(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
|
|
244083
|
+
}
|
|
244084
|
+
var isFlattenable_default = isFlattenable;
|
|
244085
|
+
|
|
244086
|
+
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseFlatten.js
|
|
244087
|
+
function baseFlatten(array, depth, predicate, isStrict, result) {
|
|
244088
|
+
var index2 = -1, length = array.length;
|
|
244089
|
+
predicate || (predicate = isFlattenable_default);
|
|
244090
|
+
result || (result = []);
|
|
244091
|
+
while (++index2 < length) {
|
|
244092
|
+
var value = array[index2];
|
|
244093
|
+
if (depth > 0 && predicate(value)) {
|
|
244094
|
+
if (depth > 1) {
|
|
244095
|
+
baseFlatten(value, depth - 1, predicate, isStrict, result);
|
|
244096
|
+
} else {
|
|
244097
|
+
arrayPush_default(result, value);
|
|
244098
|
+
}
|
|
244099
|
+
} else if (!isStrict) {
|
|
244100
|
+
result[result.length] = value;
|
|
244101
|
+
}
|
|
244102
|
+
}
|
|
244103
|
+
return result;
|
|
244104
|
+
}
|
|
244105
|
+
var baseFlatten_default = baseFlatten;
|
|
244106
|
+
|
|
244107
|
+
// ../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/flatten.js
|
|
244108
|
+
function flatten(array) {
|
|
244109
|
+
var length = array == null ? 0 : array.length;
|
|
244110
|
+
return length ? baseFlatten_default(array, 1) : [];
|
|
244111
|
+
}
|
|
244112
|
+
var flatten_default = flatten;
|
|
244062
244113
|
|
|
244063
244114
|
// src/parse/acorn.ts
|
|
244064
244115
|
var extractAttributes = (attributes, fields, imageCallback) => {
|
|
@@ -244069,7 +244120,14 @@ var extractAttributes = (attributes, fields, imageCallback) => {
|
|
|
244069
244120
|
if (!field) {
|
|
244070
244121
|
throw new Error(`Unable to find field definition for property "${attribute.name}"`);
|
|
244071
244122
|
}
|
|
244072
|
-
|
|
244123
|
+
try {
|
|
244124
|
+
properties[attribute.name] = extractAttribute(attribute, field, imageCallback);
|
|
244125
|
+
} catch (e) {
|
|
244126
|
+
if (e instanceof Error) {
|
|
244127
|
+
throw new Error(`Unable to parse field value for field "${field.name}" (type: ${field.type}). ${e.message}`);
|
|
244128
|
+
}
|
|
244129
|
+
throw e;
|
|
244130
|
+
}
|
|
244073
244131
|
});
|
|
244074
244132
|
return properties;
|
|
244075
244133
|
};
|
|
@@ -244088,9 +244146,7 @@ var extractAttribute = (attribute, field, imageCallback) => {
|
|
|
244088
244146
|
case "image":
|
|
244089
244147
|
if (field.list) {
|
|
244090
244148
|
const values = extractScalar(extractExpression(attribute), field);
|
|
244091
|
-
|
|
244092
|
-
return values.split(",").map((value) => imageCallback(value));
|
|
244093
|
-
}
|
|
244149
|
+
return values.split(",").map((value) => imageCallback(value));
|
|
244094
244150
|
} else {
|
|
244095
244151
|
const value = extractString(attribute, field);
|
|
244096
244152
|
return imageCallback(value);
|
|
@@ -244105,7 +244161,11 @@ var extractAttribute = (attribute, field, imageCallback) => {
|
|
|
244105
244161
|
return extractObject(extractExpression(attribute), field);
|
|
244106
244162
|
case "rich-text":
|
|
244107
244163
|
const JSXString = extractJSXFragment(extractExpression(attribute), attribute, field);
|
|
244108
|
-
|
|
244164
|
+
if (JSXString) {
|
|
244165
|
+
return parseMDX(JSXString, field, imageCallback);
|
|
244166
|
+
} else {
|
|
244167
|
+
return {};
|
|
244168
|
+
}
|
|
244109
244169
|
default:
|
|
244110
244170
|
throw new Error(`Extract attribute: Unhandled field type ${field.type}`);
|
|
244111
244171
|
}
|
|
@@ -244154,14 +244214,16 @@ var getField = (objectField, name) => {
|
|
|
244154
244214
|
}
|
|
244155
244215
|
};
|
|
244156
244216
|
var extractJSXFragment = (attribute, baseAttribute, field) => {
|
|
244157
|
-
var _a;
|
|
244158
244217
|
if (field.list) {
|
|
244159
244218
|
} else {
|
|
244160
244219
|
if (attribute.expression.type === "JSXFragment") {
|
|
244161
|
-
assertHasType(attribute.expression
|
|
244162
|
-
|
|
244163
|
-
|
|
244164
|
-
|
|
244220
|
+
assertHasType(attribute.expression);
|
|
244221
|
+
if (attribute.expression.children[0]) {
|
|
244222
|
+
const firstChild = attribute.expression.children[0];
|
|
244223
|
+
if (attribute.expression.children[0].type === "JSXText") {
|
|
244224
|
+
const child = firstChild;
|
|
244225
|
+
return child.value.trim();
|
|
244226
|
+
}
|
|
244165
244227
|
}
|
|
244166
244228
|
}
|
|
244167
244229
|
}
|
|
@@ -244217,7 +244279,7 @@ var extractExpression = (attribute) => {
|
|
|
244217
244279
|
};
|
|
244218
244280
|
function assertType(val, type) {
|
|
244219
244281
|
if (val.type !== type) {
|
|
244220
|
-
throw new Error(`Expected type to be ${type} but received ${val.type}`);
|
|
244282
|
+
throw new Error(`Expected type to be ${type} but received ${val.type}. ${MDX_PARSE_ERROR_MSG}`);
|
|
244221
244283
|
}
|
|
244222
244284
|
}
|
|
244223
244285
|
function assertHasType(val) {
|
|
@@ -244235,58 +244297,71 @@ var throwError = (field) => {
|
|
|
244235
244297
|
// src/parse/mdx.ts
|
|
244236
244298
|
function mdxJsxElement(node, field, imageCallback) {
|
|
244237
244299
|
var _a;
|
|
244238
|
-
|
|
244239
|
-
const
|
|
244240
|
-
|
|
244241
|
-
|
|
244242
|
-
if (typeof template === "string") {
|
|
244243
|
-
throw new Error("Global templates not yet supported");
|
|
244244
|
-
}
|
|
244245
|
-
if (!template) {
|
|
244246
|
-
const string3 = toMarkdown({ type: "root", children: [node] }, {
|
|
244247
|
-
extensions: [mdxJsxToMarkdown()],
|
|
244248
|
-
listItemIndent: "one"
|
|
244300
|
+
try {
|
|
244301
|
+
const template = (_a = field.templates) == null ? void 0 : _a.find((template2) => {
|
|
244302
|
+
const templateName = typeof template2 === "string" ? template2 : template2.name;
|
|
244303
|
+
return templateName === node.name;
|
|
244249
244304
|
});
|
|
244250
|
-
|
|
244251
|
-
|
|
244252
|
-
|
|
244253
|
-
|
|
244254
|
-
|
|
244255
|
-
|
|
244256
|
-
|
|
244257
|
-
|
|
244258
|
-
if (node.type === "mdxJsxFlowElement") {
|
|
244259
|
-
return {
|
|
244260
|
-
type: node.type,
|
|
244261
|
-
name: node.name,
|
|
244262
|
-
children: [{ type: "text", text: "" }],
|
|
244263
|
-
props: { text: value }
|
|
244264
|
-
};
|
|
244265
|
-
} else {
|
|
244305
|
+
if (typeof template === "string") {
|
|
244306
|
+
throw new Error("Global templates not yet supported");
|
|
244307
|
+
}
|
|
244308
|
+
if (!template) {
|
|
244309
|
+
const string3 = toMarkdown({ type: "root", children: [node] }, {
|
|
244310
|
+
extensions: [mdxJsxToMarkdown()],
|
|
244311
|
+
listItemIndent: "one"
|
|
244312
|
+
});
|
|
244266
244313
|
return {
|
|
244267
|
-
type: node.type,
|
|
244268
|
-
|
|
244269
|
-
children: [{ type: "text", text: "" }]
|
|
244270
|
-
props: { text: value }
|
|
244314
|
+
type: node.type === "mdxJsxFlowElement" ? "html" : "html_inline",
|
|
244315
|
+
value: string3.trim(),
|
|
244316
|
+
children: [{ type: "text", text: "" }]
|
|
244271
244317
|
};
|
|
244272
244318
|
}
|
|
244319
|
+
if (template.match) {
|
|
244320
|
+
const firstChild = node == null ? void 0 : node.children[0];
|
|
244321
|
+
if ((firstChild == null ? void 0 : firstChild.type) === "inlineCode") {
|
|
244322
|
+
const value = firstChild.value;
|
|
244323
|
+
if (node.type === "mdxJsxFlowElement") {
|
|
244324
|
+
return {
|
|
244325
|
+
type: node.type,
|
|
244326
|
+
name: node.name,
|
|
244327
|
+
children: [{ type: "text", text: "" }],
|
|
244328
|
+
props: { text: value }
|
|
244329
|
+
};
|
|
244330
|
+
} else {
|
|
244331
|
+
return {
|
|
244332
|
+
type: node.type,
|
|
244333
|
+
name: node.name,
|
|
244334
|
+
children: [{ type: "text", text: "" }],
|
|
244335
|
+
props: { text: value }
|
|
244336
|
+
};
|
|
244337
|
+
}
|
|
244338
|
+
} else {
|
|
244339
|
+
throw new Error(`Unable to parse value for template match pattern - start: ${template.match.start}, end: ${template.match.end}`);
|
|
244340
|
+
}
|
|
244341
|
+
}
|
|
244342
|
+
const props = extractAttributes(node.attributes, template.fields, imageCallback);
|
|
244343
|
+
const childField = template.fields.find((field2) => field2.name === "children");
|
|
244344
|
+
if (childField) {
|
|
244345
|
+
if (childField.type === "rich-text") {
|
|
244346
|
+
props.children = remarkToSlate(node, childField, imageCallback);
|
|
244347
|
+
}
|
|
244348
|
+
}
|
|
244349
|
+
return {
|
|
244350
|
+
type: node.type,
|
|
244351
|
+
name: node.name,
|
|
244352
|
+
children: [{ type: "text", text: "" }],
|
|
244353
|
+
props
|
|
244354
|
+
};
|
|
244355
|
+
} catch (e) {
|
|
244356
|
+
if (e instanceof Error) {
|
|
244357
|
+
throw new RichTextParseError(e.message, node.position);
|
|
244358
|
+
}
|
|
244359
|
+
throw e;
|
|
244273
244360
|
}
|
|
244274
|
-
const props = extractAttributes(node.attributes, template.fields, imageCallback);
|
|
244275
|
-
const childField = template.fields.find((field2) => field2.name === "children");
|
|
244276
|
-
if (childField) {
|
|
244277
|
-
const childProps = remarkToSlate(node, childField, imageCallback);
|
|
244278
|
-
props.children = childProps;
|
|
244279
|
-
}
|
|
244280
|
-
return {
|
|
244281
|
-
type: node.type,
|
|
244282
|
-
name: node.name,
|
|
244283
|
-
children: [{ type: "text", text: "" }],
|
|
244284
|
-
props
|
|
244285
|
-
};
|
|
244286
244361
|
}
|
|
244287
244362
|
|
|
244288
244363
|
// src/parse/remarkToPlate.ts
|
|
244289
|
-
var remarkToSlate = (
|
|
244364
|
+
var remarkToSlate = (root3, field, imageCallback) => {
|
|
244290
244365
|
const content3 = (content4) => {
|
|
244291
244366
|
switch (content4.type) {
|
|
244292
244367
|
case "blockquote":
|
|
@@ -244320,23 +244395,31 @@ var remarkToSlate = (root2, field, imageCallback) => {
|
|
|
244320
244395
|
children: [
|
|
244321
244396
|
{
|
|
244322
244397
|
type: "lic",
|
|
244323
|
-
children: content4.children.map((child) =>
|
|
244398
|
+
children: flatten_default(content4.children.map((child) => unwrapBlockContent(child)))
|
|
244324
244399
|
}
|
|
244325
244400
|
]
|
|
244326
244401
|
};
|
|
244327
244402
|
case "list":
|
|
244328
244403
|
return list3(content4);
|
|
244329
244404
|
case "html":
|
|
244330
|
-
return html2(content4
|
|
244331
|
-
case "
|
|
244332
|
-
|
|
244405
|
+
return html2(content4);
|
|
244406
|
+
case "mdxFlowExpression":
|
|
244407
|
+
case "mdxjsEsm":
|
|
244408
|
+
throw new RichTextParseError(`Unexpected expression ${content4.value}.`, content4.position);
|
|
244333
244409
|
default:
|
|
244334
|
-
throw new
|
|
244410
|
+
throw new RichTextParseError(`Content: ${content4.type} is not yet supported`, content4.position);
|
|
244335
244411
|
}
|
|
244336
244412
|
};
|
|
244337
|
-
const html2 = (content4
|
|
244413
|
+
const html2 = (content4) => {
|
|
244338
244414
|
return {
|
|
244339
|
-
type:
|
|
244415
|
+
type: "html",
|
|
244416
|
+
value: content4.value,
|
|
244417
|
+
children: [{ type: "text", text: "" }]
|
|
244418
|
+
};
|
|
244419
|
+
};
|
|
244420
|
+
const html_inline = (content4) => {
|
|
244421
|
+
return {
|
|
244422
|
+
type: "html_inline",
|
|
244340
244423
|
value: content4.value,
|
|
244341
244424
|
children: [{ type: "text", text: "" }]
|
|
244342
244425
|
};
|
|
@@ -244347,9 +244430,6 @@ var remarkToSlate = (root2, field, imageCallback) => {
|
|
|
244347
244430
|
children: content4.children.map((child) => listItem2(child))
|
|
244348
244431
|
};
|
|
244349
244432
|
};
|
|
244350
|
-
const toArray = (item) => {
|
|
244351
|
-
return Array.isArray(item) ? item : [item];
|
|
244352
|
-
};
|
|
244353
244433
|
const listItem2 = (content4) => {
|
|
244354
244434
|
return {
|
|
244355
244435
|
type: "li",
|
|
@@ -244361,7 +244441,7 @@ var remarkToSlate = (root2, field, imageCallback) => {
|
|
|
244361
244441
|
case "paragraph":
|
|
244362
244442
|
return {
|
|
244363
244443
|
type: "lic",
|
|
244364
|
-
children: (
|
|
244444
|
+
children: flatten_default(child.children.map((child2) => phrasingContent(child2)))
|
|
244365
244445
|
};
|
|
244366
244446
|
case "blockquote": {
|
|
244367
244447
|
return __spreadProps(__spreadValues({}, blockquote2(child)), {
|
|
@@ -244389,7 +244469,7 @@ var remarkToSlate = (root2, field, imageCallback) => {
|
|
|
244389
244469
|
const unwrapBlockContent = (content4) => {
|
|
244390
244470
|
const flattenPhrasingContent = (children) => {
|
|
244391
244471
|
const children2 = children.map((child) => phrasingContent(child));
|
|
244392
|
-
return (
|
|
244472
|
+
return flatten_default(Array.isArray(children2) ? children2 : [children2]);
|
|
244393
244473
|
};
|
|
244394
244474
|
switch (content4.type) {
|
|
244395
244475
|
case "heading":
|
|
@@ -244400,25 +244480,28 @@ var remarkToSlate = (root2, field, imageCallback) => {
|
|
|
244400
244480
|
}
|
|
244401
244481
|
};
|
|
244402
244482
|
const code2 = (content4) => {
|
|
244403
|
-
|
|
244404
|
-
|
|
244405
|
-
lang
|
|
244483
|
+
const extra = {};
|
|
244484
|
+
if (content4.lang)
|
|
244485
|
+
extra["lang"] = content4.lang;
|
|
244486
|
+
return __spreadProps(__spreadValues({
|
|
244487
|
+
type: "code_block"
|
|
244488
|
+
}, extra), {
|
|
244406
244489
|
value: content4.value,
|
|
244407
244490
|
children: [{ type: "text", text: "" }]
|
|
244408
|
-
};
|
|
244491
|
+
});
|
|
244409
244492
|
};
|
|
244410
244493
|
const link2 = (content4) => {
|
|
244411
244494
|
return {
|
|
244412
244495
|
type: "a",
|
|
244413
244496
|
url: content4.url,
|
|
244414
244497
|
title: content4.title,
|
|
244415
|
-
children: (
|
|
244498
|
+
children: flatten_default(content4.children.map((child) => staticPhrasingContent(child)))
|
|
244416
244499
|
};
|
|
244417
244500
|
};
|
|
244418
244501
|
const heading2 = (content4) => {
|
|
244419
244502
|
return {
|
|
244420
244503
|
type: ["h1", "h2", "h3", "h4", "h5", "h6"][content4.depth - 1],
|
|
244421
|
-
children: (
|
|
244504
|
+
children: flatten_default(content4.children.map(phrasingContent))
|
|
244422
244505
|
};
|
|
244423
244506
|
};
|
|
244424
244507
|
const staticPhrasingContent = (content4) => {
|
|
@@ -244426,7 +244509,7 @@ var remarkToSlate = (root2, field, imageCallback) => {
|
|
|
244426
244509
|
case "mdxJsxTextElement":
|
|
244427
244510
|
return mdxJsxElement(content4, field, imageCallback);
|
|
244428
244511
|
case "text":
|
|
244429
|
-
return
|
|
244512
|
+
return text5(content4);
|
|
244430
244513
|
case "inlineCode":
|
|
244431
244514
|
case "emphasis":
|
|
244432
244515
|
case "image":
|
|
@@ -244439,7 +244522,7 @@ var remarkToSlate = (root2, field, imageCallback) => {
|
|
|
244439
244522
|
const phrasingContent = (content4) => {
|
|
244440
244523
|
switch (content4.type) {
|
|
244441
244524
|
case "text":
|
|
244442
|
-
return
|
|
244525
|
+
return text5(content4);
|
|
244443
244526
|
case "link":
|
|
244444
244527
|
return link2(content4);
|
|
244445
244528
|
case "image":
|
|
@@ -244455,7 +244538,9 @@ var remarkToSlate = (root2, field, imageCallback) => {
|
|
|
244455
244538
|
case "inlineCode":
|
|
244456
244539
|
return phrashingMark(content4);
|
|
244457
244540
|
case "html":
|
|
244458
|
-
return
|
|
244541
|
+
return html_inline(content4);
|
|
244542
|
+
case "mdxTextExpression":
|
|
244543
|
+
throw new RichTextParseError(`Unexpected expression ${content4.value}.`, content4.position);
|
|
244459
244544
|
default:
|
|
244460
244545
|
throw new Error(`PhrasingContent: ${content4.type} is not yet supported`);
|
|
244461
244546
|
}
|
|
@@ -244475,7 +244560,7 @@ var remarkToSlate = (root2, field, imageCallback) => {
|
|
|
244475
244560
|
const accum = [];
|
|
244476
244561
|
switch (node.type) {
|
|
244477
244562
|
case "emphasis": {
|
|
244478
|
-
const children = (
|
|
244563
|
+
const children = flatten_default(node.children.map((child) => phrashingMark(child, [...marks, "italic"])));
|
|
244479
244564
|
children.forEach((child) => {
|
|
244480
244565
|
accum.push(child);
|
|
244481
244566
|
});
|
|
@@ -244492,7 +244577,7 @@ var remarkToSlate = (root2, field, imageCallback) => {
|
|
|
244492
244577
|
break;
|
|
244493
244578
|
}
|
|
244494
244579
|
case "strong": {
|
|
244495
|
-
const children = (
|
|
244580
|
+
const children = flatten_default(node.children.map((child) => phrashingMark(child, [...marks, "bold"])));
|
|
244496
244581
|
children.forEach((child) => {
|
|
244497
244582
|
accum.push(child);
|
|
244498
244583
|
});
|
|
@@ -244503,7 +244588,7 @@ var remarkToSlate = (root2, field, imageCallback) => {
|
|
|
244503
244588
|
break;
|
|
244504
244589
|
}
|
|
244505
244590
|
case "link": {
|
|
244506
|
-
const children = (
|
|
244591
|
+
const children = flatten_default(node.children.map((child) => phrashingMark(child, marks)));
|
|
244507
244592
|
accum.push({ type: "a", url: node.url, title: node.title, children });
|
|
244508
244593
|
break;
|
|
244509
244594
|
}
|
|
@@ -244526,7 +244611,7 @@ var remarkToSlate = (root2, field, imageCallback) => {
|
|
|
244526
244611
|
children: [{ type: "text", text: "" }]
|
|
244527
244612
|
};
|
|
244528
244613
|
};
|
|
244529
|
-
const
|
|
244614
|
+
const text5 = (content4) => {
|
|
244530
244615
|
return {
|
|
244531
244616
|
type: "text",
|
|
244532
244617
|
text: content4.value
|
|
@@ -244546,12 +244631,14 @@ var remarkToSlate = (root2, field, imageCallback) => {
|
|
|
244546
244631
|
};
|
|
244547
244632
|
};
|
|
244548
244633
|
const paragraph2 = (content4) => {
|
|
244549
|
-
const children = (
|
|
244634
|
+
const children = flatten_default(content4.children.map(phrasingContent));
|
|
244550
244635
|
if (children.length === 1) {
|
|
244551
|
-
if (children[0]
|
|
244552
|
-
|
|
244553
|
-
|
|
244554
|
-
|
|
244636
|
+
if (children[0]) {
|
|
244637
|
+
if (children[0].type === "html_inline") {
|
|
244638
|
+
return __spreadProps(__spreadValues({}, children[0]), {
|
|
244639
|
+
type: "html"
|
|
244640
|
+
});
|
|
244641
|
+
}
|
|
244555
244642
|
}
|
|
244556
244643
|
}
|
|
244557
244644
|
return {
|
|
@@ -244559,57 +244646,81 @@ var remarkToSlate = (root2, field, imageCallback) => {
|
|
|
244559
244646
|
children
|
|
244560
244647
|
};
|
|
244561
244648
|
};
|
|
244562
|
-
const blockContent = (content4) => {
|
|
244563
|
-
switch (content4.type) {
|
|
244564
|
-
case "blockquote":
|
|
244565
|
-
return blockquote2(content4);
|
|
244566
|
-
case "paragraph":
|
|
244567
|
-
return paragraph2(content4);
|
|
244568
|
-
case "thematicBreak":
|
|
244569
|
-
return {
|
|
244570
|
-
type: "hr",
|
|
244571
|
-
children: [{ type: "text", text: "" }]
|
|
244572
|
-
};
|
|
244573
|
-
case "code":
|
|
244574
|
-
case "heading":
|
|
244575
|
-
case "html":
|
|
244576
|
-
case "list":
|
|
244577
|
-
case "table":
|
|
244578
|
-
default:
|
|
244579
|
-
throw new Error(`BlockContent: ${content4.type} is not yet supported`);
|
|
244580
|
-
}
|
|
244581
|
-
};
|
|
244582
244649
|
return {
|
|
244583
244650
|
type: "root",
|
|
244584
|
-
children:
|
|
244651
|
+
children: root3.children.map((child) => {
|
|
244652
|
+
return content3(child);
|
|
244653
|
+
})
|
|
244585
244654
|
};
|
|
244586
244655
|
};
|
|
244656
|
+
var RichTextParseError = class extends Error {
|
|
244657
|
+
constructor(message, position2) {
|
|
244658
|
+
super(message);
|
|
244659
|
+
if (Error.captureStackTrace) {
|
|
244660
|
+
Error.captureStackTrace(this, RichTextParseError);
|
|
244661
|
+
}
|
|
244662
|
+
this.name = "RichTextParseError";
|
|
244663
|
+
this.position = position2;
|
|
244664
|
+
}
|
|
244665
|
+
};
|
|
244587
244666
|
|
|
244588
244667
|
// src/parse/index.ts
|
|
244589
|
-
var markdownToAst = (value,
|
|
244668
|
+
var markdownToAst = (value, field) => {
|
|
244590
244669
|
var _a;
|
|
244591
|
-
|
|
244592
|
-
|
|
244593
|
-
|
|
244594
|
-
|
|
244670
|
+
const templatesWithMatchers = (_a = field.templates) == null ? void 0 : _a.filter((template) => template.match);
|
|
244671
|
+
let preprocessedString = value;
|
|
244672
|
+
templatesWithMatchers == null ? void 0 : templatesWithMatchers.forEach((template) => {
|
|
244673
|
+
if (typeof template === "string") {
|
|
244674
|
+
throw new Error("Global templates are not supported");
|
|
244675
|
+
}
|
|
244676
|
+
if (template.match) {
|
|
244595
244677
|
preprocessedString = preprocessedString.replaceAll(template.match.start, `<${template.name}>\``);
|
|
244596
244678
|
preprocessedString = preprocessedString.replaceAll(template.match.end, `\`</${template.name}>`);
|
|
244597
|
-
}
|
|
244679
|
+
}
|
|
244680
|
+
});
|
|
244681
|
+
try {
|
|
244598
244682
|
const tree = remark().use(remarkMdx).parse(preprocessedString);
|
|
244599
244683
|
if (!tree) {
|
|
244600
244684
|
throw new Error("Error parsing markdown");
|
|
244601
244685
|
}
|
|
244602
|
-
visit(tree, (node) => {
|
|
244603
|
-
delete node.position;
|
|
244604
|
-
});
|
|
244605
244686
|
return tree;
|
|
244606
244687
|
} catch (e) {
|
|
244607
|
-
|
|
244688
|
+
throw new RichTextParseError(e, e.position);
|
|
244608
244689
|
}
|
|
244609
244690
|
};
|
|
244610
|
-
var
|
|
244611
|
-
|
|
244612
|
-
|
|
244691
|
+
var MDX_PARSE_ERROR_MSG = "TinaCMS supports a stricter version of markdown and a subset of MDX. https://tina.io/docs/editing/mdx/#differences-from-other-mdx-implementations";
|
|
244692
|
+
var parseMDX = (value, field, imageCallback) => {
|
|
244693
|
+
let tree;
|
|
244694
|
+
try {
|
|
244695
|
+
tree = markdownToAst(value, field);
|
|
244696
|
+
if (tree) {
|
|
244697
|
+
return remarkToSlate(tree, field, imageCallback);
|
|
244698
|
+
} else {
|
|
244699
|
+
return { type: "root", children: [] };
|
|
244700
|
+
}
|
|
244701
|
+
} catch (e) {
|
|
244702
|
+
if (e instanceof RichTextParseError) {
|
|
244703
|
+
return invalidMarkdown(e, value);
|
|
244704
|
+
}
|
|
244705
|
+
throw e;
|
|
244706
|
+
}
|
|
244707
|
+
};
|
|
244708
|
+
var invalidMarkdown = (e, value) => {
|
|
244709
|
+
const extra = {};
|
|
244710
|
+
if (e.position && Object.keys(e.position).length) {
|
|
244711
|
+
extra["position"] = e.position;
|
|
244712
|
+
}
|
|
244713
|
+
return {
|
|
244714
|
+
type: "root",
|
|
244715
|
+
children: [
|
|
244716
|
+
__spreadValues({
|
|
244717
|
+
type: "invalid_markdown",
|
|
244718
|
+
value,
|
|
244719
|
+
message: e.message || `Error parsing markdown ${MDX_PARSE_ERROR_MSG}`,
|
|
244720
|
+
children: [{ type: "text", text: "" }]
|
|
244721
|
+
}, extra)
|
|
244722
|
+
]
|
|
244723
|
+
};
|
|
244613
244724
|
};
|
|
244614
244725
|
|
|
244615
244726
|
// src/stringify/acorn.ts
|
|
@@ -244617,7 +244728,7 @@ var import_prettier = __toModule(require_prettier());
|
|
|
244617
244728
|
var stringifyPropsInline = (element, field, imageCallback) => {
|
|
244618
244729
|
return stringifyProps(element, field, true, imageCallback);
|
|
244619
244730
|
};
|
|
244620
|
-
|
|
244731
|
+
function stringifyProps(element, parentField, flatten2, imageCallback) {
|
|
244621
244732
|
var _a;
|
|
244622
244733
|
const attributes = [];
|
|
244623
244734
|
const children = [];
|
|
@@ -244641,69 +244752,91 @@ var stringifyProps = (element, parentField, flatten2, imageCallback) => {
|
|
|
244641
244752
|
switch (field.type) {
|
|
244642
244753
|
case "reference":
|
|
244643
244754
|
if (field.list) {
|
|
244644
|
-
|
|
244645
|
-
|
|
244646
|
-
|
|
244647
|
-
|
|
244648
|
-
|
|
244649
|
-
|
|
244650
|
-
|
|
244651
|
-
|
|
244755
|
+
if (Array.isArray(value)) {
|
|
244756
|
+
attributes.push({
|
|
244757
|
+
type: "mdxJsxAttribute",
|
|
244758
|
+
name,
|
|
244759
|
+
value: {
|
|
244760
|
+
type: "mdxJsxAttributeValueExpression",
|
|
244761
|
+
value: `[${value.map((item) => `"${item}"`).join(", ")}]`
|
|
244762
|
+
}
|
|
244763
|
+
});
|
|
244764
|
+
}
|
|
244652
244765
|
} else {
|
|
244653
|
-
|
|
244654
|
-
|
|
244655
|
-
|
|
244656
|
-
|
|
244657
|
-
|
|
244766
|
+
if (typeof value === "string") {
|
|
244767
|
+
attributes.push({
|
|
244768
|
+
type: "mdxJsxAttribute",
|
|
244769
|
+
name,
|
|
244770
|
+
value
|
|
244771
|
+
});
|
|
244772
|
+
}
|
|
244658
244773
|
}
|
|
244659
244774
|
break;
|
|
244660
244775
|
case "datetime":
|
|
244661
244776
|
case "string":
|
|
244662
244777
|
if (field.list) {
|
|
244663
|
-
|
|
244664
|
-
|
|
244665
|
-
|
|
244666
|
-
|
|
244667
|
-
|
|
244668
|
-
|
|
244669
|
-
|
|
244670
|
-
|
|
244778
|
+
if (Array.isArray(value)) {
|
|
244779
|
+
attributes.push({
|
|
244780
|
+
type: "mdxJsxAttribute",
|
|
244781
|
+
name,
|
|
244782
|
+
value: {
|
|
244783
|
+
type: "mdxJsxAttributeValueExpression",
|
|
244784
|
+
value: `[${value.map((item) => `"${item}"`).join(", ")}]`
|
|
244785
|
+
}
|
|
244786
|
+
});
|
|
244787
|
+
}
|
|
244671
244788
|
} else {
|
|
244672
|
-
|
|
244673
|
-
|
|
244674
|
-
|
|
244675
|
-
|
|
244676
|
-
|
|
244789
|
+
if (typeof value === "string") {
|
|
244790
|
+
attributes.push({
|
|
244791
|
+
type: "mdxJsxAttribute",
|
|
244792
|
+
name,
|
|
244793
|
+
value
|
|
244794
|
+
});
|
|
244795
|
+
} else {
|
|
244796
|
+
throw new Error(`Expected string for attribute on field ${field.name}`);
|
|
244797
|
+
}
|
|
244677
244798
|
}
|
|
244678
244799
|
break;
|
|
244679
244800
|
case "image":
|
|
244680
244801
|
if (field.list) {
|
|
244681
|
-
|
|
244682
|
-
|
|
244683
|
-
|
|
244684
|
-
|
|
244685
|
-
|
|
244686
|
-
|
|
244687
|
-
|
|
244688
|
-
|
|
244802
|
+
if (Array.isArray(value)) {
|
|
244803
|
+
attributes.push({
|
|
244804
|
+
type: "mdxJsxAttribute",
|
|
244805
|
+
name,
|
|
244806
|
+
value: {
|
|
244807
|
+
type: "mdxJsxAttributeValueExpression",
|
|
244808
|
+
value: `[${value.map((item) => `"${imageCallback(item)}"`).join(", ")}]`
|
|
244809
|
+
}
|
|
244810
|
+
});
|
|
244811
|
+
}
|
|
244689
244812
|
} else {
|
|
244690
244813
|
attributes.push({
|
|
244691
244814
|
type: "mdxJsxAttribute",
|
|
244692
244815
|
name,
|
|
244693
|
-
value: imageCallback(value)
|
|
244816
|
+
value: imageCallback(String(value))
|
|
244694
244817
|
});
|
|
244695
244818
|
}
|
|
244696
244819
|
break;
|
|
244697
244820
|
case "number":
|
|
244698
244821
|
case "boolean":
|
|
244699
244822
|
if (field.list) {
|
|
244823
|
+
if (Array.isArray(value)) {
|
|
244824
|
+
attributes.push({
|
|
244825
|
+
type: "mdxJsxAttribute",
|
|
244826
|
+
name,
|
|
244827
|
+
value: {
|
|
244828
|
+
type: "mdxJsxAttributeValueExpression",
|
|
244829
|
+
value: `[${value.map((item) => `${item}`).join(", ")}]`
|
|
244830
|
+
}
|
|
244831
|
+
});
|
|
244832
|
+
}
|
|
244700
244833
|
} else {
|
|
244701
244834
|
attributes.push({
|
|
244702
244835
|
type: "mdxJsxAttribute",
|
|
244703
244836
|
name,
|
|
244704
244837
|
value: {
|
|
244705
244838
|
type: "mdxJsxAttributeValueExpression",
|
|
244706
|
-
value
|
|
244839
|
+
value: String(value)
|
|
244707
244840
|
}
|
|
244708
244841
|
});
|
|
244709
244842
|
}
|
|
@@ -244727,14 +244860,15 @@ var stringifyProps = (element, parentField, flatten2, imageCallback) => {
|
|
|
244727
244860
|
} else {
|
|
244728
244861
|
const joiner = flatten2 ? " " : "\n";
|
|
244729
244862
|
let val = "";
|
|
244863
|
+
assertShape(value, (value2) => value2.type === "root" && Array.isArray(value2.children), `Nested rich-text element is not a valid shape for field ${field.name}`);
|
|
244730
244864
|
if (field.name === "children") {
|
|
244731
|
-
const
|
|
244732
|
-
|
|
244865
|
+
const root3 = rootElement(value, field, imageCallback);
|
|
244866
|
+
root3.children.forEach((child) => {
|
|
244733
244867
|
children.push(child);
|
|
244734
244868
|
});
|
|
244735
244869
|
return;
|
|
244736
244870
|
} else {
|
|
244737
|
-
const stringValue = stringifyMDX(value, field);
|
|
244871
|
+
const stringValue = stringifyMDX(value, field, imageCallback);
|
|
244738
244872
|
val = stringValue.trim().split("\n").map((str) => ` ${str.trim()}`).join(joiner);
|
|
244739
244873
|
}
|
|
244740
244874
|
if (flatten2) {
|
|
@@ -244764,16 +244898,34 @@ ${val}
|
|
|
244764
244898
|
throw new Error(`Stringify props: ${field.type} not yet supported`);
|
|
244765
244899
|
}
|
|
244766
244900
|
});
|
|
244901
|
+
if (template.match) {
|
|
244902
|
+
if (attributes[0] && typeof attributes[0].value === "string") {
|
|
244903
|
+
return {
|
|
244904
|
+
attributes: [],
|
|
244905
|
+
children: [{ type: "inlineCode", value: attributes[0].value }]
|
|
244906
|
+
};
|
|
244907
|
+
}
|
|
244908
|
+
}
|
|
244767
244909
|
return { attributes, children };
|
|
244768
|
-
}
|
|
244910
|
+
}
|
|
244769
244911
|
function stringifyObj(obj, flatten2) {
|
|
244770
|
-
|
|
244771
|
-
|
|
244772
|
-
|
|
244773
|
-
|
|
244774
|
-
|
|
244775
|
-
|
|
244776
|
-
|
|
244912
|
+
if (typeof obj === "object" && obj !== null) {
|
|
244913
|
+
const dummyFunc = `const dummyFunc = `;
|
|
244914
|
+
const res = (0, import_prettier.format)(`${dummyFunc}${JSON.stringify(obj)}`, {
|
|
244915
|
+
parser: "acorn",
|
|
244916
|
+
trailingComma: "none",
|
|
244917
|
+
semi: false
|
|
244918
|
+
}).trim().replace(dummyFunc, "");
|
|
244919
|
+
return flatten2 ? res.replaceAll("\n", "").replaceAll(" ", " ") : res;
|
|
244920
|
+
} else {
|
|
244921
|
+
console.log(obj);
|
|
244922
|
+
throw new Error(`stringifyObj must be passed an object or an array of objects, received ${typeof obj}`);
|
|
244923
|
+
}
|
|
244924
|
+
}
|
|
244925
|
+
function assertShape(value, callback, errorMessage) {
|
|
244926
|
+
if (!callback(value)) {
|
|
244927
|
+
throw new Error(errorMessage || `Failed to assert shape`);
|
|
244928
|
+
}
|
|
244777
244929
|
}
|
|
244778
244930
|
|
|
244779
244931
|
// src/stringify/marks.ts
|
|
@@ -244793,12 +244945,7 @@ var replaceLinksWithTextNodes = (content3) => {
|
|
|
244793
244945
|
type: "link",
|
|
244794
244946
|
url: item.url,
|
|
244795
244947
|
title: item.title,
|
|
244796
|
-
children: [
|
|
244797
|
-
{
|
|
244798
|
-
type: "text",
|
|
244799
|
-
value: a.value
|
|
244800
|
-
}
|
|
244801
|
-
]
|
|
244948
|
+
children: [text4({ text: a.value })]
|
|
244802
244949
|
};
|
|
244803
244950
|
}
|
|
244804
244951
|
}));
|
|
@@ -244831,15 +244978,6 @@ var inlineElementExceptLink = (content3, field, imageCallback) => {
|
|
|
244831
244978
|
};
|
|
244832
244979
|
case "mdxJsxTextElement": {
|
|
244833
244980
|
const { attributes, children } = stringifyPropsInline(content3, field, imageCallback);
|
|
244834
|
-
const template = field.templates.find((template2) => template2.name === content3.name);
|
|
244835
|
-
if (template.match) {
|
|
244836
|
-
return {
|
|
244837
|
-
type: "mdxJsxTextElement",
|
|
244838
|
-
name: content3.name,
|
|
244839
|
-
attributes: [],
|
|
244840
|
-
children: [{ type: "inlineCode", value: attributes[0].value }]
|
|
244841
|
-
};
|
|
244842
|
-
}
|
|
244843
244981
|
return {
|
|
244844
244982
|
type: "mdxJsxTextElement",
|
|
244845
244983
|
name: content3.name,
|
|
@@ -244855,14 +244993,17 @@ var inlineElementExceptLink = (content3, field, imageCallback) => {
|
|
|
244855
244993
|
}
|
|
244856
244994
|
default:
|
|
244857
244995
|
if (!content3.type && typeof content3.text === "string") {
|
|
244858
|
-
return
|
|
244859
|
-
type: "text",
|
|
244860
|
-
value: content3.text
|
|
244861
|
-
};
|
|
244996
|
+
return text4(content3);
|
|
244862
244997
|
}
|
|
244863
|
-
throw new Error(`InlineElement: ${content3.type} is not
|
|
244998
|
+
throw new Error(`InlineElement: ${content3.type} is not supported`);
|
|
244864
244999
|
}
|
|
244865
245000
|
};
|
|
245001
|
+
var text4 = (content3) => {
|
|
245002
|
+
return {
|
|
245003
|
+
type: "text",
|
|
245004
|
+
value: content3.text
|
|
245005
|
+
};
|
|
245006
|
+
};
|
|
244866
245007
|
var eat2 = (c, field, imageCallback) => {
|
|
244867
245008
|
const content3 = replaceLinksWithTextNodes(c);
|
|
244868
245009
|
const first = content3[0];
|
|
@@ -244879,14 +245020,11 @@ var eat2 = (c, field, imageCallback) => {
|
|
|
244879
245020
|
if (marks.length === 0) {
|
|
244880
245021
|
if (first.linkifyTextNode) {
|
|
244881
245022
|
return [
|
|
244882
|
-
first.linkifyTextNode(
|
|
245023
|
+
first.linkifyTextNode(text4(first)),
|
|
244883
245024
|
...eat2(content3.slice(1), field, imageCallback)
|
|
244884
245025
|
];
|
|
244885
245026
|
} else {
|
|
244886
|
-
return [
|
|
244887
|
-
{ type: "text", value: first.text },
|
|
244888
|
-
...eat2(content3.slice(1), field, imageCallback)
|
|
244889
|
-
];
|
|
245027
|
+
return [text4(first), ...eat2(content3.slice(1), field, imageCallback)];
|
|
244890
245028
|
}
|
|
244891
245029
|
}
|
|
244892
245030
|
let nonMatchingSiblingIndex = 0;
|
|
@@ -244922,13 +245060,7 @@ var eat2 = (c, field, imageCallback) => {
|
|
|
244922
245060
|
}
|
|
244923
245061
|
});
|
|
244924
245062
|
if (!markToProcess) {
|
|
244925
|
-
return [
|
|
244926
|
-
{
|
|
244927
|
-
type: "text",
|
|
244928
|
-
value: first.text
|
|
244929
|
-
},
|
|
244930
|
-
...eat2(content3.slice(1), field, imageCallback)
|
|
244931
|
-
];
|
|
245063
|
+
return [text4(first), ...eat2(content3.slice(1), field, imageCallback)];
|
|
244932
245064
|
}
|
|
244933
245065
|
if (markToProcess === "inlineCode") {
|
|
244934
245066
|
if (nonMatchingSiblingIndex) {
|
|
@@ -244976,6 +245108,11 @@ var cleanNode = (node, mark) => {
|
|
|
244976
245108
|
// src/stringify/index.ts
|
|
244977
245109
|
var stringifyMDX = (value, field, imageCallback) => {
|
|
244978
245110
|
var _a;
|
|
245111
|
+
if (value == null ? void 0 : value.children[0]) {
|
|
245112
|
+
if ((value == null ? void 0 : value.children[0].type) === "invalid_markdown") {
|
|
245113
|
+
return value.children[0].value;
|
|
245114
|
+
}
|
|
245115
|
+
}
|
|
244979
245116
|
const res = toMarkdown(rootElement(value, field, imageCallback), {
|
|
244980
245117
|
extensions: [mdxJsxToMarkdown()],
|
|
244981
245118
|
listItemIndent: "one"
|
|
@@ -244983,15 +245120,20 @@ var stringifyMDX = (value, field, imageCallback) => {
|
|
|
244983
245120
|
const templatesWithMatchers = (_a = field.templates) == null ? void 0 : _a.filter((template) => template.match);
|
|
244984
245121
|
let preprocessedString = res;
|
|
244985
245122
|
templatesWithMatchers == null ? void 0 : templatesWithMatchers.forEach((template) => {
|
|
244986
|
-
|
|
244987
|
-
|
|
245123
|
+
if (typeof template === "string") {
|
|
245124
|
+
throw new Error("Global templates are not supported");
|
|
245125
|
+
}
|
|
245126
|
+
if (template.match) {
|
|
245127
|
+
preprocessedString = preprocessedString.replaceAll(`<${template.name}>\``, `${template.match.start} `);
|
|
245128
|
+
preprocessedString = preprocessedString.replaceAll(`\`</${template.name}>`, ` ${template.match.end}`);
|
|
245129
|
+
}
|
|
244988
245130
|
});
|
|
244989
245131
|
return preprocessedString;
|
|
244990
245132
|
};
|
|
244991
245133
|
var rootElement = (content3, field, imageCallback) => {
|
|
244992
245134
|
const children = [];
|
|
244993
245135
|
content3.children.forEach((child) => {
|
|
244994
|
-
const value =
|
|
245136
|
+
const value = blockElement(child, field, imageCallback);
|
|
244995
245137
|
if (value) {
|
|
244996
245138
|
children.push(value);
|
|
244997
245139
|
}
|
|
@@ -245001,7 +245143,7 @@ var rootElement = (content3, field, imageCallback) => {
|
|
|
245001
245143
|
children
|
|
245002
245144
|
};
|
|
245003
245145
|
};
|
|
245004
|
-
var
|
|
245146
|
+
var blockElement = (content3, field, imageCallback) => {
|
|
245005
245147
|
switch (content3.type) {
|
|
245006
245148
|
case "h1":
|
|
245007
245149
|
case "h2":
|
|
@@ -245061,14 +245203,12 @@ var blockElement2 = (content3, field, imageCallback) => {
|
|
|
245061
245203
|
spread: false,
|
|
245062
245204
|
children: content3.children.map((child) => listItemElement(child, field, imageCallback))
|
|
245063
245205
|
};
|
|
245064
|
-
case "html":
|
|
245065
|
-
{
|
|
245066
|
-
|
|
245067
|
-
|
|
245068
|
-
|
|
245069
|
-
|
|
245070
|
-
}
|
|
245071
|
-
break;
|
|
245206
|
+
case "html": {
|
|
245207
|
+
return {
|
|
245208
|
+
type: "html",
|
|
245209
|
+
value: content3.value
|
|
245210
|
+
};
|
|
245211
|
+
}
|
|
245072
245212
|
default:
|
|
245073
245213
|
throw new Error(`BlockElement: ${content3.type} is not yet supported`);
|
|
245074
245214
|
}
|
|
@@ -245139,3 +245279,12 @@ var getMarks = (content3) => {
|
|
|
245139
245279
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
245140
245280
|
* @license MIT
|
|
245141
245281
|
*/
|
|
245282
|
+
/**
|
|
245283
|
+
* @license
|
|
245284
|
+
* Lodash (Custom Build) <https://lodash.com/>
|
|
245285
|
+
* Build: `lodash modularize exports="es" -o ./`
|
|
245286
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
245287
|
+
* Released under MIT license <https://lodash.com/license>
|
|
245288
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
245289
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
245290
|
+
*/
|