nitro-nightly 3.0.1-20260106-130706-e20c92d9 → 3.0.1-20260106-182834-5019d347

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.
Files changed (71) hide show
  1. package/dist/_build/rolldown.mjs +7 -5
  2. package/dist/_build/rollup.mjs +15 -5
  3. package/dist/_build/shared.mjs +2 -1
  4. package/dist/_build/shared2.mjs +1 -1
  5. package/dist/_build/shared3.mjs +1 -1
  6. package/dist/_build/vite.build.mjs +7 -6
  7. package/dist/_dev.mjs +2 -1
  8. package/dist/_libs/@hiogawa/vite-plugin-fullstack.mjs +5 -1560
  9. package/dist/_libs/@jridgewell/gen-mapping.mjs +2 -304
  10. package/dist/_libs/@jridgewell/remapping.mjs +2 -1
  11. package/dist/_libs/@jridgewell/resolve-uri.mjs +166 -0
  12. package/dist/_libs/@jridgewell/sourcemap-codec.mjs +167 -0
  13. package/dist/_libs/@jridgewell/trace-mapping.mjs +141 -0
  14. package/dist/_libs/@rolldown/pluginutils.mjs +31 -0
  15. package/dist/_libs/@rollup/plugin-commonjs.mjs +33 -2636
  16. package/dist/_libs/@rollup/plugin-inject.mjs +3 -2
  17. package/dist/_libs/@rollup/plugin-json.mjs +1 -1
  18. package/dist/_libs/@rollup/plugin-node-resolve.mjs +7 -1111
  19. package/dist/_libs/@rollup/plugin-replace.mjs +2 -2
  20. package/dist/_libs/@rollup/pluginutils.mjs +241 -0
  21. package/dist/_libs/c12.mjs +63 -2513
  22. package/dist/_libs/chokidar.mjs +1 -234
  23. package/dist/_libs/commondir.mjs +22 -0
  24. package/dist/_libs/confbox.mjs +1102 -502
  25. package/dist/_libs/deepmerge.mjs +86 -0
  26. package/dist/_libs/dotenv.mjs +345 -0
  27. package/dist/_libs/estree-walker.mjs +144 -1
  28. package/dist/_libs/exsolve.mjs +1007 -0
  29. package/dist/_libs/fdir.mjs +514 -0
  30. package/dist/_libs/function-bind.mjs +63 -0
  31. package/dist/_libs/giget.mjs +1376 -2234
  32. package/dist/_libs/hasown.mjs +14 -0
  33. package/dist/_libs/is-core-module.mjs +220 -0
  34. package/dist/_libs/is-module.mjs +13 -0
  35. package/dist/_libs/is-reference.mjs +33 -0
  36. package/dist/_libs/js-tokens.mjs +382 -0
  37. package/dist/_libs/local-pkg.mjs +6 -1560
  38. package/dist/_libs/magic-string.mjs +939 -0
  39. package/dist/_libs/mlly.mjs +1415 -0
  40. package/dist/_libs/node-fetch-native.mjs +7 -0
  41. package/dist/_libs/nypm.mjs +239 -0
  42. package/dist/_libs/path-parse.mjs +47 -0
  43. package/dist/_libs/pathe.mjs +163 -2
  44. package/dist/_libs/perfect-debounce.mjs +89 -0
  45. package/dist/_libs/picomatch.mjs +1673 -0
  46. package/dist/_libs/pkg-types.mjs +197 -0
  47. package/dist/_libs/quansync.mjs +90 -0
  48. package/dist/_libs/rc9.mjs +136 -0
  49. package/dist/_libs/readdirp.mjs +237 -0
  50. package/dist/_libs/resolve.mjs +689 -0
  51. package/dist/_libs/strip-literal.mjs +51 -0
  52. package/dist/_libs/tinyexec.mjs +627 -0
  53. package/dist/_libs/tinyglobby.mjs +2 -1
  54. package/dist/_libs/unimport.mjs +42 -1575
  55. package/dist/_libs/unplugin-utils.mjs +61 -0
  56. package/dist/_libs/unplugin.mjs +1225 -0
  57. package/dist/_libs/unwasm.mjs +3 -2
  58. package/dist/_libs/webpack-virtual-modules.mjs +272 -0
  59. package/dist/_nitro.mjs +5 -2
  60. package/dist/_nitro2.mjs +3 -3
  61. package/dist/_presets.mjs +5 -3
  62. package/dist/builder.mjs +4 -4
  63. package/dist/cli/_chunks/build.mjs +1 -1
  64. package/dist/cli/_chunks/dev.mjs +1 -1
  65. package/dist/cli/_chunks/list.mjs +1 -1
  66. package/dist/cli/_chunks/prepare.mjs +1 -1
  67. package/dist/cli/_chunks/run.mjs +1 -1
  68. package/dist/vite.mjs +1824 -19
  69. package/package.json +2 -2
  70. package/dist/_build/shared4.mjs +0 -1114
  71. package/dist/_build/vite.plugin.mjs +0 -712
