rollipop 0.1.0-alpha.11 → 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 +14 -0
- package/dist/{chunk-Dj-qOoLf.js → chunk-D0rfrjR5.js} +4 -5
- package/dist/commands.cjs +796 -2193
- package/dist/commands.js +787 -2185
- 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 +30 -48
- package/dist/index.js +973 -2369
- package/dist/pluginutils.d.ts +18 -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 -646
package/dist/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
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
|
+
import wrapAnsi from "wrap-ansi";
|
|
10
11
|
import * as c12 from "c12";
|
|
11
12
|
import pLimit from "p-limit";
|
|
12
13
|
import * as rolldown from "@rollipop/rolldown";
|
|
@@ -16,15 +17,15 @@ import gradient from "gradient-string";
|
|
|
16
17
|
import crypto from "node:crypto";
|
|
17
18
|
import { xxh32 } from "@node-rs/xxhash";
|
|
18
19
|
import dedent from "dedent";
|
|
19
|
-
import wrapAnsi from "wrap-ansi";
|
|
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);
|
|
@@ -355,102 +280,493 @@ function resolvePackagePathWithNodeRequire(basePath, packageName, subpath) {
|
|
|
355
280
|
}
|
|
356
281
|
|
|
357
282
|
//#endregion
|
|
358
|
-
//#region src/
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
entry: "index.js",
|
|
370
|
-
resolver: {
|
|
371
|
-
sourceExtensions: DEFAULT_SOURCE_EXTENSIONS,
|
|
372
|
-
assetExtensions: DEFAULT_ASSET_EXTENSIONS,
|
|
373
|
-
mainFields: DEFAULT_RESOLVER_MAIN_FIELDS,
|
|
374
|
-
conditionNames: DEFAULT_RESOLVER_CONDITION_NAMES,
|
|
375
|
-
preferNativePlatform: true,
|
|
376
|
-
symlinks: true
|
|
377
|
-
},
|
|
378
|
-
transformer: {
|
|
379
|
-
svg: true,
|
|
380
|
-
flow: { filter: {
|
|
381
|
-
id: /\.jsx?$/,
|
|
382
|
-
code: /@flow/
|
|
383
|
-
} }
|
|
384
|
-
},
|
|
385
|
-
serializer: {
|
|
386
|
-
prelude: [getInitializeCorePath(projectRoot)],
|
|
387
|
-
polyfills: getPolyfillScriptPaths(reactNativePath).map((path$1) => ({
|
|
388
|
-
type: "iife",
|
|
389
|
-
code: generateSourceFromAst(stripFlowSyntax(fs.readFileSync(path$1, "utf-8")), path$1).code
|
|
390
|
-
}))
|
|
391
|
-
},
|
|
392
|
-
watcher: {
|
|
393
|
-
skipWrite: true,
|
|
394
|
-
useDebounce: true,
|
|
395
|
-
debounceDuration: 50
|
|
396
|
-
},
|
|
397
|
-
optimization: { treeshake: true },
|
|
398
|
-
reactNative: {
|
|
399
|
-
reactNativePath,
|
|
400
|
-
codegen: { filter: { code: /\bcodegenNativeComponent</ } },
|
|
401
|
-
assetRegistryPath: DEFAULT_ASSET_REGISTRY_PATH,
|
|
402
|
-
globalIdentifiers: DEFAULT_REACT_NATIVE_GLOBAL_IDENTIFIERS
|
|
403
|
-
},
|
|
404
|
-
devMode: { hmr: true },
|
|
405
|
-
terminal: { status: (() => {
|
|
406
|
-
if (isDebugEnabled()) return "compat";
|
|
407
|
-
if (process.stderr.isTTY) return "progress";
|
|
408
|
-
return "compat";
|
|
409
|
-
})() },
|
|
410
|
-
reporter: new TerminalReporter(),
|
|
411
|
-
envDir: projectRoot,
|
|
412
|
-
envPrefix: DEFAULT_ENV_PREFIX
|
|
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
|
|
413
294
|
};
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
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}`);
|
|
425
356
|
}
|
|
426
357
|
};
|
|
427
358
|
|
|
428
359
|
//#endregion
|
|
429
|
-
//#region src/
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
return
|
|
439
|
-
debug: (log) => {
|
|
440
|
-
printPluginLog("debug", log, name);
|
|
441
|
-
},
|
|
442
|
-
info: (log) => {
|
|
443
|
-
printPluginLog("info", log, name);
|
|
444
|
-
},
|
|
445
|
-
warn: (log) => {
|
|
446
|
-
printPluginLog("warn", log, name);
|
|
447
|
-
}
|
|
448
|
-
};
|
|
360
|
+
//#region src/utils/terminal.ts
|
|
361
|
+
/**
|
|
362
|
+
* Based on https://github.com/sindresorhus/log-update/blob/master/index.js
|
|
363
|
+
* Based on https://github.com/unjs/webpackbar
|
|
364
|
+
*/
|
|
365
|
+
function eraseLines(count) {
|
|
366
|
+
let clear = "";
|
|
367
|
+
for (let i = 0; i < count; i++) clear += `\u001B[2K` + (i < count - 1 ? `\u001B[1A` : "");
|
|
368
|
+
if (count) clear += `\u001B[G`;
|
|
369
|
+
return clear;
|
|
449
370
|
}
|
|
450
|
-
function
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
371
|
+
function ellipsisLeft(value, maxLength) {
|
|
372
|
+
if (value.length <= maxLength - 3) return value;
|
|
373
|
+
return `...${value.slice(value.length - maxLength - 1)}`;
|
|
374
|
+
}
|
|
375
|
+
const originalWrite = Symbol("original-write");
|
|
376
|
+
var StreamManager = class {
|
|
377
|
+
prevLineCount;
|
|
378
|
+
listening;
|
|
379
|
+
extraLines;
|
|
380
|
+
_streams;
|
|
381
|
+
constructor() {
|
|
382
|
+
this.prevLineCount = 0;
|
|
383
|
+
this.listening = false;
|
|
384
|
+
this.extraLines = "";
|
|
385
|
+
this._onData = this._onData.bind(this);
|
|
386
|
+
this._streams = [process.stdout, process.stderr];
|
|
387
|
+
}
|
|
388
|
+
render(lines) {
|
|
389
|
+
this.listen();
|
|
390
|
+
const wrappedLines = wrapAnsi(lines, this.columns, {
|
|
391
|
+
trim: false,
|
|
392
|
+
hard: true,
|
|
393
|
+
wordWrap: false
|
|
394
|
+
});
|
|
395
|
+
const data = eraseLines(this.prevLineCount) + wrappedLines + "\n" + this.extraLines;
|
|
396
|
+
this.write(data);
|
|
397
|
+
this.prevLineCount = data.split("\n").length;
|
|
398
|
+
}
|
|
399
|
+
get columns() {
|
|
400
|
+
return (process.stderr.columns || 80) - 2;
|
|
401
|
+
}
|
|
402
|
+
write(data) {
|
|
403
|
+
const stream = process.stderr;
|
|
404
|
+
if (stream.write[originalWrite]) stream.write[originalWrite].call(stream, data, "utf8");
|
|
405
|
+
else stream.write(data, "utf8");
|
|
406
|
+
}
|
|
407
|
+
clear() {
|
|
408
|
+
this.done();
|
|
409
|
+
this.write(eraseLines(this.prevLineCount));
|
|
410
|
+
}
|
|
411
|
+
done() {
|
|
412
|
+
this.stopListen();
|
|
413
|
+
this.prevLineCount = 0;
|
|
414
|
+
this.extraLines = "";
|
|
415
|
+
}
|
|
416
|
+
_onData(data) {
|
|
417
|
+
const lines = String(data).split("\n").length - 1;
|
|
418
|
+
if (lines > 0) {
|
|
419
|
+
this.prevLineCount += lines;
|
|
420
|
+
this.extraLines += data;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
listen() {
|
|
424
|
+
if (this.listening) return;
|
|
425
|
+
for (const stream of this._streams) {
|
|
426
|
+
if (stream.write[originalWrite]) continue;
|
|
427
|
+
const write = (data, ...args) => {
|
|
428
|
+
if (!stream.write[originalWrite]) return stream.write(data, ...args);
|
|
429
|
+
this._onData(data);
|
|
430
|
+
return stream.write[originalWrite].call(stream, data, ...args);
|
|
431
|
+
};
|
|
432
|
+
write[originalWrite] = stream.write;
|
|
433
|
+
stream.write = write;
|
|
434
|
+
}
|
|
435
|
+
this.listening = true;
|
|
436
|
+
}
|
|
437
|
+
stopListen() {
|
|
438
|
+
for (const stream of this._streams) if (stream.write[originalWrite]) stream.write = stream.write[originalWrite];
|
|
439
|
+
this.listening = false;
|
|
440
|
+
}
|
|
441
|
+
};
|
|
442
|
+
|
|
443
|
+
//#endregion
|
|
444
|
+
//#region src/common/progress-bar.ts
|
|
445
|
+
const BAR_LENGTH = 25;
|
|
446
|
+
const BLOCK_CHAR = "█";
|
|
447
|
+
const idleRenderer = { render(_state, context) {
|
|
448
|
+
return ` ${chalk.gray("Waiting...")} ${chalk.gray(context.label)}\n`;
|
|
449
|
+
} };
|
|
450
|
+
const runningRenderer = { render(state, context) {
|
|
451
|
+
const { label, current, total, columns } = context;
|
|
452
|
+
const unknownTotal = total === 0;
|
|
453
|
+
const progress = unknownTotal ? 0 : current / total * 100;
|
|
454
|
+
const width = unknownTotal ? 0 : progress * (BAR_LENGTH / 100);
|
|
455
|
+
const bg = chalk.white(BLOCK_CHAR);
|
|
456
|
+
const fg = chalk.cyan(BLOCK_CHAR);
|
|
457
|
+
const bar = range(BAR_LENGTH).map((n) => n < width ? fg : bg).join("");
|
|
458
|
+
const progressLabel = unknownTotal ? chalk.gray("(calculating...)") : `(${progress.toFixed(2)}%)`;
|
|
459
|
+
const moduleCountLabel = unknownTotal ? `${current} modules` : `${current}/${total} modules`;
|
|
460
|
+
return `${[
|
|
461
|
+
chalk.cyan("●"),
|
|
462
|
+
bar,
|
|
463
|
+
progressLabel,
|
|
464
|
+
chalk.gray(moduleCountLabel),
|
|
465
|
+
chalk.gray(label)
|
|
466
|
+
].join(" ")}\n${state.moduleId ? " " + chalk.grey(ellipsisLeft(state.moduleId, columns - 10)) : ""}`;
|
|
467
|
+
} };
|
|
468
|
+
const completedRenderer = { render(state, context) {
|
|
469
|
+
if (state.hasErrors) return `${chalk.red("✘")} Build failed ${chalk.gray(context.label)}`;
|
|
470
|
+
else {
|
|
471
|
+
const icon = chalk.green("✔");
|
|
472
|
+
const durationInSeconds = (state.duration / 1e3).toFixed(2);
|
|
473
|
+
return `${`${icon} Build completed ${chalk.gray(context.label)}`}\n${chalk.grey(` Built in ${durationInSeconds}s (${context.current}/${context.total} modules)`)}`;
|
|
474
|
+
}
|
|
475
|
+
} };
|
|
476
|
+
var ProgressBarRenderer = class {
|
|
477
|
+
renderers = {
|
|
478
|
+
idle: idleRenderer,
|
|
479
|
+
running: runningRenderer,
|
|
480
|
+
completed: completedRenderer
|
|
481
|
+
};
|
|
482
|
+
render(state, context) {
|
|
483
|
+
return this.renderers[state.type].render(state, context);
|
|
484
|
+
}
|
|
485
|
+
};
|
|
486
|
+
var ProgressBar = class {
|
|
487
|
+
columns = (process.stderr.columns || 80) - 2;
|
|
488
|
+
renderer;
|
|
489
|
+
label;
|
|
490
|
+
state = { type: "idle" };
|
|
491
|
+
current = 0;
|
|
492
|
+
total;
|
|
493
|
+
stale = false;
|
|
494
|
+
constructor(options) {
|
|
495
|
+
this.total = options.total;
|
|
496
|
+
this.label = options.label;
|
|
497
|
+
this.renderer = options.renderer ?? new ProgressBarRenderer();
|
|
498
|
+
}
|
|
499
|
+
get done() {
|
|
500
|
+
return this.state.type === "completed";
|
|
501
|
+
}
|
|
502
|
+
setCurrent(current) {
|
|
503
|
+
this.current = current;
|
|
504
|
+
this.stale = true;
|
|
505
|
+
return this;
|
|
506
|
+
}
|
|
507
|
+
setTotal(total) {
|
|
508
|
+
this.total = total;
|
|
509
|
+
this.stale = true;
|
|
510
|
+
return this;
|
|
511
|
+
}
|
|
512
|
+
start() {
|
|
513
|
+
this.state = { type: "running" };
|
|
514
|
+
this.stale = true;
|
|
515
|
+
return this;
|
|
516
|
+
}
|
|
517
|
+
setModuleId(moduleId) {
|
|
518
|
+
if (this.state.type !== "running") return this;
|
|
519
|
+
this.state = {
|
|
520
|
+
type: "running",
|
|
521
|
+
moduleId
|
|
522
|
+
};
|
|
523
|
+
this.stale = true;
|
|
524
|
+
return this;
|
|
525
|
+
}
|
|
526
|
+
complete(duration, hasErrors = false) {
|
|
527
|
+
this.state = {
|
|
528
|
+
type: "completed",
|
|
529
|
+
duration,
|
|
530
|
+
hasErrors
|
|
531
|
+
};
|
|
532
|
+
this.stale = true;
|
|
533
|
+
return this;
|
|
534
|
+
}
|
|
535
|
+
render() {
|
|
536
|
+
this.stale = false;
|
|
537
|
+
const context = {
|
|
538
|
+
label: this.label,
|
|
539
|
+
current: this.current,
|
|
540
|
+
total: this.total,
|
|
541
|
+
columns: this.columns
|
|
542
|
+
};
|
|
543
|
+
return this.renderer.render(this.state, context);
|
|
544
|
+
}
|
|
545
|
+
};
|
|
546
|
+
var ProgressBarRenderManager = class ProgressBarRenderManager {
|
|
547
|
+
static instance = null;
|
|
548
|
+
streamManager = new StreamManager();
|
|
549
|
+
progressBars = /* @__PURE__ */ new Map();
|
|
550
|
+
throttledRender;
|
|
551
|
+
static getInstance() {
|
|
552
|
+
if (!ProgressBarRenderManager.instance) ProgressBarRenderManager.instance = new ProgressBarRenderManager();
|
|
553
|
+
return ProgressBarRenderManager.instance;
|
|
554
|
+
}
|
|
555
|
+
constructor() {
|
|
556
|
+
this.throttledRender = throttle(this._render.bind(this), 50);
|
|
557
|
+
}
|
|
558
|
+
_render() {
|
|
559
|
+
const renderedLines = Array.from(this.progressBars.values().filter((progressBar) => progressBar.stale).map((progressBar) => progressBar.render()));
|
|
560
|
+
if (renderedLines.length > 0) this.streamManager.render(renderedLines.join("\n\n"));
|
|
561
|
+
}
|
|
562
|
+
register(key, options) {
|
|
563
|
+
const progressBar = this.progressBars.get(key);
|
|
564
|
+
if (progressBar == null) {
|
|
565
|
+
const newProgressBar = new ProgressBar(options);
|
|
566
|
+
this.progressBars.set(key, newProgressBar);
|
|
567
|
+
return newProgressBar;
|
|
568
|
+
}
|
|
569
|
+
return progressBar;
|
|
570
|
+
}
|
|
571
|
+
start() {
|
|
572
|
+
console.log();
|
|
573
|
+
this.streamManager.listen();
|
|
574
|
+
this._render();
|
|
575
|
+
}
|
|
576
|
+
render() {
|
|
577
|
+
this.throttledRender();
|
|
578
|
+
}
|
|
579
|
+
release() {
|
|
580
|
+
if (this.progressBars.values().every((progressBar) => progressBar.done)) {
|
|
581
|
+
this._render();
|
|
582
|
+
this.streamManager.done();
|
|
583
|
+
console.log();
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
clear() {
|
|
587
|
+
this.streamManager.clear();
|
|
588
|
+
}
|
|
589
|
+
};
|
|
590
|
+
|
|
591
|
+
//#endregion
|
|
592
|
+
//#region src/logger.ts
|
|
593
|
+
const logger$2 = new Logger("bundler");
|
|
594
|
+
|
|
595
|
+
//#endregion
|
|
596
|
+
//#region src/utils/reporters.ts
|
|
597
|
+
function mergeReporters(reporters) {
|
|
598
|
+
return { update(event) {
|
|
599
|
+
reporters.forEach((reporter) => reporter.update(event));
|
|
600
|
+
} };
|
|
601
|
+
}
|
|
602
|
+
var ClientLogReporter = class {
|
|
603
|
+
logger = new Logger("app");
|
|
604
|
+
update(event) {
|
|
605
|
+
if (event.type === "client_log") {
|
|
606
|
+
if (event.level === "group" || event.level === "groupCollapsed") {
|
|
607
|
+
this.logger.info(...event.data);
|
|
608
|
+
return;
|
|
609
|
+
} else if (event.level === "groupEnd") return;
|
|
610
|
+
this.logger[event.level](...event.data);
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
};
|
|
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;
|
|
619
|
+
}(ProgressFlags || {});
|
|
620
|
+
var ProgressBarStatusReporter = class {
|
|
621
|
+
renderManager = ProgressBarRenderManager.getInstance();
|
|
622
|
+
progressBar;
|
|
623
|
+
flags = ProgressFlags.NONE;
|
|
624
|
+
constructor(id, label, initialTotalModules) {
|
|
625
|
+
this.progressBar = this.renderManager.register(id, {
|
|
626
|
+
label,
|
|
627
|
+
total: initialTotalModules
|
|
628
|
+
});
|
|
629
|
+
}
|
|
630
|
+
renderProgress(id, totalModules, transformedModules) {
|
|
631
|
+
if (totalModules != null) this.progressBar.setTotal(totalModules);
|
|
632
|
+
this.progressBar.setCurrent(transformedModules).setModuleId(id);
|
|
633
|
+
this.renderManager.render();
|
|
634
|
+
}
|
|
635
|
+
update(event) {
|
|
636
|
+
switch (event.type) {
|
|
637
|
+
case "bundle_build_started":
|
|
638
|
+
this.flags |= ProgressFlags.BUILD_IN_PROGRESS;
|
|
639
|
+
this.progressBar.start();
|
|
640
|
+
this.renderManager.start();
|
|
641
|
+
break;
|
|
642
|
+
case "bundle_build_failed":
|
|
643
|
+
this.flags = ProgressFlags.NONE;
|
|
644
|
+
this.progressBar.complete(0, true);
|
|
645
|
+
this.renderManager.release();
|
|
646
|
+
break;
|
|
647
|
+
case "bundle_build_done":
|
|
648
|
+
this.flags = ProgressFlags.NONE;
|
|
649
|
+
this.progressBar.setTotal(event.totalModules).complete(event.duration, false);
|
|
650
|
+
this.renderManager.release();
|
|
651
|
+
break;
|
|
652
|
+
case "transform":
|
|
653
|
+
const { id, totalModules, transformedModules } = event;
|
|
654
|
+
if (this.flags & ProgressFlags.FILE_CHANGED) {
|
|
655
|
+
logger$2.debug("Transformed changed file", { id });
|
|
656
|
+
return;
|
|
657
|
+
}
|
|
658
|
+
this.renderProgress(id, totalModules, transformedModules);
|
|
659
|
+
break;
|
|
660
|
+
case "watch_change":
|
|
661
|
+
this.flags |= ProgressFlags.FILE_CHANGED;
|
|
662
|
+
break;
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
};
|
|
666
|
+
var CompatStatusReporter = class {
|
|
667
|
+
update(event) {
|
|
668
|
+
switch (event.type) {
|
|
669
|
+
case "bundle_build_started":
|
|
670
|
+
logger$2.info("Build started...");
|
|
671
|
+
break;
|
|
672
|
+
case "bundle_build_failed":
|
|
673
|
+
logger$2.error(`Build failed`);
|
|
674
|
+
break;
|
|
675
|
+
case "bundle_build_done":
|
|
676
|
+
const { duration, totalModules } = event;
|
|
677
|
+
const time = chalk.blue(`${duration.toFixed(2)}ms`);
|
|
678
|
+
const modules = chalk.blue(`(${totalModules} modules)`);
|
|
679
|
+
logger$2.info(`Build completed in ${time} ${modules}`);
|
|
680
|
+
break;
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
};
|
|
684
|
+
|
|
685
|
+
//#endregion
|
|
686
|
+
//#region src/config/defaults.ts
|
|
687
|
+
function getDefaultConfig(projectRoot, mode) {
|
|
688
|
+
let reactNativePath;
|
|
689
|
+
try {
|
|
690
|
+
reactNativePath = process.env.ROLLIPOP_REACT_NATIVE_PATH ?? resolvePackagePath(projectRoot, "react-native");
|
|
691
|
+
} catch {
|
|
692
|
+
throw new Error(`Could not resolve 'react-native' package path. Please check your project path.`);
|
|
693
|
+
}
|
|
694
|
+
return {
|
|
695
|
+
root: projectRoot,
|
|
696
|
+
mode: mode ?? "development",
|
|
697
|
+
entry: "index.js",
|
|
698
|
+
resolver: {
|
|
699
|
+
sourceExtensions: DEFAULT_SOURCE_EXTENSIONS,
|
|
700
|
+
assetExtensions: DEFAULT_ASSET_EXTENSIONS,
|
|
701
|
+
mainFields: DEFAULT_RESOLVER_MAIN_FIELDS,
|
|
702
|
+
conditionNames: DEFAULT_RESOLVER_CONDITION_NAMES,
|
|
703
|
+
preferNativePlatform: true,
|
|
704
|
+
symlinks: true
|
|
705
|
+
},
|
|
706
|
+
transformer: {
|
|
707
|
+
svg: true,
|
|
708
|
+
flow: { filter: {
|
|
709
|
+
id: /\.jsx?$/,
|
|
710
|
+
code: /@flow/
|
|
711
|
+
} }
|
|
712
|
+
},
|
|
713
|
+
serializer: {
|
|
714
|
+
prelude: [getInitializeCorePath(projectRoot)],
|
|
715
|
+
polyfills: getPolyfillScriptPaths(reactNativePath).map((path) => ({
|
|
716
|
+
type: "iife",
|
|
717
|
+
code: generateSourceFromAst(stripFlowSyntax(fs.readFileSync(path, "utf-8")), path).code
|
|
718
|
+
}))
|
|
719
|
+
},
|
|
720
|
+
watcher: {
|
|
721
|
+
skipWrite: true,
|
|
722
|
+
useDebounce: true,
|
|
723
|
+
debounceDuration: 50
|
|
724
|
+
},
|
|
725
|
+
optimization: { treeshake: true },
|
|
726
|
+
reactNative: {
|
|
727
|
+
reactNativePath,
|
|
728
|
+
codegen: { filter: { code: /\bcodegenNativeComponent</ } },
|
|
729
|
+
assetRegistryPath: DEFAULT_ASSET_REGISTRY_PATH,
|
|
730
|
+
globalIdentifiers: DEFAULT_REACT_NATIVE_GLOBAL_IDENTIFIERS
|
|
731
|
+
},
|
|
732
|
+
devMode: { hmr: true },
|
|
733
|
+
reporter: new ClientLogReporter(),
|
|
734
|
+
terminal: { status: (() => {
|
|
735
|
+
if (isDebugEnabled()) return "compat";
|
|
736
|
+
if (process.stderr.isTTY) return "progress";
|
|
737
|
+
return "compat";
|
|
738
|
+
})() },
|
|
739
|
+
envDir: projectRoot,
|
|
740
|
+
envPrefix: DEFAULT_ENV_PREFIX
|
|
741
|
+
};
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
//#endregion
|
|
745
|
+
//#region src/config/define-config.ts
|
|
746
|
+
function defineConfig(userConfig) {
|
|
747
|
+
return userConfig;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
//#endregion
|
|
751
|
+
//#region src/core/plugins/context.ts
|
|
752
|
+
const pluginLogger = new Logger();
|
|
753
|
+
function createPluginContext(name) {
|
|
754
|
+
return {
|
|
755
|
+
debug: (log) => {
|
|
756
|
+
printPluginLog("debug", log, name);
|
|
757
|
+
},
|
|
758
|
+
info: (log) => {
|
|
759
|
+
printPluginLog("info", log, name);
|
|
760
|
+
},
|
|
761
|
+
warn: (log) => {
|
|
762
|
+
printPluginLog("warn", log, name);
|
|
763
|
+
}
|
|
764
|
+
};
|
|
765
|
+
}
|
|
766
|
+
function printPluginLog(level, log, pluginName = "unknown") {
|
|
767
|
+
const pluginLabel = chalk.magenta(`plugin:${pluginName}`);
|
|
768
|
+
if (typeof log === "string") pluginLogger[level](pluginLabel, log);
|
|
769
|
+
else pluginLogger[level](pluginLabel, log.stack ?? log.message);
|
|
454
770
|
}
|
|
455
771
|
|
|
456
772
|
//#endregion
|
|
@@ -509,593 +825,252 @@ async function flattenPluginOption(pluginOption) {
|
|
|
509
825
|
}
|
|
510
826
|
async function resolvePluginConfig(baseConfig, plugins) {
|
|
511
827
|
let mergedConfig = omit(baseConfig, ["plugins", "dangerously_overrideRolldownOptions"]);
|
|
512
|
-
for (const plugin
|
|
513
|
-
const context = createPluginContext(plugin
|
|
514
|
-
if (typeof plugin
|
|
515
|
-
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);
|
|
516
832
|
if (config != null) mergedConfig = mergeConfig(mergedConfig, config);
|
|
517
|
-
} else if (typeof plugin
|
|
833
|
+
} else if (typeof plugin.config === "object") mergedConfig = mergeConfig(mergedConfig, plugin.config);
|
|
518
834
|
}
|
|
519
835
|
return mergedConfig;
|
|
520
836
|
}
|
|
521
837
|
async function invokeConfigResolved(config, plugins) {
|
|
522
|
-
await Promise.all(plugins.map((plugin
|
|
523
|
-
const context = createPluginContext(plugin
|
|
524
|
-
return plugin
|
|
838
|
+
await Promise.all(plugins.map((plugin) => {
|
|
839
|
+
const context = createPluginContext(plugin.name);
|
|
840
|
+
return plugin.configResolved?.call(context, config);
|
|
525
841
|
}));
|
|
526
842
|
}
|
|
527
843
|
|
|
528
|
-
//#endregion
|
|
529
|
-
//#region src/logger.ts
|
|
530
|
-
const logger$2 = new Logger("bundler");
|
|
531
|
-
|
|
532
844
|
//#endregion
|
|
533
845
|
//#region src/core/fs/data.ts
|
|
534
846
|
function getSharedDataPath(basePath) {
|
|
535
847
|
return path.join(basePath, SHARED_DATA_PATH);
|
|
536
848
|
}
|
|
537
|
-
|
|
538
|
-
//#endregion
|
|
539
|
-
//#region src/core/cache/file-system-cache.ts
|
|
540
|
-
var FileSystemCache = class FileSystemCache {
|
|
541
|
-
pendingData = /* @__PURE__ */ new Map();
|
|
542
|
-
cacheDirectory;
|
|
543
|
-
static getCacheDirectory(projectRoot) {
|
|
544
|
-
return path.join(getSharedDataPath(projectRoot), "cache");
|
|
545
|
-
}
|
|
546
|
-
static clearAll(projectRoot) {
|
|
547
|
-
fs.rmSync(FileSystemCache.getCacheDirectory(projectRoot), {
|
|
548
|
-
recursive: true,
|
|
549
|
-
force: true
|
|
550
|
-
});
|
|
551
|
-
}
|
|
552
|
-
constructor(projectRoot, id$1) {
|
|
553
|
-
this.cacheDirectory = path.join(FileSystemCache.getCacheDirectory(projectRoot), id$1);
|
|
554
|
-
this.ensureCacheDirectory(this.cacheDirectory);
|
|
555
|
-
logger$2.debug("cache directory:", this.cacheDirectory);
|
|
556
|
-
}
|
|
557
|
-
ensureCacheDirectory(cacheDirectory) {
|
|
558
|
-
if (!fs.existsSync(cacheDirectory)) fs.mkdirSync(cacheDirectory, { recursive: true });
|
|
559
|
-
}
|
|
560
|
-
get(key) {
|
|
561
|
-
try {
|
|
562
|
-
return fs.readFileSync(path.join(this.cacheDirectory, key), "utf-8");
|
|
563
|
-
} catch {
|
|
564
|
-
return;
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
set(key, value) {
|
|
568
|
-
this.pendingData.set(key, value);
|
|
569
|
-
}
|
|
570
|
-
async flush() {
|
|
571
|
-
const limit = pLimit(process.env.ROLLIPOP_CACHE_FLUSH_LIMIT ? parseInt(process.env.ROLLIPOP_CACHE_FLUSH_LIMIT) : 20);
|
|
572
|
-
const entries = Array.from(this.pendingData.entries());
|
|
573
|
-
await Promise.all(entries.map(([key, value]) => limit(async () => {
|
|
574
|
-
try {
|
|
575
|
-
await fs.promises.writeFile(path.join(this.cacheDirectory, key), value);
|
|
576
|
-
} catch (error) {
|
|
577
|
-
logger$2.error("Failed to write cache file", key);
|
|
578
|
-
logger$2.debug(error);
|
|
579
|
-
}
|
|
580
|
-
}))).catch((error) => {
|
|
581
|
-
logger$2.error("Failed to flush cache", error);
|
|
582
|
-
});
|
|
583
|
-
this.pendingData.clear();
|
|
584
|
-
}
|
|
585
|
-
clear() {
|
|
586
|
-
fs.rmSync(this.cacheDirectory, {
|
|
587
|
-
recursive: true,
|
|
588
|
-
force: true
|
|
589
|
-
});
|
|
590
|
-
this.ensureCacheDirectory(this.cacheDirectory);
|
|
591
|
-
}
|
|
592
|
-
};
|
|
593
|
-
|
|
594
|
-
//#endregion
|
|
595
|
-
//#region src/utils/reset-cache.ts
|
|
596
|
-
function resetCache(projectRoot) {
|
|
597
|
-
FileSystemCache.clearAll(projectRoot);
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
//#endregion
|
|
601
|
-
//#region src/common/logo.ts
|
|
602
|
-
const CANDY = `
|
|
603
|
-
_....._
|
|
604
|
-
.' _..._ '.
|
|
605
|
-
/ /\` __ \`\\ \\
|
|
606
|
-
; ; /\` \\ | ;
|
|
607
|
-
| | | (_/ ; |
|
|
608
|
-
; ; \\_ _.' .;
|
|
609
|
-
\\ '. \`\` _.'/
|
|
610
|
-
'._\`"'"\`_.'`;
|
|
611
|
-
const STICK = `
|
|
612
|
-
/ /\`\`
|
|
613
|
-
/ /
|
|
614
|
-
/__/`;
|
|
615
|
-
const DESCRIPTIONS = [
|
|
616
|
-
"Rollipop",
|
|
617
|
-
"Modern build toolkit for React Native",
|
|
618
|
-
"Powered by Rolldown"
|
|
619
|
-
];
|
|
620
|
-
const PRIMARY_COLOR = "#42A5F5";
|
|
621
|
-
const BASE_GRADIENT_COLORS = [PRIMARY_COLOR, "#BBDEFB"];
|
|
622
|
-
const PADDING = 20;
|
|
623
|
-
function printLogo() {
|
|
624
|
-
let maxLogoWidth = 0;
|
|
625
|
-
const padding = " ".repeat(PADDING);
|
|
626
|
-
const gradientColors = [...BASE_GRADIENT_COLORS];
|
|
627
|
-
const styledCandy = CANDY.split("\n").map((line) => {
|
|
628
|
-
maxLogoWidth = Math.max(line.length, maxLogoWidth);
|
|
629
|
-
return gradient(gradientColors.reverse())(line);
|
|
630
|
-
}).join("\n") + STICK;
|
|
631
|
-
console.log(styledCandy.split("\n").map((line) => padding + line).join("\n"));
|
|
632
|
-
console.log("");
|
|
633
|
-
DESCRIPTIONS.forEach((description, index) => {
|
|
634
|
-
const descriptionHalfLength = description.length / 2;
|
|
635
|
-
const logoHalfWidth = maxLogoWidth / 2;
|
|
636
|
-
const padding$1 = " ".repeat(PADDING - descriptionHalfLength + logoHalfWidth);
|
|
637
|
-
if (index === 0) console.log(padding$1 + chalk.bold.hex(PRIMARY_COLOR)(description));
|
|
638
|
-
else console.log(padding$1 + description);
|
|
639
|
-
});
|
|
640
|
-
console.log("");
|
|
641
|
-
}
|
|
642
|
-
let _printed = false;
|
|
643
|
-
const Logo = {
|
|
644
|
-
print: printLogo,
|
|
645
|
-
printOnce: () => {
|
|
646
|
-
if (_printed) return;
|
|
647
|
-
_printed = true;
|
|
648
|
-
printLogo();
|
|
649
|
-
}
|
|
650
|
-
};
|
|
651
|
-
|
|
652
|
-
//#endregion
|
|
653
|
-
//#region src/utils/build-options.ts
|
|
654
|
-
const DEFAULT_BUILD_OPTIONS = {
|
|
655
|
-
cache: true,
|
|
656
|
-
minify: false
|
|
657
|
-
};
|
|
658
|
-
function resolveBuildOptions(config, buildOptions) {
|
|
659
|
-
if (buildOptions.outfile) buildOptions.outfile = path.resolve(config.root, buildOptions.outfile);
|
|
660
|
-
if ((buildOptions.sourcemap === true || buildOptions.sourcemap === "hidden") && buildOptions.sourcemapOutfile) buildOptions.sourcemapOutfile = path.resolve(config.root, buildOptions.sourcemapOutfile);
|
|
661
|
-
return merge(DEFAULT_BUILD_OPTIONS, {
|
|
662
|
-
...buildOptions,
|
|
663
|
-
dev: buildOptions.dev ?? config.mode === "development"
|
|
664
|
-
});
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
//#endregion
|
|
668
|
-
//#region src/utils/hash.ts
|
|
669
|
-
function xxhash(data) {
|
|
670
|
-
return xxh32(data).toString(16);
|
|
671
|
-
}
|
|
672
|
-
function md5(data) {
|
|
673
|
-
return crypto.createHash("md5").update(data).digest("hex");
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
//#endregion
|
|
677
|
-
//#region src/utils/serialize.ts
|
|
678
|
-
function serialize(value) {
|
|
679
|
-
return JSON.stringify(value, (_, value$1) => {
|
|
680
|
-
if (typeof value$1 === "function") return value$1.toString();
|
|
681
|
-
if (value$1 instanceof RegExp) return value$1.toString();
|
|
682
|
-
return value$1;
|
|
683
|
-
});
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
//#endregion
|
|
687
|
-
//#region src/utils/id.ts
|
|
688
|
-
function createId(config, buildOptions) {
|
|
689
|
-
return md5(serialize([
|
|
690
|
-
ROLLIPOP_VERSION,
|
|
691
|
-
filterTransformAffectedOptions(buildOptions),
|
|
692
|
-
filterTransformAffectedConfig(config)
|
|
693
|
-
]));
|
|
694
|
-
}
|
|
695
|
-
function filterTransformAffectedOptions(buildOptions) {
|
|
696
|
-
return pick(buildOptions, ["platform", "dev"]);
|
|
697
|
-
}
|
|
698
|
-
function filterTransformAffectedConfig(config) {
|
|
699
|
-
const { transformer, serializer, reactNative, devMode, plugins = [] } = config;
|
|
700
|
-
return [
|
|
701
|
-
transformer,
|
|
702
|
-
serializer.polyfills,
|
|
703
|
-
serializer.prelude,
|
|
704
|
-
reactNative.assetRegistryPath,
|
|
705
|
-
devMode,
|
|
706
|
-
plugins.map((plugin$3, index) => `${plugin$3.name}#${index}`)
|
|
707
|
-
];
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
//#endregion
|
|
711
|
-
//#region src/core/fs/storage.ts
|
|
712
|
-
const DEFAULT_DATA = { build: {} };
|
|
713
|
-
var FileStorage = class FileStorage {
|
|
714
|
-
static instance = null;
|
|
715
|
-
dataFilePath;
|
|
716
|
-
data;
|
|
717
|
-
static getInstance(basePath) {
|
|
718
|
-
if (FileStorage.instance == null) FileStorage.instance = new FileStorage(basePath);
|
|
719
|
-
return new FileStorage(basePath);
|
|
720
|
-
}
|
|
721
|
-
constructor(basePath) {
|
|
722
|
-
this.basePath = basePath;
|
|
723
|
-
this.dataFilePath = path.join(getSharedDataPath(basePath), "rollipop.json");
|
|
724
|
-
if (fs.existsSync(this.dataFilePath)) this.data = JSON.parse(fs.readFileSync(this.dataFilePath, "utf-8"));
|
|
725
|
-
else this.data = DEFAULT_DATA;
|
|
726
|
-
}
|
|
727
|
-
get() {
|
|
728
|
-
return this.data;
|
|
729
|
-
}
|
|
730
|
-
set(data) {
|
|
731
|
-
this.data = merge(this.data, data);
|
|
732
|
-
fs.writeFileSync(this.dataFilePath, JSON.stringify(this.data, null, 2));
|
|
733
|
-
}
|
|
734
|
-
};
|
|
735
|
-
|
|
736
|
-
//#endregion
|
|
737
|
-
//#region src/utils/string.ts
|
|
738
|
-
function indent(text, indent$1, space = " ") {
|
|
739
|
-
return text.replace(/^/gm, space.repeat(indent$1));
|
|
740
|
-
}
|
|
741
|
-
|
|
742
|
-
//#endregion
|
|
743
|
-
//#region src/common/code.ts
|
|
744
|
-
function asLiteral(value) {
|
|
745
|
-
return JSON.stringify(value);
|
|
746
|
-
}
|
|
747
|
-
function asIdentifier(name) {
|
|
748
|
-
return name;
|
|
749
|
-
}
|
|
750
|
-
function nodeEnvironment(dev$1) {
|
|
751
|
-
return dev$1 ? "development" : "production";
|
|
752
|
-
}
|
|
753
|
-
function iife(body, path$1 = "<unknown>") {
|
|
754
|
-
const bodyPlaceholder = "__BODY__";
|
|
755
|
-
return dedent`
|
|
756
|
-
// ${path$1}
|
|
757
|
-
(function (global) {
|
|
758
|
-
${bodyPlaceholder}
|
|
759
|
-
})(${GLOBAL_IDENTIFIER});
|
|
760
|
-
`.replace(bodyPlaceholder, indent(body, 1));
|
|
761
|
-
}
|
|
762
|
-
|
|
763
|
-
//#endregion
|
|
764
|
-
//#region src/utils/storage.ts
|
|
765
|
-
function getBuildTotalModules(storage, id$1) {
|
|
766
|
-
return storage.get().build[id$1]?.totalModules ?? 0;
|
|
767
|
-
}
|
|
768
|
-
function setBuildTotalModules(storage, id$1, totalModules) {
|
|
769
|
-
storage.set({ build: { [id$1]: { totalModules } } });
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
//#endregion
|
|
773
|
-
//#region src/utils/terminal.ts
|
|
774
|
-
/**
|
|
775
|
-
* Based on https://github.com/sindresorhus/log-update/blob/master/index.js
|
|
776
|
-
* Based on https://github.com/unjs/webpackbar
|
|
777
|
-
*/
|
|
778
|
-
function eraseLines(count) {
|
|
779
|
-
let clear = "";
|
|
780
|
-
for (let i = 0; i < count; i++) clear += `\u001B[2K` + (i < count - 1 ? `\u001B[1A` : "");
|
|
781
|
-
if (count) clear += `\u001B[G`;
|
|
782
|
-
return clear;
|
|
783
|
-
}
|
|
784
|
-
function ellipsisLeft(value, maxLength) {
|
|
785
|
-
if (value.length <= maxLength - 3) return value;
|
|
786
|
-
return `...${value.slice(value.length - maxLength - 1)}`;
|
|
787
|
-
}
|
|
788
|
-
const originalWrite = Symbol("original-write");
|
|
789
|
-
var StreamManager = class {
|
|
790
|
-
prevLineCount;
|
|
791
|
-
listening;
|
|
792
|
-
extraLines;
|
|
793
|
-
_streams;
|
|
794
|
-
constructor() {
|
|
795
|
-
this.prevLineCount = 0;
|
|
796
|
-
this.listening = false;
|
|
797
|
-
this.extraLines = "";
|
|
798
|
-
this._onData = this._onData.bind(this);
|
|
799
|
-
this._streams = [process.stdout, process.stderr];
|
|
849
|
+
|
|
850
|
+
//#endregion
|
|
851
|
+
//#region src/core/cache/file-system-cache.ts
|
|
852
|
+
var FileSystemCache = class FileSystemCache {
|
|
853
|
+
pendingData = /* @__PURE__ */ new Map();
|
|
854
|
+
cacheDirectory;
|
|
855
|
+
static getCacheDirectory(projectRoot) {
|
|
856
|
+
return path.join(getSharedDataPath(projectRoot), "cache");
|
|
800
857
|
}
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
hard: true,
|
|
806
|
-
wordWrap: false
|
|
858
|
+
static clearAll(projectRoot) {
|
|
859
|
+
fs.rmSync(FileSystemCache.getCacheDirectory(projectRoot), {
|
|
860
|
+
recursive: true,
|
|
861
|
+
force: true
|
|
807
862
|
});
|
|
808
|
-
const data = eraseLines(this.prevLineCount) + wrappedLines + "\n" + this.extraLines;
|
|
809
|
-
this.write(data);
|
|
810
|
-
this.prevLineCount = data.split("\n").length;
|
|
811
|
-
}
|
|
812
|
-
get columns() {
|
|
813
|
-
return (process.stderr.columns || 80) - 2;
|
|
814
863
|
}
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
}
|
|
820
|
-
clear() {
|
|
821
|
-
this.done();
|
|
822
|
-
this.write(eraseLines(this.prevLineCount));
|
|
864
|
+
constructor(projectRoot, id) {
|
|
865
|
+
this.cacheDirectory = path.join(FileSystemCache.getCacheDirectory(projectRoot), id);
|
|
866
|
+
this.ensureCacheDirectory(this.cacheDirectory);
|
|
867
|
+
logger$2.debug("cache directory:", this.cacheDirectory);
|
|
823
868
|
}
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
this.prevLineCount = 0;
|
|
827
|
-
this.extraLines = "";
|
|
869
|
+
ensureCacheDirectory(cacheDirectory) {
|
|
870
|
+
if (!fs.existsSync(cacheDirectory)) fs.mkdirSync(cacheDirectory, { recursive: true });
|
|
828
871
|
}
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
872
|
+
get(key) {
|
|
873
|
+
try {
|
|
874
|
+
return fs.readFileSync(path.join(this.cacheDirectory, key), "utf-8");
|
|
875
|
+
} catch {
|
|
876
|
+
return;
|
|
834
877
|
}
|
|
835
878
|
}
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
for (const stream of this._streams) {
|
|
839
|
-
if (stream.write[originalWrite]) continue;
|
|
840
|
-
const write = (data, ...args) => {
|
|
841
|
-
if (!stream.write[originalWrite]) return stream.write(data, ...args);
|
|
842
|
-
this._onData(data);
|
|
843
|
-
return stream.write[originalWrite].call(stream, data, ...args);
|
|
844
|
-
};
|
|
845
|
-
write[originalWrite] = stream.write;
|
|
846
|
-
stream.write = write;
|
|
847
|
-
}
|
|
848
|
-
this.listening = true;
|
|
879
|
+
set(key, value) {
|
|
880
|
+
this.pendingData.set(key, value);
|
|
849
881
|
}
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
882
|
+
async flush() {
|
|
883
|
+
const limit = pLimit(process.env.ROLLIPOP_CACHE_FLUSH_LIMIT ? parseInt(process.env.ROLLIPOP_CACHE_FLUSH_LIMIT) : 20);
|
|
884
|
+
const entries = Array.from(this.pendingData.entries());
|
|
885
|
+
await Promise.all(entries.map(([key, value]) => limit(async () => {
|
|
886
|
+
try {
|
|
887
|
+
await fs.promises.writeFile(path.join(this.cacheDirectory, key), value);
|
|
888
|
+
} catch (error) {
|
|
889
|
+
logger$2.error("Failed to write cache file", key);
|
|
890
|
+
logger$2.debug(error);
|
|
891
|
+
}
|
|
892
|
+
}))).catch((error) => {
|
|
893
|
+
logger$2.error("Failed to flush cache", error);
|
|
894
|
+
});
|
|
895
|
+
this.pendingData.clear();
|
|
896
|
+
}
|
|
897
|
+
clear() {
|
|
898
|
+
fs.rmSync(this.cacheDirectory, {
|
|
899
|
+
recursive: true,
|
|
900
|
+
force: true
|
|
901
|
+
});
|
|
902
|
+
this.ensureCacheDirectory(this.cacheDirectory);
|
|
853
903
|
}
|
|
854
904
|
};
|
|
855
905
|
|
|
856
906
|
//#endregion
|
|
857
|
-
//#region src/
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
907
|
+
//#region src/utils/reset-cache.ts
|
|
908
|
+
function resetCache(projectRoot) {
|
|
909
|
+
FileSystemCache.clearAll(projectRoot);
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
//#endregion
|
|
913
|
+
//#region src/common/logo.ts
|
|
914
|
+
const CANDY = `
|
|
915
|
+
_....._
|
|
916
|
+
.' _..._ '.
|
|
917
|
+
/ /\` __ \`\\ \\
|
|
918
|
+
; ; /\` \\ | ;
|
|
919
|
+
| | | (_/ ; |
|
|
920
|
+
; ; \\_ _.' .;
|
|
921
|
+
\\ '. \`\` _.'/
|
|
922
|
+
'._\`"'"\`_.'`;
|
|
923
|
+
const STICK = `
|
|
924
|
+
/ /\`\`
|
|
925
|
+
/ /
|
|
926
|
+
/__/`;
|
|
927
|
+
const DESCRIPTIONS = [
|
|
928
|
+
"Rollipop",
|
|
929
|
+
"Modern build toolkit for React Native",
|
|
930
|
+
"Powered by Rolldown"
|
|
931
|
+
];
|
|
932
|
+
const PRIMARY_COLOR = "#42A5F5";
|
|
933
|
+
const BASE_GRADIENT_COLORS = [PRIMARY_COLOR, "#BBDEFB"];
|
|
934
|
+
const PADDING = 20;
|
|
935
|
+
function printLogo() {
|
|
936
|
+
let maxLogoWidth = 0;
|
|
937
|
+
const padding = " ".repeat(PADDING);
|
|
938
|
+
const gradientColors = [...BASE_GRADIENT_COLORS];
|
|
939
|
+
const styledCandy = CANDY.split("\n").map((line) => {
|
|
940
|
+
maxLogoWidth = Math.max(line.length, maxLogoWidth);
|
|
941
|
+
return gradient(gradientColors.reverse())(line);
|
|
942
|
+
}).join("\n") + STICK;
|
|
943
|
+
console.log(styledCandy.split("\n").map((line) => padding + line).join("\n"));
|
|
944
|
+
console.log("");
|
|
945
|
+
DESCRIPTIONS.forEach((description, index) => {
|
|
946
|
+
const descriptionHalfLength = description.length / 2;
|
|
947
|
+
const logoHalfWidth = maxLogoWidth / 2;
|
|
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);
|
|
951
|
+
});
|
|
952
|
+
console.log("");
|
|
953
|
+
}
|
|
954
|
+
let _printed = false;
|
|
955
|
+
const Logo = {
|
|
956
|
+
print: printLogo,
|
|
957
|
+
printOnce: () => {
|
|
958
|
+
if (_printed) return;
|
|
959
|
+
_printed = true;
|
|
960
|
+
printLogo();
|
|
894
961
|
}
|
|
895
962
|
};
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
total;
|
|
903
|
-
stale = false;
|
|
904
|
-
constructor(options) {
|
|
905
|
-
this.total = options.total;
|
|
906
|
-
this.label = options.label;
|
|
907
|
-
this.renderer = options.renderer ?? new ProgressBarRenderer();
|
|
908
|
-
}
|
|
909
|
-
get done() {
|
|
910
|
-
return this.state.type === "completed";
|
|
911
|
-
}
|
|
912
|
-
setCurrent(current) {
|
|
913
|
-
this.current = current;
|
|
914
|
-
this.stale = true;
|
|
915
|
-
return this;
|
|
916
|
-
}
|
|
917
|
-
setTotal(total) {
|
|
918
|
-
this.total = total;
|
|
919
|
-
this.stale = true;
|
|
920
|
-
return this;
|
|
921
|
-
}
|
|
922
|
-
start() {
|
|
923
|
-
this.state = { type: "running" };
|
|
924
|
-
this.stale = true;
|
|
925
|
-
return this;
|
|
926
|
-
}
|
|
927
|
-
setModuleId(moduleId) {
|
|
928
|
-
if (this.state.type !== "running") return this;
|
|
929
|
-
this.state = {
|
|
930
|
-
type: "running",
|
|
931
|
-
moduleId
|
|
932
|
-
};
|
|
933
|
-
this.stale = true;
|
|
934
|
-
return this;
|
|
935
|
-
}
|
|
936
|
-
complete(duration, hasErrors = false) {
|
|
937
|
-
this.state = {
|
|
938
|
-
type: "completed",
|
|
939
|
-
duration,
|
|
940
|
-
hasErrors
|
|
941
|
-
};
|
|
942
|
-
this.stale = true;
|
|
943
|
-
return this;
|
|
944
|
-
}
|
|
945
|
-
render() {
|
|
946
|
-
this.stale = false;
|
|
947
|
-
const context = {
|
|
948
|
-
label: this.label,
|
|
949
|
-
current: this.current,
|
|
950
|
-
total: this.total,
|
|
951
|
-
columns: this.columns
|
|
952
|
-
};
|
|
953
|
-
return this.renderer.render(this.state, context);
|
|
954
|
-
}
|
|
963
|
+
|
|
964
|
+
//#endregion
|
|
965
|
+
//#region src/utils/build-options.ts
|
|
966
|
+
const DEFAULT_BUILD_OPTIONS = {
|
|
967
|
+
cache: true,
|
|
968
|
+
minify: false
|
|
955
969
|
};
|
|
956
|
-
|
|
970
|
+
function resolveBuildOptions(config, buildOptions) {
|
|
971
|
+
if (buildOptions.outfile) buildOptions.outfile = path.resolve(config.root, buildOptions.outfile);
|
|
972
|
+
if ((buildOptions.sourcemap === true || buildOptions.sourcemap === "hidden") && buildOptions.sourcemapOutfile) buildOptions.sourcemapOutfile = path.resolve(config.root, buildOptions.sourcemapOutfile);
|
|
973
|
+
return merge(DEFAULT_BUILD_OPTIONS, {
|
|
974
|
+
...buildOptions,
|
|
975
|
+
dev: buildOptions.dev ?? config.mode === "development"
|
|
976
|
+
});
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
//#endregion
|
|
980
|
+
//#region src/utils/hash.ts
|
|
981
|
+
function xxhash(data) {
|
|
982
|
+
return xxh32(data).toString(16);
|
|
983
|
+
}
|
|
984
|
+
function md5(data) {
|
|
985
|
+
return crypto.createHash("md5").update(data).digest("hex");
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
//#endregion
|
|
989
|
+
//#region src/utils/serialize.ts
|
|
990
|
+
function serialize(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;
|
|
995
|
+
});
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
//#endregion
|
|
999
|
+
//#region src/utils/id.ts
|
|
1000
|
+
function createId(config, buildOptions) {
|
|
1001
|
+
return md5(serialize([
|
|
1002
|
+
ROLLIPOP_VERSION,
|
|
1003
|
+
filterTransformAffectedOptions(buildOptions),
|
|
1004
|
+
filterTransformAffectedConfig(config)
|
|
1005
|
+
]));
|
|
1006
|
+
}
|
|
1007
|
+
function filterTransformAffectedOptions(buildOptions) {
|
|
1008
|
+
return pick(buildOptions, ["platform", "dev"]);
|
|
1009
|
+
}
|
|
1010
|
+
function filterTransformAffectedConfig(config) {
|
|
1011
|
+
const { transformer, serializer, reactNative, devMode, plugins = [] } = config;
|
|
1012
|
+
return [
|
|
1013
|
+
transformer,
|
|
1014
|
+
serializer.polyfills,
|
|
1015
|
+
serializer.prelude,
|
|
1016
|
+
reactNative.assetRegistryPath,
|
|
1017
|
+
devMode,
|
|
1018
|
+
plugins.map((plugin, index) => `${plugin.name}#${index}`)
|
|
1019
|
+
];
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
//#endregion
|
|
1023
|
+
//#region src/core/fs/storage.ts
|
|
1024
|
+
const DEFAULT_DATA = { build: {} };
|
|
1025
|
+
var FileStorage = class FileStorage {
|
|
957
1026
|
static instance = null;
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
return ProgressBarRenderManager.instance;
|
|
964
|
-
}
|
|
965
|
-
constructor() {
|
|
966
|
-
this.throttledRender = throttle(this._render.bind(this), 50);
|
|
967
|
-
}
|
|
968
|
-
_render() {
|
|
969
|
-
const renderedLines = Array.from(this.progressBars.values().filter((progressBar$1) => progressBar$1.stale).map((progressBar$1) => progressBar$1.render()));
|
|
970
|
-
if (renderedLines.length > 0) this.streamManager.render(renderedLines.join("\n\n"));
|
|
971
|
-
}
|
|
972
|
-
register(key, options) {
|
|
973
|
-
const progressBar$1 = this.progressBars.get(key);
|
|
974
|
-
if (progressBar$1 == null) {
|
|
975
|
-
const newProgressBar = new ProgressBar(options);
|
|
976
|
-
this.progressBars.set(key, newProgressBar);
|
|
977
|
-
return newProgressBar;
|
|
978
|
-
}
|
|
979
|
-
return progressBar$1;
|
|
980
|
-
}
|
|
981
|
-
start() {
|
|
982
|
-
console.log();
|
|
983
|
-
this.streamManager.listen();
|
|
984
|
-
this._render();
|
|
1027
|
+
dataFilePath;
|
|
1028
|
+
data;
|
|
1029
|
+
static getInstance(basePath) {
|
|
1030
|
+
if (FileStorage.instance == null) FileStorage.instance = new FileStorage(basePath);
|
|
1031
|
+
return new FileStorage(basePath);
|
|
985
1032
|
}
|
|
986
|
-
|
|
987
|
-
this.
|
|
1033
|
+
constructor(basePath) {
|
|
1034
|
+
this.basePath = basePath;
|
|
1035
|
+
this.dataFilePath = path.join(getSharedDataPath(basePath), "rollipop.json");
|
|
1036
|
+
if (fs.existsSync(this.dataFilePath)) this.data = JSON.parse(fs.readFileSync(this.dataFilePath, "utf-8"));
|
|
1037
|
+
else this.data = DEFAULT_DATA;
|
|
988
1038
|
}
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
this._render();
|
|
992
|
-
this.streamManager.done();
|
|
993
|
-
console.log();
|
|
994
|
-
}
|
|
1039
|
+
get() {
|
|
1040
|
+
return this.data;
|
|
995
1041
|
}
|
|
996
|
-
|
|
997
|
-
this.
|
|
1042
|
+
set(data) {
|
|
1043
|
+
this.data = merge(this.data, data);
|
|
1044
|
+
fs.writeFileSync(this.dataFilePath, JSON.stringify(this.data, null, 2));
|
|
998
1045
|
}
|
|
999
1046
|
};
|
|
1000
1047
|
|
|
1001
1048
|
//#endregion
|
|
1002
|
-
//#region src/
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
ProgressFlags$1[ProgressFlags$1["BUILD_IN_PROGRESS"] = 1] = "BUILD_IN_PROGRESS";
|
|
1006
|
-
ProgressFlags$1[ProgressFlags$1["FILE_CHANGED"] = 2] = "FILE_CHANGED";
|
|
1007
|
-
return ProgressFlags$1;
|
|
1008
|
-
}(ProgressFlags || {});
|
|
1009
|
-
function none(reporter) {
|
|
1010
|
-
return withReporter(reporter);
|
|
1049
|
+
//#region src/utils/string.ts
|
|
1050
|
+
function indent(text, indent, space = " ") {
|
|
1051
|
+
return text.replace(/^/gm, space.repeat(indent));
|
|
1011
1052
|
}
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
onEnd({ totalModules, duration, error }) {
|
|
1018
|
-
const time = chalk.blue(`${duration.toFixed(2)}ms`);
|
|
1019
|
-
const modules = chalk.blue(`(${totalModules} modules)`);
|
|
1020
|
-
if (error) logger$2.error(`Build failed in ${time} ${modules}`);
|
|
1021
|
-
else logger$2.info(`Build completed in ${time} ${modules}`);
|
|
1022
|
-
}
|
|
1023
|
-
});
|
|
1053
|
+
|
|
1054
|
+
//#endregion
|
|
1055
|
+
//#region src/common/code.ts
|
|
1056
|
+
function asLiteral(value) {
|
|
1057
|
+
return JSON.stringify(value);
|
|
1024
1058
|
}
|
|
1025
|
-
function
|
|
1026
|
-
|
|
1027
|
-
const initialTotalModules = getBuildTotalModules(context.storage, context.id);
|
|
1028
|
-
const renderManager = ProgressBarRenderManager.getInstance();
|
|
1029
|
-
const progressBar$1 = renderManager.register(context.id, {
|
|
1030
|
-
label,
|
|
1031
|
-
total: initialTotalModules
|
|
1032
|
-
});
|
|
1033
|
-
const renderProgress = (id$1, totalModules, transformedModules) => {
|
|
1034
|
-
if (totalModules != null) progressBar$1.setTotal(totalModules);
|
|
1035
|
-
progressBar$1.setCurrent(transformedModules).setModuleId(id$1);
|
|
1036
|
-
renderManager.render();
|
|
1037
|
-
};
|
|
1038
|
-
return withReporter(reporter, {
|
|
1039
|
-
initialTotalModules,
|
|
1040
|
-
onStart() {
|
|
1041
|
-
flags |= ProgressFlags.BUILD_IN_PROGRESS;
|
|
1042
|
-
progressBar$1.start();
|
|
1043
|
-
renderManager.start();
|
|
1044
|
-
},
|
|
1045
|
-
onEnd({ error, duration, totalModules }) {
|
|
1046
|
-
flags = ProgressFlags.NONE;
|
|
1047
|
-
progressBar$1.setTotal(totalModules).complete(duration, Boolean(error));
|
|
1048
|
-
renderManager.release();
|
|
1049
|
-
setBuildTotalModules(context.storage, context.id, totalModules);
|
|
1050
|
-
},
|
|
1051
|
-
onTransform({ id: id$1, totalModules, transformedModules }) {
|
|
1052
|
-
if (flags & ProgressFlags.FILE_CHANGED) {
|
|
1053
|
-
logger$2.debug("Transformed changed file", { id: id$1 });
|
|
1054
|
-
return;
|
|
1055
|
-
}
|
|
1056
|
-
renderProgress(id$1, totalModules, transformedModules);
|
|
1057
|
-
},
|
|
1058
|
-
onWatchChange() {
|
|
1059
|
-
flags |= ProgressFlags.FILE_CHANGED;
|
|
1060
|
-
}
|
|
1061
|
-
});
|
|
1059
|
+
function asIdentifier(name) {
|
|
1060
|
+
return name;
|
|
1062
1061
|
}
|
|
1063
|
-
function
|
|
1064
|
-
return
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
});
|
|
1075
|
-
else reporter.update({ type: "bundle_build_done" });
|
|
1076
|
-
statusPluginOptions?.onEnd?.(result);
|
|
1077
|
-
},
|
|
1078
|
-
onTransform(result) {
|
|
1079
|
-
reporter.update({
|
|
1080
|
-
type: "transform",
|
|
1081
|
-
...result
|
|
1082
|
-
});
|
|
1083
|
-
statusPluginOptions?.onTransform?.(result);
|
|
1084
|
-
},
|
|
1085
|
-
onWatchChange(id$1) {
|
|
1086
|
-
reporter.update({
|
|
1087
|
-
type: "watch_change",
|
|
1088
|
-
id: id$1
|
|
1089
|
-
});
|
|
1090
|
-
statusPluginOptions?.onWatchChange?.(id$1);
|
|
1091
|
-
}
|
|
1092
|
-
};
|
|
1062
|
+
function nodeEnvironment(dev) {
|
|
1063
|
+
return dev ? "development" : "production";
|
|
1064
|
+
}
|
|
1065
|
+
function iife(body, path = "<unknown>") {
|
|
1066
|
+
const bodyPlaceholder = "__BODY__";
|
|
1067
|
+
return dedent`
|
|
1068
|
+
// ${path}
|
|
1069
|
+
(function (global) {
|
|
1070
|
+
${bodyPlaceholder}
|
|
1071
|
+
})(${GLOBAL_IDENTIFIER});
|
|
1072
|
+
`.replace(bodyPlaceholder, indent(body, 1));
|
|
1093
1073
|
}
|
|
1094
|
-
const statusPresets = {
|
|
1095
|
-
none,
|
|
1096
|
-
compat,
|
|
1097
|
-
progressBar
|
|
1098
|
-
};
|
|
1099
1074
|
|
|
1100
1075
|
//#endregion
|
|
1101
1076
|
//#region src/utils/config.ts
|
|
@@ -1119,7 +1094,7 @@ function bindReporter(config, eventSource) {
|
|
|
1119
1094
|
eventSource.emit("watchChange", event.id);
|
|
1120
1095
|
break;
|
|
1121
1096
|
}
|
|
1122
|
-
originalReporter
|
|
1097
|
+
originalReporter?.update(event);
|
|
1123
1098
|
} };
|
|
1124
1099
|
return config;
|
|
1125
1100
|
}
|
|
@@ -1154,6 +1129,12 @@ function getBaseUrl(host, port, https) {
|
|
|
1154
1129
|
return `${https ? "https" : "http"}://${host}:${port}`;
|
|
1155
1130
|
}
|
|
1156
1131
|
|
|
1132
|
+
//#endregion
|
|
1133
|
+
//#region src/utils/storage.ts
|
|
1134
|
+
function getBuildTotalModules(storage, id) {
|
|
1135
|
+
return storage.get().build[id]?.totalModules ?? 0;
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1157
1138
|
//#endregion
|
|
1158
1139
|
//#region src/core/env.ts
|
|
1159
1140
|
function loadEnv(options) {
|
|
@@ -1183,30 +1164,6 @@ function loadEnv(options) {
|
|
|
1183
1164
|
return env;
|
|
1184
1165
|
}
|
|
1185
1166
|
|
|
1186
|
-
//#endregion
|
|
1187
|
-
//#region node_modules/mitt/dist/mitt.mjs
|
|
1188
|
-
function mitt_default(n) {
|
|
1189
|
-
return {
|
|
1190
|
-
all: n = n || /* @__PURE__ */ new Map(),
|
|
1191
|
-
on: function(t, e) {
|
|
1192
|
-
var i = n.get(t);
|
|
1193
|
-
i ? i.push(e) : n.set(t, [e]);
|
|
1194
|
-
},
|
|
1195
|
-
off: function(t, e) {
|
|
1196
|
-
var i = n.get(t);
|
|
1197
|
-
i && (e ? i.splice(i.indexOf(e) >>> 0, 1) : n.set(t, []));
|
|
1198
|
-
},
|
|
1199
|
-
emit: function(t, e) {
|
|
1200
|
-
var i = n.get(t);
|
|
1201
|
-
i && i.slice().map(function(n$1) {
|
|
1202
|
-
n$1(e);
|
|
1203
|
-
}), (i = n.get("*")) && i.slice().map(function(n$1) {
|
|
1204
|
-
n$1(t, e);
|
|
1205
|
-
});
|
|
1206
|
-
}
|
|
1207
|
-
};
|
|
1208
|
-
}
|
|
1209
|
-
|
|
1210
1167
|
//#endregion
|
|
1211
1168
|
//#region src/server/logger.ts
|
|
1212
1169
|
const logger$1 = new Logger("dev-server");
|
|
@@ -1256,12 +1213,12 @@ async function assertDevServerStatus(options) {
|
|
|
1256
1213
|
}
|
|
1257
1214
|
if (shouldExit) process.exit(1);
|
|
1258
1215
|
}
|
|
1259
|
-
var DevServerStatus = /* @__PURE__ */ function(DevServerStatus
|
|
1260
|
-
DevServerStatus
|
|
1261
|
-
DevServerStatus
|
|
1262
|
-
DevServerStatus
|
|
1263
|
-
DevServerStatus
|
|
1264
|
-
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;
|
|
1265
1222
|
}(DevServerStatus || {});
|
|
1266
1223
|
async function getDevServerStatus(devServerUrl, projectRoot) {
|
|
1267
1224
|
const { hostname, port } = new URL(devServerUrl);
|
|
@@ -1392,9 +1349,9 @@ var BundlerDevEngine = class extends EventEmitter {
|
|
|
1392
1349
|
}
|
|
1393
1350
|
get sourceMappingURL() {
|
|
1394
1351
|
const { host, port } = this.options.server;
|
|
1395
|
-
const { platform, dev
|
|
1352
|
+
const { platform, dev } = this.buildOptions;
|
|
1396
1353
|
const [name] = this.config.entry.split(".");
|
|
1397
|
-
return `http://${host}:${port}/${name}.bundle.map?platform=${platform}&dev=${dev
|
|
1354
|
+
return `http://${host}:${port}/${name}.bundle.map?platform=${platform}&dev=${dev}`;
|
|
1398
1355
|
}
|
|
1399
1356
|
async initialize() {
|
|
1400
1357
|
if (this._state !== "idle" || this._devEngine != null) return this;
|
|
@@ -1475,10 +1432,10 @@ var BundlerPool = class BundlerPool {
|
|
|
1475
1432
|
bundleName,
|
|
1476
1433
|
key
|
|
1477
1434
|
});
|
|
1478
|
-
const instance
|
|
1435
|
+
const instance = new BundlerDevEngine({ server: this.resolvedServerOptions }, this.config, buildOptions);
|
|
1479
1436
|
logger$1.debug("Setting new bundler instance", { key });
|
|
1480
|
-
BundlerPool.instances.set(key, instance
|
|
1481
|
-
return instance
|
|
1437
|
+
BundlerPool.instances.set(key, instance);
|
|
1438
|
+
return instance;
|
|
1482
1439
|
}
|
|
1483
1440
|
}
|
|
1484
1441
|
};
|
|
@@ -1528,9 +1485,9 @@ const plugin$2 = fp((fastify, options) => {
|
|
|
1528
1485
|
fastify.get(`/${DEV_SERVER_ASSET_PATH}/*`, {
|
|
1529
1486
|
schema: { querystring: queryParamSchema },
|
|
1530
1487
|
async handler(request, reply) {
|
|
1531
|
-
const { url
|
|
1532
|
-
const { pathname } = new URL(url
|
|
1533
|
-
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}/?`), ""));
|
|
1534
1491
|
let handle = null;
|
|
1535
1492
|
try {
|
|
1536
1493
|
handle = await fs.promises.open(resolveAssetPath(assetPath, {
|
|
@@ -1725,1394 +1682,30 @@ const plugin$1 = fp((fastify, options) => {
|
|
|
1725
1682
|
}, { name: "serve-bundle" });
|
|
1726
1683
|
|
|
1727
1684
|
//#endregion
|
|
1728
|
-
//#region
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
let formatter = (open, close, replace = open) => (input) => {
|
|
1733
|
-
let string = "" + input, index = string.indexOf(close, open.length);
|
|
1734
|
-
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
1735
|
-
};
|
|
1736
|
-
let replaceClose = (string, close, replace, index) => {
|
|
1737
|
-
let result = "", cursor = 0;
|
|
1738
|
-
do {
|
|
1739
|
-
result += string.substring(cursor, index) + replace;
|
|
1740
|
-
cursor = index + close.length;
|
|
1741
|
-
index = string.indexOf(close, cursor);
|
|
1742
|
-
} while (~index);
|
|
1743
|
-
return result + string.substring(cursor);
|
|
1744
|
-
};
|
|
1745
|
-
let createColors = (enabled = isColorSupported) => {
|
|
1746
|
-
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("?");
|
|
1747
1689
|
return {
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
1751
|
-
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
1752
|
-
italic: f("\x1B[3m", "\x1B[23m"),
|
|
1753
|
-
underline: f("\x1B[4m", "\x1B[24m"),
|
|
1754
|
-
inverse: f("\x1B[7m", "\x1B[27m"),
|
|
1755
|
-
hidden: f("\x1B[8m", "\x1B[28m"),
|
|
1756
|
-
strikethrough: f("\x1B[9m", "\x1B[29m"),
|
|
1757
|
-
black: f("\x1B[30m", "\x1B[39m"),
|
|
1758
|
-
red: f("\x1B[31m", "\x1B[39m"),
|
|
1759
|
-
green: f("\x1B[32m", "\x1B[39m"),
|
|
1760
|
-
yellow: f("\x1B[33m", "\x1B[39m"),
|
|
1761
|
-
blue: f("\x1B[34m", "\x1B[39m"),
|
|
1762
|
-
magenta: f("\x1B[35m", "\x1B[39m"),
|
|
1763
|
-
cyan: f("\x1B[36m", "\x1B[39m"),
|
|
1764
|
-
white: f("\x1B[37m", "\x1B[39m"),
|
|
1765
|
-
gray: f("\x1B[90m", "\x1B[39m"),
|
|
1766
|
-
bgBlack: f("\x1B[40m", "\x1B[49m"),
|
|
1767
|
-
bgRed: f("\x1B[41m", "\x1B[49m"),
|
|
1768
|
-
bgGreen: f("\x1B[42m", "\x1B[49m"),
|
|
1769
|
-
bgYellow: f("\x1B[43m", "\x1B[49m"),
|
|
1770
|
-
bgBlue: f("\x1B[44m", "\x1B[49m"),
|
|
1771
|
-
bgMagenta: f("\x1B[45m", "\x1B[49m"),
|
|
1772
|
-
bgCyan: f("\x1B[46m", "\x1B[49m"),
|
|
1773
|
-
bgWhite: f("\x1B[47m", "\x1B[49m"),
|
|
1774
|
-
blackBright: f("\x1B[90m", "\x1B[39m"),
|
|
1775
|
-
redBright: f("\x1B[91m", "\x1B[39m"),
|
|
1776
|
-
greenBright: f("\x1B[92m", "\x1B[39m"),
|
|
1777
|
-
yellowBright: f("\x1B[93m", "\x1B[39m"),
|
|
1778
|
-
blueBright: f("\x1B[94m", "\x1B[39m"),
|
|
1779
|
-
magentaBright: f("\x1B[95m", "\x1B[39m"),
|
|
1780
|
-
cyanBright: f("\x1B[96m", "\x1B[39m"),
|
|
1781
|
-
whiteBright: f("\x1B[97m", "\x1B[39m"),
|
|
1782
|
-
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
|
|
1783
|
-
bgRedBright: f("\x1B[101m", "\x1B[49m"),
|
|
1784
|
-
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
|
|
1785
|
-
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
|
|
1786
|
-
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
|
|
1787
|
-
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
|
|
1788
|
-
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
|
|
1789
|
-
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
1790
|
-
};
|
|
1791
|
-
};
|
|
1792
|
-
module.exports = createColors();
|
|
1793
|
-
module.exports.createColors = createColors;
|
|
1794
|
-
}));
|
|
1795
|
-
|
|
1796
|
-
//#endregion
|
|
1797
|
-
//#region node_modules/js-tokens/index.js
|
|
1798
|
-
var require_js_tokens = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1799
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1800
|
-
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;
|
|
1801
|
-
exports.matchToToken = function(match) {
|
|
1802
|
-
var token = {
|
|
1803
|
-
type: "invalid",
|
|
1804
|
-
value: match[0],
|
|
1805
|
-
closed: void 0
|
|
1690
|
+
pathname,
|
|
1691
|
+
query: query ? toQueryObject(new URLSearchParams(query)) : {}
|
|
1806
1692
|
};
|
|
1807
|
-
if (match[1]) token.type = "string", token.closed = !!(match[3] || match[4]);
|
|
1808
|
-
else if (match[5]) token.type = "comment";
|
|
1809
|
-
else if (match[6]) token.type = "comment", token.closed = !!match[7];
|
|
1810
|
-
else if (match[8]) token.type = "regex";
|
|
1811
|
-
else if (match[9]) token.type = "number";
|
|
1812
|
-
else if (match[10]) token.type = "name";
|
|
1813
|
-
else if (match[11]) token.type = "punctuator";
|
|
1814
|
-
else if (match[12]) token.type = "whitespace";
|
|
1815
|
-
return token;
|
|
1816
|
-
};
|
|
1817
|
-
}));
|
|
1818
|
-
|
|
1819
|
-
//#endregion
|
|
1820
|
-
//#region node_modules/@babel/helper-validator-identifier/lib/identifier.js
|
|
1821
|
-
var require_identifier = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1822
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1823
|
-
exports.isIdentifierChar = isIdentifierChar;
|
|
1824
|
-
exports.isIdentifierName = isIdentifierName;
|
|
1825
|
-
exports.isIdentifierStart = isIdentifierStart;
|
|
1826
|
-
let nonASCIIidentifierStartChars = "ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽ-ೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-Ა-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ--ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ";
|
|
1827
|
-
let nonASCIIidentifierChars = "·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ--ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・";
|
|
1828
|
-
const nonASCIIidentifierStart = /* @__PURE__ */ new RegExp("[" + nonASCIIidentifierStartChars + "]");
|
|
1829
|
-
const nonASCIIidentifier = /* @__PURE__ */ new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
|
|
1830
|
-
nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
|
|
1831
|
-
const astralIdentifierStartCodes = [
|
|
1832
|
-
0,
|
|
1833
|
-
11,
|
|
1834
|
-
2,
|
|
1835
|
-
25,
|
|
1836
|
-
2,
|
|
1837
|
-
18,
|
|
1838
|
-
2,
|
|
1839
|
-
1,
|
|
1840
|
-
2,
|
|
1841
|
-
14,
|
|
1842
|
-
3,
|
|
1843
|
-
13,
|
|
1844
|
-
35,
|
|
1845
|
-
122,
|
|
1846
|
-
70,
|
|
1847
|
-
52,
|
|
1848
|
-
268,
|
|
1849
|
-
28,
|
|
1850
|
-
4,
|
|
1851
|
-
48,
|
|
1852
|
-
48,
|
|
1853
|
-
31,
|
|
1854
|
-
14,
|
|
1855
|
-
29,
|
|
1856
|
-
6,
|
|
1857
|
-
37,
|
|
1858
|
-
11,
|
|
1859
|
-
29,
|
|
1860
|
-
3,
|
|
1861
|
-
35,
|
|
1862
|
-
5,
|
|
1863
|
-
7,
|
|
1864
|
-
2,
|
|
1865
|
-
4,
|
|
1866
|
-
43,
|
|
1867
|
-
157,
|
|
1868
|
-
19,
|
|
1869
|
-
35,
|
|
1870
|
-
5,
|
|
1871
|
-
35,
|
|
1872
|
-
5,
|
|
1873
|
-
39,
|
|
1874
|
-
9,
|
|
1875
|
-
51,
|
|
1876
|
-
13,
|
|
1877
|
-
10,
|
|
1878
|
-
2,
|
|
1879
|
-
14,
|
|
1880
|
-
2,
|
|
1881
|
-
6,
|
|
1882
|
-
2,
|
|
1883
|
-
1,
|
|
1884
|
-
2,
|
|
1885
|
-
10,
|
|
1886
|
-
2,
|
|
1887
|
-
14,
|
|
1888
|
-
2,
|
|
1889
|
-
6,
|
|
1890
|
-
2,
|
|
1891
|
-
1,
|
|
1892
|
-
4,
|
|
1893
|
-
51,
|
|
1894
|
-
13,
|
|
1895
|
-
310,
|
|
1896
|
-
10,
|
|
1897
|
-
21,
|
|
1898
|
-
11,
|
|
1899
|
-
7,
|
|
1900
|
-
25,
|
|
1901
|
-
5,
|
|
1902
|
-
2,
|
|
1903
|
-
41,
|
|
1904
|
-
2,
|
|
1905
|
-
8,
|
|
1906
|
-
70,
|
|
1907
|
-
5,
|
|
1908
|
-
3,
|
|
1909
|
-
0,
|
|
1910
|
-
2,
|
|
1911
|
-
43,
|
|
1912
|
-
2,
|
|
1913
|
-
1,
|
|
1914
|
-
4,
|
|
1915
|
-
0,
|
|
1916
|
-
3,
|
|
1917
|
-
22,
|
|
1918
|
-
11,
|
|
1919
|
-
22,
|
|
1920
|
-
10,
|
|
1921
|
-
30,
|
|
1922
|
-
66,
|
|
1923
|
-
18,
|
|
1924
|
-
2,
|
|
1925
|
-
1,
|
|
1926
|
-
11,
|
|
1927
|
-
21,
|
|
1928
|
-
11,
|
|
1929
|
-
25,
|
|
1930
|
-
7,
|
|
1931
|
-
25,
|
|
1932
|
-
39,
|
|
1933
|
-
55,
|
|
1934
|
-
7,
|
|
1935
|
-
1,
|
|
1936
|
-
65,
|
|
1937
|
-
0,
|
|
1938
|
-
16,
|
|
1939
|
-
3,
|
|
1940
|
-
2,
|
|
1941
|
-
2,
|
|
1942
|
-
2,
|
|
1943
|
-
28,
|
|
1944
|
-
43,
|
|
1945
|
-
28,
|
|
1946
|
-
4,
|
|
1947
|
-
28,
|
|
1948
|
-
36,
|
|
1949
|
-
7,
|
|
1950
|
-
2,
|
|
1951
|
-
27,
|
|
1952
|
-
28,
|
|
1953
|
-
53,
|
|
1954
|
-
11,
|
|
1955
|
-
21,
|
|
1956
|
-
11,
|
|
1957
|
-
18,
|
|
1958
|
-
14,
|
|
1959
|
-
17,
|
|
1960
|
-
111,
|
|
1961
|
-
72,
|
|
1962
|
-
56,
|
|
1963
|
-
50,
|
|
1964
|
-
14,
|
|
1965
|
-
50,
|
|
1966
|
-
14,
|
|
1967
|
-
35,
|
|
1968
|
-
39,
|
|
1969
|
-
27,
|
|
1970
|
-
10,
|
|
1971
|
-
22,
|
|
1972
|
-
251,
|
|
1973
|
-
41,
|
|
1974
|
-
7,
|
|
1975
|
-
1,
|
|
1976
|
-
17,
|
|
1977
|
-
5,
|
|
1978
|
-
57,
|
|
1979
|
-
28,
|
|
1980
|
-
11,
|
|
1981
|
-
0,
|
|
1982
|
-
9,
|
|
1983
|
-
21,
|
|
1984
|
-
43,
|
|
1985
|
-
17,
|
|
1986
|
-
47,
|
|
1987
|
-
20,
|
|
1988
|
-
28,
|
|
1989
|
-
22,
|
|
1990
|
-
13,
|
|
1991
|
-
52,
|
|
1992
|
-
58,
|
|
1993
|
-
1,
|
|
1994
|
-
3,
|
|
1995
|
-
0,
|
|
1996
|
-
14,
|
|
1997
|
-
44,
|
|
1998
|
-
33,
|
|
1999
|
-
24,
|
|
2000
|
-
27,
|
|
2001
|
-
35,
|
|
2002
|
-
30,
|
|
2003
|
-
0,
|
|
2004
|
-
3,
|
|
2005
|
-
0,
|
|
2006
|
-
9,
|
|
2007
|
-
34,
|
|
2008
|
-
4,
|
|
2009
|
-
0,
|
|
2010
|
-
13,
|
|
2011
|
-
47,
|
|
2012
|
-
15,
|
|
2013
|
-
3,
|
|
2014
|
-
22,
|
|
2015
|
-
0,
|
|
2016
|
-
2,
|
|
2017
|
-
0,
|
|
2018
|
-
36,
|
|
2019
|
-
17,
|
|
2020
|
-
2,
|
|
2021
|
-
24,
|
|
2022
|
-
20,
|
|
2023
|
-
1,
|
|
2024
|
-
64,
|
|
2025
|
-
6,
|
|
2026
|
-
2,
|
|
2027
|
-
0,
|
|
2028
|
-
2,
|
|
2029
|
-
3,
|
|
2030
|
-
2,
|
|
2031
|
-
14,
|
|
2032
|
-
2,
|
|
2033
|
-
9,
|
|
2034
|
-
8,
|
|
2035
|
-
46,
|
|
2036
|
-
39,
|
|
2037
|
-
7,
|
|
2038
|
-
3,
|
|
2039
|
-
1,
|
|
2040
|
-
3,
|
|
2041
|
-
21,
|
|
2042
|
-
2,
|
|
2043
|
-
6,
|
|
2044
|
-
2,
|
|
2045
|
-
1,
|
|
2046
|
-
2,
|
|
2047
|
-
4,
|
|
2048
|
-
4,
|
|
2049
|
-
0,
|
|
2050
|
-
19,
|
|
2051
|
-
0,
|
|
2052
|
-
13,
|
|
2053
|
-
4,
|
|
2054
|
-
31,
|
|
2055
|
-
9,
|
|
2056
|
-
2,
|
|
2057
|
-
0,
|
|
2058
|
-
3,
|
|
2059
|
-
0,
|
|
2060
|
-
2,
|
|
2061
|
-
37,
|
|
2062
|
-
2,
|
|
2063
|
-
0,
|
|
2064
|
-
26,
|
|
2065
|
-
0,
|
|
2066
|
-
2,
|
|
2067
|
-
0,
|
|
2068
|
-
45,
|
|
2069
|
-
52,
|
|
2070
|
-
19,
|
|
2071
|
-
3,
|
|
2072
|
-
21,
|
|
2073
|
-
2,
|
|
2074
|
-
31,
|
|
2075
|
-
47,
|
|
2076
|
-
21,
|
|
2077
|
-
1,
|
|
2078
|
-
2,
|
|
2079
|
-
0,
|
|
2080
|
-
185,
|
|
2081
|
-
46,
|
|
2082
|
-
42,
|
|
2083
|
-
3,
|
|
2084
|
-
37,
|
|
2085
|
-
47,
|
|
2086
|
-
21,
|
|
2087
|
-
0,
|
|
2088
|
-
60,
|
|
2089
|
-
42,
|
|
2090
|
-
14,
|
|
2091
|
-
0,
|
|
2092
|
-
72,
|
|
2093
|
-
26,
|
|
2094
|
-
38,
|
|
2095
|
-
6,
|
|
2096
|
-
186,
|
|
2097
|
-
43,
|
|
2098
|
-
117,
|
|
2099
|
-
63,
|
|
2100
|
-
32,
|
|
2101
|
-
7,
|
|
2102
|
-
3,
|
|
2103
|
-
0,
|
|
2104
|
-
3,
|
|
2105
|
-
7,
|
|
2106
|
-
2,
|
|
2107
|
-
1,
|
|
2108
|
-
2,
|
|
2109
|
-
23,
|
|
2110
|
-
16,
|
|
2111
|
-
0,
|
|
2112
|
-
2,
|
|
2113
|
-
0,
|
|
2114
|
-
95,
|
|
2115
|
-
7,
|
|
2116
|
-
3,
|
|
2117
|
-
38,
|
|
2118
|
-
17,
|
|
2119
|
-
0,
|
|
2120
|
-
2,
|
|
2121
|
-
0,
|
|
2122
|
-
29,
|
|
2123
|
-
0,
|
|
2124
|
-
11,
|
|
2125
|
-
39,
|
|
2126
|
-
8,
|
|
2127
|
-
0,
|
|
2128
|
-
22,
|
|
2129
|
-
0,
|
|
2130
|
-
12,
|
|
2131
|
-
45,
|
|
2132
|
-
20,
|
|
2133
|
-
0,
|
|
2134
|
-
19,
|
|
2135
|
-
72,
|
|
2136
|
-
200,
|
|
2137
|
-
32,
|
|
2138
|
-
32,
|
|
2139
|
-
8,
|
|
2140
|
-
2,
|
|
2141
|
-
36,
|
|
2142
|
-
18,
|
|
2143
|
-
0,
|
|
2144
|
-
50,
|
|
2145
|
-
29,
|
|
2146
|
-
113,
|
|
2147
|
-
6,
|
|
2148
|
-
2,
|
|
2149
|
-
1,
|
|
2150
|
-
2,
|
|
2151
|
-
37,
|
|
2152
|
-
22,
|
|
2153
|
-
0,
|
|
2154
|
-
26,
|
|
2155
|
-
5,
|
|
2156
|
-
2,
|
|
2157
|
-
1,
|
|
2158
|
-
2,
|
|
2159
|
-
31,
|
|
2160
|
-
15,
|
|
2161
|
-
0,
|
|
2162
|
-
24,
|
|
2163
|
-
43,
|
|
2164
|
-
261,
|
|
2165
|
-
18,
|
|
2166
|
-
16,
|
|
2167
|
-
0,
|
|
2168
|
-
2,
|
|
2169
|
-
12,
|
|
2170
|
-
2,
|
|
2171
|
-
33,
|
|
2172
|
-
125,
|
|
2173
|
-
0,
|
|
2174
|
-
80,
|
|
2175
|
-
921,
|
|
2176
|
-
103,
|
|
2177
|
-
110,
|
|
2178
|
-
18,
|
|
2179
|
-
195,
|
|
2180
|
-
2637,
|
|
2181
|
-
96,
|
|
2182
|
-
16,
|
|
2183
|
-
1071,
|
|
2184
|
-
18,
|
|
2185
|
-
5,
|
|
2186
|
-
26,
|
|
2187
|
-
3994,
|
|
2188
|
-
6,
|
|
2189
|
-
582,
|
|
2190
|
-
6842,
|
|
2191
|
-
29,
|
|
2192
|
-
1763,
|
|
2193
|
-
568,
|
|
2194
|
-
8,
|
|
2195
|
-
30,
|
|
2196
|
-
18,
|
|
2197
|
-
78,
|
|
2198
|
-
18,
|
|
2199
|
-
29,
|
|
2200
|
-
19,
|
|
2201
|
-
47,
|
|
2202
|
-
17,
|
|
2203
|
-
3,
|
|
2204
|
-
32,
|
|
2205
|
-
20,
|
|
2206
|
-
6,
|
|
2207
|
-
18,
|
|
2208
|
-
433,
|
|
2209
|
-
44,
|
|
2210
|
-
212,
|
|
2211
|
-
63,
|
|
2212
|
-
33,
|
|
2213
|
-
24,
|
|
2214
|
-
3,
|
|
2215
|
-
24,
|
|
2216
|
-
45,
|
|
2217
|
-
74,
|
|
2218
|
-
6,
|
|
2219
|
-
0,
|
|
2220
|
-
67,
|
|
2221
|
-
12,
|
|
2222
|
-
65,
|
|
2223
|
-
1,
|
|
2224
|
-
2,
|
|
2225
|
-
0,
|
|
2226
|
-
15,
|
|
2227
|
-
4,
|
|
2228
|
-
10,
|
|
2229
|
-
7381,
|
|
2230
|
-
42,
|
|
2231
|
-
31,
|
|
2232
|
-
98,
|
|
2233
|
-
114,
|
|
2234
|
-
8702,
|
|
2235
|
-
3,
|
|
2236
|
-
2,
|
|
2237
|
-
6,
|
|
2238
|
-
2,
|
|
2239
|
-
1,
|
|
2240
|
-
2,
|
|
2241
|
-
290,
|
|
2242
|
-
16,
|
|
2243
|
-
0,
|
|
2244
|
-
30,
|
|
2245
|
-
2,
|
|
2246
|
-
3,
|
|
2247
|
-
0,
|
|
2248
|
-
15,
|
|
2249
|
-
3,
|
|
2250
|
-
9,
|
|
2251
|
-
395,
|
|
2252
|
-
2309,
|
|
2253
|
-
106,
|
|
2254
|
-
6,
|
|
2255
|
-
12,
|
|
2256
|
-
4,
|
|
2257
|
-
8,
|
|
2258
|
-
8,
|
|
2259
|
-
9,
|
|
2260
|
-
5991,
|
|
2261
|
-
84,
|
|
2262
|
-
2,
|
|
2263
|
-
70,
|
|
2264
|
-
2,
|
|
2265
|
-
1,
|
|
2266
|
-
3,
|
|
2267
|
-
0,
|
|
2268
|
-
3,
|
|
2269
|
-
1,
|
|
2270
|
-
3,
|
|
2271
|
-
3,
|
|
2272
|
-
2,
|
|
2273
|
-
11,
|
|
2274
|
-
2,
|
|
2275
|
-
0,
|
|
2276
|
-
2,
|
|
2277
|
-
6,
|
|
2278
|
-
2,
|
|
2279
|
-
64,
|
|
2280
|
-
2,
|
|
2281
|
-
3,
|
|
2282
|
-
3,
|
|
2283
|
-
7,
|
|
2284
|
-
2,
|
|
2285
|
-
6,
|
|
2286
|
-
2,
|
|
2287
|
-
27,
|
|
2288
|
-
2,
|
|
2289
|
-
3,
|
|
2290
|
-
2,
|
|
2291
|
-
4,
|
|
2292
|
-
2,
|
|
2293
|
-
0,
|
|
2294
|
-
4,
|
|
2295
|
-
6,
|
|
2296
|
-
2,
|
|
2297
|
-
339,
|
|
2298
|
-
3,
|
|
2299
|
-
24,
|
|
2300
|
-
2,
|
|
2301
|
-
24,
|
|
2302
|
-
2,
|
|
2303
|
-
30,
|
|
2304
|
-
2,
|
|
2305
|
-
24,
|
|
2306
|
-
2,
|
|
2307
|
-
30,
|
|
2308
|
-
2,
|
|
2309
|
-
24,
|
|
2310
|
-
2,
|
|
2311
|
-
30,
|
|
2312
|
-
2,
|
|
2313
|
-
24,
|
|
2314
|
-
2,
|
|
2315
|
-
30,
|
|
2316
|
-
2,
|
|
2317
|
-
24,
|
|
2318
|
-
2,
|
|
2319
|
-
7,
|
|
2320
|
-
1845,
|
|
2321
|
-
30,
|
|
2322
|
-
7,
|
|
2323
|
-
5,
|
|
2324
|
-
262,
|
|
2325
|
-
61,
|
|
2326
|
-
147,
|
|
2327
|
-
44,
|
|
2328
|
-
11,
|
|
2329
|
-
6,
|
|
2330
|
-
17,
|
|
2331
|
-
0,
|
|
2332
|
-
322,
|
|
2333
|
-
29,
|
|
2334
|
-
19,
|
|
2335
|
-
43,
|
|
2336
|
-
485,
|
|
2337
|
-
27,
|
|
2338
|
-
229,
|
|
2339
|
-
29,
|
|
2340
|
-
3,
|
|
2341
|
-
0,
|
|
2342
|
-
208,
|
|
2343
|
-
30,
|
|
2344
|
-
2,
|
|
2345
|
-
2,
|
|
2346
|
-
2,
|
|
2347
|
-
1,
|
|
2348
|
-
2,
|
|
2349
|
-
6,
|
|
2350
|
-
3,
|
|
2351
|
-
4,
|
|
2352
|
-
10,
|
|
2353
|
-
1,
|
|
2354
|
-
225,
|
|
2355
|
-
6,
|
|
2356
|
-
2,
|
|
2357
|
-
3,
|
|
2358
|
-
2,
|
|
2359
|
-
1,
|
|
2360
|
-
2,
|
|
2361
|
-
14,
|
|
2362
|
-
2,
|
|
2363
|
-
196,
|
|
2364
|
-
60,
|
|
2365
|
-
67,
|
|
2366
|
-
8,
|
|
2367
|
-
0,
|
|
2368
|
-
1205,
|
|
2369
|
-
3,
|
|
2370
|
-
2,
|
|
2371
|
-
26,
|
|
2372
|
-
2,
|
|
2373
|
-
1,
|
|
2374
|
-
2,
|
|
2375
|
-
0,
|
|
2376
|
-
3,
|
|
2377
|
-
0,
|
|
2378
|
-
2,
|
|
2379
|
-
9,
|
|
2380
|
-
2,
|
|
2381
|
-
3,
|
|
2382
|
-
2,
|
|
2383
|
-
0,
|
|
2384
|
-
2,
|
|
2385
|
-
0,
|
|
2386
|
-
7,
|
|
2387
|
-
0,
|
|
2388
|
-
5,
|
|
2389
|
-
0,
|
|
2390
|
-
2,
|
|
2391
|
-
0,
|
|
2392
|
-
2,
|
|
2393
|
-
0,
|
|
2394
|
-
2,
|
|
2395
|
-
2,
|
|
2396
|
-
2,
|
|
2397
|
-
1,
|
|
2398
|
-
2,
|
|
2399
|
-
0,
|
|
2400
|
-
3,
|
|
2401
|
-
0,
|
|
2402
|
-
2,
|
|
2403
|
-
0,
|
|
2404
|
-
2,
|
|
2405
|
-
0,
|
|
2406
|
-
2,
|
|
2407
|
-
0,
|
|
2408
|
-
2,
|
|
2409
|
-
0,
|
|
2410
|
-
2,
|
|
2411
|
-
1,
|
|
2412
|
-
2,
|
|
2413
|
-
0,
|
|
2414
|
-
3,
|
|
2415
|
-
3,
|
|
2416
|
-
2,
|
|
2417
|
-
6,
|
|
2418
|
-
2,
|
|
2419
|
-
3,
|
|
2420
|
-
2,
|
|
2421
|
-
3,
|
|
2422
|
-
2,
|
|
2423
|
-
0,
|
|
2424
|
-
2,
|
|
2425
|
-
9,
|
|
2426
|
-
2,
|
|
2427
|
-
16,
|
|
2428
|
-
6,
|
|
2429
|
-
2,
|
|
2430
|
-
2,
|
|
2431
|
-
4,
|
|
2432
|
-
2,
|
|
2433
|
-
16,
|
|
2434
|
-
4421,
|
|
2435
|
-
42719,
|
|
2436
|
-
33,
|
|
2437
|
-
4381,
|
|
2438
|
-
3,
|
|
2439
|
-
5773,
|
|
2440
|
-
3,
|
|
2441
|
-
7472,
|
|
2442
|
-
16,
|
|
2443
|
-
621,
|
|
2444
|
-
2467,
|
|
2445
|
-
541,
|
|
2446
|
-
1507,
|
|
2447
|
-
4938,
|
|
2448
|
-
6,
|
|
2449
|
-
8489
|
|
2450
|
-
];
|
|
2451
|
-
const astralIdentifierCodes = [
|
|
2452
|
-
509,
|
|
2453
|
-
0,
|
|
2454
|
-
227,
|
|
2455
|
-
0,
|
|
2456
|
-
150,
|
|
2457
|
-
4,
|
|
2458
|
-
294,
|
|
2459
|
-
9,
|
|
2460
|
-
1368,
|
|
2461
|
-
2,
|
|
2462
|
-
2,
|
|
2463
|
-
1,
|
|
2464
|
-
6,
|
|
2465
|
-
3,
|
|
2466
|
-
41,
|
|
2467
|
-
2,
|
|
2468
|
-
5,
|
|
2469
|
-
0,
|
|
2470
|
-
166,
|
|
2471
|
-
1,
|
|
2472
|
-
574,
|
|
2473
|
-
3,
|
|
2474
|
-
9,
|
|
2475
|
-
9,
|
|
2476
|
-
7,
|
|
2477
|
-
9,
|
|
2478
|
-
32,
|
|
2479
|
-
4,
|
|
2480
|
-
318,
|
|
2481
|
-
1,
|
|
2482
|
-
78,
|
|
2483
|
-
5,
|
|
2484
|
-
71,
|
|
2485
|
-
10,
|
|
2486
|
-
50,
|
|
2487
|
-
3,
|
|
2488
|
-
123,
|
|
2489
|
-
2,
|
|
2490
|
-
54,
|
|
2491
|
-
14,
|
|
2492
|
-
32,
|
|
2493
|
-
10,
|
|
2494
|
-
3,
|
|
2495
|
-
1,
|
|
2496
|
-
11,
|
|
2497
|
-
3,
|
|
2498
|
-
46,
|
|
2499
|
-
10,
|
|
2500
|
-
8,
|
|
2501
|
-
0,
|
|
2502
|
-
46,
|
|
2503
|
-
9,
|
|
2504
|
-
7,
|
|
2505
|
-
2,
|
|
2506
|
-
37,
|
|
2507
|
-
13,
|
|
2508
|
-
2,
|
|
2509
|
-
9,
|
|
2510
|
-
6,
|
|
2511
|
-
1,
|
|
2512
|
-
45,
|
|
2513
|
-
0,
|
|
2514
|
-
13,
|
|
2515
|
-
2,
|
|
2516
|
-
49,
|
|
2517
|
-
13,
|
|
2518
|
-
9,
|
|
2519
|
-
3,
|
|
2520
|
-
2,
|
|
2521
|
-
11,
|
|
2522
|
-
83,
|
|
2523
|
-
11,
|
|
2524
|
-
7,
|
|
2525
|
-
0,
|
|
2526
|
-
3,
|
|
2527
|
-
0,
|
|
2528
|
-
158,
|
|
2529
|
-
11,
|
|
2530
|
-
6,
|
|
2531
|
-
9,
|
|
2532
|
-
7,
|
|
2533
|
-
3,
|
|
2534
|
-
56,
|
|
2535
|
-
1,
|
|
2536
|
-
2,
|
|
2537
|
-
6,
|
|
2538
|
-
3,
|
|
2539
|
-
1,
|
|
2540
|
-
3,
|
|
2541
|
-
2,
|
|
2542
|
-
10,
|
|
2543
|
-
0,
|
|
2544
|
-
11,
|
|
2545
|
-
1,
|
|
2546
|
-
3,
|
|
2547
|
-
6,
|
|
2548
|
-
4,
|
|
2549
|
-
4,
|
|
2550
|
-
68,
|
|
2551
|
-
8,
|
|
2552
|
-
2,
|
|
2553
|
-
0,
|
|
2554
|
-
3,
|
|
2555
|
-
0,
|
|
2556
|
-
2,
|
|
2557
|
-
3,
|
|
2558
|
-
2,
|
|
2559
|
-
4,
|
|
2560
|
-
2,
|
|
2561
|
-
0,
|
|
2562
|
-
15,
|
|
2563
|
-
1,
|
|
2564
|
-
83,
|
|
2565
|
-
17,
|
|
2566
|
-
10,
|
|
2567
|
-
9,
|
|
2568
|
-
5,
|
|
2569
|
-
0,
|
|
2570
|
-
82,
|
|
2571
|
-
19,
|
|
2572
|
-
13,
|
|
2573
|
-
9,
|
|
2574
|
-
214,
|
|
2575
|
-
6,
|
|
2576
|
-
3,
|
|
2577
|
-
8,
|
|
2578
|
-
28,
|
|
2579
|
-
1,
|
|
2580
|
-
83,
|
|
2581
|
-
16,
|
|
2582
|
-
16,
|
|
2583
|
-
9,
|
|
2584
|
-
82,
|
|
2585
|
-
12,
|
|
2586
|
-
9,
|
|
2587
|
-
9,
|
|
2588
|
-
7,
|
|
2589
|
-
19,
|
|
2590
|
-
58,
|
|
2591
|
-
14,
|
|
2592
|
-
5,
|
|
2593
|
-
9,
|
|
2594
|
-
243,
|
|
2595
|
-
14,
|
|
2596
|
-
166,
|
|
2597
|
-
9,
|
|
2598
|
-
71,
|
|
2599
|
-
5,
|
|
2600
|
-
2,
|
|
2601
|
-
1,
|
|
2602
|
-
3,
|
|
2603
|
-
3,
|
|
2604
|
-
2,
|
|
2605
|
-
0,
|
|
2606
|
-
2,
|
|
2607
|
-
1,
|
|
2608
|
-
13,
|
|
2609
|
-
9,
|
|
2610
|
-
120,
|
|
2611
|
-
6,
|
|
2612
|
-
3,
|
|
2613
|
-
6,
|
|
2614
|
-
4,
|
|
2615
|
-
0,
|
|
2616
|
-
29,
|
|
2617
|
-
9,
|
|
2618
|
-
41,
|
|
2619
|
-
6,
|
|
2620
|
-
2,
|
|
2621
|
-
3,
|
|
2622
|
-
9,
|
|
2623
|
-
0,
|
|
2624
|
-
10,
|
|
2625
|
-
10,
|
|
2626
|
-
47,
|
|
2627
|
-
15,
|
|
2628
|
-
199,
|
|
2629
|
-
7,
|
|
2630
|
-
137,
|
|
2631
|
-
9,
|
|
2632
|
-
54,
|
|
2633
|
-
7,
|
|
2634
|
-
2,
|
|
2635
|
-
7,
|
|
2636
|
-
17,
|
|
2637
|
-
9,
|
|
2638
|
-
57,
|
|
2639
|
-
21,
|
|
2640
|
-
2,
|
|
2641
|
-
13,
|
|
2642
|
-
123,
|
|
2643
|
-
5,
|
|
2644
|
-
4,
|
|
2645
|
-
0,
|
|
2646
|
-
2,
|
|
2647
|
-
1,
|
|
2648
|
-
2,
|
|
2649
|
-
6,
|
|
2650
|
-
2,
|
|
2651
|
-
0,
|
|
2652
|
-
9,
|
|
2653
|
-
9,
|
|
2654
|
-
49,
|
|
2655
|
-
4,
|
|
2656
|
-
2,
|
|
2657
|
-
1,
|
|
2658
|
-
2,
|
|
2659
|
-
4,
|
|
2660
|
-
9,
|
|
2661
|
-
9,
|
|
2662
|
-
55,
|
|
2663
|
-
9,
|
|
2664
|
-
266,
|
|
2665
|
-
3,
|
|
2666
|
-
10,
|
|
2667
|
-
1,
|
|
2668
|
-
2,
|
|
2669
|
-
0,
|
|
2670
|
-
49,
|
|
2671
|
-
6,
|
|
2672
|
-
4,
|
|
2673
|
-
4,
|
|
2674
|
-
14,
|
|
2675
|
-
10,
|
|
2676
|
-
5350,
|
|
2677
|
-
0,
|
|
2678
|
-
7,
|
|
2679
|
-
14,
|
|
2680
|
-
11465,
|
|
2681
|
-
27,
|
|
2682
|
-
2343,
|
|
2683
|
-
9,
|
|
2684
|
-
87,
|
|
2685
|
-
9,
|
|
2686
|
-
39,
|
|
2687
|
-
4,
|
|
2688
|
-
60,
|
|
2689
|
-
6,
|
|
2690
|
-
26,
|
|
2691
|
-
9,
|
|
2692
|
-
535,
|
|
2693
|
-
9,
|
|
2694
|
-
470,
|
|
2695
|
-
0,
|
|
2696
|
-
2,
|
|
2697
|
-
54,
|
|
2698
|
-
8,
|
|
2699
|
-
3,
|
|
2700
|
-
82,
|
|
2701
|
-
0,
|
|
2702
|
-
12,
|
|
2703
|
-
1,
|
|
2704
|
-
19628,
|
|
2705
|
-
1,
|
|
2706
|
-
4178,
|
|
2707
|
-
9,
|
|
2708
|
-
519,
|
|
2709
|
-
45,
|
|
2710
|
-
3,
|
|
2711
|
-
22,
|
|
2712
|
-
543,
|
|
2713
|
-
4,
|
|
2714
|
-
4,
|
|
2715
|
-
5,
|
|
2716
|
-
9,
|
|
2717
|
-
7,
|
|
2718
|
-
3,
|
|
2719
|
-
6,
|
|
2720
|
-
31,
|
|
2721
|
-
3,
|
|
2722
|
-
149,
|
|
2723
|
-
2,
|
|
2724
|
-
1418,
|
|
2725
|
-
49,
|
|
2726
|
-
513,
|
|
2727
|
-
54,
|
|
2728
|
-
5,
|
|
2729
|
-
49,
|
|
2730
|
-
9,
|
|
2731
|
-
0,
|
|
2732
|
-
15,
|
|
2733
|
-
0,
|
|
2734
|
-
23,
|
|
2735
|
-
4,
|
|
2736
|
-
2,
|
|
2737
|
-
14,
|
|
2738
|
-
1361,
|
|
2739
|
-
6,
|
|
2740
|
-
2,
|
|
2741
|
-
16,
|
|
2742
|
-
3,
|
|
2743
|
-
6,
|
|
2744
|
-
2,
|
|
2745
|
-
1,
|
|
2746
|
-
2,
|
|
2747
|
-
4,
|
|
2748
|
-
101,
|
|
2749
|
-
0,
|
|
2750
|
-
161,
|
|
2751
|
-
6,
|
|
2752
|
-
10,
|
|
2753
|
-
9,
|
|
2754
|
-
357,
|
|
2755
|
-
0,
|
|
2756
|
-
62,
|
|
2757
|
-
13,
|
|
2758
|
-
499,
|
|
2759
|
-
13,
|
|
2760
|
-
245,
|
|
2761
|
-
1,
|
|
2762
|
-
2,
|
|
2763
|
-
9,
|
|
2764
|
-
233,
|
|
2765
|
-
0,
|
|
2766
|
-
3,
|
|
2767
|
-
0,
|
|
2768
|
-
8,
|
|
2769
|
-
1,
|
|
2770
|
-
6,
|
|
2771
|
-
0,
|
|
2772
|
-
475,
|
|
2773
|
-
6,
|
|
2774
|
-
110,
|
|
2775
|
-
6,
|
|
2776
|
-
6,
|
|
2777
|
-
9,
|
|
2778
|
-
4759,
|
|
2779
|
-
9,
|
|
2780
|
-
787719,
|
|
2781
|
-
239
|
|
2782
|
-
];
|
|
2783
|
-
function isInAstralSet(code, set) {
|
|
2784
|
-
let pos = 65536;
|
|
2785
|
-
for (let i = 0, length = set.length; i < length; i += 2) {
|
|
2786
|
-
pos += set[i];
|
|
2787
|
-
if (pos > code) return false;
|
|
2788
|
-
pos += set[i + 1];
|
|
2789
|
-
if (pos >= code) return true;
|
|
2790
|
-
}
|
|
2791
|
-
return false;
|
|
2792
|
-
}
|
|
2793
|
-
function isIdentifierStart(code) {
|
|
2794
|
-
if (code < 65) return code === 36;
|
|
2795
|
-
if (code <= 90) return true;
|
|
2796
|
-
if (code < 97) return code === 95;
|
|
2797
|
-
if (code <= 122) return true;
|
|
2798
|
-
if (code <= 65535) return code >= 170 && nonASCIIidentifierStart.test(String.fromCharCode(code));
|
|
2799
|
-
return isInAstralSet(code, astralIdentifierStartCodes);
|
|
2800
|
-
}
|
|
2801
|
-
function isIdentifierChar(code) {
|
|
2802
|
-
if (code < 48) return code === 36;
|
|
2803
|
-
if (code < 58) return true;
|
|
2804
|
-
if (code < 65) return false;
|
|
2805
|
-
if (code <= 90) return true;
|
|
2806
|
-
if (code < 97) return code === 95;
|
|
2807
|
-
if (code <= 122) return true;
|
|
2808
|
-
if (code <= 65535) return code >= 170 && nonASCIIidentifier.test(String.fromCharCode(code));
|
|
2809
|
-
return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
|
|
2810
|
-
}
|
|
2811
|
-
function isIdentifierName(name) {
|
|
2812
|
-
let isFirst = true;
|
|
2813
|
-
for (let i = 0; i < name.length; i++) {
|
|
2814
|
-
let cp = name.charCodeAt(i);
|
|
2815
|
-
if ((cp & 64512) === 55296 && i + 1 < name.length) {
|
|
2816
|
-
const trail = name.charCodeAt(++i);
|
|
2817
|
-
if ((trail & 64512) === 56320) cp = 65536 + ((cp & 1023) << 10) + (trail & 1023);
|
|
2818
|
-
}
|
|
2819
|
-
if (isFirst) {
|
|
2820
|
-
isFirst = false;
|
|
2821
|
-
if (!isIdentifierStart(cp)) return false;
|
|
2822
|
-
} else if (!isIdentifierChar(cp)) return false;
|
|
2823
|
-
}
|
|
2824
|
-
return !isFirst;
|
|
2825
1693
|
}
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
var require_keyword = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2831
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2832
|
-
exports.isKeyword = isKeyword;
|
|
2833
|
-
exports.isReservedWord = isReservedWord;
|
|
2834
|
-
exports.isStrictBindOnlyReservedWord = isStrictBindOnlyReservedWord;
|
|
2835
|
-
exports.isStrictBindReservedWord = isStrictBindReservedWord;
|
|
2836
|
-
exports.isStrictReservedWord = isStrictReservedWord;
|
|
2837
|
-
const reservedWords = {
|
|
2838
|
-
keyword: [
|
|
2839
|
-
"break",
|
|
2840
|
-
"case",
|
|
2841
|
-
"catch",
|
|
2842
|
-
"continue",
|
|
2843
|
-
"debugger",
|
|
2844
|
-
"default",
|
|
2845
|
-
"do",
|
|
2846
|
-
"else",
|
|
2847
|
-
"finally",
|
|
2848
|
-
"for",
|
|
2849
|
-
"function",
|
|
2850
|
-
"if",
|
|
2851
|
-
"return",
|
|
2852
|
-
"switch",
|
|
2853
|
-
"throw",
|
|
2854
|
-
"try",
|
|
2855
|
-
"var",
|
|
2856
|
-
"const",
|
|
2857
|
-
"while",
|
|
2858
|
-
"with",
|
|
2859
|
-
"new",
|
|
2860
|
-
"this",
|
|
2861
|
-
"super",
|
|
2862
|
-
"class",
|
|
2863
|
-
"extends",
|
|
2864
|
-
"export",
|
|
2865
|
-
"import",
|
|
2866
|
-
"null",
|
|
2867
|
-
"true",
|
|
2868
|
-
"false",
|
|
2869
|
-
"in",
|
|
2870
|
-
"instanceof",
|
|
2871
|
-
"typeof",
|
|
2872
|
-
"void",
|
|
2873
|
-
"delete"
|
|
2874
|
-
],
|
|
2875
|
-
strict: [
|
|
2876
|
-
"implements",
|
|
2877
|
-
"interface",
|
|
2878
|
-
"let",
|
|
2879
|
-
"package",
|
|
2880
|
-
"private",
|
|
2881
|
-
"protected",
|
|
2882
|
-
"public",
|
|
2883
|
-
"static",
|
|
2884
|
-
"yield"
|
|
2885
|
-
],
|
|
2886
|
-
strictBind: ["eval", "arguments"]
|
|
1694
|
+
const url = new URL(value);
|
|
1695
|
+
return {
|
|
1696
|
+
pathname: url.pathname,
|
|
1697
|
+
query: toQueryObject(url.searchParams)
|
|
2887
1698
|
};
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
}
|
|
2894
|
-
|
|
2895
|
-
return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);
|
|
2896
|
-
}
|
|
2897
|
-
function isStrictBindOnlyReservedWord(word) {
|
|
2898
|
-
return reservedWordsStrictBindSet.has(word);
|
|
2899
|
-
}
|
|
2900
|
-
function isStrictBindReservedWord(word, inModule) {
|
|
2901
|
-
return isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word);
|
|
2902
|
-
}
|
|
2903
|
-
function isKeyword(word) {
|
|
2904
|
-
return keywords.has(word);
|
|
2905
|
-
}
|
|
2906
|
-
}));
|
|
2907
|
-
|
|
2908
|
-
//#endregion
|
|
2909
|
-
//#region node_modules/@babel/helper-validator-identifier/lib/index.js
|
|
2910
|
-
var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2911
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2912
|
-
Object.defineProperty(exports, "isIdentifierChar", {
|
|
2913
|
-
enumerable: true,
|
|
2914
|
-
get: function() {
|
|
2915
|
-
return _identifier.isIdentifierChar;
|
|
2916
|
-
}
|
|
2917
|
-
});
|
|
2918
|
-
Object.defineProperty(exports, "isIdentifierName", {
|
|
2919
|
-
enumerable: true,
|
|
2920
|
-
get: function() {
|
|
2921
|
-
return _identifier.isIdentifierName;
|
|
2922
|
-
}
|
|
2923
|
-
});
|
|
2924
|
-
Object.defineProperty(exports, "isIdentifierStart", {
|
|
2925
|
-
enumerable: true,
|
|
2926
|
-
get: function() {
|
|
2927
|
-
return _identifier.isIdentifierStart;
|
|
2928
|
-
}
|
|
2929
|
-
});
|
|
2930
|
-
Object.defineProperty(exports, "isKeyword", {
|
|
2931
|
-
enumerable: true,
|
|
2932
|
-
get: function() {
|
|
2933
|
-
return _keyword.isKeyword;
|
|
2934
|
-
}
|
|
2935
|
-
});
|
|
2936
|
-
Object.defineProperty(exports, "isReservedWord", {
|
|
2937
|
-
enumerable: true,
|
|
2938
|
-
get: function() {
|
|
2939
|
-
return _keyword.isReservedWord;
|
|
2940
|
-
}
|
|
2941
|
-
});
|
|
2942
|
-
Object.defineProperty(exports, "isStrictBindOnlyReservedWord", {
|
|
2943
|
-
enumerable: true,
|
|
2944
|
-
get: function() {
|
|
2945
|
-
return _keyword.isStrictBindOnlyReservedWord;
|
|
2946
|
-
}
|
|
2947
|
-
});
|
|
2948
|
-
Object.defineProperty(exports, "isStrictBindReservedWord", {
|
|
2949
|
-
enumerable: true,
|
|
2950
|
-
get: function() {
|
|
2951
|
-
return _keyword.isStrictBindReservedWord;
|
|
2952
|
-
}
|
|
2953
|
-
});
|
|
2954
|
-
Object.defineProperty(exports, "isStrictReservedWord", {
|
|
2955
|
-
enumerable: true,
|
|
2956
|
-
get: function() {
|
|
2957
|
-
return _keyword.isStrictReservedWord;
|
|
2958
|
-
}
|
|
2959
|
-
});
|
|
2960
|
-
var _identifier = require_identifier();
|
|
2961
|
-
var _keyword = require_keyword();
|
|
2962
|
-
}));
|
|
2963
|
-
|
|
2964
|
-
//#endregion
|
|
2965
|
-
//#region node_modules/@babel/code-frame/lib/index.js
|
|
2966
|
-
var require_lib = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2967
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2968
|
-
var picocolors = require_picocolors();
|
|
2969
|
-
var jsTokens = require_js_tokens();
|
|
2970
|
-
var helperValidatorIdentifier = require_lib$1();
|
|
2971
|
-
function isColorSupported() {
|
|
2972
|
-
return typeof process === "object" && (process.env.FORCE_COLOR === "0" || process.env.FORCE_COLOR === "false") ? false : picocolors.isColorSupported;
|
|
2973
|
-
}
|
|
2974
|
-
const compose = (f, g) => (v) => f(g(v));
|
|
2975
|
-
function buildDefs(colors) {
|
|
2976
|
-
return {
|
|
2977
|
-
keyword: colors.cyan,
|
|
2978
|
-
capitalized: colors.yellow,
|
|
2979
|
-
jsxIdentifier: colors.yellow,
|
|
2980
|
-
punctuator: colors.yellow,
|
|
2981
|
-
number: colors.magenta,
|
|
2982
|
-
string: colors.green,
|
|
2983
|
-
regex: colors.magenta,
|
|
2984
|
-
comment: colors.gray,
|
|
2985
|
-
invalid: compose(compose(colors.white, colors.bgRed), colors.bold),
|
|
2986
|
-
gutter: colors.gray,
|
|
2987
|
-
marker: compose(colors.red, colors.bold),
|
|
2988
|
-
message: compose(colors.red, colors.bold),
|
|
2989
|
-
reset: colors.reset
|
|
2990
|
-
};
|
|
2991
|
-
}
|
|
2992
|
-
const defsOn = buildDefs(picocolors.createColors(true));
|
|
2993
|
-
const defsOff = buildDefs(picocolors.createColors(false));
|
|
2994
|
-
function getDefs(enabled) {
|
|
2995
|
-
return enabled ? defsOn : defsOff;
|
|
2996
|
-
}
|
|
2997
|
-
const sometimesKeywords = new Set([
|
|
2998
|
-
"as",
|
|
2999
|
-
"async",
|
|
3000
|
-
"from",
|
|
3001
|
-
"get",
|
|
3002
|
-
"of",
|
|
3003
|
-
"set"
|
|
3004
|
-
]);
|
|
3005
|
-
const NEWLINE$1 = /\r\n|[\n\r\u2028\u2029]/;
|
|
3006
|
-
const BRACKET = /^[()[\]{}]$/;
|
|
3007
|
-
let tokenize;
|
|
3008
|
-
{
|
|
3009
|
-
const JSX_TAG = /^[a-z][\w-]*$/i;
|
|
3010
|
-
const getTokenType = function(token, offset, text) {
|
|
3011
|
-
if (token.type === "name") {
|
|
3012
|
-
if (helperValidatorIdentifier.isKeyword(token.value) || helperValidatorIdentifier.isStrictReservedWord(token.value, true) || sometimesKeywords.has(token.value)) return "keyword";
|
|
3013
|
-
if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.slice(offset - 2, offset) === "</")) return "jsxIdentifier";
|
|
3014
|
-
if (token.value[0] !== token.value[0].toLowerCase()) return "capitalized";
|
|
3015
|
-
}
|
|
3016
|
-
if (token.type === "punctuator" && BRACKET.test(token.value)) return "bracket";
|
|
3017
|
-
if (token.type === "invalid" && (token.value === "@" || token.value === "#")) return "punctuator";
|
|
3018
|
-
return token.type;
|
|
3019
|
-
};
|
|
3020
|
-
tokenize = function* (text) {
|
|
3021
|
-
let match;
|
|
3022
|
-
while (match = jsTokens.default.exec(text)) {
|
|
3023
|
-
const token = jsTokens.matchToToken(match);
|
|
3024
|
-
yield {
|
|
3025
|
-
type: getTokenType(token, match.index, text),
|
|
3026
|
-
value: token.value
|
|
3027
|
-
};
|
|
3028
|
-
}
|
|
3029
|
-
};
|
|
3030
|
-
}
|
|
3031
|
-
function highlight(text) {
|
|
3032
|
-
if (text === "") return "";
|
|
3033
|
-
const defs = getDefs(true);
|
|
3034
|
-
let highlighted = "";
|
|
3035
|
-
for (const { type, value } of tokenize(text)) if (type in defs) highlighted += value.split(NEWLINE$1).map((str) => defs[type](str)).join("\n");
|
|
3036
|
-
else highlighted += value;
|
|
3037
|
-
return highlighted;
|
|
3038
|
-
}
|
|
3039
|
-
const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
|
|
3040
|
-
function getMarkerLines(loc, source, opts) {
|
|
3041
|
-
const startLoc = Object.assign({
|
|
3042
|
-
column: 0,
|
|
3043
|
-
line: -1
|
|
3044
|
-
}, loc.start);
|
|
3045
|
-
const endLoc = Object.assign({}, startLoc, loc.end);
|
|
3046
|
-
const { linesAbove = 2, linesBelow = 3 } = opts || {};
|
|
3047
|
-
const startLine = startLoc.line;
|
|
3048
|
-
const startColumn = startLoc.column;
|
|
3049
|
-
const endLine = endLoc.line;
|
|
3050
|
-
const endColumn = endLoc.column;
|
|
3051
|
-
let start = Math.max(startLine - (linesAbove + 1), 0);
|
|
3052
|
-
let end = Math.min(source.length, endLine + linesBelow);
|
|
3053
|
-
if (startLine === -1) start = 0;
|
|
3054
|
-
if (endLine === -1) end = source.length;
|
|
3055
|
-
const lineDiff = endLine - startLine;
|
|
3056
|
-
const markerLines = {};
|
|
3057
|
-
if (lineDiff) for (let i = 0; i <= lineDiff; i++) {
|
|
3058
|
-
const lineNumber = i + startLine;
|
|
3059
|
-
if (!startColumn) markerLines[lineNumber] = true;
|
|
3060
|
-
else if (i === 0) markerLines[lineNumber] = [startColumn, source[lineNumber - 1].length - startColumn + 1];
|
|
3061
|
-
else if (i === lineDiff) markerLines[lineNumber] = [0, endColumn];
|
|
3062
|
-
else markerLines[lineNumber] = [0, source[lineNumber - i].length];
|
|
3063
|
-
}
|
|
3064
|
-
else if (startColumn === endColumn) if (startColumn) markerLines[startLine] = [startColumn, 0];
|
|
3065
|
-
else markerLines[startLine] = true;
|
|
3066
|
-
else markerLines[startLine] = [startColumn, endColumn - startColumn];
|
|
3067
|
-
return {
|
|
3068
|
-
start,
|
|
3069
|
-
end,
|
|
3070
|
-
markerLines
|
|
3071
|
-
};
|
|
3072
|
-
}
|
|
3073
|
-
function codeFrameColumns(rawLines, loc, opts = {}) {
|
|
3074
|
-
const shouldHighlight = opts.forceColor || isColorSupported() && opts.highlightCode;
|
|
3075
|
-
const defs = getDefs(shouldHighlight);
|
|
3076
|
-
const { start, end, markerLines } = getMarkerLines(loc, rawLines.split(NEWLINE), opts);
|
|
3077
|
-
const hasColumns = loc.start && typeof loc.start.column === "number";
|
|
3078
|
-
const numberMaxWidth = String(end).length;
|
|
3079
|
-
let frame = (shouldHighlight ? highlight(rawLines) : rawLines).split(NEWLINE, end).slice(start, end).map((line, index) => {
|
|
3080
|
-
const number = start + 1 + index;
|
|
3081
|
-
const gutter = ` ${` ${number}`.slice(-numberMaxWidth)} |`;
|
|
3082
|
-
const hasMarker = markerLines[number];
|
|
3083
|
-
const lastMarkerLine = !markerLines[number + 1];
|
|
3084
|
-
if (hasMarker) {
|
|
3085
|
-
let markerLine = "";
|
|
3086
|
-
if (Array.isArray(hasMarker)) {
|
|
3087
|
-
const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
|
|
3088
|
-
const numberOfMarkers = hasMarker[1] || 1;
|
|
3089
|
-
markerLine = [
|
|
3090
|
-
"\n ",
|
|
3091
|
-
defs.gutter(gutter.replace(/\d/g, " ")),
|
|
3092
|
-
" ",
|
|
3093
|
-
markerSpacing,
|
|
3094
|
-
defs.marker("^").repeat(numberOfMarkers)
|
|
3095
|
-
].join("");
|
|
3096
|
-
if (lastMarkerLine && opts.message) markerLine += " " + defs.message(opts.message);
|
|
3097
|
-
}
|
|
3098
|
-
return [
|
|
3099
|
-
defs.marker(">"),
|
|
3100
|
-
defs.gutter(gutter),
|
|
3101
|
-
line.length > 0 ? ` ${line}` : "",
|
|
3102
|
-
markerLine
|
|
3103
|
-
].join("");
|
|
3104
|
-
} else return ` ${defs.gutter(gutter)}${line.length > 0 ? ` ${line}` : ""}`;
|
|
3105
|
-
}).join("\n");
|
|
3106
|
-
if (opts.message && !hasColumns) frame = `${" ".repeat(numberMaxWidth + 1)}${opts.message}\n${frame}`;
|
|
3107
|
-
if (shouldHighlight) return defs.reset(frame);
|
|
3108
|
-
else return frame;
|
|
3109
|
-
}
|
|
3110
|
-
exports.codeFrameColumns = codeFrameColumns;
|
|
3111
|
-
}));
|
|
1699
|
+
}
|
|
1700
|
+
function toQueryObject(searchParams) {
|
|
1701
|
+
return searchParams.entries().reduce((acc, [key, value]) => ({
|
|
1702
|
+
...acc,
|
|
1703
|
+
[key]: value
|
|
1704
|
+
}), {});
|
|
1705
|
+
}
|
|
3112
1706
|
|
|
3113
1707
|
//#endregion
|
|
3114
1708
|
//#region src/server/symbolicate.ts
|
|
3115
|
-
var import_lib = require_lib();
|
|
3116
1709
|
/**
|
|
3117
1710
|
* @see https://github.com/facebook/react-native/blob/0.83-stable/packages/metro-config/src/index.flow.js#L17
|
|
3118
1711
|
*/
|
|
@@ -3151,10 +1744,10 @@ function originalPositionFor(sourceMapConsumer, frame) {
|
|
|
3151
1744
|
column: frame.column,
|
|
3152
1745
|
line: frame.lineNumber
|
|
3153
1746
|
});
|
|
3154
|
-
return Object.entries(originalPosition).reduce((frame
|
|
1747
|
+
return Object.entries(originalPosition).reduce((frame, [key, value]) => {
|
|
3155
1748
|
const targetKey = convertFrameKey(key);
|
|
3156
1749
|
return {
|
|
3157
|
-
...frame
|
|
1750
|
+
...frame,
|
|
3158
1751
|
...value ? { [targetKey]: value } : null
|
|
3159
1752
|
};
|
|
3160
1753
|
}, frame);
|
|
@@ -3175,17 +1768,17 @@ function convertFrameKey(key) {
|
|
|
3175
1768
|
return key;
|
|
3176
1769
|
}
|
|
3177
1770
|
function getCodeFrame(sourceMapConsumer, frames, bundle) {
|
|
3178
|
-
const frame = frames.find((frame
|
|
3179
|
-
return frame
|
|
1771
|
+
const frame = frames.find((frame) => {
|
|
1772
|
+
return frame.lineNumber != null && frame.column != null && !isCollapsed(frame);
|
|
3180
1773
|
});
|
|
3181
1774
|
if (frame?.file == null || frame.column == null || frame.lineNumber == null) return null;
|
|
3182
1775
|
try {
|
|
3183
1776
|
const { lineNumber, column, file } = frame;
|
|
3184
1777
|
const unresolved = file.startsWith("http");
|
|
3185
1778
|
const source = unresolved ? bundle.code : sourceMapConsumer.sourceContentFor(frame.file);
|
|
3186
|
-
const fileName = unresolved ?
|
|
1779
|
+
const fileName = unresolved ? parseUrl(file).pathname ?? "unknown" : file;
|
|
3187
1780
|
let content = "";
|
|
3188
|
-
if (source) content =
|
|
1781
|
+
if (source) content = codeFrameColumns(source, { start: {
|
|
3189
1782
|
column,
|
|
3190
1783
|
line: lineNumber
|
|
3191
1784
|
} }, { highlightCode: true });
|
|
@@ -3223,7 +1816,7 @@ const plugin = fp((fastify, options) => {
|
|
|
3223
1816
|
const { stack } = request.body;
|
|
3224
1817
|
const bundleUrl = stack.find((frame) => frame.file?.startsWith("http"));
|
|
3225
1818
|
invariant(bundleUrl?.file, "No bundle URL found in stack frames");
|
|
3226
|
-
const { pathname, query } =
|
|
1819
|
+
const { pathname, query } = parseUrl(bundleUrl.file);
|
|
3227
1820
|
invariant(pathname, "No pathname found in bundle URL");
|
|
3228
1821
|
invariant(query.platform, "No platform found in query");
|
|
3229
1822
|
invariant(query.dev, "No dev found in query");
|
|
@@ -3244,7 +1837,7 @@ var WebSocketServer = class extends EventEmitter {
|
|
|
3244
1837
|
logger;
|
|
3245
1838
|
constructor(name, options) {
|
|
3246
1839
|
super();
|
|
3247
|
-
const logger
|
|
1840
|
+
const logger = logger$1.child(name);
|
|
3248
1841
|
const wss = new ws.WebSocketServer(options);
|
|
3249
1842
|
wss.on("connection", (socket) => {
|
|
3250
1843
|
const client = Object.defineProperty(socket, "id", {
|
|
@@ -3267,7 +1860,7 @@ var WebSocketServer = class extends EventEmitter {
|
|
|
3267
1860
|
});
|
|
3268
1861
|
});
|
|
3269
1862
|
this.wss = wss;
|
|
3270
|
-
this.logger = logger
|
|
1863
|
+
this.logger = logger;
|
|
3271
1864
|
}
|
|
3272
1865
|
get server() {
|
|
3273
1866
|
return this.wss;
|
|
@@ -3292,11 +1885,11 @@ function getWebSocketUpgradeHandler(websocketEndpoints) {
|
|
|
3292
1885
|
socket.destroy();
|
|
3293
1886
|
return;
|
|
3294
1887
|
}
|
|
3295
|
-
const { pathname } =
|
|
1888
|
+
const { pathname } = parseUrl(request.url);
|
|
3296
1889
|
if (pathname != null && websocketEndpoints[pathname]) {
|
|
3297
1890
|
const wss = websocketEndpoints[pathname];
|
|
3298
|
-
wss.handleUpgrade(request, socket, head, (socket
|
|
3299
|
-
wss.emit("connection", socket
|
|
1891
|
+
wss.handleUpgrade(request, socket, head, (socket) => {
|
|
1892
|
+
wss.emit("connection", socket, request);
|
|
3300
1893
|
});
|
|
3301
1894
|
} else socket.destroy();
|
|
3302
1895
|
};
|
|
@@ -3425,8 +2018,8 @@ var HMRServer = class extends WebSocketServer {
|
|
|
3425
2018
|
sendError(client, error) {
|
|
3426
2019
|
try {
|
|
3427
2020
|
this.send(client, JSON.stringify(error));
|
|
3428
|
-
} catch (error
|
|
3429
|
-
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);
|
|
3430
2023
|
}
|
|
3431
2024
|
}
|
|
3432
2025
|
cleanup(client) {
|
|
@@ -3457,12 +2050,12 @@ var HMRServer = class extends WebSocketServer {
|
|
|
3457
2050
|
};
|
|
3458
2051
|
this.logger.trace("HMR client message received", traceMessage);
|
|
3459
2052
|
} catch (error) {
|
|
3460
|
-
const message
|
|
3461
|
-
this.logger.error(message
|
|
2053
|
+
const message = "Failed to parse HMR client message";
|
|
2054
|
+
this.logger.error(message, error);
|
|
3462
2055
|
this.sendError(client, {
|
|
3463
2056
|
type: "InternalError",
|
|
3464
2057
|
errors: [{ description: error instanceof Error ? error.message : String(error) }],
|
|
3465
|
-
message
|
|
2058
|
+
message
|
|
3466
2059
|
});
|
|
3467
2060
|
return;
|
|
3468
2061
|
}
|
|
@@ -3523,7 +2116,7 @@ async function createDevServer(config, options) {
|
|
|
3523
2116
|
projectRoot,
|
|
3524
2117
|
port
|
|
3525
2118
|
});
|
|
3526
|
-
const emitter =
|
|
2119
|
+
const emitter = mitt();
|
|
3527
2120
|
const fastify = Fastify({
|
|
3528
2121
|
loggerInstance: new DevServerLogger(),
|
|
3529
2122
|
disableRequestLogging: true
|
|
@@ -3559,7 +2152,7 @@ async function createDevServer(config, options) {
|
|
|
3559
2152
|
bundlerPool,
|
|
3560
2153
|
reportEvent: (event) => {
|
|
3561
2154
|
reportEvent?.(event);
|
|
3562
|
-
config.reporter
|
|
2155
|
+
config.reporter?.update(event);
|
|
3563
2156
|
}
|
|
3564
2157
|
}).on("connection", (client) => emitter.emit("device.connected", { client })).on("message", (client, data) => emitter.emit("device.message", {
|
|
3565
2158
|
client,
|
|
@@ -3609,9 +2202,9 @@ async function createDevServer(config, options) {
|
|
|
3609
2202
|
}
|
|
3610
2203
|
async function invokeConfigureServer(server, plugins) {
|
|
3611
2204
|
const postConfigureServerHandlers = [];
|
|
3612
|
-
for (const plugin
|
|
3613
|
-
const context = createPluginContext(plugin
|
|
3614
|
-
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);
|
|
3615
2208
|
if (typeof result === "function") postConfigureServerHandlers.push(result);
|
|
3616
2209
|
}
|
|
3617
2210
|
return { invokePostConfigureServer: async () => {
|
|
@@ -3671,7 +2264,7 @@ async function resolveScaledAssets(options) {
|
|
|
3671
2264
|
const files = fs.readdirSync(dirname);
|
|
3672
2265
|
const stripedBasename = stripSuffix(assetPath, context);
|
|
3673
2266
|
const suffixPattern = platformSuffixPattern(context);
|
|
3674
|
-
const assetRegExp =
|
|
2267
|
+
const assetRegExp = new RegExp(`${stripedBasename}(${SCALE_PATTERN})?(?:${suffixPattern})?${extension}$`);
|
|
3675
2268
|
const scaledAssets = {};
|
|
3676
2269
|
for (const file of files.sort((a, b) => getAssetPriority(b, context) - getAssetPriority(a, context))) {
|
|
3677
2270
|
const match = assetRegExp.exec(file);
|
|
@@ -3716,13 +2309,13 @@ function stripSuffix(assetPath, context) {
|
|
|
3716
2309
|
const basename = path.basename(assetPath);
|
|
3717
2310
|
const extension = path.extname(assetPath);
|
|
3718
2311
|
const suffixPattern = platformSuffixPattern(context);
|
|
3719
|
-
return basename.replace(
|
|
2312
|
+
return basename.replace(new RegExp(`(${SCALE_PATTERN})?(?:${suffixPattern})?${extension}$`), "");
|
|
3720
2313
|
}
|
|
3721
2314
|
function getAssetPriority(assetPath, context) {
|
|
3722
2315
|
const suffixPattern = platformSuffixPattern(context);
|
|
3723
|
-
if (
|
|
3724
|
-
else if (
|
|
3725
|
-
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;
|
|
3726
2319
|
return 0;
|
|
3727
2320
|
}
|
|
3728
2321
|
function addSuffix(assetPath, context, options) {
|
|
@@ -3805,10 +2398,10 @@ async function copyAssetsToDestination(options) {
|
|
|
3805
2398
|
return Promise.all(assets.map((asset) => {
|
|
3806
2399
|
return Promise.all(asset.scales.map(async (scale) => {
|
|
3807
2400
|
if (platform !== "android") {
|
|
3808
|
-
const from
|
|
3809
|
-
const to
|
|
3810
|
-
mkdirWithAssertPath(to
|
|
3811
|
-
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);
|
|
3812
2405
|
}
|
|
3813
2406
|
const from = resolveAssetPath(asset.id, context, scale);
|
|
3814
2407
|
const to = path.join(assetsDir, getAndroidAssetDestinationPath(asset, scale));
|
|
@@ -3855,15 +2448,15 @@ function generateAssetRegistryCode(assetRegistryPath, asset) {
|
|
|
3855
2448
|
//#endregion
|
|
3856
2449
|
//#region src/core/plugins/utils/transform-utils.ts
|
|
3857
2450
|
const TRANSFORM_FLAGS_KEY = Symbol("transform-flags");
|
|
3858
|
-
let TransformFlag = /* @__PURE__ */ function(TransformFlag
|
|
3859
|
-
TransformFlag
|
|
3860
|
-
TransformFlag
|
|
3861
|
-
TransformFlag
|
|
3862
|
-
TransformFlag
|
|
3863
|
-
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;
|
|
3864
2457
|
}({});
|
|
3865
|
-
function setFlag(context, id
|
|
3866
|
-
const moduleInfo = context.getModuleInfo(id
|
|
2458
|
+
function setFlag(context, id, flag, options) {
|
|
2459
|
+
const moduleInfo = context.getModuleInfo(id);
|
|
3867
2460
|
if (moduleInfo && hasFlag(moduleInfo.meta)) {
|
|
3868
2461
|
if (options?.override) moduleInfo.meta[TRANSFORM_FLAGS_KEY] = flag;
|
|
3869
2462
|
else moduleInfo.meta[TRANSFORM_FLAGS_KEY] |= flag;
|
|
@@ -3873,8 +2466,8 @@ function setFlag(context, id$1, flag, options) {
|
|
|
3873
2466
|
function hasFlag(meta) {
|
|
3874
2467
|
return TRANSFORM_FLAGS_KEY in meta;
|
|
3875
2468
|
}
|
|
3876
|
-
function getFlag(context, id
|
|
3877
|
-
return getFlagFromModuleInfo(context.getModuleInfo(id
|
|
2469
|
+
function getFlag(context, id) {
|
|
2470
|
+
return getFlagFromModuleInfo(context.getModuleInfo(id));
|
|
3878
2471
|
}
|
|
3879
2472
|
function getFlagFromModuleInfo(moduleInfo) {
|
|
3880
2473
|
if (moduleInfo && hasFlag(moduleInfo.meta)) return moduleInfo.meta[TRANSFORM_FLAGS_KEY];
|
|
@@ -3887,18 +2480,18 @@ function withTransformBoundary(plugins, options) {
|
|
|
3887
2480
|
name: "rollipop:transform-initializer",
|
|
3888
2481
|
transform: {
|
|
3889
2482
|
order: "pre",
|
|
3890
|
-
handler(_code, id
|
|
3891
|
-
if (context.state.hmrUpdates.has(id
|
|
3892
|
-
context.state.hmrUpdates.delete(id
|
|
3893
|
-
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 }) };
|
|
3894
2487
|
}
|
|
3895
2488
|
}
|
|
3896
2489
|
}
|
|
3897
2490
|
},
|
|
3898
2491
|
{
|
|
3899
2492
|
name: "rollipop:transform-change-watcher",
|
|
3900
|
-
watchChange(id
|
|
3901
|
-
context.state.hmrUpdates.add(id
|
|
2493
|
+
watchChange(id) {
|
|
2494
|
+
context.state.hmrUpdates.add(id);
|
|
3902
2495
|
}
|
|
3903
2496
|
},
|
|
3904
2497
|
options?.beforeTransform,
|
|
@@ -3915,8 +2508,8 @@ function getPersistCachePlugins(options) {
|
|
|
3915
2508
|
afterTransform: null
|
|
3916
2509
|
};
|
|
3917
2510
|
const { sourceExtensions, context } = options;
|
|
3918
|
-
const includePattern =
|
|
3919
|
-
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))];
|
|
3920
2513
|
let cacheHits = 0;
|
|
3921
2514
|
return {
|
|
3922
2515
|
beforeTransform: {
|
|
@@ -3930,15 +2523,15 @@ function getPersistCachePlugins(options) {
|
|
|
3930
2523
|
transform: {
|
|
3931
2524
|
order: "pre",
|
|
3932
2525
|
filter,
|
|
3933
|
-
handler(_code, id
|
|
3934
|
-
const key = getCacheKey(id
|
|
2526
|
+
handler(_code, id) {
|
|
2527
|
+
const key = getCacheKey(id, context.id);
|
|
3935
2528
|
const cache = context.cache.get(key);
|
|
3936
2529
|
if (cache != null) {
|
|
3937
2530
|
cacheHits++;
|
|
3938
2531
|
return {
|
|
3939
2532
|
code: cache,
|
|
3940
2533
|
moduleType: "tsx",
|
|
3941
|
-
meta: setFlag(this, id
|
|
2534
|
+
meta: setFlag(this, id, TransformFlag.SKIP_ALL)
|
|
3942
2535
|
};
|
|
3943
2536
|
}
|
|
3944
2537
|
}
|
|
@@ -3949,9 +2542,9 @@ function getPersistCachePlugins(options) {
|
|
|
3949
2542
|
transform: {
|
|
3950
2543
|
order: "post",
|
|
3951
2544
|
filter,
|
|
3952
|
-
handler(code, id
|
|
3953
|
-
if (getFlag(this, id
|
|
3954
|
-
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);
|
|
3955
2548
|
}
|
|
3956
2549
|
},
|
|
3957
2550
|
buildEnd() {
|
|
@@ -3960,60 +2553,60 @@ function getPersistCachePlugins(options) {
|
|
|
3960
2553
|
}
|
|
3961
2554
|
};
|
|
3962
2555
|
}
|
|
3963
|
-
function getCacheKey(id
|
|
3964
|
-
const { mtimeMs } = fs.statSync(id
|
|
3965
|
-
return xxhash(`${id
|
|
2556
|
+
function getCacheKey(id, buildHash) {
|
|
2557
|
+
const { mtimeMs } = fs.statSync(id);
|
|
2558
|
+
return xxhash(`${id}${buildHash}${mtimeMs}`);
|
|
3966
2559
|
}
|
|
3967
2560
|
/**
|
|
3968
2561
|
* Enhance a plugin to cache the result. (transform hook only)
|
|
3969
2562
|
*/
|
|
3970
|
-
function cacheable(plugin
|
|
2563
|
+
function cacheable(plugin) {
|
|
3971
2564
|
let configured = false;
|
|
3972
|
-
const originalTransform = plugin
|
|
2565
|
+
const originalTransform = plugin.transform;
|
|
3973
2566
|
if (typeof originalTransform === "function") {
|
|
3974
|
-
plugin
|
|
3975
|
-
if (getFlag(this, id
|
|
3976
|
-
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);
|
|
3977
2570
|
};
|
|
3978
2571
|
configured = true;
|
|
3979
2572
|
}
|
|
3980
2573
|
if (typeof originalTransform === "object") {
|
|
3981
|
-
plugin
|
|
2574
|
+
plugin.transform = {
|
|
3982
2575
|
...originalTransform,
|
|
3983
|
-
handler(code, id
|
|
3984
|
-
if (getFlag(this, id
|
|
3985
|
-
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);
|
|
3986
2579
|
}
|
|
3987
2580
|
};
|
|
3988
2581
|
configured = true;
|
|
3989
2582
|
}
|
|
3990
|
-
if (configured) plugin
|
|
3991
|
-
else logger$2.warn(`Plugin '${plugin
|
|
3992
|
-
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;
|
|
3993
2586
|
}
|
|
3994
2587
|
|
|
3995
2588
|
//#endregion
|
|
3996
2589
|
//#region src/core/plugins/utils/source.ts
|
|
3997
2590
|
const TS_EXTENSION_REGEXP = /\.tsx?$/;
|
|
3998
|
-
function isTS(id
|
|
3999
|
-
return TS_EXTENSION_REGEXP.test(id
|
|
2591
|
+
function isTS(id) {
|
|
2592
|
+
return TS_EXTENSION_REGEXP.test(id);
|
|
4000
2593
|
}
|
|
4001
|
-
function isJSX(id
|
|
4002
|
-
return id
|
|
2594
|
+
function isJSX(id) {
|
|
2595
|
+
return id.endsWith("x");
|
|
4003
2596
|
}
|
|
4004
2597
|
|
|
4005
2598
|
//#endregion
|
|
4006
2599
|
//#region src/core/plugins/react-native-plugin.ts
|
|
4007
2600
|
function reactNativePlugin(config, options) {
|
|
4008
2601
|
const { buildType, flowFilter, codegenFilter, assetsDir, assetExtensions, assetRegistryPath } = options;
|
|
4009
|
-
const assetExtensionRegex =
|
|
2602
|
+
const assetExtensionRegex = new RegExp(`\\.(?:${assetExtensions.join("|")})$`);
|
|
4010
2603
|
const codegenPlugin = {
|
|
4011
2604
|
name: "rollipop:react-native-codegen-marker",
|
|
4012
2605
|
transform: {
|
|
4013
2606
|
order: "pre",
|
|
4014
2607
|
filter: codegenFilter,
|
|
4015
|
-
handler(_code, id
|
|
4016
|
-
return { meta: setFlag(this, id
|
|
2608
|
+
handler(_code, id) {
|
|
2609
|
+
return { meta: setFlag(this, id, TransformFlag.CODEGEN_REQUIRED) };
|
|
4017
2610
|
}
|
|
4018
2611
|
}
|
|
4019
2612
|
};
|
|
@@ -4022,11 +2615,11 @@ function reactNativePlugin(config, options) {
|
|
|
4022
2615
|
transform: {
|
|
4023
2616
|
order: "pre",
|
|
4024
2617
|
filter: flowFilter,
|
|
4025
|
-
handler(code, id
|
|
4026
|
-
const flags = getFlag(this, id
|
|
2618
|
+
handler(code, id) {
|
|
2619
|
+
const flags = getFlag(this, id);
|
|
4027
2620
|
if (flags & TransformFlag.SKIP_ALL) return;
|
|
4028
|
-
if (flags & TransformFlag.CODEGEN_REQUIRED) return { meta: setFlag(this, id
|
|
4029
|
-
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);
|
|
4030
2623
|
return {
|
|
4031
2624
|
code: result.code,
|
|
4032
2625
|
map: result.map,
|
|
@@ -4040,18 +2633,18 @@ function reactNativePlugin(config, options) {
|
|
|
4040
2633
|
name: "rollipop:react-native-asset",
|
|
4041
2634
|
load: {
|
|
4042
2635
|
filter: [include(id(assetExtensionRegex))],
|
|
4043
|
-
async handler(id
|
|
4044
|
-
this.debug(`Asset ${id
|
|
2636
|
+
async handler(id) {
|
|
2637
|
+
this.debug(`Asset ${id} found`);
|
|
4045
2638
|
const assetData = await resolveScaledAssets({
|
|
4046
2639
|
projectRoot: config.root,
|
|
4047
|
-
assetPath: id
|
|
2640
|
+
assetPath: id,
|
|
4048
2641
|
platform: options.platform,
|
|
4049
2642
|
preferNativePlatform: config.resolver.preferNativePlatform
|
|
4050
2643
|
});
|
|
4051
2644
|
assets.push(assetData);
|
|
4052
2645
|
return {
|
|
4053
2646
|
code: generateAssetRegistryCode(assetRegistryPath, assetData),
|
|
4054
|
-
meta: setFlag(this, id
|
|
2647
|
+
meta: setFlag(this, id, TransformFlag.SKIP_ALL),
|
|
4055
2648
|
moduleType: "js"
|
|
4056
2649
|
};
|
|
4057
2650
|
}
|
|
@@ -4079,15 +2672,15 @@ function reactNativePlugin(config, options) {
|
|
|
4079
2672
|
name: "rollipop:react-native-replace-hmr-client",
|
|
4080
2673
|
resolveId: {
|
|
4081
2674
|
filter: [include(id(/\/HMRClient\.js$/))],
|
|
4082
|
-
async handler(id
|
|
4083
|
-
const resolvedId = await this.resolve(id
|
|
2675
|
+
async handler(id, importer) {
|
|
2676
|
+
const resolvedId = await this.resolve(id, importer, { skipSelf: true });
|
|
4084
2677
|
if (resolvedId?.id === hmrClientPath) await this.load({ id: resolvedId.id });
|
|
4085
2678
|
}
|
|
4086
2679
|
},
|
|
4087
2680
|
load: {
|
|
4088
2681
|
filter: [include(id(exactRegex(hmrClientPath)))],
|
|
4089
|
-
handler(id
|
|
4090
|
-
this.debug(`Replacing HMR client: ${id
|
|
2682
|
+
handler(id) {
|
|
2683
|
+
this.debug(`Replacing HMR client: ${id}`);
|
|
4091
2684
|
return hmrConfig?.clientImplement ?? defaultRuntimeImplements.clientImplement;
|
|
4092
2685
|
}
|
|
4093
2686
|
}
|
|
@@ -4108,17 +2701,17 @@ const DEFAULT_EXCLUDE_REGEX = /\/node_modules\//;
|
|
|
4108
2701
|
const HAS_REFRESH_REGEX = /\$RefreshReg\$\(/;
|
|
4109
2702
|
const ONLY_REACT_COMPONENT_REGEX = /extends\s+(?:React\.)?(?:Pure)?Component/;
|
|
4110
2703
|
function reactRefreshPlugin(options) {
|
|
4111
|
-
const { include
|
|
2704
|
+
const { include = DEFAULT_INCLUDE_REGEX, exclude = DEFAULT_EXCLUDE_REGEX } = options ?? {};
|
|
4112
2705
|
return [{
|
|
4113
2706
|
name: "rollipop:transform-react-refresh",
|
|
4114
2707
|
transform: {
|
|
4115
2708
|
filter: { id: {
|
|
4116
|
-
include
|
|
4117
|
-
exclude
|
|
2709
|
+
include,
|
|
2710
|
+
exclude
|
|
4118
2711
|
} },
|
|
4119
|
-
handler(code, id
|
|
4120
|
-
if (getFlag(this, id
|
|
4121
|
-
const result = transformSync(id
|
|
2712
|
+
handler(code, id) {
|
|
2713
|
+
if (getFlag(this, id) & TransformFlag.SKIP_ALL) return;
|
|
2714
|
+
const result = transformSync(id, code, {
|
|
4122
2715
|
sourcemap: true,
|
|
4123
2716
|
jsx: {
|
|
4124
2717
|
runtime: "automatic",
|
|
@@ -4139,15 +2732,15 @@ function reactRefreshPlugin(options) {
|
|
|
4139
2732
|
name: "rollipop:react-refresh-boundary",
|
|
4140
2733
|
transform: {
|
|
4141
2734
|
filter: { id: {
|
|
4142
|
-
include
|
|
4143
|
-
exclude
|
|
2735
|
+
include,
|
|
2736
|
+
exclude
|
|
4144
2737
|
} },
|
|
4145
|
-
handler(code, id
|
|
4146
|
-
if (getFlag(this, id
|
|
2738
|
+
handler(code, id, meta) {
|
|
2739
|
+
if (getFlag(this, id) & TransformFlag.SKIP_ALL) return;
|
|
4147
2740
|
const { magicString } = meta;
|
|
4148
2741
|
invariant(magicString != null, "magicString is not available");
|
|
4149
2742
|
applyRefreshWrapper(magicString, {
|
|
4150
|
-
id
|
|
2743
|
+
id,
|
|
4151
2744
|
hasRefresh: HAS_REFRESH_REGEX.test(code),
|
|
4152
2745
|
onlyReactComponent: ONLY_REACT_COMPONENT_REGEX.test(code)
|
|
4153
2746
|
});
|
|
@@ -4157,12 +2750,12 @@ function reactRefreshPlugin(options) {
|
|
|
4157
2750
|
}];
|
|
4158
2751
|
}
|
|
4159
2752
|
function applyRefreshWrapper(s, options) {
|
|
4160
|
-
const { id
|
|
2753
|
+
const { id, hasRefresh, onlyReactComponent } = options;
|
|
4161
2754
|
if (!(hasRefresh || onlyReactComponent)) return;
|
|
4162
2755
|
if (hasRefresh) s.prepend(`
|
|
4163
2756
|
var __prev$RefreshReg$ = global.$RefreshReg$;
|
|
4164
2757
|
var __prev$RefreshSig$ = global.$RefreshSig$;
|
|
4165
|
-
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) }
|
|
4166
2759
|
global.$RefreshSig$ = function() { return __ReactRefresh.createSignatureFunctionForTransform(); }
|
|
4167
2760
|
`);
|
|
4168
2761
|
s.append(`
|
|
@@ -4199,12 +2792,12 @@ function preludePlugin(options) {
|
|
|
4199
2792
|
meta: { [IS_ENTRY]: true }
|
|
4200
2793
|
};
|
|
4201
2794
|
} },
|
|
4202
|
-
load: { handler(id
|
|
2795
|
+
load: { handler(id) {
|
|
4203
2796
|
if (processed) return;
|
|
4204
|
-
const moduleInfo = this.getModuleInfo(id
|
|
2797
|
+
const moduleInfo = this.getModuleInfo(id);
|
|
4205
2798
|
if (moduleInfo && isEntry(moduleInfo.meta)) {
|
|
4206
|
-
this.debug(`Prelude plugin found entry ${id
|
|
4207
|
-
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");
|
|
4208
2801
|
processed = true;
|
|
4209
2802
|
return modifiedSource;
|
|
4210
2803
|
}
|
|
@@ -4215,47 +2808,6 @@ function isEntry(meta) {
|
|
|
4215
2808
|
return IS_ENTRY in meta;
|
|
4216
2809
|
}
|
|
4217
2810
|
|
|
4218
|
-
//#endregion
|
|
4219
|
-
//#region src/core/plugins/status-plugin.ts
|
|
4220
|
-
function statusPlugin(options) {
|
|
4221
|
-
let totalModules = options?.initialTotalModules ?? 0;
|
|
4222
|
-
let startedAt = 0;
|
|
4223
|
-
let transformedModules = 0;
|
|
4224
|
-
let unknownTotalModules = totalModules === 0;
|
|
4225
|
-
return {
|
|
4226
|
-
name: "rollipop:status",
|
|
4227
|
-
buildStart() {
|
|
4228
|
-
startedAt = performance.now();
|
|
4229
|
-
transformedModules = 0;
|
|
4230
|
-
options?.onStart?.();
|
|
4231
|
-
},
|
|
4232
|
-
buildEnd(error) {
|
|
4233
|
-
if (transformedModules !== 0) totalModules = transformedModules;
|
|
4234
|
-
unknownTotalModules = false;
|
|
4235
|
-
options?.onEnd?.({
|
|
4236
|
-
error,
|
|
4237
|
-
totalModules,
|
|
4238
|
-
duration: performance.now() - startedAt
|
|
4239
|
-
});
|
|
4240
|
-
},
|
|
4241
|
-
transform: {
|
|
4242
|
-
order: "post",
|
|
4243
|
-
handler(_code, id$1) {
|
|
4244
|
-
++transformedModules;
|
|
4245
|
-
if (!unknownTotalModules && totalModules < transformedModules) totalModules = transformedModules;
|
|
4246
|
-
options?.onTransform?.({
|
|
4247
|
-
id: id$1,
|
|
4248
|
-
totalModules: unknownTotalModules ? void 0 : totalModules,
|
|
4249
|
-
transformedModules
|
|
4250
|
-
});
|
|
4251
|
-
}
|
|
4252
|
-
},
|
|
4253
|
-
watchChange(id$1) {
|
|
4254
|
-
options?.onWatchChange?.(id$1);
|
|
4255
|
-
}
|
|
4256
|
-
};
|
|
4257
|
-
}
|
|
4258
|
-
|
|
4259
2811
|
//#endregion
|
|
4260
2812
|
//#region src/core/plugins/json-plugin.ts
|
|
4261
2813
|
function jsonPlugin() {
|
|
@@ -4263,10 +2815,10 @@ function jsonPlugin() {
|
|
|
4263
2815
|
name: "rollipop:json",
|
|
4264
2816
|
load: {
|
|
4265
2817
|
filter: [include(id(/\.json$/))],
|
|
4266
|
-
handler(id
|
|
2818
|
+
handler(id) {
|
|
4267
2819
|
return {
|
|
4268
|
-
code: `export = ${fs.readFileSync(id
|
|
4269
|
-
meta: setFlag(this, id
|
|
2820
|
+
code: `export = ${fs.readFileSync(id, "utf-8")};`,
|
|
2821
|
+
meta: setFlag(this, id, TransformFlag.SKIP_ALL),
|
|
4270
2822
|
moduleType: "ts"
|
|
4271
2823
|
};
|
|
4272
2824
|
}
|
|
@@ -4282,13 +2834,13 @@ function svgPlugin(options) {
|
|
|
4282
2834
|
name: "rollipop:svg",
|
|
4283
2835
|
load: {
|
|
4284
2836
|
filter: { id: /\.svg$/ },
|
|
4285
|
-
async handler(id
|
|
2837
|
+
async handler(id) {
|
|
4286
2838
|
return {
|
|
4287
|
-
code: await transform(fs.readFileSync(id
|
|
2839
|
+
code: await transform(fs.readFileSync(id, "utf-8"), {
|
|
4288
2840
|
template: defaultTemplate,
|
|
4289
2841
|
plugins: [__require.resolve("@svgr/plugin-jsx")],
|
|
4290
2842
|
native: true
|
|
4291
|
-
}, { filePath: id
|
|
2843
|
+
}, { filePath: id }),
|
|
4292
2844
|
moduleType: "jsx"
|
|
4293
2845
|
};
|
|
4294
2846
|
}
|
|
@@ -4311,7 +2863,7 @@ export default ${SVG_COMPONENT_NAME};`;
|
|
|
4311
2863
|
//#endregion
|
|
4312
2864
|
//#region src/utils/babel.ts
|
|
4313
2865
|
function mergeBabelOptions(baseOptions, ...options) {
|
|
4314
|
-
return options.reduce((acc, options
|
|
2866
|
+
return options.reduce((acc, options) => mergeWith(acc, options, merge$2), baseOptions);
|
|
4315
2867
|
}
|
|
4316
2868
|
function merge$2(target, source, key) {
|
|
4317
2869
|
if (key === "plugins") return [...target ?? [], ...source ?? []];
|
|
@@ -4323,47 +2875,47 @@ function merge$2(target, source, key) {
|
|
|
4323
2875
|
function babelPlugin(options) {
|
|
4324
2876
|
const { rules = [] } = options ?? {};
|
|
4325
2877
|
const babelOptionsById = /* @__PURE__ */ new Map();
|
|
4326
|
-
const babelRules = rules.map(({ filter, options
|
|
2878
|
+
const babelRules = rules.map(({ filter, options }, index) => {
|
|
4327
2879
|
return {
|
|
4328
2880
|
name: `rollipop:babel-rule-${index}`,
|
|
4329
2881
|
transform: {
|
|
4330
2882
|
filter,
|
|
4331
|
-
handler(code, id
|
|
4332
|
-
const existingBabelOptions = babelOptionsById.get(id
|
|
4333
|
-
const resolvedOptions = typeof options
|
|
4334
|
-
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]);
|
|
4335
2887
|
}
|
|
4336
2888
|
}
|
|
4337
2889
|
};
|
|
4338
2890
|
});
|
|
4339
|
-
const babelPlugin
|
|
2891
|
+
const babelPlugin = {
|
|
4340
2892
|
name: "rollipop:babel",
|
|
4341
2893
|
buildStart() {
|
|
4342
2894
|
babelOptionsById.clear();
|
|
4343
2895
|
},
|
|
4344
|
-
transform: { handler(code, id
|
|
4345
|
-
const flags = getFlag(this, id
|
|
2896
|
+
transform: { handler(code, id) {
|
|
2897
|
+
const flags = getFlag(this, id);
|
|
4346
2898
|
if (flags & TransformFlag.SKIP_ALL) return;
|
|
4347
|
-
const babelOptions = babelOptionsById.get(id
|
|
2899
|
+
const babelOptions = babelOptionsById.get(id) ?? [];
|
|
4348
2900
|
if (!(flags & TransformFlag.CODEGEN_REQUIRED || babelOptions.length > 0)) return;
|
|
4349
|
-
const baseOptions = getPreset$1(flags, id
|
|
2901
|
+
const baseOptions = getPreset$1(flags, id);
|
|
4350
2902
|
const result = babel.transformSync(code, {
|
|
4351
|
-
filename: id
|
|
2903
|
+
filename: id,
|
|
4352
2904
|
babelrc: false,
|
|
4353
2905
|
configFile: false,
|
|
4354
2906
|
sourceMaps: true,
|
|
4355
2907
|
...mergeBabelOptions(baseOptions, ...babelOptions)
|
|
4356
2908
|
});
|
|
4357
|
-
invariant(result?.code, `Failed to transform with babel: ${id
|
|
2909
|
+
invariant(result?.code, `Failed to transform with babel: ${id}`);
|
|
4358
2910
|
return {
|
|
4359
2911
|
code: result.code,
|
|
4360
2912
|
map: result.map
|
|
4361
2913
|
};
|
|
4362
2914
|
} }
|
|
4363
2915
|
};
|
|
4364
|
-
return [...babelRules, babelPlugin
|
|
2916
|
+
return [...babelRules, babelPlugin].map(cacheable);
|
|
4365
2917
|
}
|
|
4366
|
-
function getPreset$1(flags, id
|
|
2918
|
+
function getPreset$1(flags, id) {
|
|
4367
2919
|
const presets = [];
|
|
4368
2920
|
const plugins = [];
|
|
4369
2921
|
let parserOpts = null;
|
|
@@ -4373,8 +2925,8 @@ function getPreset$1(flags, id$1) {
|
|
|
4373
2925
|
parseLangTypes: "flow",
|
|
4374
2926
|
reactRuntimeTarget: "19"
|
|
4375
2927
|
}], __require.resolve("@babel/plugin-transform-flow-strip-types"));
|
|
4376
|
-
} else if (isTS(id
|
|
4377
|
-
isTSX: isJSX(id
|
|
2928
|
+
} else if (isTS(id)) plugins.push([__require.resolve("@babel/plugin-transform-typescript"), {
|
|
2929
|
+
isTSX: isJSX(id),
|
|
4378
2930
|
allowNamespaces: true
|
|
4379
2931
|
}]);
|
|
4380
2932
|
if (flags & TransformFlag.CODEGEN_REQUIRED) plugins.push([__require.resolve("@react-native/babel-plugin-codegen")]);
|
|
@@ -4389,7 +2941,7 @@ function getPreset$1(flags, id$1) {
|
|
|
4389
2941
|
//#endregion
|
|
4390
2942
|
//#region src/utils/swc.ts
|
|
4391
2943
|
function mergeSwcOptions(baseOptions, ...options) {
|
|
4392
|
-
return options.reduce((acc, options
|
|
2944
|
+
return options.reduce((acc, options) => mergeWith(acc, options, merge$1), baseOptions);
|
|
4393
2945
|
}
|
|
4394
2946
|
function merge$1(target, source, key) {
|
|
4395
2947
|
if (key === "plugins") return [...target ?? [], ...source ?? []];
|
|
@@ -4400,30 +2952,30 @@ function merge$1(target, source, key) {
|
|
|
4400
2952
|
function swcPlugin(options) {
|
|
4401
2953
|
const { rules = [] } = options ?? {};
|
|
4402
2954
|
const swcOptionsById = /* @__PURE__ */ new Map();
|
|
4403
|
-
const swcRules = rules.map(({ filter, options
|
|
2955
|
+
const swcRules = rules.map(({ filter, options }, index) => {
|
|
4404
2956
|
return {
|
|
4405
2957
|
name: `rollipop:swc-rule-${index}`,
|
|
4406
2958
|
transform: {
|
|
4407
2959
|
filter,
|
|
4408
|
-
handler(code, id
|
|
4409
|
-
const existingBabelOptions = swcOptionsById.get(id
|
|
4410
|
-
const resolvedOptions = typeof options
|
|
4411
|
-
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]);
|
|
4412
2964
|
}
|
|
4413
2965
|
}
|
|
4414
2966
|
};
|
|
4415
2967
|
});
|
|
4416
|
-
const swcPlugin
|
|
2968
|
+
const swcPlugin = {
|
|
4417
2969
|
name: "rollipop:swc",
|
|
4418
2970
|
buildStart() {
|
|
4419
2971
|
swcOptionsById.clear();
|
|
4420
2972
|
},
|
|
4421
|
-
transform: { handler(code, id
|
|
4422
|
-
if (getFlag(this, id
|
|
4423
|
-
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) ?? [];
|
|
4424
2976
|
const baseOptions = getPreset();
|
|
4425
2977
|
const result = swc.transformSync(code, {
|
|
4426
|
-
filename: id
|
|
2978
|
+
filename: id,
|
|
4427
2979
|
configFile: false,
|
|
4428
2980
|
swcrc: false,
|
|
4429
2981
|
sourceMaps: true,
|
|
@@ -4436,7 +2988,7 @@ function swcPlugin(options) {
|
|
|
4436
2988
|
};
|
|
4437
2989
|
} }
|
|
4438
2990
|
};
|
|
4439
|
-
return [...swcRules, swcPlugin
|
|
2991
|
+
return [...swcRules, swcPlugin].map(cacheable);
|
|
4440
2992
|
}
|
|
4441
2993
|
function getPreset() {
|
|
4442
2994
|
return {
|
|
@@ -4458,6 +3010,56 @@ function getPreset() {
|
|
|
4458
3010
|
};
|
|
4459
3011
|
}
|
|
4460
3012
|
|
|
3013
|
+
//#endregion
|
|
3014
|
+
//#region src/core/plugins/reporter-plugin.ts
|
|
3015
|
+
function reporterPlugin(options) {
|
|
3016
|
+
const { reporter, initialTotalModules = 0 } = options ?? {};
|
|
3017
|
+
let totalModules = initialTotalModules;
|
|
3018
|
+
let startedAt = 0;
|
|
3019
|
+
let transformedModules = 0;
|
|
3020
|
+
let unknownTotalModules = totalModules === 0;
|
|
3021
|
+
return {
|
|
3022
|
+
name: "rollipop:status",
|
|
3023
|
+
buildStart() {
|
|
3024
|
+
startedAt = performance.now();
|
|
3025
|
+
transformedModules = 0;
|
|
3026
|
+
reporter?.update({ type: "bundle_build_started" });
|
|
3027
|
+
},
|
|
3028
|
+
buildEnd(error) {
|
|
3029
|
+
const endedAt = performance.now();
|
|
3030
|
+
if (transformedModules !== 0) totalModules = transformedModules;
|
|
3031
|
+
unknownTotalModules = false;
|
|
3032
|
+
reporter?.update(error == null ? {
|
|
3033
|
+
type: "bundle_build_done",
|
|
3034
|
+
totalModules,
|
|
3035
|
+
duration: endedAt - startedAt
|
|
3036
|
+
} : {
|
|
3037
|
+
type: "bundle_build_failed",
|
|
3038
|
+
error
|
|
3039
|
+
});
|
|
3040
|
+
},
|
|
3041
|
+
transform: {
|
|
3042
|
+
order: "post",
|
|
3043
|
+
handler(_code, id) {
|
|
3044
|
+
++transformedModules;
|
|
3045
|
+
if (!unknownTotalModules && totalModules < transformedModules) totalModules = transformedModules;
|
|
3046
|
+
reporter?.update({
|
|
3047
|
+
type: "transform",
|
|
3048
|
+
id,
|
|
3049
|
+
totalModules: unknownTotalModules ? void 0 : totalModules,
|
|
3050
|
+
transformedModules
|
|
3051
|
+
});
|
|
3052
|
+
}
|
|
3053
|
+
},
|
|
3054
|
+
watchChange(id) {
|
|
3055
|
+
reporter?.update({
|
|
3056
|
+
type: "watch_change",
|
|
3057
|
+
id
|
|
3058
|
+
});
|
|
3059
|
+
}
|
|
3060
|
+
};
|
|
3061
|
+
}
|
|
3062
|
+
|
|
4461
3063
|
//#endregion
|
|
4462
3064
|
//#region src/core/plugins/index.ts
|
|
4463
3065
|
var plugins_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -4467,7 +3069,7 @@ var plugins_exports = /* @__PURE__ */ __exportAll({
|
|
|
4467
3069
|
prelude: () => preludePlugin,
|
|
4468
3070
|
reactNative: () => reactNativePlugin,
|
|
4469
3071
|
reactRefresh: () => reactRefreshPlugin,
|
|
4470
|
-
|
|
3072
|
+
reporter: () => reporterPlugin,
|
|
4471
3073
|
svg: () => svgPlugin,
|
|
4472
3074
|
swc: () => swcPlugin
|
|
4473
3075
|
});
|
|
@@ -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 = {
|
|
@@ -4489,7 +3091,7 @@ async function resolveRolldownOptions(context, config, buildOptions, devEngineOp
|
|
|
4489
3091
|
const { sourceExtensions, assetExtensions, preferNativePlatform, external: rolldownExternal, ...rolldownResolve } = config.resolver;
|
|
4490
3092
|
const { prelude: preludePaths, polyfills, banner: rolldownBanner, footer: rolldownFooter, postBanner: rolldownPostBanner, postFooter: rolldownPostFooter, intro: rolldownIntro, outro: rolldownOutro, shimMissingExports: rolldownShimMissingExports } = config.serializer;
|
|
4491
3093
|
const { flow, babel: babelConfig, swc: swcConfig, ...rolldownTransform } = config.transformer;
|
|
4492
|
-
const { treeshake: rolldownTreeshake, minify: rolldownMinify, ...rolldownOptimization } = config.optimization;
|
|
3094
|
+
const { treeshake: rolldownTreeshake, minify: rolldownMinify, lazyBarrel: rolldownLazyBarrel, ...rolldownOptimization } = config.optimization;
|
|
4493
3095
|
const { codegen, assetRegistryPath, globalIdentifiers: rolldownGlobalIdentifiers } = config.reactNative;
|
|
4494
3096
|
const { sourcemap: rolldownSourcemap, sourcemapBaseUrl: rolldownSourcemapBaseUrl, sourcemapDebugIds: rolldownSourcemapDebugIds, sourcemapIgnoreList: rolldownSourcemapIgnoreList, sourcemapPathTransform: rolldownSourcemapPathTransform } = config;
|
|
4495
3097
|
const transformSvg = config.transformer.svg;
|
|
@@ -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,14 +3128,16 @@ 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
|
-
case "compat": return
|
|
4532
|
-
case "progress": return
|
|
4533
|
-
case "none":
|
|
4534
|
-
default: return statusPresets.none(config.reporter);
|
|
3133
|
+
case "compat": return new CompatStatusReporter();
|
|
3134
|
+
case "progress": return new ProgressBarStatusReporter(context.id, `[${platform}, ${buildOptions.dev ? "dev" : "prod"}]`, getBuildTotalModules(context.storage, context.id));
|
|
4535
3135
|
}
|
|
4536
|
-
})();
|
|
3136
|
+
})()];
|
|
3137
|
+
const reporterOptions = {
|
|
3138
|
+
initialTotalModules: getBuildTotalModules(context.storage, context.id),
|
|
3139
|
+
reporter: mergeReporters([...defaultReporters, config.reporter].filter(isNotNil))
|
|
3140
|
+
};
|
|
4537
3141
|
const finalOptions = await applyDangerouslyOverrideOptionsFinalizer(config, {
|
|
4538
3142
|
platform: "neutral",
|
|
4539
3143
|
cwd: config.root,
|
|
@@ -4545,10 +3149,11 @@ async function resolveRolldownOptions(context, config, buildOptions, devEngineOp
|
|
|
4545
3149
|
treeshake: rolldownTreeshake,
|
|
4546
3150
|
external: rolldownExternal,
|
|
4547
3151
|
shimMissingExports: rolldownShimMissingExports,
|
|
3152
|
+
experimental: { lazyBarrel: rolldownLazyBarrel },
|
|
4548
3153
|
plugins: withTransformBoundary([
|
|
4549
3154
|
preludePlugin({ modulePaths: preludePaths }),
|
|
4550
3155
|
reactNativePlugin(config, {
|
|
4551
|
-
dev
|
|
3156
|
+
dev,
|
|
4552
3157
|
platform,
|
|
4553
3158
|
buildType: context.buildType,
|
|
4554
3159
|
codegenFilter: codegen.filter,
|
|
@@ -4561,7 +3166,7 @@ async function resolveRolldownOptions(context, config, buildOptions, devEngineOp
|
|
|
4561
3166
|
svgPlugin({ enabled: transformSvg }),
|
|
4562
3167
|
babelPlugin(babelConfig),
|
|
4563
3168
|
swcPlugin(swcConfig),
|
|
4564
|
-
|
|
3169
|
+
reporterPlugin(reporterOptions),
|
|
4565
3170
|
devServerPlugins,
|
|
4566
3171
|
config.plugins
|
|
4567
3172
|
], {
|
|
@@ -4588,19 +3193,18 @@ async function resolveRolldownOptions(context, config, buildOptions, devEngineOp
|
|
|
4588
3193
|
outro: rolldownOutro,
|
|
4589
3194
|
intro: async (chunk) => {
|
|
4590
3195
|
return [
|
|
4591
|
-
...getGlobalVariables(dev
|
|
3196
|
+
...getGlobalVariables(dev, context.buildType),
|
|
4592
3197
|
...loadPolyfills(polyfills),
|
|
4593
3198
|
typeof rolldownIntro === "function" ? await rolldownIntro(chunk) : rolldownIntro
|
|
4594
3199
|
].filter(isNotNil).join("\n");
|
|
4595
3200
|
},
|
|
4596
|
-
keepNames: dev$1,
|
|
4597
3201
|
minify: buildOptions.minify ?? rolldownMinify,
|
|
4598
3202
|
sourcemap: buildOptions.sourcemap ?? rolldownSourcemap,
|
|
4599
3203
|
sourcemapBaseUrl: rolldownSourcemapBaseUrl,
|
|
4600
3204
|
sourcemapDebugIds: rolldownSourcemapDebugIds,
|
|
4601
3205
|
sourcemapIgnoreList: rolldownSourcemapIgnoreList,
|
|
4602
3206
|
sourcemapPathTransform: rolldownSourcemapPathTransform,
|
|
4603
|
-
|
|
3207
|
+
codeSplitting: false,
|
|
4604
3208
|
strictExecutionOrder: true,
|
|
4605
3209
|
globalIdentifiers: rolldownGlobalIdentifiers
|
|
4606
3210
|
});
|
|
@@ -4609,16 +3213,16 @@ async function resolveRolldownOptions(context, config, buildOptions, devEngineOp
|
|
|
4609
3213
|
}
|
|
4610
3214
|
function getResolveExtensions({ platform, sourceExtensions, assetExtensions, preferNativePlatform }) {
|
|
4611
3215
|
const supportedExtensions = [...sourceExtensions, ...assetExtensions];
|
|
4612
|
-
return [...[platform, preferNativePlatform ? "native" : null].filter(isNotNil).map((platform
|
|
4613
|
-
return supportedExtensions.map((extension) => `.${platform
|
|
3216
|
+
return [...[platform, preferNativePlatform ? "native" : null].filter(isNotNil).map((platform) => {
|
|
3217
|
+
return supportedExtensions.map((extension) => `.${platform}.${extension}`);
|
|
4614
3218
|
}), ...supportedExtensions.map((extension) => `.${extension}`)].flat();
|
|
4615
3219
|
}
|
|
4616
3220
|
function loadPolyfills(polyfills) {
|
|
4617
3221
|
return polyfills.map((polyfill) => {
|
|
4618
3222
|
if (typeof polyfill === "string") return fs.readFileSync(polyfill, "utf-8");
|
|
4619
|
-
const path
|
|
3223
|
+
const path = "path" in polyfill ? polyfill.path : void 0;
|
|
4620
3224
|
const content = "code" in polyfill ? polyfill.code : fs.readFileSync(polyfill.path, "utf-8");
|
|
4621
|
-
return polyfill.type === "iife" ? iife(content, path
|
|
3225
|
+
return polyfill.type === "iife" ? iife(content, path) : content;
|
|
4622
3226
|
});
|
|
4623
3227
|
}
|
|
4624
3228
|
async function applyDangerouslyOverrideOptionsFinalizer(config, inputOptions, outputOptions) {
|
|
@@ -4678,11 +3282,11 @@ var Bundler = class Bundler {
|
|
|
4678
3282
|
return createId(config, buildOptions);
|
|
4679
3283
|
}
|
|
4680
3284
|
static createContext(buildType, config, buildOptions) {
|
|
4681
|
-
const id
|
|
3285
|
+
const id = Bundler.createId(config, buildOptions);
|
|
4682
3286
|
return {
|
|
4683
|
-
id
|
|
3287
|
+
id,
|
|
4684
3288
|
root: config.root,
|
|
4685
|
-
cache: new FileSystemCache(config.root, id
|
|
3289
|
+
cache: new FileSystemCache(config.root, id),
|
|
4686
3290
|
storage: FileStorage.getInstance(config.root),
|
|
4687
3291
|
buildType,
|
|
4688
3292
|
state: { hmrUpdates: /* @__PURE__ */ new Set() }
|
|
@@ -4739,7 +3343,7 @@ async function runServer(config, options) {
|
|
|
4739
3343
|
|
|
4740
3344
|
//#endregion
|
|
4741
3345
|
//#region package.json
|
|
4742
|
-
var version = "0.1.0-alpha.
|
|
3346
|
+
var version = "0.1.0-alpha.13";
|
|
4743
3347
|
|
|
4744
3348
|
//#endregion
|
|
4745
3349
|
//#region src/node/logger.ts
|
|
@@ -4753,10 +3357,10 @@ function parseBoolean(value) {
|
|
|
4753
3357
|
function resolvePath(value) {
|
|
4754
3358
|
return path.resolve(value);
|
|
4755
3359
|
}
|
|
4756
|
-
function withErrorHandler(action
|
|
3360
|
+
function withErrorHandler(action) {
|
|
4757
3361
|
return async function(args) {
|
|
4758
3362
|
try {
|
|
4759
|
-
await action
|
|
3363
|
+
await action.call(this, args);
|
|
4760
3364
|
} catch (reason) {
|
|
4761
3365
|
logger.error("An error occurred while executing the command");
|
|
4762
3366
|
logger.error(`Reason: ${reason instanceof Error ? reason.message : String(reason)}`);
|
|
@@ -4886,18 +3490,18 @@ function setupInteractiveMode(options) {
|
|
|
4886
3490
|
process.emit("SIGINT");
|
|
4887
3491
|
process.exit(0);
|
|
4888
3492
|
}
|
|
4889
|
-
const targetCommand = allCommands.find((command
|
|
3493
|
+
const targetCommand = allCommands.find((command) => command.key === sequence && (command.shift ?? false) === shift);
|
|
4890
3494
|
if (targetCommand) targetCommand.handler.call({
|
|
4891
3495
|
server: devServer,
|
|
4892
3496
|
logger
|
|
4893
3497
|
});
|
|
4894
3498
|
});
|
|
4895
3499
|
console.log();
|
|
4896
|
-
allCommands.forEach((command
|
|
3500
|
+
allCommands.forEach((command, index) => {
|
|
4897
3501
|
if (defaultCommands.length === index) console.log();
|
|
4898
|
-
const leadingLabel = command
|
|
4899
|
-
const shortcut = chalk.bold(shortcutLabel(command
|
|
4900
|
-
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}`);
|
|
4901
3505
|
});
|
|
4902
3506
|
}
|
|
4903
3507
|
function getDefaultCommands(devServer, debuggerOpener) {
|
|
@@ -4957,11 +3561,11 @@ function assertHasNoDuplicateCommands(defaultCommands, commands) {
|
|
|
4957
3561
|
//#endregion
|
|
4958
3562
|
//#region src/node/cli-utils.ts
|
|
4959
3563
|
function createCommand(commandDefinition) {
|
|
4960
|
-
const { name, description, options, action
|
|
4961
|
-
const command
|
|
4962
|
-
if (options != null) for (const option of options) (option.required ? command
|
|
4963
|
-
return command
|
|
4964
|
-
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);
|
|
4965
3569
|
}));
|
|
4966
3570
|
}
|
|
4967
3571
|
function createReactNativeCliCommand(commandDefinition) {
|
|
@@ -5225,4 +3829,4 @@ function run(argv) {
|
|
|
5225
3829
|
}
|
|
5226
3830
|
|
|
5227
3831
|
//#endregion
|
|
5228
|
-
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 };
|