nitro-nightly 4.0.0-20251010-091516-7cafddba → 4.0.0-20251030-091344-d4418b98
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/{_chunks/build2.mjs → _build/build.mjs} +108 -58
- package/dist/_build/build2.mjs +556 -0
- package/dist/_build/info.mjs +1002 -0
- package/dist/_build/prepare.mjs +1511 -0
- package/dist/_build/snapshot.mjs +185 -0
- package/dist/{_chunks/plugin.mjs → _build/vite.mjs} +295 -296
- package/dist/_build/vite2.mjs +149 -0
- package/dist/_chunks/_deps/@jridgewell/gen-mapping.mjs +189 -0
- package/dist/_chunks/_deps/@jridgewell/remapping.mjs +137 -0
- package/dist/_chunks/_deps/@jridgewell/resolve-uri.mjs +231 -0
- package/dist/_chunks/_deps/@jridgewell/sourcemap-codec.mjs +173 -0
- package/dist/_chunks/_deps/@jridgewell/trace-mapping.mjs +170 -0
- package/dist/_chunks/_deps/@pi0/vite-plugin-fullstack.mjs +575 -0
- package/dist/_chunks/_deps/@rollup/plugin-alias.mjs +89 -0
- package/dist/_chunks/_deps/@rollup/plugin-commonjs.mjs +2376 -0
- package/dist/_chunks/{index2.mjs → _deps/@rollup/plugin-inject.mjs} +5 -90
- package/dist/_chunks/_deps/@rollup/plugin-json.mjs +37 -0
- package/dist/_chunks/_deps/@rollup/plugin-node-resolve.mjs +1386 -0
- package/dist/_chunks/_deps/@rollup/plugin-replace.mjs +133 -0
- package/dist/_chunks/_deps/@rollup/pluginutils.mjs +346 -0
- package/dist/_chunks/_deps/acorn.mjs +6225 -0
- package/dist/_chunks/_deps/c12.mjs +510 -0
- package/dist/_chunks/_deps/chokidar.mjs +1428 -0
- package/dist/_chunks/_deps/citty.mjs +460 -0
- package/dist/_chunks/_deps/commondir.mjs +77 -0
- package/dist/_chunks/_deps/compatx.mjs +76 -0
- package/dist/_chunks/_deps/confbox.mjs +300 -0
- package/dist/_chunks/_deps/debug.mjs +885 -0
- package/dist/_chunks/_deps/deepmerge.mjs +147 -0
- package/dist/_chunks/_deps/depd.mjs +550 -0
- package/dist/_chunks/_deps/dot-prop.mjs +282 -0
- package/dist/_chunks/_deps/dotenv.mjs +555 -0
- package/dist/_chunks/_deps/duplexer.mjs +1 -0
- package/dist/_chunks/_deps/ee-first.mjs +104 -0
- package/dist/_chunks/_deps/encodeurl.mjs +69 -0
- package/dist/_chunks/_deps/escape-html.mjs +87 -0
- package/dist/_chunks/_deps/escape-string-regexp.mjs +13 -0
- package/dist/_chunks/_deps/estree-walker.mjs +433 -0
- package/dist/_chunks/_deps/etag.mjs +147 -0
- package/dist/_chunks/_deps/exsolve.mjs +1416 -0
- package/dist/_chunks/_deps/fdir.mjs +569 -0
- package/dist/_chunks/_deps/fresh.mjs +145 -0
- package/dist/_chunks/_deps/function-bind.mjs +106 -0
- package/dist/_chunks/{index4.mjs → _deps/giget.mjs} +21 -776
- package/dist/_chunks/_deps/gzip-size.mjs +19 -0
- package/dist/_chunks/_deps/hasown.mjs +19 -0
- package/dist/_chunks/_deps/http-errors.mjs +307 -0
- package/dist/_chunks/_deps/httpxy.mjs +580 -0
- package/dist/_chunks/_deps/inherits.mjs +57 -0
- package/dist/_chunks/_deps/is-core-module.mjs +596 -0
- package/dist/_chunks/_deps/is-module.mjs +25 -0
- package/dist/_chunks/_deps/is-reference.mjs +31 -0
- package/dist/_chunks/_deps/js-tokens.mjs +411 -0
- package/dist/_chunks/_deps/klona.mjs +137 -0
- package/dist/_chunks/_deps/knitwork.mjs +172 -0
- package/dist/_chunks/_deps/local-pkg.mjs +163 -0
- package/dist/_chunks/_deps/magic-string.mjs +1296 -0
- package/dist/_chunks/_deps/mime-db.mjs +11685 -0
- package/dist/_chunks/_deps/mime-types.mjs +287 -0
- package/dist/_chunks/_deps/mime.mjs +1172 -0
- package/dist/_chunks/_deps/mlly.mjs +2413 -0
- package/dist/_chunks/_deps/ms.mjs +172 -0
- package/dist/_chunks/_deps/node-fetch-native.mjs +3 -0
- package/dist/_chunks/_deps/nypm.mjs +219 -0
- package/dist/_chunks/_deps/on-finished.mjs +246 -0
- package/dist/_chunks/_deps/parseurl.mjs +168 -0
- package/dist/_chunks/_deps/path-parse.mjs +85 -0
- package/dist/_chunks/{pathe.M-eThtNZ.mjs → _deps/pathe.mjs} +48 -1
- package/dist/_chunks/_deps/perfect-debounce.mjs +88 -0
- package/dist/_chunks/_deps/picomatch.mjs +2144 -0
- package/dist/_chunks/_deps/pkg-types.mjs +247 -0
- package/dist/_chunks/{snapshot.mjs → _deps/pretty-bytes.mjs} +1 -105
- package/dist/_chunks/_deps/quansync.mjs +99 -0
- package/dist/_chunks/_deps/range-parser.mjs +171 -0
- package/dist/_chunks/_deps/rc9.mjs +219 -0
- package/dist/_chunks/_deps/readdirp.mjs +245 -0
- package/dist/_chunks/_deps/resolve.mjs +1260 -0
- package/dist/_chunks/_deps/rou3.mjs +326 -0
- package/dist/_chunks/_deps/send.mjs +1022 -0
- package/dist/_chunks/_deps/serve-static.mjs +228 -0
- package/dist/_chunks/_deps/setprototypeof.mjs +26 -0
- package/dist/_chunks/_deps/statuses.mjs +457 -0
- package/dist/_chunks/_deps/std-env.mjs +3 -0
- package/dist/_chunks/_deps/strip-literal.mjs +67 -0
- package/dist/_chunks/_deps/supports-color.mjs +44 -0
- package/dist/_chunks/_deps/tinyexec.mjs +552 -0
- package/dist/_chunks/_deps/tinyglobby.mjs +293 -0
- package/dist/_chunks/_deps/toidentifier.mjs +41 -0
- package/dist/_chunks/_deps/ultrahtml.mjs +3 -0
- package/dist/_chunks/_deps/unimport.mjs +2267 -0
- package/dist/_chunks/_deps/unplugin-utils.mjs +65 -0
- package/dist/_chunks/_deps/unplugin.mjs +1294 -0
- package/dist/_chunks/_deps/untyped.mjs +375 -0
- package/dist/_chunks/{info.mjs → _deps/unwasm.mjs} +8 -4206
- package/dist/_chunks/_deps/webpack-virtual-modules.mjs +360 -0
- package/dist/_chunks/_presets/_all.mjs +59 -0
- package/dist/_chunks/_presets/_nitro.mjs +74 -0
- package/dist/_chunks/_presets/_resolve.mjs +64 -0
- package/dist/_chunks/_presets/_static.mjs +69 -0
- package/dist/_chunks/_presets/_types.mjs +3 -0
- package/dist/_chunks/_presets/_utils.mjs +31 -0
- package/dist/_chunks/_presets/alwaysdata.mjs +17 -0
- package/dist/_chunks/_presets/aws-amplify.mjs +111 -0
- package/dist/_chunks/_presets/aws-lambda.mjs +23 -0
- package/dist/_chunks/_presets/azure.mjs +162 -0
- package/dist/_chunks/_presets/bun.mjs +19 -0
- package/dist/_chunks/_presets/cleavr.mjs +15 -0
- package/dist/_chunks/_presets/cloudflare.mjs +608 -0
- package/dist/_chunks/_presets/deno.mjs +196 -0
- package/dist/_chunks/_presets/digitalocean.mjs +14 -0
- package/dist/_chunks/_presets/firebase.mjs +47 -0
- package/dist/_chunks/_presets/flightcontrol.mjs +14 -0
- package/dist/_chunks/_presets/genezio.mjs +13 -0
- package/dist/_chunks/_presets/heroku.mjs +14 -0
- package/dist/_chunks/_presets/iis.mjs +194 -0
- package/dist/_chunks/_presets/index.mjs +62 -0
- package/dist/_chunks/_presets/koyeb.mjs +14 -0
- package/dist/_chunks/_presets/netlify.mjs +241 -0
- package/dist/_chunks/_presets/node.mjs +54 -0
- package/dist/_chunks/_presets/platform.mjs +14 -0
- package/dist/_chunks/_presets/render.mjs +14 -0
- package/dist/_chunks/_presets/standard.mjs +23 -0
- package/dist/_chunks/_presets/stormkit.mjs +18 -0
- package/dist/_chunks/_presets/vercel.mjs +375 -0
- package/dist/_chunks/_presets/winterjs.mjs +22 -0
- package/dist/_chunks/_presets/zeabur.mjs +69 -0
- package/dist/_chunks/_presets/zerops.mjs +27 -0
- package/dist/_chunks/app.mjs +9 -19206
- package/dist/_chunks/{index3.mjs → builder.mjs} +560 -970
- package/dist/_chunks/server.mjs +6 -4
- package/dist/{cli → _cli}/build.mjs +3 -8
- package/dist/{cli → _cli}/dev.mjs +38 -12
- package/dist/{cli/index2.mjs → _cli/index.mjs} +1 -2
- package/dist/{cli → _cli}/list.mjs +3 -4
- package/dist/{cli → _cli}/prepare.mjs +3 -4
- package/dist/{cli → _cli}/run.mjs +3 -4
- package/dist/{index.d.mts → builder.d.mts} +11 -11
- package/dist/builder.mjs +117 -0
- package/dist/cli/index.mjs +7 -464
- package/dist/node_modules/@speed-highlight/core/dist/index.js +1 -1
- package/dist/node_modules/@speed-highlight/core/dist/terminal.js +1 -1
- package/dist/node_modules/@speed-highlight/core/package.json +7 -3
- package/dist/node_modules/cookie-es/dist/index.mjs +262 -0
- package/dist/node_modules/cookie-es/package.json +37 -0
- package/dist/node_modules/hookable/dist/index.mjs +243 -266
- package/dist/node_modules/hookable/package.json +29 -26
- package/dist/node_modules/rendu/dist/index.mjs +380 -0
- package/dist/node_modules/rendu/package.json +47 -0
- package/dist/presets/_nitro/runtime/nitro-dev.mjs +4 -7
- package/dist/presets/_nitro/runtime/nitro-prerenderer.mjs +5 -4
- package/dist/presets/azure/runtime/azure-swa.mjs +1 -1
- package/dist/presets/cloudflare/runtime/_module-handler.mjs +7 -6
- package/dist/presets/cloudflare/runtime/cloudflare-durable.mjs +4 -5
- package/dist/presets/cloudflare/runtime/plugin.dev.mjs +7 -10
- package/dist/presets/cloudflare/runtime/shims/workers.dev.d.mts +21 -0
- package/dist/presets/cloudflare/runtime/shims/workers.dev.mjs +27 -0
- package/dist/presets/node/runtime/node-server.mjs +1 -1
- package/dist/runtime/index.d.mts +1 -1
- package/dist/runtime/index.mjs +1 -1
- package/dist/runtime/internal/app.d.mts +3 -1
- package/dist/runtime/internal/app.mjs +90 -64
- package/dist/runtime/internal/error/prod.d.mts +3 -2
- package/dist/runtime/internal/error/prod.mjs +9 -13
- package/dist/runtime/internal/renderer.mjs +4 -4
- package/dist/runtime/internal/routes/dev-tasks.d.mts +30 -2
- package/dist/runtime/internal/shutdown.d.mts +1 -2
- package/dist/runtime/internal/shutdown.mjs +3 -2
- package/dist/runtime/internal/task.mjs +1 -2
- package/dist/types/index.d.mts +1603 -10
- package/dist/vite.d.mts +5 -0
- package/dist/vite.mjs +94 -30
- package/lib/index.mjs +1 -0
- package/lib/indexd.mts +1 -0
- package/lib/runtime/meta.mjs +35 -0
- package/package.json +40 -41
- package/dist/_chunks/build.mjs +0 -84
- package/dist/_chunks/build3.mjs +0 -6452
- package/dist/_chunks/detect-acorn.mjs +0 -503
- package/dist/_chunks/index.mjs +0 -22242
- package/dist/_chunks/json5.mjs +0 -68
- package/dist/_chunks/jsonc.mjs +0 -51
- package/dist/_chunks/toml.mjs +0 -259
- package/dist/_chunks/yaml.mjs +0 -86
- package/dist/index.mjs +0 -55
- package/dist/node_modules/klona/dist/index.mjs +0 -81
- package/dist/node_modules/klona/full/index.mjs +0 -53
- package/dist/node_modules/klona/package.json +0 -74
- package/dist/node_modules/std-env/dist/index.mjs +0 -1
- package/dist/node_modules/std-env/package.json +0 -46
- package/dist/presets.mjs +0 -2460
- package/dist/runtime/internal/debug.d.mts +0 -2
- package/dist/runtime/internal/debug.mjs +0 -5
- package/lib/runtime-meta.mjs +0 -38
- /package/dist/{cli → _cli}/common.mjs +0 -0
- /package/lib/{runtime-meta.d.mts → runtime/meta.d.mts} +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,137 @@
|
|
|
1
|
+
function set(obj, key, val) {
|
|
2
|
+
if (typeof val.value === 'object') val.value = klona$1(val.value);
|
|
3
|
+
if (!val.enumerable || val.get || val.set || !val.configurable || !val.writable || key === '__proto__') {
|
|
4
|
+
Object.defineProperty(obj, key, val);
|
|
5
|
+
} else obj[key] = val.value;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function klona$1(x) {
|
|
9
|
+
if (typeof x !== 'object') return x;
|
|
10
|
+
|
|
11
|
+
var i=0, k, list, tmp, str=Object.prototype.toString.call(x);
|
|
12
|
+
|
|
13
|
+
if (str === '[object Object]') {
|
|
14
|
+
tmp = Object.create(x.__proto__ || null);
|
|
15
|
+
} else if (str === '[object Array]') {
|
|
16
|
+
tmp = Array(x.length);
|
|
17
|
+
} else if (str === '[object Set]') {
|
|
18
|
+
tmp = new Set;
|
|
19
|
+
x.forEach(function (val) {
|
|
20
|
+
tmp.add(klona$1(val));
|
|
21
|
+
});
|
|
22
|
+
} else if (str === '[object Map]') {
|
|
23
|
+
tmp = new Map;
|
|
24
|
+
x.forEach(function (val, key) {
|
|
25
|
+
tmp.set(klona$1(key), klona$1(val));
|
|
26
|
+
});
|
|
27
|
+
} else if (str === '[object Date]') {
|
|
28
|
+
tmp = new Date(+x);
|
|
29
|
+
} else if (str === '[object RegExp]') {
|
|
30
|
+
tmp = new RegExp(x.source, x.flags);
|
|
31
|
+
} else if (str === '[object DataView]') {
|
|
32
|
+
tmp = new x.constructor( klona$1(x.buffer) );
|
|
33
|
+
} else if (str === '[object ArrayBuffer]') {
|
|
34
|
+
tmp = x.slice(0);
|
|
35
|
+
} else if (str.slice(-6) === 'Array]') {
|
|
36
|
+
// ArrayBuffer.isView(x)
|
|
37
|
+
// ~> `new` bcuz `Buffer.slice` => ref
|
|
38
|
+
tmp = new x.constructor(x);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (tmp) {
|
|
42
|
+
for (list=Object.getOwnPropertySymbols(x); i < list.length; i++) {
|
|
43
|
+
set(tmp, list[i], Object.getOwnPropertyDescriptor(x, list[i]));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
for (i=0, list=Object.getOwnPropertyNames(x); i < list.length; i++) {
|
|
47
|
+
if (Object.hasOwnProperty.call(tmp, k=list[i]) && tmp[k] === x[k]) continue;
|
|
48
|
+
set(tmp, k, Object.getOwnPropertyDescriptor(x, k));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return tmp || x;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function klona(x) {
|
|
56
|
+
if (typeof x !== 'object') return x;
|
|
57
|
+
|
|
58
|
+
var k, tmp, str=Object.prototype.toString.call(x);
|
|
59
|
+
|
|
60
|
+
if (str === '[object Object]') {
|
|
61
|
+
if (x.constructor !== Object && typeof x.constructor === 'function') {
|
|
62
|
+
tmp = new x.constructor();
|
|
63
|
+
for (k in x) {
|
|
64
|
+
if (x.hasOwnProperty(k) && tmp[k] !== x[k]) {
|
|
65
|
+
tmp[k] = klona(x[k]);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
} else {
|
|
69
|
+
tmp = {}; // null
|
|
70
|
+
for (k in x) {
|
|
71
|
+
if (k === '__proto__') {
|
|
72
|
+
Object.defineProperty(tmp, k, {
|
|
73
|
+
value: klona(x[k]),
|
|
74
|
+
configurable: true,
|
|
75
|
+
enumerable: true,
|
|
76
|
+
writable: true,
|
|
77
|
+
});
|
|
78
|
+
} else {
|
|
79
|
+
tmp[k] = klona(x[k]);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return tmp;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (str === '[object Array]') {
|
|
87
|
+
k = x.length;
|
|
88
|
+
for (tmp=Array(k); k--;) {
|
|
89
|
+
tmp[k] = klona(x[k]);
|
|
90
|
+
}
|
|
91
|
+
return tmp;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (str === '[object Set]') {
|
|
95
|
+
tmp = new Set;
|
|
96
|
+
x.forEach(function (val) {
|
|
97
|
+
tmp.add(klona(val));
|
|
98
|
+
});
|
|
99
|
+
return tmp;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (str === '[object Map]') {
|
|
103
|
+
tmp = new Map;
|
|
104
|
+
x.forEach(function (val, key) {
|
|
105
|
+
tmp.set(klona(key), klona(val));
|
|
106
|
+
});
|
|
107
|
+
return tmp;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (str === '[object Date]') {
|
|
111
|
+
return new Date(+x);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (str === '[object RegExp]') {
|
|
115
|
+
tmp = new RegExp(x.source, x.flags);
|
|
116
|
+
tmp.lastIndex = x.lastIndex;
|
|
117
|
+
return tmp;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (str === '[object DataView]') {
|
|
121
|
+
return new x.constructor( klona(x.buffer) );
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (str === '[object ArrayBuffer]') {
|
|
125
|
+
return x.slice(0);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// ArrayBuffer.isView(x)
|
|
129
|
+
// ~> `new` bcuz `Buffer.slice` => ref
|
|
130
|
+
if (str.slice(-6) === 'Array]') {
|
|
131
|
+
return new x.constructor(x);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return x;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export { klona as a, klona$1 as k };
|