@@ -0,0 +1,14 @@
1
+ import { t as __commonJSMin } from "../_rolldown.mjs";
2
+ import { t as require_function_bind } from "./function-bind.mjs";
3
+
4
+ //#region node_modules/.pnpm/hasown@2.0.2/node_modules/hasown/index.js
5
+ var require_hasown = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6
+ var call = Function.prototype.call;
7
+ var $hasOwn = Object.prototype.hasOwnProperty;
8
+ var bind = require_function_bind();
9
+ /** @type {import('.')} */
10
+ module.exports = bind.call(call, $hasOwn);
11
+ }));
12
+
13
+ //#endregion
14
+ export { require_hasown as t };
@@ -0,0 +1,220 @@
1
+ import { t as __commonJSMin } from "../_rolldown.mjs";
2
+ import { t as require_hasown } from "./hasown.mjs";
3
+
4
+ //#region node_modules/.pnpm/is-core-module@2.16.1/node_modules/is-core-module/core.json
5
+ var require_core = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6
+ module.exports = {
7
+ "assert": true,
8
+ "node:assert": [">= 14.18 && < 15", ">= 16"],
9
+ "assert/strict": ">= 15",
10
+ "node:assert/strict": ">= 16",
11
+ "async_hooks": ">= 8",
12
+ "node:async_hooks": [">= 14.18 && < 15", ">= 16"],
13
+ "buffer_ieee754": ">= 0.5 && < 0.9.7",
14
+ "buffer": true,
15
+ "node:buffer": [">= 14.18 && < 15", ">= 16"],
16
+ "child_process": true,
17
+ "node:child_process": [">= 14.18 && < 15", ">= 16"],
18
+ "cluster": ">= 0.5",
19
+ "node:cluster": [">= 14.18 && < 15", ">= 16"],
20
+ "console": true,
21
+ "node:console": [">= 14.18 && < 15", ">= 16"],
22
+ "constants": true,
23
+ "node:constants": [">= 14.18 && < 15", ">= 16"],
24
+ "crypto": true,
25
+ "node:crypto": [">= 14.18 && < 15", ">= 16"],
26
+ "_debug_agent": ">= 1 && < 8",
27
+ "_debugger": "< 8",
28
+ "dgram": true,
29
+ "node:dgram": [">= 14.18 && < 15", ">= 16"],
30
+ "diagnostics_channel": [">= 14.17 && < 15", ">= 15.1"],
31
+ "node:diagnostics_channel": [">= 14.18 && < 15", ">= 16"],
32
+ "dns": true,
33
+ "node:dns": [">= 14.18 && < 15", ">= 16"],
34
+ "dns/promises": ">= 15",
35
+ "node:dns/promises": ">= 16",
36
+ "domain": ">= 0.7.12",
37
+ "node:domain": [">= 14.18 && < 15", ">= 16"],
38
+ "events": true,
39
+ "node:events": [">= 14.18 && < 15", ">= 16"],
40
+ "freelist": "< 6",
41
+ "fs": true,
42
+ "node:fs": [">= 14.18 && < 15", ">= 16"],
43
+ "fs/promises": [">= 10 && < 10.1", ">= 14"],
44
+ "node:fs/promises": [">= 14.18 && < 15", ">= 16"],
45
+ "_http_agent": ">= 0.11.1",
46
+ "node:_http_agent": [">= 14.18 && < 15", ">= 16"],
47
+ "_http_client": ">= 0.11.1",
48
+ "node:_http_client": [">= 14.18 && < 15", ">= 16"],
49
+ "_http_common": ">= 0.11.1",
50
+ "node:_http_common": [">= 14.18 && < 15", ">= 16"],
51
+ "_http_incoming": ">= 0.11.1",
52
+ "node:_http_incoming": [">= 14.18 && < 15", ">= 16"],
53
+ "_http_outgoing": ">= 0.11.1",
54
+ "node:_http_outgoing": [">= 14.18 && < 15", ">= 16"],
55
+ "_http_server": ">= 0.11.1",
56
+ "node:_http_server": [">= 14.18 && < 15", ">= 16"],
57
+ "http": true,
58
+ "node:http": [">= 14.18 && < 15", ">= 16"],
59
+ "http2": ">= 8.8",
60
+ "node:http2": [">= 14.18 && < 15", ">= 16"],
61
+ "https": true,
62
+ "node:https": [">= 14.18 && < 15", ">= 16"],
63
+ "inspector": ">= 8",
64
+ "node:inspector": [">= 14.18 && < 15", ">= 16"],
65
+ "inspector/promises": [">= 19"],
66
+ "node:inspector/promises": [">= 19"],
67
+ "_linklist": "< 8",
68
+ "module": true,
69
+ "node:module": [">= 14.18 && < 15", ">= 16"],
70
+ "net": true,
71
+ "node:net": [">= 14.18 && < 15", ">= 16"],
72
+ "node-inspect/lib/_inspect": ">= 7.6 && < 12",
73
+ "node-inspect/lib/internal/inspect_client": ">= 7.6 && < 12",
74
+ "node-inspect/lib/internal/inspect_repl": ">= 7.6 && < 12",
75
+ "os": true,
76
+ "node:os": [">= 14.18 && < 15", ">= 16"],
77
+ "path": true,
78
+ "node:path": [">= 14.18 && < 15", ">= 16"],
79
+ "path/posix": ">= 15.3",
80
+ "node:path/posix": ">= 16",
81
+ "path/win32": ">= 15.3",
82
+ "node:path/win32": ">= 16",
83
+ "perf_hooks": ">= 8.5",
84
+ "node:perf_hooks": [">= 14.18 && < 15", ">= 16"],
85
+ "process": ">= 1",
86
+ "node:process": [">= 14.18 && < 15", ">= 16"],
87
+ "punycode": ">= 0.5",
88
+ "node:punycode": [">= 14.18 && < 15", ">= 16"],
89
+ "querystring": true,
90
+ "node:querystring": [">= 14.18 && < 15", ">= 16"],
91
+ "readline": true,
92
+ "node:readline": [">= 14.18 && < 15", ">= 16"],
93
+ "readline/promises": ">= 17",
94
+ "node:readline/promises": ">= 17",
95
+ "repl": true,
96
+ "node:repl": [">= 14.18 && < 15", ">= 16"],
97
+ "node:sea": [">= 20.12 && < 21", ">= 21.7"],
98
+ "smalloc": ">= 0.11.5 && < 3",
99
+ "node:sqlite": [">= 22.13 && < 23", ">= 23.4"],
100
+ "_stream_duplex": ">= 0.9.4",
101
+ "node:_stream_duplex": [">= 14.18 && < 15", ">= 16"],
102
+ "_stream_transform": ">= 0.9.4",
103
+ "node:_stream_transform": [">= 14.18 && < 15", ">= 16"],
104
+ "_stream_wrap": ">= 1.4.1",
105
+ "node:_stream_wrap": [">= 14.18 && < 15", ">= 16"],
106
+ "_stream_passthrough": ">= 0.9.4",
107
+ "node:_stream_passthrough": [">= 14.18 && < 15", ">= 16"],
108
+ "_stream_readable": ">= 0.9.4",
109
+ "node:_stream_readable": [">= 14.18 && < 15", ">= 16"],
110
+ "_stream_writable": ">= 0.9.4",
111
+ "node:_stream_writable": [">= 14.18 && < 15", ">= 16"],
112
+ "stream": true,
113
+ "node:stream": [">= 14.18 && < 15", ">= 16"],
114
+ "stream/consumers": ">= 16.7",
115
+ "node:stream/consumers": ">= 16.7",
116
+ "stream/promises": ">= 15",
117
+ "node:stream/promises": ">= 16",
118
+ "stream/web": ">= 16.5",
119
+ "node:stream/web": ">= 16.5",
120
+ "string_decoder": true,
121
+ "node:string_decoder": [">= 14.18 && < 15", ">= 16"],
122
+ "sys": [">= 0.4 && < 0.7", ">= 0.8"],
123
+ "node:sys": [">= 14.18 && < 15", ">= 16"],
124
+ "test/reporters": ">= 19.9 && < 20.2",
125
+ "node:test/reporters": [
126
+ ">= 18.17 && < 19",
127
+ ">= 19.9",
128
+ ">= 20"
129
+ ],
130
+ "test/mock_loader": ">= 22.3 && < 22.7",
131
+ "node:test/mock_loader": ">= 22.3 && < 22.7",
132
+ "node:test": [">= 16.17 && < 17", ">= 18"],
133
+ "timers": true,
134
+ "node:timers": [">= 14.18 && < 15", ">= 16"],
135
+ "timers/promises": ">= 15",
136
+ "node:timers/promises": ">= 16",
137
+ "_tls_common": ">= 0.11.13",
138
+ "node:_tls_common": [">= 14.18 && < 15", ">= 16"],
139
+ "_tls_legacy": ">= 0.11.3 && < 10",
140
+ "_tls_wrap": ">= 0.11.3",
141
+ "node:_tls_wrap": [">= 14.18 && < 15", ">= 16"],
142
+ "tls": true,
143
+ "node:tls": [">= 14.18 && < 15", ">= 16"],
144
+ "trace_events": ">= 10",
145
+ "node:trace_events": [">= 14.18 && < 15", ">= 16"],
146
+ "tty": true,
147
+ "node:tty": [">= 14.18 && < 15", ">= 16"],
148
+ "url": true,
149
+ "node:url": [">= 14.18 && < 15", ">= 16"],
150
+ "util": true,
151
+ "node:util": [">= 14.18 && < 15", ">= 16"],
152
+ "util/types": ">= 15.3",
153
+ "node:util/types": ">= 16",
154
+ "v8/tools/arguments": ">= 10 && < 12",
155
+ "v8/tools/codemap": [">= 4.4 && < 5", ">= 5.2 && < 12"],
156
+ "v8/tools/consarray": [">= 4.4 && < 5", ">= 5.2 && < 12"],
157
+ "v8/tools/csvparser": [">= 4.4 && < 5", ">= 5.2 && < 12"],
158
+ "v8/tools/logreader": [">= 4.4 && < 5", ">= 5.2 && < 12"],
159
+ "v8/tools/profile_view": [">= 4.4 && < 5", ">= 5.2 && < 12"],
160
+ "v8/tools/splaytree": [">= 4.4 && < 5", ">= 5.2 && < 12"],
161
+ "v8": ">= 1",
162
+ "node:v8": [">= 14.18 && < 15", ">= 16"],
163
+ "vm": true,
164
+ "node:vm": [">= 14.18 && < 15", ">= 16"],
165
+ "wasi": [
166
+ ">= 13.4 && < 13.5",
167
+ ">= 18.17 && < 19",
168
+ ">= 20"
169
+ ],
170
+ "node:wasi": [">= 18.17 && < 19", ">= 20"],
171
+ "worker_threads": ">= 11.7",
172
+ "node:worker_threads": [">= 14.18 && < 15", ">= 16"],
173
+ "zlib": ">= 0.5",
174
+ "node:zlib": [">= 14.18 && < 15", ">= 16"]
175
+ };
176
+ }));
177
+
178
+ //#endregion
179
+ //#region node_modules/.pnpm/is-core-module@2.16.1/node_modules/is-core-module/index.js
180
+ var require_is_core_module = /* @__PURE__ */ __commonJSMin(((exports, module) => {
181
+ var hasOwn = require_hasown();
182
+ function specifierIncluded(current, specifier) {
183
+ var nodeParts = current.split(".");
184
+ var parts = specifier.split(" ");
185
+ var op = parts.length > 1 ? parts[0] : "=";
186
+ var versionParts = (parts.length > 1 ? parts[1] : parts[0]).split(".");
187
+ for (var i = 0; i < 3; ++i) {
188
+ var cur = parseInt(nodeParts[i] || 0, 10);
189
+ var ver = parseInt(versionParts[i] || 0, 10);
190
+ if (cur === ver) continue;
191
+ if (op === "<") return cur < ver;
192
+ if (op === ">=") return cur >= ver;
193
+ return false;
194
+ }
195
+ return op === ">=";
196
+ }
197
+ function matchesRange(current, range) {
198
+ var specifiers = range.split(/ ?&& ?/);
199
+ if (specifiers.length === 0) return false;
200
+ for (var i = 0; i < specifiers.length; ++i) if (!specifierIncluded(current, specifiers[i])) return false;
201
+ return true;
202
+ }
203
+ function versionIncluded(nodeVersion, specifierValue) {
204
+ if (typeof specifierValue === "boolean") return specifierValue;
205
+ var current = typeof nodeVersion === "undefined" ? process.versions && process.versions.node : nodeVersion;
206
+ if (typeof current !== "string") throw new TypeError(typeof nodeVersion === "undefined" ? "Unable to determine current node version" : "If provided, a valid node version is required");
207
+ if (specifierValue && typeof specifierValue === "object") {
208
+ for (var i = 0; i < specifierValue.length; ++i) if (matchesRange(current, specifierValue[i])) return true;
209
+ return false;
210
+ }
211
+ return matchesRange(current, specifierValue);
212
+ }
213
+ var data = require_core();
214
+ module.exports = function isCore(x, nodeVersion) {
215
+ return hasOwn(data, x) && versionIncluded(nodeVersion, data[x]);
216
+ };
217
+ }));
218
+
219
+ //#endregion
220
+ export { require_is_core_module as t };
@@ -0,0 +1,13 @@
1
+ import { t as __commonJSMin } from "../_rolldown.mjs";
2
+
3
+ //#region node_modules/.pnpm/is-module@1.0.0/node_modules/is-module/index.js
4
+ var require_is_module = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5
+ var ES6ImportExportRegExp = /(?:^\s*|[}{\(\);,\n]\s*)(import\s+['"]|(import|module)\s+[^"'\(\)\n;]+\s+from\s+['"]|export\s+(\*|\{|default|function|var|const|let|[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*))/;
6
+ var ES6AliasRegExp = /(?:^\s*|[}{\(\);,\n]\s*)(export\s*\*\s*from\s*(?:'([^']+)'|"([^"]+)"))/;
7
+ module.exports = function(sauce) {
8
+ return ES6ImportExportRegExp.test(sauce) || ES6AliasRegExp.test(sauce);
9
+ };
10
+ }));
11
+
12
+ //#endregion
13
+ export { require_is_module as t };
@@ -0,0 +1,33 @@
1
+ import { t as __commonJSMin } from "../_rolldown.mjs";
2
+
3
+ //#region node_modules/.pnpm/is-reference@1.2.1/node_modules/is-reference/dist/is-reference.js
4
+ var require_is_reference = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5
+ (function(global, factory) {
6
+ typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global = global || self, global.isReference = factory());
7
+ })(exports, (function() {
8
+ "use strict";
9
+ function isReference(node, parent) {
10
+ if (node.type === "MemberExpression") return !node.computed && isReference(node.object, node);
11
+ if (node.type === "Identifier") {
12
+ if (!parent) return true;
13
+ switch (parent.type) {
14
+ case "MemberExpression": return parent.computed || node === parent.object;
15
+ case "MethodDefinition": return parent.computed;
16
+ case "FieldDefinition": return parent.computed || node === parent.value;
17
+ case "Property": return parent.computed || node === parent.value;
18
+ case "ExportSpecifier":
19
+ case "ImportSpecifier": return node === parent.local;
20
+ case "LabeledStatement":
21
+ case "BreakStatement":
22
+ case "ContinueStatement": return false;
23
+ default: return true;
24
+ }
25
+ }
26
+ return false;
27
+ }
28
+ return isReference;
29
+ }));
30
+ }));
31
+
32
+ //#endregion
33
+ export { require_is_reference as t };
@@ -0,0 +1,382 @@
1
+ import { t as __commonJSMin } from "../_rolldown.mjs";
2
+
3
+ //#region node_modules/.pnpm/js-tokens@9.0.1/node_modules/js-tokens/index.js
4
+ var require_js_tokens = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5
+ var HashbangComment, Identifier, JSXIdentifier, JSXPunctuator, JSXString, JSXText, KeywordsWithExpressionAfter, KeywordsWithNoLineTerminatorAfter, LineTerminatorSequence, MultiLineComment, Newline, NumericLiteral, Punctuator, RegularExpressionLiteral = /\/(?![*\/])(?:\[(?:[^\]\\\n\r\u2028\u2029]+|\\.)*\]?|[^\/[\\\n\r\u2028\u2029]+|\\.)*(\/[$_\u200C\u200D\p{ID_Continue}]*|\\)?/uy, SingleLineComment, StringLiteral, Template, TokensNotPrecedingObjectLiteral, TokensPrecedingExpression, WhiteSpace;
6
+ Punctuator = /--|\+\+|=>|\.{3}|\??\.(?!\d)|(?:&&|\|\||\?\?|[+\-%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2}|\/(?![\/*]))=?|[?~,:;[\](){}]/y;
7
+ Identifier = /(\x23?)(?=[$_\p{ID_Start}\\])(?:[$_\u200C\u200D\p{ID_Continue}]+|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+/uy;
8
+ StringLiteral = /(['"])(?:[^'"\\\n\r]+|(?!\1)['"]|\\(?:\r\n|[^]))*(\1)?/y;
9
+ 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;
10
+ Template = /[`}](?:[^`\\$]+|\\[^]|\$(?!\{))*(`|\$\{)?/y;
11
+ WhiteSpace = /[\t\v\f\ufeff\p{Zs}]+/uy;
12
+ LineTerminatorSequence = /\r?\n|[\r\u2028\u2029]/y;
13
+ MultiLineComment = /\/\*(?:[^*]+|\*(?!\/))*(\*\/)?/y;
14
+ SingleLineComment = /\/\/.*/y;
15
+ HashbangComment = /^#!.*/;
16
+ JSXPunctuator = /[<>.:={}]|\/(?![\/*])/y;
17
+ JSXIdentifier = /[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}-]*/uy;
18
+ JSXString = /(['"])(?:[^'"]+|(?!\1)['"])*(\1)?/y;
19
+ JSXText = /[^<>{}]+/y;
20
+ TokensPrecedingExpression = /^(?:[\/+-]|\.{3}|\?(?:InterpolationIn(?:JSX|Template)|NoLineTerminatorHere|NonExpressionParenEnd|UnaryIncDec))?$|[{}([,;<>=*%&|^!~?:]$/;
21
+ TokensNotPrecedingObjectLiteral = /^(?:=>|[;\]){}]|else|\?(?:NoLineTerminatorHere|NonExpressionParenEnd))?$/;
22
+ KeywordsWithExpressionAfter = /^(?:await|case|default|delete|do|else|instanceof|new|return|throw|typeof|void|yield)$/;
23
+ KeywordsWithNoLineTerminatorAfter = /^(?:return|throw|yield)$/;
24
+ Newline = RegExp(LineTerminatorSequence.source);
25
+ module.exports = function* (input, { jsx = false } = {}) {
26
+ var braces, firstCodePoint, isExpression, lastIndex, lastSignificantToken, length, match, mode, nextLastIndex, nextLastSignificantToken, parenNesting, postfixIncDec, punctuator, stack;
27
+ ({length} = input);
28
+ lastIndex = 0;
29
+ lastSignificantToken = "";
30
+ stack = [{ tag: "JS" }];
31
+ braces = [];
32
+ parenNesting = 0;
33
+ postfixIncDec = false;
34
+ if (match = HashbangComment.exec(input)) {
35
+ yield {
36
+ type: "HashbangComment",
37
+ value: match[0]
38
+ };
39
+ lastIndex = match[0].length;
40
+ }
41
+ while (lastIndex < length) {
42
+ mode = stack[stack.length - 1];
43
+ switch (mode.tag) {
44
+ case "JS":
45
+ case "JSNonExpressionParen":
46
+ case "InterpolationInTemplate":
47
+ case "InterpolationInJSX":
48
+ if (input[lastIndex] === "/" && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken))) {
49
+ RegularExpressionLiteral.lastIndex = lastIndex;
50
+ if (match = RegularExpressionLiteral.exec(input)) {
51
+ lastIndex = RegularExpressionLiteral.lastIndex;
52
+ lastSignificantToken = match[0];
53
+ postfixIncDec = true;
54
+ yield {
55
+ type: "RegularExpressionLiteral",
56
+ value: match[0],
57
+ closed: match[1] !== void 0 && match[1] !== "\\"
58
+ };
59
+ continue;
60
+ }
61
+ }
62
+ Punctuator.lastIndex = lastIndex;
63
+ if (match = Punctuator.exec(input)) {
64
+ punctuator = match[0];
65
+ nextLastIndex = Punctuator.lastIndex;
66
+ nextLastSignificantToken = punctuator;
67
+ switch (punctuator) {
68
+ case "(":
69
+ if (lastSignificantToken === "?NonExpressionParenKeyword") stack.push({
70
+ tag: "JSNonExpressionParen",
71
+ nesting: parenNesting
72
+ });
73
+ parenNesting++;
74
+ postfixIncDec = false;
75
+ break;
76
+ case ")":
77
+ parenNesting--;
78
+ postfixIncDec = true;
79
+ if (mode.tag === "JSNonExpressionParen" && parenNesting === mode.nesting) {
80
+ stack.pop();
81
+ nextLastSignificantToken = "?NonExpressionParenEnd";
82
+ postfixIncDec = false;
83
+ }
84
+ break;
85
+ case "{":
86
+ Punctuator.lastIndex = 0;
87
+ isExpression = !TokensNotPrecedingObjectLiteral.test(lastSignificantToken) && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken));
88
+ braces.push(isExpression);
89
+ postfixIncDec = false;
90
+ break;
91
+ case "}":
92
+ switch (mode.tag) {
93
+ case "InterpolationInTemplate":
94
+ if (braces.length === mode.nesting) {
95
+ Template.lastIndex = lastIndex;
96
+ match = Template.exec(input);
97
+ lastIndex = Template.lastIndex;
98
+ lastSignificantToken = match[0];
99
+ if (match[1] === "${") {
100
+ lastSignificantToken = "?InterpolationInTemplate";
101
+ postfixIncDec = false;
102
+ yield {
103
+ type: "TemplateMiddle",
104
+ value: match[0]
105
+ };
106
+ } else {
107
+ stack.pop();
108
+ postfixIncDec = true;
109
+ yield {
110
+ type: "TemplateTail",
111
+ value: match[0],
112
+ closed: match[1] === "`"
113
+ };
114
+ }
115
+ continue;
116
+ }
117
+ break;
118
+ case "InterpolationInJSX": if (braces.length === mode.nesting) {
119
+ stack.pop();
120
+ lastIndex += 1;
121
+ lastSignificantToken = "}";
122
+ yield {
123
+ type: "JSXPunctuator",
124
+ value: "}"
125
+ };
126
+ continue;
127
+ }
128
+ }
129
+ postfixIncDec = braces.pop();
130
+ nextLastSignificantToken = postfixIncDec ? "?ExpressionBraceEnd" : "}";
131
+ break;
132
+ case "]":
133
+ postfixIncDec = true;
134
+ break;
135
+ case "++":
136
+ case "--":
137
+ nextLastSignificantToken = postfixIncDec ? "?PostfixIncDec" : "?UnaryIncDec";
138
+ break;
139
+ case "<":
140
+ if (jsx && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken))) {
141
+ stack.push({ tag: "JSXTag" });
142
+ lastIndex += 1;
143
+ lastSignificantToken = "<";
144
+ yield {
145
+ type: "JSXPunctuator",
146
+ value: punctuator
147
+ };
148
+ continue;
149
+ }
150
+ postfixIncDec = false;
151
+ break;
152
+ default: postfixIncDec = false;
153
+ }
154
+ lastIndex = nextLastIndex;
155
+ lastSignificantToken = nextLastSignificantToken;
156
+ yield {
157
+ type: "Punctuator",
158
+ value: punctuator
159
+ };
160
+ continue;
161
+ }
162
+ Identifier.lastIndex = lastIndex;
163
+ if (match = Identifier.exec(input)) {
164
+ lastIndex = Identifier.lastIndex;
165
+ nextLastSignificantToken = match[0];
166
+ switch (match[0]) {
167
+ case "for":
168
+ case "if":
169
+ case "while":
170
+ case "with": if (lastSignificantToken !== "." && lastSignificantToken !== "?.") nextLastSignificantToken = "?NonExpressionParenKeyword";
171
+ }
172
+ lastSignificantToken = nextLastSignificantToken;
173
+ postfixIncDec = !KeywordsWithExpressionAfter.test(match[0]);
174
+ yield {
175
+ type: match[1] === "#" ? "PrivateIdentifier" : "IdentifierName",
176
+ value: match[0]
177
+ };
178
+ continue;
179
+ }
180
+ StringLiteral.lastIndex = lastIndex;
181
+ if (match = StringLiteral.exec(input)) {
182
+ lastIndex = StringLiteral.lastIndex;
183
+ lastSignificantToken = match[0];
184
+ postfixIncDec = true;
185
+ yield {
186
+ type: "StringLiteral",
187
+ value: match[0],
188
+ closed: match[2] !== void 0
189
+ };
190
+ continue;
191
+ }
192
+ NumericLiteral.lastIndex = lastIndex;
193
+ if (match = NumericLiteral.exec(input)) {
194
+ lastIndex = NumericLiteral.lastIndex;
195
+ lastSignificantToken = match[0];
196
+ postfixIncDec = true;
197
+ yield {
198
+ type: "NumericLiteral",
199
+ value: match[0]
200
+ };
201
+ continue;
202
+ }
203
+ Template.lastIndex = lastIndex;
204
+ if (match = Template.exec(input)) {
205
+ lastIndex = Template.lastIndex;
206
+ lastSignificantToken = match[0];
207
+ if (match[1] === "${") {
208
+ lastSignificantToken = "?InterpolationInTemplate";
209
+ stack.push({
210
+ tag: "InterpolationInTemplate",
211
+ nesting: braces.length
212
+ });
213
+ postfixIncDec = false;
214
+ yield {
215
+ type: "TemplateHead",
216
+ value: match[0]
217
+ };
218
+ } else {
219
+ postfixIncDec = true;
220
+ yield {
221
+ type: "NoSubstitutionTemplate",
222
+ value: match[0],
223
+ closed: match[1] === "`"
224
+ };
225
+ }
226
+ continue;
227
+ }
228
+ break;
229
+ case "JSXTag":
230
+ case "JSXTagEnd":
231
+ JSXPunctuator.lastIndex = lastIndex;
232
+ if (match = JSXPunctuator.exec(input)) {
233
+ lastIndex = JSXPunctuator.lastIndex;
234
+ nextLastSignificantToken = match[0];
235
+ switch (match[0]) {
236
+ case "<":
237
+ stack.push({ tag: "JSXTag" });
238
+ break;
239
+ case ">":
240
+ stack.pop();
241
+ if (lastSignificantToken === "/" || mode.tag === "JSXTagEnd") {
242
+ nextLastSignificantToken = "?JSX";
243
+ postfixIncDec = true;
244
+ } else stack.push({ tag: "JSXChildren" });
245
+ break;
246
+ case "{":
247
+ stack.push({
248
+ tag: "InterpolationInJSX",
249
+ nesting: braces.length
250
+ });
251
+ nextLastSignificantToken = "?InterpolationInJSX";
252
+ postfixIncDec = false;
253
+ break;
254
+ case "/": if (lastSignificantToken === "<") {
255
+ stack.pop();
256
+ if (stack[stack.length - 1].tag === "JSXChildren") stack.pop();
257
+ stack.push({ tag: "JSXTagEnd" });
258
+ }
259
+ }
260
+ lastSignificantToken = nextLastSignificantToken;
261
+ yield {
262
+ type: "JSXPunctuator",
263
+ value: match[0]
264
+ };
265
+ continue;
266
+ }
267
+ JSXIdentifier.lastIndex = lastIndex;
268
+ if (match = JSXIdentifier.exec(input)) {
269
+ lastIndex = JSXIdentifier.lastIndex;
270
+ lastSignificantToken = match[0];
271
+ yield {
272
+ type: "JSXIdentifier",
273
+ value: match[0]
274
+ };
275
+ continue;
276
+ }
277
+ JSXString.lastIndex = lastIndex;
278
+ if (match = JSXString.exec(input)) {
279
+ lastIndex = JSXString.lastIndex;
280
+ lastSignificantToken = match[0];
281
+ yield {
282
+ type: "JSXString",
283
+ value: match[0],
284
+ closed: match[2] !== void 0
285
+ };
286
+ continue;
287
+ }
288
+ break;
289
+ case "JSXChildren":
290
+ JSXText.lastIndex = lastIndex;
291
+ if (match = JSXText.exec(input)) {
292
+ lastIndex = JSXText.lastIndex;
293
+ lastSignificantToken = match[0];
294
+ yield {
295
+ type: "JSXText",
296
+ value: match[0]
297
+ };
298
+ continue;
299
+ }
300
+ switch (input[lastIndex]) {
301
+ case "<":
302
+ stack.push({ tag: "JSXTag" });
303
+ lastIndex++;
304
+ lastSignificantToken = "<";
305
+ yield {
306
+ type: "JSXPunctuator",
307
+ value: "<"
308
+ };
309
+ continue;
310
+ case "{":
311
+ stack.push({
312
+ tag: "InterpolationInJSX",
313
+ nesting: braces.length
314
+ });
315
+ lastIndex++;
316
+ lastSignificantToken = "?InterpolationInJSX";
317
+ postfixIncDec = false;
318
+ yield {
319
+ type: "JSXPunctuator",
320
+ value: "{"
321
+ };
322
+ continue;
323
+ }
324
+ }
325
+ WhiteSpace.lastIndex = lastIndex;
326
+ if (match = WhiteSpace.exec(input)) {
327
+ lastIndex = WhiteSpace.lastIndex;
328
+ yield {
329
+ type: "WhiteSpace",
330
+ value: match[0]
331
+ };
332
+ continue;
333
+ }
334
+ LineTerminatorSequence.lastIndex = lastIndex;
335
+ if (match = LineTerminatorSequence.exec(input)) {
336
+ lastIndex = LineTerminatorSequence.lastIndex;
337
+ postfixIncDec = false;
338
+ if (KeywordsWithNoLineTerminatorAfter.test(lastSignificantToken)) lastSignificantToken = "?NoLineTerminatorHere";
339
+ yield {
340
+ type: "LineTerminatorSequence",
341
+ value: match[0]
342
+ };
343
+ continue;
344
+ }
345
+ MultiLineComment.lastIndex = lastIndex;
346
+ if (match = MultiLineComment.exec(input)) {
347
+ lastIndex = MultiLineComment.lastIndex;
348
+ if (Newline.test(match[0])) {
349
+ postfixIncDec = false;
350
+ if (KeywordsWithNoLineTerminatorAfter.test(lastSignificantToken)) lastSignificantToken = "?NoLineTerminatorHere";
351
+ }
352
+ yield {
353
+ type: "MultiLineComment",
354
+ value: match[0],
355
+ closed: match[1] !== void 0
356
+ };
357
+ continue;
358
+ }
359
+ SingleLineComment.lastIndex = lastIndex;
360
+ if (match = SingleLineComment.exec(input)) {
361
+ lastIndex = SingleLineComment.lastIndex;
362
+ postfixIncDec = false;
363
+ yield {
364
+ type: "SingleLineComment",
365
+ value: match[0]
366
+ };
367
+ continue;
368
+ }
369
+ firstCodePoint = String.fromCodePoint(input.codePointAt(lastIndex));
370
+ lastIndex += firstCodePoint.length;
371
+ lastSignificantToken = firstCodePoint;
372
+ postfixIncDec = false;
373
+ yield {
374
+ type: mode.tag.startsWith("JSX") ? "JSXInvalid" : "Invalid",
375
+ value: firstCodePoint
376
+ };
377
+ }
378
+ };
379
+ }));
380
+
381
+ //#endregion
382
+ export { require_js_tokens as t };