rollipop 0.1.0-alpha.12 → 0.1.0-alpha.13
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/CHANGELOG.md +7 -0
- package/dist/{chunk-Dj-qOoLf.js → chunk-D0rfrjR5.js} +4 -5
- package/dist/commands.cjs +261 -1649
- package/dist/commands.js +253 -1642
- package/dist/hmr-client.js +137 -133
- package/dist/hmr-runtime.d.ts +1 -1
- package/dist/hmr-runtime.js +195 -187
- package/dist/index.d.ts +8 -27
- package/dist/index.js +341 -1740
- package/dist/pluginutils.d.ts +4 -21
- package/dist/pluginutils.js +7 -7
- package/dist/runtime.cjs +1 -0
- package/package.json +27 -33
- package/dist/pluginutils.cjs +0 -210
- package/dist/pluginutils.d.cts +0 -660
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { n as
|
|
1
|
+
import { n as __require, t as __exportAll } from "./chunk-D0rfrjR5.js";
|
|
2
2
|
import fs from "node:fs";
|
|
3
|
-
import chalk from "chalk";
|
|
4
|
-
import dayjs from "dayjs";
|
|
5
|
-
import { invariant, isNotNil, merge, mergeWith, noop, omit, pick, range, throttle } from "es-toolkit";
|
|
6
3
|
import path from "node:path";
|
|
7
4
|
import { generate } from "@babel/generator";
|
|
8
5
|
import flowRemoveTypes from "flow-remove-types";
|
|
9
6
|
import * as hermesParser from "hermes-parser";
|
|
7
|
+
import { invariant, isNotNil, merge, mergeWith, noop, omit, pick, range, throttle } from "es-toolkit";
|
|
8
|
+
import chalk from "chalk";
|
|
9
|
+
import dayjs from "dayjs";
|
|
10
10
|
import wrapAnsi from "wrap-ansi";
|
|
11
11
|
import * as c12 from "c12";
|
|
12
12
|
import pLimit from "p-limit";
|
|
@@ -19,12 +19,13 @@ import { xxh32 } from "@node-rs/xxhash";
|
|
|
19
19
|
import dedent from "dedent";
|
|
20
20
|
import dotenv from "dotenv";
|
|
21
21
|
import dotenvExpand from "dotenv-expand";
|
|
22
|
-
import { exactRegex, exclude, id, include } from "@rollipop/rolldown-pluginutils";
|
|
22
|
+
import { exactRegex, exclude, id, include, or } from "@rollipop/rolldown-pluginutils";
|
|
23
23
|
import { imageSize } from "image-size";
|
|
24
24
|
import url from "url";
|
|
25
25
|
import { createDevServerMiddleware } from "@react-native-community/cli-server-api";
|
|
26
26
|
import { createDevMiddleware } from "@react-native/dev-middleware";
|
|
27
27
|
import Fastify from "fastify";
|
|
28
|
+
import mitt from "mitt";
|
|
28
29
|
import http from "node:http";
|
|
29
30
|
import EventEmitter from "node:events";
|
|
30
31
|
import stripAnsi from "strip-ansi";
|
|
@@ -33,6 +34,7 @@ import fp from "fastify-plugin";
|
|
|
33
34
|
import { asConst } from "json-schema-to-ts";
|
|
34
35
|
import mime from "mime";
|
|
35
36
|
import Ajv from "ajv";
|
|
37
|
+
import { codeFrameColumns } from "@babel/code-frame";
|
|
36
38
|
import * as ws from "ws";
|
|
37
39
|
import { transform } from "@svgr/core";
|
|
38
40
|
import * as babel from "@babel/core";
|
|
@@ -62,7 +64,7 @@ const FALSY_VALUES = [
|
|
|
62
64
|
];
|
|
63
65
|
function parseDebugKeys() {
|
|
64
66
|
return Object.keys(process.env).filter((key) => /^debug_/i.test(key)).reduce((acc, key) => {
|
|
65
|
-
const prop = key.slice(6).toLowerCase().replace(/_([a-z])/g, (_, key
|
|
67
|
+
const prop = key.slice(6).toLowerCase().replace(/_([a-z])/g, (_, key) => key.toUpperCase());
|
|
66
68
|
let value = process.env[key];
|
|
67
69
|
const lowerCase = typeof value === "string" ? value.toLowerCase() : value.toString();
|
|
68
70
|
if (TRUTHY_VALUES.includes(lowerCase)) value = true;
|
|
@@ -78,83 +80,6 @@ function isDebugEnabled() {
|
|
|
78
80
|
return debugKeys[DEBUG_KEY] ?? false;
|
|
79
81
|
}
|
|
80
82
|
|
|
81
|
-
//#endregion
|
|
82
|
-
//#region src/common/logger.ts
|
|
83
|
-
var Logger = class Logger {
|
|
84
|
-
static blocked = false;
|
|
85
|
-
static queuedMessages = [];
|
|
86
|
-
static Colors = {
|
|
87
|
-
trace: chalk.gray,
|
|
88
|
-
debug: chalk.blue,
|
|
89
|
-
log: chalk.green,
|
|
90
|
-
info: chalk.cyan,
|
|
91
|
-
warn: chalk.yellow,
|
|
92
|
-
error: chalk.red
|
|
93
|
-
};
|
|
94
|
-
format = "HH:mm:ss.SSS";
|
|
95
|
-
debugEnabled;
|
|
96
|
-
static block() {
|
|
97
|
-
this.blocked = true;
|
|
98
|
-
}
|
|
99
|
-
static unblock(flush = true) {
|
|
100
|
-
this.blocked = false;
|
|
101
|
-
if (flush) for (const args of Logger.queuedMessages) console.log(...args);
|
|
102
|
-
Logger.queuedMessages.length = 0;
|
|
103
|
-
}
|
|
104
|
-
constructor(scope) {
|
|
105
|
-
this.scope = scope;
|
|
106
|
-
this.debugEnabled = isDebugEnabled();
|
|
107
|
-
}
|
|
108
|
-
getFormat() {
|
|
109
|
-
return this.format;
|
|
110
|
-
}
|
|
111
|
-
setFormat(format) {
|
|
112
|
-
this.format = format;
|
|
113
|
-
}
|
|
114
|
-
getTimestamp() {
|
|
115
|
-
return dayjs().format(this.getFormat());
|
|
116
|
-
}
|
|
117
|
-
print(logLevel, ...args) {
|
|
118
|
-
const timestamp = chalk.gray(this.getTimestamp());
|
|
119
|
-
const level = Logger.Colors[logLevel](logLevel);
|
|
120
|
-
if (this.scope) args = [
|
|
121
|
-
timestamp,
|
|
122
|
-
level,
|
|
123
|
-
chalk.magenta(this.scope),
|
|
124
|
-
...args
|
|
125
|
-
];
|
|
126
|
-
else args = [
|
|
127
|
-
timestamp,
|
|
128
|
-
level,
|
|
129
|
-
...args
|
|
130
|
-
];
|
|
131
|
-
if (Logger.blocked) Logger.queuedMessages.push(args);
|
|
132
|
-
else console.log(...args);
|
|
133
|
-
}
|
|
134
|
-
trace(...args) {
|
|
135
|
-
this.debugEnabled && this.print("trace", ...args);
|
|
136
|
-
}
|
|
137
|
-
debug(...args) {
|
|
138
|
-
this.debugEnabled && this.print("debug", ...args);
|
|
139
|
-
}
|
|
140
|
-
log(...args) {
|
|
141
|
-
this.print("log", ...args);
|
|
142
|
-
}
|
|
143
|
-
info(...args) {
|
|
144
|
-
this.print("info", ...args);
|
|
145
|
-
}
|
|
146
|
-
warn(...args) {
|
|
147
|
-
this.print("warn", ...args);
|
|
148
|
-
}
|
|
149
|
-
error(...args) {
|
|
150
|
-
this.print("error", ...args);
|
|
151
|
-
}
|
|
152
|
-
child(scope) {
|
|
153
|
-
invariant(this.scope, "Logger must have a scope to create a child logger");
|
|
154
|
-
return new Logger(`${this.scope}:${scope}`);
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
|
|
158
83
|
//#endregion
|
|
159
84
|
//#region src/common/transformer.ts
|
|
160
85
|
function stripFlowTypes(code) {
|
|
@@ -177,10 +102,10 @@ function parseFlowSyntax(code) {
|
|
|
177
102
|
babel: true
|
|
178
103
|
});
|
|
179
104
|
}
|
|
180
|
-
function generateSourceFromAst(ast, id
|
|
105
|
+
function generateSourceFromAst(ast, id) {
|
|
181
106
|
const generated = generate(ast, {
|
|
182
107
|
sourceMaps: true,
|
|
183
|
-
sourceFileName: path.basename(id
|
|
108
|
+
sourceFileName: path.basename(id)
|
|
184
109
|
});
|
|
185
110
|
return {
|
|
186
111
|
code: generated.code,
|
|
@@ -190,7 +115,7 @@ function generateSourceFromAst(ast, id$1) {
|
|
|
190
115
|
|
|
191
116
|
//#endregion
|
|
192
117
|
//#region src/constants.ts
|
|
193
|
-
const ROLLIPOP_VERSION = "0.1.0-alpha.
|
|
118
|
+
const ROLLIPOP_VERSION = "0.1.0-alpha.13";
|
|
194
119
|
const GLOBAL_IDENTIFIER = "__ROLLIPOP_GLOBAL__";
|
|
195
120
|
/**
|
|
196
121
|
* @see {@link https://github.com/facebook/metro/blob/0.81.x/docs/Configuration.md#resolvermainfields}
|
|
@@ -317,13 +242,13 @@ function getPolyfillScriptPaths(reactNativePath) {
|
|
|
317
242
|
const scriptPath = path.join(reactNativePath, "rn-get-polyfills");
|
|
318
243
|
return __require(scriptPath)();
|
|
319
244
|
}
|
|
320
|
-
function getGlobalVariables(dev
|
|
321
|
-
const isDevServerMode = dev
|
|
245
|
+
function getGlobalVariables(dev, buildType) {
|
|
246
|
+
const isDevServerMode = dev && buildType === "serve";
|
|
322
247
|
return [
|
|
323
248
|
`var __BUNDLE_START_TIME__=globalThis.nativePerformanceNow?nativePerformanceNow():Date.now();`,
|
|
324
|
-
`var __DEV__=${dev
|
|
249
|
+
`var __DEV__=${dev};`,
|
|
325
250
|
`var ${GLOBAL_IDENTIFIER}=typeof globalThis!=='undefined'?globalThis:typeof global !== 'undefined'?global:typeof window!=='undefined'?window:this;`,
|
|
326
|
-
`var process=globalThis.process||{};process.env=process.env||{};process.env.NODE_ENV=process.env.NODE_ENV||"${dev
|
|
251
|
+
`var process=globalThis.process||{};process.env=process.env||{};process.env.NODE_ENV=process.env.NODE_ENV||"${dev ? "development" : "production"}";`,
|
|
327
252
|
isDevServerMode ? `var $RefreshReg$ = () => {};` : null,
|
|
328
253
|
isDevServerMode ? `var $RefreshSig$ = () => (v) => v;` : null
|
|
329
254
|
].filter(isNotNil);
|
|
@@ -354,6 +279,83 @@ function resolvePackagePathWithNodeRequire(basePath, packageName, subpath) {
|
|
|
354
279
|
return null;
|
|
355
280
|
}
|
|
356
281
|
|
|
282
|
+
//#endregion
|
|
283
|
+
//#region src/common/logger.ts
|
|
284
|
+
var Logger = class Logger {
|
|
285
|
+
static blocked = false;
|
|
286
|
+
static queuedMessages = [];
|
|
287
|
+
static Colors = {
|
|
288
|
+
trace: chalk.gray,
|
|
289
|
+
debug: chalk.blue,
|
|
290
|
+
log: chalk.green,
|
|
291
|
+
info: chalk.cyan,
|
|
292
|
+
warn: chalk.yellow,
|
|
293
|
+
error: chalk.red
|
|
294
|
+
};
|
|
295
|
+
format = "HH:mm:ss.SSS";
|
|
296
|
+
debugEnabled;
|
|
297
|
+
static block() {
|
|
298
|
+
this.blocked = true;
|
|
299
|
+
}
|
|
300
|
+
static unblock(flush = true) {
|
|
301
|
+
this.blocked = false;
|
|
302
|
+
if (flush) for (const args of Logger.queuedMessages) console.log(...args);
|
|
303
|
+
Logger.queuedMessages.length = 0;
|
|
304
|
+
}
|
|
305
|
+
constructor(scope) {
|
|
306
|
+
this.scope = scope;
|
|
307
|
+
this.debugEnabled = isDebugEnabled();
|
|
308
|
+
}
|
|
309
|
+
getFormat() {
|
|
310
|
+
return this.format;
|
|
311
|
+
}
|
|
312
|
+
setFormat(format) {
|
|
313
|
+
this.format = format;
|
|
314
|
+
}
|
|
315
|
+
getTimestamp() {
|
|
316
|
+
return dayjs().format(this.getFormat());
|
|
317
|
+
}
|
|
318
|
+
print(logLevel, ...args) {
|
|
319
|
+
const timestamp = chalk.gray(this.getTimestamp());
|
|
320
|
+
const level = Logger.Colors[logLevel](logLevel);
|
|
321
|
+
if (this.scope) args = [
|
|
322
|
+
timestamp,
|
|
323
|
+
level,
|
|
324
|
+
chalk.magenta(this.scope),
|
|
325
|
+
...args
|
|
326
|
+
];
|
|
327
|
+
else args = [
|
|
328
|
+
timestamp,
|
|
329
|
+
level,
|
|
330
|
+
...args
|
|
331
|
+
];
|
|
332
|
+
if (Logger.blocked) Logger.queuedMessages.push(args);
|
|
333
|
+
else console.log(...args);
|
|
334
|
+
}
|
|
335
|
+
trace(...args) {
|
|
336
|
+
this.debugEnabled && this.print("trace", ...args);
|
|
337
|
+
}
|
|
338
|
+
debug(...args) {
|
|
339
|
+
this.debugEnabled && this.print("debug", ...args);
|
|
340
|
+
}
|
|
341
|
+
log(...args) {
|
|
342
|
+
this.print("log", ...args);
|
|
343
|
+
}
|
|
344
|
+
info(...args) {
|
|
345
|
+
this.print("info", ...args);
|
|
346
|
+
}
|
|
347
|
+
warn(...args) {
|
|
348
|
+
this.print("warn", ...args);
|
|
349
|
+
}
|
|
350
|
+
error(...args) {
|
|
351
|
+
this.print("error", ...args);
|
|
352
|
+
}
|
|
353
|
+
child(scope) {
|
|
354
|
+
invariant(this.scope, "Logger must have a scope to create a child logger");
|
|
355
|
+
return new Logger(`${this.scope}:${scope}`);
|
|
356
|
+
}
|
|
357
|
+
};
|
|
358
|
+
|
|
357
359
|
//#endregion
|
|
358
360
|
//#region src/utils/terminal.ts
|
|
359
361
|
/**
|
|
@@ -609,25 +611,25 @@ var ClientLogReporter = class {
|
|
|
609
611
|
}
|
|
610
612
|
}
|
|
611
613
|
};
|
|
612
|
-
var ProgressFlags = /* @__PURE__ */ function(ProgressFlags
|
|
613
|
-
ProgressFlags
|
|
614
|
-
ProgressFlags
|
|
615
|
-
ProgressFlags
|
|
616
|
-
return ProgressFlags
|
|
614
|
+
var ProgressFlags = /* @__PURE__ */ function(ProgressFlags) {
|
|
615
|
+
ProgressFlags[ProgressFlags["NONE"] = 0] = "NONE";
|
|
616
|
+
ProgressFlags[ProgressFlags["BUILD_IN_PROGRESS"] = 1] = "BUILD_IN_PROGRESS";
|
|
617
|
+
ProgressFlags[ProgressFlags["FILE_CHANGED"] = 2] = "FILE_CHANGED";
|
|
618
|
+
return ProgressFlags;
|
|
617
619
|
}(ProgressFlags || {});
|
|
618
620
|
var ProgressBarStatusReporter = class {
|
|
619
621
|
renderManager = ProgressBarRenderManager.getInstance();
|
|
620
622
|
progressBar;
|
|
621
623
|
flags = ProgressFlags.NONE;
|
|
622
|
-
constructor(id
|
|
623
|
-
this.progressBar = this.renderManager.register(id
|
|
624
|
+
constructor(id, label, initialTotalModules) {
|
|
625
|
+
this.progressBar = this.renderManager.register(id, {
|
|
624
626
|
label,
|
|
625
627
|
total: initialTotalModules
|
|
626
628
|
});
|
|
627
629
|
}
|
|
628
|
-
renderProgress(id
|
|
630
|
+
renderProgress(id, totalModules, transformedModules) {
|
|
629
631
|
if (totalModules != null) this.progressBar.setTotal(totalModules);
|
|
630
|
-
this.progressBar.setCurrent(transformedModules).setModuleId(id
|
|
632
|
+
this.progressBar.setCurrent(transformedModules).setModuleId(id);
|
|
631
633
|
this.renderManager.render();
|
|
632
634
|
}
|
|
633
635
|
update(event) {
|
|
@@ -648,12 +650,12 @@ var ProgressBarStatusReporter = class {
|
|
|
648
650
|
this.renderManager.release();
|
|
649
651
|
break;
|
|
650
652
|
case "transform":
|
|
651
|
-
const { id
|
|
653
|
+
const { id, totalModules, transformedModules } = event;
|
|
652
654
|
if (this.flags & ProgressFlags.FILE_CHANGED) {
|
|
653
|
-
logger$2.debug("Transformed changed file", { id
|
|
655
|
+
logger$2.debug("Transformed changed file", { id });
|
|
654
656
|
return;
|
|
655
657
|
}
|
|
656
|
-
this.renderProgress(id
|
|
658
|
+
this.renderProgress(id, totalModules, transformedModules);
|
|
657
659
|
break;
|
|
658
660
|
case "watch_change":
|
|
659
661
|
this.flags |= ProgressFlags.FILE_CHANGED;
|
|
@@ -710,9 +712,9 @@ function getDefaultConfig(projectRoot, mode) {
|
|
|
710
712
|
},
|
|
711
713
|
serializer: {
|
|
712
714
|
prelude: [getInitializeCorePath(projectRoot)],
|
|
713
|
-
polyfills: getPolyfillScriptPaths(reactNativePath).map((path
|
|
715
|
+
polyfills: getPolyfillScriptPaths(reactNativePath).map((path) => ({
|
|
714
716
|
type: "iife",
|
|
715
|
-
code: generateSourceFromAst(stripFlowSyntax(fs.readFileSync(path
|
|
717
|
+
code: generateSourceFromAst(stripFlowSyntax(fs.readFileSync(path, "utf-8")), path).code
|
|
716
718
|
}))
|
|
717
719
|
},
|
|
718
720
|
watcher: {
|
|
@@ -728,28 +730,16 @@ function getDefaultConfig(projectRoot, mode) {
|
|
|
728
730
|
globalIdentifiers: DEFAULT_REACT_NATIVE_GLOBAL_IDENTIFIERS
|
|
729
731
|
},
|
|
730
732
|
devMode: { hmr: true },
|
|
733
|
+
reporter: new ClientLogReporter(),
|
|
731
734
|
terminal: { status: (() => {
|
|
732
735
|
if (isDebugEnabled()) return "compat";
|
|
733
736
|
if (process.stderr.isTTY) return "progress";
|
|
734
737
|
return "compat";
|
|
735
738
|
})() },
|
|
736
|
-
reporter: new ClientLogReporter(),
|
|
737
739
|
envDir: projectRoot,
|
|
738
740
|
envPrefix: DEFAULT_ENV_PREFIX
|
|
739
741
|
};
|
|
740
742
|
}
|
|
741
|
-
var TerminalReporter = class {
|
|
742
|
-
logger = new Logger("app");
|
|
743
|
-
update(event) {
|
|
744
|
-
if (event.type === "client_log") {
|
|
745
|
-
if (event.level === "group" || event.level === "groupCollapsed") {
|
|
746
|
-
this.logger.info(...event.data);
|
|
747
|
-
return;
|
|
748
|
-
} else if (event.level === "groupEnd") return;
|
|
749
|
-
this.logger[event.level](...event.data);
|
|
750
|
-
}
|
|
751
|
-
}
|
|
752
|
-
};
|
|
753
743
|
|
|
754
744
|
//#endregion
|
|
755
745
|
//#region src/config/define-config.ts
|
|
@@ -835,19 +825,19 @@ async function flattenPluginOption(pluginOption) {
|
|
|
835
825
|
}
|
|
836
826
|
async function resolvePluginConfig(baseConfig, plugins) {
|
|
837
827
|
let mergedConfig = omit(baseConfig, ["plugins", "dangerously_overrideRolldownOptions"]);
|
|
838
|
-
for (const plugin
|
|
839
|
-
const context = createPluginContext(plugin
|
|
840
|
-
if (typeof plugin
|
|
841
|
-
const config = await plugin
|
|
828
|
+
for (const plugin of plugins) {
|
|
829
|
+
const context = createPluginContext(plugin.name);
|
|
830
|
+
if (typeof plugin.config === "function") {
|
|
831
|
+
const config = await plugin.config.call(context, mergedConfig);
|
|
842
832
|
if (config != null) mergedConfig = mergeConfig(mergedConfig, config);
|
|
843
|
-
} else if (typeof plugin
|
|
833
|
+
} else if (typeof plugin.config === "object") mergedConfig = mergeConfig(mergedConfig, plugin.config);
|
|
844
834
|
}
|
|
845
835
|
return mergedConfig;
|
|
846
836
|
}
|
|
847
837
|
async function invokeConfigResolved(config, plugins) {
|
|
848
|
-
await Promise.all(plugins.map((plugin
|
|
849
|
-
const context = createPluginContext(plugin
|
|
850
|
-
return plugin
|
|
838
|
+
await Promise.all(plugins.map((plugin) => {
|
|
839
|
+
const context = createPluginContext(plugin.name);
|
|
840
|
+
return plugin.configResolved?.call(context, config);
|
|
851
841
|
}));
|
|
852
842
|
}
|
|
853
843
|
|
|
@@ -871,8 +861,8 @@ var FileSystemCache = class FileSystemCache {
|
|
|
871
861
|
force: true
|
|
872
862
|
});
|
|
873
863
|
}
|
|
874
|
-
constructor(projectRoot, id
|
|
875
|
-
this.cacheDirectory = path.join(FileSystemCache.getCacheDirectory(projectRoot), id
|
|
864
|
+
constructor(projectRoot, id) {
|
|
865
|
+
this.cacheDirectory = path.join(FileSystemCache.getCacheDirectory(projectRoot), id);
|
|
876
866
|
this.ensureCacheDirectory(this.cacheDirectory);
|
|
877
867
|
logger$2.debug("cache directory:", this.cacheDirectory);
|
|
878
868
|
}
|
|
@@ -955,9 +945,9 @@ function printLogo() {
|
|
|
955
945
|
DESCRIPTIONS.forEach((description, index) => {
|
|
956
946
|
const descriptionHalfLength = description.length / 2;
|
|
957
947
|
const logoHalfWidth = maxLogoWidth / 2;
|
|
958
|
-
const padding
|
|
959
|
-
if (index === 0) console.log(padding
|
|
960
|
-
else console.log(padding
|
|
948
|
+
const padding = " ".repeat(PADDING - descriptionHalfLength + logoHalfWidth);
|
|
949
|
+
if (index === 0) console.log(padding + chalk.bold.hex(PRIMARY_COLOR)(description));
|
|
950
|
+
else console.log(padding + description);
|
|
961
951
|
});
|
|
962
952
|
console.log("");
|
|
963
953
|
}
|
|
@@ -998,10 +988,10 @@ function md5(data) {
|
|
|
998
988
|
//#endregion
|
|
999
989
|
//#region src/utils/serialize.ts
|
|
1000
990
|
function serialize(value) {
|
|
1001
|
-
return JSON.stringify(value, (_, value
|
|
1002
|
-
if (typeof value
|
|
1003
|
-
if (value
|
|
1004
|
-
return value
|
|
991
|
+
return JSON.stringify(value, (_, value) => {
|
|
992
|
+
if (typeof value === "function") return value.toString();
|
|
993
|
+
if (value instanceof RegExp) return value.toString();
|
|
994
|
+
return value;
|
|
1005
995
|
});
|
|
1006
996
|
}
|
|
1007
997
|
|
|
@@ -1025,7 +1015,7 @@ function filterTransformAffectedConfig(config) {
|
|
|
1025
1015
|
serializer.prelude,
|
|
1026
1016
|
reactNative.assetRegistryPath,
|
|
1027
1017
|
devMode,
|
|
1028
|
-
plugins.map((plugin
|
|
1018
|
+
plugins.map((plugin, index) => `${plugin.name}#${index}`)
|
|
1029
1019
|
];
|
|
1030
1020
|
}
|
|
1031
1021
|
|
|
@@ -1057,8 +1047,8 @@ var FileStorage = class FileStorage {
|
|
|
1057
1047
|
|
|
1058
1048
|
//#endregion
|
|
1059
1049
|
//#region src/utils/string.ts
|
|
1060
|
-
function indent(text, indent
|
|
1061
|
-
return text.replace(/^/gm, space.repeat(indent
|
|
1050
|
+
function indent(text, indent, space = " ") {
|
|
1051
|
+
return text.replace(/^/gm, space.repeat(indent));
|
|
1062
1052
|
}
|
|
1063
1053
|
|
|
1064
1054
|
//#endregion
|
|
@@ -1069,13 +1059,13 @@ function asLiteral(value) {
|
|
|
1069
1059
|
function asIdentifier(name) {
|
|
1070
1060
|
return name;
|
|
1071
1061
|
}
|
|
1072
|
-
function nodeEnvironment(dev
|
|
1073
|
-
return dev
|
|
1062
|
+
function nodeEnvironment(dev) {
|
|
1063
|
+
return dev ? "development" : "production";
|
|
1074
1064
|
}
|
|
1075
|
-
function iife(body, path
|
|
1065
|
+
function iife(body, path = "<unknown>") {
|
|
1076
1066
|
const bodyPlaceholder = "__BODY__";
|
|
1077
1067
|
return dedent`
|
|
1078
|
-
// ${path
|
|
1068
|
+
// ${path}
|
|
1079
1069
|
(function (global) {
|
|
1080
1070
|
${bodyPlaceholder}
|
|
1081
1071
|
})(${GLOBAL_IDENTIFIER});
|
|
@@ -1104,7 +1094,7 @@ function bindReporter(config, eventSource) {
|
|
|
1104
1094
|
eventSource.emit("watchChange", event.id);
|
|
1105
1095
|
break;
|
|
1106
1096
|
}
|
|
1107
|
-
originalReporter
|
|
1097
|
+
originalReporter?.update(event);
|
|
1108
1098
|
} };
|
|
1109
1099
|
return config;
|
|
1110
1100
|
}
|
|
@@ -1141,8 +1131,8 @@ function getBaseUrl(host, port, https) {
|
|
|
1141
1131
|
|
|
1142
1132
|
//#endregion
|
|
1143
1133
|
//#region src/utils/storage.ts
|
|
1144
|
-
function getBuildTotalModules(storage, id
|
|
1145
|
-
return storage.get().build[id
|
|
1134
|
+
function getBuildTotalModules(storage, id) {
|
|
1135
|
+
return storage.get().build[id]?.totalModules ?? 0;
|
|
1146
1136
|
}
|
|
1147
1137
|
|
|
1148
1138
|
//#endregion
|
|
@@ -1174,30 +1164,6 @@ function loadEnv(options) {
|
|
|
1174
1164
|
return env;
|
|
1175
1165
|
}
|
|
1176
1166
|
|
|
1177
|
-
//#endregion
|
|
1178
|
-
//#region node_modules/mitt/dist/mitt.mjs
|
|
1179
|
-
function mitt_default(n) {
|
|
1180
|
-
return {
|
|
1181
|
-
all: n = n || /* @__PURE__ */ new Map(),
|
|
1182
|
-
on: function(t, e) {
|
|
1183
|
-
var i = n.get(t);
|
|
1184
|
-
i ? i.push(e) : n.set(t, [e]);
|
|
1185
|
-
},
|
|
1186
|
-
off: function(t, e) {
|
|
1187
|
-
var i = n.get(t);
|
|
1188
|
-
i && (e ? i.splice(i.indexOf(e) >>> 0, 1) : n.set(t, []));
|
|
1189
|
-
},
|
|
1190
|
-
emit: function(t, e) {
|
|
1191
|
-
var i = n.get(t);
|
|
1192
|
-
i && i.slice().map(function(n$1) {
|
|
1193
|
-
n$1(e);
|
|
1194
|
-
}), (i = n.get("*")) && i.slice().map(function(n$1) {
|
|
1195
|
-
n$1(t, e);
|
|
1196
|
-
});
|
|
1197
|
-
}
|
|
1198
|
-
};
|
|
1199
|
-
}
|
|
1200
|
-
|
|
1201
1167
|
//#endregion
|
|
1202
1168
|
//#region src/server/logger.ts
|
|
1203
1169
|
const logger$1 = new Logger("dev-server");
|
|
@@ -1247,12 +1213,12 @@ async function assertDevServerStatus(options) {
|
|
|
1247
1213
|
}
|
|
1248
1214
|
if (shouldExit) process.exit(1);
|
|
1249
1215
|
}
|
|
1250
|
-
var DevServerStatus = /* @__PURE__ */ function(DevServerStatus
|
|
1251
|
-
DevServerStatus
|
|
1252
|
-
DevServerStatus
|
|
1253
|
-
DevServerStatus
|
|
1254
|
-
DevServerStatus
|
|
1255
|
-
return DevServerStatus
|
|
1216
|
+
var DevServerStatus = /* @__PURE__ */ function(DevServerStatus) {
|
|
1217
|
+
DevServerStatus[DevServerStatus["NOT_RUNNING"] = 0] = "NOT_RUNNING";
|
|
1218
|
+
DevServerStatus[DevServerStatus["MATCHED_SERVER_RUNNING"] = 1] = "MATCHED_SERVER_RUNNING";
|
|
1219
|
+
DevServerStatus[DevServerStatus["PORT_TAKEN"] = 2] = "PORT_TAKEN";
|
|
1220
|
+
DevServerStatus[DevServerStatus["UNKNOWN"] = 3] = "UNKNOWN";
|
|
1221
|
+
return DevServerStatus;
|
|
1256
1222
|
}(DevServerStatus || {});
|
|
1257
1223
|
async function getDevServerStatus(devServerUrl, projectRoot) {
|
|
1258
1224
|
const { hostname, port } = new URL(devServerUrl);
|
|
@@ -1383,9 +1349,9 @@ var BundlerDevEngine = class extends EventEmitter {
|
|
|
1383
1349
|
}
|
|
1384
1350
|
get sourceMappingURL() {
|
|
1385
1351
|
const { host, port } = this.options.server;
|
|
1386
|
-
const { platform, dev
|
|
1352
|
+
const { platform, dev } = this.buildOptions;
|
|
1387
1353
|
const [name] = this.config.entry.split(".");
|
|
1388
|
-
return `http://${host}:${port}/${name}.bundle.map?platform=${platform}&dev=${dev
|
|
1354
|
+
return `http://${host}:${port}/${name}.bundle.map?platform=${platform}&dev=${dev}`;
|
|
1389
1355
|
}
|
|
1390
1356
|
async initialize() {
|
|
1391
1357
|
if (this._state !== "idle" || this._devEngine != null) return this;
|
|
@@ -1466,10 +1432,10 @@ var BundlerPool = class BundlerPool {
|
|
|
1466
1432
|
bundleName,
|
|
1467
1433
|
key
|
|
1468
1434
|
});
|
|
1469
|
-
const instance
|
|
1435
|
+
const instance = new BundlerDevEngine({ server: this.resolvedServerOptions }, this.config, buildOptions);
|
|
1470
1436
|
logger$1.debug("Setting new bundler instance", { key });
|
|
1471
|
-
BundlerPool.instances.set(key, instance
|
|
1472
|
-
return instance
|
|
1437
|
+
BundlerPool.instances.set(key, instance);
|
|
1438
|
+
return instance;
|
|
1473
1439
|
}
|
|
1474
1440
|
}
|
|
1475
1441
|
};
|
|
@@ -1519,9 +1485,9 @@ const plugin$2 = fp((fastify, options) => {
|
|
|
1519
1485
|
fastify.get(`/${DEV_SERVER_ASSET_PATH}/*`, {
|
|
1520
1486
|
schema: { querystring: queryParamSchema },
|
|
1521
1487
|
async handler(request, reply) {
|
|
1522
|
-
const { url
|
|
1523
|
-
const { pathname } = new URL(url
|
|
1524
|
-
const assetPath = resolveAsset(pathname.replace(
|
|
1488
|
+
const { url, query } = request;
|
|
1489
|
+
const { pathname } = new URL(url, baseUrl);
|
|
1490
|
+
const assetPath = resolveAsset(pathname.replace(new RegExp(`^/${DEV_SERVER_ASSET_PATH}/?`), ""));
|
|
1525
1491
|
let handle = null;
|
|
1526
1492
|
try {
|
|
1527
1493
|
handle = await fs.promises.open(resolveAssetPath(assetPath, {
|
|
@@ -1716,1394 +1682,30 @@ const plugin$1 = fp((fastify, options) => {
|
|
|
1716
1682
|
}, { name: "serve-bundle" });
|
|
1717
1683
|
|
|
1718
1684
|
//#endregion
|
|
1719
|
-
//#region
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
let formatter = (open, close, replace = open) => (input) => {
|
|
1724
|
-
let string = "" + input, index = string.indexOf(close, open.length);
|
|
1725
|
-
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
1726
|
-
};
|
|
1727
|
-
let replaceClose = (string, close, replace, index) => {
|
|
1728
|
-
let result = "", cursor = 0;
|
|
1729
|
-
do {
|
|
1730
|
-
result += string.substring(cursor, index) + replace;
|
|
1731
|
-
cursor = index + close.length;
|
|
1732
|
-
index = string.indexOf(close, cursor);
|
|
1733
|
-
} while (~index);
|
|
1734
|
-
return result + string.substring(cursor);
|
|
1735
|
-
};
|
|
1736
|
-
let createColors = (enabled = isColorSupported) => {
|
|
1737
|
-
let f = enabled ? formatter : () => String;
|
|
1685
|
+
//#region src/utils/url.ts
|
|
1686
|
+
function parseUrl(value) {
|
|
1687
|
+
if (value.startsWith("/")) {
|
|
1688
|
+
const [pathname, query] = value.split("?");
|
|
1738
1689
|
return {
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
1742
|
-
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
1743
|
-
italic: f("\x1B[3m", "\x1B[23m"),
|
|
1744
|
-
underline: f("\x1B[4m", "\x1B[24m"),
|
|
1745
|
-
inverse: f("\x1B[7m", "\x1B[27m"),
|
|
1746
|
-
hidden: f("\x1B[8m", "\x1B[28m"),
|
|
1747
|
-
strikethrough: f("\x1B[9m", "\x1B[29m"),
|
|
1748
|
-
black: f("\x1B[30m", "\x1B[39m"),
|
|
1749
|
-
red: f("\x1B[31m", "\x1B[39m"),
|
|
1750
|
-
green: f("\x1B[32m", "\x1B[39m"),
|
|
1751
|
-
yellow: f("\x1B[33m", "\x1B[39m"),
|
|
1752
|
-
blue: f("\x1B[34m", "\x1B[39m"),
|
|
1753
|
-
magenta: f("\x1B[35m", "\x1B[39m"),
|
|
1754
|
-
cyan: f("\x1B[36m", "\x1B[39m"),
|
|
1755
|
-
white: f("\x1B[37m", "\x1B[39m"),
|
|
1756
|
-
gray: f("\x1B[90m", "\x1B[39m"),
|
|
1757
|
-
bgBlack: f("\x1B[40m", "\x1B[49m"),
|
|
1758
|
-
bgRed: f("\x1B[41m", "\x1B[49m"),
|
|
1759
|
-
bgGreen: f("\x1B[42m", "\x1B[49m"),
|
|
1760
|
-
bgYellow: f("\x1B[43m", "\x1B[49m"),
|
|
1761
|
-
bgBlue: f("\x1B[44m", "\x1B[49m"),
|
|
1762
|
-
bgMagenta: f("\x1B[45m", "\x1B[49m"),
|
|
1763
|
-
bgCyan: f("\x1B[46m", "\x1B[49m"),
|
|
1764
|
-
bgWhite: f("\x1B[47m", "\x1B[49m"),
|
|
1765
|
-
blackBright: f("\x1B[90m", "\x1B[39m"),
|
|
1766
|
-
redBright: f("\x1B[91m", "\x1B[39m"),
|
|
1767
|
-
greenBright: f("\x1B[92m", "\x1B[39m"),
|
|
1768
|
-
yellowBright: f("\x1B[93m", "\x1B[39m"),
|
|
1769
|
-
blueBright: f("\x1B[94m", "\x1B[39m"),
|
|
1770
|
-
magentaBright: f("\x1B[95m", "\x1B[39m"),
|
|
1771
|
-
cyanBright: f("\x1B[96m", "\x1B[39m"),
|
|
1772
|
-
whiteBright: f("\x1B[97m", "\x1B[39m"),
|
|
1773
|
-
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
|
|
1774
|
-
bgRedBright: f("\x1B[101m", "\x1B[49m"),
|
|
1775
|
-
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
|
|
1776
|
-
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
|
|
1777
|
-
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
|
|
1778
|
-
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
|
|
1779
|
-
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
|
|
1780
|
-
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
1781
|
-
};
|
|
1782
|
-
};
|
|
1783
|
-
module.exports = createColors();
|
|
1784
|
-
module.exports.createColors = createColors;
|
|
1785
|
-
}));
|
|
1786
|
-
|
|
1787
|
-
//#endregion
|
|
1788
|
-
//#region node_modules/js-tokens/index.js
|
|
1789
|
-
var require_js_tokens = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1790
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1791
|
-
exports.default = /((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyus]{1,6}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g;
|
|
1792
|
-
exports.matchToToken = function(match) {
|
|
1793
|
-
var token = {
|
|
1794
|
-
type: "invalid",
|
|
1795
|
-
value: match[0],
|
|
1796
|
-
closed: void 0
|
|
1690
|
+
pathname,
|
|
1691
|
+
query: query ? toQueryObject(new URLSearchParams(query)) : {}
|
|
1797
1692
|
};
|
|
1798
|
-
if (match[1]) token.type = "string", token.closed = !!(match[3] || match[4]);
|
|
1799
|
-
else if (match[5]) token.type = "comment";
|
|
1800
|
-
else if (match[6]) token.type = "comment", token.closed = !!match[7];
|
|
1801
|
-
else if (match[8]) token.type = "regex";
|
|
1802
|
-
else if (match[9]) token.type = "number";
|
|
1803
|
-
else if (match[10]) token.type = "name";
|
|
1804
|
-
else if (match[11]) token.type = "punctuator";
|
|
1805
|
-
else if (match[12]) token.type = "whitespace";
|
|
1806
|
-
return token;
|
|
1807
|
-
};
|
|
1808
|
-
}));
|
|
1809
|
-
|
|
1810
|
-
//#endregion
|
|
1811
|
-
//#region node_modules/@babel/helper-validator-identifier/lib/identifier.js
|
|
1812
|
-
var require_identifier = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1813
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1814
|
-
exports.isIdentifierChar = isIdentifierChar;
|
|
1815
|
-
exports.isIdentifierName = isIdentifierName;
|
|
1816
|
-
exports.isIdentifierStart = isIdentifierStart;
|
|
1817
|
-
let nonASCIIidentifierStartChars = "ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽ-ೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-Ა-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ--ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ";
|
|
1818
|
-
let nonASCIIidentifierChars = "·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ--ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・";
|
|
1819
|
-
const nonASCIIidentifierStart = /* @__PURE__ */ new RegExp("[" + nonASCIIidentifierStartChars + "]");
|
|
1820
|
-
const nonASCIIidentifier = /* @__PURE__ */ new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
|
|
1821
|
-
nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
|
|
1822
|
-
const astralIdentifierStartCodes = [
|
|
1823
|
-
0,
|
|
1824
|
-
11,
|
|
1825
|
-
2,
|
|
1826
|
-
25,
|
|
1827
|
-
2,
|
|
1828
|
-
18,
|
|
1829
|
-
2,
|
|
1830
|
-
1,
|
|
1831
|
-
2,
|
|
1832
|
-
14,
|
|
1833
|
-
3,
|
|
1834
|
-
13,
|
|
1835
|
-
35,
|
|
1836
|
-
122,
|
|
1837
|
-
70,
|
|
1838
|
-
52,
|
|
1839
|
-
268,
|
|
1840
|
-
28,
|
|
1841
|
-
4,
|
|
1842
|
-
48,
|
|
1843
|
-
48,
|
|
1844
|
-
31,
|
|
1845
|
-
14,
|
|
1846
|
-
29,
|
|
1847
|
-
6,
|
|
1848
|
-
37,
|
|
1849
|
-
11,
|
|
1850
|
-
29,
|
|
1851
|
-
3,
|
|
1852
|
-
35,
|
|
1853
|
-
5,
|
|
1854
|
-
7,
|
|
1855
|
-
2,
|
|
1856
|
-
4,
|
|
1857
|
-
43,
|
|
1858
|
-
157,
|
|
1859
|
-
19,
|
|
1860
|
-
35,
|
|
1861
|
-
5,
|
|
1862
|
-
35,
|
|
1863
|
-
5,
|
|
1864
|
-
39,
|
|
1865
|
-
9,
|
|
1866
|
-
51,
|
|
1867
|
-
13,
|
|
1868
|
-
10,
|
|
1869
|
-
2,
|
|
1870
|
-
14,
|
|
1871
|
-
2,
|
|
1872
|
-
6,
|
|
1873
|
-
2,
|
|
1874
|
-
1,
|
|
1875
|
-
2,
|
|
1876
|
-
10,
|
|
1877
|
-
2,
|
|
1878
|
-
14,
|
|
1879
|
-
2,
|
|
1880
|
-
6,
|
|
1881
|
-
2,
|
|
1882
|
-
1,
|
|
1883
|
-
4,
|
|
1884
|
-
51,
|
|
1885
|
-
13,
|
|
1886
|
-
310,
|
|
1887
|
-
10,
|
|
1888
|
-
21,
|
|
1889
|
-
11,
|
|
1890
|
-
7,
|
|
1891
|
-
25,
|
|
1892
|
-
5,
|
|
1893
|
-
2,
|
|
1894
|
-
41,
|
|
1895
|
-
2,
|
|
1896
|
-
8,
|
|
1897
|
-
70,
|
|
1898
|
-
5,
|
|
1899
|
-
3,
|
|
1900
|
-
0,
|
|
1901
|
-
2,
|
|
1902
|
-
43,
|
|
1903
|
-
2,
|
|
1904
|
-
1,
|
|
1905
|
-
4,
|
|
1906
|
-
0,
|
|
1907
|
-
3,
|
|
1908
|
-
22,
|
|
1909
|
-
11,
|
|
1910
|
-
22,
|
|
1911
|
-
10,
|
|
1912
|
-
30,
|
|
1913
|
-
66,
|
|
1914
|
-
18,
|
|
1915
|
-
2,
|
|
1916
|
-
1,
|
|
1917
|
-
11,
|
|
1918
|
-
21,
|
|
1919
|
-
11,
|
|
1920
|
-
25,
|
|
1921
|
-
7,
|
|
1922
|
-
25,
|
|
1923
|
-
39,
|
|
1924
|
-
55,
|
|
1925
|
-
7,
|
|
1926
|
-
1,
|
|
1927
|
-
65,
|
|
1928
|
-
0,
|
|
1929
|
-
16,
|
|
1930
|
-
3,
|
|
1931
|
-
2,
|
|
1932
|
-
2,
|
|
1933
|
-
2,
|
|
1934
|
-
28,
|
|
1935
|
-
43,
|
|
1936
|
-
28,
|
|
1937
|
-
4,
|
|
1938
|
-
28,
|
|
1939
|
-
36,
|
|
1940
|
-
7,
|
|
1941
|
-
2,
|
|
1942
|
-
27,
|
|
1943
|
-
28,
|
|
1944
|
-
53,
|
|
1945
|
-
11,
|
|
1946
|
-
21,
|
|
1947
|
-
11,
|
|
1948
|
-
18,
|
|
1949
|
-
14,
|
|
1950
|
-
17,
|
|
1951
|
-
111,
|
|
1952
|
-
72,
|
|
1953
|
-
56,
|
|
1954
|
-
50,
|
|
1955
|
-
14,
|
|
1956
|
-
50,
|
|
1957
|
-
14,
|
|
1958
|
-
35,
|
|
1959
|
-
39,
|
|
1960
|
-
27,
|
|
1961
|
-
10,
|
|
1962
|
-
22,
|
|
1963
|
-
251,
|
|
1964
|
-
41,
|
|
1965
|
-
7,
|
|
1966
|
-
1,
|
|
1967
|
-
17,
|
|
1968
|
-
5,
|
|
1969
|
-
57,
|
|
1970
|
-
28,
|
|
1971
|
-
11,
|
|
1972
|
-
0,
|
|
1973
|
-
9,
|
|
1974
|
-
21,
|
|
1975
|
-
43,
|
|
1976
|
-
17,
|
|
1977
|
-
47,
|
|
1978
|
-
20,
|
|
1979
|
-
28,
|
|
1980
|
-
22,
|
|
1981
|
-
13,
|
|
1982
|
-
52,
|
|
1983
|
-
58,
|
|
1984
|
-
1,
|
|
1985
|
-
3,
|
|
1986
|
-
0,
|
|
1987
|
-
14,
|
|
1988
|
-
44,
|
|
1989
|
-
33,
|
|
1990
|
-
24,
|
|
1991
|
-
27,
|
|
1992
|
-
35,
|
|
1993
|
-
30,
|
|
1994
|
-
0,
|
|
1995
|
-
3,
|
|
1996
|
-
0,
|
|
1997
|
-
9,
|
|
1998
|
-
34,
|
|
1999
|
-
4,
|
|
2000
|
-
0,
|
|
2001
|
-
13,
|
|
2002
|
-
47,
|
|
2003
|
-
15,
|
|
2004
|
-
3,
|
|
2005
|
-
22,
|
|
2006
|
-
0,
|
|
2007
|
-
2,
|
|
2008
|
-
0,
|
|
2009
|
-
36,
|
|
2010
|
-
17,
|
|
2011
|
-
2,
|
|
2012
|
-
24,
|
|
2013
|
-
20,
|
|
2014
|
-
1,
|
|
2015
|
-
64,
|
|
2016
|
-
6,
|
|
2017
|
-
2,
|
|
2018
|
-
0,
|
|
2019
|
-
2,
|
|
2020
|
-
3,
|
|
2021
|
-
2,
|
|
2022
|
-
14,
|
|
2023
|
-
2,
|
|
2024
|
-
9,
|
|
2025
|
-
8,
|
|
2026
|
-
46,
|
|
2027
|
-
39,
|
|
2028
|
-
7,
|
|
2029
|
-
3,
|
|
2030
|
-
1,
|
|
2031
|
-
3,
|
|
2032
|
-
21,
|
|
2033
|
-
2,
|
|
2034
|
-
6,
|
|
2035
|
-
2,
|
|
2036
|
-
1,
|
|
2037
|
-
2,
|
|
2038
|
-
4,
|
|
2039
|
-
4,
|
|
2040
|
-
0,
|
|
2041
|
-
19,
|
|
2042
|
-
0,
|
|
2043
|
-
13,
|
|
2044
|
-
4,
|
|
2045
|
-
31,
|
|
2046
|
-
9,
|
|
2047
|
-
2,
|
|
2048
|
-
0,
|
|
2049
|
-
3,
|
|
2050
|
-
0,
|
|
2051
|
-
2,
|
|
2052
|
-
37,
|
|
2053
|
-
2,
|
|
2054
|
-
0,
|
|
2055
|
-
26,
|
|
2056
|
-
0,
|
|
2057
|
-
2,
|
|
2058
|
-
0,
|
|
2059
|
-
45,
|
|
2060
|
-
52,
|
|
2061
|
-
19,
|
|
2062
|
-
3,
|
|
2063
|
-
21,
|
|
2064
|
-
2,
|
|
2065
|
-
31,
|
|
2066
|
-
47,
|
|
2067
|
-
21,
|
|
2068
|
-
1,
|
|
2069
|
-
2,
|
|
2070
|
-
0,
|
|
2071
|
-
185,
|
|
2072
|
-
46,
|
|
2073
|
-
42,
|
|
2074
|
-
3,
|
|
2075
|
-
37,
|
|
2076
|
-
47,
|
|
2077
|
-
21,
|
|
2078
|
-
0,
|
|
2079
|
-
60,
|
|
2080
|
-
42,
|
|
2081
|
-
14,
|
|
2082
|
-
0,
|
|
2083
|
-
72,
|
|
2084
|
-
26,
|
|
2085
|
-
38,
|
|
2086
|
-
6,
|
|
2087
|
-
186,
|
|
2088
|
-
43,
|
|
2089
|
-
117,
|
|
2090
|
-
63,
|
|
2091
|
-
32,
|
|
2092
|
-
7,
|
|
2093
|
-
3,
|
|
2094
|
-
0,
|
|
2095
|
-
3,
|
|
2096
|
-
7,
|
|
2097
|
-
2,
|
|
2098
|
-
1,
|
|
2099
|
-
2,
|
|
2100
|
-
23,
|
|
2101
|
-
16,
|
|
2102
|
-
0,
|
|
2103
|
-
2,
|
|
2104
|
-
0,
|
|
2105
|
-
95,
|
|
2106
|
-
7,
|
|
2107
|
-
3,
|
|
2108
|
-
38,
|
|
2109
|
-
17,
|
|
2110
|
-
0,
|
|
2111
|
-
2,
|
|
2112
|
-
0,
|
|
2113
|
-
29,
|
|
2114
|
-
0,
|
|
2115
|
-
11,
|
|
2116
|
-
39,
|
|
2117
|
-
8,
|
|
2118
|
-
0,
|
|
2119
|
-
22,
|
|
2120
|
-
0,
|
|
2121
|
-
12,
|
|
2122
|
-
45,
|
|
2123
|
-
20,
|
|
2124
|
-
0,
|
|
2125
|
-
19,
|
|
2126
|
-
72,
|
|
2127
|
-
200,
|
|
2128
|
-
32,
|
|
2129
|
-
32,
|
|
2130
|
-
8,
|
|
2131
|
-
2,
|
|
2132
|
-
36,
|
|
2133
|
-
18,
|
|
2134
|
-
0,
|
|
2135
|
-
50,
|
|
2136
|
-
29,
|
|
2137
|
-
113,
|
|
2138
|
-
6,
|
|
2139
|
-
2,
|
|
2140
|
-
1,
|
|
2141
|
-
2,
|
|
2142
|
-
37,
|
|
2143
|
-
22,
|
|
2144
|
-
0,
|
|
2145
|
-
26,
|
|
2146
|
-
5,
|
|
2147
|
-
2,
|
|
2148
|
-
1,
|
|
2149
|
-
2,
|
|
2150
|
-
31,
|
|
2151
|
-
15,
|
|
2152
|
-
0,
|
|
2153
|
-
24,
|
|
2154
|
-
43,
|
|
2155
|
-
261,
|
|
2156
|
-
18,
|
|
2157
|
-
16,
|
|
2158
|
-
0,
|
|
2159
|
-
2,
|
|
2160
|
-
12,
|
|
2161
|
-
2,
|
|
2162
|
-
33,
|
|
2163
|
-
125,
|
|
2164
|
-
0,
|
|
2165
|
-
80,
|
|
2166
|
-
921,
|
|
2167
|
-
103,
|
|
2168
|
-
110,
|
|
2169
|
-
18,
|
|
2170
|
-
195,
|
|
2171
|
-
2637,
|
|
2172
|
-
96,
|
|
2173
|
-
16,
|
|
2174
|
-
1071,
|
|
2175
|
-
18,
|
|
2176
|
-
5,
|
|
2177
|
-
26,
|
|
2178
|
-
3994,
|
|
2179
|
-
6,
|
|
2180
|
-
582,
|
|
2181
|
-
6842,
|
|
2182
|
-
29,
|
|
2183
|
-
1763,
|
|
2184
|
-
568,
|
|
2185
|
-
8,
|
|
2186
|
-
30,
|
|
2187
|
-
18,
|
|
2188
|
-
78,
|
|
2189
|
-
18,
|
|
2190
|
-
29,
|
|
2191
|
-
19,
|
|
2192
|
-
47,
|
|
2193
|
-
17,
|
|
2194
|
-
3,
|
|
2195
|
-
32,
|
|
2196
|
-
20,
|
|
2197
|
-
6,
|
|
2198
|
-
18,
|
|
2199
|
-
433,
|
|
2200
|
-
44,
|
|
2201
|
-
212,
|
|
2202
|
-
63,
|
|
2203
|
-
33,
|
|
2204
|
-
24,
|
|
2205
|
-
3,
|
|
2206
|
-
24,
|
|
2207
|
-
45,
|
|
2208
|
-
74,
|
|
2209
|
-
6,
|
|
2210
|
-
0,
|
|
2211
|
-
67,
|
|
2212
|
-
12,
|
|
2213
|
-
65,
|
|
2214
|
-
1,
|
|
2215
|
-
2,
|
|
2216
|
-
0,
|
|
2217
|
-
15,
|
|
2218
|
-
4,
|
|
2219
|
-
10,
|
|
2220
|
-
7381,
|
|
2221
|
-
42,
|
|
2222
|
-
31,
|
|
2223
|
-
98,
|
|
2224
|
-
114,
|
|
2225
|
-
8702,
|
|
2226
|
-
3,
|
|
2227
|
-
2,
|
|
2228
|
-
6,
|
|
2229
|
-
2,
|
|
2230
|
-
1,
|
|
2231
|
-
2,
|
|
2232
|
-
290,
|
|
2233
|
-
16,
|
|
2234
|
-
0,
|
|
2235
|
-
30,
|
|
2236
|
-
2,
|
|
2237
|
-
3,
|
|
2238
|
-
0,
|
|
2239
|
-
15,
|
|
2240
|
-
3,
|
|
2241
|
-
9,
|
|
2242
|
-
395,
|
|
2243
|
-
2309,
|
|
2244
|
-
106,
|
|
2245
|
-
6,
|
|
2246
|
-
12,
|
|
2247
|
-
4,
|
|
2248
|
-
8,
|
|
2249
|
-
8,
|
|
2250
|
-
9,
|
|
2251
|
-
5991,
|
|
2252
|
-
84,
|
|
2253
|
-
2,
|
|
2254
|
-
70,
|
|
2255
|
-
2,
|
|
2256
|
-
1,
|
|
2257
|
-
3,
|
|
2258
|
-
0,
|
|
2259
|
-
3,
|
|
2260
|
-
1,
|
|
2261
|
-
3,
|
|
2262
|
-
3,
|
|
2263
|
-
2,
|
|
2264
|
-
11,
|
|
2265
|
-
2,
|
|
2266
|
-
0,
|
|
2267
|
-
2,
|
|
2268
|
-
6,
|
|
2269
|
-
2,
|
|
2270
|
-
64,
|
|
2271
|
-
2,
|
|
2272
|
-
3,
|
|
2273
|
-
3,
|
|
2274
|
-
7,
|
|
2275
|
-
2,
|
|
2276
|
-
6,
|
|
2277
|
-
2,
|
|
2278
|
-
27,
|
|
2279
|
-
2,
|
|
2280
|
-
3,
|
|
2281
|
-
2,
|
|
2282
|
-
4,
|
|
2283
|
-
2,
|
|
2284
|
-
0,
|
|
2285
|
-
4,
|
|
2286
|
-
6,
|
|
2287
|
-
2,
|
|
2288
|
-
339,
|
|
2289
|
-
3,
|
|
2290
|
-
24,
|
|
2291
|
-
2,
|
|
2292
|
-
24,
|
|
2293
|
-
2,
|
|
2294
|
-
30,
|
|
2295
|
-
2,
|
|
2296
|
-
24,
|
|
2297
|
-
2,
|
|
2298
|
-
30,
|
|
2299
|
-
2,
|
|
2300
|
-
24,
|
|
2301
|
-
2,
|
|
2302
|
-
30,
|
|
2303
|
-
2,
|
|
2304
|
-
24,
|
|
2305
|
-
2,
|
|
2306
|
-
30,
|
|
2307
|
-
2,
|
|
2308
|
-
24,
|
|
2309
|
-
2,
|
|
2310
|
-
7,
|
|
2311
|
-
1845,
|
|
2312
|
-
30,
|
|
2313
|
-
7,
|
|
2314
|
-
5,
|
|
2315
|
-
262,
|
|
2316
|
-
61,
|
|
2317
|
-
147,
|
|
2318
|
-
44,
|
|
2319
|
-
11,
|
|
2320
|
-
6,
|
|
2321
|
-
17,
|
|
2322
|
-
0,
|
|
2323
|
-
322,
|
|
2324
|
-
29,
|
|
2325
|
-
19,
|
|
2326
|
-
43,
|
|
2327
|
-
485,
|
|
2328
|
-
27,
|
|
2329
|
-
229,
|
|
2330
|
-
29,
|
|
2331
|
-
3,
|
|
2332
|
-
0,
|
|
2333
|
-
208,
|
|
2334
|
-
30,
|
|
2335
|
-
2,
|
|
2336
|
-
2,
|
|
2337
|
-
2,
|
|
2338
|
-
1,
|
|
2339
|
-
2,
|
|
2340
|
-
6,
|
|
2341
|
-
3,
|
|
2342
|
-
4,
|
|
2343
|
-
10,
|
|
2344
|
-
1,
|
|
2345
|
-
225,
|
|
2346
|
-
6,
|
|
2347
|
-
2,
|
|
2348
|
-
3,
|
|
2349
|
-
2,
|
|
2350
|
-
1,
|
|
2351
|
-
2,
|
|
2352
|
-
14,
|
|
2353
|
-
2,
|
|
2354
|
-
196,
|
|
2355
|
-
60,
|
|
2356
|
-
67,
|
|
2357
|
-
8,
|
|
2358
|
-
0,
|
|
2359
|
-
1205,
|
|
2360
|
-
3,
|
|
2361
|
-
2,
|
|
2362
|
-
26,
|
|
2363
|
-
2,
|
|
2364
|
-
1,
|
|
2365
|
-
2,
|
|
2366
|
-
0,
|
|
2367
|
-
3,
|
|
2368
|
-
0,
|
|
2369
|
-
2,
|
|
2370
|
-
9,
|
|
2371
|
-
2,
|
|
2372
|
-
3,
|
|
2373
|
-
2,
|
|
2374
|
-
0,
|
|
2375
|
-
2,
|
|
2376
|
-
0,
|
|
2377
|
-
7,
|
|
2378
|
-
0,
|
|
2379
|
-
5,
|
|
2380
|
-
0,
|
|
2381
|
-
2,
|
|
2382
|
-
0,
|
|
2383
|
-
2,
|
|
2384
|
-
0,
|
|
2385
|
-
2,
|
|
2386
|
-
2,
|
|
2387
|
-
2,
|
|
2388
|
-
1,
|
|
2389
|
-
2,
|
|
2390
|
-
0,
|
|
2391
|
-
3,
|
|
2392
|
-
0,
|
|
2393
|
-
2,
|
|
2394
|
-
0,
|
|
2395
|
-
2,
|
|
2396
|
-
0,
|
|
2397
|
-
2,
|
|
2398
|
-
0,
|
|
2399
|
-
2,
|
|
2400
|
-
0,
|
|
2401
|
-
2,
|
|
2402
|
-
1,
|
|
2403
|
-
2,
|
|
2404
|
-
0,
|
|
2405
|
-
3,
|
|
2406
|
-
3,
|
|
2407
|
-
2,
|
|
2408
|
-
6,
|
|
2409
|
-
2,
|
|
2410
|
-
3,
|
|
2411
|
-
2,
|
|
2412
|
-
3,
|
|
2413
|
-
2,
|
|
2414
|
-
0,
|
|
2415
|
-
2,
|
|
2416
|
-
9,
|
|
2417
|
-
2,
|
|
2418
|
-
16,
|
|
2419
|
-
6,
|
|
2420
|
-
2,
|
|
2421
|
-
2,
|
|
2422
|
-
4,
|
|
2423
|
-
2,
|
|
2424
|
-
16,
|
|
2425
|
-
4421,
|
|
2426
|
-
42719,
|
|
2427
|
-
33,
|
|
2428
|
-
4381,
|
|
2429
|
-
3,
|
|
2430
|
-
5773,
|
|
2431
|
-
3,
|
|
2432
|
-
7472,
|
|
2433
|
-
16,
|
|
2434
|
-
621,
|
|
2435
|
-
2467,
|
|
2436
|
-
541,
|
|
2437
|
-
1507,
|
|
2438
|
-
4938,
|
|
2439
|
-
6,
|
|
2440
|
-
8489
|
|
2441
|
-
];
|
|
2442
|
-
const astralIdentifierCodes = [
|
|
2443
|
-
509,
|
|
2444
|
-
0,
|
|
2445
|
-
227,
|
|
2446
|
-
0,
|
|
2447
|
-
150,
|
|
2448
|
-
4,
|
|
2449
|
-
294,
|
|
2450
|
-
9,
|
|
2451
|
-
1368,
|
|
2452
|
-
2,
|
|
2453
|
-
2,
|
|
2454
|
-
1,
|
|
2455
|
-
6,
|
|
2456
|
-
3,
|
|
2457
|
-
41,
|
|
2458
|
-
2,
|
|
2459
|
-
5,
|
|
2460
|
-
0,
|
|
2461
|
-
166,
|
|
2462
|
-
1,
|
|
2463
|
-
574,
|
|
2464
|
-
3,
|
|
2465
|
-
9,
|
|
2466
|
-
9,
|
|
2467
|
-
7,
|
|
2468
|
-
9,
|
|
2469
|
-
32,
|
|
2470
|
-
4,
|
|
2471
|
-
318,
|
|
2472
|
-
1,
|
|
2473
|
-
78,
|
|
2474
|
-
5,
|
|
2475
|
-
71,
|
|
2476
|
-
10,
|
|
2477
|
-
50,
|
|
2478
|
-
3,
|
|
2479
|
-
123,
|
|
2480
|
-
2,
|
|
2481
|
-
54,
|
|
2482
|
-
14,
|
|
2483
|
-
32,
|
|
2484
|
-
10,
|
|
2485
|
-
3,
|
|
2486
|
-
1,
|
|
2487
|
-
11,
|
|
2488
|
-
3,
|
|
2489
|
-
46,
|
|
2490
|
-
10,
|
|
2491
|
-
8,
|
|
2492
|
-
0,
|
|
2493
|
-
46,
|
|
2494
|
-
9,
|
|
2495
|
-
7,
|
|
2496
|
-
2,
|
|
2497
|
-
37,
|
|
2498
|
-
13,
|
|
2499
|
-
2,
|
|
2500
|
-
9,
|
|
2501
|
-
6,
|
|
2502
|
-
1,
|
|
2503
|
-
45,
|
|
2504
|
-
0,
|
|
2505
|
-
13,
|
|
2506
|
-
2,
|
|
2507
|
-
49,
|
|
2508
|
-
13,
|
|
2509
|
-
9,
|
|
2510
|
-
3,
|
|
2511
|
-
2,
|
|
2512
|
-
11,
|
|
2513
|
-
83,
|
|
2514
|
-
11,
|
|
2515
|
-
7,
|
|
2516
|
-
0,
|
|
2517
|
-
3,
|
|
2518
|
-
0,
|
|
2519
|
-
158,
|
|
2520
|
-
11,
|
|
2521
|
-
6,
|
|
2522
|
-
9,
|
|
2523
|
-
7,
|
|
2524
|
-
3,
|
|
2525
|
-
56,
|
|
2526
|
-
1,
|
|
2527
|
-
2,
|
|
2528
|
-
6,
|
|
2529
|
-
3,
|
|
2530
|
-
1,
|
|
2531
|
-
3,
|
|
2532
|
-
2,
|
|
2533
|
-
10,
|
|
2534
|
-
0,
|
|
2535
|
-
11,
|
|
2536
|
-
1,
|
|
2537
|
-
3,
|
|
2538
|
-
6,
|
|
2539
|
-
4,
|
|
2540
|
-
4,
|
|
2541
|
-
68,
|
|
2542
|
-
8,
|
|
2543
|
-
2,
|
|
2544
|
-
0,
|
|
2545
|
-
3,
|
|
2546
|
-
0,
|
|
2547
|
-
2,
|
|
2548
|
-
3,
|
|
2549
|
-
2,
|
|
2550
|
-
4,
|
|
2551
|
-
2,
|
|
2552
|
-
0,
|
|
2553
|
-
15,
|
|
2554
|
-
1,
|
|
2555
|
-
83,
|
|
2556
|
-
17,
|
|
2557
|
-
10,
|
|
2558
|
-
9,
|
|
2559
|
-
5,
|
|
2560
|
-
0,
|
|
2561
|
-
82,
|
|
2562
|
-
19,
|
|
2563
|
-
13,
|
|
2564
|
-
9,
|
|
2565
|
-
214,
|
|
2566
|
-
6,
|
|
2567
|
-
3,
|
|
2568
|
-
8,
|
|
2569
|
-
28,
|
|
2570
|
-
1,
|
|
2571
|
-
83,
|
|
2572
|
-
16,
|
|
2573
|
-
16,
|
|
2574
|
-
9,
|
|
2575
|
-
82,
|
|
2576
|
-
12,
|
|
2577
|
-
9,
|
|
2578
|
-
9,
|
|
2579
|
-
7,
|
|
2580
|
-
19,
|
|
2581
|
-
58,
|
|
2582
|
-
14,
|
|
2583
|
-
5,
|
|
2584
|
-
9,
|
|
2585
|
-
243,
|
|
2586
|
-
14,
|
|
2587
|
-
166,
|
|
2588
|
-
9,
|
|
2589
|
-
71,
|
|
2590
|
-
5,
|
|
2591
|
-
2,
|
|
2592
|
-
1,
|
|
2593
|
-
3,
|
|
2594
|
-
3,
|
|
2595
|
-
2,
|
|
2596
|
-
0,
|
|
2597
|
-
2,
|
|
2598
|
-
1,
|
|
2599
|
-
13,
|
|
2600
|
-
9,
|
|
2601
|
-
120,
|
|
2602
|
-
6,
|
|
2603
|
-
3,
|
|
2604
|
-
6,
|
|
2605
|
-
4,
|
|
2606
|
-
0,
|
|
2607
|
-
29,
|
|
2608
|
-
9,
|
|
2609
|
-
41,
|
|
2610
|
-
6,
|
|
2611
|
-
2,
|
|
2612
|
-
3,
|
|
2613
|
-
9,
|
|
2614
|
-
0,
|
|
2615
|
-
10,
|
|
2616
|
-
10,
|
|
2617
|
-
47,
|
|
2618
|
-
15,
|
|
2619
|
-
199,
|
|
2620
|
-
7,
|
|
2621
|
-
137,
|
|
2622
|
-
9,
|
|
2623
|
-
54,
|
|
2624
|
-
7,
|
|
2625
|
-
2,
|
|
2626
|
-
7,
|
|
2627
|
-
17,
|
|
2628
|
-
9,
|
|
2629
|
-
57,
|
|
2630
|
-
21,
|
|
2631
|
-
2,
|
|
2632
|
-
13,
|
|
2633
|
-
123,
|
|
2634
|
-
5,
|
|
2635
|
-
4,
|
|
2636
|
-
0,
|
|
2637
|
-
2,
|
|
2638
|
-
1,
|
|
2639
|
-
2,
|
|
2640
|
-
6,
|
|
2641
|
-
2,
|
|
2642
|
-
0,
|
|
2643
|
-
9,
|
|
2644
|
-
9,
|
|
2645
|
-
49,
|
|
2646
|
-
4,
|
|
2647
|
-
2,
|
|
2648
|
-
1,
|
|
2649
|
-
2,
|
|
2650
|
-
4,
|
|
2651
|
-
9,
|
|
2652
|
-
9,
|
|
2653
|
-
55,
|
|
2654
|
-
9,
|
|
2655
|
-
266,
|
|
2656
|
-
3,
|
|
2657
|
-
10,
|
|
2658
|
-
1,
|
|
2659
|
-
2,
|
|
2660
|
-
0,
|
|
2661
|
-
49,
|
|
2662
|
-
6,
|
|
2663
|
-
4,
|
|
2664
|
-
4,
|
|
2665
|
-
14,
|
|
2666
|
-
10,
|
|
2667
|
-
5350,
|
|
2668
|
-
0,
|
|
2669
|
-
7,
|
|
2670
|
-
14,
|
|
2671
|
-
11465,
|
|
2672
|
-
27,
|
|
2673
|
-
2343,
|
|
2674
|
-
9,
|
|
2675
|
-
87,
|
|
2676
|
-
9,
|
|
2677
|
-
39,
|
|
2678
|
-
4,
|
|
2679
|
-
60,
|
|
2680
|
-
6,
|
|
2681
|
-
26,
|
|
2682
|
-
9,
|
|
2683
|
-
535,
|
|
2684
|
-
9,
|
|
2685
|
-
470,
|
|
2686
|
-
0,
|
|
2687
|
-
2,
|
|
2688
|
-
54,
|
|
2689
|
-
8,
|
|
2690
|
-
3,
|
|
2691
|
-
82,
|
|
2692
|
-
0,
|
|
2693
|
-
12,
|
|
2694
|
-
1,
|
|
2695
|
-
19628,
|
|
2696
|
-
1,
|
|
2697
|
-
4178,
|
|
2698
|
-
9,
|
|
2699
|
-
519,
|
|
2700
|
-
45,
|
|
2701
|
-
3,
|
|
2702
|
-
22,
|
|
2703
|
-
543,
|
|
2704
|
-
4,
|
|
2705
|
-
4,
|
|
2706
|
-
5,
|
|
2707
|
-
9,
|
|
2708
|
-
7,
|
|
2709
|
-
3,
|
|
2710
|
-
6,
|
|
2711
|
-
31,
|
|
2712
|
-
3,
|
|
2713
|
-
149,
|
|
2714
|
-
2,
|
|
2715
|
-
1418,
|
|
2716
|
-
49,
|
|
2717
|
-
513,
|
|
2718
|
-
54,
|
|
2719
|
-
5,
|
|
2720
|
-
49,
|
|
2721
|
-
9,
|
|
2722
|
-
0,
|
|
2723
|
-
15,
|
|
2724
|
-
0,
|
|
2725
|
-
23,
|
|
2726
|
-
4,
|
|
2727
|
-
2,
|
|
2728
|
-
14,
|
|
2729
|
-
1361,
|
|
2730
|
-
6,
|
|
2731
|
-
2,
|
|
2732
|
-
16,
|
|
2733
|
-
3,
|
|
2734
|
-
6,
|
|
2735
|
-
2,
|
|
2736
|
-
1,
|
|
2737
|
-
2,
|
|
2738
|
-
4,
|
|
2739
|
-
101,
|
|
2740
|
-
0,
|
|
2741
|
-
161,
|
|
2742
|
-
6,
|
|
2743
|
-
10,
|
|
2744
|
-
9,
|
|
2745
|
-
357,
|
|
2746
|
-
0,
|
|
2747
|
-
62,
|
|
2748
|
-
13,
|
|
2749
|
-
499,
|
|
2750
|
-
13,
|
|
2751
|
-
245,
|
|
2752
|
-
1,
|
|
2753
|
-
2,
|
|
2754
|
-
9,
|
|
2755
|
-
233,
|
|
2756
|
-
0,
|
|
2757
|
-
3,
|
|
2758
|
-
0,
|
|
2759
|
-
8,
|
|
2760
|
-
1,
|
|
2761
|
-
6,
|
|
2762
|
-
0,
|
|
2763
|
-
475,
|
|
2764
|
-
6,
|
|
2765
|
-
110,
|
|
2766
|
-
6,
|
|
2767
|
-
6,
|
|
2768
|
-
9,
|
|
2769
|
-
4759,
|
|
2770
|
-
9,
|
|
2771
|
-
787719,
|
|
2772
|
-
239
|
|
2773
|
-
];
|
|
2774
|
-
function isInAstralSet(code, set) {
|
|
2775
|
-
let pos = 65536;
|
|
2776
|
-
for (let i = 0, length = set.length; i < length; i += 2) {
|
|
2777
|
-
pos += set[i];
|
|
2778
|
-
if (pos > code) return false;
|
|
2779
|
-
pos += set[i + 1];
|
|
2780
|
-
if (pos >= code) return true;
|
|
2781
|
-
}
|
|
2782
|
-
return false;
|
|
2783
|
-
}
|
|
2784
|
-
function isIdentifierStart(code) {
|
|
2785
|
-
if (code < 65) return code === 36;
|
|
2786
|
-
if (code <= 90) return true;
|
|
2787
|
-
if (code < 97) return code === 95;
|
|
2788
|
-
if (code <= 122) return true;
|
|
2789
|
-
if (code <= 65535) return code >= 170 && nonASCIIidentifierStart.test(String.fromCharCode(code));
|
|
2790
|
-
return isInAstralSet(code, astralIdentifierStartCodes);
|
|
2791
|
-
}
|
|
2792
|
-
function isIdentifierChar(code) {
|
|
2793
|
-
if (code < 48) return code === 36;
|
|
2794
|
-
if (code < 58) return true;
|
|
2795
|
-
if (code < 65) return false;
|
|
2796
|
-
if (code <= 90) return true;
|
|
2797
|
-
if (code < 97) return code === 95;
|
|
2798
|
-
if (code <= 122) return true;
|
|
2799
|
-
if (code <= 65535) return code >= 170 && nonASCIIidentifier.test(String.fromCharCode(code));
|
|
2800
|
-
return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
|
|
2801
|
-
}
|
|
2802
|
-
function isIdentifierName(name) {
|
|
2803
|
-
let isFirst = true;
|
|
2804
|
-
for (let i = 0; i < name.length; i++) {
|
|
2805
|
-
let cp = name.charCodeAt(i);
|
|
2806
|
-
if ((cp & 64512) === 55296 && i + 1 < name.length) {
|
|
2807
|
-
const trail = name.charCodeAt(++i);
|
|
2808
|
-
if ((trail & 64512) === 56320) cp = 65536 + ((cp & 1023) << 10) + (trail & 1023);
|
|
2809
|
-
}
|
|
2810
|
-
if (isFirst) {
|
|
2811
|
-
isFirst = false;
|
|
2812
|
-
if (!isIdentifierStart(cp)) return false;
|
|
2813
|
-
} else if (!isIdentifierChar(cp)) return false;
|
|
2814
|
-
}
|
|
2815
|
-
return !isFirst;
|
|
2816
1693
|
}
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
var require_keyword = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2822
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2823
|
-
exports.isKeyword = isKeyword;
|
|
2824
|
-
exports.isReservedWord = isReservedWord;
|
|
2825
|
-
exports.isStrictBindOnlyReservedWord = isStrictBindOnlyReservedWord;
|
|
2826
|
-
exports.isStrictBindReservedWord = isStrictBindReservedWord;
|
|
2827
|
-
exports.isStrictReservedWord = isStrictReservedWord;
|
|
2828
|
-
const reservedWords = {
|
|
2829
|
-
keyword: [
|
|
2830
|
-
"break",
|
|
2831
|
-
"case",
|
|
2832
|
-
"catch",
|
|
2833
|
-
"continue",
|
|
2834
|
-
"debugger",
|
|
2835
|
-
"default",
|
|
2836
|
-
"do",
|
|
2837
|
-
"else",
|
|
2838
|
-
"finally",
|
|
2839
|
-
"for",
|
|
2840
|
-
"function",
|
|
2841
|
-
"if",
|
|
2842
|
-
"return",
|
|
2843
|
-
"switch",
|
|
2844
|
-
"throw",
|
|
2845
|
-
"try",
|
|
2846
|
-
"var",
|
|
2847
|
-
"const",
|
|
2848
|
-
"while",
|
|
2849
|
-
"with",
|
|
2850
|
-
"new",
|
|
2851
|
-
"this",
|
|
2852
|
-
"super",
|
|
2853
|
-
"class",
|
|
2854
|
-
"extends",
|
|
2855
|
-
"export",
|
|
2856
|
-
"import",
|
|
2857
|
-
"null",
|
|
2858
|
-
"true",
|
|
2859
|
-
"false",
|
|
2860
|
-
"in",
|
|
2861
|
-
"instanceof",
|
|
2862
|
-
"typeof",
|
|
2863
|
-
"void",
|
|
2864
|
-
"delete"
|
|
2865
|
-
],
|
|
2866
|
-
strict: [
|
|
2867
|
-
"implements",
|
|
2868
|
-
"interface",
|
|
2869
|
-
"let",
|
|
2870
|
-
"package",
|
|
2871
|
-
"private",
|
|
2872
|
-
"protected",
|
|
2873
|
-
"public",
|
|
2874
|
-
"static",
|
|
2875
|
-
"yield"
|
|
2876
|
-
],
|
|
2877
|
-
strictBind: ["eval", "arguments"]
|
|
1694
|
+
const url = new URL(value);
|
|
1695
|
+
return {
|
|
1696
|
+
pathname: url.pathname,
|
|
1697
|
+
query: toQueryObject(url.searchParams)
|
|
2878
1698
|
};
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
}
|
|
2885
|
-
|
|
2886
|
-
return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);
|
|
2887
|
-
}
|
|
2888
|
-
function isStrictBindOnlyReservedWord(word) {
|
|
2889
|
-
return reservedWordsStrictBindSet.has(word);
|
|
2890
|
-
}
|
|
2891
|
-
function isStrictBindReservedWord(word, inModule) {
|
|
2892
|
-
return isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word);
|
|
2893
|
-
}
|
|
2894
|
-
function isKeyword(word) {
|
|
2895
|
-
return keywords.has(word);
|
|
2896
|
-
}
|
|
2897
|
-
}));
|
|
2898
|
-
|
|
2899
|
-
//#endregion
|
|
2900
|
-
//#region node_modules/@babel/helper-validator-identifier/lib/index.js
|
|
2901
|
-
var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2902
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2903
|
-
Object.defineProperty(exports, "isIdentifierChar", {
|
|
2904
|
-
enumerable: true,
|
|
2905
|
-
get: function() {
|
|
2906
|
-
return _identifier.isIdentifierChar;
|
|
2907
|
-
}
|
|
2908
|
-
});
|
|
2909
|
-
Object.defineProperty(exports, "isIdentifierName", {
|
|
2910
|
-
enumerable: true,
|
|
2911
|
-
get: function() {
|
|
2912
|
-
return _identifier.isIdentifierName;
|
|
2913
|
-
}
|
|
2914
|
-
});
|
|
2915
|
-
Object.defineProperty(exports, "isIdentifierStart", {
|
|
2916
|
-
enumerable: true,
|
|
2917
|
-
get: function() {
|
|
2918
|
-
return _identifier.isIdentifierStart;
|
|
2919
|
-
}
|
|
2920
|
-
});
|
|
2921
|
-
Object.defineProperty(exports, "isKeyword", {
|
|
2922
|
-
enumerable: true,
|
|
2923
|
-
get: function() {
|
|
2924
|
-
return _keyword.isKeyword;
|
|
2925
|
-
}
|
|
2926
|
-
});
|
|
2927
|
-
Object.defineProperty(exports, "isReservedWord", {
|
|
2928
|
-
enumerable: true,
|
|
2929
|
-
get: function() {
|
|
2930
|
-
return _keyword.isReservedWord;
|
|
2931
|
-
}
|
|
2932
|
-
});
|
|
2933
|
-
Object.defineProperty(exports, "isStrictBindOnlyReservedWord", {
|
|
2934
|
-
enumerable: true,
|
|
2935
|
-
get: function() {
|
|
2936
|
-
return _keyword.isStrictBindOnlyReservedWord;
|
|
2937
|
-
}
|
|
2938
|
-
});
|
|
2939
|
-
Object.defineProperty(exports, "isStrictBindReservedWord", {
|
|
2940
|
-
enumerable: true,
|
|
2941
|
-
get: function() {
|
|
2942
|
-
return _keyword.isStrictBindReservedWord;
|
|
2943
|
-
}
|
|
2944
|
-
});
|
|
2945
|
-
Object.defineProperty(exports, "isStrictReservedWord", {
|
|
2946
|
-
enumerable: true,
|
|
2947
|
-
get: function() {
|
|
2948
|
-
return _keyword.isStrictReservedWord;
|
|
2949
|
-
}
|
|
2950
|
-
});
|
|
2951
|
-
var _identifier = require_identifier();
|
|
2952
|
-
var _keyword = require_keyword();
|
|
2953
|
-
}));
|
|
2954
|
-
|
|
2955
|
-
//#endregion
|
|
2956
|
-
//#region node_modules/@babel/code-frame/lib/index.js
|
|
2957
|
-
var require_lib = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2958
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2959
|
-
var picocolors = require_picocolors();
|
|
2960
|
-
var jsTokens = require_js_tokens();
|
|
2961
|
-
var helperValidatorIdentifier = require_lib$1();
|
|
2962
|
-
function isColorSupported() {
|
|
2963
|
-
return typeof process === "object" && (process.env.FORCE_COLOR === "0" || process.env.FORCE_COLOR === "false") ? false : picocolors.isColorSupported;
|
|
2964
|
-
}
|
|
2965
|
-
const compose = (f, g) => (v) => f(g(v));
|
|
2966
|
-
function buildDefs(colors) {
|
|
2967
|
-
return {
|
|
2968
|
-
keyword: colors.cyan,
|
|
2969
|
-
capitalized: colors.yellow,
|
|
2970
|
-
jsxIdentifier: colors.yellow,
|
|
2971
|
-
punctuator: colors.yellow,
|
|
2972
|
-
number: colors.magenta,
|
|
2973
|
-
string: colors.green,
|
|
2974
|
-
regex: colors.magenta,
|
|
2975
|
-
comment: colors.gray,
|
|
2976
|
-
invalid: compose(compose(colors.white, colors.bgRed), colors.bold),
|
|
2977
|
-
gutter: colors.gray,
|
|
2978
|
-
marker: compose(colors.red, colors.bold),
|
|
2979
|
-
message: compose(colors.red, colors.bold),
|
|
2980
|
-
reset: colors.reset
|
|
2981
|
-
};
|
|
2982
|
-
}
|
|
2983
|
-
const defsOn = buildDefs(picocolors.createColors(true));
|
|
2984
|
-
const defsOff = buildDefs(picocolors.createColors(false));
|
|
2985
|
-
function getDefs(enabled) {
|
|
2986
|
-
return enabled ? defsOn : defsOff;
|
|
2987
|
-
}
|
|
2988
|
-
const sometimesKeywords = new Set([
|
|
2989
|
-
"as",
|
|
2990
|
-
"async",
|
|
2991
|
-
"from",
|
|
2992
|
-
"get",
|
|
2993
|
-
"of",
|
|
2994
|
-
"set"
|
|
2995
|
-
]);
|
|
2996
|
-
const NEWLINE$1 = /\r\n|[\n\r\u2028\u2029]/;
|
|
2997
|
-
const BRACKET = /^[()[\]{}]$/;
|
|
2998
|
-
let tokenize;
|
|
2999
|
-
{
|
|
3000
|
-
const JSX_TAG = /^[a-z][\w-]*$/i;
|
|
3001
|
-
const getTokenType = function(token, offset, text) {
|
|
3002
|
-
if (token.type === "name") {
|
|
3003
|
-
if (helperValidatorIdentifier.isKeyword(token.value) || helperValidatorIdentifier.isStrictReservedWord(token.value, true) || sometimesKeywords.has(token.value)) return "keyword";
|
|
3004
|
-
if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.slice(offset - 2, offset) === "</")) return "jsxIdentifier";
|
|
3005
|
-
if (token.value[0] !== token.value[0].toLowerCase()) return "capitalized";
|
|
3006
|
-
}
|
|
3007
|
-
if (token.type === "punctuator" && BRACKET.test(token.value)) return "bracket";
|
|
3008
|
-
if (token.type === "invalid" && (token.value === "@" || token.value === "#")) return "punctuator";
|
|
3009
|
-
return token.type;
|
|
3010
|
-
};
|
|
3011
|
-
tokenize = function* (text) {
|
|
3012
|
-
let match;
|
|
3013
|
-
while (match = jsTokens.default.exec(text)) {
|
|
3014
|
-
const token = jsTokens.matchToToken(match);
|
|
3015
|
-
yield {
|
|
3016
|
-
type: getTokenType(token, match.index, text),
|
|
3017
|
-
value: token.value
|
|
3018
|
-
};
|
|
3019
|
-
}
|
|
3020
|
-
};
|
|
3021
|
-
}
|
|
3022
|
-
function highlight(text) {
|
|
3023
|
-
if (text === "") return "";
|
|
3024
|
-
const defs = getDefs(true);
|
|
3025
|
-
let highlighted = "";
|
|
3026
|
-
for (const { type, value } of tokenize(text)) if (type in defs) highlighted += value.split(NEWLINE$1).map((str) => defs[type](str)).join("\n");
|
|
3027
|
-
else highlighted += value;
|
|
3028
|
-
return highlighted;
|
|
3029
|
-
}
|
|
3030
|
-
const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
|
|
3031
|
-
function getMarkerLines(loc, source, opts) {
|
|
3032
|
-
const startLoc = Object.assign({
|
|
3033
|
-
column: 0,
|
|
3034
|
-
line: -1
|
|
3035
|
-
}, loc.start);
|
|
3036
|
-
const endLoc = Object.assign({}, startLoc, loc.end);
|
|
3037
|
-
const { linesAbove = 2, linesBelow = 3 } = opts || {};
|
|
3038
|
-
const startLine = startLoc.line;
|
|
3039
|
-
const startColumn = startLoc.column;
|
|
3040
|
-
const endLine = endLoc.line;
|
|
3041
|
-
const endColumn = endLoc.column;
|
|
3042
|
-
let start = Math.max(startLine - (linesAbove + 1), 0);
|
|
3043
|
-
let end = Math.min(source.length, endLine + linesBelow);
|
|
3044
|
-
if (startLine === -1) start = 0;
|
|
3045
|
-
if (endLine === -1) end = source.length;
|
|
3046
|
-
const lineDiff = endLine - startLine;
|
|
3047
|
-
const markerLines = {};
|
|
3048
|
-
if (lineDiff) for (let i = 0; i <= lineDiff; i++) {
|
|
3049
|
-
const lineNumber = i + startLine;
|
|
3050
|
-
if (!startColumn) markerLines[lineNumber] = true;
|
|
3051
|
-
else if (i === 0) markerLines[lineNumber] = [startColumn, source[lineNumber - 1].length - startColumn + 1];
|
|
3052
|
-
else if (i === lineDiff) markerLines[lineNumber] = [0, endColumn];
|
|
3053
|
-
else markerLines[lineNumber] = [0, source[lineNumber - i].length];
|
|
3054
|
-
}
|
|
3055
|
-
else if (startColumn === endColumn) if (startColumn) markerLines[startLine] = [startColumn, 0];
|
|
3056
|
-
else markerLines[startLine] = true;
|
|
3057
|
-
else markerLines[startLine] = [startColumn, endColumn - startColumn];
|
|
3058
|
-
return {
|
|
3059
|
-
start,
|
|
3060
|
-
end,
|
|
3061
|
-
markerLines
|
|
3062
|
-
};
|
|
3063
|
-
}
|
|
3064
|
-
function codeFrameColumns(rawLines, loc, opts = {}) {
|
|
3065
|
-
const shouldHighlight = opts.forceColor || isColorSupported() && opts.highlightCode;
|
|
3066
|
-
const defs = getDefs(shouldHighlight);
|
|
3067
|
-
const { start, end, markerLines } = getMarkerLines(loc, rawLines.split(NEWLINE), opts);
|
|
3068
|
-
const hasColumns = loc.start && typeof loc.start.column === "number";
|
|
3069
|
-
const numberMaxWidth = String(end).length;
|
|
3070
|
-
let frame = (shouldHighlight ? highlight(rawLines) : rawLines).split(NEWLINE, end).slice(start, end).map((line, index) => {
|
|
3071
|
-
const number = start + 1 + index;
|
|
3072
|
-
const gutter = ` ${` ${number}`.slice(-numberMaxWidth)} |`;
|
|
3073
|
-
const hasMarker = markerLines[number];
|
|
3074
|
-
const lastMarkerLine = !markerLines[number + 1];
|
|
3075
|
-
if (hasMarker) {
|
|
3076
|
-
let markerLine = "";
|
|
3077
|
-
if (Array.isArray(hasMarker)) {
|
|
3078
|
-
const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
|
|
3079
|
-
const numberOfMarkers = hasMarker[1] || 1;
|
|
3080
|
-
markerLine = [
|
|
3081
|
-
"\n ",
|
|
3082
|
-
defs.gutter(gutter.replace(/\d/g, " ")),
|
|
3083
|
-
" ",
|
|
3084
|
-
markerSpacing,
|
|
3085
|
-
defs.marker("^").repeat(numberOfMarkers)
|
|
3086
|
-
].join("");
|
|
3087
|
-
if (lastMarkerLine && opts.message) markerLine += " " + defs.message(opts.message);
|
|
3088
|
-
}
|
|
3089
|
-
return [
|
|
3090
|
-
defs.marker(">"),
|
|
3091
|
-
defs.gutter(gutter),
|
|
3092
|
-
line.length > 0 ? ` ${line}` : "",
|
|
3093
|
-
markerLine
|
|
3094
|
-
].join("");
|
|
3095
|
-
} else return ` ${defs.gutter(gutter)}${line.length > 0 ? ` ${line}` : ""}`;
|
|
3096
|
-
}).join("\n");
|
|
3097
|
-
if (opts.message && !hasColumns) frame = `${" ".repeat(numberMaxWidth + 1)}${opts.message}\n${frame}`;
|
|
3098
|
-
if (shouldHighlight) return defs.reset(frame);
|
|
3099
|
-
else return frame;
|
|
3100
|
-
}
|
|
3101
|
-
exports.codeFrameColumns = codeFrameColumns;
|
|
3102
|
-
}));
|
|
1699
|
+
}
|
|
1700
|
+
function toQueryObject(searchParams) {
|
|
1701
|
+
return searchParams.entries().reduce((acc, [key, value]) => ({
|
|
1702
|
+
...acc,
|
|
1703
|
+
[key]: value
|
|
1704
|
+
}), {});
|
|
1705
|
+
}
|
|
3103
1706
|
|
|
3104
1707
|
//#endregion
|
|
3105
1708
|
//#region src/server/symbolicate.ts
|
|
3106
|
-
var import_lib = require_lib();
|
|
3107
1709
|
/**
|
|
3108
1710
|
* @see https://github.com/facebook/react-native/blob/0.83-stable/packages/metro-config/src/index.flow.js#L17
|
|
3109
1711
|
*/
|
|
@@ -3142,10 +1744,10 @@ function originalPositionFor(sourceMapConsumer, frame) {
|
|
|
3142
1744
|
column: frame.column,
|
|
3143
1745
|
line: frame.lineNumber
|
|
3144
1746
|
});
|
|
3145
|
-
return Object.entries(originalPosition).reduce((frame
|
|
1747
|
+
return Object.entries(originalPosition).reduce((frame, [key, value]) => {
|
|
3146
1748
|
const targetKey = convertFrameKey(key);
|
|
3147
1749
|
return {
|
|
3148
|
-
...frame
|
|
1750
|
+
...frame,
|
|
3149
1751
|
...value ? { [targetKey]: value } : null
|
|
3150
1752
|
};
|
|
3151
1753
|
}, frame);
|
|
@@ -3166,17 +1768,17 @@ function convertFrameKey(key) {
|
|
|
3166
1768
|
return key;
|
|
3167
1769
|
}
|
|
3168
1770
|
function getCodeFrame(sourceMapConsumer, frames, bundle) {
|
|
3169
|
-
const frame = frames.find((frame
|
|
3170
|
-
return frame
|
|
1771
|
+
const frame = frames.find((frame) => {
|
|
1772
|
+
return frame.lineNumber != null && frame.column != null && !isCollapsed(frame);
|
|
3171
1773
|
});
|
|
3172
1774
|
if (frame?.file == null || frame.column == null || frame.lineNumber == null) return null;
|
|
3173
1775
|
try {
|
|
3174
1776
|
const { lineNumber, column, file } = frame;
|
|
3175
1777
|
const unresolved = file.startsWith("http");
|
|
3176
1778
|
const source = unresolved ? bundle.code : sourceMapConsumer.sourceContentFor(frame.file);
|
|
3177
|
-
const fileName = unresolved ?
|
|
1779
|
+
const fileName = unresolved ? parseUrl(file).pathname ?? "unknown" : file;
|
|
3178
1780
|
let content = "";
|
|
3179
|
-
if (source) content =
|
|
1781
|
+
if (source) content = codeFrameColumns(source, { start: {
|
|
3180
1782
|
column,
|
|
3181
1783
|
line: lineNumber
|
|
3182
1784
|
} }, { highlightCode: true });
|
|
@@ -3214,7 +1816,7 @@ const plugin = fp((fastify, options) => {
|
|
|
3214
1816
|
const { stack } = request.body;
|
|
3215
1817
|
const bundleUrl = stack.find((frame) => frame.file?.startsWith("http"));
|
|
3216
1818
|
invariant(bundleUrl?.file, "No bundle URL found in stack frames");
|
|
3217
|
-
const { pathname, query } =
|
|
1819
|
+
const { pathname, query } = parseUrl(bundleUrl.file);
|
|
3218
1820
|
invariant(pathname, "No pathname found in bundle URL");
|
|
3219
1821
|
invariant(query.platform, "No platform found in query");
|
|
3220
1822
|
invariant(query.dev, "No dev found in query");
|
|
@@ -3235,7 +1837,7 @@ var WebSocketServer = class extends EventEmitter {
|
|
|
3235
1837
|
logger;
|
|
3236
1838
|
constructor(name, options) {
|
|
3237
1839
|
super();
|
|
3238
|
-
const logger
|
|
1840
|
+
const logger = logger$1.child(name);
|
|
3239
1841
|
const wss = new ws.WebSocketServer(options);
|
|
3240
1842
|
wss.on("connection", (socket) => {
|
|
3241
1843
|
const client = Object.defineProperty(socket, "id", {
|
|
@@ -3258,7 +1860,7 @@ var WebSocketServer = class extends EventEmitter {
|
|
|
3258
1860
|
});
|
|
3259
1861
|
});
|
|
3260
1862
|
this.wss = wss;
|
|
3261
|
-
this.logger = logger
|
|
1863
|
+
this.logger = logger;
|
|
3262
1864
|
}
|
|
3263
1865
|
get server() {
|
|
3264
1866
|
return this.wss;
|
|
@@ -3283,11 +1885,11 @@ function getWebSocketUpgradeHandler(websocketEndpoints) {
|
|
|
3283
1885
|
socket.destroy();
|
|
3284
1886
|
return;
|
|
3285
1887
|
}
|
|
3286
|
-
const { pathname } =
|
|
1888
|
+
const { pathname } = parseUrl(request.url);
|
|
3287
1889
|
if (pathname != null && websocketEndpoints[pathname]) {
|
|
3288
1890
|
const wss = websocketEndpoints[pathname];
|
|
3289
|
-
wss.handleUpgrade(request, socket, head, (socket
|
|
3290
|
-
wss.emit("connection", socket
|
|
1891
|
+
wss.handleUpgrade(request, socket, head, (socket) => {
|
|
1892
|
+
wss.emit("connection", socket, request);
|
|
3291
1893
|
});
|
|
3292
1894
|
} else socket.destroy();
|
|
3293
1895
|
};
|
|
@@ -3416,8 +2018,8 @@ var HMRServer = class extends WebSocketServer {
|
|
|
3416
2018
|
sendError(client, error) {
|
|
3417
2019
|
try {
|
|
3418
2020
|
this.send(client, JSON.stringify(error));
|
|
3419
|
-
} catch (error
|
|
3420
|
-
this.logger.error(`Failed to send HMR error message to client (clientId: ${client.id})`, error
|
|
2021
|
+
} catch (error) {
|
|
2022
|
+
this.logger.error(`Failed to send HMR error message to client (clientId: ${client.id})`, error);
|
|
3421
2023
|
}
|
|
3422
2024
|
}
|
|
3423
2025
|
cleanup(client) {
|
|
@@ -3448,12 +2050,12 @@ var HMRServer = class extends WebSocketServer {
|
|
|
3448
2050
|
};
|
|
3449
2051
|
this.logger.trace("HMR client message received", traceMessage);
|
|
3450
2052
|
} catch (error) {
|
|
3451
|
-
const message
|
|
3452
|
-
this.logger.error(message
|
|
2053
|
+
const message = "Failed to parse HMR client message";
|
|
2054
|
+
this.logger.error(message, error);
|
|
3453
2055
|
this.sendError(client, {
|
|
3454
2056
|
type: "InternalError",
|
|
3455
2057
|
errors: [{ description: error instanceof Error ? error.message : String(error) }],
|
|
3456
|
-
message
|
|
2058
|
+
message
|
|
3457
2059
|
});
|
|
3458
2060
|
return;
|
|
3459
2061
|
}
|
|
@@ -3514,7 +2116,7 @@ async function createDevServer(config, options) {
|
|
|
3514
2116
|
projectRoot,
|
|
3515
2117
|
port
|
|
3516
2118
|
});
|
|
3517
|
-
const emitter =
|
|
2119
|
+
const emitter = mitt();
|
|
3518
2120
|
const fastify = Fastify({
|
|
3519
2121
|
loggerInstance: new DevServerLogger(),
|
|
3520
2122
|
disableRequestLogging: true
|
|
@@ -3550,7 +2152,7 @@ async function createDevServer(config, options) {
|
|
|
3550
2152
|
bundlerPool,
|
|
3551
2153
|
reportEvent: (event) => {
|
|
3552
2154
|
reportEvent?.(event);
|
|
3553
|
-
config.reporter
|
|
2155
|
+
config.reporter?.update(event);
|
|
3554
2156
|
}
|
|
3555
2157
|
}).on("connection", (client) => emitter.emit("device.connected", { client })).on("message", (client, data) => emitter.emit("device.message", {
|
|
3556
2158
|
client,
|
|
@@ -3600,9 +2202,9 @@ async function createDevServer(config, options) {
|
|
|
3600
2202
|
}
|
|
3601
2203
|
async function invokeConfigureServer(server, plugins) {
|
|
3602
2204
|
const postConfigureServerHandlers = [];
|
|
3603
|
-
for (const plugin
|
|
3604
|
-
const context = createPluginContext(plugin
|
|
3605
|
-
const result = await plugin
|
|
2205
|
+
for (const plugin of plugins) {
|
|
2206
|
+
const context = createPluginContext(plugin.name);
|
|
2207
|
+
const result = await plugin.configureServer?.call(context, server);
|
|
3606
2208
|
if (typeof result === "function") postConfigureServerHandlers.push(result);
|
|
3607
2209
|
}
|
|
3608
2210
|
return { invokePostConfigureServer: async () => {
|
|
@@ -3662,7 +2264,7 @@ async function resolveScaledAssets(options) {
|
|
|
3662
2264
|
const files = fs.readdirSync(dirname);
|
|
3663
2265
|
const stripedBasename = stripSuffix(assetPath, context);
|
|
3664
2266
|
const suffixPattern = platformSuffixPattern(context);
|
|
3665
|
-
const assetRegExp =
|
|
2267
|
+
const assetRegExp = new RegExp(`${stripedBasename}(${SCALE_PATTERN})?(?:${suffixPattern})?${extension}$`);
|
|
3666
2268
|
const scaledAssets = {};
|
|
3667
2269
|
for (const file of files.sort((a, b) => getAssetPriority(b, context) - getAssetPriority(a, context))) {
|
|
3668
2270
|
const match = assetRegExp.exec(file);
|
|
@@ -3707,13 +2309,13 @@ function stripSuffix(assetPath, context) {
|
|
|
3707
2309
|
const basename = path.basename(assetPath);
|
|
3708
2310
|
const extension = path.extname(assetPath);
|
|
3709
2311
|
const suffixPattern = platformSuffixPattern(context);
|
|
3710
|
-
return basename.replace(
|
|
2312
|
+
return basename.replace(new RegExp(`(${SCALE_PATTERN})?(?:${suffixPattern})?${extension}$`), "");
|
|
3711
2313
|
}
|
|
3712
2314
|
function getAssetPriority(assetPath, context) {
|
|
3713
2315
|
const suffixPattern = platformSuffixPattern(context);
|
|
3714
|
-
if (
|
|
3715
|
-
else if (
|
|
3716
|
-
else if (
|
|
2316
|
+
if (new RegExp(`${SCALE_PATTERN}(?:${suffixPattern})`).test(assetPath)) return 3;
|
|
2317
|
+
else if (new RegExp(`(?:${suffixPattern})`).test(assetPath)) return 2;
|
|
2318
|
+
else if (new RegExp(`${SCALE_PATTERN}`).test(assetPath)) return 1;
|
|
3717
2319
|
return 0;
|
|
3718
2320
|
}
|
|
3719
2321
|
function addSuffix(assetPath, context, options) {
|
|
@@ -3796,10 +2398,10 @@ async function copyAssetsToDestination(options) {
|
|
|
3796
2398
|
return Promise.all(assets.map((asset) => {
|
|
3797
2399
|
return Promise.all(asset.scales.map(async (scale) => {
|
|
3798
2400
|
if (platform !== "android") {
|
|
3799
|
-
const from
|
|
3800
|
-
const to
|
|
3801
|
-
mkdirWithAssertPath(to
|
|
3802
|
-
return fs.copyFileSync(from
|
|
2401
|
+
const from = resolveAssetPath(asset.id, context, scale);
|
|
2402
|
+
const to = path.join(assetsDir, getIosAssetDestinationPath(asset, scale));
|
|
2403
|
+
mkdirWithAssertPath(to);
|
|
2404
|
+
return fs.copyFileSync(from, to);
|
|
3803
2405
|
}
|
|
3804
2406
|
const from = resolveAssetPath(asset.id, context, scale);
|
|
3805
2407
|
const to = path.join(assetsDir, getAndroidAssetDestinationPath(asset, scale));
|
|
@@ -3846,15 +2448,15 @@ function generateAssetRegistryCode(assetRegistryPath, asset) {
|
|
|
3846
2448
|
//#endregion
|
|
3847
2449
|
//#region src/core/plugins/utils/transform-utils.ts
|
|
3848
2450
|
const TRANSFORM_FLAGS_KEY = Symbol("transform-flags");
|
|
3849
|
-
let TransformFlag = /* @__PURE__ */ function(TransformFlag
|
|
3850
|
-
TransformFlag
|
|
3851
|
-
TransformFlag
|
|
3852
|
-
TransformFlag
|
|
3853
|
-
TransformFlag
|
|
3854
|
-
return TransformFlag
|
|
2451
|
+
let TransformFlag = /* @__PURE__ */ function(TransformFlag) {
|
|
2452
|
+
TransformFlag[TransformFlag["NONE"] = 0] = "NONE";
|
|
2453
|
+
TransformFlag[TransformFlag["CODEGEN_REQUIRED"] = 1] = "CODEGEN_REQUIRED";
|
|
2454
|
+
TransformFlag[TransformFlag["STRIP_FLOW_REQUIRED"] = 2] = "STRIP_FLOW_REQUIRED";
|
|
2455
|
+
TransformFlag[TransformFlag["SKIP_ALL"] = 128] = "SKIP_ALL";
|
|
2456
|
+
return TransformFlag;
|
|
3855
2457
|
}({});
|
|
3856
|
-
function setFlag(context, id
|
|
3857
|
-
const moduleInfo = context.getModuleInfo(id
|
|
2458
|
+
function setFlag(context, id, flag, options) {
|
|
2459
|
+
const moduleInfo = context.getModuleInfo(id);
|
|
3858
2460
|
if (moduleInfo && hasFlag(moduleInfo.meta)) {
|
|
3859
2461
|
if (options?.override) moduleInfo.meta[TRANSFORM_FLAGS_KEY] = flag;
|
|
3860
2462
|
else moduleInfo.meta[TRANSFORM_FLAGS_KEY] |= flag;
|
|
@@ -3864,8 +2466,8 @@ function setFlag(context, id$1, flag, options) {
|
|
|
3864
2466
|
function hasFlag(meta) {
|
|
3865
2467
|
return TRANSFORM_FLAGS_KEY in meta;
|
|
3866
2468
|
}
|
|
3867
|
-
function getFlag(context, id
|
|
3868
|
-
return getFlagFromModuleInfo(context.getModuleInfo(id
|
|
2469
|
+
function getFlag(context, id) {
|
|
2470
|
+
return getFlagFromModuleInfo(context.getModuleInfo(id));
|
|
3869
2471
|
}
|
|
3870
2472
|
function getFlagFromModuleInfo(moduleInfo) {
|
|
3871
2473
|
if (moduleInfo && hasFlag(moduleInfo.meta)) return moduleInfo.meta[TRANSFORM_FLAGS_KEY];
|
|
@@ -3878,18 +2480,18 @@ function withTransformBoundary(plugins, options) {
|
|
|
3878
2480
|
name: "rollipop:transform-initializer",
|
|
3879
2481
|
transform: {
|
|
3880
2482
|
order: "pre",
|
|
3881
|
-
handler(_code, id
|
|
3882
|
-
if (context.state.hmrUpdates.has(id
|
|
3883
|
-
context.state.hmrUpdates.delete(id
|
|
3884
|
-
return { meta: setFlag(this, id
|
|
2483
|
+
handler(_code, id) {
|
|
2484
|
+
if (context.state.hmrUpdates.has(id)) {
|
|
2485
|
+
context.state.hmrUpdates.delete(id);
|
|
2486
|
+
return { meta: setFlag(this, id, TransformFlag.NONE, { override: true }) };
|
|
3885
2487
|
}
|
|
3886
2488
|
}
|
|
3887
2489
|
}
|
|
3888
2490
|
},
|
|
3889
2491
|
{
|
|
3890
2492
|
name: "rollipop:transform-change-watcher",
|
|
3891
|
-
watchChange(id
|
|
3892
|
-
context.state.hmrUpdates.add(id
|
|
2493
|
+
watchChange(id) {
|
|
2494
|
+
context.state.hmrUpdates.add(id);
|
|
3893
2495
|
}
|
|
3894
2496
|
},
|
|
3895
2497
|
options?.beforeTransform,
|
|
@@ -3906,8 +2508,8 @@ function getPersistCachePlugins(options) {
|
|
|
3906
2508
|
afterTransform: null
|
|
3907
2509
|
};
|
|
3908
2510
|
const { sourceExtensions, context } = options;
|
|
3909
|
-
const includePattern =
|
|
3910
|
-
const filter = [exclude(id(/@oxc-project\+runtime/)), include(id(includePattern))];
|
|
2511
|
+
const includePattern = new RegExp(`\\.(?:${sourceExtensions.join("|")})$`);
|
|
2512
|
+
const filter = [exclude(or(id(/rolldown\/runtime/), id(/@oxc-project\+runtime/))), include(id(includePattern))];
|
|
3911
2513
|
let cacheHits = 0;
|
|
3912
2514
|
return {
|
|
3913
2515
|
beforeTransform: {
|
|
@@ -3921,15 +2523,15 @@ function getPersistCachePlugins(options) {
|
|
|
3921
2523
|
transform: {
|
|
3922
2524
|
order: "pre",
|
|
3923
2525
|
filter,
|
|
3924
|
-
handler(_code, id
|
|
3925
|
-
const key = getCacheKey(id
|
|
2526
|
+
handler(_code, id) {
|
|
2527
|
+
const key = getCacheKey(id, context.id);
|
|
3926
2528
|
const cache = context.cache.get(key);
|
|
3927
2529
|
if (cache != null) {
|
|
3928
2530
|
cacheHits++;
|
|
3929
2531
|
return {
|
|
3930
2532
|
code: cache,
|
|
3931
2533
|
moduleType: "tsx",
|
|
3932
|
-
meta: setFlag(this, id
|
|
2534
|
+
meta: setFlag(this, id, TransformFlag.SKIP_ALL)
|
|
3933
2535
|
};
|
|
3934
2536
|
}
|
|
3935
2537
|
}
|
|
@@ -3940,9 +2542,9 @@ function getPersistCachePlugins(options) {
|
|
|
3940
2542
|
transform: {
|
|
3941
2543
|
order: "post",
|
|
3942
2544
|
filter,
|
|
3943
|
-
handler(code, id
|
|
3944
|
-
if (getFlag(this, id
|
|
3945
|
-
context.cache.set(getCacheKey(id
|
|
2545
|
+
handler(code, id) {
|
|
2546
|
+
if (getFlag(this, id) & TransformFlag.SKIP_ALL) return;
|
|
2547
|
+
context.cache.set(getCacheKey(id, context.id), code);
|
|
3946
2548
|
}
|
|
3947
2549
|
},
|
|
3948
2550
|
buildEnd() {
|
|
@@ -3951,60 +2553,60 @@ function getPersistCachePlugins(options) {
|
|
|
3951
2553
|
}
|
|
3952
2554
|
};
|
|
3953
2555
|
}
|
|
3954
|
-
function getCacheKey(id
|
|
3955
|
-
const { mtimeMs } = fs.statSync(id
|
|
3956
|
-
return xxhash(`${id
|
|
2556
|
+
function getCacheKey(id, buildHash) {
|
|
2557
|
+
const { mtimeMs } = fs.statSync(id);
|
|
2558
|
+
return xxhash(`${id}${buildHash}${mtimeMs}`);
|
|
3957
2559
|
}
|
|
3958
2560
|
/**
|
|
3959
2561
|
* Enhance a plugin to cache the result. (transform hook only)
|
|
3960
2562
|
*/
|
|
3961
|
-
function cacheable(plugin
|
|
2563
|
+
function cacheable(plugin) {
|
|
3962
2564
|
let configured = false;
|
|
3963
|
-
const originalTransform = plugin
|
|
2565
|
+
const originalTransform = plugin.transform;
|
|
3964
2566
|
if (typeof originalTransform === "function") {
|
|
3965
|
-
plugin
|
|
3966
|
-
if (getFlag(this, id
|
|
3967
|
-
return originalTransform.call(this, code, id
|
|
2567
|
+
plugin.transform = function(code, id, meta) {
|
|
2568
|
+
if (getFlag(this, id) & TransformFlag.SKIP_ALL) return;
|
|
2569
|
+
return originalTransform.call(this, code, id, meta);
|
|
3968
2570
|
};
|
|
3969
2571
|
configured = true;
|
|
3970
2572
|
}
|
|
3971
2573
|
if (typeof originalTransform === "object") {
|
|
3972
|
-
plugin
|
|
2574
|
+
plugin.transform = {
|
|
3973
2575
|
...originalTransform,
|
|
3974
|
-
handler(code, id
|
|
3975
|
-
if (getFlag(this, id
|
|
3976
|
-
return originalTransform.handler.call(this, code, id
|
|
2576
|
+
handler(code, id, meta) {
|
|
2577
|
+
if (getFlag(this, id) & TransformFlag.SKIP_ALL) return;
|
|
2578
|
+
return originalTransform.handler.call(this, code, id, meta);
|
|
3977
2579
|
}
|
|
3978
2580
|
};
|
|
3979
2581
|
configured = true;
|
|
3980
2582
|
}
|
|
3981
|
-
if (configured) plugin
|
|
3982
|
-
else logger$2.warn(`Plugin '${plugin
|
|
3983
|
-
return plugin
|
|
2583
|
+
if (configured) plugin.name = `${plugin.name}:cacheable`;
|
|
2584
|
+
else logger$2.warn(`Plugin '${plugin.name}' is could not be cached`);
|
|
2585
|
+
return plugin;
|
|
3984
2586
|
}
|
|
3985
2587
|
|
|
3986
2588
|
//#endregion
|
|
3987
2589
|
//#region src/core/plugins/utils/source.ts
|
|
3988
2590
|
const TS_EXTENSION_REGEXP = /\.tsx?$/;
|
|
3989
|
-
function isTS(id
|
|
3990
|
-
return TS_EXTENSION_REGEXP.test(id
|
|
2591
|
+
function isTS(id) {
|
|
2592
|
+
return TS_EXTENSION_REGEXP.test(id);
|
|
3991
2593
|
}
|
|
3992
|
-
function isJSX(id
|
|
3993
|
-
return id
|
|
2594
|
+
function isJSX(id) {
|
|
2595
|
+
return id.endsWith("x");
|
|
3994
2596
|
}
|
|
3995
2597
|
|
|
3996
2598
|
//#endregion
|
|
3997
2599
|
//#region src/core/plugins/react-native-plugin.ts
|
|
3998
2600
|
function reactNativePlugin(config, options) {
|
|
3999
2601
|
const { buildType, flowFilter, codegenFilter, assetsDir, assetExtensions, assetRegistryPath } = options;
|
|
4000
|
-
const assetExtensionRegex =
|
|
2602
|
+
const assetExtensionRegex = new RegExp(`\\.(?:${assetExtensions.join("|")})$`);
|
|
4001
2603
|
const codegenPlugin = {
|
|
4002
2604
|
name: "rollipop:react-native-codegen-marker",
|
|
4003
2605
|
transform: {
|
|
4004
2606
|
order: "pre",
|
|
4005
2607
|
filter: codegenFilter,
|
|
4006
|
-
handler(_code, id
|
|
4007
|
-
return { meta: setFlag(this, id
|
|
2608
|
+
handler(_code, id) {
|
|
2609
|
+
return { meta: setFlag(this, id, TransformFlag.CODEGEN_REQUIRED) };
|
|
4008
2610
|
}
|
|
4009
2611
|
}
|
|
4010
2612
|
};
|
|
@@ -4013,11 +2615,11 @@ function reactNativePlugin(config, options) {
|
|
|
4013
2615
|
transform: {
|
|
4014
2616
|
order: "pre",
|
|
4015
2617
|
filter: flowFilter,
|
|
4016
|
-
handler(code, id
|
|
4017
|
-
const flags = getFlag(this, id
|
|
2618
|
+
handler(code, id) {
|
|
2619
|
+
const flags = getFlag(this, id);
|
|
4018
2620
|
if (flags & TransformFlag.SKIP_ALL) return;
|
|
4019
|
-
if (flags & TransformFlag.CODEGEN_REQUIRED) return { meta: setFlag(this, id
|
|
4020
|
-
const result = generateSourceFromAst(stripFlowSyntax(code), id
|
|
2621
|
+
if (flags & TransformFlag.CODEGEN_REQUIRED) return { meta: setFlag(this, id, TransformFlag.STRIP_FLOW_REQUIRED) };
|
|
2622
|
+
const result = generateSourceFromAst(stripFlowSyntax(code), id);
|
|
4021
2623
|
return {
|
|
4022
2624
|
code: result.code,
|
|
4023
2625
|
map: result.map,
|
|
@@ -4031,18 +2633,18 @@ function reactNativePlugin(config, options) {
|
|
|
4031
2633
|
name: "rollipop:react-native-asset",
|
|
4032
2634
|
load: {
|
|
4033
2635
|
filter: [include(id(assetExtensionRegex))],
|
|
4034
|
-
async handler(id
|
|
4035
|
-
this.debug(`Asset ${id
|
|
2636
|
+
async handler(id) {
|
|
2637
|
+
this.debug(`Asset ${id} found`);
|
|
4036
2638
|
const assetData = await resolveScaledAssets({
|
|
4037
2639
|
projectRoot: config.root,
|
|
4038
|
-
assetPath: id
|
|
2640
|
+
assetPath: id,
|
|
4039
2641
|
platform: options.platform,
|
|
4040
2642
|
preferNativePlatform: config.resolver.preferNativePlatform
|
|
4041
2643
|
});
|
|
4042
2644
|
assets.push(assetData);
|
|
4043
2645
|
return {
|
|
4044
2646
|
code: generateAssetRegistryCode(assetRegistryPath, assetData),
|
|
4045
|
-
meta: setFlag(this, id
|
|
2647
|
+
meta: setFlag(this, id, TransformFlag.SKIP_ALL),
|
|
4046
2648
|
moduleType: "js"
|
|
4047
2649
|
};
|
|
4048
2650
|
}
|
|
@@ -4070,15 +2672,15 @@ function reactNativePlugin(config, options) {
|
|
|
4070
2672
|
name: "rollipop:react-native-replace-hmr-client",
|
|
4071
2673
|
resolveId: {
|
|
4072
2674
|
filter: [include(id(/\/HMRClient\.js$/))],
|
|
4073
|
-
async handler(id
|
|
4074
|
-
const resolvedId = await this.resolve(id
|
|
2675
|
+
async handler(id, importer) {
|
|
2676
|
+
const resolvedId = await this.resolve(id, importer, { skipSelf: true });
|
|
4075
2677
|
if (resolvedId?.id === hmrClientPath) await this.load({ id: resolvedId.id });
|
|
4076
2678
|
}
|
|
4077
2679
|
},
|
|
4078
2680
|
load: {
|
|
4079
2681
|
filter: [include(id(exactRegex(hmrClientPath)))],
|
|
4080
|
-
handler(id
|
|
4081
|
-
this.debug(`Replacing HMR client: ${id
|
|
2682
|
+
handler(id) {
|
|
2683
|
+
this.debug(`Replacing HMR client: ${id}`);
|
|
4082
2684
|
return hmrConfig?.clientImplement ?? defaultRuntimeImplements.clientImplement;
|
|
4083
2685
|
}
|
|
4084
2686
|
}
|
|
@@ -4099,17 +2701,17 @@ const DEFAULT_EXCLUDE_REGEX = /\/node_modules\//;
|
|
|
4099
2701
|
const HAS_REFRESH_REGEX = /\$RefreshReg\$\(/;
|
|
4100
2702
|
const ONLY_REACT_COMPONENT_REGEX = /extends\s+(?:React\.)?(?:Pure)?Component/;
|
|
4101
2703
|
function reactRefreshPlugin(options) {
|
|
4102
|
-
const { include
|
|
2704
|
+
const { include = DEFAULT_INCLUDE_REGEX, exclude = DEFAULT_EXCLUDE_REGEX } = options ?? {};
|
|
4103
2705
|
return [{
|
|
4104
2706
|
name: "rollipop:transform-react-refresh",
|
|
4105
2707
|
transform: {
|
|
4106
2708
|
filter: { id: {
|
|
4107
|
-
include
|
|
4108
|
-
exclude
|
|
2709
|
+
include,
|
|
2710
|
+
exclude
|
|
4109
2711
|
} },
|
|
4110
|
-
handler(code, id
|
|
4111
|
-
if (getFlag(this, id
|
|
4112
|
-
const result = transformSync(id
|
|
2712
|
+
handler(code, id) {
|
|
2713
|
+
if (getFlag(this, id) & TransformFlag.SKIP_ALL) return;
|
|
2714
|
+
const result = transformSync(id, code, {
|
|
4113
2715
|
sourcemap: true,
|
|
4114
2716
|
jsx: {
|
|
4115
2717
|
runtime: "automatic",
|
|
@@ -4130,15 +2732,15 @@ function reactRefreshPlugin(options) {
|
|
|
4130
2732
|
name: "rollipop:react-refresh-boundary",
|
|
4131
2733
|
transform: {
|
|
4132
2734
|
filter: { id: {
|
|
4133
|
-
include
|
|
4134
|
-
exclude
|
|
2735
|
+
include,
|
|
2736
|
+
exclude
|
|
4135
2737
|
} },
|
|
4136
|
-
handler(code, id
|
|
4137
|
-
if (getFlag(this, id
|
|
2738
|
+
handler(code, id, meta) {
|
|
2739
|
+
if (getFlag(this, id) & TransformFlag.SKIP_ALL) return;
|
|
4138
2740
|
const { magicString } = meta;
|
|
4139
2741
|
invariant(magicString != null, "magicString is not available");
|
|
4140
2742
|
applyRefreshWrapper(magicString, {
|
|
4141
|
-
id
|
|
2743
|
+
id,
|
|
4142
2744
|
hasRefresh: HAS_REFRESH_REGEX.test(code),
|
|
4143
2745
|
onlyReactComponent: ONLY_REACT_COMPONENT_REGEX.test(code)
|
|
4144
2746
|
});
|
|
@@ -4148,12 +2750,12 @@ function reactRefreshPlugin(options) {
|
|
|
4148
2750
|
}];
|
|
4149
2751
|
}
|
|
4150
2752
|
function applyRefreshWrapper(s, options) {
|
|
4151
|
-
const { id
|
|
2753
|
+
const { id, hasRefresh, onlyReactComponent } = options;
|
|
4152
2754
|
if (!(hasRefresh || onlyReactComponent)) return;
|
|
4153
2755
|
if (hasRefresh) s.prepend(`
|
|
4154
2756
|
var __prev$RefreshReg$ = global.$RefreshReg$;
|
|
4155
2757
|
var __prev$RefreshSig$ = global.$RefreshSig$;
|
|
4156
|
-
global.$RefreshReg$ = function(type, id) { return __ReactRefresh.register(type, ${JSON.stringify(id
|
|
2758
|
+
global.$RefreshReg$ = function(type, id) { return __ReactRefresh.register(type, ${JSON.stringify(id)} + ' ' + id) }
|
|
4157
2759
|
global.$RefreshSig$ = function() { return __ReactRefresh.createSignatureFunctionForTransform(); }
|
|
4158
2760
|
`);
|
|
4159
2761
|
s.append(`
|
|
@@ -4190,12 +2792,12 @@ function preludePlugin(options) {
|
|
|
4190
2792
|
meta: { [IS_ENTRY]: true }
|
|
4191
2793
|
};
|
|
4192
2794
|
} },
|
|
4193
|
-
load: { handler(id
|
|
2795
|
+
load: { handler(id) {
|
|
4194
2796
|
if (processed) return;
|
|
4195
|
-
const moduleInfo = this.getModuleInfo(id
|
|
2797
|
+
const moduleInfo = this.getModuleInfo(id);
|
|
4196
2798
|
if (moduleInfo && isEntry(moduleInfo.meta)) {
|
|
4197
|
-
this.debug(`Prelude plugin found entry ${id
|
|
4198
|
-
const modifiedSource = [preludeImportStatements, fs.readFileSync(id
|
|
2799
|
+
this.debug(`Prelude plugin found entry ${id}`);
|
|
2800
|
+
const modifiedSource = [preludeImportStatements, fs.readFileSync(id, "utf-8")].join("\n");
|
|
4199
2801
|
processed = true;
|
|
4200
2802
|
return modifiedSource;
|
|
4201
2803
|
}
|
|
@@ -4213,10 +2815,10 @@ function jsonPlugin() {
|
|
|
4213
2815
|
name: "rollipop:json",
|
|
4214
2816
|
load: {
|
|
4215
2817
|
filter: [include(id(/\.json$/))],
|
|
4216
|
-
handler(id
|
|
2818
|
+
handler(id) {
|
|
4217
2819
|
return {
|
|
4218
|
-
code: `export = ${fs.readFileSync(id
|
|
4219
|
-
meta: setFlag(this, id
|
|
2820
|
+
code: `export = ${fs.readFileSync(id, "utf-8")};`,
|
|
2821
|
+
meta: setFlag(this, id, TransformFlag.SKIP_ALL),
|
|
4220
2822
|
moduleType: "ts"
|
|
4221
2823
|
};
|
|
4222
2824
|
}
|
|
@@ -4232,13 +2834,13 @@ function svgPlugin(options) {
|
|
|
4232
2834
|
name: "rollipop:svg",
|
|
4233
2835
|
load: {
|
|
4234
2836
|
filter: { id: /\.svg$/ },
|
|
4235
|
-
async handler(id
|
|
2837
|
+
async handler(id) {
|
|
4236
2838
|
return {
|
|
4237
|
-
code: await transform(fs.readFileSync(id
|
|
2839
|
+
code: await transform(fs.readFileSync(id, "utf-8"), {
|
|
4238
2840
|
template: defaultTemplate,
|
|
4239
2841
|
plugins: [__require.resolve("@svgr/plugin-jsx")],
|
|
4240
2842
|
native: true
|
|
4241
|
-
}, { filePath: id
|
|
2843
|
+
}, { filePath: id }),
|
|
4242
2844
|
moduleType: "jsx"
|
|
4243
2845
|
};
|
|
4244
2846
|
}
|
|
@@ -4261,7 +2863,7 @@ export default ${SVG_COMPONENT_NAME};`;
|
|
|
4261
2863
|
//#endregion
|
|
4262
2864
|
//#region src/utils/babel.ts
|
|
4263
2865
|
function mergeBabelOptions(baseOptions, ...options) {
|
|
4264
|
-
return options.reduce((acc, options
|
|
2866
|
+
return options.reduce((acc, options) => mergeWith(acc, options, merge$2), baseOptions);
|
|
4265
2867
|
}
|
|
4266
2868
|
function merge$2(target, source, key) {
|
|
4267
2869
|
if (key === "plugins") return [...target ?? [], ...source ?? []];
|
|
@@ -4273,47 +2875,47 @@ function merge$2(target, source, key) {
|
|
|
4273
2875
|
function babelPlugin(options) {
|
|
4274
2876
|
const { rules = [] } = options ?? {};
|
|
4275
2877
|
const babelOptionsById = /* @__PURE__ */ new Map();
|
|
4276
|
-
const babelRules = rules.map(({ filter, options
|
|
2878
|
+
const babelRules = rules.map(({ filter, options }, index) => {
|
|
4277
2879
|
return {
|
|
4278
2880
|
name: `rollipop:babel-rule-${index}`,
|
|
4279
2881
|
transform: {
|
|
4280
2882
|
filter,
|
|
4281
|
-
handler(code, id
|
|
4282
|
-
const existingBabelOptions = babelOptionsById.get(id
|
|
4283
|
-
const resolvedOptions = typeof options
|
|
4284
|
-
existingBabelOptions ? existingBabelOptions.push(resolvedOptions) : babelOptionsById.set(id
|
|
2883
|
+
handler(code, id) {
|
|
2884
|
+
const existingBabelOptions = babelOptionsById.get(id);
|
|
2885
|
+
const resolvedOptions = typeof options === "function" ? options(code, id) : options;
|
|
2886
|
+
existingBabelOptions ? existingBabelOptions.push(resolvedOptions) : babelOptionsById.set(id, [resolvedOptions]);
|
|
4285
2887
|
}
|
|
4286
2888
|
}
|
|
4287
2889
|
};
|
|
4288
2890
|
});
|
|
4289
|
-
const babelPlugin
|
|
2891
|
+
const babelPlugin = {
|
|
4290
2892
|
name: "rollipop:babel",
|
|
4291
2893
|
buildStart() {
|
|
4292
2894
|
babelOptionsById.clear();
|
|
4293
2895
|
},
|
|
4294
|
-
transform: { handler(code, id
|
|
4295
|
-
const flags = getFlag(this, id
|
|
2896
|
+
transform: { handler(code, id) {
|
|
2897
|
+
const flags = getFlag(this, id);
|
|
4296
2898
|
if (flags & TransformFlag.SKIP_ALL) return;
|
|
4297
|
-
const babelOptions = babelOptionsById.get(id
|
|
2899
|
+
const babelOptions = babelOptionsById.get(id) ?? [];
|
|
4298
2900
|
if (!(flags & TransformFlag.CODEGEN_REQUIRED || babelOptions.length > 0)) return;
|
|
4299
|
-
const baseOptions = getPreset$1(flags, id
|
|
2901
|
+
const baseOptions = getPreset$1(flags, id);
|
|
4300
2902
|
const result = babel.transformSync(code, {
|
|
4301
|
-
filename: id
|
|
2903
|
+
filename: id,
|
|
4302
2904
|
babelrc: false,
|
|
4303
2905
|
configFile: false,
|
|
4304
2906
|
sourceMaps: true,
|
|
4305
2907
|
...mergeBabelOptions(baseOptions, ...babelOptions)
|
|
4306
2908
|
});
|
|
4307
|
-
invariant(result?.code, `Failed to transform with babel: ${id
|
|
2909
|
+
invariant(result?.code, `Failed to transform with babel: ${id}`);
|
|
4308
2910
|
return {
|
|
4309
2911
|
code: result.code,
|
|
4310
2912
|
map: result.map
|
|
4311
2913
|
};
|
|
4312
2914
|
} }
|
|
4313
2915
|
};
|
|
4314
|
-
return [...babelRules, babelPlugin
|
|
2916
|
+
return [...babelRules, babelPlugin].map(cacheable);
|
|
4315
2917
|
}
|
|
4316
|
-
function getPreset$1(flags, id
|
|
2918
|
+
function getPreset$1(flags, id) {
|
|
4317
2919
|
const presets = [];
|
|
4318
2920
|
const plugins = [];
|
|
4319
2921
|
let parserOpts = null;
|
|
@@ -4323,8 +2925,8 @@ function getPreset$1(flags, id$1) {
|
|
|
4323
2925
|
parseLangTypes: "flow",
|
|
4324
2926
|
reactRuntimeTarget: "19"
|
|
4325
2927
|
}], __require.resolve("@babel/plugin-transform-flow-strip-types"));
|
|
4326
|
-
} else if (isTS(id
|
|
4327
|
-
isTSX: isJSX(id
|
|
2928
|
+
} else if (isTS(id)) plugins.push([__require.resolve("@babel/plugin-transform-typescript"), {
|
|
2929
|
+
isTSX: isJSX(id),
|
|
4328
2930
|
allowNamespaces: true
|
|
4329
2931
|
}]);
|
|
4330
2932
|
if (flags & TransformFlag.CODEGEN_REQUIRED) plugins.push([__require.resolve("@react-native/babel-plugin-codegen")]);
|
|
@@ -4339,7 +2941,7 @@ function getPreset$1(flags, id$1) {
|
|
|
4339
2941
|
//#endregion
|
|
4340
2942
|
//#region src/utils/swc.ts
|
|
4341
2943
|
function mergeSwcOptions(baseOptions, ...options) {
|
|
4342
|
-
return options.reduce((acc, options
|
|
2944
|
+
return options.reduce((acc, options) => mergeWith(acc, options, merge$1), baseOptions);
|
|
4343
2945
|
}
|
|
4344
2946
|
function merge$1(target, source, key) {
|
|
4345
2947
|
if (key === "plugins") return [...target ?? [], ...source ?? []];
|
|
@@ -4350,30 +2952,30 @@ function merge$1(target, source, key) {
|
|
|
4350
2952
|
function swcPlugin(options) {
|
|
4351
2953
|
const { rules = [] } = options ?? {};
|
|
4352
2954
|
const swcOptionsById = /* @__PURE__ */ new Map();
|
|
4353
|
-
const swcRules = rules.map(({ filter, options
|
|
2955
|
+
const swcRules = rules.map(({ filter, options }, index) => {
|
|
4354
2956
|
return {
|
|
4355
2957
|
name: `rollipop:swc-rule-${index}`,
|
|
4356
2958
|
transform: {
|
|
4357
2959
|
filter,
|
|
4358
|
-
handler(code, id
|
|
4359
|
-
const existingBabelOptions = swcOptionsById.get(id
|
|
4360
|
-
const resolvedOptions = typeof options
|
|
4361
|
-
existingBabelOptions ? existingBabelOptions.push(resolvedOptions) : swcOptionsById.set(id
|
|
2960
|
+
handler(code, id) {
|
|
2961
|
+
const existingBabelOptions = swcOptionsById.get(id);
|
|
2962
|
+
const resolvedOptions = typeof options === "function" ? options(code, id) : options;
|
|
2963
|
+
existingBabelOptions ? existingBabelOptions.push(resolvedOptions) : swcOptionsById.set(id, [resolvedOptions]);
|
|
4362
2964
|
}
|
|
4363
2965
|
}
|
|
4364
2966
|
};
|
|
4365
2967
|
});
|
|
4366
|
-
const swcPlugin
|
|
2968
|
+
const swcPlugin = {
|
|
4367
2969
|
name: "rollipop:swc",
|
|
4368
2970
|
buildStart() {
|
|
4369
2971
|
swcOptionsById.clear();
|
|
4370
2972
|
},
|
|
4371
|
-
transform: { handler(code, id
|
|
4372
|
-
if (getFlag(this, id
|
|
4373
|
-
const swcOptions = swcOptionsById.get(id
|
|
2973
|
+
transform: { handler(code, id) {
|
|
2974
|
+
if (getFlag(this, id) & TransformFlag.SKIP_ALL) return;
|
|
2975
|
+
const swcOptions = swcOptionsById.get(id) ?? [];
|
|
4374
2976
|
const baseOptions = getPreset();
|
|
4375
2977
|
const result = swc.transformSync(code, {
|
|
4376
|
-
filename: id
|
|
2978
|
+
filename: id,
|
|
4377
2979
|
configFile: false,
|
|
4378
2980
|
swcrc: false,
|
|
4379
2981
|
sourceMaps: true,
|
|
@@ -4386,7 +2988,7 @@ function swcPlugin(options) {
|
|
|
4386
2988
|
};
|
|
4387
2989
|
} }
|
|
4388
2990
|
};
|
|
4389
|
-
return [...swcRules, swcPlugin
|
|
2991
|
+
return [...swcRules, swcPlugin].map(cacheable);
|
|
4390
2992
|
}
|
|
4391
2993
|
function getPreset() {
|
|
4392
2994
|
return {
|
|
@@ -4438,21 +3040,21 @@ function reporterPlugin(options) {
|
|
|
4438
3040
|
},
|
|
4439
3041
|
transform: {
|
|
4440
3042
|
order: "post",
|
|
4441
|
-
handler(_code, id
|
|
3043
|
+
handler(_code, id) {
|
|
4442
3044
|
++transformedModules;
|
|
4443
3045
|
if (!unknownTotalModules && totalModules < transformedModules) totalModules = transformedModules;
|
|
4444
3046
|
reporter?.update({
|
|
4445
3047
|
type: "transform",
|
|
4446
|
-
id
|
|
3048
|
+
id,
|
|
4447
3049
|
totalModules: unknownTotalModules ? void 0 : totalModules,
|
|
4448
3050
|
transformedModules
|
|
4449
3051
|
});
|
|
4450
3052
|
}
|
|
4451
3053
|
},
|
|
4452
|
-
watchChange(id
|
|
3054
|
+
watchChange(id) {
|
|
4453
3055
|
reporter?.update({
|
|
4454
3056
|
type: "watch_change",
|
|
4455
|
-
id
|
|
3057
|
+
id
|
|
4456
3058
|
});
|
|
4457
3059
|
}
|
|
4458
3060
|
};
|
|
@@ -4478,8 +3080,8 @@ resolveRolldownOptions.cache = /* @__PURE__ */ new Map();
|
|
|
4478
3080
|
async function resolveRolldownOptions(context, config, buildOptions, devEngineOptions) {
|
|
4479
3081
|
const cachedOptions = resolveRolldownOptions.cache.get(context.id);
|
|
4480
3082
|
if (cachedOptions != null) return cachedOptions;
|
|
4481
|
-
const { platform, dev
|
|
4482
|
-
const isDevServerMode = dev
|
|
3083
|
+
const { platform, dev, cache } = buildOptions;
|
|
3084
|
+
const isDevServerMode = dev && context.buildType === "serve";
|
|
4483
3085
|
invariant(isDevServerMode ? devEngineOptions != null : true, "devEngineOptions is required in dev server mode");
|
|
4484
3086
|
const env = loadEnv(config);
|
|
4485
3087
|
const builtInEnv = {
|
|
@@ -4506,12 +3108,12 @@ async function resolveRolldownOptions(context, config, buildOptions, devEngineOp
|
|
|
4506
3108
|
target: "es2015",
|
|
4507
3109
|
jsx: {
|
|
4508
3110
|
runtime: "automatic",
|
|
4509
|
-
development: dev
|
|
3111
|
+
development: dev
|
|
4510
3112
|
},
|
|
4511
3113
|
define: {
|
|
4512
|
-
__DEV__: asLiteral(dev
|
|
3114
|
+
__DEV__: asLiteral(dev),
|
|
4513
3115
|
global: asIdentifier(GLOBAL_IDENTIFIER),
|
|
4514
|
-
"process.env.NODE_ENV": asLiteral(nodeEnvironment(dev
|
|
3116
|
+
"process.env.NODE_ENV": asLiteral(nodeEnvironment(dev)),
|
|
4515
3117
|
"process.env.DEBUG_ROLLIPOP": asLiteral(isDebugEnabled()),
|
|
4516
3118
|
...defineEnvFromObject(env),
|
|
4517
3119
|
...defineEnvFromObject(builtInEnv)
|
|
@@ -4526,15 +3128,15 @@ async function resolveRolldownOptions(context, config, buildOptions, devEngineOp
|
|
|
4526
3128
|
sourceExtensions,
|
|
4527
3129
|
context
|
|
4528
3130
|
});
|
|
4529
|
-
const
|
|
3131
|
+
const defaultReporters = [(() => {
|
|
4530
3132
|
switch (config.terminal.status) {
|
|
4531
3133
|
case "compat": return new CompatStatusReporter();
|
|
4532
3134
|
case "progress": return new ProgressBarStatusReporter(context.id, `[${platform}, ${buildOptions.dev ? "dev" : "prod"}]`, getBuildTotalModules(context.storage, context.id));
|
|
4533
3135
|
}
|
|
4534
|
-
})();
|
|
3136
|
+
})()];
|
|
4535
3137
|
const reporterOptions = {
|
|
4536
3138
|
initialTotalModules: getBuildTotalModules(context.storage, context.id),
|
|
4537
|
-
reporter: mergeReporters([
|
|
3139
|
+
reporter: mergeReporters([...defaultReporters, config.reporter].filter(isNotNil))
|
|
4538
3140
|
};
|
|
4539
3141
|
const finalOptions = await applyDangerouslyOverrideOptionsFinalizer(config, {
|
|
4540
3142
|
platform: "neutral",
|
|
@@ -4551,7 +3153,7 @@ async function resolveRolldownOptions(context, config, buildOptions, devEngineOp
|
|
|
4551
3153
|
plugins: withTransformBoundary([
|
|
4552
3154
|
preludePlugin({ modulePaths: preludePaths }),
|
|
4553
3155
|
reactNativePlugin(config, {
|
|
4554
|
-
dev
|
|
3156
|
+
dev,
|
|
4555
3157
|
platform,
|
|
4556
3158
|
buildType: context.buildType,
|
|
4557
3159
|
codegenFilter: codegen.filter,
|
|
@@ -4591,12 +3193,11 @@ async function resolveRolldownOptions(context, config, buildOptions, devEngineOp
|
|
|
4591
3193
|
outro: rolldownOutro,
|
|
4592
3194
|
intro: async (chunk) => {
|
|
4593
3195
|
return [
|
|
4594
|
-
...getGlobalVariables(dev
|
|
3196
|
+
...getGlobalVariables(dev, context.buildType),
|
|
4595
3197
|
...loadPolyfills(polyfills),
|
|
4596
3198
|
typeof rolldownIntro === "function" ? await rolldownIntro(chunk) : rolldownIntro
|
|
4597
3199
|
].filter(isNotNil).join("\n");
|
|
4598
3200
|
},
|
|
4599
|
-
keepNames: dev$1,
|
|
4600
3201
|
minify: buildOptions.minify ?? rolldownMinify,
|
|
4601
3202
|
sourcemap: buildOptions.sourcemap ?? rolldownSourcemap,
|
|
4602
3203
|
sourcemapBaseUrl: rolldownSourcemapBaseUrl,
|
|
@@ -4612,16 +3213,16 @@ async function resolveRolldownOptions(context, config, buildOptions, devEngineOp
|
|
|
4612
3213
|
}
|
|
4613
3214
|
function getResolveExtensions({ platform, sourceExtensions, assetExtensions, preferNativePlatform }) {
|
|
4614
3215
|
const supportedExtensions = [...sourceExtensions, ...assetExtensions];
|
|
4615
|
-
return [...[platform, preferNativePlatform ? "native" : null].filter(isNotNil).map((platform
|
|
4616
|
-
return supportedExtensions.map((extension) => `.${platform
|
|
3216
|
+
return [...[platform, preferNativePlatform ? "native" : null].filter(isNotNil).map((platform) => {
|
|
3217
|
+
return supportedExtensions.map((extension) => `.${platform}.${extension}`);
|
|
4617
3218
|
}), ...supportedExtensions.map((extension) => `.${extension}`)].flat();
|
|
4618
3219
|
}
|
|
4619
3220
|
function loadPolyfills(polyfills) {
|
|
4620
3221
|
return polyfills.map((polyfill) => {
|
|
4621
3222
|
if (typeof polyfill === "string") return fs.readFileSync(polyfill, "utf-8");
|
|
4622
|
-
const path
|
|
3223
|
+
const path = "path" in polyfill ? polyfill.path : void 0;
|
|
4623
3224
|
const content = "code" in polyfill ? polyfill.code : fs.readFileSync(polyfill.path, "utf-8");
|
|
4624
|
-
return polyfill.type === "iife" ? iife(content, path
|
|
3225
|
+
return polyfill.type === "iife" ? iife(content, path) : content;
|
|
4625
3226
|
});
|
|
4626
3227
|
}
|
|
4627
3228
|
async function applyDangerouslyOverrideOptionsFinalizer(config, inputOptions, outputOptions) {
|
|
@@ -4681,11 +3282,11 @@ var Bundler = class Bundler {
|
|
|
4681
3282
|
return createId(config, buildOptions);
|
|
4682
3283
|
}
|
|
4683
3284
|
static createContext(buildType, config, buildOptions) {
|
|
4684
|
-
const id
|
|
3285
|
+
const id = Bundler.createId(config, buildOptions);
|
|
4685
3286
|
return {
|
|
4686
|
-
id
|
|
3287
|
+
id,
|
|
4687
3288
|
root: config.root,
|
|
4688
|
-
cache: new FileSystemCache(config.root, id
|
|
3289
|
+
cache: new FileSystemCache(config.root, id),
|
|
4689
3290
|
storage: FileStorage.getInstance(config.root),
|
|
4690
3291
|
buildType,
|
|
4691
3292
|
state: { hmrUpdates: /* @__PURE__ */ new Set() }
|
|
@@ -4742,7 +3343,7 @@ async function runServer(config, options) {
|
|
|
4742
3343
|
|
|
4743
3344
|
//#endregion
|
|
4744
3345
|
//#region package.json
|
|
4745
|
-
var version = "0.1.0-alpha.
|
|
3346
|
+
var version = "0.1.0-alpha.13";
|
|
4746
3347
|
|
|
4747
3348
|
//#endregion
|
|
4748
3349
|
//#region src/node/logger.ts
|
|
@@ -4756,10 +3357,10 @@ function parseBoolean(value) {
|
|
|
4756
3357
|
function resolvePath(value) {
|
|
4757
3358
|
return path.resolve(value);
|
|
4758
3359
|
}
|
|
4759
|
-
function withErrorHandler(action
|
|
3360
|
+
function withErrorHandler(action) {
|
|
4760
3361
|
return async function(args) {
|
|
4761
3362
|
try {
|
|
4762
|
-
await action
|
|
3363
|
+
await action.call(this, args);
|
|
4763
3364
|
} catch (reason) {
|
|
4764
3365
|
logger.error("An error occurred while executing the command");
|
|
4765
3366
|
logger.error(`Reason: ${reason instanceof Error ? reason.message : String(reason)}`);
|
|
@@ -4889,18 +3490,18 @@ function setupInteractiveMode(options) {
|
|
|
4889
3490
|
process.emit("SIGINT");
|
|
4890
3491
|
process.exit(0);
|
|
4891
3492
|
}
|
|
4892
|
-
const targetCommand = allCommands.find((command
|
|
3493
|
+
const targetCommand = allCommands.find((command) => command.key === sequence && (command.shift ?? false) === shift);
|
|
4893
3494
|
if (targetCommand) targetCommand.handler.call({
|
|
4894
3495
|
server: devServer,
|
|
4895
3496
|
logger
|
|
4896
3497
|
});
|
|
4897
3498
|
});
|
|
4898
3499
|
console.log();
|
|
4899
|
-
allCommands.forEach((command
|
|
3500
|
+
allCommands.forEach((command, index) => {
|
|
4900
3501
|
if (defaultCommands.length === index) console.log();
|
|
4901
|
-
const leadingLabel = command
|
|
4902
|
-
const shortcut = chalk.bold(shortcutLabel(command
|
|
4903
|
-
console.log(`${leadingLabel} ${shortcut} │ ${typeof command
|
|
3502
|
+
const leadingLabel = command.shift ? "»" : "» Press";
|
|
3503
|
+
const shortcut = chalk.bold(shortcutLabel(command.key, command.shift));
|
|
3504
|
+
console.log(`${leadingLabel} ${shortcut} │ ${typeof command.description === "function" ? command.description() : command.description}`);
|
|
4904
3505
|
});
|
|
4905
3506
|
}
|
|
4906
3507
|
function getDefaultCommands(devServer, debuggerOpener) {
|
|
@@ -4960,11 +3561,11 @@ function assertHasNoDuplicateCommands(defaultCommands, commands) {
|
|
|
4960
3561
|
//#endregion
|
|
4961
3562
|
//#region src/node/cli-utils.ts
|
|
4962
3563
|
function createCommand(commandDefinition) {
|
|
4963
|
-
const { name, description, options, action
|
|
4964
|
-
const command
|
|
4965
|
-
if (options != null) for (const option of options) (option.required ? command
|
|
4966
|
-
return command
|
|
4967
|
-
await action
|
|
3564
|
+
const { name, description, options, action } = commandDefinition;
|
|
3565
|
+
const command = new Command(name).description(description);
|
|
3566
|
+
if (options != null) for (const option of options) (option.required ? command.requiredOption.bind(command) : command.option.bind(command))(option.name, option.description ?? "", (value) => option.parse != null ? option.parse(value) : value, option.default);
|
|
3567
|
+
return command.action(withErrorHandler(async function(args) {
|
|
3568
|
+
await action.call({ platforms: ["android", "ios"] }, args);
|
|
4968
3569
|
}));
|
|
4969
3570
|
}
|
|
4970
3571
|
function createReactNativeCliCommand(commandDefinition) {
|
|
@@ -5228,4 +3829,4 @@ function run(argv) {
|
|
|
5228
3829
|
}
|
|
5229
3830
|
|
|
5230
3831
|
//#endregion
|
|
5231
|
-
export { assets_exports as AssetUtils, Bundler, DEFAULT_HOST, DEFAULT_PORT, DEV_SERVER_ASSET_PATH,
|
|
3832
|
+
export { assets_exports as AssetUtils, Bundler, DEFAULT_HOST, DEFAULT_PORT, DEV_SERVER_ASSET_PATH, cli_exports as cli, createCommand, createDevServer, createReactNativeCliCommand, defineConfig, flattenPluginOption, getDefaultConfig, invokeConfigResolved, loadConfig, loadEnv, mergeConfig, plugins_exports as plugins, resetCache, resolvePluginConfig, rolldown, rolldownExperimental, runBuild, runServer, setupInteractiveMode };
|