nitro-nightly 3.1.0-20251028-004953-57503e42 → 3.1.0-20251028-090722-437659e4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_build/assets.mjs +235 -0
- package/dist/_build/build.mjs +21 -0
- package/dist/_build/config.mjs +124 -0
- package/dist/_build/info.mjs +39 -0
- package/dist/_build/plugins.mjs +1041 -0
- package/dist/_build/prepare.mjs +17 -0
- package/dist/{_chunks/build2.mjs → _build/rolldown.mjs} +238 -64
- package/dist/_build/rollup.mjs +404 -0
- package/dist/_build/snapshot.mjs +61 -0
- package/dist/_build/types.mjs +268 -0
- package/dist/_build/vite.mjs +3266 -0
- package/dist/{cli → _cli}/build.mjs +2 -3
- package/dist/_cli/dev.mjs +205 -0
- package/dist/{cli/index2.mjs → _cli/index.mjs} +1 -2
- package/dist/{cli → _cli}/list.mjs +2 -3
- package/dist/{cli → _cli}/prepare.mjs +2 -3
- package/dist/{cli → _cli}/run.mjs +2 -3
- package/dist/_deps/@jridgewell/gen-mapping.mjs +189 -0
- package/dist/_deps/@jridgewell/remapping.mjs +137 -0
- package/dist/_deps/@jridgewell/resolve-uri.mjs +231 -0
- package/dist/_deps/@jridgewell/sourcemap-codec.mjs +173 -0
- package/dist/_deps/@jridgewell/trace-mapping.mjs +170 -0
- package/dist/_deps/@pi0/vite-plugin-fullstack.mjs +575 -0
- package/dist/_deps/@rollup/plugin-alias.mjs +89 -0
- package/dist/_deps/@rollup/plugin-commonjs.mjs +2376 -0
- package/dist/{_chunks/index2.mjs → _deps/@rollup/plugin-inject.mjs} +5 -90
- package/dist/_deps/@rollup/plugin-json.mjs +37 -0
- package/dist/_deps/@rollup/plugin-node-resolve.mjs +1386 -0
- package/dist/_deps/@rollup/plugin-replace.mjs +133 -0
- package/dist/_deps/@rollup/pluginutils.mjs +346 -0
- package/dist/_deps/acorn.mjs +6225 -0
- package/dist/_deps/c12.mjs +510 -0
- package/dist/_deps/chokidar.mjs +1428 -0
- package/dist/_deps/citty.mjs +460 -0
- package/dist/_deps/commondir.mjs +77 -0
- package/dist/_deps/compatx.mjs +76 -0
- package/dist/_deps/confbox.mjs +300 -0
- package/dist/_deps/debug.mjs +885 -0
- package/dist/_deps/deepmerge.mjs +147 -0
- package/dist/_deps/depd.mjs +550 -0
- package/dist/_deps/dot-prop.mjs +282 -0
- package/dist/_deps/dotenv.mjs +555 -0
- package/dist/_deps/duplexer.mjs +1 -0
- package/dist/_deps/ee-first.mjs +104 -0
- package/dist/_deps/encodeurl.mjs +69 -0
- package/dist/_deps/escape-html.mjs +87 -0
- package/dist/_deps/escape-string-regexp.mjs +13 -0
- package/dist/_deps/estree-walker.mjs +433 -0
- package/dist/_deps/etag.mjs +147 -0
- package/dist/_deps/exsolve.mjs +1416 -0
- package/dist/_deps/fdir.mjs +569 -0
- package/dist/_deps/fresh.mjs +145 -0
- package/dist/_deps/function-bind.mjs +106 -0
- package/dist/{_chunks/index4.mjs → _deps/giget.mjs} +21 -776
- package/dist/_deps/gzip-size.mjs +19 -0
- package/dist/_deps/hasown.mjs +19 -0
- package/dist/_deps/http-errors.mjs +307 -0
- package/dist/_deps/httpxy.mjs +580 -0
- package/dist/_deps/inherits.mjs +57 -0
- package/dist/_deps/is-core-module.mjs +596 -0
- package/dist/_deps/is-module.mjs +25 -0
- package/dist/_deps/is-reference.mjs +31 -0
- package/dist/_deps/js-tokens.mjs +411 -0
- package/dist/_deps/knitwork.mjs +172 -0
- package/dist/_deps/local-pkg.mjs +163 -0
- package/dist/_deps/magic-string.mjs +1296 -0
- package/dist/_deps/mime-db.mjs +11685 -0
- package/dist/_deps/mime-types.mjs +287 -0
- package/dist/_deps/mime.mjs +1172 -0
- package/dist/_deps/mlly.mjs +2413 -0
- package/dist/_deps/ms.mjs +172 -0
- package/dist/_deps/node-fetch-native.mjs +3 -0
- package/dist/_deps/nypm.mjs +219 -0
- package/dist/_deps/on-finished.mjs +246 -0
- package/dist/_deps/parseurl.mjs +168 -0
- package/dist/_deps/path-parse.mjs +85 -0
- package/dist/{_chunks/pathe.M-eThtNZ.mjs → _deps/pathe.mjs} +48 -1
- package/dist/_deps/perfect-debounce.mjs +88 -0
- package/dist/_deps/picomatch.mjs +2144 -0
- package/dist/_deps/pkg-types.mjs +247 -0
- package/dist/_deps/pretty-bytes.mjs +180 -0
- package/dist/_deps/quansync.mjs +99 -0
- package/dist/_deps/range-parser.mjs +171 -0
- package/dist/_deps/rc9.mjs +219 -0
- package/dist/_deps/readdirp.mjs +245 -0
- package/dist/_deps/resolve.mjs +1260 -0
- package/dist/_deps/rou3.mjs +326 -0
- package/dist/_deps/send.mjs +1022 -0
- package/dist/_deps/serve-static.mjs +228 -0
- package/dist/_deps/setprototypeof.mjs +26 -0
- package/dist/_deps/statuses.mjs +457 -0
- package/dist/_deps/strip-literal.mjs +67 -0
- package/dist/_deps/supports-color.mjs +44 -0
- package/dist/_deps/tinyexec.mjs +552 -0
- package/dist/_deps/tinyglobby.mjs +293 -0
- package/dist/_deps/toidentifier.mjs +41 -0
- package/dist/_deps/ultrahtml.mjs +3 -0
- package/dist/_deps/unimport.mjs +2267 -0
- package/dist/_deps/unplugin-utils.mjs +65 -0
- package/dist/_deps/unplugin.mjs +1294 -0
- package/dist/_deps/untyped.mjs +375 -0
- package/dist/{_chunks/info.mjs → _deps/unwasm.mjs} +8 -4122
- package/dist/_deps/webpack-virtual-modules.mjs +360 -0
- package/dist/_presets/_all.mjs +59 -0
- package/dist/_presets/_nitro.mjs +74 -0
- package/dist/_presets/_resolve.mjs +64 -0
- package/dist/_presets/_static.mjs +69 -0
- package/dist/_presets/_types.mjs +3 -0
- package/dist/_presets/_utils.mjs +31 -0
- package/dist/_presets/alwaysdata.mjs +17 -0
- package/dist/_presets/aws-amplify.mjs +111 -0
- package/dist/_presets/aws-lambda.mjs +23 -0
- package/dist/_presets/azure.mjs +162 -0
- package/dist/_presets/bun.mjs +19 -0
- package/dist/_presets/cleavr.mjs +15 -0
- package/dist/_presets/cloudflare.mjs +608 -0
- package/dist/_presets/deno.mjs +196 -0
- package/dist/_presets/digitalocean.mjs +14 -0
- package/dist/_presets/firebase.mjs +47 -0
- package/dist/_presets/flightcontrol.mjs +14 -0
- package/dist/_presets/genezio.mjs +13 -0
- package/dist/_presets/heroku.mjs +14 -0
- package/dist/_presets/iis.mjs +194 -0
- package/dist/_presets/index.mjs +62 -0
- package/dist/_presets/koyeb.mjs +14 -0
- package/dist/_presets/netlify.mjs +241 -0
- package/dist/_presets/node.mjs +54 -0
- package/dist/_presets/platform.mjs +14 -0
- package/dist/_presets/render.mjs +14 -0
- package/dist/_presets/standard.mjs +23 -0
- package/dist/_presets/stormkit.mjs +18 -0
- package/dist/_presets/vercel.mjs +365 -0
- package/dist/_presets/winterjs.mjs +22 -0
- package/dist/_presets/zeabur.mjs +69 -0
- package/dist/_presets/zerops.mjs +27 -0
- package/dist/cli/index.mjs +7 -464
- package/dist/index.mjs +122 -34
- package/dist/vite.mjs +118 -44
- package/package.json +1 -1
- package/dist/_chunks/app.mjs +0 -19797
- package/dist/_chunks/build.mjs +0 -86
- package/dist/_chunks/build3.mjs +0 -6538
- package/dist/_chunks/detect-acorn.mjs +0 -503
- package/dist/_chunks/index.mjs +0 -22256
- package/dist/_chunks/index3.mjs +0 -1062
- package/dist/_chunks/json5.mjs +0 -68
- package/dist/_chunks/jsonc.mjs +0 -51
- package/dist/_chunks/plugin.mjs +0 -1560
- package/dist/_chunks/server.mjs +0 -254
- package/dist/_chunks/snapshot.mjs +0 -376
- package/dist/_chunks/toml.mjs +0 -259
- package/dist/_chunks/yaml.mjs +0 -86
- package/dist/cli/dev.mjs +0 -95
- package/dist/presets.mjs +0 -2494
- /package/dist/{cli → _cli}/common.mjs +0 -0
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
import { a as getDefaultExportFromCjs } from './commondir.mjs';
|
|
2
|
+
|
|
3
|
+
var jsTokens_1;
|
|
4
|
+
var hasRequiredJsTokens;
|
|
5
|
+
|
|
6
|
+
function requireJsTokens () {
|
|
7
|
+
if (hasRequiredJsTokens) return jsTokens_1;
|
|
8
|
+
hasRequiredJsTokens = 1;
|
|
9
|
+
// Copyright 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Simon Lydell
|
|
10
|
+
// License: MIT.
|
|
11
|
+
var HashbangComment, Identifier, JSXIdentifier, JSXPunctuator, JSXString, JSXText, KeywordsWithExpressionAfter, KeywordsWithNoLineTerminatorAfter, LineTerminatorSequence, MultiLineComment, Newline, NumericLiteral, Punctuator, RegularExpressionLiteral, SingleLineComment, StringLiteral, Template, TokensNotPrecedingObjectLiteral, TokensPrecedingExpression, WhiteSpace;
|
|
12
|
+
RegularExpressionLiteral = /\/(?![*\/])(?:\[(?:[^\]\\\n\r\u2028\u2029]+|\\.)*\]?|[^\/[\\\n\r\u2028\u2029]+|\\.)*(\/[$_\u200C\u200D\p{ID_Continue}]*|\\)?/yu;
|
|
13
|
+
Punctuator = /--|\+\+|=>|\.{3}|\??\.(?!\d)|(?:&&|\|\||\?\?|[+\-%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2}|\/(?![\/*]))=?|[?~,:;[\](){}]/y;
|
|
14
|
+
Identifier = /(\x23?)(?=[$_\p{ID_Start}\\])(?:[$_\u200C\u200D\p{ID_Continue}]+|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+/yu;
|
|
15
|
+
StringLiteral = /(['"])(?:[^'"\\\n\r]+|(?!\1)['"]|\\(?:\r\n|[^]))*(\1)?/y;
|
|
16
|
+
NumericLiteral = /(?:0[xX][\da-fA-F](?:_?[\da-fA-F])*|0[oO][0-7](?:_?[0-7])*|0[bB][01](?:_?[01])*)n?|0n|[1-9](?:_?\d)*n|(?:(?:0(?!\d)|0\d*[89]\d*|[1-9](?:_?\d)*)(?:\.(?:\d(?:_?\d)*)?)?|\.\d(?:_?\d)*)(?:[eE][+-]?\d(?:_?\d)*)?|0[0-7]+/y;
|
|
17
|
+
Template = /[`}](?:[^`\\$]+|\\[^]|\$(?!\{))*(`|\$\{)?/y;
|
|
18
|
+
WhiteSpace = /[\t\v\f\ufeff\p{Zs}]+/yu;
|
|
19
|
+
LineTerminatorSequence = /\r?\n|[\r\u2028\u2029]/y;
|
|
20
|
+
MultiLineComment = /\/\*(?:[^*]+|\*(?!\/))*(\*\/)?/y;
|
|
21
|
+
SingleLineComment = /\/\/.*/y;
|
|
22
|
+
HashbangComment = /^#!.*/;
|
|
23
|
+
JSXPunctuator = /[<>.:={}]|\/(?![\/*])/y;
|
|
24
|
+
JSXIdentifier = /[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}-]*/yu;
|
|
25
|
+
JSXString = /(['"])(?:[^'"]+|(?!\1)['"])*(\1)?/y;
|
|
26
|
+
JSXText = /[^<>{}]+/y;
|
|
27
|
+
TokensPrecedingExpression = /^(?:[\/+-]|\.{3}|\?(?:InterpolationIn(?:JSX|Template)|NoLineTerminatorHere|NonExpressionParenEnd|UnaryIncDec))?$|[{}([,;<>=*%&|^!~?:]$/;
|
|
28
|
+
TokensNotPrecedingObjectLiteral = /^(?:=>|[;\]){}]|else|\?(?:NoLineTerminatorHere|NonExpressionParenEnd))?$/;
|
|
29
|
+
KeywordsWithExpressionAfter = /^(?:await|case|default|delete|do|else|instanceof|new|return|throw|typeof|void|yield)$/;
|
|
30
|
+
KeywordsWithNoLineTerminatorAfter = /^(?:return|throw|yield)$/;
|
|
31
|
+
Newline = RegExp(LineTerminatorSequence.source);
|
|
32
|
+
jsTokens_1 = function*(input, {jsx = false} = {}) {
|
|
33
|
+
var braces, firstCodePoint, isExpression, lastIndex, lastSignificantToken, length, match, mode, nextLastIndex, nextLastSignificantToken, parenNesting, postfixIncDec, punctuator, stack;
|
|
34
|
+
({length} = input);
|
|
35
|
+
lastIndex = 0;
|
|
36
|
+
lastSignificantToken = "";
|
|
37
|
+
stack = [
|
|
38
|
+
{tag: "JS"}
|
|
39
|
+
];
|
|
40
|
+
braces = [];
|
|
41
|
+
parenNesting = 0;
|
|
42
|
+
postfixIncDec = false;
|
|
43
|
+
if (match = HashbangComment.exec(input)) {
|
|
44
|
+
yield ({
|
|
45
|
+
type: "HashbangComment",
|
|
46
|
+
value: match[0]
|
|
47
|
+
});
|
|
48
|
+
lastIndex = match[0].length;
|
|
49
|
+
}
|
|
50
|
+
while (lastIndex < length) {
|
|
51
|
+
mode = stack[stack.length - 1];
|
|
52
|
+
switch (mode.tag) {
|
|
53
|
+
case "JS":
|
|
54
|
+
case "JSNonExpressionParen":
|
|
55
|
+
case "InterpolationInTemplate":
|
|
56
|
+
case "InterpolationInJSX":
|
|
57
|
+
if (input[lastIndex] === "/" && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken))) {
|
|
58
|
+
RegularExpressionLiteral.lastIndex = lastIndex;
|
|
59
|
+
if (match = RegularExpressionLiteral.exec(input)) {
|
|
60
|
+
lastIndex = RegularExpressionLiteral.lastIndex;
|
|
61
|
+
lastSignificantToken = match[0];
|
|
62
|
+
postfixIncDec = true;
|
|
63
|
+
yield ({
|
|
64
|
+
type: "RegularExpressionLiteral",
|
|
65
|
+
value: match[0],
|
|
66
|
+
closed: match[1] !== void 0 && match[1] !== "\\"
|
|
67
|
+
});
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
Punctuator.lastIndex = lastIndex;
|
|
72
|
+
if (match = Punctuator.exec(input)) {
|
|
73
|
+
punctuator = match[0];
|
|
74
|
+
nextLastIndex = Punctuator.lastIndex;
|
|
75
|
+
nextLastSignificantToken = punctuator;
|
|
76
|
+
switch (punctuator) {
|
|
77
|
+
case "(":
|
|
78
|
+
if (lastSignificantToken === "?NonExpressionParenKeyword") {
|
|
79
|
+
stack.push({
|
|
80
|
+
tag: "JSNonExpressionParen",
|
|
81
|
+
nesting: parenNesting
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
parenNesting++;
|
|
85
|
+
postfixIncDec = false;
|
|
86
|
+
break;
|
|
87
|
+
case ")":
|
|
88
|
+
parenNesting--;
|
|
89
|
+
postfixIncDec = true;
|
|
90
|
+
if (mode.tag === "JSNonExpressionParen" && parenNesting === mode.nesting) {
|
|
91
|
+
stack.pop();
|
|
92
|
+
nextLastSignificantToken = "?NonExpressionParenEnd";
|
|
93
|
+
postfixIncDec = false;
|
|
94
|
+
}
|
|
95
|
+
break;
|
|
96
|
+
case "{":
|
|
97
|
+
Punctuator.lastIndex = 0;
|
|
98
|
+
isExpression = !TokensNotPrecedingObjectLiteral.test(lastSignificantToken) && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken));
|
|
99
|
+
braces.push(isExpression);
|
|
100
|
+
postfixIncDec = false;
|
|
101
|
+
break;
|
|
102
|
+
case "}":
|
|
103
|
+
switch (mode.tag) {
|
|
104
|
+
case "InterpolationInTemplate":
|
|
105
|
+
if (braces.length === mode.nesting) {
|
|
106
|
+
Template.lastIndex = lastIndex;
|
|
107
|
+
match = Template.exec(input);
|
|
108
|
+
lastIndex = Template.lastIndex;
|
|
109
|
+
lastSignificantToken = match[0];
|
|
110
|
+
if (match[1] === "${") {
|
|
111
|
+
lastSignificantToken = "?InterpolationInTemplate";
|
|
112
|
+
postfixIncDec = false;
|
|
113
|
+
yield ({
|
|
114
|
+
type: "TemplateMiddle",
|
|
115
|
+
value: match[0]
|
|
116
|
+
});
|
|
117
|
+
} else {
|
|
118
|
+
stack.pop();
|
|
119
|
+
postfixIncDec = true;
|
|
120
|
+
yield ({
|
|
121
|
+
type: "TemplateTail",
|
|
122
|
+
value: match[0],
|
|
123
|
+
closed: match[1] === "`"
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
break;
|
|
129
|
+
case "InterpolationInJSX":
|
|
130
|
+
if (braces.length === mode.nesting) {
|
|
131
|
+
stack.pop();
|
|
132
|
+
lastIndex += 1;
|
|
133
|
+
lastSignificantToken = "}";
|
|
134
|
+
yield ({
|
|
135
|
+
type: "JSXPunctuator",
|
|
136
|
+
value: "}"
|
|
137
|
+
});
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
postfixIncDec = braces.pop();
|
|
142
|
+
nextLastSignificantToken = postfixIncDec ? "?ExpressionBraceEnd" : "}";
|
|
143
|
+
break;
|
|
144
|
+
case "]":
|
|
145
|
+
postfixIncDec = true;
|
|
146
|
+
break;
|
|
147
|
+
case "++":
|
|
148
|
+
case "--":
|
|
149
|
+
nextLastSignificantToken = postfixIncDec ? "?PostfixIncDec" : "?UnaryIncDec";
|
|
150
|
+
break;
|
|
151
|
+
case "<":
|
|
152
|
+
if (jsx && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken))) {
|
|
153
|
+
stack.push({tag: "JSXTag"});
|
|
154
|
+
lastIndex += 1;
|
|
155
|
+
lastSignificantToken = "<";
|
|
156
|
+
yield ({
|
|
157
|
+
type: "JSXPunctuator",
|
|
158
|
+
value: punctuator
|
|
159
|
+
});
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
postfixIncDec = false;
|
|
163
|
+
break;
|
|
164
|
+
default:
|
|
165
|
+
postfixIncDec = false;
|
|
166
|
+
}
|
|
167
|
+
lastIndex = nextLastIndex;
|
|
168
|
+
lastSignificantToken = nextLastSignificantToken;
|
|
169
|
+
yield ({
|
|
170
|
+
type: "Punctuator",
|
|
171
|
+
value: punctuator
|
|
172
|
+
});
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
Identifier.lastIndex = lastIndex;
|
|
176
|
+
if (match = Identifier.exec(input)) {
|
|
177
|
+
lastIndex = Identifier.lastIndex;
|
|
178
|
+
nextLastSignificantToken = match[0];
|
|
179
|
+
switch (match[0]) {
|
|
180
|
+
case "for":
|
|
181
|
+
case "if":
|
|
182
|
+
case "while":
|
|
183
|
+
case "with":
|
|
184
|
+
if (lastSignificantToken !== "." && lastSignificantToken !== "?.") {
|
|
185
|
+
nextLastSignificantToken = "?NonExpressionParenKeyword";
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
lastSignificantToken = nextLastSignificantToken;
|
|
189
|
+
postfixIncDec = !KeywordsWithExpressionAfter.test(match[0]);
|
|
190
|
+
yield ({
|
|
191
|
+
type: match[1] === "#" ? "PrivateIdentifier" : "IdentifierName",
|
|
192
|
+
value: match[0]
|
|
193
|
+
});
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
196
|
+
StringLiteral.lastIndex = lastIndex;
|
|
197
|
+
if (match = StringLiteral.exec(input)) {
|
|
198
|
+
lastIndex = StringLiteral.lastIndex;
|
|
199
|
+
lastSignificantToken = match[0];
|
|
200
|
+
postfixIncDec = true;
|
|
201
|
+
yield ({
|
|
202
|
+
type: "StringLiteral",
|
|
203
|
+
value: match[0],
|
|
204
|
+
closed: match[2] !== void 0
|
|
205
|
+
});
|
|
206
|
+
continue;
|
|
207
|
+
}
|
|
208
|
+
NumericLiteral.lastIndex = lastIndex;
|
|
209
|
+
if (match = NumericLiteral.exec(input)) {
|
|
210
|
+
lastIndex = NumericLiteral.lastIndex;
|
|
211
|
+
lastSignificantToken = match[0];
|
|
212
|
+
postfixIncDec = true;
|
|
213
|
+
yield ({
|
|
214
|
+
type: "NumericLiteral",
|
|
215
|
+
value: match[0]
|
|
216
|
+
});
|
|
217
|
+
continue;
|
|
218
|
+
}
|
|
219
|
+
Template.lastIndex = lastIndex;
|
|
220
|
+
if (match = Template.exec(input)) {
|
|
221
|
+
lastIndex = Template.lastIndex;
|
|
222
|
+
lastSignificantToken = match[0];
|
|
223
|
+
if (match[1] === "${") {
|
|
224
|
+
lastSignificantToken = "?InterpolationInTemplate";
|
|
225
|
+
stack.push({
|
|
226
|
+
tag: "InterpolationInTemplate",
|
|
227
|
+
nesting: braces.length
|
|
228
|
+
});
|
|
229
|
+
postfixIncDec = false;
|
|
230
|
+
yield ({
|
|
231
|
+
type: "TemplateHead",
|
|
232
|
+
value: match[0]
|
|
233
|
+
});
|
|
234
|
+
} else {
|
|
235
|
+
postfixIncDec = true;
|
|
236
|
+
yield ({
|
|
237
|
+
type: "NoSubstitutionTemplate",
|
|
238
|
+
value: match[0],
|
|
239
|
+
closed: match[1] === "`"
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
244
|
+
break;
|
|
245
|
+
case "JSXTag":
|
|
246
|
+
case "JSXTagEnd":
|
|
247
|
+
JSXPunctuator.lastIndex = lastIndex;
|
|
248
|
+
if (match = JSXPunctuator.exec(input)) {
|
|
249
|
+
lastIndex = JSXPunctuator.lastIndex;
|
|
250
|
+
nextLastSignificantToken = match[0];
|
|
251
|
+
switch (match[0]) {
|
|
252
|
+
case "<":
|
|
253
|
+
stack.push({tag: "JSXTag"});
|
|
254
|
+
break;
|
|
255
|
+
case ">":
|
|
256
|
+
stack.pop();
|
|
257
|
+
if (lastSignificantToken === "/" || mode.tag === "JSXTagEnd") {
|
|
258
|
+
nextLastSignificantToken = "?JSX";
|
|
259
|
+
postfixIncDec = true;
|
|
260
|
+
} else {
|
|
261
|
+
stack.push({tag: "JSXChildren"});
|
|
262
|
+
}
|
|
263
|
+
break;
|
|
264
|
+
case "{":
|
|
265
|
+
stack.push({
|
|
266
|
+
tag: "InterpolationInJSX",
|
|
267
|
+
nesting: braces.length
|
|
268
|
+
});
|
|
269
|
+
nextLastSignificantToken = "?InterpolationInJSX";
|
|
270
|
+
postfixIncDec = false;
|
|
271
|
+
break;
|
|
272
|
+
case "/":
|
|
273
|
+
if (lastSignificantToken === "<") {
|
|
274
|
+
stack.pop();
|
|
275
|
+
if (stack[stack.length - 1].tag === "JSXChildren") {
|
|
276
|
+
stack.pop();
|
|
277
|
+
}
|
|
278
|
+
stack.push({tag: "JSXTagEnd"});
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
lastSignificantToken = nextLastSignificantToken;
|
|
282
|
+
yield ({
|
|
283
|
+
type: "JSXPunctuator",
|
|
284
|
+
value: match[0]
|
|
285
|
+
});
|
|
286
|
+
continue;
|
|
287
|
+
}
|
|
288
|
+
JSXIdentifier.lastIndex = lastIndex;
|
|
289
|
+
if (match = JSXIdentifier.exec(input)) {
|
|
290
|
+
lastIndex = JSXIdentifier.lastIndex;
|
|
291
|
+
lastSignificantToken = match[0];
|
|
292
|
+
yield ({
|
|
293
|
+
type: "JSXIdentifier",
|
|
294
|
+
value: match[0]
|
|
295
|
+
});
|
|
296
|
+
continue;
|
|
297
|
+
}
|
|
298
|
+
JSXString.lastIndex = lastIndex;
|
|
299
|
+
if (match = JSXString.exec(input)) {
|
|
300
|
+
lastIndex = JSXString.lastIndex;
|
|
301
|
+
lastSignificantToken = match[0];
|
|
302
|
+
yield ({
|
|
303
|
+
type: "JSXString",
|
|
304
|
+
value: match[0],
|
|
305
|
+
closed: match[2] !== void 0
|
|
306
|
+
});
|
|
307
|
+
continue;
|
|
308
|
+
}
|
|
309
|
+
break;
|
|
310
|
+
case "JSXChildren":
|
|
311
|
+
JSXText.lastIndex = lastIndex;
|
|
312
|
+
if (match = JSXText.exec(input)) {
|
|
313
|
+
lastIndex = JSXText.lastIndex;
|
|
314
|
+
lastSignificantToken = match[0];
|
|
315
|
+
yield ({
|
|
316
|
+
type: "JSXText",
|
|
317
|
+
value: match[0]
|
|
318
|
+
});
|
|
319
|
+
continue;
|
|
320
|
+
}
|
|
321
|
+
switch (input[lastIndex]) {
|
|
322
|
+
case "<":
|
|
323
|
+
stack.push({tag: "JSXTag"});
|
|
324
|
+
lastIndex++;
|
|
325
|
+
lastSignificantToken = "<";
|
|
326
|
+
yield ({
|
|
327
|
+
type: "JSXPunctuator",
|
|
328
|
+
value: "<"
|
|
329
|
+
});
|
|
330
|
+
continue;
|
|
331
|
+
case "{":
|
|
332
|
+
stack.push({
|
|
333
|
+
tag: "InterpolationInJSX",
|
|
334
|
+
nesting: braces.length
|
|
335
|
+
});
|
|
336
|
+
lastIndex++;
|
|
337
|
+
lastSignificantToken = "?InterpolationInJSX";
|
|
338
|
+
postfixIncDec = false;
|
|
339
|
+
yield ({
|
|
340
|
+
type: "JSXPunctuator",
|
|
341
|
+
value: "{"
|
|
342
|
+
});
|
|
343
|
+
continue;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
WhiteSpace.lastIndex = lastIndex;
|
|
347
|
+
if (match = WhiteSpace.exec(input)) {
|
|
348
|
+
lastIndex = WhiteSpace.lastIndex;
|
|
349
|
+
yield ({
|
|
350
|
+
type: "WhiteSpace",
|
|
351
|
+
value: match[0]
|
|
352
|
+
});
|
|
353
|
+
continue;
|
|
354
|
+
}
|
|
355
|
+
LineTerminatorSequence.lastIndex = lastIndex;
|
|
356
|
+
if (match = LineTerminatorSequence.exec(input)) {
|
|
357
|
+
lastIndex = LineTerminatorSequence.lastIndex;
|
|
358
|
+
postfixIncDec = false;
|
|
359
|
+
if (KeywordsWithNoLineTerminatorAfter.test(lastSignificantToken)) {
|
|
360
|
+
lastSignificantToken = "?NoLineTerminatorHere";
|
|
361
|
+
}
|
|
362
|
+
yield ({
|
|
363
|
+
type: "LineTerminatorSequence",
|
|
364
|
+
value: match[0]
|
|
365
|
+
});
|
|
366
|
+
continue;
|
|
367
|
+
}
|
|
368
|
+
MultiLineComment.lastIndex = lastIndex;
|
|
369
|
+
if (match = MultiLineComment.exec(input)) {
|
|
370
|
+
lastIndex = MultiLineComment.lastIndex;
|
|
371
|
+
if (Newline.test(match[0])) {
|
|
372
|
+
postfixIncDec = false;
|
|
373
|
+
if (KeywordsWithNoLineTerminatorAfter.test(lastSignificantToken)) {
|
|
374
|
+
lastSignificantToken = "?NoLineTerminatorHere";
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
yield ({
|
|
378
|
+
type: "MultiLineComment",
|
|
379
|
+
value: match[0],
|
|
380
|
+
closed: match[1] !== void 0
|
|
381
|
+
});
|
|
382
|
+
continue;
|
|
383
|
+
}
|
|
384
|
+
SingleLineComment.lastIndex = lastIndex;
|
|
385
|
+
if (match = SingleLineComment.exec(input)) {
|
|
386
|
+
lastIndex = SingleLineComment.lastIndex;
|
|
387
|
+
postfixIncDec = false;
|
|
388
|
+
yield ({
|
|
389
|
+
type: "SingleLineComment",
|
|
390
|
+
value: match[0]
|
|
391
|
+
});
|
|
392
|
+
continue;
|
|
393
|
+
}
|
|
394
|
+
firstCodePoint = String.fromCodePoint(input.codePointAt(lastIndex));
|
|
395
|
+
lastIndex += firstCodePoint.length;
|
|
396
|
+
lastSignificantToken = firstCodePoint;
|
|
397
|
+
postfixIncDec = false;
|
|
398
|
+
yield ({
|
|
399
|
+
type: mode.tag.startsWith("JSX") ? "JSXInvalid" : "Invalid",
|
|
400
|
+
value: firstCodePoint
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
return void 0;
|
|
404
|
+
};
|
|
405
|
+
return jsTokens_1;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
var jsTokensExports = requireJsTokens();
|
|
409
|
+
const jsTokens = /*@__PURE__*/getDefaultExportFromCjs(jsTokensExports);
|
|
410
|
+
|
|
411
|
+
export { jsTokens as j };
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
function genString(input, options = {}) {
|
|
2
|
+
const str = JSON.stringify(input);
|
|
3
|
+
if (!options.singleQuotes) {
|
|
4
|
+
return str;
|
|
5
|
+
}
|
|
6
|
+
return `'${escapeString(str).slice(1, -1)}'`;
|
|
7
|
+
}
|
|
8
|
+
const NEEDS_ESCAPE_RE = /[\n\r'\\\u2028\u2029]/;
|
|
9
|
+
const QUOTE_NEWLINE_RE = /([\n\r'\u2028\u2029])/g;
|
|
10
|
+
const BACKSLASH_RE = /\\/g;
|
|
11
|
+
function escapeString(id) {
|
|
12
|
+
if (!NEEDS_ESCAPE_RE.test(id)) {
|
|
13
|
+
return id;
|
|
14
|
+
}
|
|
15
|
+
return id.replace(BACKSLASH_RE, "\\\\").replace(QUOTE_NEWLINE_RE, "\\$1");
|
|
16
|
+
}
|
|
17
|
+
function genSafeVariableName(name) {
|
|
18
|
+
if (reservedNames.has(name)) {
|
|
19
|
+
return `_${name}`;
|
|
20
|
+
}
|
|
21
|
+
return name.replace(/^\d/, (r) => `_${r}`).replace(/\W/g, (r) => "_" + r.charCodeAt(0));
|
|
22
|
+
}
|
|
23
|
+
const reservedNames = /* @__PURE__ */ new Set([
|
|
24
|
+
"Infinity",
|
|
25
|
+
"NaN",
|
|
26
|
+
"arguments",
|
|
27
|
+
"await",
|
|
28
|
+
"break",
|
|
29
|
+
"case",
|
|
30
|
+
"catch",
|
|
31
|
+
"class",
|
|
32
|
+
"const",
|
|
33
|
+
"continue",
|
|
34
|
+
"debugger",
|
|
35
|
+
"default",
|
|
36
|
+
"delete",
|
|
37
|
+
"do",
|
|
38
|
+
"else",
|
|
39
|
+
"enum",
|
|
40
|
+
"eval",
|
|
41
|
+
"export",
|
|
42
|
+
"extends",
|
|
43
|
+
"false",
|
|
44
|
+
"finally",
|
|
45
|
+
"for",
|
|
46
|
+
"function",
|
|
47
|
+
"if",
|
|
48
|
+
"implements",
|
|
49
|
+
"import",
|
|
50
|
+
"in",
|
|
51
|
+
"instanceof",
|
|
52
|
+
"interface",
|
|
53
|
+
"let",
|
|
54
|
+
"new",
|
|
55
|
+
"null",
|
|
56
|
+
"package",
|
|
57
|
+
"private",
|
|
58
|
+
"protected",
|
|
59
|
+
"public",
|
|
60
|
+
"return",
|
|
61
|
+
"static",
|
|
62
|
+
"super",
|
|
63
|
+
"switch",
|
|
64
|
+
"this",
|
|
65
|
+
"throw",
|
|
66
|
+
"true",
|
|
67
|
+
"try",
|
|
68
|
+
"typeof",
|
|
69
|
+
"undefined",
|
|
70
|
+
"var",
|
|
71
|
+
"void",
|
|
72
|
+
"while",
|
|
73
|
+
"with",
|
|
74
|
+
"yield"
|
|
75
|
+
]);
|
|
76
|
+
|
|
77
|
+
function _genStatement(type, specifier, names, options = {}) {
|
|
78
|
+
const specifierString = genString(specifier, options);
|
|
79
|
+
if (!names) {
|
|
80
|
+
return `${type} ${specifierString};`;
|
|
81
|
+
}
|
|
82
|
+
const nameArray = Array.isArray(names);
|
|
83
|
+
const _names = (nameArray ? names : [names]).map((index) => {
|
|
84
|
+
if (typeof index === "string") {
|
|
85
|
+
return { name: index };
|
|
86
|
+
}
|
|
87
|
+
if (index.name === index.as) {
|
|
88
|
+
index = { name: index.name };
|
|
89
|
+
}
|
|
90
|
+
return index;
|
|
91
|
+
});
|
|
92
|
+
const namesString = _names.map((index) => index.as ? `${index.name} as ${index.as}` : index.name).join(", ");
|
|
93
|
+
if (nameArray) {
|
|
94
|
+
return `${type} { ${namesString} } from ${genString(
|
|
95
|
+
specifier,
|
|
96
|
+
options
|
|
97
|
+
)}${_genImportAttributes(type, options)};`;
|
|
98
|
+
}
|
|
99
|
+
return `${type} ${namesString} from ${genString(
|
|
100
|
+
specifier,
|
|
101
|
+
options
|
|
102
|
+
)}${_genImportAttributes(type, options)};`;
|
|
103
|
+
}
|
|
104
|
+
function _genImportAttributes(type, options) {
|
|
105
|
+
if (typeof options.attributes?.type === "string") {
|
|
106
|
+
return ` with { type: ${genString(options.attributes.type)} }`;
|
|
107
|
+
}
|
|
108
|
+
if (typeof options.assert?.type === "string") {
|
|
109
|
+
return ` assert { type: ${genString(options.assert.type)} }`;
|
|
110
|
+
}
|
|
111
|
+
return "";
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function genImport(specifier, imports, options = {}) {
|
|
115
|
+
return _genStatement("import", specifier, imports, options);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function wrapInDelimiters(lines, indent = "", delimiters = "{}", withComma = true) {
|
|
119
|
+
if (lines.length === 0) {
|
|
120
|
+
return delimiters;
|
|
121
|
+
}
|
|
122
|
+
const [start, end] = delimiters;
|
|
123
|
+
return `${start}
|
|
124
|
+
` + lines.join(withComma ? ",\n" : "\n") + `
|
|
125
|
+
${indent}${end}`;
|
|
126
|
+
}
|
|
127
|
+
const VALID_IDENTIFIER_RE = /^[$_]?([A-Z_a-z]\w*|\d)$/;
|
|
128
|
+
function genObjectKey(key) {
|
|
129
|
+
return VALID_IDENTIFIER_RE.test(key) ? key : genString(key);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function genObjectFromRaw(object, indent = "", options = {}) {
|
|
133
|
+
return genObjectFromRawEntries(Object.entries(object), indent, options);
|
|
134
|
+
}
|
|
135
|
+
function genArrayFromRaw(array, indent = "", options = {}) {
|
|
136
|
+
const newIdent = indent + " ";
|
|
137
|
+
return wrapInDelimiters(
|
|
138
|
+
array.map((index) => `${newIdent}${genRawValue(index, newIdent, options)}`),
|
|
139
|
+
indent,
|
|
140
|
+
"[]"
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
function genObjectFromRawEntries(array, indent = "", options = {}) {
|
|
144
|
+
const newIdent = indent + " ";
|
|
145
|
+
return wrapInDelimiters(
|
|
146
|
+
array.map(
|
|
147
|
+
([key, value]) => `${newIdent}${genObjectKey(key)}: ${genRawValue(value, newIdent, options)}`
|
|
148
|
+
),
|
|
149
|
+
indent,
|
|
150
|
+
"{}"
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
function genRawValue(value, indent = "", options = {}) {
|
|
154
|
+
if (value === void 0) {
|
|
155
|
+
return "undefined";
|
|
156
|
+
}
|
|
157
|
+
if (value === null) {
|
|
158
|
+
return "null";
|
|
159
|
+
}
|
|
160
|
+
if (Array.isArray(value)) {
|
|
161
|
+
return genArrayFromRaw(value, indent, options);
|
|
162
|
+
}
|
|
163
|
+
if (value && typeof value === "object") {
|
|
164
|
+
return genObjectFromRaw(value, indent, options);
|
|
165
|
+
}
|
|
166
|
+
if (options.preserveTypes && typeof value !== "function") {
|
|
167
|
+
return JSON.stringify(value);
|
|
168
|
+
}
|
|
169
|
+
return value.toString();
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export { genSafeVariableName as a, genObjectKey as b, genString as c, genObjectFromRaw as d, genImport as g };
|