@xyd-js/cli 0.1.0-xyd.18 → 0.1.0-xyd.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cli/dist/index.d.ts +1 -0
- package/.cli/dist/index.js +12417 -0
- package/.cli/host/.react-router/types/app/+types/root.ts +40 -0
- package/.cli/host/app/root.tsx +23 -0
- package/.cli/host/app/routes.ts +5 -0
- package/.cli/host/node_modules/.vite/deps/@mdx-js_mdx.js +81 -0
- package/.cli/host/node_modules/.vite/deps/@mdx-js_mdx.js.map +7 -0
- package/.cli/host/node_modules/.vite/deps/@mdx-js_rollup.js +4003 -0
- package/.cli/host/node_modules/.vite/deps/@mdx-js_rollup.js.map +7 -0
- package/.cli/host/node_modules/.vite/deps/@radix-ui_react-icons.js +7531 -0
- package/.cli/host/node_modules/.vite/deps/@radix-ui_react-icons.js.map +7 -0
- package/.cli/host/node_modules/.vite/deps/@radix-ui_react-tabs.js +917 -0
- package/.cli/host/node_modules/.vite/deps/@radix-ui_react-tabs.js.map +7 -0
- package/.cli/host/node_modules/.vite/deps/_metadata.json +157 -0
- package/.cli/host/node_modules/.vite/deps/chunk-2TUXWMP5.js +46 -0
- package/.cli/host/node_modules/.vite/deps/chunk-2TUXWMP5.js.map +7 -0
- package/.cli/host/node_modules/.vite/deps/chunk-DNIFH2K7.js +3461 -0
- package/.cli/host/node_modules/.vite/deps/chunk-DNIFH2K7.js.map +7 -0
- package/.cli/host/node_modules/.vite/deps/chunk-ERHH4CDL.js +23875 -0
- package/.cli/host/node_modules/.vite/deps/chunk-ERHH4CDL.js.map +7 -0
- package/.cli/host/node_modules/.vite/deps/chunk-ETJV5QNK.js +27 -0
- package/.cli/host/node_modules/.vite/deps/chunk-ETJV5QNK.js.map +7 -0
- package/.cli/host/node_modules/.vite/deps/chunk-GPEJJ3KZ.js +1906 -0
- package/.cli/host/node_modules/.vite/deps/chunk-GPEJJ3KZ.js.map +7 -0
- package/.cli/host/node_modules/.vite/deps/chunk-IVP26VTC.js +21 -0
- package/.cli/host/node_modules/.vite/deps/chunk-IVP26VTC.js.map +7 -0
- package/.cli/host/node_modules/.vite/deps/chunk-MJUUSK53.js +894 -0
- package/.cli/host/node_modules/.vite/deps/chunk-MJUUSK53.js.map +7 -0
- package/.cli/host/node_modules/.vite/deps/chunk-NHN7DW4J.js +928 -0
- package/.cli/host/node_modules/.vite/deps/chunk-NHN7DW4J.js.map +7 -0
- package/.cli/host/node_modules/.vite/deps/chunk-OO6QDGMA.js +10609 -0
- package/.cli/host/node_modules/.vite/deps/chunk-OO6QDGMA.js.map +7 -0
- package/.cli/host/node_modules/.vite/deps/chunk-OUN4SSIE.js +205 -0
- package/.cli/host/node_modules/.vite/deps/chunk-OUN4SSIE.js.map +7 -0
- package/.cli/host/node_modules/.vite/deps/chunk-TKNG6GUJ.js +894 -0
- package/.cli/host/node_modules/.vite/deps/chunk-TKNG6GUJ.js.map +7 -0
- package/.cli/host/node_modules/.vite/deps/chunk-TM4FKLNO.js +21628 -0
- package/.cli/host/node_modules/.vite/deps/chunk-TM4FKLNO.js.map +7 -0
- package/.cli/host/node_modules/.vite/deps/chunk-V2IF7L2E.js +12 -0
- package/.cli/host/node_modules/.vite/deps/chunk-V2IF7L2E.js.map +7 -0
- package/.cli/host/node_modules/.vite/deps/gray-matter.js +3492 -0
- package/.cli/host/node_modules/.vite/deps/gray-matter.js.map +7 -0
- package/.cli/host/node_modules/.vite/deps/lucide-react.js +34742 -0
- package/.cli/host/node_modules/.vite/deps/lucide-react.js.map +7 -0
- package/.cli/host/node_modules/.vite/deps/package.json +3 -0
- package/.cli/host/node_modules/.vite/deps/react-dom.js +7 -0
- package/.cli/host/node_modules/.vite/deps/react-dom.js.map +7 -0
- package/.cli/host/node_modules/.vite/deps/react-dom_client.js +39 -0
- package/.cli/host/node_modules/.vite/deps/react-dom_client.js.map +7 -0
- package/.cli/host/node_modules/.vite/deps/react-router.js +243 -0
- package/.cli/host/node_modules/.vite/deps/react-router.js.map +7 -0
- package/.cli/host/node_modules/.vite/deps/react-router_dom.js +212 -0
- package/.cli/host/node_modules/.vite/deps/react-router_dom.js.map +7 -0
- package/.cli/host/node_modules/.vite/deps/react.js +6 -0
- package/.cli/host/node_modules/.vite/deps/react.js.map +7 -0
- package/.cli/host/node_modules/.vite/deps/react_jsx-dev-runtime.js +913 -0
- package/.cli/host/node_modules/.vite/deps/react_jsx-dev-runtime.js.map +7 -0
- package/.cli/host/node_modules/.vite/deps/react_jsx-runtime.js +7 -0
- package/.cli/host/node_modules/.vite/deps/react_jsx-runtime.js.map +7 -0
- package/.cli/host/node_modules/.vite/deps/remark-frontmatter.js +428 -0
- package/.cli/host/node_modules/.vite/deps/remark-frontmatter.js.map +7 -0
- package/.cli/host/node_modules/.vite/deps/remark-gfm.js +3122 -0
- package/.cli/host/node_modules/.vite/deps/remark-gfm.js.map +7 -0
- package/.cli/host/node_modules/.vite/deps/remark-mdx-frontmatter.js +10482 -0
- package/.cli/host/node_modules/.vite/deps/remark-mdx-frontmatter.js.map +7 -0
- package/.cli/host/node_modules/.vite/deps/unist-util-visit.js +14 -0
- package/.cli/host/node_modules/.vite/deps/unist-util-visit.js.map +7 -0
- package/.cli/host/node_modules/.vite/deps/vfile.js +8 -0
- package/.cli/host/node_modules/.vite/deps/vfile.js.map +7 -0
- package/.cli/host/package.json +43 -0
- package/.cli/host/postcss.config.cjs +5 -0
- package/.cli/host/react-router.config.ts +8 -0
- package/.cli/host/tsconfig.json +22 -0
- package/.cli/host/vite.config.ts +9 -0
- package/.cli/plugins/xyd-plugin-zero/src/pages/api-reference.tsx +406 -0
- package/.cli/plugins/xyd-plugin-zero/src/pages/docs.tsx +166 -0
- package/.cli/plugins/xyd-plugin-zero/src/pages/root.tsx +37 -0
- package/bin.js +3 -0
- package/package.json +15 -13
- package/postinstall.js +0 -15
|
@@ -0,0 +1,4003 @@
|
|
|
1
|
+
import {
|
|
2
|
+
require_fs
|
|
3
|
+
} from "./chunk-IVP26VTC.js";
|
|
4
|
+
import {
|
|
5
|
+
createProcessor,
|
|
6
|
+
md,
|
|
7
|
+
mdx,
|
|
8
|
+
resolveFileAndOptions
|
|
9
|
+
} from "./chunk-ERHH4CDL.js";
|
|
10
|
+
import "./chunk-ETJV5QNK.js";
|
|
11
|
+
import "./chunk-DNIFH2K7.js";
|
|
12
|
+
import "./chunk-MJUUSK53.js";
|
|
13
|
+
import "./chunk-OUN4SSIE.js";
|
|
14
|
+
import {
|
|
15
|
+
VFile
|
|
16
|
+
} from "./chunk-TKNG6GUJ.js";
|
|
17
|
+
import {
|
|
18
|
+
__commonJS,
|
|
19
|
+
__toESM
|
|
20
|
+
} from "./chunk-2TUXWMP5.js";
|
|
21
|
+
|
|
22
|
+
// browser-external:path
|
|
23
|
+
var require_path = __commonJS({
|
|
24
|
+
"browser-external:path"(exports, module) {
|
|
25
|
+
module.exports = Object.create(new Proxy({}, {
|
|
26
|
+
get(_, key) {
|
|
27
|
+
if (key !== "__esModule" && key !== "__proto__" && key !== "constructor" && key !== "splice") {
|
|
28
|
+
console.warn(`Module "path" has been externalized for browser compatibility. Cannot access "path.${key}" in client code. See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}));
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// ../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/constants.js
|
|
36
|
+
var require_constants = __commonJS({
|
|
37
|
+
"../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/constants.js"(exports, module) {
|
|
38
|
+
"use strict";
|
|
39
|
+
var WIN_SLASH = "\\\\/";
|
|
40
|
+
var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
41
|
+
var DOT_LITERAL = "\\.";
|
|
42
|
+
var PLUS_LITERAL = "\\+";
|
|
43
|
+
var QMARK_LITERAL = "\\?";
|
|
44
|
+
var SLASH_LITERAL = "\\/";
|
|
45
|
+
var ONE_CHAR = "(?=.)";
|
|
46
|
+
var QMARK = "[^/]";
|
|
47
|
+
var END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
|
|
48
|
+
var START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
|
|
49
|
+
var DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
|
|
50
|
+
var NO_DOT = `(?!${DOT_LITERAL})`;
|
|
51
|
+
var NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
|
|
52
|
+
var NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
|
|
53
|
+
var NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
|
|
54
|
+
var QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
|
|
55
|
+
var STAR = `${QMARK}*?`;
|
|
56
|
+
var SEP = "/";
|
|
57
|
+
var POSIX_CHARS = {
|
|
58
|
+
DOT_LITERAL,
|
|
59
|
+
PLUS_LITERAL,
|
|
60
|
+
QMARK_LITERAL,
|
|
61
|
+
SLASH_LITERAL,
|
|
62
|
+
ONE_CHAR,
|
|
63
|
+
QMARK,
|
|
64
|
+
END_ANCHOR,
|
|
65
|
+
DOTS_SLASH,
|
|
66
|
+
NO_DOT,
|
|
67
|
+
NO_DOTS,
|
|
68
|
+
NO_DOT_SLASH,
|
|
69
|
+
NO_DOTS_SLASH,
|
|
70
|
+
QMARK_NO_DOT,
|
|
71
|
+
STAR,
|
|
72
|
+
START_ANCHOR,
|
|
73
|
+
SEP
|
|
74
|
+
};
|
|
75
|
+
var WINDOWS_CHARS = {
|
|
76
|
+
...POSIX_CHARS,
|
|
77
|
+
SLASH_LITERAL: `[${WIN_SLASH}]`,
|
|
78
|
+
QMARK: WIN_NO_SLASH,
|
|
79
|
+
STAR: `${WIN_NO_SLASH}*?`,
|
|
80
|
+
DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
|
|
81
|
+
NO_DOT: `(?!${DOT_LITERAL})`,
|
|
82
|
+
NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
83
|
+
NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
|
|
84
|
+
NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
85
|
+
QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
|
|
86
|
+
START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
|
|
87
|
+
END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
|
|
88
|
+
SEP: "\\"
|
|
89
|
+
};
|
|
90
|
+
var POSIX_REGEX_SOURCE = {
|
|
91
|
+
alnum: "a-zA-Z0-9",
|
|
92
|
+
alpha: "a-zA-Z",
|
|
93
|
+
ascii: "\\x00-\\x7F",
|
|
94
|
+
blank: " \\t",
|
|
95
|
+
cntrl: "\\x00-\\x1F\\x7F",
|
|
96
|
+
digit: "0-9",
|
|
97
|
+
graph: "\\x21-\\x7E",
|
|
98
|
+
lower: "a-z",
|
|
99
|
+
print: "\\x20-\\x7E ",
|
|
100
|
+
punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
|
|
101
|
+
space: " \\t\\r\\n\\v\\f",
|
|
102
|
+
upper: "A-Z",
|
|
103
|
+
word: "A-Za-z0-9_",
|
|
104
|
+
xdigit: "A-Fa-f0-9"
|
|
105
|
+
};
|
|
106
|
+
module.exports = {
|
|
107
|
+
MAX_LENGTH: 1024 * 64,
|
|
108
|
+
POSIX_REGEX_SOURCE,
|
|
109
|
+
// regular expressions
|
|
110
|
+
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
|
111
|
+
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
|
112
|
+
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
|
|
113
|
+
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
|
|
114
|
+
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
|
|
115
|
+
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
|
|
116
|
+
// Replace globs with equivalent patterns to reduce parsing time.
|
|
117
|
+
REPLACEMENTS: {
|
|
118
|
+
"***": "*",
|
|
119
|
+
"**/**": "**",
|
|
120
|
+
"**/**/**": "**"
|
|
121
|
+
},
|
|
122
|
+
// Digits
|
|
123
|
+
CHAR_0: 48,
|
|
124
|
+
/* 0 */
|
|
125
|
+
CHAR_9: 57,
|
|
126
|
+
/* 9 */
|
|
127
|
+
// Alphabet chars.
|
|
128
|
+
CHAR_UPPERCASE_A: 65,
|
|
129
|
+
/* A */
|
|
130
|
+
CHAR_LOWERCASE_A: 97,
|
|
131
|
+
/* a */
|
|
132
|
+
CHAR_UPPERCASE_Z: 90,
|
|
133
|
+
/* Z */
|
|
134
|
+
CHAR_LOWERCASE_Z: 122,
|
|
135
|
+
/* z */
|
|
136
|
+
CHAR_LEFT_PARENTHESES: 40,
|
|
137
|
+
/* ( */
|
|
138
|
+
CHAR_RIGHT_PARENTHESES: 41,
|
|
139
|
+
/* ) */
|
|
140
|
+
CHAR_ASTERISK: 42,
|
|
141
|
+
/* * */
|
|
142
|
+
// Non-alphabetic chars.
|
|
143
|
+
CHAR_AMPERSAND: 38,
|
|
144
|
+
/* & */
|
|
145
|
+
CHAR_AT: 64,
|
|
146
|
+
/* @ */
|
|
147
|
+
CHAR_BACKWARD_SLASH: 92,
|
|
148
|
+
/* \ */
|
|
149
|
+
CHAR_CARRIAGE_RETURN: 13,
|
|
150
|
+
/* \r */
|
|
151
|
+
CHAR_CIRCUMFLEX_ACCENT: 94,
|
|
152
|
+
/* ^ */
|
|
153
|
+
CHAR_COLON: 58,
|
|
154
|
+
/* : */
|
|
155
|
+
CHAR_COMMA: 44,
|
|
156
|
+
/* , */
|
|
157
|
+
CHAR_DOT: 46,
|
|
158
|
+
/* . */
|
|
159
|
+
CHAR_DOUBLE_QUOTE: 34,
|
|
160
|
+
/* " */
|
|
161
|
+
CHAR_EQUAL: 61,
|
|
162
|
+
/* = */
|
|
163
|
+
CHAR_EXCLAMATION_MARK: 33,
|
|
164
|
+
/* ! */
|
|
165
|
+
CHAR_FORM_FEED: 12,
|
|
166
|
+
/* \f */
|
|
167
|
+
CHAR_FORWARD_SLASH: 47,
|
|
168
|
+
/* / */
|
|
169
|
+
CHAR_GRAVE_ACCENT: 96,
|
|
170
|
+
/* ` */
|
|
171
|
+
CHAR_HASH: 35,
|
|
172
|
+
/* # */
|
|
173
|
+
CHAR_HYPHEN_MINUS: 45,
|
|
174
|
+
/* - */
|
|
175
|
+
CHAR_LEFT_ANGLE_BRACKET: 60,
|
|
176
|
+
/* < */
|
|
177
|
+
CHAR_LEFT_CURLY_BRACE: 123,
|
|
178
|
+
/* { */
|
|
179
|
+
CHAR_LEFT_SQUARE_BRACKET: 91,
|
|
180
|
+
/* [ */
|
|
181
|
+
CHAR_LINE_FEED: 10,
|
|
182
|
+
/* \n */
|
|
183
|
+
CHAR_NO_BREAK_SPACE: 160,
|
|
184
|
+
/* \u00A0 */
|
|
185
|
+
CHAR_PERCENT: 37,
|
|
186
|
+
/* % */
|
|
187
|
+
CHAR_PLUS: 43,
|
|
188
|
+
/* + */
|
|
189
|
+
CHAR_QUESTION_MARK: 63,
|
|
190
|
+
/* ? */
|
|
191
|
+
CHAR_RIGHT_ANGLE_BRACKET: 62,
|
|
192
|
+
/* > */
|
|
193
|
+
CHAR_RIGHT_CURLY_BRACE: 125,
|
|
194
|
+
/* } */
|
|
195
|
+
CHAR_RIGHT_SQUARE_BRACKET: 93,
|
|
196
|
+
/* ] */
|
|
197
|
+
CHAR_SEMICOLON: 59,
|
|
198
|
+
/* ; */
|
|
199
|
+
CHAR_SINGLE_QUOTE: 39,
|
|
200
|
+
/* ' */
|
|
201
|
+
CHAR_SPACE: 32,
|
|
202
|
+
/* */
|
|
203
|
+
CHAR_TAB: 9,
|
|
204
|
+
/* \t */
|
|
205
|
+
CHAR_UNDERSCORE: 95,
|
|
206
|
+
/* _ */
|
|
207
|
+
CHAR_VERTICAL_LINE: 124,
|
|
208
|
+
/* | */
|
|
209
|
+
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
|
|
210
|
+
/* \uFEFF */
|
|
211
|
+
/**
|
|
212
|
+
* Create EXTGLOB_CHARS
|
|
213
|
+
*/
|
|
214
|
+
extglobChars(chars) {
|
|
215
|
+
return {
|
|
216
|
+
"!": { type: "negate", open: "(?:(?!(?:", close: `))${chars.STAR})` },
|
|
217
|
+
"?": { type: "qmark", open: "(?:", close: ")?" },
|
|
218
|
+
"+": { type: "plus", open: "(?:", close: ")+" },
|
|
219
|
+
"*": { type: "star", open: "(?:", close: ")*" },
|
|
220
|
+
"@": { type: "at", open: "(?:", close: ")" }
|
|
221
|
+
};
|
|
222
|
+
},
|
|
223
|
+
/**
|
|
224
|
+
* Create GLOB_CHARS
|
|
225
|
+
*/
|
|
226
|
+
globChars(win322) {
|
|
227
|
+
return win322 === true ? WINDOWS_CHARS : POSIX_CHARS;
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
// ../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/utils.js
|
|
234
|
+
var require_utils = __commonJS({
|
|
235
|
+
"../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/utils.js"(exports) {
|
|
236
|
+
"use strict";
|
|
237
|
+
var {
|
|
238
|
+
REGEX_BACKSLASH,
|
|
239
|
+
REGEX_REMOVE_BACKSLASH,
|
|
240
|
+
REGEX_SPECIAL_CHARS,
|
|
241
|
+
REGEX_SPECIAL_CHARS_GLOBAL
|
|
242
|
+
} = require_constants();
|
|
243
|
+
exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
|
|
244
|
+
exports.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
|
|
245
|
+
exports.isRegexChar = (str) => str.length === 1 && exports.hasRegexChars(str);
|
|
246
|
+
exports.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
|
|
247
|
+
exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
|
|
248
|
+
exports.isWindows = () => {
|
|
249
|
+
if (typeof navigator !== "undefined" && navigator.platform) {
|
|
250
|
+
const platform = navigator.platform.toLowerCase();
|
|
251
|
+
return platform === "win32" || platform === "windows";
|
|
252
|
+
}
|
|
253
|
+
if (typeof process !== "undefined" && process.platform) {
|
|
254
|
+
return process.platform === "win32";
|
|
255
|
+
}
|
|
256
|
+
return false;
|
|
257
|
+
};
|
|
258
|
+
exports.removeBackslashes = (str) => {
|
|
259
|
+
return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
|
|
260
|
+
return match === "\\" ? "" : match;
|
|
261
|
+
});
|
|
262
|
+
};
|
|
263
|
+
exports.escapeLast = (input, char, lastIdx) => {
|
|
264
|
+
const idx = input.lastIndexOf(char, lastIdx);
|
|
265
|
+
if (idx === -1) return input;
|
|
266
|
+
if (input[idx - 1] === "\\") return exports.escapeLast(input, char, idx - 1);
|
|
267
|
+
return `${input.slice(0, idx)}\\${input.slice(idx)}`;
|
|
268
|
+
};
|
|
269
|
+
exports.removePrefix = (input, state = {}) => {
|
|
270
|
+
let output = input;
|
|
271
|
+
if (output.startsWith("./")) {
|
|
272
|
+
output = output.slice(2);
|
|
273
|
+
state.prefix = "./";
|
|
274
|
+
}
|
|
275
|
+
return output;
|
|
276
|
+
};
|
|
277
|
+
exports.wrapOutput = (input, state = {}, options = {}) => {
|
|
278
|
+
const prepend = options.contains ? "" : "^";
|
|
279
|
+
const append = options.contains ? "" : "$";
|
|
280
|
+
let output = `${prepend}(?:${input})${append}`;
|
|
281
|
+
if (state.negated === true) {
|
|
282
|
+
output = `(?:^(?!${output}).*$)`;
|
|
283
|
+
}
|
|
284
|
+
return output;
|
|
285
|
+
};
|
|
286
|
+
exports.basename = (path, { windows } = {}) => {
|
|
287
|
+
const segs = path.split(windows ? /[\\/]/ : "/");
|
|
288
|
+
const last = segs[segs.length - 1];
|
|
289
|
+
if (last === "") {
|
|
290
|
+
return segs[segs.length - 2];
|
|
291
|
+
}
|
|
292
|
+
return last;
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
// ../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/scan.js
|
|
298
|
+
var require_scan = __commonJS({
|
|
299
|
+
"../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/scan.js"(exports, module) {
|
|
300
|
+
"use strict";
|
|
301
|
+
var utils = require_utils();
|
|
302
|
+
var {
|
|
303
|
+
CHAR_ASTERISK,
|
|
304
|
+
/* * */
|
|
305
|
+
CHAR_AT,
|
|
306
|
+
/* @ */
|
|
307
|
+
CHAR_BACKWARD_SLASH,
|
|
308
|
+
/* \ */
|
|
309
|
+
CHAR_COMMA,
|
|
310
|
+
/* , */
|
|
311
|
+
CHAR_DOT,
|
|
312
|
+
/* . */
|
|
313
|
+
CHAR_EXCLAMATION_MARK,
|
|
314
|
+
/* ! */
|
|
315
|
+
CHAR_FORWARD_SLASH,
|
|
316
|
+
/* / */
|
|
317
|
+
CHAR_LEFT_CURLY_BRACE,
|
|
318
|
+
/* { */
|
|
319
|
+
CHAR_LEFT_PARENTHESES,
|
|
320
|
+
/* ( */
|
|
321
|
+
CHAR_LEFT_SQUARE_BRACKET,
|
|
322
|
+
/* [ */
|
|
323
|
+
CHAR_PLUS,
|
|
324
|
+
/* + */
|
|
325
|
+
CHAR_QUESTION_MARK,
|
|
326
|
+
/* ? */
|
|
327
|
+
CHAR_RIGHT_CURLY_BRACE,
|
|
328
|
+
/* } */
|
|
329
|
+
CHAR_RIGHT_PARENTHESES,
|
|
330
|
+
/* ) */
|
|
331
|
+
CHAR_RIGHT_SQUARE_BRACKET
|
|
332
|
+
/* ] */
|
|
333
|
+
} = require_constants();
|
|
334
|
+
var isPathSeparator = (code) => {
|
|
335
|
+
return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
|
|
336
|
+
};
|
|
337
|
+
var depth = (token) => {
|
|
338
|
+
if (token.isPrefix !== true) {
|
|
339
|
+
token.depth = token.isGlobstar ? Infinity : 1;
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
var scan = (input, options) => {
|
|
343
|
+
const opts = options || {};
|
|
344
|
+
const length = input.length - 1;
|
|
345
|
+
const scanToEnd = opts.parts === true || opts.scanToEnd === true;
|
|
346
|
+
const slashes = [];
|
|
347
|
+
const tokens = [];
|
|
348
|
+
const parts = [];
|
|
349
|
+
let str = input;
|
|
350
|
+
let index = -1;
|
|
351
|
+
let start = 0;
|
|
352
|
+
let lastIndex = 0;
|
|
353
|
+
let isBrace = false;
|
|
354
|
+
let isBracket = false;
|
|
355
|
+
let isGlob = false;
|
|
356
|
+
let isExtglob = false;
|
|
357
|
+
let isGlobstar = false;
|
|
358
|
+
let braceEscaped = false;
|
|
359
|
+
let backslashes = false;
|
|
360
|
+
let negated = false;
|
|
361
|
+
let negatedExtglob = false;
|
|
362
|
+
let finished = false;
|
|
363
|
+
let braces = 0;
|
|
364
|
+
let prev;
|
|
365
|
+
let code;
|
|
366
|
+
let token = { value: "", depth: 0, isGlob: false };
|
|
367
|
+
const eos = () => index >= length;
|
|
368
|
+
const peek = () => str.charCodeAt(index + 1);
|
|
369
|
+
const advance = () => {
|
|
370
|
+
prev = code;
|
|
371
|
+
return str.charCodeAt(++index);
|
|
372
|
+
};
|
|
373
|
+
while (index < length) {
|
|
374
|
+
code = advance();
|
|
375
|
+
let next;
|
|
376
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
377
|
+
backslashes = token.backslashes = true;
|
|
378
|
+
code = advance();
|
|
379
|
+
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
380
|
+
braceEscaped = true;
|
|
381
|
+
}
|
|
382
|
+
continue;
|
|
383
|
+
}
|
|
384
|
+
if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
|
|
385
|
+
braces++;
|
|
386
|
+
while (eos() !== true && (code = advance())) {
|
|
387
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
388
|
+
backslashes = token.backslashes = true;
|
|
389
|
+
advance();
|
|
390
|
+
continue;
|
|
391
|
+
}
|
|
392
|
+
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
393
|
+
braces++;
|
|
394
|
+
continue;
|
|
395
|
+
}
|
|
396
|
+
if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
|
|
397
|
+
isBrace = token.isBrace = true;
|
|
398
|
+
isGlob = token.isGlob = true;
|
|
399
|
+
finished = true;
|
|
400
|
+
if (scanToEnd === true) {
|
|
401
|
+
continue;
|
|
402
|
+
}
|
|
403
|
+
break;
|
|
404
|
+
}
|
|
405
|
+
if (braceEscaped !== true && code === CHAR_COMMA) {
|
|
406
|
+
isBrace = token.isBrace = true;
|
|
407
|
+
isGlob = token.isGlob = true;
|
|
408
|
+
finished = true;
|
|
409
|
+
if (scanToEnd === true) {
|
|
410
|
+
continue;
|
|
411
|
+
}
|
|
412
|
+
break;
|
|
413
|
+
}
|
|
414
|
+
if (code === CHAR_RIGHT_CURLY_BRACE) {
|
|
415
|
+
braces--;
|
|
416
|
+
if (braces === 0) {
|
|
417
|
+
braceEscaped = false;
|
|
418
|
+
isBrace = token.isBrace = true;
|
|
419
|
+
finished = true;
|
|
420
|
+
break;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
if (scanToEnd === true) {
|
|
425
|
+
continue;
|
|
426
|
+
}
|
|
427
|
+
break;
|
|
428
|
+
}
|
|
429
|
+
if (code === CHAR_FORWARD_SLASH) {
|
|
430
|
+
slashes.push(index);
|
|
431
|
+
tokens.push(token);
|
|
432
|
+
token = { value: "", depth: 0, isGlob: false };
|
|
433
|
+
if (finished === true) continue;
|
|
434
|
+
if (prev === CHAR_DOT && index === start + 1) {
|
|
435
|
+
start += 2;
|
|
436
|
+
continue;
|
|
437
|
+
}
|
|
438
|
+
lastIndex = index + 1;
|
|
439
|
+
continue;
|
|
440
|
+
}
|
|
441
|
+
if (opts.noext !== true) {
|
|
442
|
+
const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
|
|
443
|
+
if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
|
|
444
|
+
isGlob = token.isGlob = true;
|
|
445
|
+
isExtglob = token.isExtglob = true;
|
|
446
|
+
finished = true;
|
|
447
|
+
if (code === CHAR_EXCLAMATION_MARK && index === start) {
|
|
448
|
+
negatedExtglob = true;
|
|
449
|
+
}
|
|
450
|
+
if (scanToEnd === true) {
|
|
451
|
+
while (eos() !== true && (code = advance())) {
|
|
452
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
453
|
+
backslashes = token.backslashes = true;
|
|
454
|
+
code = advance();
|
|
455
|
+
continue;
|
|
456
|
+
}
|
|
457
|
+
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
458
|
+
isGlob = token.isGlob = true;
|
|
459
|
+
finished = true;
|
|
460
|
+
break;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
continue;
|
|
464
|
+
}
|
|
465
|
+
break;
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
if (code === CHAR_ASTERISK) {
|
|
469
|
+
if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
|
|
470
|
+
isGlob = token.isGlob = true;
|
|
471
|
+
finished = true;
|
|
472
|
+
if (scanToEnd === true) {
|
|
473
|
+
continue;
|
|
474
|
+
}
|
|
475
|
+
break;
|
|
476
|
+
}
|
|
477
|
+
if (code === CHAR_QUESTION_MARK) {
|
|
478
|
+
isGlob = token.isGlob = true;
|
|
479
|
+
finished = true;
|
|
480
|
+
if (scanToEnd === true) {
|
|
481
|
+
continue;
|
|
482
|
+
}
|
|
483
|
+
break;
|
|
484
|
+
}
|
|
485
|
+
if (code === CHAR_LEFT_SQUARE_BRACKET) {
|
|
486
|
+
while (eos() !== true && (next = advance())) {
|
|
487
|
+
if (next === CHAR_BACKWARD_SLASH) {
|
|
488
|
+
backslashes = token.backslashes = true;
|
|
489
|
+
advance();
|
|
490
|
+
continue;
|
|
491
|
+
}
|
|
492
|
+
if (next === CHAR_RIGHT_SQUARE_BRACKET) {
|
|
493
|
+
isBracket = token.isBracket = true;
|
|
494
|
+
isGlob = token.isGlob = true;
|
|
495
|
+
finished = true;
|
|
496
|
+
break;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
if (scanToEnd === true) {
|
|
500
|
+
continue;
|
|
501
|
+
}
|
|
502
|
+
break;
|
|
503
|
+
}
|
|
504
|
+
if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
|
|
505
|
+
negated = token.negated = true;
|
|
506
|
+
start++;
|
|
507
|
+
continue;
|
|
508
|
+
}
|
|
509
|
+
if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
|
|
510
|
+
isGlob = token.isGlob = true;
|
|
511
|
+
if (scanToEnd === true) {
|
|
512
|
+
while (eos() !== true && (code = advance())) {
|
|
513
|
+
if (code === CHAR_LEFT_PARENTHESES) {
|
|
514
|
+
backslashes = token.backslashes = true;
|
|
515
|
+
code = advance();
|
|
516
|
+
continue;
|
|
517
|
+
}
|
|
518
|
+
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
519
|
+
finished = true;
|
|
520
|
+
break;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
continue;
|
|
524
|
+
}
|
|
525
|
+
break;
|
|
526
|
+
}
|
|
527
|
+
if (isGlob === true) {
|
|
528
|
+
finished = true;
|
|
529
|
+
if (scanToEnd === true) {
|
|
530
|
+
continue;
|
|
531
|
+
}
|
|
532
|
+
break;
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
if (opts.noext === true) {
|
|
536
|
+
isExtglob = false;
|
|
537
|
+
isGlob = false;
|
|
538
|
+
}
|
|
539
|
+
let base = str;
|
|
540
|
+
let prefix = "";
|
|
541
|
+
let glob = "";
|
|
542
|
+
if (start > 0) {
|
|
543
|
+
prefix = str.slice(0, start);
|
|
544
|
+
str = str.slice(start);
|
|
545
|
+
lastIndex -= start;
|
|
546
|
+
}
|
|
547
|
+
if (base && isGlob === true && lastIndex > 0) {
|
|
548
|
+
base = str.slice(0, lastIndex);
|
|
549
|
+
glob = str.slice(lastIndex);
|
|
550
|
+
} else if (isGlob === true) {
|
|
551
|
+
base = "";
|
|
552
|
+
glob = str;
|
|
553
|
+
} else {
|
|
554
|
+
base = str;
|
|
555
|
+
}
|
|
556
|
+
if (base && base !== "" && base !== "/" && base !== str) {
|
|
557
|
+
if (isPathSeparator(base.charCodeAt(base.length - 1))) {
|
|
558
|
+
base = base.slice(0, -1);
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
if (opts.unescape === true) {
|
|
562
|
+
if (glob) glob = utils.removeBackslashes(glob);
|
|
563
|
+
if (base && backslashes === true) {
|
|
564
|
+
base = utils.removeBackslashes(base);
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
const state = {
|
|
568
|
+
prefix,
|
|
569
|
+
input,
|
|
570
|
+
start,
|
|
571
|
+
base,
|
|
572
|
+
glob,
|
|
573
|
+
isBrace,
|
|
574
|
+
isBracket,
|
|
575
|
+
isGlob,
|
|
576
|
+
isExtglob,
|
|
577
|
+
isGlobstar,
|
|
578
|
+
negated,
|
|
579
|
+
negatedExtglob
|
|
580
|
+
};
|
|
581
|
+
if (opts.tokens === true) {
|
|
582
|
+
state.maxDepth = 0;
|
|
583
|
+
if (!isPathSeparator(code)) {
|
|
584
|
+
tokens.push(token);
|
|
585
|
+
}
|
|
586
|
+
state.tokens = tokens;
|
|
587
|
+
}
|
|
588
|
+
if (opts.parts === true || opts.tokens === true) {
|
|
589
|
+
let prevIndex;
|
|
590
|
+
for (let idx = 0; idx < slashes.length; idx++) {
|
|
591
|
+
const n = prevIndex ? prevIndex + 1 : start;
|
|
592
|
+
const i = slashes[idx];
|
|
593
|
+
const value = input.slice(n, i);
|
|
594
|
+
if (opts.tokens) {
|
|
595
|
+
if (idx === 0 && start !== 0) {
|
|
596
|
+
tokens[idx].isPrefix = true;
|
|
597
|
+
tokens[idx].value = prefix;
|
|
598
|
+
} else {
|
|
599
|
+
tokens[idx].value = value;
|
|
600
|
+
}
|
|
601
|
+
depth(tokens[idx]);
|
|
602
|
+
state.maxDepth += tokens[idx].depth;
|
|
603
|
+
}
|
|
604
|
+
if (idx !== 0 || value !== "") {
|
|
605
|
+
parts.push(value);
|
|
606
|
+
}
|
|
607
|
+
prevIndex = i;
|
|
608
|
+
}
|
|
609
|
+
if (prevIndex && prevIndex + 1 < input.length) {
|
|
610
|
+
const value = input.slice(prevIndex + 1);
|
|
611
|
+
parts.push(value);
|
|
612
|
+
if (opts.tokens) {
|
|
613
|
+
tokens[tokens.length - 1].value = value;
|
|
614
|
+
depth(tokens[tokens.length - 1]);
|
|
615
|
+
state.maxDepth += tokens[tokens.length - 1].depth;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
state.slashes = slashes;
|
|
619
|
+
state.parts = parts;
|
|
620
|
+
}
|
|
621
|
+
return state;
|
|
622
|
+
};
|
|
623
|
+
module.exports = scan;
|
|
624
|
+
}
|
|
625
|
+
});
|
|
626
|
+
|
|
627
|
+
// ../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/parse.js
|
|
628
|
+
var require_parse = __commonJS({
|
|
629
|
+
"../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/parse.js"(exports, module) {
|
|
630
|
+
"use strict";
|
|
631
|
+
var constants = require_constants();
|
|
632
|
+
var utils = require_utils();
|
|
633
|
+
var {
|
|
634
|
+
MAX_LENGTH,
|
|
635
|
+
POSIX_REGEX_SOURCE,
|
|
636
|
+
REGEX_NON_SPECIAL_CHARS,
|
|
637
|
+
REGEX_SPECIAL_CHARS_BACKREF,
|
|
638
|
+
REPLACEMENTS
|
|
639
|
+
} = constants;
|
|
640
|
+
var expandRange = (args, options) => {
|
|
641
|
+
if (typeof options.expandRange === "function") {
|
|
642
|
+
return options.expandRange(...args, options);
|
|
643
|
+
}
|
|
644
|
+
args.sort();
|
|
645
|
+
const value = `[${args.join("-")}]`;
|
|
646
|
+
try {
|
|
647
|
+
new RegExp(value);
|
|
648
|
+
} catch (ex) {
|
|
649
|
+
return args.map((v) => utils.escapeRegex(v)).join("..");
|
|
650
|
+
}
|
|
651
|
+
return value;
|
|
652
|
+
};
|
|
653
|
+
var syntaxError = (type, char) => {
|
|
654
|
+
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
|
655
|
+
};
|
|
656
|
+
var parse = (input, options) => {
|
|
657
|
+
if (typeof input !== "string") {
|
|
658
|
+
throw new TypeError("Expected a string");
|
|
659
|
+
}
|
|
660
|
+
input = REPLACEMENTS[input] || input;
|
|
661
|
+
const opts = { ...options };
|
|
662
|
+
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
663
|
+
let len = input.length;
|
|
664
|
+
if (len > max) {
|
|
665
|
+
throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
666
|
+
}
|
|
667
|
+
const bos = { type: "bos", value: "", output: opts.prepend || "" };
|
|
668
|
+
const tokens = [bos];
|
|
669
|
+
const capture = opts.capture ? "" : "?:";
|
|
670
|
+
const PLATFORM_CHARS = constants.globChars(opts.windows);
|
|
671
|
+
const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
|
|
672
|
+
const {
|
|
673
|
+
DOT_LITERAL,
|
|
674
|
+
PLUS_LITERAL,
|
|
675
|
+
SLASH_LITERAL,
|
|
676
|
+
ONE_CHAR,
|
|
677
|
+
DOTS_SLASH,
|
|
678
|
+
NO_DOT,
|
|
679
|
+
NO_DOT_SLASH,
|
|
680
|
+
NO_DOTS_SLASH,
|
|
681
|
+
QMARK,
|
|
682
|
+
QMARK_NO_DOT,
|
|
683
|
+
STAR,
|
|
684
|
+
START_ANCHOR
|
|
685
|
+
} = PLATFORM_CHARS;
|
|
686
|
+
const globstar = (opts2) => {
|
|
687
|
+
return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
|
688
|
+
};
|
|
689
|
+
const nodot = opts.dot ? "" : NO_DOT;
|
|
690
|
+
const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
|
|
691
|
+
let star = opts.bash === true ? globstar(opts) : STAR;
|
|
692
|
+
if (opts.capture) {
|
|
693
|
+
star = `(${star})`;
|
|
694
|
+
}
|
|
695
|
+
if (typeof opts.noext === "boolean") {
|
|
696
|
+
opts.noextglob = opts.noext;
|
|
697
|
+
}
|
|
698
|
+
const state = {
|
|
699
|
+
input,
|
|
700
|
+
index: -1,
|
|
701
|
+
start: 0,
|
|
702
|
+
dot: opts.dot === true,
|
|
703
|
+
consumed: "",
|
|
704
|
+
output: "",
|
|
705
|
+
prefix: "",
|
|
706
|
+
backtrack: false,
|
|
707
|
+
negated: false,
|
|
708
|
+
brackets: 0,
|
|
709
|
+
braces: 0,
|
|
710
|
+
parens: 0,
|
|
711
|
+
quotes: 0,
|
|
712
|
+
globstar: false,
|
|
713
|
+
tokens
|
|
714
|
+
};
|
|
715
|
+
input = utils.removePrefix(input, state);
|
|
716
|
+
len = input.length;
|
|
717
|
+
const extglobs = [];
|
|
718
|
+
const braces = [];
|
|
719
|
+
const stack = [];
|
|
720
|
+
let prev = bos;
|
|
721
|
+
let value;
|
|
722
|
+
const eos = () => state.index === len - 1;
|
|
723
|
+
const peek = state.peek = (n = 1) => input[state.index + n];
|
|
724
|
+
const advance = state.advance = () => input[++state.index] || "";
|
|
725
|
+
const remaining = () => input.slice(state.index + 1);
|
|
726
|
+
const consume = (value2 = "", num = 0) => {
|
|
727
|
+
state.consumed += value2;
|
|
728
|
+
state.index += num;
|
|
729
|
+
};
|
|
730
|
+
const append = (token) => {
|
|
731
|
+
state.output += token.output != null ? token.output : token.value;
|
|
732
|
+
consume(token.value);
|
|
733
|
+
};
|
|
734
|
+
const negate = () => {
|
|
735
|
+
let count = 1;
|
|
736
|
+
while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
|
|
737
|
+
advance();
|
|
738
|
+
state.start++;
|
|
739
|
+
count++;
|
|
740
|
+
}
|
|
741
|
+
if (count % 2 === 0) {
|
|
742
|
+
return false;
|
|
743
|
+
}
|
|
744
|
+
state.negated = true;
|
|
745
|
+
state.start++;
|
|
746
|
+
return true;
|
|
747
|
+
};
|
|
748
|
+
const increment = (type) => {
|
|
749
|
+
state[type]++;
|
|
750
|
+
stack.push(type);
|
|
751
|
+
};
|
|
752
|
+
const decrement = (type) => {
|
|
753
|
+
state[type]--;
|
|
754
|
+
stack.pop();
|
|
755
|
+
};
|
|
756
|
+
const push = (tok) => {
|
|
757
|
+
if (prev.type === "globstar") {
|
|
758
|
+
const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
|
|
759
|
+
const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
|
|
760
|
+
if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
|
|
761
|
+
state.output = state.output.slice(0, -prev.output.length);
|
|
762
|
+
prev.type = "star";
|
|
763
|
+
prev.value = "*";
|
|
764
|
+
prev.output = star;
|
|
765
|
+
state.output += prev.output;
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
if (extglobs.length && tok.type !== "paren") {
|
|
769
|
+
extglobs[extglobs.length - 1].inner += tok.value;
|
|
770
|
+
}
|
|
771
|
+
if (tok.value || tok.output) append(tok);
|
|
772
|
+
if (prev && prev.type === "text" && tok.type === "text") {
|
|
773
|
+
prev.output = (prev.output || prev.value) + tok.value;
|
|
774
|
+
prev.value += tok.value;
|
|
775
|
+
return;
|
|
776
|
+
}
|
|
777
|
+
tok.prev = prev;
|
|
778
|
+
tokens.push(tok);
|
|
779
|
+
prev = tok;
|
|
780
|
+
};
|
|
781
|
+
const extglobOpen = (type, value2) => {
|
|
782
|
+
const token = { ...EXTGLOB_CHARS[value2], conditions: 1, inner: "" };
|
|
783
|
+
token.prev = prev;
|
|
784
|
+
token.parens = state.parens;
|
|
785
|
+
token.output = state.output;
|
|
786
|
+
const output = (opts.capture ? "(" : "") + token.open;
|
|
787
|
+
increment("parens");
|
|
788
|
+
push({ type, value: value2, output: state.output ? "" : ONE_CHAR });
|
|
789
|
+
push({ type: "paren", extglob: true, value: advance(), output });
|
|
790
|
+
extglobs.push(token);
|
|
791
|
+
};
|
|
792
|
+
const extglobClose = (token) => {
|
|
793
|
+
let output = token.close + (opts.capture ? ")" : "");
|
|
794
|
+
let rest;
|
|
795
|
+
if (token.type === "negate") {
|
|
796
|
+
let extglobStar = star;
|
|
797
|
+
if (token.inner && token.inner.length > 1 && token.inner.includes("/")) {
|
|
798
|
+
extglobStar = globstar(opts);
|
|
799
|
+
}
|
|
800
|
+
if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
|
|
801
|
+
output = token.close = `)$))${extglobStar}`;
|
|
802
|
+
}
|
|
803
|
+
if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
|
|
804
|
+
const expression = parse(rest, { ...options, fastpaths: false }).output;
|
|
805
|
+
output = token.close = `)${expression})${extglobStar})`;
|
|
806
|
+
}
|
|
807
|
+
if (token.prev.type === "bos") {
|
|
808
|
+
state.negatedExtglob = true;
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
push({ type: "paren", extglob: true, value, output });
|
|
812
|
+
decrement("parens");
|
|
813
|
+
};
|
|
814
|
+
if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
|
|
815
|
+
let backslashes = false;
|
|
816
|
+
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
|
|
817
|
+
if (first === "\\") {
|
|
818
|
+
backslashes = true;
|
|
819
|
+
return m;
|
|
820
|
+
}
|
|
821
|
+
if (first === "?") {
|
|
822
|
+
if (esc) {
|
|
823
|
+
return esc + first + (rest ? QMARK.repeat(rest.length) : "");
|
|
824
|
+
}
|
|
825
|
+
if (index === 0) {
|
|
826
|
+
return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : "");
|
|
827
|
+
}
|
|
828
|
+
return QMARK.repeat(chars.length);
|
|
829
|
+
}
|
|
830
|
+
if (first === ".") {
|
|
831
|
+
return DOT_LITERAL.repeat(chars.length);
|
|
832
|
+
}
|
|
833
|
+
if (first === "*") {
|
|
834
|
+
if (esc) {
|
|
835
|
+
return esc + first + (rest ? star : "");
|
|
836
|
+
}
|
|
837
|
+
return star;
|
|
838
|
+
}
|
|
839
|
+
return esc ? m : `\\${m}`;
|
|
840
|
+
});
|
|
841
|
+
if (backslashes === true) {
|
|
842
|
+
if (opts.unescape === true) {
|
|
843
|
+
output = output.replace(/\\/g, "");
|
|
844
|
+
} else {
|
|
845
|
+
output = output.replace(/\\+/g, (m) => {
|
|
846
|
+
return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
|
|
847
|
+
});
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
if (output === input && opts.contains === true) {
|
|
851
|
+
state.output = input;
|
|
852
|
+
return state;
|
|
853
|
+
}
|
|
854
|
+
state.output = utils.wrapOutput(output, state, options);
|
|
855
|
+
return state;
|
|
856
|
+
}
|
|
857
|
+
while (!eos()) {
|
|
858
|
+
value = advance();
|
|
859
|
+
if (value === "\0") {
|
|
860
|
+
continue;
|
|
861
|
+
}
|
|
862
|
+
if (value === "\\") {
|
|
863
|
+
const next = peek();
|
|
864
|
+
if (next === "/" && opts.bash !== true) {
|
|
865
|
+
continue;
|
|
866
|
+
}
|
|
867
|
+
if (next === "." || next === ";") {
|
|
868
|
+
continue;
|
|
869
|
+
}
|
|
870
|
+
if (!next) {
|
|
871
|
+
value += "\\";
|
|
872
|
+
push({ type: "text", value });
|
|
873
|
+
continue;
|
|
874
|
+
}
|
|
875
|
+
const match = /^\\+/.exec(remaining());
|
|
876
|
+
let slashes = 0;
|
|
877
|
+
if (match && match[0].length > 2) {
|
|
878
|
+
slashes = match[0].length;
|
|
879
|
+
state.index += slashes;
|
|
880
|
+
if (slashes % 2 !== 0) {
|
|
881
|
+
value += "\\";
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
if (opts.unescape === true) {
|
|
885
|
+
value = advance();
|
|
886
|
+
} else {
|
|
887
|
+
value += advance();
|
|
888
|
+
}
|
|
889
|
+
if (state.brackets === 0) {
|
|
890
|
+
push({ type: "text", value });
|
|
891
|
+
continue;
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
|
|
895
|
+
if (opts.posix !== false && value === ":") {
|
|
896
|
+
const inner = prev.value.slice(1);
|
|
897
|
+
if (inner.includes("[")) {
|
|
898
|
+
prev.posix = true;
|
|
899
|
+
if (inner.includes(":")) {
|
|
900
|
+
const idx = prev.value.lastIndexOf("[");
|
|
901
|
+
const pre = prev.value.slice(0, idx);
|
|
902
|
+
const rest2 = prev.value.slice(idx + 2);
|
|
903
|
+
const posix2 = POSIX_REGEX_SOURCE[rest2];
|
|
904
|
+
if (posix2) {
|
|
905
|
+
prev.value = pre + posix2;
|
|
906
|
+
state.backtrack = true;
|
|
907
|
+
advance();
|
|
908
|
+
if (!bos.output && tokens.indexOf(prev) === 1) {
|
|
909
|
+
bos.output = ONE_CHAR;
|
|
910
|
+
}
|
|
911
|
+
continue;
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") {
|
|
917
|
+
value = `\\${value}`;
|
|
918
|
+
}
|
|
919
|
+
if (value === "]" && (prev.value === "[" || prev.value === "[^")) {
|
|
920
|
+
value = `\\${value}`;
|
|
921
|
+
}
|
|
922
|
+
if (opts.posix === true && value === "!" && prev.value === "[") {
|
|
923
|
+
value = "^";
|
|
924
|
+
}
|
|
925
|
+
prev.value += value;
|
|
926
|
+
append({ value });
|
|
927
|
+
continue;
|
|
928
|
+
}
|
|
929
|
+
if (state.quotes === 1 && value !== '"') {
|
|
930
|
+
value = utils.escapeRegex(value);
|
|
931
|
+
prev.value += value;
|
|
932
|
+
append({ value });
|
|
933
|
+
continue;
|
|
934
|
+
}
|
|
935
|
+
if (value === '"') {
|
|
936
|
+
state.quotes = state.quotes === 1 ? 0 : 1;
|
|
937
|
+
if (opts.keepQuotes === true) {
|
|
938
|
+
push({ type: "text", value });
|
|
939
|
+
}
|
|
940
|
+
continue;
|
|
941
|
+
}
|
|
942
|
+
if (value === "(") {
|
|
943
|
+
increment("parens");
|
|
944
|
+
push({ type: "paren", value });
|
|
945
|
+
continue;
|
|
946
|
+
}
|
|
947
|
+
if (value === ")") {
|
|
948
|
+
if (state.parens === 0 && opts.strictBrackets === true) {
|
|
949
|
+
throw new SyntaxError(syntaxError("opening", "("));
|
|
950
|
+
}
|
|
951
|
+
const extglob = extglobs[extglobs.length - 1];
|
|
952
|
+
if (extglob && state.parens === extglob.parens + 1) {
|
|
953
|
+
extglobClose(extglobs.pop());
|
|
954
|
+
continue;
|
|
955
|
+
}
|
|
956
|
+
push({ type: "paren", value, output: state.parens ? ")" : "\\)" });
|
|
957
|
+
decrement("parens");
|
|
958
|
+
continue;
|
|
959
|
+
}
|
|
960
|
+
if (value === "[") {
|
|
961
|
+
if (opts.nobracket === true || !remaining().includes("]")) {
|
|
962
|
+
if (opts.nobracket !== true && opts.strictBrackets === true) {
|
|
963
|
+
throw new SyntaxError(syntaxError("closing", "]"));
|
|
964
|
+
}
|
|
965
|
+
value = `\\${value}`;
|
|
966
|
+
} else {
|
|
967
|
+
increment("brackets");
|
|
968
|
+
}
|
|
969
|
+
push({ type: "bracket", value });
|
|
970
|
+
continue;
|
|
971
|
+
}
|
|
972
|
+
if (value === "]") {
|
|
973
|
+
if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
|
|
974
|
+
push({ type: "text", value, output: `\\${value}` });
|
|
975
|
+
continue;
|
|
976
|
+
}
|
|
977
|
+
if (state.brackets === 0) {
|
|
978
|
+
if (opts.strictBrackets === true) {
|
|
979
|
+
throw new SyntaxError(syntaxError("opening", "["));
|
|
980
|
+
}
|
|
981
|
+
push({ type: "text", value, output: `\\${value}` });
|
|
982
|
+
continue;
|
|
983
|
+
}
|
|
984
|
+
decrement("brackets");
|
|
985
|
+
const prevValue = prev.value.slice(1);
|
|
986
|
+
if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) {
|
|
987
|
+
value = `/${value}`;
|
|
988
|
+
}
|
|
989
|
+
prev.value += value;
|
|
990
|
+
append({ value });
|
|
991
|
+
if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {
|
|
992
|
+
continue;
|
|
993
|
+
}
|
|
994
|
+
const escaped = utils.escapeRegex(prev.value);
|
|
995
|
+
state.output = state.output.slice(0, -prev.value.length);
|
|
996
|
+
if (opts.literalBrackets === true) {
|
|
997
|
+
state.output += escaped;
|
|
998
|
+
prev.value = escaped;
|
|
999
|
+
continue;
|
|
1000
|
+
}
|
|
1001
|
+
prev.value = `(${capture}${escaped}|${prev.value})`;
|
|
1002
|
+
state.output += prev.value;
|
|
1003
|
+
continue;
|
|
1004
|
+
}
|
|
1005
|
+
if (value === "{" && opts.nobrace !== true) {
|
|
1006
|
+
increment("braces");
|
|
1007
|
+
const open = {
|
|
1008
|
+
type: "brace",
|
|
1009
|
+
value,
|
|
1010
|
+
output: "(",
|
|
1011
|
+
outputIndex: state.output.length,
|
|
1012
|
+
tokensIndex: state.tokens.length
|
|
1013
|
+
};
|
|
1014
|
+
braces.push(open);
|
|
1015
|
+
push(open);
|
|
1016
|
+
continue;
|
|
1017
|
+
}
|
|
1018
|
+
if (value === "}") {
|
|
1019
|
+
const brace = braces[braces.length - 1];
|
|
1020
|
+
if (opts.nobrace === true || !brace) {
|
|
1021
|
+
push({ type: "text", value, output: value });
|
|
1022
|
+
continue;
|
|
1023
|
+
}
|
|
1024
|
+
let output = ")";
|
|
1025
|
+
if (brace.dots === true) {
|
|
1026
|
+
const arr = tokens.slice();
|
|
1027
|
+
const range = [];
|
|
1028
|
+
for (let i = arr.length - 1; i >= 0; i--) {
|
|
1029
|
+
tokens.pop();
|
|
1030
|
+
if (arr[i].type === "brace") {
|
|
1031
|
+
break;
|
|
1032
|
+
}
|
|
1033
|
+
if (arr[i].type !== "dots") {
|
|
1034
|
+
range.unshift(arr[i].value);
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
output = expandRange(range, opts);
|
|
1038
|
+
state.backtrack = true;
|
|
1039
|
+
}
|
|
1040
|
+
if (brace.comma !== true && brace.dots !== true) {
|
|
1041
|
+
const out = state.output.slice(0, brace.outputIndex);
|
|
1042
|
+
const toks = state.tokens.slice(brace.tokensIndex);
|
|
1043
|
+
brace.value = brace.output = "\\{";
|
|
1044
|
+
value = output = "\\}";
|
|
1045
|
+
state.output = out;
|
|
1046
|
+
for (const t of toks) {
|
|
1047
|
+
state.output += t.output || t.value;
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
push({ type: "brace", value, output });
|
|
1051
|
+
decrement("braces");
|
|
1052
|
+
braces.pop();
|
|
1053
|
+
continue;
|
|
1054
|
+
}
|
|
1055
|
+
if (value === "|") {
|
|
1056
|
+
if (extglobs.length > 0) {
|
|
1057
|
+
extglobs[extglobs.length - 1].conditions++;
|
|
1058
|
+
}
|
|
1059
|
+
push({ type: "text", value });
|
|
1060
|
+
continue;
|
|
1061
|
+
}
|
|
1062
|
+
if (value === ",") {
|
|
1063
|
+
let output = value;
|
|
1064
|
+
const brace = braces[braces.length - 1];
|
|
1065
|
+
if (brace && stack[stack.length - 1] === "braces") {
|
|
1066
|
+
brace.comma = true;
|
|
1067
|
+
output = "|";
|
|
1068
|
+
}
|
|
1069
|
+
push({ type: "comma", value, output });
|
|
1070
|
+
continue;
|
|
1071
|
+
}
|
|
1072
|
+
if (value === "/") {
|
|
1073
|
+
if (prev.type === "dot" && state.index === state.start + 1) {
|
|
1074
|
+
state.start = state.index + 1;
|
|
1075
|
+
state.consumed = "";
|
|
1076
|
+
state.output = "";
|
|
1077
|
+
tokens.pop();
|
|
1078
|
+
prev = bos;
|
|
1079
|
+
continue;
|
|
1080
|
+
}
|
|
1081
|
+
push({ type: "slash", value, output: SLASH_LITERAL });
|
|
1082
|
+
continue;
|
|
1083
|
+
}
|
|
1084
|
+
if (value === ".") {
|
|
1085
|
+
if (state.braces > 0 && prev.type === "dot") {
|
|
1086
|
+
if (prev.value === ".") prev.output = DOT_LITERAL;
|
|
1087
|
+
const brace = braces[braces.length - 1];
|
|
1088
|
+
prev.type = "dots";
|
|
1089
|
+
prev.output += value;
|
|
1090
|
+
prev.value += value;
|
|
1091
|
+
brace.dots = true;
|
|
1092
|
+
continue;
|
|
1093
|
+
}
|
|
1094
|
+
if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
|
|
1095
|
+
push({ type: "text", value, output: DOT_LITERAL });
|
|
1096
|
+
continue;
|
|
1097
|
+
}
|
|
1098
|
+
push({ type: "dot", value, output: DOT_LITERAL });
|
|
1099
|
+
continue;
|
|
1100
|
+
}
|
|
1101
|
+
if (value === "?") {
|
|
1102
|
+
const isGroup = prev && prev.value === "(";
|
|
1103
|
+
if (!isGroup && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
|
1104
|
+
extglobOpen("qmark", value);
|
|
1105
|
+
continue;
|
|
1106
|
+
}
|
|
1107
|
+
if (prev && prev.type === "paren") {
|
|
1108
|
+
const next = peek();
|
|
1109
|
+
let output = value;
|
|
1110
|
+
if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) {
|
|
1111
|
+
output = `\\${value}`;
|
|
1112
|
+
}
|
|
1113
|
+
push({ type: "text", value, output });
|
|
1114
|
+
continue;
|
|
1115
|
+
}
|
|
1116
|
+
if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
|
|
1117
|
+
push({ type: "qmark", value, output: QMARK_NO_DOT });
|
|
1118
|
+
continue;
|
|
1119
|
+
}
|
|
1120
|
+
push({ type: "qmark", value, output: QMARK });
|
|
1121
|
+
continue;
|
|
1122
|
+
}
|
|
1123
|
+
if (value === "!") {
|
|
1124
|
+
if (opts.noextglob !== true && peek() === "(") {
|
|
1125
|
+
if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
|
|
1126
|
+
extglobOpen("negate", value);
|
|
1127
|
+
continue;
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
if (opts.nonegate !== true && state.index === 0) {
|
|
1131
|
+
negate();
|
|
1132
|
+
continue;
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
if (value === "+") {
|
|
1136
|
+
if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
|
1137
|
+
extglobOpen("plus", value);
|
|
1138
|
+
continue;
|
|
1139
|
+
}
|
|
1140
|
+
if (prev && prev.value === "(" || opts.regex === false) {
|
|
1141
|
+
push({ type: "plus", value, output: PLUS_LITERAL });
|
|
1142
|
+
continue;
|
|
1143
|
+
}
|
|
1144
|
+
if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) {
|
|
1145
|
+
push({ type: "plus", value });
|
|
1146
|
+
continue;
|
|
1147
|
+
}
|
|
1148
|
+
push({ type: "plus", value: PLUS_LITERAL });
|
|
1149
|
+
continue;
|
|
1150
|
+
}
|
|
1151
|
+
if (value === "@") {
|
|
1152
|
+
if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
|
1153
|
+
push({ type: "at", extglob: true, value, output: "" });
|
|
1154
|
+
continue;
|
|
1155
|
+
}
|
|
1156
|
+
push({ type: "text", value });
|
|
1157
|
+
continue;
|
|
1158
|
+
}
|
|
1159
|
+
if (value !== "*") {
|
|
1160
|
+
if (value === "$" || value === "^") {
|
|
1161
|
+
value = `\\${value}`;
|
|
1162
|
+
}
|
|
1163
|
+
const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
|
|
1164
|
+
if (match) {
|
|
1165
|
+
value += match[0];
|
|
1166
|
+
state.index += match[0].length;
|
|
1167
|
+
}
|
|
1168
|
+
push({ type: "text", value });
|
|
1169
|
+
continue;
|
|
1170
|
+
}
|
|
1171
|
+
if (prev && (prev.type === "globstar" || prev.star === true)) {
|
|
1172
|
+
prev.type = "star";
|
|
1173
|
+
prev.star = true;
|
|
1174
|
+
prev.value += value;
|
|
1175
|
+
prev.output = star;
|
|
1176
|
+
state.backtrack = true;
|
|
1177
|
+
state.globstar = true;
|
|
1178
|
+
consume(value);
|
|
1179
|
+
continue;
|
|
1180
|
+
}
|
|
1181
|
+
let rest = remaining();
|
|
1182
|
+
if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
|
|
1183
|
+
extglobOpen("star", value);
|
|
1184
|
+
continue;
|
|
1185
|
+
}
|
|
1186
|
+
if (prev.type === "star") {
|
|
1187
|
+
if (opts.noglobstar === true) {
|
|
1188
|
+
consume(value);
|
|
1189
|
+
continue;
|
|
1190
|
+
}
|
|
1191
|
+
const prior = prev.prev;
|
|
1192
|
+
const before = prior.prev;
|
|
1193
|
+
const isStart = prior.type === "slash" || prior.type === "bos";
|
|
1194
|
+
const afterStar = before && (before.type === "star" || before.type === "globstar");
|
|
1195
|
+
if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
|
|
1196
|
+
push({ type: "star", value, output: "" });
|
|
1197
|
+
continue;
|
|
1198
|
+
}
|
|
1199
|
+
const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
|
|
1200
|
+
const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
|
|
1201
|
+
if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
|
|
1202
|
+
push({ type: "star", value, output: "" });
|
|
1203
|
+
continue;
|
|
1204
|
+
}
|
|
1205
|
+
while (rest.slice(0, 3) === "/**") {
|
|
1206
|
+
const after = input[state.index + 4];
|
|
1207
|
+
if (after && after !== "/") {
|
|
1208
|
+
break;
|
|
1209
|
+
}
|
|
1210
|
+
rest = rest.slice(3);
|
|
1211
|
+
consume("/**", 3);
|
|
1212
|
+
}
|
|
1213
|
+
if (prior.type === "bos" && eos()) {
|
|
1214
|
+
prev.type = "globstar";
|
|
1215
|
+
prev.value += value;
|
|
1216
|
+
prev.output = globstar(opts);
|
|
1217
|
+
state.output = prev.output;
|
|
1218
|
+
state.globstar = true;
|
|
1219
|
+
consume(value);
|
|
1220
|
+
continue;
|
|
1221
|
+
}
|
|
1222
|
+
if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
|
|
1223
|
+
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
1224
|
+
prior.output = `(?:${prior.output}`;
|
|
1225
|
+
prev.type = "globstar";
|
|
1226
|
+
prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
|
|
1227
|
+
prev.value += value;
|
|
1228
|
+
state.globstar = true;
|
|
1229
|
+
state.output += prior.output + prev.output;
|
|
1230
|
+
consume(value);
|
|
1231
|
+
continue;
|
|
1232
|
+
}
|
|
1233
|
+
if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
|
|
1234
|
+
const end = rest[1] !== void 0 ? "|$" : "";
|
|
1235
|
+
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
1236
|
+
prior.output = `(?:${prior.output}`;
|
|
1237
|
+
prev.type = "globstar";
|
|
1238
|
+
prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
|
|
1239
|
+
prev.value += value;
|
|
1240
|
+
state.output += prior.output + prev.output;
|
|
1241
|
+
state.globstar = true;
|
|
1242
|
+
consume(value + advance());
|
|
1243
|
+
push({ type: "slash", value: "/", output: "" });
|
|
1244
|
+
continue;
|
|
1245
|
+
}
|
|
1246
|
+
if (prior.type === "bos" && rest[0] === "/") {
|
|
1247
|
+
prev.type = "globstar";
|
|
1248
|
+
prev.value += value;
|
|
1249
|
+
prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
|
|
1250
|
+
state.output = prev.output;
|
|
1251
|
+
state.globstar = true;
|
|
1252
|
+
consume(value + advance());
|
|
1253
|
+
push({ type: "slash", value: "/", output: "" });
|
|
1254
|
+
continue;
|
|
1255
|
+
}
|
|
1256
|
+
state.output = state.output.slice(0, -prev.output.length);
|
|
1257
|
+
prev.type = "globstar";
|
|
1258
|
+
prev.output = globstar(opts);
|
|
1259
|
+
prev.value += value;
|
|
1260
|
+
state.output += prev.output;
|
|
1261
|
+
state.globstar = true;
|
|
1262
|
+
consume(value);
|
|
1263
|
+
continue;
|
|
1264
|
+
}
|
|
1265
|
+
const token = { type: "star", value, output: star };
|
|
1266
|
+
if (opts.bash === true) {
|
|
1267
|
+
token.output = ".*?";
|
|
1268
|
+
if (prev.type === "bos" || prev.type === "slash") {
|
|
1269
|
+
token.output = nodot + token.output;
|
|
1270
|
+
}
|
|
1271
|
+
push(token);
|
|
1272
|
+
continue;
|
|
1273
|
+
}
|
|
1274
|
+
if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
|
|
1275
|
+
token.output = value;
|
|
1276
|
+
push(token);
|
|
1277
|
+
continue;
|
|
1278
|
+
}
|
|
1279
|
+
if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
|
|
1280
|
+
if (prev.type === "dot") {
|
|
1281
|
+
state.output += NO_DOT_SLASH;
|
|
1282
|
+
prev.output += NO_DOT_SLASH;
|
|
1283
|
+
} else if (opts.dot === true) {
|
|
1284
|
+
state.output += NO_DOTS_SLASH;
|
|
1285
|
+
prev.output += NO_DOTS_SLASH;
|
|
1286
|
+
} else {
|
|
1287
|
+
state.output += nodot;
|
|
1288
|
+
prev.output += nodot;
|
|
1289
|
+
}
|
|
1290
|
+
if (peek() !== "*") {
|
|
1291
|
+
state.output += ONE_CHAR;
|
|
1292
|
+
prev.output += ONE_CHAR;
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
push(token);
|
|
1296
|
+
}
|
|
1297
|
+
while (state.brackets > 0) {
|
|
1298
|
+
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
|
|
1299
|
+
state.output = utils.escapeLast(state.output, "[");
|
|
1300
|
+
decrement("brackets");
|
|
1301
|
+
}
|
|
1302
|
+
while (state.parens > 0) {
|
|
1303
|
+
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", ")"));
|
|
1304
|
+
state.output = utils.escapeLast(state.output, "(");
|
|
1305
|
+
decrement("parens");
|
|
1306
|
+
}
|
|
1307
|
+
while (state.braces > 0) {
|
|
1308
|
+
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "}"));
|
|
1309
|
+
state.output = utils.escapeLast(state.output, "{");
|
|
1310
|
+
decrement("braces");
|
|
1311
|
+
}
|
|
1312
|
+
if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) {
|
|
1313
|
+
push({ type: "maybe_slash", value: "", output: `${SLASH_LITERAL}?` });
|
|
1314
|
+
}
|
|
1315
|
+
if (state.backtrack === true) {
|
|
1316
|
+
state.output = "";
|
|
1317
|
+
for (const token of state.tokens) {
|
|
1318
|
+
state.output += token.output != null ? token.output : token.value;
|
|
1319
|
+
if (token.suffix) {
|
|
1320
|
+
state.output += token.suffix;
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
return state;
|
|
1325
|
+
};
|
|
1326
|
+
parse.fastpaths = (input, options) => {
|
|
1327
|
+
const opts = { ...options };
|
|
1328
|
+
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
1329
|
+
const len = input.length;
|
|
1330
|
+
if (len > max) {
|
|
1331
|
+
throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
1332
|
+
}
|
|
1333
|
+
input = REPLACEMENTS[input] || input;
|
|
1334
|
+
const {
|
|
1335
|
+
DOT_LITERAL,
|
|
1336
|
+
SLASH_LITERAL,
|
|
1337
|
+
ONE_CHAR,
|
|
1338
|
+
DOTS_SLASH,
|
|
1339
|
+
NO_DOT,
|
|
1340
|
+
NO_DOTS,
|
|
1341
|
+
NO_DOTS_SLASH,
|
|
1342
|
+
STAR,
|
|
1343
|
+
START_ANCHOR
|
|
1344
|
+
} = constants.globChars(opts.windows);
|
|
1345
|
+
const nodot = opts.dot ? NO_DOTS : NO_DOT;
|
|
1346
|
+
const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
|
|
1347
|
+
const capture = opts.capture ? "" : "?:";
|
|
1348
|
+
const state = { negated: false, prefix: "" };
|
|
1349
|
+
let star = opts.bash === true ? ".*?" : STAR;
|
|
1350
|
+
if (opts.capture) {
|
|
1351
|
+
star = `(${star})`;
|
|
1352
|
+
}
|
|
1353
|
+
const globstar = (opts2) => {
|
|
1354
|
+
if (opts2.noglobstar === true) return star;
|
|
1355
|
+
return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
|
1356
|
+
};
|
|
1357
|
+
const create = (str) => {
|
|
1358
|
+
switch (str) {
|
|
1359
|
+
case "*":
|
|
1360
|
+
return `${nodot}${ONE_CHAR}${star}`;
|
|
1361
|
+
case ".*":
|
|
1362
|
+
return `${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
1363
|
+
case "*.*":
|
|
1364
|
+
return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
1365
|
+
case "*/*":
|
|
1366
|
+
return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
|
|
1367
|
+
case "**":
|
|
1368
|
+
return nodot + globstar(opts);
|
|
1369
|
+
case "**/*":
|
|
1370
|
+
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
|
|
1371
|
+
case "**/*.*":
|
|
1372
|
+
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
1373
|
+
case "**/.*":
|
|
1374
|
+
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
1375
|
+
default: {
|
|
1376
|
+
const match = /^(.*?)\.(\w+)$/.exec(str);
|
|
1377
|
+
if (!match) return;
|
|
1378
|
+
const source2 = create(match[1]);
|
|
1379
|
+
if (!source2) return;
|
|
1380
|
+
return source2 + DOT_LITERAL + match[2];
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
};
|
|
1384
|
+
const output = utils.removePrefix(input, state);
|
|
1385
|
+
let source = create(output);
|
|
1386
|
+
if (source && opts.strictSlashes !== true) {
|
|
1387
|
+
source += `${SLASH_LITERAL}?`;
|
|
1388
|
+
}
|
|
1389
|
+
return source;
|
|
1390
|
+
};
|
|
1391
|
+
module.exports = parse;
|
|
1392
|
+
}
|
|
1393
|
+
});
|
|
1394
|
+
|
|
1395
|
+
// ../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/picomatch.js
|
|
1396
|
+
var require_picomatch = __commonJS({
|
|
1397
|
+
"../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/picomatch.js"(exports, module) {
|
|
1398
|
+
"use strict";
|
|
1399
|
+
var scan = require_scan();
|
|
1400
|
+
var parse = require_parse();
|
|
1401
|
+
var utils = require_utils();
|
|
1402
|
+
var constants = require_constants();
|
|
1403
|
+
var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
|
|
1404
|
+
var picomatch = (glob, options, returnState = false) => {
|
|
1405
|
+
if (Array.isArray(glob)) {
|
|
1406
|
+
const fns = glob.map((input) => picomatch(input, options, returnState));
|
|
1407
|
+
const arrayMatcher = (str) => {
|
|
1408
|
+
for (const isMatch of fns) {
|
|
1409
|
+
const state2 = isMatch(str);
|
|
1410
|
+
if (state2) return state2;
|
|
1411
|
+
}
|
|
1412
|
+
return false;
|
|
1413
|
+
};
|
|
1414
|
+
return arrayMatcher;
|
|
1415
|
+
}
|
|
1416
|
+
const isState = isObject(glob) && glob.tokens && glob.input;
|
|
1417
|
+
if (glob === "" || typeof glob !== "string" && !isState) {
|
|
1418
|
+
throw new TypeError("Expected pattern to be a non-empty string");
|
|
1419
|
+
}
|
|
1420
|
+
const opts = options || {};
|
|
1421
|
+
const posix2 = opts.windows;
|
|
1422
|
+
const regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true);
|
|
1423
|
+
const state = regex.state;
|
|
1424
|
+
delete regex.state;
|
|
1425
|
+
let isIgnored = () => false;
|
|
1426
|
+
if (opts.ignore) {
|
|
1427
|
+
const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
|
|
1428
|
+
isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
|
|
1429
|
+
}
|
|
1430
|
+
const matcher = (input, returnObject = false) => {
|
|
1431
|
+
const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix: posix2 });
|
|
1432
|
+
const result = { glob, state, regex, posix: posix2, input, output, match, isMatch };
|
|
1433
|
+
if (typeof opts.onResult === "function") {
|
|
1434
|
+
opts.onResult(result);
|
|
1435
|
+
}
|
|
1436
|
+
if (isMatch === false) {
|
|
1437
|
+
result.isMatch = false;
|
|
1438
|
+
return returnObject ? result : false;
|
|
1439
|
+
}
|
|
1440
|
+
if (isIgnored(input)) {
|
|
1441
|
+
if (typeof opts.onIgnore === "function") {
|
|
1442
|
+
opts.onIgnore(result);
|
|
1443
|
+
}
|
|
1444
|
+
result.isMatch = false;
|
|
1445
|
+
return returnObject ? result : false;
|
|
1446
|
+
}
|
|
1447
|
+
if (typeof opts.onMatch === "function") {
|
|
1448
|
+
opts.onMatch(result);
|
|
1449
|
+
}
|
|
1450
|
+
return returnObject ? result : true;
|
|
1451
|
+
};
|
|
1452
|
+
if (returnState) {
|
|
1453
|
+
matcher.state = state;
|
|
1454
|
+
}
|
|
1455
|
+
return matcher;
|
|
1456
|
+
};
|
|
1457
|
+
picomatch.test = (input, regex, options, { glob, posix: posix2 } = {}) => {
|
|
1458
|
+
if (typeof input !== "string") {
|
|
1459
|
+
throw new TypeError("Expected input to be a string");
|
|
1460
|
+
}
|
|
1461
|
+
if (input === "") {
|
|
1462
|
+
return { isMatch: false, output: "" };
|
|
1463
|
+
}
|
|
1464
|
+
const opts = options || {};
|
|
1465
|
+
const format = opts.format || (posix2 ? utils.toPosixSlashes : null);
|
|
1466
|
+
let match = input === glob;
|
|
1467
|
+
let output = match && format ? format(input) : input;
|
|
1468
|
+
if (match === false) {
|
|
1469
|
+
output = format ? format(input) : input;
|
|
1470
|
+
match = output === glob;
|
|
1471
|
+
}
|
|
1472
|
+
if (match === false || opts.capture === true) {
|
|
1473
|
+
if (opts.matchBase === true || opts.basename === true) {
|
|
1474
|
+
match = picomatch.matchBase(input, regex, options, posix2);
|
|
1475
|
+
} else {
|
|
1476
|
+
match = regex.exec(output);
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
return { isMatch: Boolean(match), match, output };
|
|
1480
|
+
};
|
|
1481
|
+
picomatch.matchBase = (input, glob, options) => {
|
|
1482
|
+
const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
|
|
1483
|
+
return regex.test(utils.basename(input));
|
|
1484
|
+
};
|
|
1485
|
+
picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
|
1486
|
+
picomatch.parse = (pattern, options) => {
|
|
1487
|
+
if (Array.isArray(pattern)) return pattern.map((p) => picomatch.parse(p, options));
|
|
1488
|
+
return parse(pattern, { ...options, fastpaths: false });
|
|
1489
|
+
};
|
|
1490
|
+
picomatch.scan = (input, options) => scan(input, options);
|
|
1491
|
+
picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
|
|
1492
|
+
if (returnOutput === true) {
|
|
1493
|
+
return state.output;
|
|
1494
|
+
}
|
|
1495
|
+
const opts = options || {};
|
|
1496
|
+
const prepend = opts.contains ? "" : "^";
|
|
1497
|
+
const append = opts.contains ? "" : "$";
|
|
1498
|
+
let source = `${prepend}(?:${state.output})${append}`;
|
|
1499
|
+
if (state && state.negated === true) {
|
|
1500
|
+
source = `^(?!${source}).*$`;
|
|
1501
|
+
}
|
|
1502
|
+
const regex = picomatch.toRegex(source, options);
|
|
1503
|
+
if (returnState === true) {
|
|
1504
|
+
regex.state = state;
|
|
1505
|
+
}
|
|
1506
|
+
return regex;
|
|
1507
|
+
};
|
|
1508
|
+
picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
|
|
1509
|
+
if (!input || typeof input !== "string") {
|
|
1510
|
+
throw new TypeError("Expected a non-empty string");
|
|
1511
|
+
}
|
|
1512
|
+
let parsed = { negated: false, fastpaths: true };
|
|
1513
|
+
if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
|
|
1514
|
+
parsed.output = parse.fastpaths(input, options);
|
|
1515
|
+
}
|
|
1516
|
+
if (!parsed.output) {
|
|
1517
|
+
parsed = parse(input, options);
|
|
1518
|
+
}
|
|
1519
|
+
return picomatch.compileRe(parsed, options, returnOutput, returnState);
|
|
1520
|
+
};
|
|
1521
|
+
picomatch.toRegex = (source, options) => {
|
|
1522
|
+
try {
|
|
1523
|
+
const opts = options || {};
|
|
1524
|
+
return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
|
|
1525
|
+
} catch (err) {
|
|
1526
|
+
if (options && options.debug === true) throw err;
|
|
1527
|
+
return /$^/;
|
|
1528
|
+
}
|
|
1529
|
+
};
|
|
1530
|
+
picomatch.constants = constants;
|
|
1531
|
+
module.exports = picomatch;
|
|
1532
|
+
}
|
|
1533
|
+
});
|
|
1534
|
+
|
|
1535
|
+
// ../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/index.js
|
|
1536
|
+
var require_picomatch2 = __commonJS({
|
|
1537
|
+
"../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/index.js"(exports, module) {
|
|
1538
|
+
"use strict";
|
|
1539
|
+
var pico = require_picomatch();
|
|
1540
|
+
var utils = require_utils();
|
|
1541
|
+
function picomatch(glob, options, returnState = false) {
|
|
1542
|
+
if (options && (options.windows === null || options.windows === void 0)) {
|
|
1543
|
+
options = { ...options, windows: utils.isWindows() };
|
|
1544
|
+
}
|
|
1545
|
+
return pico(glob, options, returnState);
|
|
1546
|
+
}
|
|
1547
|
+
Object.assign(picomatch, pico);
|
|
1548
|
+
module.exports = picomatch;
|
|
1549
|
+
}
|
|
1550
|
+
});
|
|
1551
|
+
|
|
1552
|
+
// ../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/base64.js
|
|
1553
|
+
var require_base64 = __commonJS({
|
|
1554
|
+
"../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/base64.js"(exports) {
|
|
1555
|
+
var intToCharMap = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");
|
|
1556
|
+
exports.encode = function(number) {
|
|
1557
|
+
if (0 <= number && number < intToCharMap.length) {
|
|
1558
|
+
return intToCharMap[number];
|
|
1559
|
+
}
|
|
1560
|
+
throw new TypeError("Must be between 0 and 63: " + number);
|
|
1561
|
+
};
|
|
1562
|
+
}
|
|
1563
|
+
});
|
|
1564
|
+
|
|
1565
|
+
// ../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/base64-vlq.js
|
|
1566
|
+
var require_base64_vlq = __commonJS({
|
|
1567
|
+
"../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/base64-vlq.js"(exports) {
|
|
1568
|
+
var base64 = require_base64();
|
|
1569
|
+
var VLQ_BASE_SHIFT = 5;
|
|
1570
|
+
var VLQ_BASE = 1 << VLQ_BASE_SHIFT;
|
|
1571
|
+
var VLQ_BASE_MASK = VLQ_BASE - 1;
|
|
1572
|
+
var VLQ_CONTINUATION_BIT = VLQ_BASE;
|
|
1573
|
+
function toVLQSigned(aValue) {
|
|
1574
|
+
return aValue < 0 ? (-aValue << 1) + 1 : (aValue << 1) + 0;
|
|
1575
|
+
}
|
|
1576
|
+
exports.encode = function base64VLQ_encode(aValue) {
|
|
1577
|
+
let encoded = "";
|
|
1578
|
+
let digit;
|
|
1579
|
+
let vlq = toVLQSigned(aValue);
|
|
1580
|
+
do {
|
|
1581
|
+
digit = vlq & VLQ_BASE_MASK;
|
|
1582
|
+
vlq >>>= VLQ_BASE_SHIFT;
|
|
1583
|
+
if (vlq > 0) {
|
|
1584
|
+
digit |= VLQ_CONTINUATION_BIT;
|
|
1585
|
+
}
|
|
1586
|
+
encoded += base64.encode(digit);
|
|
1587
|
+
} while (vlq > 0);
|
|
1588
|
+
return encoded;
|
|
1589
|
+
};
|
|
1590
|
+
}
|
|
1591
|
+
});
|
|
1592
|
+
|
|
1593
|
+
// ../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/util.js
|
|
1594
|
+
var require_util = __commonJS({
|
|
1595
|
+
"../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/util.js"(exports) {
|
|
1596
|
+
function getArg(aArgs, aName, aDefaultValue) {
|
|
1597
|
+
if (aName in aArgs) {
|
|
1598
|
+
return aArgs[aName];
|
|
1599
|
+
} else if (arguments.length === 3) {
|
|
1600
|
+
return aDefaultValue;
|
|
1601
|
+
}
|
|
1602
|
+
throw new Error('"' + aName + '" is a required argument.');
|
|
1603
|
+
}
|
|
1604
|
+
exports.getArg = getArg;
|
|
1605
|
+
var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;
|
|
1606
|
+
var dataUrlRegexp = /^data:.+\,.+$/;
|
|
1607
|
+
function urlParse(aUrl) {
|
|
1608
|
+
const match = aUrl.match(urlRegexp);
|
|
1609
|
+
if (!match) {
|
|
1610
|
+
return null;
|
|
1611
|
+
}
|
|
1612
|
+
return {
|
|
1613
|
+
scheme: match[1],
|
|
1614
|
+
auth: match[2],
|
|
1615
|
+
host: match[3],
|
|
1616
|
+
port: match[4],
|
|
1617
|
+
path: match[5]
|
|
1618
|
+
};
|
|
1619
|
+
}
|
|
1620
|
+
exports.urlParse = urlParse;
|
|
1621
|
+
function urlGenerate(aParsedUrl) {
|
|
1622
|
+
let url = "";
|
|
1623
|
+
if (aParsedUrl.scheme) {
|
|
1624
|
+
url += aParsedUrl.scheme + ":";
|
|
1625
|
+
}
|
|
1626
|
+
url += "//";
|
|
1627
|
+
if (aParsedUrl.auth) {
|
|
1628
|
+
url += aParsedUrl.auth + "@";
|
|
1629
|
+
}
|
|
1630
|
+
if (aParsedUrl.host) {
|
|
1631
|
+
url += aParsedUrl.host;
|
|
1632
|
+
}
|
|
1633
|
+
if (aParsedUrl.port) {
|
|
1634
|
+
url += ":" + aParsedUrl.port;
|
|
1635
|
+
}
|
|
1636
|
+
if (aParsedUrl.path) {
|
|
1637
|
+
url += aParsedUrl.path;
|
|
1638
|
+
}
|
|
1639
|
+
return url;
|
|
1640
|
+
}
|
|
1641
|
+
exports.urlGenerate = urlGenerate;
|
|
1642
|
+
var MAX_CACHED_INPUTS = 32;
|
|
1643
|
+
function lruMemoize(f) {
|
|
1644
|
+
const cache = [];
|
|
1645
|
+
return function(input) {
|
|
1646
|
+
for (let i = 0; i < cache.length; i++) {
|
|
1647
|
+
if (cache[i].input === input) {
|
|
1648
|
+
const temp = cache[0];
|
|
1649
|
+
cache[0] = cache[i];
|
|
1650
|
+
cache[i] = temp;
|
|
1651
|
+
return cache[0].result;
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1654
|
+
const result = f(input);
|
|
1655
|
+
cache.unshift({
|
|
1656
|
+
input,
|
|
1657
|
+
result
|
|
1658
|
+
});
|
|
1659
|
+
if (cache.length > MAX_CACHED_INPUTS) {
|
|
1660
|
+
cache.pop();
|
|
1661
|
+
}
|
|
1662
|
+
return result;
|
|
1663
|
+
};
|
|
1664
|
+
}
|
|
1665
|
+
var normalize = lruMemoize(function normalize2(aPath) {
|
|
1666
|
+
let path = aPath;
|
|
1667
|
+
const url = urlParse(aPath);
|
|
1668
|
+
if (url) {
|
|
1669
|
+
if (!url.path) {
|
|
1670
|
+
return aPath;
|
|
1671
|
+
}
|
|
1672
|
+
path = url.path;
|
|
1673
|
+
}
|
|
1674
|
+
const isAbsolute2 = exports.isAbsolute(path);
|
|
1675
|
+
const parts = [];
|
|
1676
|
+
let start = 0;
|
|
1677
|
+
let i = 0;
|
|
1678
|
+
while (true) {
|
|
1679
|
+
start = i;
|
|
1680
|
+
i = path.indexOf("/", start);
|
|
1681
|
+
if (i === -1) {
|
|
1682
|
+
parts.push(path.slice(start));
|
|
1683
|
+
break;
|
|
1684
|
+
} else {
|
|
1685
|
+
parts.push(path.slice(start, i));
|
|
1686
|
+
while (i < path.length && path[i] === "/") {
|
|
1687
|
+
i++;
|
|
1688
|
+
}
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
let up = 0;
|
|
1692
|
+
for (i = parts.length - 1; i >= 0; i--) {
|
|
1693
|
+
const part = parts[i];
|
|
1694
|
+
if (part === ".") {
|
|
1695
|
+
parts.splice(i, 1);
|
|
1696
|
+
} else if (part === "..") {
|
|
1697
|
+
up++;
|
|
1698
|
+
} else if (up > 0) {
|
|
1699
|
+
if (part === "") {
|
|
1700
|
+
parts.splice(i + 1, up);
|
|
1701
|
+
up = 0;
|
|
1702
|
+
} else {
|
|
1703
|
+
parts.splice(i, 2);
|
|
1704
|
+
up--;
|
|
1705
|
+
}
|
|
1706
|
+
}
|
|
1707
|
+
}
|
|
1708
|
+
path = parts.join("/");
|
|
1709
|
+
if (path === "") {
|
|
1710
|
+
path = isAbsolute2 ? "/" : ".";
|
|
1711
|
+
}
|
|
1712
|
+
if (url) {
|
|
1713
|
+
url.path = path;
|
|
1714
|
+
return urlGenerate(url);
|
|
1715
|
+
}
|
|
1716
|
+
return path;
|
|
1717
|
+
});
|
|
1718
|
+
exports.normalize = normalize;
|
|
1719
|
+
function join(aRoot, aPath) {
|
|
1720
|
+
if (aRoot === "") {
|
|
1721
|
+
aRoot = ".";
|
|
1722
|
+
}
|
|
1723
|
+
if (aPath === "") {
|
|
1724
|
+
aPath = ".";
|
|
1725
|
+
}
|
|
1726
|
+
const aPathUrl = urlParse(aPath);
|
|
1727
|
+
const aRootUrl = urlParse(aRoot);
|
|
1728
|
+
if (aRootUrl) {
|
|
1729
|
+
aRoot = aRootUrl.path || "/";
|
|
1730
|
+
}
|
|
1731
|
+
if (aPathUrl && !aPathUrl.scheme) {
|
|
1732
|
+
if (aRootUrl) {
|
|
1733
|
+
aPathUrl.scheme = aRootUrl.scheme;
|
|
1734
|
+
}
|
|
1735
|
+
return urlGenerate(aPathUrl);
|
|
1736
|
+
}
|
|
1737
|
+
if (aPathUrl || aPath.match(dataUrlRegexp)) {
|
|
1738
|
+
return aPath;
|
|
1739
|
+
}
|
|
1740
|
+
if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
|
|
1741
|
+
aRootUrl.host = aPath;
|
|
1742
|
+
return urlGenerate(aRootUrl);
|
|
1743
|
+
}
|
|
1744
|
+
const joined = aPath.charAt(0) === "/" ? aPath : normalize(aRoot.replace(/\/+$/, "") + "/" + aPath);
|
|
1745
|
+
if (aRootUrl) {
|
|
1746
|
+
aRootUrl.path = joined;
|
|
1747
|
+
return urlGenerate(aRootUrl);
|
|
1748
|
+
}
|
|
1749
|
+
return joined;
|
|
1750
|
+
}
|
|
1751
|
+
exports.join = join;
|
|
1752
|
+
exports.isAbsolute = function(aPath) {
|
|
1753
|
+
return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
|
|
1754
|
+
};
|
|
1755
|
+
function relative(aRoot, aPath) {
|
|
1756
|
+
if (aRoot === "") {
|
|
1757
|
+
aRoot = ".";
|
|
1758
|
+
}
|
|
1759
|
+
aRoot = aRoot.replace(/\/$/, "");
|
|
1760
|
+
let level = 0;
|
|
1761
|
+
while (aPath.indexOf(aRoot + "/") !== 0) {
|
|
1762
|
+
const index = aRoot.lastIndexOf("/");
|
|
1763
|
+
if (index < 0) {
|
|
1764
|
+
return aPath;
|
|
1765
|
+
}
|
|
1766
|
+
aRoot = aRoot.slice(0, index);
|
|
1767
|
+
if (aRoot.match(/^([^\/]+:\/)?\/*$/)) {
|
|
1768
|
+
return aPath;
|
|
1769
|
+
}
|
|
1770
|
+
++level;
|
|
1771
|
+
}
|
|
1772
|
+
return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
|
|
1773
|
+
}
|
|
1774
|
+
exports.relative = relative;
|
|
1775
|
+
var supportsNullProto = function() {
|
|
1776
|
+
const obj = /* @__PURE__ */ Object.create(null);
|
|
1777
|
+
return !("__proto__" in obj);
|
|
1778
|
+
}();
|
|
1779
|
+
function identity(s) {
|
|
1780
|
+
return s;
|
|
1781
|
+
}
|
|
1782
|
+
function toSetString(aStr) {
|
|
1783
|
+
if (isProtoString(aStr)) {
|
|
1784
|
+
return "$" + aStr;
|
|
1785
|
+
}
|
|
1786
|
+
return aStr;
|
|
1787
|
+
}
|
|
1788
|
+
exports.toSetString = supportsNullProto ? identity : toSetString;
|
|
1789
|
+
function fromSetString(aStr) {
|
|
1790
|
+
if (isProtoString(aStr)) {
|
|
1791
|
+
return aStr.slice(1);
|
|
1792
|
+
}
|
|
1793
|
+
return aStr;
|
|
1794
|
+
}
|
|
1795
|
+
exports.fromSetString = supportsNullProto ? identity : fromSetString;
|
|
1796
|
+
function isProtoString(s) {
|
|
1797
|
+
if (!s) {
|
|
1798
|
+
return false;
|
|
1799
|
+
}
|
|
1800
|
+
const length = s.length;
|
|
1801
|
+
if (length < 9) {
|
|
1802
|
+
return false;
|
|
1803
|
+
}
|
|
1804
|
+
if (s.charCodeAt(length - 1) !== 95 || s.charCodeAt(length - 2) !== 95 || s.charCodeAt(length - 3) !== 111 || s.charCodeAt(length - 4) !== 116 || s.charCodeAt(length - 5) !== 111 || s.charCodeAt(length - 6) !== 114 || s.charCodeAt(length - 7) !== 112 || s.charCodeAt(length - 8) !== 95 || s.charCodeAt(length - 9) !== 95) {
|
|
1805
|
+
return false;
|
|
1806
|
+
}
|
|
1807
|
+
for (let i = length - 10; i >= 0; i--) {
|
|
1808
|
+
if (s.charCodeAt(i) !== 36) {
|
|
1809
|
+
return false;
|
|
1810
|
+
}
|
|
1811
|
+
}
|
|
1812
|
+
return true;
|
|
1813
|
+
}
|
|
1814
|
+
function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
|
|
1815
|
+
let cmp = strcmp(mappingA.source, mappingB.source);
|
|
1816
|
+
if (cmp !== 0) {
|
|
1817
|
+
return cmp;
|
|
1818
|
+
}
|
|
1819
|
+
cmp = mappingA.originalLine - mappingB.originalLine;
|
|
1820
|
+
if (cmp !== 0) {
|
|
1821
|
+
return cmp;
|
|
1822
|
+
}
|
|
1823
|
+
cmp = mappingA.originalColumn - mappingB.originalColumn;
|
|
1824
|
+
if (cmp !== 0 || onlyCompareOriginal) {
|
|
1825
|
+
return cmp;
|
|
1826
|
+
}
|
|
1827
|
+
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
|
|
1828
|
+
if (cmp !== 0) {
|
|
1829
|
+
return cmp;
|
|
1830
|
+
}
|
|
1831
|
+
cmp = mappingA.generatedLine - mappingB.generatedLine;
|
|
1832
|
+
if (cmp !== 0) {
|
|
1833
|
+
return cmp;
|
|
1834
|
+
}
|
|
1835
|
+
return strcmp(mappingA.name, mappingB.name);
|
|
1836
|
+
}
|
|
1837
|
+
exports.compareByOriginalPositions = compareByOriginalPositions;
|
|
1838
|
+
function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
|
|
1839
|
+
let cmp = mappingA.generatedLine - mappingB.generatedLine;
|
|
1840
|
+
if (cmp !== 0) {
|
|
1841
|
+
return cmp;
|
|
1842
|
+
}
|
|
1843
|
+
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
|
|
1844
|
+
if (cmp !== 0 || onlyCompareGenerated) {
|
|
1845
|
+
return cmp;
|
|
1846
|
+
}
|
|
1847
|
+
cmp = strcmp(mappingA.source, mappingB.source);
|
|
1848
|
+
if (cmp !== 0) {
|
|
1849
|
+
return cmp;
|
|
1850
|
+
}
|
|
1851
|
+
cmp = mappingA.originalLine - mappingB.originalLine;
|
|
1852
|
+
if (cmp !== 0) {
|
|
1853
|
+
return cmp;
|
|
1854
|
+
}
|
|
1855
|
+
cmp = mappingA.originalColumn - mappingB.originalColumn;
|
|
1856
|
+
if (cmp !== 0) {
|
|
1857
|
+
return cmp;
|
|
1858
|
+
}
|
|
1859
|
+
return strcmp(mappingA.name, mappingB.name);
|
|
1860
|
+
}
|
|
1861
|
+
exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
|
|
1862
|
+
function strcmp(aStr1, aStr2) {
|
|
1863
|
+
if (aStr1 === aStr2) {
|
|
1864
|
+
return 0;
|
|
1865
|
+
}
|
|
1866
|
+
if (aStr1 === null) {
|
|
1867
|
+
return 1;
|
|
1868
|
+
}
|
|
1869
|
+
if (aStr2 === null) {
|
|
1870
|
+
return -1;
|
|
1871
|
+
}
|
|
1872
|
+
if (aStr1 > aStr2) {
|
|
1873
|
+
return 1;
|
|
1874
|
+
}
|
|
1875
|
+
return -1;
|
|
1876
|
+
}
|
|
1877
|
+
function compareByGeneratedPositionsInflated(mappingA, mappingB) {
|
|
1878
|
+
let cmp = mappingA.generatedLine - mappingB.generatedLine;
|
|
1879
|
+
if (cmp !== 0) {
|
|
1880
|
+
return cmp;
|
|
1881
|
+
}
|
|
1882
|
+
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
|
|
1883
|
+
if (cmp !== 0) {
|
|
1884
|
+
return cmp;
|
|
1885
|
+
}
|
|
1886
|
+
cmp = strcmp(mappingA.source, mappingB.source);
|
|
1887
|
+
if (cmp !== 0) {
|
|
1888
|
+
return cmp;
|
|
1889
|
+
}
|
|
1890
|
+
cmp = mappingA.originalLine - mappingB.originalLine;
|
|
1891
|
+
if (cmp !== 0) {
|
|
1892
|
+
return cmp;
|
|
1893
|
+
}
|
|
1894
|
+
cmp = mappingA.originalColumn - mappingB.originalColumn;
|
|
1895
|
+
if (cmp !== 0) {
|
|
1896
|
+
return cmp;
|
|
1897
|
+
}
|
|
1898
|
+
return strcmp(mappingA.name, mappingB.name);
|
|
1899
|
+
}
|
|
1900
|
+
exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
|
|
1901
|
+
function parseSourceMapInput(str) {
|
|
1902
|
+
return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ""));
|
|
1903
|
+
}
|
|
1904
|
+
exports.parseSourceMapInput = parseSourceMapInput;
|
|
1905
|
+
function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {
|
|
1906
|
+
sourceURL = sourceURL || "";
|
|
1907
|
+
if (sourceRoot) {
|
|
1908
|
+
if (sourceRoot[sourceRoot.length - 1] !== "/" && sourceURL[0] !== "/") {
|
|
1909
|
+
sourceRoot += "/";
|
|
1910
|
+
}
|
|
1911
|
+
sourceURL = sourceRoot + sourceURL;
|
|
1912
|
+
}
|
|
1913
|
+
if (sourceMapURL) {
|
|
1914
|
+
const parsed = urlParse(sourceMapURL);
|
|
1915
|
+
if (!parsed) {
|
|
1916
|
+
throw new Error("sourceMapURL could not be parsed");
|
|
1917
|
+
}
|
|
1918
|
+
if (parsed.path) {
|
|
1919
|
+
const index = parsed.path.lastIndexOf("/");
|
|
1920
|
+
if (index >= 0) {
|
|
1921
|
+
parsed.path = parsed.path.substring(0, index + 1);
|
|
1922
|
+
}
|
|
1923
|
+
}
|
|
1924
|
+
sourceURL = join(urlGenerate(parsed), sourceURL);
|
|
1925
|
+
}
|
|
1926
|
+
return normalize(sourceURL);
|
|
1927
|
+
}
|
|
1928
|
+
exports.computeSourceURL = computeSourceURL;
|
|
1929
|
+
}
|
|
1930
|
+
});
|
|
1931
|
+
|
|
1932
|
+
// ../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/array-set.js
|
|
1933
|
+
var require_array_set = __commonJS({
|
|
1934
|
+
"../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/array-set.js"(exports) {
|
|
1935
|
+
var ArraySet = class _ArraySet {
|
|
1936
|
+
constructor() {
|
|
1937
|
+
this._array = [];
|
|
1938
|
+
this._set = /* @__PURE__ */ new Map();
|
|
1939
|
+
}
|
|
1940
|
+
/**
|
|
1941
|
+
* Static method for creating ArraySet instances from an existing array.
|
|
1942
|
+
*/
|
|
1943
|
+
static fromArray(aArray, aAllowDuplicates) {
|
|
1944
|
+
const set = new _ArraySet();
|
|
1945
|
+
for (let i = 0, len = aArray.length; i < len; i++) {
|
|
1946
|
+
set.add(aArray[i], aAllowDuplicates);
|
|
1947
|
+
}
|
|
1948
|
+
return set;
|
|
1949
|
+
}
|
|
1950
|
+
/**
|
|
1951
|
+
* Return how many unique items are in this ArraySet. If duplicates have been
|
|
1952
|
+
* added, than those do not count towards the size.
|
|
1953
|
+
*
|
|
1954
|
+
* @returns Number
|
|
1955
|
+
*/
|
|
1956
|
+
size() {
|
|
1957
|
+
return this._set.size;
|
|
1958
|
+
}
|
|
1959
|
+
/**
|
|
1960
|
+
* Add the given string to this set.
|
|
1961
|
+
*
|
|
1962
|
+
* @param String aStr
|
|
1963
|
+
*/
|
|
1964
|
+
add(aStr, aAllowDuplicates) {
|
|
1965
|
+
const isDuplicate = this.has(aStr);
|
|
1966
|
+
const idx = this._array.length;
|
|
1967
|
+
if (!isDuplicate || aAllowDuplicates) {
|
|
1968
|
+
this._array.push(aStr);
|
|
1969
|
+
}
|
|
1970
|
+
if (!isDuplicate) {
|
|
1971
|
+
this._set.set(aStr, idx);
|
|
1972
|
+
}
|
|
1973
|
+
}
|
|
1974
|
+
/**
|
|
1975
|
+
* Is the given string a member of this set?
|
|
1976
|
+
*
|
|
1977
|
+
* @param String aStr
|
|
1978
|
+
*/
|
|
1979
|
+
has(aStr) {
|
|
1980
|
+
return this._set.has(aStr);
|
|
1981
|
+
}
|
|
1982
|
+
/**
|
|
1983
|
+
* What is the index of the given string in the array?
|
|
1984
|
+
*
|
|
1985
|
+
* @param String aStr
|
|
1986
|
+
*/
|
|
1987
|
+
indexOf(aStr) {
|
|
1988
|
+
const idx = this._set.get(aStr);
|
|
1989
|
+
if (idx >= 0) {
|
|
1990
|
+
return idx;
|
|
1991
|
+
}
|
|
1992
|
+
throw new Error('"' + aStr + '" is not in the set.');
|
|
1993
|
+
}
|
|
1994
|
+
/**
|
|
1995
|
+
* What is the element at the given index?
|
|
1996
|
+
*
|
|
1997
|
+
* @param Number aIdx
|
|
1998
|
+
*/
|
|
1999
|
+
at(aIdx) {
|
|
2000
|
+
if (aIdx >= 0 && aIdx < this._array.length) {
|
|
2001
|
+
return this._array[aIdx];
|
|
2002
|
+
}
|
|
2003
|
+
throw new Error("No element indexed by " + aIdx);
|
|
2004
|
+
}
|
|
2005
|
+
/**
|
|
2006
|
+
* Returns the array representation of this set (which has the proper indices
|
|
2007
|
+
* indicated by indexOf). Note that this is a copy of the internal array used
|
|
2008
|
+
* for storing the members so that no one can mess with internal state.
|
|
2009
|
+
*/
|
|
2010
|
+
toArray() {
|
|
2011
|
+
return this._array.slice();
|
|
2012
|
+
}
|
|
2013
|
+
};
|
|
2014
|
+
exports.ArraySet = ArraySet;
|
|
2015
|
+
}
|
|
2016
|
+
});
|
|
2017
|
+
|
|
2018
|
+
// ../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/mapping-list.js
|
|
2019
|
+
var require_mapping_list = __commonJS({
|
|
2020
|
+
"../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/mapping-list.js"(exports) {
|
|
2021
|
+
var util = require_util();
|
|
2022
|
+
function generatedPositionAfter(mappingA, mappingB) {
|
|
2023
|
+
const lineA = mappingA.generatedLine;
|
|
2024
|
+
const lineB = mappingB.generatedLine;
|
|
2025
|
+
const columnA = mappingA.generatedColumn;
|
|
2026
|
+
const columnB = mappingB.generatedColumn;
|
|
2027
|
+
return lineB > lineA || lineB == lineA && columnB >= columnA || util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;
|
|
2028
|
+
}
|
|
2029
|
+
var MappingList = class {
|
|
2030
|
+
constructor() {
|
|
2031
|
+
this._array = [];
|
|
2032
|
+
this._sorted = true;
|
|
2033
|
+
this._last = { generatedLine: -1, generatedColumn: 0 };
|
|
2034
|
+
}
|
|
2035
|
+
/**
|
|
2036
|
+
* Iterate through internal items. This method takes the same arguments that
|
|
2037
|
+
* `Array.prototype.forEach` takes.
|
|
2038
|
+
*
|
|
2039
|
+
* NOTE: The order of the mappings is NOT guaranteed.
|
|
2040
|
+
*/
|
|
2041
|
+
unsortedForEach(aCallback, aThisArg) {
|
|
2042
|
+
this._array.forEach(aCallback, aThisArg);
|
|
2043
|
+
}
|
|
2044
|
+
/**
|
|
2045
|
+
* Add the given source mapping.
|
|
2046
|
+
*
|
|
2047
|
+
* @param Object aMapping
|
|
2048
|
+
*/
|
|
2049
|
+
add(aMapping) {
|
|
2050
|
+
if (generatedPositionAfter(this._last, aMapping)) {
|
|
2051
|
+
this._last = aMapping;
|
|
2052
|
+
this._array.push(aMapping);
|
|
2053
|
+
} else {
|
|
2054
|
+
this._sorted = false;
|
|
2055
|
+
this._array.push(aMapping);
|
|
2056
|
+
}
|
|
2057
|
+
}
|
|
2058
|
+
/**
|
|
2059
|
+
* Returns the flat, sorted array of mappings. The mappings are sorted by
|
|
2060
|
+
* generated position.
|
|
2061
|
+
*
|
|
2062
|
+
* WARNING: This method returns internal data without copying, for
|
|
2063
|
+
* performance. The return value must NOT be mutated, and should be treated as
|
|
2064
|
+
* an immutable borrow. If you want to take ownership, you must make your own
|
|
2065
|
+
* copy.
|
|
2066
|
+
*/
|
|
2067
|
+
toArray() {
|
|
2068
|
+
if (!this._sorted) {
|
|
2069
|
+
this._array.sort(util.compareByGeneratedPositionsInflated);
|
|
2070
|
+
this._sorted = true;
|
|
2071
|
+
}
|
|
2072
|
+
return this._array;
|
|
2073
|
+
}
|
|
2074
|
+
};
|
|
2075
|
+
exports.MappingList = MappingList;
|
|
2076
|
+
}
|
|
2077
|
+
});
|
|
2078
|
+
|
|
2079
|
+
// ../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/source-map-generator.js
|
|
2080
|
+
var require_source_map_generator = __commonJS({
|
|
2081
|
+
"../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/source-map-generator.js"(exports) {
|
|
2082
|
+
var base64VLQ = require_base64_vlq();
|
|
2083
|
+
var util = require_util();
|
|
2084
|
+
var ArraySet = require_array_set().ArraySet;
|
|
2085
|
+
var MappingList = require_mapping_list().MappingList;
|
|
2086
|
+
var SourceMapGenerator2 = class _SourceMapGenerator {
|
|
2087
|
+
constructor(aArgs) {
|
|
2088
|
+
if (!aArgs) {
|
|
2089
|
+
aArgs = {};
|
|
2090
|
+
}
|
|
2091
|
+
this._file = util.getArg(aArgs, "file", null);
|
|
2092
|
+
this._sourceRoot = util.getArg(aArgs, "sourceRoot", null);
|
|
2093
|
+
this._skipValidation = util.getArg(aArgs, "skipValidation", false);
|
|
2094
|
+
this._sources = new ArraySet();
|
|
2095
|
+
this._names = new ArraySet();
|
|
2096
|
+
this._mappings = new MappingList();
|
|
2097
|
+
this._sourcesContents = null;
|
|
2098
|
+
}
|
|
2099
|
+
/**
|
|
2100
|
+
* Creates a new SourceMapGenerator based on a SourceMapConsumer
|
|
2101
|
+
*
|
|
2102
|
+
* @param aSourceMapConsumer The SourceMap.
|
|
2103
|
+
*/
|
|
2104
|
+
static fromSourceMap(aSourceMapConsumer) {
|
|
2105
|
+
const sourceRoot = aSourceMapConsumer.sourceRoot;
|
|
2106
|
+
const generator = new _SourceMapGenerator({
|
|
2107
|
+
file: aSourceMapConsumer.file,
|
|
2108
|
+
sourceRoot
|
|
2109
|
+
});
|
|
2110
|
+
aSourceMapConsumer.eachMapping(function(mapping) {
|
|
2111
|
+
const newMapping = {
|
|
2112
|
+
generated: {
|
|
2113
|
+
line: mapping.generatedLine,
|
|
2114
|
+
column: mapping.generatedColumn
|
|
2115
|
+
}
|
|
2116
|
+
};
|
|
2117
|
+
if (mapping.source != null) {
|
|
2118
|
+
newMapping.source = mapping.source;
|
|
2119
|
+
if (sourceRoot != null) {
|
|
2120
|
+
newMapping.source = util.relative(sourceRoot, newMapping.source);
|
|
2121
|
+
}
|
|
2122
|
+
newMapping.original = {
|
|
2123
|
+
line: mapping.originalLine,
|
|
2124
|
+
column: mapping.originalColumn
|
|
2125
|
+
};
|
|
2126
|
+
if (mapping.name != null) {
|
|
2127
|
+
newMapping.name = mapping.name;
|
|
2128
|
+
}
|
|
2129
|
+
}
|
|
2130
|
+
generator.addMapping(newMapping);
|
|
2131
|
+
});
|
|
2132
|
+
aSourceMapConsumer.sources.forEach(function(sourceFile) {
|
|
2133
|
+
let sourceRelative = sourceFile;
|
|
2134
|
+
if (sourceRoot !== null) {
|
|
2135
|
+
sourceRelative = util.relative(sourceRoot, sourceFile);
|
|
2136
|
+
}
|
|
2137
|
+
if (!generator._sources.has(sourceRelative)) {
|
|
2138
|
+
generator._sources.add(sourceRelative);
|
|
2139
|
+
}
|
|
2140
|
+
const content = aSourceMapConsumer.sourceContentFor(sourceFile);
|
|
2141
|
+
if (content != null) {
|
|
2142
|
+
generator.setSourceContent(sourceFile, content);
|
|
2143
|
+
}
|
|
2144
|
+
});
|
|
2145
|
+
return generator;
|
|
2146
|
+
}
|
|
2147
|
+
/**
|
|
2148
|
+
* Add a single mapping from original source line and column to the generated
|
|
2149
|
+
* source's line and column for this source map being created. The mapping
|
|
2150
|
+
* object should have the following properties:
|
|
2151
|
+
*
|
|
2152
|
+
* - generated: An object with the generated line and column positions.
|
|
2153
|
+
* - original: An object with the original line and column positions.
|
|
2154
|
+
* - source: The original source file (relative to the sourceRoot).
|
|
2155
|
+
* - name: An optional original token name for this mapping.
|
|
2156
|
+
*/
|
|
2157
|
+
addMapping(aArgs) {
|
|
2158
|
+
const generated = util.getArg(aArgs, "generated");
|
|
2159
|
+
const original = util.getArg(aArgs, "original", null);
|
|
2160
|
+
let source = util.getArg(aArgs, "source", null);
|
|
2161
|
+
let name = util.getArg(aArgs, "name", null);
|
|
2162
|
+
if (!this._skipValidation) {
|
|
2163
|
+
this._validateMapping(generated, original, source, name);
|
|
2164
|
+
}
|
|
2165
|
+
if (source != null) {
|
|
2166
|
+
source = String(source);
|
|
2167
|
+
if (!this._sources.has(source)) {
|
|
2168
|
+
this._sources.add(source);
|
|
2169
|
+
}
|
|
2170
|
+
}
|
|
2171
|
+
if (name != null) {
|
|
2172
|
+
name = String(name);
|
|
2173
|
+
if (!this._names.has(name)) {
|
|
2174
|
+
this._names.add(name);
|
|
2175
|
+
}
|
|
2176
|
+
}
|
|
2177
|
+
this._mappings.add({
|
|
2178
|
+
generatedLine: generated.line,
|
|
2179
|
+
generatedColumn: generated.column,
|
|
2180
|
+
originalLine: original != null && original.line,
|
|
2181
|
+
originalColumn: original != null && original.column,
|
|
2182
|
+
source,
|
|
2183
|
+
name
|
|
2184
|
+
});
|
|
2185
|
+
}
|
|
2186
|
+
/**
|
|
2187
|
+
* Set the source content for a source file.
|
|
2188
|
+
*/
|
|
2189
|
+
setSourceContent(aSourceFile, aSourceContent) {
|
|
2190
|
+
let source = aSourceFile;
|
|
2191
|
+
if (this._sourceRoot != null) {
|
|
2192
|
+
source = util.relative(this._sourceRoot, source);
|
|
2193
|
+
}
|
|
2194
|
+
if (aSourceContent != null) {
|
|
2195
|
+
if (!this._sourcesContents) {
|
|
2196
|
+
this._sourcesContents = /* @__PURE__ */ Object.create(null);
|
|
2197
|
+
}
|
|
2198
|
+
this._sourcesContents[util.toSetString(source)] = aSourceContent;
|
|
2199
|
+
} else if (this._sourcesContents) {
|
|
2200
|
+
delete this._sourcesContents[util.toSetString(source)];
|
|
2201
|
+
if (Object.keys(this._sourcesContents).length === 0) {
|
|
2202
|
+
this._sourcesContents = null;
|
|
2203
|
+
}
|
|
2204
|
+
}
|
|
2205
|
+
}
|
|
2206
|
+
/**
|
|
2207
|
+
* Applies the mappings of a sub-source-map for a specific source file to the
|
|
2208
|
+
* source map being generated. Each mapping to the supplied source file is
|
|
2209
|
+
* rewritten using the supplied source map. Note: The resolution for the
|
|
2210
|
+
* resulting mappings is the minimium of this map and the supplied map.
|
|
2211
|
+
*
|
|
2212
|
+
* @param aSourceMapConsumer The source map to be applied.
|
|
2213
|
+
* @param aSourceFile Optional. The filename of the source file.
|
|
2214
|
+
* If omitted, SourceMapConsumer's file property will be used.
|
|
2215
|
+
* @param aSourceMapPath Optional. The dirname of the path to the source map
|
|
2216
|
+
* to be applied. If relative, it is relative to the SourceMapConsumer.
|
|
2217
|
+
* This parameter is needed when the two source maps aren't in the same
|
|
2218
|
+
* directory, and the source map to be applied contains relative source
|
|
2219
|
+
* paths. If so, those relative source paths need to be rewritten
|
|
2220
|
+
* relative to the SourceMapGenerator.
|
|
2221
|
+
*/
|
|
2222
|
+
applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {
|
|
2223
|
+
let sourceFile = aSourceFile;
|
|
2224
|
+
if (aSourceFile == null) {
|
|
2225
|
+
if (aSourceMapConsumer.file == null) {
|
|
2226
|
+
throw new Error(
|
|
2227
|
+
`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`
|
|
2228
|
+
);
|
|
2229
|
+
}
|
|
2230
|
+
sourceFile = aSourceMapConsumer.file;
|
|
2231
|
+
}
|
|
2232
|
+
const sourceRoot = this._sourceRoot;
|
|
2233
|
+
if (sourceRoot != null) {
|
|
2234
|
+
sourceFile = util.relative(sourceRoot, sourceFile);
|
|
2235
|
+
}
|
|
2236
|
+
const newSources = this._mappings.toArray().length > 0 ? new ArraySet() : this._sources;
|
|
2237
|
+
const newNames = new ArraySet();
|
|
2238
|
+
this._mappings.unsortedForEach(function(mapping) {
|
|
2239
|
+
if (mapping.source === sourceFile && mapping.originalLine != null) {
|
|
2240
|
+
const original = aSourceMapConsumer.originalPositionFor({
|
|
2241
|
+
line: mapping.originalLine,
|
|
2242
|
+
column: mapping.originalColumn
|
|
2243
|
+
});
|
|
2244
|
+
if (original.source != null) {
|
|
2245
|
+
mapping.source = original.source;
|
|
2246
|
+
if (aSourceMapPath != null) {
|
|
2247
|
+
mapping.source = util.join(aSourceMapPath, mapping.source);
|
|
2248
|
+
}
|
|
2249
|
+
if (sourceRoot != null) {
|
|
2250
|
+
mapping.source = util.relative(sourceRoot, mapping.source);
|
|
2251
|
+
}
|
|
2252
|
+
mapping.originalLine = original.line;
|
|
2253
|
+
mapping.originalColumn = original.column;
|
|
2254
|
+
if (original.name != null) {
|
|
2255
|
+
mapping.name = original.name;
|
|
2256
|
+
}
|
|
2257
|
+
}
|
|
2258
|
+
}
|
|
2259
|
+
const source = mapping.source;
|
|
2260
|
+
if (source != null && !newSources.has(source)) {
|
|
2261
|
+
newSources.add(source);
|
|
2262
|
+
}
|
|
2263
|
+
const name = mapping.name;
|
|
2264
|
+
if (name != null && !newNames.has(name)) {
|
|
2265
|
+
newNames.add(name);
|
|
2266
|
+
}
|
|
2267
|
+
}, this);
|
|
2268
|
+
this._sources = newSources;
|
|
2269
|
+
this._names = newNames;
|
|
2270
|
+
aSourceMapConsumer.sources.forEach(function(srcFile) {
|
|
2271
|
+
const content = aSourceMapConsumer.sourceContentFor(srcFile);
|
|
2272
|
+
if (content != null) {
|
|
2273
|
+
if (aSourceMapPath != null) {
|
|
2274
|
+
srcFile = util.join(aSourceMapPath, srcFile);
|
|
2275
|
+
}
|
|
2276
|
+
if (sourceRoot != null) {
|
|
2277
|
+
srcFile = util.relative(sourceRoot, srcFile);
|
|
2278
|
+
}
|
|
2279
|
+
this.setSourceContent(srcFile, content);
|
|
2280
|
+
}
|
|
2281
|
+
}, this);
|
|
2282
|
+
}
|
|
2283
|
+
/**
|
|
2284
|
+
* A mapping can have one of the three levels of data:
|
|
2285
|
+
*
|
|
2286
|
+
* 1. Just the generated position.
|
|
2287
|
+
* 2. The Generated position, original position, and original source.
|
|
2288
|
+
* 3. Generated and original position, original source, as well as a name
|
|
2289
|
+
* token.
|
|
2290
|
+
*
|
|
2291
|
+
* To maintain consistency, we validate that any new mapping being added falls
|
|
2292
|
+
* in to one of these categories.
|
|
2293
|
+
*/
|
|
2294
|
+
_validateMapping(aGenerated, aOriginal, aSource, aName) {
|
|
2295
|
+
if (aOriginal && typeof aOriginal.line !== "number" && typeof aOriginal.column !== "number") {
|
|
2296
|
+
throw new Error(
|
|
2297
|
+
"original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values."
|
|
2298
|
+
);
|
|
2299
|
+
}
|
|
2300
|
+
if (aGenerated && "line" in aGenerated && "column" in aGenerated && aGenerated.line > 0 && aGenerated.column >= 0 && !aOriginal && !aSource && !aName) {
|
|
2301
|
+
} else if (aGenerated && "line" in aGenerated && "column" in aGenerated && aOriginal && "line" in aOriginal && "column" in aOriginal && aGenerated.line > 0 && aGenerated.column >= 0 && aOriginal.line > 0 && aOriginal.column >= 0 && aSource) {
|
|
2302
|
+
} else {
|
|
2303
|
+
throw new Error("Invalid mapping: " + JSON.stringify({
|
|
2304
|
+
generated: aGenerated,
|
|
2305
|
+
source: aSource,
|
|
2306
|
+
original: aOriginal,
|
|
2307
|
+
name: aName
|
|
2308
|
+
}));
|
|
2309
|
+
}
|
|
2310
|
+
}
|
|
2311
|
+
/**
|
|
2312
|
+
* Serialize the accumulated mappings in to the stream of base 64 VLQs
|
|
2313
|
+
* specified by the source map format.
|
|
2314
|
+
*/
|
|
2315
|
+
_serializeMappings() {
|
|
2316
|
+
let previousGeneratedColumn = 0;
|
|
2317
|
+
let previousGeneratedLine = 1;
|
|
2318
|
+
let previousOriginalColumn = 0;
|
|
2319
|
+
let previousOriginalLine = 0;
|
|
2320
|
+
let previousName = 0;
|
|
2321
|
+
let previousSource = 0;
|
|
2322
|
+
let result = "";
|
|
2323
|
+
let next;
|
|
2324
|
+
let mapping;
|
|
2325
|
+
let nameIdx;
|
|
2326
|
+
let sourceIdx;
|
|
2327
|
+
const mappings = this._mappings.toArray();
|
|
2328
|
+
for (let i = 0, len = mappings.length; i < len; i++) {
|
|
2329
|
+
mapping = mappings[i];
|
|
2330
|
+
next = "";
|
|
2331
|
+
if (mapping.generatedLine !== previousGeneratedLine) {
|
|
2332
|
+
previousGeneratedColumn = 0;
|
|
2333
|
+
while (mapping.generatedLine !== previousGeneratedLine) {
|
|
2334
|
+
next += ";";
|
|
2335
|
+
previousGeneratedLine++;
|
|
2336
|
+
}
|
|
2337
|
+
} else if (i > 0) {
|
|
2338
|
+
if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {
|
|
2339
|
+
continue;
|
|
2340
|
+
}
|
|
2341
|
+
next += ",";
|
|
2342
|
+
}
|
|
2343
|
+
next += base64VLQ.encode(mapping.generatedColumn - previousGeneratedColumn);
|
|
2344
|
+
previousGeneratedColumn = mapping.generatedColumn;
|
|
2345
|
+
if (mapping.source != null) {
|
|
2346
|
+
sourceIdx = this._sources.indexOf(mapping.source);
|
|
2347
|
+
next += base64VLQ.encode(sourceIdx - previousSource);
|
|
2348
|
+
previousSource = sourceIdx;
|
|
2349
|
+
next += base64VLQ.encode(mapping.originalLine - 1 - previousOriginalLine);
|
|
2350
|
+
previousOriginalLine = mapping.originalLine - 1;
|
|
2351
|
+
next += base64VLQ.encode(mapping.originalColumn - previousOriginalColumn);
|
|
2352
|
+
previousOriginalColumn = mapping.originalColumn;
|
|
2353
|
+
if (mapping.name != null) {
|
|
2354
|
+
nameIdx = this._names.indexOf(mapping.name);
|
|
2355
|
+
next += base64VLQ.encode(nameIdx - previousName);
|
|
2356
|
+
previousName = nameIdx;
|
|
2357
|
+
}
|
|
2358
|
+
}
|
|
2359
|
+
result += next;
|
|
2360
|
+
}
|
|
2361
|
+
return result;
|
|
2362
|
+
}
|
|
2363
|
+
_generateSourcesContent(aSources, aSourceRoot) {
|
|
2364
|
+
return aSources.map(function(source) {
|
|
2365
|
+
if (!this._sourcesContents) {
|
|
2366
|
+
return null;
|
|
2367
|
+
}
|
|
2368
|
+
if (aSourceRoot != null) {
|
|
2369
|
+
source = util.relative(aSourceRoot, source);
|
|
2370
|
+
}
|
|
2371
|
+
const key = util.toSetString(source);
|
|
2372
|
+
return Object.prototype.hasOwnProperty.call(this._sourcesContents, key) ? this._sourcesContents[key] : null;
|
|
2373
|
+
}, this);
|
|
2374
|
+
}
|
|
2375
|
+
/**
|
|
2376
|
+
* Externalize the source map.
|
|
2377
|
+
*/
|
|
2378
|
+
toJSON() {
|
|
2379
|
+
const map = {
|
|
2380
|
+
version: this._version,
|
|
2381
|
+
sources: this._sources.toArray(),
|
|
2382
|
+
names: this._names.toArray(),
|
|
2383
|
+
mappings: this._serializeMappings()
|
|
2384
|
+
};
|
|
2385
|
+
if (this._file != null) {
|
|
2386
|
+
map.file = this._file;
|
|
2387
|
+
}
|
|
2388
|
+
if (this._sourceRoot != null) {
|
|
2389
|
+
map.sourceRoot = this._sourceRoot;
|
|
2390
|
+
}
|
|
2391
|
+
if (this._sourcesContents) {
|
|
2392
|
+
map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);
|
|
2393
|
+
}
|
|
2394
|
+
return map;
|
|
2395
|
+
}
|
|
2396
|
+
/**
|
|
2397
|
+
* Render the source map being generated to a string.
|
|
2398
|
+
*/
|
|
2399
|
+
toString() {
|
|
2400
|
+
return JSON.stringify(this.toJSON());
|
|
2401
|
+
}
|
|
2402
|
+
};
|
|
2403
|
+
SourceMapGenerator2.prototype._version = 3;
|
|
2404
|
+
exports.SourceMapGenerator = SourceMapGenerator2;
|
|
2405
|
+
}
|
|
2406
|
+
});
|
|
2407
|
+
|
|
2408
|
+
// ../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/binary-search.js
|
|
2409
|
+
var require_binary_search = __commonJS({
|
|
2410
|
+
"../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/binary-search.js"(exports) {
|
|
2411
|
+
exports.GREATEST_LOWER_BOUND = 1;
|
|
2412
|
+
exports.LEAST_UPPER_BOUND = 2;
|
|
2413
|
+
function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {
|
|
2414
|
+
const mid = Math.floor((aHigh - aLow) / 2) + aLow;
|
|
2415
|
+
const cmp = aCompare(aNeedle, aHaystack[mid], true);
|
|
2416
|
+
if (cmp === 0) {
|
|
2417
|
+
return mid;
|
|
2418
|
+
} else if (cmp > 0) {
|
|
2419
|
+
if (aHigh - mid > 1) {
|
|
2420
|
+
return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);
|
|
2421
|
+
}
|
|
2422
|
+
if (aBias == exports.LEAST_UPPER_BOUND) {
|
|
2423
|
+
return aHigh < aHaystack.length ? aHigh : -1;
|
|
2424
|
+
}
|
|
2425
|
+
return mid;
|
|
2426
|
+
}
|
|
2427
|
+
if (mid - aLow > 1) {
|
|
2428
|
+
return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);
|
|
2429
|
+
}
|
|
2430
|
+
if (aBias == exports.LEAST_UPPER_BOUND) {
|
|
2431
|
+
return mid;
|
|
2432
|
+
}
|
|
2433
|
+
return aLow < 0 ? -1 : aLow;
|
|
2434
|
+
}
|
|
2435
|
+
exports.search = function search(aNeedle, aHaystack, aCompare, aBias) {
|
|
2436
|
+
if (aHaystack.length === 0) {
|
|
2437
|
+
return -1;
|
|
2438
|
+
}
|
|
2439
|
+
let index = recursiveSearch(
|
|
2440
|
+
-1,
|
|
2441
|
+
aHaystack.length,
|
|
2442
|
+
aNeedle,
|
|
2443
|
+
aHaystack,
|
|
2444
|
+
aCompare,
|
|
2445
|
+
aBias || exports.GREATEST_LOWER_BOUND
|
|
2446
|
+
);
|
|
2447
|
+
if (index < 0) {
|
|
2448
|
+
return -1;
|
|
2449
|
+
}
|
|
2450
|
+
while (index - 1 >= 0) {
|
|
2451
|
+
if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {
|
|
2452
|
+
break;
|
|
2453
|
+
}
|
|
2454
|
+
--index;
|
|
2455
|
+
}
|
|
2456
|
+
return index;
|
|
2457
|
+
};
|
|
2458
|
+
}
|
|
2459
|
+
});
|
|
2460
|
+
|
|
2461
|
+
// ../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/read-wasm.js
|
|
2462
|
+
var require_read_wasm = __commonJS({
|
|
2463
|
+
"../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/read-wasm.js"(exports, module) {
|
|
2464
|
+
var isBrowserEnvironment = (function() {
|
|
2465
|
+
return typeof window !== "undefined" && this === window;
|
|
2466
|
+
}).call();
|
|
2467
|
+
if (isBrowserEnvironment) {
|
|
2468
|
+
let mappingsWasm = null;
|
|
2469
|
+
module.exports = function readWasm() {
|
|
2470
|
+
if (typeof mappingsWasm === "string") {
|
|
2471
|
+
return fetch(mappingsWasm).then((response) => response.arrayBuffer());
|
|
2472
|
+
}
|
|
2473
|
+
if (mappingsWasm instanceof ArrayBuffer) {
|
|
2474
|
+
return Promise.resolve(mappingsWasm);
|
|
2475
|
+
}
|
|
2476
|
+
throw new Error("You must provide the string URL or ArrayBuffer contents of lib/mappings.wasm by calling SourceMapConsumer.initialize({ 'lib/mappings.wasm': ... }) before using SourceMapConsumer");
|
|
2477
|
+
};
|
|
2478
|
+
module.exports.initialize = (input) => mappingsWasm = input;
|
|
2479
|
+
} else {
|
|
2480
|
+
const fs = require_fs();
|
|
2481
|
+
const path = require_path();
|
|
2482
|
+
module.exports = function readWasm() {
|
|
2483
|
+
return new Promise((resolve2, reject) => {
|
|
2484
|
+
const wasmPath = path.join(__dirname, "mappings.wasm");
|
|
2485
|
+
fs.readFile(wasmPath, null, (error, data) => {
|
|
2486
|
+
if (error) {
|
|
2487
|
+
reject(error);
|
|
2488
|
+
return;
|
|
2489
|
+
}
|
|
2490
|
+
resolve2(data.buffer);
|
|
2491
|
+
});
|
|
2492
|
+
});
|
|
2493
|
+
};
|
|
2494
|
+
module.exports.initialize = (_) => {
|
|
2495
|
+
console.debug("SourceMapConsumer.initialize is a no-op when running in node.js");
|
|
2496
|
+
};
|
|
2497
|
+
}
|
|
2498
|
+
}
|
|
2499
|
+
});
|
|
2500
|
+
|
|
2501
|
+
// ../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/wasm.js
|
|
2502
|
+
var require_wasm = __commonJS({
|
|
2503
|
+
"../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/wasm.js"(exports, module) {
|
|
2504
|
+
var readWasm = require_read_wasm();
|
|
2505
|
+
function Mapping() {
|
|
2506
|
+
this.generatedLine = 0;
|
|
2507
|
+
this.generatedColumn = 0;
|
|
2508
|
+
this.lastGeneratedColumn = null;
|
|
2509
|
+
this.source = null;
|
|
2510
|
+
this.originalLine = null;
|
|
2511
|
+
this.originalColumn = null;
|
|
2512
|
+
this.name = null;
|
|
2513
|
+
}
|
|
2514
|
+
var cachedWasm = null;
|
|
2515
|
+
module.exports = function wasm() {
|
|
2516
|
+
if (cachedWasm) {
|
|
2517
|
+
return cachedWasm;
|
|
2518
|
+
}
|
|
2519
|
+
const callbackStack = [];
|
|
2520
|
+
cachedWasm = readWasm().then((buffer) => {
|
|
2521
|
+
return WebAssembly.instantiate(buffer, {
|
|
2522
|
+
env: {
|
|
2523
|
+
mapping_callback(generatedLine, generatedColumn, hasLastGeneratedColumn, lastGeneratedColumn, hasOriginal, source, originalLine, originalColumn, hasName, name) {
|
|
2524
|
+
const mapping = new Mapping();
|
|
2525
|
+
mapping.generatedLine = generatedLine + 1;
|
|
2526
|
+
mapping.generatedColumn = generatedColumn;
|
|
2527
|
+
if (hasLastGeneratedColumn) {
|
|
2528
|
+
mapping.lastGeneratedColumn = lastGeneratedColumn - 1;
|
|
2529
|
+
}
|
|
2530
|
+
if (hasOriginal) {
|
|
2531
|
+
mapping.source = source;
|
|
2532
|
+
mapping.originalLine = originalLine + 1;
|
|
2533
|
+
mapping.originalColumn = originalColumn;
|
|
2534
|
+
if (hasName) {
|
|
2535
|
+
mapping.name = name;
|
|
2536
|
+
}
|
|
2537
|
+
}
|
|
2538
|
+
callbackStack[callbackStack.length - 1](mapping);
|
|
2539
|
+
},
|
|
2540
|
+
start_all_generated_locations_for() {
|
|
2541
|
+
console.time("all_generated_locations_for");
|
|
2542
|
+
},
|
|
2543
|
+
end_all_generated_locations_for() {
|
|
2544
|
+
console.timeEnd("all_generated_locations_for");
|
|
2545
|
+
},
|
|
2546
|
+
start_compute_column_spans() {
|
|
2547
|
+
console.time("compute_column_spans");
|
|
2548
|
+
},
|
|
2549
|
+
end_compute_column_spans() {
|
|
2550
|
+
console.timeEnd("compute_column_spans");
|
|
2551
|
+
},
|
|
2552
|
+
start_generated_location_for() {
|
|
2553
|
+
console.time("generated_location_for");
|
|
2554
|
+
},
|
|
2555
|
+
end_generated_location_for() {
|
|
2556
|
+
console.timeEnd("generated_location_for");
|
|
2557
|
+
},
|
|
2558
|
+
start_original_location_for() {
|
|
2559
|
+
console.time("original_location_for");
|
|
2560
|
+
},
|
|
2561
|
+
end_original_location_for() {
|
|
2562
|
+
console.timeEnd("original_location_for");
|
|
2563
|
+
},
|
|
2564
|
+
start_parse_mappings() {
|
|
2565
|
+
console.time("parse_mappings");
|
|
2566
|
+
},
|
|
2567
|
+
end_parse_mappings() {
|
|
2568
|
+
console.timeEnd("parse_mappings");
|
|
2569
|
+
},
|
|
2570
|
+
start_sort_by_generated_location() {
|
|
2571
|
+
console.time("sort_by_generated_location");
|
|
2572
|
+
},
|
|
2573
|
+
end_sort_by_generated_location() {
|
|
2574
|
+
console.timeEnd("sort_by_generated_location");
|
|
2575
|
+
},
|
|
2576
|
+
start_sort_by_original_location() {
|
|
2577
|
+
console.time("sort_by_original_location");
|
|
2578
|
+
},
|
|
2579
|
+
end_sort_by_original_location() {
|
|
2580
|
+
console.timeEnd("sort_by_original_location");
|
|
2581
|
+
}
|
|
2582
|
+
}
|
|
2583
|
+
});
|
|
2584
|
+
}).then((Wasm) => {
|
|
2585
|
+
return {
|
|
2586
|
+
exports: Wasm.instance.exports,
|
|
2587
|
+
withMappingCallback: (mappingCallback, f) => {
|
|
2588
|
+
callbackStack.push(mappingCallback);
|
|
2589
|
+
try {
|
|
2590
|
+
f();
|
|
2591
|
+
} finally {
|
|
2592
|
+
callbackStack.pop();
|
|
2593
|
+
}
|
|
2594
|
+
}
|
|
2595
|
+
};
|
|
2596
|
+
}).then(null, (e) => {
|
|
2597
|
+
cachedWasm = null;
|
|
2598
|
+
throw e;
|
|
2599
|
+
});
|
|
2600
|
+
return cachedWasm;
|
|
2601
|
+
};
|
|
2602
|
+
}
|
|
2603
|
+
});
|
|
2604
|
+
|
|
2605
|
+
// ../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/source-map-consumer.js
|
|
2606
|
+
var require_source_map_consumer = __commonJS({
|
|
2607
|
+
"../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/source-map-consumer.js"(exports) {
|
|
2608
|
+
var util = require_util();
|
|
2609
|
+
var binarySearch = require_binary_search();
|
|
2610
|
+
var ArraySet = require_array_set().ArraySet;
|
|
2611
|
+
var base64VLQ = require_base64_vlq();
|
|
2612
|
+
var readWasm = require_read_wasm();
|
|
2613
|
+
var wasm = require_wasm();
|
|
2614
|
+
var INTERNAL = Symbol("smcInternal");
|
|
2615
|
+
var SourceMapConsumer = class _SourceMapConsumer {
|
|
2616
|
+
constructor(aSourceMap, aSourceMapURL) {
|
|
2617
|
+
if (aSourceMap == INTERNAL) {
|
|
2618
|
+
return Promise.resolve(this);
|
|
2619
|
+
}
|
|
2620
|
+
return _factory(aSourceMap, aSourceMapURL);
|
|
2621
|
+
}
|
|
2622
|
+
static initialize(opts) {
|
|
2623
|
+
readWasm.initialize(opts["lib/mappings.wasm"]);
|
|
2624
|
+
}
|
|
2625
|
+
static fromSourceMap(aSourceMap, aSourceMapURL) {
|
|
2626
|
+
return _factoryBSM(aSourceMap, aSourceMapURL);
|
|
2627
|
+
}
|
|
2628
|
+
/**
|
|
2629
|
+
* Construct a new `SourceMapConsumer` from `rawSourceMap` and `sourceMapUrl`
|
|
2630
|
+
* (see the `SourceMapConsumer` constructor for details. Then, invoke the `async
|
|
2631
|
+
* function f(SourceMapConsumer) -> T` with the newly constructed consumer, wait
|
|
2632
|
+
* for `f` to complete, call `destroy` on the consumer, and return `f`'s return
|
|
2633
|
+
* value.
|
|
2634
|
+
*
|
|
2635
|
+
* You must not use the consumer after `f` completes!
|
|
2636
|
+
*
|
|
2637
|
+
* By using `with`, you do not have to remember to manually call `destroy` on
|
|
2638
|
+
* the consumer, since it will be called automatically once `f` completes.
|
|
2639
|
+
*
|
|
2640
|
+
* ```js
|
|
2641
|
+
* const xSquared = await SourceMapConsumer.with(
|
|
2642
|
+
* myRawSourceMap,
|
|
2643
|
+
* null,
|
|
2644
|
+
* async function (consumer) {
|
|
2645
|
+
* // Use `consumer` inside here and don't worry about remembering
|
|
2646
|
+
* // to call `destroy`.
|
|
2647
|
+
*
|
|
2648
|
+
* const x = await whatever(consumer);
|
|
2649
|
+
* return x * x;
|
|
2650
|
+
* }
|
|
2651
|
+
* );
|
|
2652
|
+
*
|
|
2653
|
+
* // You may not use that `consumer` anymore out here; it has
|
|
2654
|
+
* // been destroyed. But you can use `xSquared`.
|
|
2655
|
+
* console.log(xSquared);
|
|
2656
|
+
* ```
|
|
2657
|
+
*/
|
|
2658
|
+
static async with(rawSourceMap, sourceMapUrl, f) {
|
|
2659
|
+
const consumer = await new _SourceMapConsumer(rawSourceMap, sourceMapUrl);
|
|
2660
|
+
try {
|
|
2661
|
+
return await f(consumer);
|
|
2662
|
+
} finally {
|
|
2663
|
+
consumer.destroy();
|
|
2664
|
+
}
|
|
2665
|
+
}
|
|
2666
|
+
/**
|
|
2667
|
+
* Parse the mappings in a string in to a data structure which we can easily
|
|
2668
|
+
* query (the ordered arrays in the `this.__generatedMappings` and
|
|
2669
|
+
* `this.__originalMappings` properties).
|
|
2670
|
+
*/
|
|
2671
|
+
_parseMappings(aStr, aSourceRoot) {
|
|
2672
|
+
throw new Error("Subclasses must implement _parseMappings");
|
|
2673
|
+
}
|
|
2674
|
+
/**
|
|
2675
|
+
* Iterate over each mapping between an original source/line/column and a
|
|
2676
|
+
* generated line/column in this source map.
|
|
2677
|
+
*
|
|
2678
|
+
* @param Function aCallback
|
|
2679
|
+
* The function that is called with each mapping.
|
|
2680
|
+
* @param Object aContext
|
|
2681
|
+
* Optional. If specified, this object will be the value of `this` every
|
|
2682
|
+
* time that `aCallback` is called.
|
|
2683
|
+
* @param aOrder
|
|
2684
|
+
* Either `SourceMapConsumer.GENERATED_ORDER` or
|
|
2685
|
+
* `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to
|
|
2686
|
+
* iterate over the mappings sorted by the generated file's line/column
|
|
2687
|
+
* order or the original's source/line/column order, respectively. Defaults to
|
|
2688
|
+
* `SourceMapConsumer.GENERATED_ORDER`.
|
|
2689
|
+
*/
|
|
2690
|
+
eachMapping(aCallback, aContext, aOrder) {
|
|
2691
|
+
throw new Error("Subclasses must implement eachMapping");
|
|
2692
|
+
}
|
|
2693
|
+
/**
|
|
2694
|
+
* Returns all generated line and column information for the original source,
|
|
2695
|
+
* line, and column provided. If no column is provided, returns all mappings
|
|
2696
|
+
* corresponding to a either the line we are searching for or the next
|
|
2697
|
+
* closest line that has any mappings. Otherwise, returns all mappings
|
|
2698
|
+
* corresponding to the given line and either the column we are searching for
|
|
2699
|
+
* or the next closest column that has any offsets.
|
|
2700
|
+
*
|
|
2701
|
+
* The only argument is an object with the following properties:
|
|
2702
|
+
*
|
|
2703
|
+
* - source: The filename of the original source.
|
|
2704
|
+
* - line: The line number in the original source. The line number is 1-based.
|
|
2705
|
+
* - column: Optional. the column number in the original source.
|
|
2706
|
+
* The column number is 0-based.
|
|
2707
|
+
*
|
|
2708
|
+
* and an array of objects is returned, each with the following properties:
|
|
2709
|
+
*
|
|
2710
|
+
* - line: The line number in the generated source, or null. The
|
|
2711
|
+
* line number is 1-based.
|
|
2712
|
+
* - column: The column number in the generated source, or null.
|
|
2713
|
+
* The column number is 0-based.
|
|
2714
|
+
*/
|
|
2715
|
+
allGeneratedPositionsFor(aArgs) {
|
|
2716
|
+
throw new Error("Subclasses must implement allGeneratedPositionsFor");
|
|
2717
|
+
}
|
|
2718
|
+
destroy() {
|
|
2719
|
+
throw new Error("Subclasses must implement destroy");
|
|
2720
|
+
}
|
|
2721
|
+
};
|
|
2722
|
+
SourceMapConsumer.prototype._version = 3;
|
|
2723
|
+
SourceMapConsumer.GENERATED_ORDER = 1;
|
|
2724
|
+
SourceMapConsumer.ORIGINAL_ORDER = 2;
|
|
2725
|
+
SourceMapConsumer.GREATEST_LOWER_BOUND = 1;
|
|
2726
|
+
SourceMapConsumer.LEAST_UPPER_BOUND = 2;
|
|
2727
|
+
exports.SourceMapConsumer = SourceMapConsumer;
|
|
2728
|
+
var BasicSourceMapConsumer = class _BasicSourceMapConsumer extends SourceMapConsumer {
|
|
2729
|
+
constructor(aSourceMap, aSourceMapURL) {
|
|
2730
|
+
return super(INTERNAL).then((that) => {
|
|
2731
|
+
let sourceMap = aSourceMap;
|
|
2732
|
+
if (typeof aSourceMap === "string") {
|
|
2733
|
+
sourceMap = util.parseSourceMapInput(aSourceMap);
|
|
2734
|
+
}
|
|
2735
|
+
const version = util.getArg(sourceMap, "version");
|
|
2736
|
+
let sources = util.getArg(sourceMap, "sources");
|
|
2737
|
+
const names = util.getArg(sourceMap, "names", []);
|
|
2738
|
+
let sourceRoot = util.getArg(sourceMap, "sourceRoot", null);
|
|
2739
|
+
const sourcesContent = util.getArg(sourceMap, "sourcesContent", null);
|
|
2740
|
+
const mappings = util.getArg(sourceMap, "mappings");
|
|
2741
|
+
const file = util.getArg(sourceMap, "file", null);
|
|
2742
|
+
if (version != that._version) {
|
|
2743
|
+
throw new Error("Unsupported version: " + version);
|
|
2744
|
+
}
|
|
2745
|
+
if (sourceRoot) {
|
|
2746
|
+
sourceRoot = util.normalize(sourceRoot);
|
|
2747
|
+
}
|
|
2748
|
+
sources = sources.map(String).map(util.normalize).map(function(source) {
|
|
2749
|
+
return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source) ? util.relative(sourceRoot, source) : source;
|
|
2750
|
+
});
|
|
2751
|
+
that._names = ArraySet.fromArray(names.map(String), true);
|
|
2752
|
+
that._sources = ArraySet.fromArray(sources, true);
|
|
2753
|
+
that._absoluteSources = that._sources.toArray().map(function(s) {
|
|
2754
|
+
return util.computeSourceURL(sourceRoot, s, aSourceMapURL);
|
|
2755
|
+
});
|
|
2756
|
+
that.sourceRoot = sourceRoot;
|
|
2757
|
+
that.sourcesContent = sourcesContent;
|
|
2758
|
+
that._mappings = mappings;
|
|
2759
|
+
that._sourceMapURL = aSourceMapURL;
|
|
2760
|
+
that.file = file;
|
|
2761
|
+
that._computedColumnSpans = false;
|
|
2762
|
+
that._mappingsPtr = 0;
|
|
2763
|
+
that._wasm = null;
|
|
2764
|
+
return wasm().then((w) => {
|
|
2765
|
+
that._wasm = w;
|
|
2766
|
+
return that;
|
|
2767
|
+
});
|
|
2768
|
+
});
|
|
2769
|
+
}
|
|
2770
|
+
/**
|
|
2771
|
+
* Utility function to find the index of a source. Returns -1 if not
|
|
2772
|
+
* found.
|
|
2773
|
+
*/
|
|
2774
|
+
_findSourceIndex(aSource) {
|
|
2775
|
+
let relativeSource = aSource;
|
|
2776
|
+
if (this.sourceRoot != null) {
|
|
2777
|
+
relativeSource = util.relative(this.sourceRoot, relativeSource);
|
|
2778
|
+
}
|
|
2779
|
+
if (this._sources.has(relativeSource)) {
|
|
2780
|
+
return this._sources.indexOf(relativeSource);
|
|
2781
|
+
}
|
|
2782
|
+
for (let i = 0; i < this._absoluteSources.length; ++i) {
|
|
2783
|
+
if (this._absoluteSources[i] == aSource) {
|
|
2784
|
+
return i;
|
|
2785
|
+
}
|
|
2786
|
+
}
|
|
2787
|
+
return -1;
|
|
2788
|
+
}
|
|
2789
|
+
/**
|
|
2790
|
+
* Create a BasicSourceMapConsumer from a SourceMapGenerator.
|
|
2791
|
+
*
|
|
2792
|
+
* @param SourceMapGenerator aSourceMap
|
|
2793
|
+
* The source map that will be consumed.
|
|
2794
|
+
* @param String aSourceMapURL
|
|
2795
|
+
* The URL at which the source map can be found (optional)
|
|
2796
|
+
* @returns BasicSourceMapConsumer
|
|
2797
|
+
*/
|
|
2798
|
+
static fromSourceMap(aSourceMap, aSourceMapURL) {
|
|
2799
|
+
return new _BasicSourceMapConsumer(aSourceMap.toString());
|
|
2800
|
+
}
|
|
2801
|
+
get sources() {
|
|
2802
|
+
return this._absoluteSources.slice();
|
|
2803
|
+
}
|
|
2804
|
+
_getMappingsPtr() {
|
|
2805
|
+
if (this._mappingsPtr === 0) {
|
|
2806
|
+
this._parseMappings(this._mappings, this.sourceRoot);
|
|
2807
|
+
}
|
|
2808
|
+
return this._mappingsPtr;
|
|
2809
|
+
}
|
|
2810
|
+
/**
|
|
2811
|
+
* Parse the mappings in a string in to a data structure which we can easily
|
|
2812
|
+
* query (the ordered arrays in the `this.__generatedMappings` and
|
|
2813
|
+
* `this.__originalMappings` properties).
|
|
2814
|
+
*/
|
|
2815
|
+
_parseMappings(aStr, aSourceRoot) {
|
|
2816
|
+
const size = aStr.length;
|
|
2817
|
+
const mappingsBufPtr = this._wasm.exports.allocate_mappings(size);
|
|
2818
|
+
const mappingsBuf = new Uint8Array(this._wasm.exports.memory.buffer, mappingsBufPtr, size);
|
|
2819
|
+
for (let i = 0; i < size; i++) {
|
|
2820
|
+
mappingsBuf[i] = aStr.charCodeAt(i);
|
|
2821
|
+
}
|
|
2822
|
+
const mappingsPtr = this._wasm.exports.parse_mappings(mappingsBufPtr);
|
|
2823
|
+
if (!mappingsPtr) {
|
|
2824
|
+
const error = this._wasm.exports.get_last_error();
|
|
2825
|
+
let msg = `Error parsing mappings (code ${error}): `;
|
|
2826
|
+
switch (error) {
|
|
2827
|
+
case 1:
|
|
2828
|
+
msg += "the mappings contained a negative line, column, source index, or name index";
|
|
2829
|
+
break;
|
|
2830
|
+
case 2:
|
|
2831
|
+
msg += "the mappings contained a number larger than 2**32";
|
|
2832
|
+
break;
|
|
2833
|
+
case 3:
|
|
2834
|
+
msg += "reached EOF while in the middle of parsing a VLQ";
|
|
2835
|
+
break;
|
|
2836
|
+
case 4:
|
|
2837
|
+
msg += "invalid base 64 character while parsing a VLQ";
|
|
2838
|
+
break;
|
|
2839
|
+
default:
|
|
2840
|
+
msg += "unknown error code";
|
|
2841
|
+
break;
|
|
2842
|
+
}
|
|
2843
|
+
throw new Error(msg);
|
|
2844
|
+
}
|
|
2845
|
+
this._mappingsPtr = mappingsPtr;
|
|
2846
|
+
}
|
|
2847
|
+
eachMapping(aCallback, aContext, aOrder) {
|
|
2848
|
+
const context = aContext || null;
|
|
2849
|
+
const order = aOrder || SourceMapConsumer.GENERATED_ORDER;
|
|
2850
|
+
const sourceRoot = this.sourceRoot;
|
|
2851
|
+
this._wasm.withMappingCallback(
|
|
2852
|
+
(mapping) => {
|
|
2853
|
+
if (mapping.source !== null) {
|
|
2854
|
+
mapping.source = this._sources.at(mapping.source);
|
|
2855
|
+
mapping.source = util.computeSourceURL(sourceRoot, mapping.source, this._sourceMapURL);
|
|
2856
|
+
if (mapping.name !== null) {
|
|
2857
|
+
mapping.name = this._names.at(mapping.name);
|
|
2858
|
+
}
|
|
2859
|
+
}
|
|
2860
|
+
aCallback.call(context, mapping);
|
|
2861
|
+
},
|
|
2862
|
+
() => {
|
|
2863
|
+
switch (order) {
|
|
2864
|
+
case SourceMapConsumer.GENERATED_ORDER:
|
|
2865
|
+
this._wasm.exports.by_generated_location(this._getMappingsPtr());
|
|
2866
|
+
break;
|
|
2867
|
+
case SourceMapConsumer.ORIGINAL_ORDER:
|
|
2868
|
+
this._wasm.exports.by_original_location(this._getMappingsPtr());
|
|
2869
|
+
break;
|
|
2870
|
+
default:
|
|
2871
|
+
throw new Error("Unknown order of iteration.");
|
|
2872
|
+
}
|
|
2873
|
+
}
|
|
2874
|
+
);
|
|
2875
|
+
}
|
|
2876
|
+
allGeneratedPositionsFor(aArgs) {
|
|
2877
|
+
let source = util.getArg(aArgs, "source");
|
|
2878
|
+
const originalLine = util.getArg(aArgs, "line");
|
|
2879
|
+
const originalColumn = aArgs.column || 0;
|
|
2880
|
+
source = this._findSourceIndex(source);
|
|
2881
|
+
if (source < 0) {
|
|
2882
|
+
return [];
|
|
2883
|
+
}
|
|
2884
|
+
if (originalLine < 1) {
|
|
2885
|
+
throw new Error("Line numbers must be >= 1");
|
|
2886
|
+
}
|
|
2887
|
+
if (originalColumn < 0) {
|
|
2888
|
+
throw new Error("Column numbers must be >= 0");
|
|
2889
|
+
}
|
|
2890
|
+
const mappings = [];
|
|
2891
|
+
this._wasm.withMappingCallback(
|
|
2892
|
+
(m) => {
|
|
2893
|
+
let lastColumn = m.lastGeneratedColumn;
|
|
2894
|
+
if (this._computedColumnSpans && lastColumn === null) {
|
|
2895
|
+
lastColumn = Infinity;
|
|
2896
|
+
}
|
|
2897
|
+
mappings.push({
|
|
2898
|
+
line: m.generatedLine,
|
|
2899
|
+
column: m.generatedColumn,
|
|
2900
|
+
lastColumn
|
|
2901
|
+
});
|
|
2902
|
+
},
|
|
2903
|
+
() => {
|
|
2904
|
+
this._wasm.exports.all_generated_locations_for(
|
|
2905
|
+
this._getMappingsPtr(),
|
|
2906
|
+
source,
|
|
2907
|
+
originalLine - 1,
|
|
2908
|
+
"column" in aArgs,
|
|
2909
|
+
originalColumn
|
|
2910
|
+
);
|
|
2911
|
+
}
|
|
2912
|
+
);
|
|
2913
|
+
return mappings;
|
|
2914
|
+
}
|
|
2915
|
+
destroy() {
|
|
2916
|
+
if (this._mappingsPtr !== 0) {
|
|
2917
|
+
this._wasm.exports.free_mappings(this._mappingsPtr);
|
|
2918
|
+
this._mappingsPtr = 0;
|
|
2919
|
+
}
|
|
2920
|
+
}
|
|
2921
|
+
/**
|
|
2922
|
+
* Compute the last column for each generated mapping. The last column is
|
|
2923
|
+
* inclusive.
|
|
2924
|
+
*/
|
|
2925
|
+
computeColumnSpans() {
|
|
2926
|
+
if (this._computedColumnSpans) {
|
|
2927
|
+
return;
|
|
2928
|
+
}
|
|
2929
|
+
this._wasm.exports.compute_column_spans(this._getMappingsPtr());
|
|
2930
|
+
this._computedColumnSpans = true;
|
|
2931
|
+
}
|
|
2932
|
+
/**
|
|
2933
|
+
* Returns the original source, line, and column information for the generated
|
|
2934
|
+
* source's line and column positions provided. The only argument is an object
|
|
2935
|
+
* with the following properties:
|
|
2936
|
+
*
|
|
2937
|
+
* - line: The line number in the generated source. The line number
|
|
2938
|
+
* is 1-based.
|
|
2939
|
+
* - column: The column number in the generated source. The column
|
|
2940
|
+
* number is 0-based.
|
|
2941
|
+
* - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
|
|
2942
|
+
* 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
|
|
2943
|
+
* closest element that is smaller than or greater than the one we are
|
|
2944
|
+
* searching for, respectively, if the exact element cannot be found.
|
|
2945
|
+
* Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
|
|
2946
|
+
*
|
|
2947
|
+
* and an object is returned with the following properties:
|
|
2948
|
+
*
|
|
2949
|
+
* - source: The original source file, or null.
|
|
2950
|
+
* - line: The line number in the original source, or null. The
|
|
2951
|
+
* line number is 1-based.
|
|
2952
|
+
* - column: The column number in the original source, or null. The
|
|
2953
|
+
* column number is 0-based.
|
|
2954
|
+
* - name: The original identifier, or null.
|
|
2955
|
+
*/
|
|
2956
|
+
originalPositionFor(aArgs) {
|
|
2957
|
+
const needle = {
|
|
2958
|
+
generatedLine: util.getArg(aArgs, "line"),
|
|
2959
|
+
generatedColumn: util.getArg(aArgs, "column")
|
|
2960
|
+
};
|
|
2961
|
+
if (needle.generatedLine < 1) {
|
|
2962
|
+
throw new Error("Line numbers must be >= 1");
|
|
2963
|
+
}
|
|
2964
|
+
if (needle.generatedColumn < 0) {
|
|
2965
|
+
throw new Error("Column numbers must be >= 0");
|
|
2966
|
+
}
|
|
2967
|
+
let bias = util.getArg(aArgs, "bias", SourceMapConsumer.GREATEST_LOWER_BOUND);
|
|
2968
|
+
if (bias == null) {
|
|
2969
|
+
bias = SourceMapConsumer.GREATEST_LOWER_BOUND;
|
|
2970
|
+
}
|
|
2971
|
+
let mapping;
|
|
2972
|
+
this._wasm.withMappingCallback((m) => mapping = m, () => {
|
|
2973
|
+
this._wasm.exports.original_location_for(
|
|
2974
|
+
this._getMappingsPtr(),
|
|
2975
|
+
needle.generatedLine - 1,
|
|
2976
|
+
needle.generatedColumn,
|
|
2977
|
+
bias
|
|
2978
|
+
);
|
|
2979
|
+
});
|
|
2980
|
+
if (mapping) {
|
|
2981
|
+
if (mapping.generatedLine === needle.generatedLine) {
|
|
2982
|
+
let source = util.getArg(mapping, "source", null);
|
|
2983
|
+
if (source !== null) {
|
|
2984
|
+
source = this._sources.at(source);
|
|
2985
|
+
source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL);
|
|
2986
|
+
}
|
|
2987
|
+
let name = util.getArg(mapping, "name", null);
|
|
2988
|
+
if (name !== null) {
|
|
2989
|
+
name = this._names.at(name);
|
|
2990
|
+
}
|
|
2991
|
+
return {
|
|
2992
|
+
source,
|
|
2993
|
+
line: util.getArg(mapping, "originalLine", null),
|
|
2994
|
+
column: util.getArg(mapping, "originalColumn", null),
|
|
2995
|
+
name
|
|
2996
|
+
};
|
|
2997
|
+
}
|
|
2998
|
+
}
|
|
2999
|
+
return {
|
|
3000
|
+
source: null,
|
|
3001
|
+
line: null,
|
|
3002
|
+
column: null,
|
|
3003
|
+
name: null
|
|
3004
|
+
};
|
|
3005
|
+
}
|
|
3006
|
+
/**
|
|
3007
|
+
* Return true if we have the source content for every source in the source
|
|
3008
|
+
* map, false otherwise.
|
|
3009
|
+
*/
|
|
3010
|
+
hasContentsOfAllSources() {
|
|
3011
|
+
if (!this.sourcesContent) {
|
|
3012
|
+
return false;
|
|
3013
|
+
}
|
|
3014
|
+
return this.sourcesContent.length >= this._sources.size() && !this.sourcesContent.some(function(sc) {
|
|
3015
|
+
return sc == null;
|
|
3016
|
+
});
|
|
3017
|
+
}
|
|
3018
|
+
/**
|
|
3019
|
+
* Returns the original source content. The only argument is the url of the
|
|
3020
|
+
* original source file. Returns null if no original source content is
|
|
3021
|
+
* available.
|
|
3022
|
+
*/
|
|
3023
|
+
sourceContentFor(aSource, nullOnMissing) {
|
|
3024
|
+
if (!this.sourcesContent) {
|
|
3025
|
+
return null;
|
|
3026
|
+
}
|
|
3027
|
+
const index = this._findSourceIndex(aSource);
|
|
3028
|
+
if (index >= 0) {
|
|
3029
|
+
return this.sourcesContent[index];
|
|
3030
|
+
}
|
|
3031
|
+
let relativeSource = aSource;
|
|
3032
|
+
if (this.sourceRoot != null) {
|
|
3033
|
+
relativeSource = util.relative(this.sourceRoot, relativeSource);
|
|
3034
|
+
}
|
|
3035
|
+
let url;
|
|
3036
|
+
if (this.sourceRoot != null && (url = util.urlParse(this.sourceRoot))) {
|
|
3037
|
+
const fileUriAbsPath = relativeSource.replace(/^file:\/\//, "");
|
|
3038
|
+
if (url.scheme == "file" && this._sources.has(fileUriAbsPath)) {
|
|
3039
|
+
return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)];
|
|
3040
|
+
}
|
|
3041
|
+
if ((!url.path || url.path == "/") && this._sources.has("/" + relativeSource)) {
|
|
3042
|
+
return this.sourcesContent[this._sources.indexOf("/" + relativeSource)];
|
|
3043
|
+
}
|
|
3044
|
+
}
|
|
3045
|
+
if (nullOnMissing) {
|
|
3046
|
+
return null;
|
|
3047
|
+
}
|
|
3048
|
+
throw new Error('"' + relativeSource + '" is not in the SourceMap.');
|
|
3049
|
+
}
|
|
3050
|
+
/**
|
|
3051
|
+
* Returns the generated line and column information for the original source,
|
|
3052
|
+
* line, and column positions provided. The only argument is an object with
|
|
3053
|
+
* the following properties:
|
|
3054
|
+
*
|
|
3055
|
+
* - source: The filename of the original source.
|
|
3056
|
+
* - line: The line number in the original source. The line number
|
|
3057
|
+
* is 1-based.
|
|
3058
|
+
* - column: The column number in the original source. The column
|
|
3059
|
+
* number is 0-based.
|
|
3060
|
+
* - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
|
|
3061
|
+
* 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
|
|
3062
|
+
* closest element that is smaller than or greater than the one we are
|
|
3063
|
+
* searching for, respectively, if the exact element cannot be found.
|
|
3064
|
+
* Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
|
|
3065
|
+
*
|
|
3066
|
+
* and an object is returned with the following properties:
|
|
3067
|
+
*
|
|
3068
|
+
* - line: The line number in the generated source, or null. The
|
|
3069
|
+
* line number is 1-based.
|
|
3070
|
+
* - column: The column number in the generated source, or null.
|
|
3071
|
+
* The column number is 0-based.
|
|
3072
|
+
*/
|
|
3073
|
+
generatedPositionFor(aArgs) {
|
|
3074
|
+
let source = util.getArg(aArgs, "source");
|
|
3075
|
+
source = this._findSourceIndex(source);
|
|
3076
|
+
if (source < 0) {
|
|
3077
|
+
return {
|
|
3078
|
+
line: null,
|
|
3079
|
+
column: null,
|
|
3080
|
+
lastColumn: null
|
|
3081
|
+
};
|
|
3082
|
+
}
|
|
3083
|
+
const needle = {
|
|
3084
|
+
source,
|
|
3085
|
+
originalLine: util.getArg(aArgs, "line"),
|
|
3086
|
+
originalColumn: util.getArg(aArgs, "column")
|
|
3087
|
+
};
|
|
3088
|
+
if (needle.originalLine < 1) {
|
|
3089
|
+
throw new Error("Line numbers must be >= 1");
|
|
3090
|
+
}
|
|
3091
|
+
if (needle.originalColumn < 0) {
|
|
3092
|
+
throw new Error("Column numbers must be >= 0");
|
|
3093
|
+
}
|
|
3094
|
+
let bias = util.getArg(aArgs, "bias", SourceMapConsumer.GREATEST_LOWER_BOUND);
|
|
3095
|
+
if (bias == null) {
|
|
3096
|
+
bias = SourceMapConsumer.GREATEST_LOWER_BOUND;
|
|
3097
|
+
}
|
|
3098
|
+
let mapping;
|
|
3099
|
+
this._wasm.withMappingCallback((m) => mapping = m, () => {
|
|
3100
|
+
this._wasm.exports.generated_location_for(
|
|
3101
|
+
this._getMappingsPtr(),
|
|
3102
|
+
needle.source,
|
|
3103
|
+
needle.originalLine - 1,
|
|
3104
|
+
needle.originalColumn,
|
|
3105
|
+
bias
|
|
3106
|
+
);
|
|
3107
|
+
});
|
|
3108
|
+
if (mapping) {
|
|
3109
|
+
if (mapping.source === needle.source) {
|
|
3110
|
+
let lastColumn = mapping.lastGeneratedColumn;
|
|
3111
|
+
if (this._computedColumnSpans && lastColumn === null) {
|
|
3112
|
+
lastColumn = Infinity;
|
|
3113
|
+
}
|
|
3114
|
+
return {
|
|
3115
|
+
line: util.getArg(mapping, "generatedLine", null),
|
|
3116
|
+
column: util.getArg(mapping, "generatedColumn", null),
|
|
3117
|
+
lastColumn
|
|
3118
|
+
};
|
|
3119
|
+
}
|
|
3120
|
+
}
|
|
3121
|
+
return {
|
|
3122
|
+
line: null,
|
|
3123
|
+
column: null,
|
|
3124
|
+
lastColumn: null
|
|
3125
|
+
};
|
|
3126
|
+
}
|
|
3127
|
+
};
|
|
3128
|
+
BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;
|
|
3129
|
+
exports.BasicSourceMapConsumer = BasicSourceMapConsumer;
|
|
3130
|
+
var IndexedSourceMapConsumer = class extends SourceMapConsumer {
|
|
3131
|
+
constructor(aSourceMap, aSourceMapURL) {
|
|
3132
|
+
return super(INTERNAL).then((that) => {
|
|
3133
|
+
let sourceMap = aSourceMap;
|
|
3134
|
+
if (typeof aSourceMap === "string") {
|
|
3135
|
+
sourceMap = util.parseSourceMapInput(aSourceMap);
|
|
3136
|
+
}
|
|
3137
|
+
const version = util.getArg(sourceMap, "version");
|
|
3138
|
+
const sections = util.getArg(sourceMap, "sections");
|
|
3139
|
+
if (version != that._version) {
|
|
3140
|
+
throw new Error("Unsupported version: " + version);
|
|
3141
|
+
}
|
|
3142
|
+
that._sources = new ArraySet();
|
|
3143
|
+
that._names = new ArraySet();
|
|
3144
|
+
that.__generatedMappings = null;
|
|
3145
|
+
that.__originalMappings = null;
|
|
3146
|
+
that.__generatedMappingsUnsorted = null;
|
|
3147
|
+
that.__originalMappingsUnsorted = null;
|
|
3148
|
+
let lastOffset = {
|
|
3149
|
+
line: -1,
|
|
3150
|
+
column: 0
|
|
3151
|
+
};
|
|
3152
|
+
return Promise.all(sections.map((s) => {
|
|
3153
|
+
if (s.url) {
|
|
3154
|
+
throw new Error("Support for url field in sections not implemented.");
|
|
3155
|
+
}
|
|
3156
|
+
const offset = util.getArg(s, "offset");
|
|
3157
|
+
const offsetLine = util.getArg(offset, "line");
|
|
3158
|
+
const offsetColumn = util.getArg(offset, "column");
|
|
3159
|
+
if (offsetLine < lastOffset.line || offsetLine === lastOffset.line && offsetColumn < lastOffset.column) {
|
|
3160
|
+
throw new Error("Section offsets must be ordered and non-overlapping.");
|
|
3161
|
+
}
|
|
3162
|
+
lastOffset = offset;
|
|
3163
|
+
const cons = new SourceMapConsumer(util.getArg(s, "map"), aSourceMapURL);
|
|
3164
|
+
return cons.then((consumer) => {
|
|
3165
|
+
return {
|
|
3166
|
+
generatedOffset: {
|
|
3167
|
+
// The offset fields are 0-based, but we use 1-based indices when
|
|
3168
|
+
// encoding/decoding from VLQ.
|
|
3169
|
+
generatedLine: offsetLine + 1,
|
|
3170
|
+
generatedColumn: offsetColumn + 1
|
|
3171
|
+
},
|
|
3172
|
+
consumer
|
|
3173
|
+
};
|
|
3174
|
+
});
|
|
3175
|
+
})).then((s) => {
|
|
3176
|
+
that._sections = s;
|
|
3177
|
+
return that;
|
|
3178
|
+
});
|
|
3179
|
+
});
|
|
3180
|
+
}
|
|
3181
|
+
// `__generatedMappings` and `__originalMappings` are arrays that hold the
|
|
3182
|
+
// parsed mapping coordinates from the source map's "mappings" attribute. They
|
|
3183
|
+
// are lazily instantiated, accessed via the `_generatedMappings` and
|
|
3184
|
+
// `_originalMappings` getters respectively, and we only parse the mappings
|
|
3185
|
+
// and create these arrays once queried for a source location. We jump through
|
|
3186
|
+
// these hoops because there can be many thousands of mappings, and parsing
|
|
3187
|
+
// them is expensive, so we only want to do it if we must.
|
|
3188
|
+
//
|
|
3189
|
+
// Each object in the arrays is of the form:
|
|
3190
|
+
//
|
|
3191
|
+
// {
|
|
3192
|
+
// generatedLine: The line number in the generated code,
|
|
3193
|
+
// generatedColumn: The column number in the generated code,
|
|
3194
|
+
// source: The path to the original source file that generated this
|
|
3195
|
+
// chunk of code,
|
|
3196
|
+
// originalLine: The line number in the original source that
|
|
3197
|
+
// corresponds to this chunk of generated code,
|
|
3198
|
+
// originalColumn: The column number in the original source that
|
|
3199
|
+
// corresponds to this chunk of generated code,
|
|
3200
|
+
// name: The name of the original symbol which generated this chunk of
|
|
3201
|
+
// code.
|
|
3202
|
+
// }
|
|
3203
|
+
//
|
|
3204
|
+
// All properties except for `generatedLine` and `generatedColumn` can be
|
|
3205
|
+
// `null`.
|
|
3206
|
+
//
|
|
3207
|
+
// `_generatedMappings` is ordered by the generated positions.
|
|
3208
|
+
//
|
|
3209
|
+
// `_originalMappings` is ordered by the original positions.
|
|
3210
|
+
get _generatedMappings() {
|
|
3211
|
+
if (!this.__generatedMappings) {
|
|
3212
|
+
this._sortGeneratedMappings();
|
|
3213
|
+
}
|
|
3214
|
+
return this.__generatedMappings;
|
|
3215
|
+
}
|
|
3216
|
+
get _originalMappings() {
|
|
3217
|
+
if (!this.__originalMappings) {
|
|
3218
|
+
this._sortOriginalMappings();
|
|
3219
|
+
}
|
|
3220
|
+
return this.__originalMappings;
|
|
3221
|
+
}
|
|
3222
|
+
get _generatedMappingsUnsorted() {
|
|
3223
|
+
if (!this.__generatedMappingsUnsorted) {
|
|
3224
|
+
this._parseMappings(this._mappings, this.sourceRoot);
|
|
3225
|
+
}
|
|
3226
|
+
return this.__generatedMappingsUnsorted;
|
|
3227
|
+
}
|
|
3228
|
+
get _originalMappingsUnsorted() {
|
|
3229
|
+
if (!this.__originalMappingsUnsorted) {
|
|
3230
|
+
this._parseMappings(this._mappings, this.sourceRoot);
|
|
3231
|
+
}
|
|
3232
|
+
return this.__originalMappingsUnsorted;
|
|
3233
|
+
}
|
|
3234
|
+
_sortGeneratedMappings() {
|
|
3235
|
+
const mappings = this._generatedMappingsUnsorted;
|
|
3236
|
+
mappings.sort(util.compareByGeneratedPositionsDeflated);
|
|
3237
|
+
this.__generatedMappings = mappings;
|
|
3238
|
+
}
|
|
3239
|
+
_sortOriginalMappings() {
|
|
3240
|
+
const mappings = this._originalMappingsUnsorted;
|
|
3241
|
+
mappings.sort(util.compareByOriginalPositions);
|
|
3242
|
+
this.__originalMappings = mappings;
|
|
3243
|
+
}
|
|
3244
|
+
/**
|
|
3245
|
+
* The list of original sources.
|
|
3246
|
+
*/
|
|
3247
|
+
get sources() {
|
|
3248
|
+
const sources = [];
|
|
3249
|
+
for (let i = 0; i < this._sections.length; i++) {
|
|
3250
|
+
for (let j = 0; j < this._sections[i].consumer.sources.length; j++) {
|
|
3251
|
+
sources.push(this._sections[i].consumer.sources[j]);
|
|
3252
|
+
}
|
|
3253
|
+
}
|
|
3254
|
+
return sources;
|
|
3255
|
+
}
|
|
3256
|
+
/**
|
|
3257
|
+
* Returns the original source, line, and column information for the generated
|
|
3258
|
+
* source's line and column positions provided. The only argument is an object
|
|
3259
|
+
* with the following properties:
|
|
3260
|
+
*
|
|
3261
|
+
* - line: The line number in the generated source. The line number
|
|
3262
|
+
* is 1-based.
|
|
3263
|
+
* - column: The column number in the generated source. The column
|
|
3264
|
+
* number is 0-based.
|
|
3265
|
+
*
|
|
3266
|
+
* and an object is returned with the following properties:
|
|
3267
|
+
*
|
|
3268
|
+
* - source: The original source file, or null.
|
|
3269
|
+
* - line: The line number in the original source, or null. The
|
|
3270
|
+
* line number is 1-based.
|
|
3271
|
+
* - column: The column number in the original source, or null. The
|
|
3272
|
+
* column number is 0-based.
|
|
3273
|
+
* - name: The original identifier, or null.
|
|
3274
|
+
*/
|
|
3275
|
+
originalPositionFor(aArgs) {
|
|
3276
|
+
const needle = {
|
|
3277
|
+
generatedLine: util.getArg(aArgs, "line"),
|
|
3278
|
+
generatedColumn: util.getArg(aArgs, "column")
|
|
3279
|
+
};
|
|
3280
|
+
const sectionIndex = binarySearch.search(
|
|
3281
|
+
needle,
|
|
3282
|
+
this._sections,
|
|
3283
|
+
function(aNeedle, section2) {
|
|
3284
|
+
const cmp = aNeedle.generatedLine - section2.generatedOffset.generatedLine;
|
|
3285
|
+
if (cmp) {
|
|
3286
|
+
return cmp;
|
|
3287
|
+
}
|
|
3288
|
+
return aNeedle.generatedColumn - section2.generatedOffset.generatedColumn;
|
|
3289
|
+
}
|
|
3290
|
+
);
|
|
3291
|
+
const section = this._sections[sectionIndex];
|
|
3292
|
+
if (!section) {
|
|
3293
|
+
return {
|
|
3294
|
+
source: null,
|
|
3295
|
+
line: null,
|
|
3296
|
+
column: null,
|
|
3297
|
+
name: null
|
|
3298
|
+
};
|
|
3299
|
+
}
|
|
3300
|
+
return section.consumer.originalPositionFor({
|
|
3301
|
+
line: needle.generatedLine - (section.generatedOffset.generatedLine - 1),
|
|
3302
|
+
column: needle.generatedColumn - (section.generatedOffset.generatedLine === needle.generatedLine ? section.generatedOffset.generatedColumn - 1 : 0),
|
|
3303
|
+
bias: aArgs.bias
|
|
3304
|
+
});
|
|
3305
|
+
}
|
|
3306
|
+
/**
|
|
3307
|
+
* Return true if we have the source content for every source in the source
|
|
3308
|
+
* map, false otherwise.
|
|
3309
|
+
*/
|
|
3310
|
+
hasContentsOfAllSources() {
|
|
3311
|
+
return this._sections.every(function(s) {
|
|
3312
|
+
return s.consumer.hasContentsOfAllSources();
|
|
3313
|
+
});
|
|
3314
|
+
}
|
|
3315
|
+
/**
|
|
3316
|
+
* Returns the original source content. The only argument is the url of the
|
|
3317
|
+
* original source file. Returns null if no original source content is
|
|
3318
|
+
* available.
|
|
3319
|
+
*/
|
|
3320
|
+
sourceContentFor(aSource, nullOnMissing) {
|
|
3321
|
+
for (let i = 0; i < this._sections.length; i++) {
|
|
3322
|
+
const section = this._sections[i];
|
|
3323
|
+
const content = section.consumer.sourceContentFor(aSource, true);
|
|
3324
|
+
if (content) {
|
|
3325
|
+
return content;
|
|
3326
|
+
}
|
|
3327
|
+
}
|
|
3328
|
+
if (nullOnMissing) {
|
|
3329
|
+
return null;
|
|
3330
|
+
}
|
|
3331
|
+
throw new Error('"' + aSource + '" is not in the SourceMap.');
|
|
3332
|
+
}
|
|
3333
|
+
/**
|
|
3334
|
+
* Returns the generated line and column information for the original source,
|
|
3335
|
+
* line, and column positions provided. The only argument is an object with
|
|
3336
|
+
* the following properties:
|
|
3337
|
+
*
|
|
3338
|
+
* - source: The filename of the original source.
|
|
3339
|
+
* - line: The line number in the original source. The line number
|
|
3340
|
+
* is 1-based.
|
|
3341
|
+
* - column: The column number in the original source. The column
|
|
3342
|
+
* number is 0-based.
|
|
3343
|
+
*
|
|
3344
|
+
* and an object is returned with the following properties:
|
|
3345
|
+
*
|
|
3346
|
+
* - line: The line number in the generated source, or null. The
|
|
3347
|
+
* line number is 1-based.
|
|
3348
|
+
* - column: The column number in the generated source, or null.
|
|
3349
|
+
* The column number is 0-based.
|
|
3350
|
+
*/
|
|
3351
|
+
generatedPositionFor(aArgs) {
|
|
3352
|
+
for (let i = 0; i < this._sections.length; i++) {
|
|
3353
|
+
const section = this._sections[i];
|
|
3354
|
+
if (section.consumer._findSourceIndex(util.getArg(aArgs, "source")) === -1) {
|
|
3355
|
+
continue;
|
|
3356
|
+
}
|
|
3357
|
+
const generatedPosition = section.consumer.generatedPositionFor(aArgs);
|
|
3358
|
+
if (generatedPosition) {
|
|
3359
|
+
const ret = {
|
|
3360
|
+
line: generatedPosition.line + (section.generatedOffset.generatedLine - 1),
|
|
3361
|
+
column: generatedPosition.column + (section.generatedOffset.generatedLine === generatedPosition.line ? section.generatedOffset.generatedColumn - 1 : 0)
|
|
3362
|
+
};
|
|
3363
|
+
return ret;
|
|
3364
|
+
}
|
|
3365
|
+
}
|
|
3366
|
+
return {
|
|
3367
|
+
line: null,
|
|
3368
|
+
column: null
|
|
3369
|
+
};
|
|
3370
|
+
}
|
|
3371
|
+
/**
|
|
3372
|
+
* Parse the mappings in a string in to a data structure which we can easily
|
|
3373
|
+
* query (the ordered arrays in the `this.__generatedMappings` and
|
|
3374
|
+
* `this.__originalMappings` properties).
|
|
3375
|
+
*/
|
|
3376
|
+
_parseMappings(aStr, aSourceRoot) {
|
|
3377
|
+
const generatedMappings = this.__generatedMappingsUnsorted = [];
|
|
3378
|
+
const originalMappings = this.__originalMappingsUnsorted = [];
|
|
3379
|
+
for (let i = 0; i < this._sections.length; i++) {
|
|
3380
|
+
const section = this._sections[i];
|
|
3381
|
+
const sectionMappings = [];
|
|
3382
|
+
section.consumer.eachMapping((m) => sectionMappings.push(m));
|
|
3383
|
+
for (let j = 0; j < sectionMappings.length; j++) {
|
|
3384
|
+
const mapping = sectionMappings[j];
|
|
3385
|
+
let source = util.computeSourceURL(section.consumer.sourceRoot, null, this._sourceMapURL);
|
|
3386
|
+
this._sources.add(source);
|
|
3387
|
+
source = this._sources.indexOf(source);
|
|
3388
|
+
let name = null;
|
|
3389
|
+
if (mapping.name) {
|
|
3390
|
+
this._names.add(mapping.name);
|
|
3391
|
+
name = this._names.indexOf(mapping.name);
|
|
3392
|
+
}
|
|
3393
|
+
const adjustedMapping = {
|
|
3394
|
+
source,
|
|
3395
|
+
generatedLine: mapping.generatedLine + (section.generatedOffset.generatedLine - 1),
|
|
3396
|
+
generatedColumn: mapping.generatedColumn + (section.generatedOffset.generatedLine === mapping.generatedLine ? section.generatedOffset.generatedColumn - 1 : 0),
|
|
3397
|
+
originalLine: mapping.originalLine,
|
|
3398
|
+
originalColumn: mapping.originalColumn,
|
|
3399
|
+
name
|
|
3400
|
+
};
|
|
3401
|
+
generatedMappings.push(adjustedMapping);
|
|
3402
|
+
if (typeof adjustedMapping.originalLine === "number") {
|
|
3403
|
+
originalMappings.push(adjustedMapping);
|
|
3404
|
+
}
|
|
3405
|
+
}
|
|
3406
|
+
}
|
|
3407
|
+
}
|
|
3408
|
+
eachMapping(aCallback, aContext, aOrder) {
|
|
3409
|
+
const context = aContext || null;
|
|
3410
|
+
const order = aOrder || SourceMapConsumer.GENERATED_ORDER;
|
|
3411
|
+
let mappings;
|
|
3412
|
+
switch (order) {
|
|
3413
|
+
case SourceMapConsumer.GENERATED_ORDER:
|
|
3414
|
+
mappings = this._generatedMappings;
|
|
3415
|
+
break;
|
|
3416
|
+
case SourceMapConsumer.ORIGINAL_ORDER:
|
|
3417
|
+
mappings = this._originalMappings;
|
|
3418
|
+
break;
|
|
3419
|
+
default:
|
|
3420
|
+
throw new Error("Unknown order of iteration.");
|
|
3421
|
+
}
|
|
3422
|
+
const sourceRoot = this.sourceRoot;
|
|
3423
|
+
mappings.map(function(mapping) {
|
|
3424
|
+
let source = null;
|
|
3425
|
+
if (mapping.source !== null) {
|
|
3426
|
+
source = this._sources.at(mapping.source);
|
|
3427
|
+
source = util.computeSourceURL(sourceRoot, source, this._sourceMapURL);
|
|
3428
|
+
}
|
|
3429
|
+
return {
|
|
3430
|
+
source,
|
|
3431
|
+
generatedLine: mapping.generatedLine,
|
|
3432
|
+
generatedColumn: mapping.generatedColumn,
|
|
3433
|
+
originalLine: mapping.originalLine,
|
|
3434
|
+
originalColumn: mapping.originalColumn,
|
|
3435
|
+
name: mapping.name === null ? null : this._names.at(mapping.name)
|
|
3436
|
+
};
|
|
3437
|
+
}, this).forEach(aCallback, context);
|
|
3438
|
+
}
|
|
3439
|
+
/**
|
|
3440
|
+
* Find the mapping that best matches the hypothetical "needle" mapping that
|
|
3441
|
+
* we are searching for in the given "haystack" of mappings.
|
|
3442
|
+
*/
|
|
3443
|
+
_findMapping(aNeedle, aMappings, aLineName, aColumnName, aComparator, aBias) {
|
|
3444
|
+
if (aNeedle[aLineName] <= 0) {
|
|
3445
|
+
throw new TypeError("Line must be greater than or equal to 1, got " + aNeedle[aLineName]);
|
|
3446
|
+
}
|
|
3447
|
+
if (aNeedle[aColumnName] < 0) {
|
|
3448
|
+
throw new TypeError("Column must be greater than or equal to 0, got " + aNeedle[aColumnName]);
|
|
3449
|
+
}
|
|
3450
|
+
return binarySearch.search(aNeedle, aMappings, aComparator, aBias);
|
|
3451
|
+
}
|
|
3452
|
+
allGeneratedPositionsFor(aArgs) {
|
|
3453
|
+
const line = util.getArg(aArgs, "line");
|
|
3454
|
+
const needle = {
|
|
3455
|
+
source: util.getArg(aArgs, "source"),
|
|
3456
|
+
originalLine: line,
|
|
3457
|
+
originalColumn: util.getArg(aArgs, "column", 0)
|
|
3458
|
+
};
|
|
3459
|
+
needle.source = this._findSourceIndex(needle.source);
|
|
3460
|
+
if (needle.source < 0) {
|
|
3461
|
+
return [];
|
|
3462
|
+
}
|
|
3463
|
+
if (needle.originalLine < 1) {
|
|
3464
|
+
throw new Error("Line numbers must be >= 1");
|
|
3465
|
+
}
|
|
3466
|
+
if (needle.originalColumn < 0) {
|
|
3467
|
+
throw new Error("Column numbers must be >= 0");
|
|
3468
|
+
}
|
|
3469
|
+
const mappings = [];
|
|
3470
|
+
let index = this._findMapping(
|
|
3471
|
+
needle,
|
|
3472
|
+
this._originalMappings,
|
|
3473
|
+
"originalLine",
|
|
3474
|
+
"originalColumn",
|
|
3475
|
+
util.compareByOriginalPositions,
|
|
3476
|
+
binarySearch.LEAST_UPPER_BOUND
|
|
3477
|
+
);
|
|
3478
|
+
if (index >= 0) {
|
|
3479
|
+
let mapping = this._originalMappings[index];
|
|
3480
|
+
if (aArgs.column === void 0) {
|
|
3481
|
+
const originalLine = mapping.originalLine;
|
|
3482
|
+
while (mapping && mapping.originalLine === originalLine) {
|
|
3483
|
+
let lastColumn = mapping.lastGeneratedColumn;
|
|
3484
|
+
if (this._computedColumnSpans && lastColumn === null) {
|
|
3485
|
+
lastColumn = Infinity;
|
|
3486
|
+
}
|
|
3487
|
+
mappings.push({
|
|
3488
|
+
line: util.getArg(mapping, "generatedLine", null),
|
|
3489
|
+
column: util.getArg(mapping, "generatedColumn", null),
|
|
3490
|
+
lastColumn
|
|
3491
|
+
});
|
|
3492
|
+
mapping = this._originalMappings[++index];
|
|
3493
|
+
}
|
|
3494
|
+
} else {
|
|
3495
|
+
const originalColumn = mapping.originalColumn;
|
|
3496
|
+
while (mapping && mapping.originalLine === line && mapping.originalColumn == originalColumn) {
|
|
3497
|
+
let lastColumn = mapping.lastGeneratedColumn;
|
|
3498
|
+
if (this._computedColumnSpans && lastColumn === null) {
|
|
3499
|
+
lastColumn = Infinity;
|
|
3500
|
+
}
|
|
3501
|
+
mappings.push({
|
|
3502
|
+
line: util.getArg(mapping, "generatedLine", null),
|
|
3503
|
+
column: util.getArg(mapping, "generatedColumn", null),
|
|
3504
|
+
lastColumn
|
|
3505
|
+
});
|
|
3506
|
+
mapping = this._originalMappings[++index];
|
|
3507
|
+
}
|
|
3508
|
+
}
|
|
3509
|
+
}
|
|
3510
|
+
return mappings;
|
|
3511
|
+
}
|
|
3512
|
+
destroy() {
|
|
3513
|
+
for (let i = 0; i < this._sections.length; i++) {
|
|
3514
|
+
this._sections[i].consumer.destroy();
|
|
3515
|
+
}
|
|
3516
|
+
}
|
|
3517
|
+
};
|
|
3518
|
+
exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;
|
|
3519
|
+
function _factory(aSourceMap, aSourceMapURL) {
|
|
3520
|
+
let sourceMap = aSourceMap;
|
|
3521
|
+
if (typeof aSourceMap === "string") {
|
|
3522
|
+
sourceMap = util.parseSourceMapInput(aSourceMap);
|
|
3523
|
+
}
|
|
3524
|
+
const consumer = sourceMap.sections != null ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL) : new BasicSourceMapConsumer(sourceMap, aSourceMapURL);
|
|
3525
|
+
return Promise.resolve(consumer);
|
|
3526
|
+
}
|
|
3527
|
+
function _factoryBSM(aSourceMap, aSourceMapURL) {
|
|
3528
|
+
return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL);
|
|
3529
|
+
}
|
|
3530
|
+
}
|
|
3531
|
+
});
|
|
3532
|
+
|
|
3533
|
+
// ../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/source-node.js
|
|
3534
|
+
var require_source_node = __commonJS({
|
|
3535
|
+
"../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/source-node.js"(exports) {
|
|
3536
|
+
var SourceMapGenerator2 = require_source_map_generator().SourceMapGenerator;
|
|
3537
|
+
var util = require_util();
|
|
3538
|
+
var REGEX_NEWLINE = /(\r?\n)/;
|
|
3539
|
+
var NEWLINE_CODE = 10;
|
|
3540
|
+
var isSourceNode = "$$$isSourceNode$$$";
|
|
3541
|
+
var SourceNode = class _SourceNode {
|
|
3542
|
+
constructor(aLine, aColumn, aSource, aChunks, aName) {
|
|
3543
|
+
this.children = [];
|
|
3544
|
+
this.sourceContents = {};
|
|
3545
|
+
this.line = aLine == null ? null : aLine;
|
|
3546
|
+
this.column = aColumn == null ? null : aColumn;
|
|
3547
|
+
this.source = aSource == null ? null : aSource;
|
|
3548
|
+
this.name = aName == null ? null : aName;
|
|
3549
|
+
this[isSourceNode] = true;
|
|
3550
|
+
if (aChunks != null) this.add(aChunks);
|
|
3551
|
+
}
|
|
3552
|
+
/**
|
|
3553
|
+
* Creates a SourceNode from generated code and a SourceMapConsumer.
|
|
3554
|
+
*
|
|
3555
|
+
* @param aGeneratedCode The generated code
|
|
3556
|
+
* @param aSourceMapConsumer The SourceMap for the generated code
|
|
3557
|
+
* @param aRelativePath Optional. The path that relative sources in the
|
|
3558
|
+
* SourceMapConsumer should be relative to.
|
|
3559
|
+
*/
|
|
3560
|
+
static fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {
|
|
3561
|
+
const node = new _SourceNode();
|
|
3562
|
+
const remainingLines = aGeneratedCode.split(REGEX_NEWLINE);
|
|
3563
|
+
let remainingLinesIndex = 0;
|
|
3564
|
+
const shiftNextLine = function() {
|
|
3565
|
+
const lineContents = getNextLine();
|
|
3566
|
+
const newLine = getNextLine() || "";
|
|
3567
|
+
return lineContents + newLine;
|
|
3568
|
+
function getNextLine() {
|
|
3569
|
+
return remainingLinesIndex < remainingLines.length ? remainingLines[remainingLinesIndex++] : void 0;
|
|
3570
|
+
}
|
|
3571
|
+
};
|
|
3572
|
+
let lastGeneratedLine = 1, lastGeneratedColumn = 0;
|
|
3573
|
+
let lastMapping = null;
|
|
3574
|
+
let nextLine;
|
|
3575
|
+
aSourceMapConsumer.eachMapping(function(mapping) {
|
|
3576
|
+
if (lastMapping !== null) {
|
|
3577
|
+
if (lastGeneratedLine < mapping.generatedLine) {
|
|
3578
|
+
addMappingWithCode(lastMapping, shiftNextLine());
|
|
3579
|
+
lastGeneratedLine++;
|
|
3580
|
+
lastGeneratedColumn = 0;
|
|
3581
|
+
} else {
|
|
3582
|
+
nextLine = remainingLines[remainingLinesIndex] || "";
|
|
3583
|
+
const code = nextLine.substr(0, mapping.generatedColumn - lastGeneratedColumn);
|
|
3584
|
+
remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn - lastGeneratedColumn);
|
|
3585
|
+
lastGeneratedColumn = mapping.generatedColumn;
|
|
3586
|
+
addMappingWithCode(lastMapping, code);
|
|
3587
|
+
lastMapping = mapping;
|
|
3588
|
+
return;
|
|
3589
|
+
}
|
|
3590
|
+
}
|
|
3591
|
+
while (lastGeneratedLine < mapping.generatedLine) {
|
|
3592
|
+
node.add(shiftNextLine());
|
|
3593
|
+
lastGeneratedLine++;
|
|
3594
|
+
}
|
|
3595
|
+
if (lastGeneratedColumn < mapping.generatedColumn) {
|
|
3596
|
+
nextLine = remainingLines[remainingLinesIndex] || "";
|
|
3597
|
+
node.add(nextLine.substr(0, mapping.generatedColumn));
|
|
3598
|
+
remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);
|
|
3599
|
+
lastGeneratedColumn = mapping.generatedColumn;
|
|
3600
|
+
}
|
|
3601
|
+
lastMapping = mapping;
|
|
3602
|
+
}, this);
|
|
3603
|
+
if (remainingLinesIndex < remainingLines.length) {
|
|
3604
|
+
if (lastMapping) {
|
|
3605
|
+
addMappingWithCode(lastMapping, shiftNextLine());
|
|
3606
|
+
}
|
|
3607
|
+
node.add(remainingLines.splice(remainingLinesIndex).join(""));
|
|
3608
|
+
}
|
|
3609
|
+
aSourceMapConsumer.sources.forEach(function(sourceFile) {
|
|
3610
|
+
const content = aSourceMapConsumer.sourceContentFor(sourceFile);
|
|
3611
|
+
if (content != null) {
|
|
3612
|
+
if (aRelativePath != null) {
|
|
3613
|
+
sourceFile = util.join(aRelativePath, sourceFile);
|
|
3614
|
+
}
|
|
3615
|
+
node.setSourceContent(sourceFile, content);
|
|
3616
|
+
}
|
|
3617
|
+
});
|
|
3618
|
+
return node;
|
|
3619
|
+
function addMappingWithCode(mapping, code) {
|
|
3620
|
+
if (mapping === null || mapping.source === void 0) {
|
|
3621
|
+
node.add(code);
|
|
3622
|
+
} else {
|
|
3623
|
+
const source = aRelativePath ? util.join(aRelativePath, mapping.source) : mapping.source;
|
|
3624
|
+
node.add(new _SourceNode(
|
|
3625
|
+
mapping.originalLine,
|
|
3626
|
+
mapping.originalColumn,
|
|
3627
|
+
source,
|
|
3628
|
+
code,
|
|
3629
|
+
mapping.name
|
|
3630
|
+
));
|
|
3631
|
+
}
|
|
3632
|
+
}
|
|
3633
|
+
}
|
|
3634
|
+
/**
|
|
3635
|
+
* Add a chunk of generated JS to this source node.
|
|
3636
|
+
*
|
|
3637
|
+
* @param aChunk A string snippet of generated JS code, another instance of
|
|
3638
|
+
* SourceNode, or an array where each member is one of those things.
|
|
3639
|
+
*/
|
|
3640
|
+
add(aChunk) {
|
|
3641
|
+
if (Array.isArray(aChunk)) {
|
|
3642
|
+
aChunk.forEach(function(chunk) {
|
|
3643
|
+
this.add(chunk);
|
|
3644
|
+
}, this);
|
|
3645
|
+
} else if (aChunk[isSourceNode] || typeof aChunk === "string") {
|
|
3646
|
+
if (aChunk) {
|
|
3647
|
+
this.children.push(aChunk);
|
|
3648
|
+
}
|
|
3649
|
+
} else {
|
|
3650
|
+
throw new TypeError(
|
|
3651
|
+
"Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
|
|
3652
|
+
);
|
|
3653
|
+
}
|
|
3654
|
+
return this;
|
|
3655
|
+
}
|
|
3656
|
+
/**
|
|
3657
|
+
* Add a chunk of generated JS to the beginning of this source node.
|
|
3658
|
+
*
|
|
3659
|
+
* @param aChunk A string snippet of generated JS code, another instance of
|
|
3660
|
+
* SourceNode, or an array where each member is one of those things.
|
|
3661
|
+
*/
|
|
3662
|
+
prepend(aChunk) {
|
|
3663
|
+
if (Array.isArray(aChunk)) {
|
|
3664
|
+
for (let i = aChunk.length - 1; i >= 0; i--) {
|
|
3665
|
+
this.prepend(aChunk[i]);
|
|
3666
|
+
}
|
|
3667
|
+
} else if (aChunk[isSourceNode] || typeof aChunk === "string") {
|
|
3668
|
+
this.children.unshift(aChunk);
|
|
3669
|
+
} else {
|
|
3670
|
+
throw new TypeError(
|
|
3671
|
+
"Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
|
|
3672
|
+
);
|
|
3673
|
+
}
|
|
3674
|
+
return this;
|
|
3675
|
+
}
|
|
3676
|
+
/**
|
|
3677
|
+
* Walk over the tree of JS snippets in this node and its children. The
|
|
3678
|
+
* walking function is called once for each snippet of JS and is passed that
|
|
3679
|
+
* snippet and the its original associated source's line/column location.
|
|
3680
|
+
*
|
|
3681
|
+
* @param aFn The traversal function.
|
|
3682
|
+
*/
|
|
3683
|
+
walk(aFn) {
|
|
3684
|
+
let chunk;
|
|
3685
|
+
for (let i = 0, len = this.children.length; i < len; i++) {
|
|
3686
|
+
chunk = this.children[i];
|
|
3687
|
+
if (chunk[isSourceNode]) {
|
|
3688
|
+
chunk.walk(aFn);
|
|
3689
|
+
} else if (chunk !== "") {
|
|
3690
|
+
aFn(chunk, {
|
|
3691
|
+
source: this.source,
|
|
3692
|
+
line: this.line,
|
|
3693
|
+
column: this.column,
|
|
3694
|
+
name: this.name
|
|
3695
|
+
});
|
|
3696
|
+
}
|
|
3697
|
+
}
|
|
3698
|
+
}
|
|
3699
|
+
/**
|
|
3700
|
+
* Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between
|
|
3701
|
+
* each of `this.children`.
|
|
3702
|
+
*
|
|
3703
|
+
* @param aSep The separator.
|
|
3704
|
+
*/
|
|
3705
|
+
join(aSep) {
|
|
3706
|
+
let newChildren;
|
|
3707
|
+
let i;
|
|
3708
|
+
const len = this.children.length;
|
|
3709
|
+
if (len > 0) {
|
|
3710
|
+
newChildren = [];
|
|
3711
|
+
for (i = 0; i < len - 1; i++) {
|
|
3712
|
+
newChildren.push(this.children[i]);
|
|
3713
|
+
newChildren.push(aSep);
|
|
3714
|
+
}
|
|
3715
|
+
newChildren.push(this.children[i]);
|
|
3716
|
+
this.children = newChildren;
|
|
3717
|
+
}
|
|
3718
|
+
return this;
|
|
3719
|
+
}
|
|
3720
|
+
/**
|
|
3721
|
+
* Call String.prototype.replace on the very right-most source snippet. Useful
|
|
3722
|
+
* for trimming whitespace from the end of a source node, etc.
|
|
3723
|
+
*
|
|
3724
|
+
* @param aPattern The pattern to replace.
|
|
3725
|
+
* @param aReplacement The thing to replace the pattern with.
|
|
3726
|
+
*/
|
|
3727
|
+
replaceRight(aPattern, aReplacement) {
|
|
3728
|
+
const lastChild = this.children[this.children.length - 1];
|
|
3729
|
+
if (lastChild[isSourceNode]) {
|
|
3730
|
+
lastChild.replaceRight(aPattern, aReplacement);
|
|
3731
|
+
} else if (typeof lastChild === "string") {
|
|
3732
|
+
this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);
|
|
3733
|
+
} else {
|
|
3734
|
+
this.children.push("".replace(aPattern, aReplacement));
|
|
3735
|
+
}
|
|
3736
|
+
return this;
|
|
3737
|
+
}
|
|
3738
|
+
/**
|
|
3739
|
+
* Set the source content for a source file. This will be added to the SourceMapGenerator
|
|
3740
|
+
* in the sourcesContent field.
|
|
3741
|
+
*
|
|
3742
|
+
* @param aSourceFile The filename of the source file
|
|
3743
|
+
* @param aSourceContent The content of the source file
|
|
3744
|
+
*/
|
|
3745
|
+
setSourceContent(aSourceFile, aSourceContent) {
|
|
3746
|
+
this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;
|
|
3747
|
+
}
|
|
3748
|
+
/**
|
|
3749
|
+
* Walk over the tree of SourceNodes. The walking function is called for each
|
|
3750
|
+
* source file content and is passed the filename and source content.
|
|
3751
|
+
*
|
|
3752
|
+
* @param aFn The traversal function.
|
|
3753
|
+
*/
|
|
3754
|
+
walkSourceContents(aFn) {
|
|
3755
|
+
for (let i = 0, len = this.children.length; i < len; i++) {
|
|
3756
|
+
if (this.children[i][isSourceNode]) {
|
|
3757
|
+
this.children[i].walkSourceContents(aFn);
|
|
3758
|
+
}
|
|
3759
|
+
}
|
|
3760
|
+
const sources = Object.keys(this.sourceContents);
|
|
3761
|
+
for (let i = 0, len = sources.length; i < len; i++) {
|
|
3762
|
+
aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);
|
|
3763
|
+
}
|
|
3764
|
+
}
|
|
3765
|
+
/**
|
|
3766
|
+
* Return the string representation of this source node. Walks over the tree
|
|
3767
|
+
* and concatenates all the various snippets together to one string.
|
|
3768
|
+
*/
|
|
3769
|
+
toString() {
|
|
3770
|
+
let str = "";
|
|
3771
|
+
this.walk(function(chunk) {
|
|
3772
|
+
str += chunk;
|
|
3773
|
+
});
|
|
3774
|
+
return str;
|
|
3775
|
+
}
|
|
3776
|
+
/**
|
|
3777
|
+
* Returns the string representation of this source node along with a source
|
|
3778
|
+
* map.
|
|
3779
|
+
*/
|
|
3780
|
+
toStringWithSourceMap(aArgs) {
|
|
3781
|
+
const generated = {
|
|
3782
|
+
code: "",
|
|
3783
|
+
line: 1,
|
|
3784
|
+
column: 0
|
|
3785
|
+
};
|
|
3786
|
+
const map = new SourceMapGenerator2(aArgs);
|
|
3787
|
+
let sourceMappingActive = false;
|
|
3788
|
+
let lastOriginalSource = null;
|
|
3789
|
+
let lastOriginalLine = null;
|
|
3790
|
+
let lastOriginalColumn = null;
|
|
3791
|
+
let lastOriginalName = null;
|
|
3792
|
+
this.walk(function(chunk, original) {
|
|
3793
|
+
generated.code += chunk;
|
|
3794
|
+
if (original.source !== null && original.line !== null && original.column !== null) {
|
|
3795
|
+
if (lastOriginalSource !== original.source || lastOriginalLine !== original.line || lastOriginalColumn !== original.column || lastOriginalName !== original.name) {
|
|
3796
|
+
map.addMapping({
|
|
3797
|
+
source: original.source,
|
|
3798
|
+
original: {
|
|
3799
|
+
line: original.line,
|
|
3800
|
+
column: original.column
|
|
3801
|
+
},
|
|
3802
|
+
generated: {
|
|
3803
|
+
line: generated.line,
|
|
3804
|
+
column: generated.column
|
|
3805
|
+
},
|
|
3806
|
+
name: original.name
|
|
3807
|
+
});
|
|
3808
|
+
}
|
|
3809
|
+
lastOriginalSource = original.source;
|
|
3810
|
+
lastOriginalLine = original.line;
|
|
3811
|
+
lastOriginalColumn = original.column;
|
|
3812
|
+
lastOriginalName = original.name;
|
|
3813
|
+
sourceMappingActive = true;
|
|
3814
|
+
} else if (sourceMappingActive) {
|
|
3815
|
+
map.addMapping({
|
|
3816
|
+
generated: {
|
|
3817
|
+
line: generated.line,
|
|
3818
|
+
column: generated.column
|
|
3819
|
+
}
|
|
3820
|
+
});
|
|
3821
|
+
lastOriginalSource = null;
|
|
3822
|
+
sourceMappingActive = false;
|
|
3823
|
+
}
|
|
3824
|
+
for (let idx = 0, length = chunk.length; idx < length; idx++) {
|
|
3825
|
+
if (chunk.charCodeAt(idx) === NEWLINE_CODE) {
|
|
3826
|
+
generated.line++;
|
|
3827
|
+
generated.column = 0;
|
|
3828
|
+
if (idx + 1 === length) {
|
|
3829
|
+
lastOriginalSource = null;
|
|
3830
|
+
sourceMappingActive = false;
|
|
3831
|
+
} else if (sourceMappingActive) {
|
|
3832
|
+
map.addMapping({
|
|
3833
|
+
source: original.source,
|
|
3834
|
+
original: {
|
|
3835
|
+
line: original.line,
|
|
3836
|
+
column: original.column
|
|
3837
|
+
},
|
|
3838
|
+
generated: {
|
|
3839
|
+
line: generated.line,
|
|
3840
|
+
column: generated.column
|
|
3841
|
+
},
|
|
3842
|
+
name: original.name
|
|
3843
|
+
});
|
|
3844
|
+
}
|
|
3845
|
+
} else {
|
|
3846
|
+
generated.column++;
|
|
3847
|
+
}
|
|
3848
|
+
}
|
|
3849
|
+
});
|
|
3850
|
+
this.walkSourceContents(function(sourceFile, sourceContent) {
|
|
3851
|
+
map.setSourceContent(sourceFile, sourceContent);
|
|
3852
|
+
});
|
|
3853
|
+
return { code: generated.code, map };
|
|
3854
|
+
}
|
|
3855
|
+
};
|
|
3856
|
+
exports.SourceNode = SourceNode;
|
|
3857
|
+
}
|
|
3858
|
+
});
|
|
3859
|
+
|
|
3860
|
+
// ../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/source-map.js
|
|
3861
|
+
var require_source_map = __commonJS({
|
|
3862
|
+
"../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/source-map.js"(exports) {
|
|
3863
|
+
exports.SourceMapGenerator = require_source_map_generator().SourceMapGenerator;
|
|
3864
|
+
exports.SourceMapConsumer = require_source_map_consumer().SourceMapConsumer;
|
|
3865
|
+
exports.SourceNode = require_source_node().SourceNode;
|
|
3866
|
+
}
|
|
3867
|
+
});
|
|
3868
|
+
|
|
3869
|
+
// ../node_modules/.pnpm/@mdx-js+mdx@3.1.0_acorn@8.14.0/node_modules/@mdx-js/mdx/lib/util/create-format-aware-processors.js
|
|
3870
|
+
function createFormatAwareProcessors(compileOptions) {
|
|
3871
|
+
const compileOptions_ = compileOptions || {};
|
|
3872
|
+
const mdExtensions = compileOptions_.mdExtensions || md;
|
|
3873
|
+
const mdxExtensions = compileOptions_.mdxExtensions || mdx;
|
|
3874
|
+
let cachedMarkdown;
|
|
3875
|
+
let cachedMdx;
|
|
3876
|
+
return {
|
|
3877
|
+
extnames: compileOptions_.format === "md" ? mdExtensions : compileOptions_.format === "mdx" ? mdxExtensions : [...mdExtensions, ...mdxExtensions],
|
|
3878
|
+
process: process2
|
|
3879
|
+
};
|
|
3880
|
+
function process2(vfileCompatible) {
|
|
3881
|
+
const { file, processor } = split(vfileCompatible);
|
|
3882
|
+
return processor.process(file);
|
|
3883
|
+
}
|
|
3884
|
+
function split(vfileCompatible) {
|
|
3885
|
+
const { file, options } = resolveFileAndOptions(
|
|
3886
|
+
vfileCompatible,
|
|
3887
|
+
compileOptions_
|
|
3888
|
+
);
|
|
3889
|
+
const processor = options.format === "md" ? cachedMarkdown || (cachedMarkdown = createProcessor(options)) : cachedMdx || (cachedMdx = createProcessor(options));
|
|
3890
|
+
return { file, processor };
|
|
3891
|
+
}
|
|
3892
|
+
}
|
|
3893
|
+
|
|
3894
|
+
// ../node_modules/.pnpm/@rollup+pluginutils@5.1.4_rollup@4.30.1/node_modules/@rollup/pluginutils/dist/es/index.js
|
|
3895
|
+
var import_path = __toESM(require_path());
|
|
3896
|
+
var import_picomatch = __toESM(require_picomatch2());
|
|
3897
|
+
function isArray(arg) {
|
|
3898
|
+
return Array.isArray(arg);
|
|
3899
|
+
}
|
|
3900
|
+
function ensureArray(thing) {
|
|
3901
|
+
if (isArray(thing))
|
|
3902
|
+
return thing;
|
|
3903
|
+
if (thing == null)
|
|
3904
|
+
return [];
|
|
3905
|
+
return [thing];
|
|
3906
|
+
}
|
|
3907
|
+
var normalizePathRegExp = new RegExp(`\\${import_path.win32.sep}`, "g");
|
|
3908
|
+
var normalizePath = function normalizePath2(filename) {
|
|
3909
|
+
return filename.replace(normalizePathRegExp, import_path.posix.sep);
|
|
3910
|
+
};
|
|
3911
|
+
function getMatcherString(id, resolutionBase) {
|
|
3912
|
+
if (resolutionBase === false || (0, import_path.isAbsolute)(id) || id.startsWith("**")) {
|
|
3913
|
+
return normalizePath(id);
|
|
3914
|
+
}
|
|
3915
|
+
const basePath = normalizePath((0, import_path.resolve)(resolutionBase || "")).replace(/[-^$*+?.()|[\]{}]/g, "\\$&");
|
|
3916
|
+
return import_path.posix.join(basePath, normalizePath(id));
|
|
3917
|
+
}
|
|
3918
|
+
var createFilter = function createFilter2(include, exclude, options) {
|
|
3919
|
+
const resolutionBase = options && options.resolve;
|
|
3920
|
+
const getMatcher = (id) => id instanceof RegExp ? id : {
|
|
3921
|
+
test: (what) => {
|
|
3922
|
+
const pattern = getMatcherString(id, resolutionBase);
|
|
3923
|
+
const fn = (0, import_picomatch.default)(pattern, { dot: true });
|
|
3924
|
+
const result = fn(what);
|
|
3925
|
+
return result;
|
|
3926
|
+
}
|
|
3927
|
+
};
|
|
3928
|
+
const includeMatchers = ensureArray(include).map(getMatcher);
|
|
3929
|
+
const excludeMatchers = ensureArray(exclude).map(getMatcher);
|
|
3930
|
+
if (!includeMatchers.length && !excludeMatchers.length)
|
|
3931
|
+
return (id) => typeof id === "string" && !id.includes("\0");
|
|
3932
|
+
return function result(id) {
|
|
3933
|
+
if (typeof id !== "string")
|
|
3934
|
+
return false;
|
|
3935
|
+
if (id.includes("\0"))
|
|
3936
|
+
return false;
|
|
3937
|
+
const pathId = normalizePath(id);
|
|
3938
|
+
for (let i = 0; i < excludeMatchers.length; ++i) {
|
|
3939
|
+
const matcher = excludeMatchers[i];
|
|
3940
|
+
if (matcher instanceof RegExp) {
|
|
3941
|
+
matcher.lastIndex = 0;
|
|
3942
|
+
}
|
|
3943
|
+
if (matcher.test(pathId))
|
|
3944
|
+
return false;
|
|
3945
|
+
}
|
|
3946
|
+
for (let i = 0; i < includeMatchers.length; ++i) {
|
|
3947
|
+
const matcher = includeMatchers[i];
|
|
3948
|
+
if (matcher instanceof RegExp) {
|
|
3949
|
+
matcher.lastIndex = 0;
|
|
3950
|
+
}
|
|
3951
|
+
if (matcher.test(pathId))
|
|
3952
|
+
return true;
|
|
3953
|
+
}
|
|
3954
|
+
return !includeMatchers.length;
|
|
3955
|
+
};
|
|
3956
|
+
};
|
|
3957
|
+
var reservedWords = "break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield enum await implements package protected static interface private public";
|
|
3958
|
+
var builtins = "arguments Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl";
|
|
3959
|
+
var forbiddenIdentifiers = new Set(`${reservedWords} ${builtins}`.split(" "));
|
|
3960
|
+
forbiddenIdentifiers.add("");
|
|
3961
|
+
var hasStringIsWellFormed = "isWellFormed" in String.prototype;
|
|
3962
|
+
|
|
3963
|
+
// ../node_modules/.pnpm/@mdx-js+rollup@3.1.0_acorn@8.14.0_rollup@4.30.1/node_modules/@mdx-js/rollup/lib/index.js
|
|
3964
|
+
var import_source_map = __toESM(require_source_map(), 1);
|
|
3965
|
+
function rollup(options) {
|
|
3966
|
+
const { exclude, include, ...rest } = options || {};
|
|
3967
|
+
let formatAwareProcessors;
|
|
3968
|
+
const filter = createFilter(include, exclude);
|
|
3969
|
+
return {
|
|
3970
|
+
name: "@mdx-js/rollup",
|
|
3971
|
+
config(config, env) {
|
|
3972
|
+
formatAwareProcessors = createFormatAwareProcessors({
|
|
3973
|
+
SourceMapGenerator: import_source_map.SourceMapGenerator,
|
|
3974
|
+
development: env.mode === "development",
|
|
3975
|
+
...rest
|
|
3976
|
+
});
|
|
3977
|
+
},
|
|
3978
|
+
async transform(value, path) {
|
|
3979
|
+
if (!formatAwareProcessors) {
|
|
3980
|
+
formatAwareProcessors = createFormatAwareProcessors({
|
|
3981
|
+
SourceMapGenerator: import_source_map.SourceMapGenerator,
|
|
3982
|
+
...rest
|
|
3983
|
+
});
|
|
3984
|
+
}
|
|
3985
|
+
const file = new VFile({ path, value });
|
|
3986
|
+
if (file.extname && filter(file.path) && formatAwareProcessors.extnames.includes(file.extname)) {
|
|
3987
|
+
const compiled = await formatAwareProcessors.process(file);
|
|
3988
|
+
const code = String(compiled.value);
|
|
3989
|
+
const result = {
|
|
3990
|
+
code,
|
|
3991
|
+
// @ts-expect-error: `rollup` is not compiled with `exactOptionalPropertyTypes`,
|
|
3992
|
+
// so it does not allow `sourceRoot` in `file.map` to be `undefined` here.
|
|
3993
|
+
map: compiled.map
|
|
3994
|
+
};
|
|
3995
|
+
return result;
|
|
3996
|
+
}
|
|
3997
|
+
}
|
|
3998
|
+
};
|
|
3999
|
+
}
|
|
4000
|
+
export {
|
|
4001
|
+
rollup as default
|
|
4002
|
+
};
|
|
4003
|
+
//# sourceMappingURL=@mdx-js_rollup.js.map
|