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/commands.js
CHANGED
|
@@ -12,6 +12,7 @@ import fs from "node:fs";
|
|
|
12
12
|
import { generate } from "@babel/generator";
|
|
13
13
|
import flowRemoveTypes from "flow-remove-types";
|
|
14
14
|
import * as hermesParser from "hermes-parser";
|
|
15
|
+
import wrapAnsi from "wrap-ansi";
|
|
15
16
|
import * as c12 from "c12";
|
|
16
17
|
import pLimit from "p-limit";
|
|
17
18
|
import * as rolldown from "@rollipop/rolldown";
|
|
@@ -19,15 +20,15 @@ import { dev, transformSync } from "@rollipop/rolldown/experimental";
|
|
|
19
20
|
import crypto from "node:crypto";
|
|
20
21
|
import { xxh32 } from "@node-rs/xxhash";
|
|
21
22
|
import dedent from "dedent";
|
|
22
|
-
import wrapAnsi from "wrap-ansi";
|
|
23
23
|
import dotenv from "dotenv";
|
|
24
24
|
import dotenvExpand from "dotenv-expand";
|
|
25
|
-
import { exactRegex, exclude, id, include } from "@rollipop/rolldown-pluginutils";
|
|
25
|
+
import { exactRegex, exclude, id, include, or } from "@rollipop/rolldown-pluginutils";
|
|
26
26
|
import { imageSize } from "image-size";
|
|
27
27
|
import url from "url";
|
|
28
28
|
import { createDevServerMiddleware } from "@react-native-community/cli-server-api";
|
|
29
29
|
import { createDevMiddleware } from "@react-native/dev-middleware";
|
|
30
30
|
import Fastify from "fastify";
|
|
31
|
+
import mitt from "mitt";
|
|
31
32
|
import http from "node:http";
|
|
32
33
|
import EventEmitter from "node:events";
|
|
33
34
|
import stripAnsi from "strip-ansi";
|
|
@@ -36,13 +37,13 @@ import fp from "fastify-plugin";
|
|
|
36
37
|
import { asConst } from "json-schema-to-ts";
|
|
37
38
|
import mime from "mime";
|
|
38
39
|
import Ajv from "ajv";
|
|
40
|
+
import { codeFrameColumns } from "@babel/code-frame";
|
|
39
41
|
import * as ws from "ws";
|
|
40
42
|
import { transform } from "@svgr/core";
|
|
41
43
|
import * as babel from "@babel/core";
|
|
42
44
|
import * as swc from "@swc/core";
|
|
43
45
|
|
|
44
|
-
//#region
|
|
45
|
-
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
46
|
+
//#region \0rolldown/runtime.js
|
|
46
47
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
47
48
|
|
|
48
49
|
//#endregion
|
|
@@ -81,9 +82,9 @@ function printLogo() {
|
|
|
81
82
|
DESCRIPTIONS.forEach((description, index) => {
|
|
82
83
|
const descriptionHalfLength = description.length / 2;
|
|
83
84
|
const logoHalfWidth = maxLogoWidth / 2;
|
|
84
|
-
const padding
|
|
85
|
-
if (index === 0) console.log(padding
|
|
86
|
-
else console.log(padding
|
|
85
|
+
const padding = " ".repeat(PADDING - descriptionHalfLength + logoHalfWidth);
|
|
86
|
+
if (index === 0) console.log(padding + chalk.bold.hex(PRIMARY_COLOR)(description));
|
|
87
|
+
else console.log(padding + description);
|
|
87
88
|
});
|
|
88
89
|
console.log("");
|
|
89
90
|
}
|
|
@@ -118,7 +119,7 @@ const FALSY_VALUES = [
|
|
|
118
119
|
];
|
|
119
120
|
function parseDebugKeys() {
|
|
120
121
|
return Object.keys(process.env).filter((key) => /^debug_/i.test(key)).reduce((acc, key) => {
|
|
121
|
-
const prop = key.slice(6).toLowerCase().replace(/_([a-z])/g, (_, key
|
|
122
|
+
const prop = key.slice(6).toLowerCase().replace(/_([a-z])/g, (_, key) => key.toUpperCase());
|
|
122
123
|
let value = process.env[key];
|
|
123
124
|
const lowerCase = typeof value === "string" ? value.toLowerCase() : value.toString();
|
|
124
125
|
if (TRUTHY_VALUES.includes(lowerCase)) value = true;
|
|
@@ -350,18 +351,18 @@ function setupInteractiveMode(options) {
|
|
|
350
351
|
process.emit("SIGINT");
|
|
351
352
|
process.exit(0);
|
|
352
353
|
}
|
|
353
|
-
const targetCommand = allCommands.find((command
|
|
354
|
+
const targetCommand = allCommands.find((command) => command.key === sequence && (command.shift ?? false) === shift);
|
|
354
355
|
if (targetCommand) targetCommand.handler.call({
|
|
355
356
|
server: devServer,
|
|
356
357
|
logger: logger$2
|
|
357
358
|
});
|
|
358
359
|
});
|
|
359
360
|
console.log();
|
|
360
|
-
allCommands.forEach((command
|
|
361
|
+
allCommands.forEach((command, index) => {
|
|
361
362
|
if (defaultCommands.length === index) console.log();
|
|
362
|
-
const leadingLabel = command
|
|
363
|
-
const shortcut = chalk.bold(shortcutLabel(command
|
|
364
|
-
console.log(`${leadingLabel} ${shortcut} │ ${typeof command
|
|
363
|
+
const leadingLabel = command.shift ? "»" : "» Press";
|
|
364
|
+
const shortcut = chalk.bold(shortcutLabel(command.key, command.shift));
|
|
365
|
+
console.log(`${leadingLabel} ${shortcut} │ ${typeof command.description === "function" ? command.description() : command.description}`);
|
|
365
366
|
});
|
|
366
367
|
}
|
|
367
368
|
function getDefaultCommands(devServer, debuggerOpener) {
|
|
@@ -410,10 +411,10 @@ function shortcutLabel(key, shift) {
|
|
|
410
411
|
if (shift) return `shift+${key}`;
|
|
411
412
|
return key;
|
|
412
413
|
}
|
|
413
|
-
function assertHasNoDuplicateCommands(defaultCommands, commands
|
|
414
|
+
function assertHasNoDuplicateCommands(defaultCommands, commands) {
|
|
414
415
|
const defaultCommandKeys = defaultCommands.map(({ key, shift }) => shortcutLabel(key, shift));
|
|
415
|
-
const duplicateKeys = commands
|
|
416
|
-
const invalidCommandKeys = commands
|
|
416
|
+
const duplicateKeys = commands.map(({ key, shift }) => shortcutLabel(key, shift)).filter((key) => defaultCommandKeys.includes(key));
|
|
417
|
+
const invalidCommandKeys = commands.filter(({ key }) => key.length > 1).map(({ key, shift }) => shortcutLabel(key, shift));
|
|
417
418
|
if (invalidCommandKeys.length > 0) throw new Error(`Invalid commands: ${invalidCommandKeys.join(", ")}`);
|
|
418
419
|
if (duplicateKeys.length > 0) throw new Error(`Duplicate commands: ${duplicateKeys.join(", ")}`);
|
|
419
420
|
}
|
|
@@ -458,10 +459,10 @@ function parseFlowSyntax(code) {
|
|
|
458
459
|
babel: true
|
|
459
460
|
});
|
|
460
461
|
}
|
|
461
|
-
function generateSourceFromAst(ast, id
|
|
462
|
+
function generateSourceFromAst(ast, id) {
|
|
462
463
|
const generated = generate(ast, {
|
|
463
464
|
sourceMaps: true,
|
|
464
|
-
sourceFileName: path.basename(id
|
|
465
|
+
sourceFileName: path.basename(id)
|
|
465
466
|
});
|
|
466
467
|
return {
|
|
467
468
|
code: generated.code,
|
|
@@ -598,13 +599,13 @@ function getPolyfillScriptPaths(reactNativePath) {
|
|
|
598
599
|
const scriptPath = path.join(reactNativePath, "rn-get-polyfills");
|
|
599
600
|
return __require(scriptPath)();
|
|
600
601
|
}
|
|
601
|
-
function getGlobalVariables(dev
|
|
602
|
-
const isDevServerMode = dev
|
|
602
|
+
function getGlobalVariables(dev, buildType) {
|
|
603
|
+
const isDevServerMode = dev && buildType === "serve";
|
|
603
604
|
return [
|
|
604
605
|
`var __BUNDLE_START_TIME__=globalThis.nativePerformanceNow?nativePerformanceNow():Date.now();`,
|
|
605
|
-
`var __DEV__=${dev
|
|
606
|
+
`var __DEV__=${dev};`,
|
|
606
607
|
`var ${GLOBAL_IDENTIFIER}=typeof globalThis!=='undefined'?globalThis:typeof global !== 'undefined'?global:typeof window!=='undefined'?window:this;`,
|
|
607
|
-
`var process=globalThis.process||{};process.env=process.env||{};process.env.NODE_ENV=process.env.NODE_ENV||"${dev
|
|
608
|
+
`var process=globalThis.process||{};process.env=process.env||{};process.env.NODE_ENV=process.env.NODE_ENV||"${dev ? "development" : "production"}";`,
|
|
608
609
|
isDevServerMode ? `var $RefreshReg$ = () => {};` : null,
|
|
609
610
|
isDevServerMode ? `var $RefreshSig$ = () => (v) => v;` : null
|
|
610
611
|
].filter(isNotNil);
|
|
@@ -636,419 +637,68 @@ function resolvePackagePathWithNodeRequire(basePath, packageName, subpath) {
|
|
|
636
637
|
}
|
|
637
638
|
|
|
638
639
|
//#endregion
|
|
639
|
-
//#region src/
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
mode: mode ?? "development",
|
|
650
|
-
entry: "index.js",
|
|
651
|
-
resolver: {
|
|
652
|
-
sourceExtensions: DEFAULT_SOURCE_EXTENSIONS,
|
|
653
|
-
assetExtensions: DEFAULT_ASSET_EXTENSIONS,
|
|
654
|
-
mainFields: DEFAULT_RESOLVER_MAIN_FIELDS,
|
|
655
|
-
conditionNames: DEFAULT_RESOLVER_CONDITION_NAMES,
|
|
656
|
-
preferNativePlatform: true,
|
|
657
|
-
symlinks: true
|
|
658
|
-
},
|
|
659
|
-
transformer: {
|
|
660
|
-
svg: true,
|
|
661
|
-
flow: { filter: {
|
|
662
|
-
id: /\.jsx?$/,
|
|
663
|
-
code: /@flow/
|
|
664
|
-
} }
|
|
665
|
-
},
|
|
666
|
-
serializer: {
|
|
667
|
-
prelude: [getInitializeCorePath(projectRoot)],
|
|
668
|
-
polyfills: getPolyfillScriptPaths(reactNativePath).map((path$1) => ({
|
|
669
|
-
type: "iife",
|
|
670
|
-
code: generateSourceFromAst(stripFlowSyntax(fs.readFileSync(path$1, "utf-8")), path$1).code
|
|
671
|
-
}))
|
|
672
|
-
},
|
|
673
|
-
watcher: {
|
|
674
|
-
skipWrite: true,
|
|
675
|
-
useDebounce: true,
|
|
676
|
-
debounceDuration: 50
|
|
677
|
-
},
|
|
678
|
-
optimization: { treeshake: true },
|
|
679
|
-
reactNative: {
|
|
680
|
-
reactNativePath,
|
|
681
|
-
codegen: { filter: { code: /\bcodegenNativeComponent</ } },
|
|
682
|
-
assetRegistryPath: DEFAULT_ASSET_REGISTRY_PATH,
|
|
683
|
-
globalIdentifiers: DEFAULT_REACT_NATIVE_GLOBAL_IDENTIFIERS
|
|
684
|
-
},
|
|
685
|
-
devMode: { hmr: true },
|
|
686
|
-
terminal: { status: (() => {
|
|
687
|
-
if (isDebugEnabled()) return "compat";
|
|
688
|
-
if (process.stderr.isTTY) return "progress";
|
|
689
|
-
return "compat";
|
|
690
|
-
})() },
|
|
691
|
-
reporter: new TerminalReporter(),
|
|
692
|
-
envDir: projectRoot,
|
|
693
|
-
envPrefix: DEFAULT_ENV_PREFIX
|
|
694
|
-
};
|
|
695
|
-
}
|
|
696
|
-
var TerminalReporter = class {
|
|
697
|
-
logger = new Logger("app");
|
|
698
|
-
update(event) {
|
|
699
|
-
if (event.type === "client_log") {
|
|
700
|
-
if (event.level === "group" || event.level === "groupCollapsed") {
|
|
701
|
-
this.logger.info(...event.data);
|
|
702
|
-
return;
|
|
703
|
-
} else if (event.level === "groupEnd") return;
|
|
704
|
-
this.logger[event.level](...event.data);
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
};
|
|
708
|
-
|
|
709
|
-
//#endregion
|
|
710
|
-
//#region src/core/plugins/context.ts
|
|
711
|
-
const pluginLogger = new Logger();
|
|
712
|
-
function createPluginContext(name) {
|
|
713
|
-
return {
|
|
714
|
-
debug: (log) => {
|
|
715
|
-
printPluginLog("debug", log, name);
|
|
716
|
-
},
|
|
717
|
-
info: (log) => {
|
|
718
|
-
printPluginLog("info", log, name);
|
|
719
|
-
},
|
|
720
|
-
warn: (log) => {
|
|
721
|
-
printPluginLog("warn", log, name);
|
|
722
|
-
}
|
|
723
|
-
};
|
|
724
|
-
}
|
|
725
|
-
function printPluginLog(level, log, pluginName = "unknown") {
|
|
726
|
-
const pluginLabel = chalk.magenta(`plugin:${pluginName}`);
|
|
727
|
-
if (typeof log === "string") pluginLogger[level](pluginLabel, log);
|
|
728
|
-
else pluginLogger[level](pluginLabel, log.stack ?? log.message);
|
|
729
|
-
}
|
|
730
|
-
|
|
731
|
-
//#endregion
|
|
732
|
-
//#region src/config/merge-config.ts
|
|
733
|
-
function mergeConfig(baseConfig, ...overrideConfigs) {
|
|
734
|
-
let mergedConfig = baseConfig;
|
|
735
|
-
for (const overrideConfig of overrideConfigs) mergedConfig = mergeWith(mergedConfig, overrideConfig, (target, source, key) => {
|
|
736
|
-
if ([
|
|
737
|
-
"sourceExtensions",
|
|
738
|
-
"assetExtensions",
|
|
739
|
-
"polyfills",
|
|
740
|
-
"prelude",
|
|
741
|
-
"plugins"
|
|
742
|
-
].includes(key)) return Array.from(new Set([...target ?? [], ...source ?? []]));
|
|
743
|
-
if (key === "reporter") return source ?? target;
|
|
744
|
-
});
|
|
745
|
-
return mergedConfig;
|
|
746
|
-
}
|
|
747
|
-
|
|
748
|
-
//#endregion
|
|
749
|
-
//#region src/config/load-config.ts
|
|
750
|
-
const CONFIG_FILE_NAME = "rollipop";
|
|
751
|
-
async function loadConfig(options = {}) {
|
|
752
|
-
const { cwd = process.cwd(), configFile, mode, context = {} } = options;
|
|
753
|
-
const defaultConfig = getDefaultConfig(cwd, mode);
|
|
754
|
-
const commonOptions = {
|
|
755
|
-
context: {
|
|
756
|
-
...context,
|
|
757
|
-
defaultConfig
|
|
758
|
-
},
|
|
759
|
-
rcFile: false
|
|
760
|
-
};
|
|
761
|
-
const { config: userConfig } = await c12.loadConfig(configFile ? {
|
|
762
|
-
configFile: path.resolve(cwd, configFile),
|
|
763
|
-
configFileRequired: true
|
|
764
|
-
} : {
|
|
765
|
-
cwd,
|
|
766
|
-
defaultConfig,
|
|
767
|
-
name: CONFIG_FILE_NAME,
|
|
768
|
-
...commonOptions
|
|
769
|
-
});
|
|
770
|
-
const plugins = await flattenPluginOption(userConfig.plugins);
|
|
771
|
-
const pluginConfig = await resolvePluginConfig(userConfig, plugins);
|
|
772
|
-
const resolvedConfig = mergeConfig(defaultConfig, ...[{
|
|
773
|
-
...userConfig,
|
|
774
|
-
plugins
|
|
775
|
-
}, pluginConfig]);
|
|
776
|
-
await invokeConfigResolved(resolvedConfig, plugins);
|
|
777
|
-
return resolvedConfig;
|
|
778
|
-
}
|
|
779
|
-
async function flattenPluginOption(pluginOption) {
|
|
780
|
-
const awaitedPluginOption = await pluginOption;
|
|
781
|
-
if (Array.isArray(awaitedPluginOption)) return (await Promise.all(awaitedPluginOption.map(flattenPluginOption))).flat();
|
|
782
|
-
if (awaitedPluginOption == null || awaitedPluginOption === false) return [];
|
|
783
|
-
return [awaitedPluginOption];
|
|
784
|
-
}
|
|
785
|
-
async function resolvePluginConfig(baseConfig, plugins) {
|
|
786
|
-
let mergedConfig = omit(baseConfig, ["plugins", "dangerously_overrideRolldownOptions"]);
|
|
787
|
-
for (const plugin$3 of plugins) {
|
|
788
|
-
const context = createPluginContext(plugin$3.name);
|
|
789
|
-
if (typeof plugin$3.config === "function") {
|
|
790
|
-
const config = await plugin$3.config.call(context, mergedConfig);
|
|
791
|
-
if (config != null) mergedConfig = mergeConfig(mergedConfig, config);
|
|
792
|
-
} else if (typeof plugin$3.config === "object") mergedConfig = mergeConfig(mergedConfig, plugin$3.config);
|
|
793
|
-
}
|
|
794
|
-
return mergedConfig;
|
|
640
|
+
//#region src/utils/terminal.ts
|
|
641
|
+
/**
|
|
642
|
+
* Based on https://github.com/sindresorhus/log-update/blob/master/index.js
|
|
643
|
+
* Based on https://github.com/unjs/webpackbar
|
|
644
|
+
*/
|
|
645
|
+
function eraseLines(count) {
|
|
646
|
+
let clear = "";
|
|
647
|
+
for (let i = 0; i < count; i++) clear += `\u001B[2K` + (i < count - 1 ? `\u001B[1A` : "");
|
|
648
|
+
if (count) clear += `\u001B[G`;
|
|
649
|
+
return clear;
|
|
795
650
|
}
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
return plugin$3.configResolved?.call(context, config);
|
|
800
|
-
}));
|
|
651
|
+
function ellipsisLeft(value, maxLength) {
|
|
652
|
+
if (value.length <= maxLength - 3) return value;
|
|
653
|
+
return `...${value.slice(value.length - maxLength - 1)}`;
|
|
801
654
|
}
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
655
|
+
const originalWrite = Symbol("original-write");
|
|
656
|
+
var StreamManager = class {
|
|
657
|
+
prevLineCount;
|
|
658
|
+
listening;
|
|
659
|
+
extraLines;
|
|
660
|
+
_streams;
|
|
661
|
+
constructor() {
|
|
662
|
+
this.prevLineCount = 0;
|
|
663
|
+
this.listening = false;
|
|
664
|
+
this.extraLines = "";
|
|
665
|
+
this._onData = this._onData.bind(this);
|
|
666
|
+
this._streams = [process.stdout, process.stderr];
|
|
814
667
|
}
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
668
|
+
render(lines) {
|
|
669
|
+
this.listen();
|
|
670
|
+
const wrappedLines = wrapAnsi(lines, this.columns, {
|
|
671
|
+
trim: false,
|
|
672
|
+
hard: true,
|
|
673
|
+
wordWrap: false
|
|
819
674
|
});
|
|
675
|
+
const data = eraseLines(this.prevLineCount) + wrappedLines + "\n" + this.extraLines;
|
|
676
|
+
this.write(data);
|
|
677
|
+
this.prevLineCount = data.split("\n").length;
|
|
820
678
|
}
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
this.ensureCacheDirectory(this.cacheDirectory);
|
|
824
|
-
logger$1.debug("cache directory:", this.cacheDirectory);
|
|
825
|
-
}
|
|
826
|
-
ensureCacheDirectory(cacheDirectory) {
|
|
827
|
-
if (!fs.existsSync(cacheDirectory)) fs.mkdirSync(cacheDirectory, { recursive: true });
|
|
679
|
+
get columns() {
|
|
680
|
+
return (process.stderr.columns || 80) - 2;
|
|
828
681
|
}
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
return;
|
|
834
|
-
}
|
|
682
|
+
write(data) {
|
|
683
|
+
const stream = process.stderr;
|
|
684
|
+
if (stream.write[originalWrite]) stream.write[originalWrite].call(stream, data, "utf8");
|
|
685
|
+
else stream.write(data, "utf8");
|
|
835
686
|
}
|
|
836
|
-
|
|
837
|
-
this.
|
|
687
|
+
clear() {
|
|
688
|
+
this.done();
|
|
689
|
+
this.write(eraseLines(this.prevLineCount));
|
|
838
690
|
}
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
try {
|
|
844
|
-
await fs.promises.writeFile(path.join(this.cacheDirectory, key), value);
|
|
845
|
-
} catch (error) {
|
|
846
|
-
logger$1.error("Failed to write cache file", key);
|
|
847
|
-
logger$1.debug(error);
|
|
848
|
-
}
|
|
849
|
-
}))).catch((error) => {
|
|
850
|
-
logger$1.error("Failed to flush cache", error);
|
|
851
|
-
});
|
|
852
|
-
this.pendingData.clear();
|
|
691
|
+
done() {
|
|
692
|
+
this.stopListen();
|
|
693
|
+
this.prevLineCount = 0;
|
|
694
|
+
this.extraLines = "";
|
|
853
695
|
}
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
}
|
|
861
|
-
};
|
|
862
|
-
|
|
863
|
-
//#endregion
|
|
864
|
-
//#region src/utils/reset-cache.ts
|
|
865
|
-
function resetCache(projectRoot) {
|
|
866
|
-
FileSystemCache.clearAll(projectRoot);
|
|
867
|
-
}
|
|
868
|
-
|
|
869
|
-
//#endregion
|
|
870
|
-
//#region src/utils/build-options.ts
|
|
871
|
-
const DEFAULT_BUILD_OPTIONS = {
|
|
872
|
-
cache: true,
|
|
873
|
-
minify: false
|
|
874
|
-
};
|
|
875
|
-
function resolveBuildOptions(config, buildOptions) {
|
|
876
|
-
if (buildOptions.outfile) buildOptions.outfile = path.resolve(config.root, buildOptions.outfile);
|
|
877
|
-
if ((buildOptions.sourcemap === true || buildOptions.sourcemap === "hidden") && buildOptions.sourcemapOutfile) buildOptions.sourcemapOutfile = path.resolve(config.root, buildOptions.sourcemapOutfile);
|
|
878
|
-
return merge(DEFAULT_BUILD_OPTIONS, {
|
|
879
|
-
...buildOptions,
|
|
880
|
-
dev: buildOptions.dev ?? config.mode === "development"
|
|
881
|
-
});
|
|
882
|
-
}
|
|
883
|
-
|
|
884
|
-
//#endregion
|
|
885
|
-
//#region src/utils/hash.ts
|
|
886
|
-
function xxhash(data) {
|
|
887
|
-
return xxh32(data).toString(16);
|
|
888
|
-
}
|
|
889
|
-
function md5(data) {
|
|
890
|
-
return crypto.createHash("md5").update(data).digest("hex");
|
|
891
|
-
}
|
|
892
|
-
|
|
893
|
-
//#endregion
|
|
894
|
-
//#region src/utils/serialize.ts
|
|
895
|
-
function serialize(value) {
|
|
896
|
-
return JSON.stringify(value, (_, value$1) => {
|
|
897
|
-
if (typeof value$1 === "function") return value$1.toString();
|
|
898
|
-
if (value$1 instanceof RegExp) return value$1.toString();
|
|
899
|
-
return value$1;
|
|
900
|
-
});
|
|
901
|
-
}
|
|
902
|
-
|
|
903
|
-
//#endregion
|
|
904
|
-
//#region src/utils/id.ts
|
|
905
|
-
function createId(config, buildOptions) {
|
|
906
|
-
return md5(serialize([
|
|
907
|
-
ROLLIPOP_VERSION,
|
|
908
|
-
filterTransformAffectedOptions(buildOptions),
|
|
909
|
-
filterTransformAffectedConfig(config)
|
|
910
|
-
]));
|
|
911
|
-
}
|
|
912
|
-
function filterTransformAffectedOptions(buildOptions) {
|
|
913
|
-
return pick(buildOptions, ["platform", "dev"]);
|
|
914
|
-
}
|
|
915
|
-
function filterTransformAffectedConfig(config) {
|
|
916
|
-
const { transformer, serializer, reactNative, devMode, plugins = [] } = config;
|
|
917
|
-
return [
|
|
918
|
-
transformer,
|
|
919
|
-
serializer.polyfills,
|
|
920
|
-
serializer.prelude,
|
|
921
|
-
reactNative.assetRegistryPath,
|
|
922
|
-
devMode,
|
|
923
|
-
plugins.map((plugin$3, index) => `${plugin$3.name}#${index}`)
|
|
924
|
-
];
|
|
925
|
-
}
|
|
926
|
-
|
|
927
|
-
//#endregion
|
|
928
|
-
//#region src/core/fs/storage.ts
|
|
929
|
-
const DEFAULT_DATA = { build: {} };
|
|
930
|
-
var FileStorage = class FileStorage {
|
|
931
|
-
static instance = null;
|
|
932
|
-
dataFilePath;
|
|
933
|
-
data;
|
|
934
|
-
static getInstance(basePath) {
|
|
935
|
-
if (FileStorage.instance == null) FileStorage.instance = new FileStorage(basePath);
|
|
936
|
-
return new FileStorage(basePath);
|
|
937
|
-
}
|
|
938
|
-
constructor(basePath) {
|
|
939
|
-
this.basePath = basePath;
|
|
940
|
-
this.dataFilePath = path.join(getSharedDataPath(basePath), "rollipop.json");
|
|
941
|
-
if (fs.existsSync(this.dataFilePath)) this.data = JSON.parse(fs.readFileSync(this.dataFilePath, "utf-8"));
|
|
942
|
-
else this.data = DEFAULT_DATA;
|
|
943
|
-
}
|
|
944
|
-
get() {
|
|
945
|
-
return this.data;
|
|
946
|
-
}
|
|
947
|
-
set(data) {
|
|
948
|
-
this.data = merge(this.data, data);
|
|
949
|
-
fs.writeFileSync(this.dataFilePath, JSON.stringify(this.data, null, 2));
|
|
950
|
-
}
|
|
951
|
-
};
|
|
952
|
-
|
|
953
|
-
//#endregion
|
|
954
|
-
//#region src/utils/string.ts
|
|
955
|
-
function indent(text, indent$1, space = " ") {
|
|
956
|
-
return text.replace(/^/gm, space.repeat(indent$1));
|
|
957
|
-
}
|
|
958
|
-
|
|
959
|
-
//#endregion
|
|
960
|
-
//#region src/common/code.ts
|
|
961
|
-
function asLiteral(value) {
|
|
962
|
-
return JSON.stringify(value);
|
|
963
|
-
}
|
|
964
|
-
function asIdentifier(name) {
|
|
965
|
-
return name;
|
|
966
|
-
}
|
|
967
|
-
function nodeEnvironment(dev$1) {
|
|
968
|
-
return dev$1 ? "development" : "production";
|
|
969
|
-
}
|
|
970
|
-
function iife(body, path$1 = "<unknown>") {
|
|
971
|
-
const bodyPlaceholder = "__BODY__";
|
|
972
|
-
return dedent`
|
|
973
|
-
// ${path$1}
|
|
974
|
-
(function (global) {
|
|
975
|
-
${bodyPlaceholder}
|
|
976
|
-
})(${GLOBAL_IDENTIFIER});
|
|
977
|
-
`.replace(bodyPlaceholder, indent(body, 1));
|
|
978
|
-
}
|
|
979
|
-
|
|
980
|
-
//#endregion
|
|
981
|
-
//#region src/utils/storage.ts
|
|
982
|
-
function getBuildTotalModules(storage, id$1) {
|
|
983
|
-
return storage.get().build[id$1]?.totalModules ?? 0;
|
|
984
|
-
}
|
|
985
|
-
function setBuildTotalModules(storage, id$1, totalModules) {
|
|
986
|
-
storage.set({ build: { [id$1]: { totalModules } } });
|
|
987
|
-
}
|
|
988
|
-
|
|
989
|
-
//#endregion
|
|
990
|
-
//#region src/utils/terminal.ts
|
|
991
|
-
/**
|
|
992
|
-
* Based on https://github.com/sindresorhus/log-update/blob/master/index.js
|
|
993
|
-
* Based on https://github.com/unjs/webpackbar
|
|
994
|
-
*/
|
|
995
|
-
function eraseLines(count) {
|
|
996
|
-
let clear = "";
|
|
997
|
-
for (let i = 0; i < count; i++) clear += `\u001B[2K` + (i < count - 1 ? `\u001B[1A` : "");
|
|
998
|
-
if (count) clear += `\u001B[G`;
|
|
999
|
-
return clear;
|
|
1000
|
-
}
|
|
1001
|
-
function ellipsisLeft(value, maxLength) {
|
|
1002
|
-
if (value.length <= maxLength - 3) return value;
|
|
1003
|
-
return `...${value.slice(value.length - maxLength - 1)}`;
|
|
1004
|
-
}
|
|
1005
|
-
const originalWrite = Symbol("original-write");
|
|
1006
|
-
var StreamManager = class {
|
|
1007
|
-
prevLineCount;
|
|
1008
|
-
listening;
|
|
1009
|
-
extraLines;
|
|
1010
|
-
_streams;
|
|
1011
|
-
constructor() {
|
|
1012
|
-
this.prevLineCount = 0;
|
|
1013
|
-
this.listening = false;
|
|
1014
|
-
this.extraLines = "";
|
|
1015
|
-
this._onData = this._onData.bind(this);
|
|
1016
|
-
this._streams = [process.stdout, process.stderr];
|
|
1017
|
-
}
|
|
1018
|
-
render(lines) {
|
|
1019
|
-
this.listen();
|
|
1020
|
-
const wrappedLines = wrapAnsi(lines, this.columns, {
|
|
1021
|
-
trim: false,
|
|
1022
|
-
hard: true,
|
|
1023
|
-
wordWrap: false
|
|
1024
|
-
});
|
|
1025
|
-
const data = eraseLines(this.prevLineCount) + wrappedLines + "\n" + this.extraLines;
|
|
1026
|
-
this.write(data);
|
|
1027
|
-
this.prevLineCount = data.split("\n").length;
|
|
1028
|
-
}
|
|
1029
|
-
get columns() {
|
|
1030
|
-
return (process.stderr.columns || 80) - 2;
|
|
1031
|
-
}
|
|
1032
|
-
write(data) {
|
|
1033
|
-
const stream = process.stderr;
|
|
1034
|
-
if (stream.write[originalWrite]) stream.write[originalWrite].call(stream, data, "utf8");
|
|
1035
|
-
else stream.write(data, "utf8");
|
|
1036
|
-
}
|
|
1037
|
-
clear() {
|
|
1038
|
-
this.done();
|
|
1039
|
-
this.write(eraseLines(this.prevLineCount));
|
|
1040
|
-
}
|
|
1041
|
-
done() {
|
|
1042
|
-
this.stopListen();
|
|
1043
|
-
this.prevLineCount = 0;
|
|
1044
|
-
this.extraLines = "";
|
|
1045
|
-
}
|
|
1046
|
-
_onData(data) {
|
|
1047
|
-
const lines = String(data).split("\n").length - 1;
|
|
1048
|
-
if (lines > 0) {
|
|
1049
|
-
this.prevLineCount += lines;
|
|
1050
|
-
this.extraLines += data;
|
|
1051
|
-
}
|
|
696
|
+
_onData(data) {
|
|
697
|
+
const lines = String(data).split("\n").length - 1;
|
|
698
|
+
if (lines > 0) {
|
|
699
|
+
this.prevLineCount += lines;
|
|
700
|
+
this.extraLines += data;
|
|
701
|
+
}
|
|
1052
702
|
}
|
|
1053
703
|
listen() {
|
|
1054
704
|
if (this.listening) return;
|
|
@@ -1096,9 +746,12 @@ const runningRenderer = { render(state, context) {
|
|
|
1096
746
|
].join(" ")}\n${state.moduleId ? " " + chalk.grey(ellipsisLeft(state.moduleId, columns - 10)) : ""}`;
|
|
1097
747
|
} };
|
|
1098
748
|
const completedRenderer = { render(state, context) {
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
749
|
+
if (state.hasErrors) return `${chalk.red("✘")} Build failed ${chalk.gray(context.label)}`;
|
|
750
|
+
else {
|
|
751
|
+
const icon = chalk.green("✔");
|
|
752
|
+
const durationInSeconds = (state.duration / 1e3).toFixed(2);
|
|
753
|
+
return `${`${icon} Build completed ${chalk.gray(context.label)}`}\n${chalk.grey(` Built in ${durationInSeconds}s (${context.current}/${context.total} modules)`)}`;
|
|
754
|
+
}
|
|
1102
755
|
} };
|
|
1103
756
|
var ProgressBarRenderer = class {
|
|
1104
757
|
renderers = {
|
|
@@ -1172,147 +825,468 @@ var ProgressBar = class {
|
|
|
1172
825
|
};
|
|
1173
826
|
var ProgressBarRenderManager = class ProgressBarRenderManager {
|
|
1174
827
|
static instance = null;
|
|
1175
|
-
streamManager = new StreamManager();
|
|
1176
|
-
progressBars = /* @__PURE__ */ new Map();
|
|
1177
|
-
throttledRender;
|
|
1178
|
-
static getInstance() {
|
|
1179
|
-
if (!ProgressBarRenderManager.instance) ProgressBarRenderManager.instance = new ProgressBarRenderManager();
|
|
1180
|
-
return ProgressBarRenderManager.instance;
|
|
1181
|
-
}
|
|
1182
|
-
constructor() {
|
|
1183
|
-
this.throttledRender = throttle(this._render.bind(this), 50);
|
|
1184
|
-
}
|
|
1185
|
-
_render() {
|
|
1186
|
-
const renderedLines = Array.from(this.progressBars.values().filter((progressBar
|
|
1187
|
-
if (renderedLines.length > 0) this.streamManager.render(renderedLines.join("\n\n"));
|
|
1188
|
-
}
|
|
1189
|
-
register(key, options) {
|
|
1190
|
-
const progressBar
|
|
1191
|
-
if (progressBar
|
|
1192
|
-
const newProgressBar = new ProgressBar(options);
|
|
1193
|
-
this.progressBars.set(key, newProgressBar);
|
|
1194
|
-
return newProgressBar;
|
|
1195
|
-
}
|
|
1196
|
-
return progressBar
|
|
1197
|
-
}
|
|
1198
|
-
start() {
|
|
1199
|
-
console.log();
|
|
1200
|
-
this.streamManager.listen();
|
|
1201
|
-
this._render();
|
|
828
|
+
streamManager = new StreamManager();
|
|
829
|
+
progressBars = /* @__PURE__ */ new Map();
|
|
830
|
+
throttledRender;
|
|
831
|
+
static getInstance() {
|
|
832
|
+
if (!ProgressBarRenderManager.instance) ProgressBarRenderManager.instance = new ProgressBarRenderManager();
|
|
833
|
+
return ProgressBarRenderManager.instance;
|
|
834
|
+
}
|
|
835
|
+
constructor() {
|
|
836
|
+
this.throttledRender = throttle(this._render.bind(this), 50);
|
|
837
|
+
}
|
|
838
|
+
_render() {
|
|
839
|
+
const renderedLines = Array.from(this.progressBars.values().filter((progressBar) => progressBar.stale).map((progressBar) => progressBar.render()));
|
|
840
|
+
if (renderedLines.length > 0) this.streamManager.render(renderedLines.join("\n\n"));
|
|
841
|
+
}
|
|
842
|
+
register(key, options) {
|
|
843
|
+
const progressBar = this.progressBars.get(key);
|
|
844
|
+
if (progressBar == null) {
|
|
845
|
+
const newProgressBar = new ProgressBar(options);
|
|
846
|
+
this.progressBars.set(key, newProgressBar);
|
|
847
|
+
return newProgressBar;
|
|
848
|
+
}
|
|
849
|
+
return progressBar;
|
|
850
|
+
}
|
|
851
|
+
start() {
|
|
852
|
+
console.log();
|
|
853
|
+
this.streamManager.listen();
|
|
854
|
+
this._render();
|
|
855
|
+
}
|
|
856
|
+
render() {
|
|
857
|
+
this.throttledRender();
|
|
858
|
+
}
|
|
859
|
+
release() {
|
|
860
|
+
if (this.progressBars.values().every((progressBar) => progressBar.done)) {
|
|
861
|
+
this._render();
|
|
862
|
+
this.streamManager.done();
|
|
863
|
+
console.log();
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
clear() {
|
|
867
|
+
this.streamManager.clear();
|
|
868
|
+
}
|
|
869
|
+
};
|
|
870
|
+
|
|
871
|
+
//#endregion
|
|
872
|
+
//#region src/logger.ts
|
|
873
|
+
const logger$1 = new Logger("bundler");
|
|
874
|
+
|
|
875
|
+
//#endregion
|
|
876
|
+
//#region src/utils/reporters.ts
|
|
877
|
+
function mergeReporters(reporters) {
|
|
878
|
+
return { update(event) {
|
|
879
|
+
reporters.forEach((reporter) => reporter.update(event));
|
|
880
|
+
} };
|
|
881
|
+
}
|
|
882
|
+
var ClientLogReporter = class {
|
|
883
|
+
logger = new Logger("app");
|
|
884
|
+
update(event) {
|
|
885
|
+
if (event.type === "client_log") {
|
|
886
|
+
if (event.level === "group" || event.level === "groupCollapsed") {
|
|
887
|
+
this.logger.info(...event.data);
|
|
888
|
+
return;
|
|
889
|
+
} else if (event.level === "groupEnd") return;
|
|
890
|
+
this.logger[event.level](...event.data);
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
};
|
|
894
|
+
var ProgressFlags = /* @__PURE__ */ function(ProgressFlags) {
|
|
895
|
+
ProgressFlags[ProgressFlags["NONE"] = 0] = "NONE";
|
|
896
|
+
ProgressFlags[ProgressFlags["BUILD_IN_PROGRESS"] = 1] = "BUILD_IN_PROGRESS";
|
|
897
|
+
ProgressFlags[ProgressFlags["FILE_CHANGED"] = 2] = "FILE_CHANGED";
|
|
898
|
+
return ProgressFlags;
|
|
899
|
+
}(ProgressFlags || {});
|
|
900
|
+
var ProgressBarStatusReporter = class {
|
|
901
|
+
renderManager = ProgressBarRenderManager.getInstance();
|
|
902
|
+
progressBar;
|
|
903
|
+
flags = ProgressFlags.NONE;
|
|
904
|
+
constructor(id, label, initialTotalModules) {
|
|
905
|
+
this.progressBar = this.renderManager.register(id, {
|
|
906
|
+
label,
|
|
907
|
+
total: initialTotalModules
|
|
908
|
+
});
|
|
909
|
+
}
|
|
910
|
+
renderProgress(id, totalModules, transformedModules) {
|
|
911
|
+
if (totalModules != null) this.progressBar.setTotal(totalModules);
|
|
912
|
+
this.progressBar.setCurrent(transformedModules).setModuleId(id);
|
|
913
|
+
this.renderManager.render();
|
|
914
|
+
}
|
|
915
|
+
update(event) {
|
|
916
|
+
switch (event.type) {
|
|
917
|
+
case "bundle_build_started":
|
|
918
|
+
this.flags |= ProgressFlags.BUILD_IN_PROGRESS;
|
|
919
|
+
this.progressBar.start();
|
|
920
|
+
this.renderManager.start();
|
|
921
|
+
break;
|
|
922
|
+
case "bundle_build_failed":
|
|
923
|
+
this.flags = ProgressFlags.NONE;
|
|
924
|
+
this.progressBar.complete(0, true);
|
|
925
|
+
this.renderManager.release();
|
|
926
|
+
break;
|
|
927
|
+
case "bundle_build_done":
|
|
928
|
+
this.flags = ProgressFlags.NONE;
|
|
929
|
+
this.progressBar.setTotal(event.totalModules).complete(event.duration, false);
|
|
930
|
+
this.renderManager.release();
|
|
931
|
+
break;
|
|
932
|
+
case "transform":
|
|
933
|
+
const { id, totalModules, transformedModules } = event;
|
|
934
|
+
if (this.flags & ProgressFlags.FILE_CHANGED) {
|
|
935
|
+
logger$1.debug("Transformed changed file", { id });
|
|
936
|
+
return;
|
|
937
|
+
}
|
|
938
|
+
this.renderProgress(id, totalModules, transformedModules);
|
|
939
|
+
break;
|
|
940
|
+
case "watch_change":
|
|
941
|
+
this.flags |= ProgressFlags.FILE_CHANGED;
|
|
942
|
+
break;
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
};
|
|
946
|
+
var CompatStatusReporter = class {
|
|
947
|
+
update(event) {
|
|
948
|
+
switch (event.type) {
|
|
949
|
+
case "bundle_build_started":
|
|
950
|
+
logger$1.info("Build started...");
|
|
951
|
+
break;
|
|
952
|
+
case "bundle_build_failed":
|
|
953
|
+
logger$1.error(`Build failed`);
|
|
954
|
+
break;
|
|
955
|
+
case "bundle_build_done":
|
|
956
|
+
const { duration, totalModules } = event;
|
|
957
|
+
const time = chalk.blue(`${duration.toFixed(2)}ms`);
|
|
958
|
+
const modules = chalk.blue(`(${totalModules} modules)`);
|
|
959
|
+
logger$1.info(`Build completed in ${time} ${modules}`);
|
|
960
|
+
break;
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
};
|
|
964
|
+
|
|
965
|
+
//#endregion
|
|
966
|
+
//#region src/config/defaults.ts
|
|
967
|
+
function getDefaultConfig(projectRoot, mode) {
|
|
968
|
+
let reactNativePath;
|
|
969
|
+
try {
|
|
970
|
+
reactNativePath = process.env.ROLLIPOP_REACT_NATIVE_PATH ?? resolvePackagePath(projectRoot, "react-native");
|
|
971
|
+
} catch {
|
|
972
|
+
throw new Error(`Could not resolve 'react-native' package path. Please check your project path.`);
|
|
973
|
+
}
|
|
974
|
+
return {
|
|
975
|
+
root: projectRoot,
|
|
976
|
+
mode: mode ?? "development",
|
|
977
|
+
entry: "index.js",
|
|
978
|
+
resolver: {
|
|
979
|
+
sourceExtensions: DEFAULT_SOURCE_EXTENSIONS,
|
|
980
|
+
assetExtensions: DEFAULT_ASSET_EXTENSIONS,
|
|
981
|
+
mainFields: DEFAULT_RESOLVER_MAIN_FIELDS,
|
|
982
|
+
conditionNames: DEFAULT_RESOLVER_CONDITION_NAMES,
|
|
983
|
+
preferNativePlatform: true,
|
|
984
|
+
symlinks: true
|
|
985
|
+
},
|
|
986
|
+
transformer: {
|
|
987
|
+
svg: true,
|
|
988
|
+
flow: { filter: {
|
|
989
|
+
id: /\.jsx?$/,
|
|
990
|
+
code: /@flow/
|
|
991
|
+
} }
|
|
992
|
+
},
|
|
993
|
+
serializer: {
|
|
994
|
+
prelude: [getInitializeCorePath(projectRoot)],
|
|
995
|
+
polyfills: getPolyfillScriptPaths(reactNativePath).map((path) => ({
|
|
996
|
+
type: "iife",
|
|
997
|
+
code: generateSourceFromAst(stripFlowSyntax(fs.readFileSync(path, "utf-8")), path).code
|
|
998
|
+
}))
|
|
999
|
+
},
|
|
1000
|
+
watcher: {
|
|
1001
|
+
skipWrite: true,
|
|
1002
|
+
useDebounce: true,
|
|
1003
|
+
debounceDuration: 50
|
|
1004
|
+
},
|
|
1005
|
+
optimization: { treeshake: true },
|
|
1006
|
+
reactNative: {
|
|
1007
|
+
reactNativePath,
|
|
1008
|
+
codegen: { filter: { code: /\bcodegenNativeComponent</ } },
|
|
1009
|
+
assetRegistryPath: DEFAULT_ASSET_REGISTRY_PATH,
|
|
1010
|
+
globalIdentifiers: DEFAULT_REACT_NATIVE_GLOBAL_IDENTIFIERS
|
|
1011
|
+
},
|
|
1012
|
+
devMode: { hmr: true },
|
|
1013
|
+
reporter: new ClientLogReporter(),
|
|
1014
|
+
terminal: { status: (() => {
|
|
1015
|
+
if (isDebugEnabled()) return "compat";
|
|
1016
|
+
if (process.stderr.isTTY) return "progress";
|
|
1017
|
+
return "compat";
|
|
1018
|
+
})() },
|
|
1019
|
+
envDir: projectRoot,
|
|
1020
|
+
envPrefix: DEFAULT_ENV_PREFIX
|
|
1021
|
+
};
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
//#endregion
|
|
1025
|
+
//#region src/core/plugins/context.ts
|
|
1026
|
+
const pluginLogger = new Logger();
|
|
1027
|
+
function createPluginContext(name) {
|
|
1028
|
+
return {
|
|
1029
|
+
debug: (log) => {
|
|
1030
|
+
printPluginLog("debug", log, name);
|
|
1031
|
+
},
|
|
1032
|
+
info: (log) => {
|
|
1033
|
+
printPluginLog("info", log, name);
|
|
1034
|
+
},
|
|
1035
|
+
warn: (log) => {
|
|
1036
|
+
printPluginLog("warn", log, name);
|
|
1037
|
+
}
|
|
1038
|
+
};
|
|
1039
|
+
}
|
|
1040
|
+
function printPluginLog(level, log, pluginName = "unknown") {
|
|
1041
|
+
const pluginLabel = chalk.magenta(`plugin:${pluginName}`);
|
|
1042
|
+
if (typeof log === "string") pluginLogger[level](pluginLabel, log);
|
|
1043
|
+
else pluginLogger[level](pluginLabel, log.stack ?? log.message);
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
//#endregion
|
|
1047
|
+
//#region src/config/merge-config.ts
|
|
1048
|
+
function mergeConfig(baseConfig, ...overrideConfigs) {
|
|
1049
|
+
let mergedConfig = baseConfig;
|
|
1050
|
+
for (const overrideConfig of overrideConfigs) mergedConfig = mergeWith(mergedConfig, overrideConfig, (target, source, key) => {
|
|
1051
|
+
if ([
|
|
1052
|
+
"sourceExtensions",
|
|
1053
|
+
"assetExtensions",
|
|
1054
|
+
"polyfills",
|
|
1055
|
+
"prelude",
|
|
1056
|
+
"plugins"
|
|
1057
|
+
].includes(key)) return Array.from(new Set([...target ?? [], ...source ?? []]));
|
|
1058
|
+
if (key === "reporter") return source ?? target;
|
|
1059
|
+
});
|
|
1060
|
+
return mergedConfig;
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
//#endregion
|
|
1064
|
+
//#region src/config/load-config.ts
|
|
1065
|
+
const CONFIG_FILE_NAME = "rollipop";
|
|
1066
|
+
async function loadConfig(options = {}) {
|
|
1067
|
+
const { cwd = process.cwd(), configFile, mode, context = {} } = options;
|
|
1068
|
+
const defaultConfig = getDefaultConfig(cwd, mode);
|
|
1069
|
+
const commonOptions = {
|
|
1070
|
+
context: {
|
|
1071
|
+
...context,
|
|
1072
|
+
defaultConfig
|
|
1073
|
+
},
|
|
1074
|
+
rcFile: false
|
|
1075
|
+
};
|
|
1076
|
+
const { config: userConfig } = await c12.loadConfig(configFile ? {
|
|
1077
|
+
configFile: path.resolve(cwd, configFile),
|
|
1078
|
+
configFileRequired: true
|
|
1079
|
+
} : {
|
|
1080
|
+
cwd,
|
|
1081
|
+
defaultConfig,
|
|
1082
|
+
name: CONFIG_FILE_NAME,
|
|
1083
|
+
...commonOptions
|
|
1084
|
+
});
|
|
1085
|
+
const plugins = await flattenPluginOption(userConfig.plugins);
|
|
1086
|
+
const pluginConfig = await resolvePluginConfig(userConfig, plugins);
|
|
1087
|
+
const resolvedConfig = mergeConfig(defaultConfig, ...[{
|
|
1088
|
+
...userConfig,
|
|
1089
|
+
plugins
|
|
1090
|
+
}, pluginConfig]);
|
|
1091
|
+
await invokeConfigResolved(resolvedConfig, plugins);
|
|
1092
|
+
return resolvedConfig;
|
|
1093
|
+
}
|
|
1094
|
+
async function flattenPluginOption(pluginOption) {
|
|
1095
|
+
const awaitedPluginOption = await pluginOption;
|
|
1096
|
+
if (Array.isArray(awaitedPluginOption)) return (await Promise.all(awaitedPluginOption.map(flattenPluginOption))).flat();
|
|
1097
|
+
if (awaitedPluginOption == null || awaitedPluginOption === false) return [];
|
|
1098
|
+
return [awaitedPluginOption];
|
|
1099
|
+
}
|
|
1100
|
+
async function resolvePluginConfig(baseConfig, plugins) {
|
|
1101
|
+
let mergedConfig = omit(baseConfig, ["plugins", "dangerously_overrideRolldownOptions"]);
|
|
1102
|
+
for (const plugin of plugins) {
|
|
1103
|
+
const context = createPluginContext(plugin.name);
|
|
1104
|
+
if (typeof plugin.config === "function") {
|
|
1105
|
+
const config = await plugin.config.call(context, mergedConfig);
|
|
1106
|
+
if (config != null) mergedConfig = mergeConfig(mergedConfig, config);
|
|
1107
|
+
} else if (typeof plugin.config === "object") mergedConfig = mergeConfig(mergedConfig, plugin.config);
|
|
1108
|
+
}
|
|
1109
|
+
return mergedConfig;
|
|
1110
|
+
}
|
|
1111
|
+
async function invokeConfigResolved(config, plugins) {
|
|
1112
|
+
await Promise.all(plugins.map((plugin) => {
|
|
1113
|
+
const context = createPluginContext(plugin.name);
|
|
1114
|
+
return plugin.configResolved?.call(context, config);
|
|
1115
|
+
}));
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
//#endregion
|
|
1119
|
+
//#region src/core/cache/file-system-cache.ts
|
|
1120
|
+
var FileSystemCache = class FileSystemCache {
|
|
1121
|
+
pendingData = /* @__PURE__ */ new Map();
|
|
1122
|
+
cacheDirectory;
|
|
1123
|
+
static getCacheDirectory(projectRoot) {
|
|
1124
|
+
return path.join(getSharedDataPath(projectRoot), "cache");
|
|
1125
|
+
}
|
|
1126
|
+
static clearAll(projectRoot) {
|
|
1127
|
+
fs.rmSync(FileSystemCache.getCacheDirectory(projectRoot), {
|
|
1128
|
+
recursive: true,
|
|
1129
|
+
force: true
|
|
1130
|
+
});
|
|
1131
|
+
}
|
|
1132
|
+
constructor(projectRoot, id) {
|
|
1133
|
+
this.cacheDirectory = path.join(FileSystemCache.getCacheDirectory(projectRoot), id);
|
|
1134
|
+
this.ensureCacheDirectory(this.cacheDirectory);
|
|
1135
|
+
logger$1.debug("cache directory:", this.cacheDirectory);
|
|
1136
|
+
}
|
|
1137
|
+
ensureCacheDirectory(cacheDirectory) {
|
|
1138
|
+
if (!fs.existsSync(cacheDirectory)) fs.mkdirSync(cacheDirectory, { recursive: true });
|
|
1139
|
+
}
|
|
1140
|
+
get(key) {
|
|
1141
|
+
try {
|
|
1142
|
+
return fs.readFileSync(path.join(this.cacheDirectory, key), "utf-8");
|
|
1143
|
+
} catch {
|
|
1144
|
+
return;
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
set(key, value) {
|
|
1148
|
+
this.pendingData.set(key, value);
|
|
1149
|
+
}
|
|
1150
|
+
async flush() {
|
|
1151
|
+
const limit = pLimit(process.env.ROLLIPOP_CACHE_FLUSH_LIMIT ? parseInt(process.env.ROLLIPOP_CACHE_FLUSH_LIMIT) : 20);
|
|
1152
|
+
const entries = Array.from(this.pendingData.entries());
|
|
1153
|
+
await Promise.all(entries.map(([key, value]) => limit(async () => {
|
|
1154
|
+
try {
|
|
1155
|
+
await fs.promises.writeFile(path.join(this.cacheDirectory, key), value);
|
|
1156
|
+
} catch (error) {
|
|
1157
|
+
logger$1.error("Failed to write cache file", key);
|
|
1158
|
+
logger$1.debug(error);
|
|
1159
|
+
}
|
|
1160
|
+
}))).catch((error) => {
|
|
1161
|
+
logger$1.error("Failed to flush cache", error);
|
|
1162
|
+
});
|
|
1163
|
+
this.pendingData.clear();
|
|
1164
|
+
}
|
|
1165
|
+
clear() {
|
|
1166
|
+
fs.rmSync(this.cacheDirectory, {
|
|
1167
|
+
recursive: true,
|
|
1168
|
+
force: true
|
|
1169
|
+
});
|
|
1170
|
+
this.ensureCacheDirectory(this.cacheDirectory);
|
|
1171
|
+
}
|
|
1172
|
+
};
|
|
1173
|
+
|
|
1174
|
+
//#endregion
|
|
1175
|
+
//#region src/utils/reset-cache.ts
|
|
1176
|
+
function resetCache(projectRoot) {
|
|
1177
|
+
FileSystemCache.clearAll(projectRoot);
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
//#endregion
|
|
1181
|
+
//#region src/utils/build-options.ts
|
|
1182
|
+
const DEFAULT_BUILD_OPTIONS = {
|
|
1183
|
+
cache: true,
|
|
1184
|
+
minify: false
|
|
1185
|
+
};
|
|
1186
|
+
function resolveBuildOptions(config, buildOptions) {
|
|
1187
|
+
if (buildOptions.outfile) buildOptions.outfile = path.resolve(config.root, buildOptions.outfile);
|
|
1188
|
+
if ((buildOptions.sourcemap === true || buildOptions.sourcemap === "hidden") && buildOptions.sourcemapOutfile) buildOptions.sourcemapOutfile = path.resolve(config.root, buildOptions.sourcemapOutfile);
|
|
1189
|
+
return merge(DEFAULT_BUILD_OPTIONS, {
|
|
1190
|
+
...buildOptions,
|
|
1191
|
+
dev: buildOptions.dev ?? config.mode === "development"
|
|
1192
|
+
});
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
//#endregion
|
|
1196
|
+
//#region src/utils/hash.ts
|
|
1197
|
+
function xxhash(data) {
|
|
1198
|
+
return xxh32(data).toString(16);
|
|
1199
|
+
}
|
|
1200
|
+
function md5(data) {
|
|
1201
|
+
return crypto.createHash("md5").update(data).digest("hex");
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
//#endregion
|
|
1205
|
+
//#region src/utils/serialize.ts
|
|
1206
|
+
function serialize(value) {
|
|
1207
|
+
return JSON.stringify(value, (_, value) => {
|
|
1208
|
+
if (typeof value === "function") return value.toString();
|
|
1209
|
+
if (value instanceof RegExp) return value.toString();
|
|
1210
|
+
return value;
|
|
1211
|
+
});
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
//#endregion
|
|
1215
|
+
//#region src/utils/id.ts
|
|
1216
|
+
function createId(config, buildOptions) {
|
|
1217
|
+
return md5(serialize([
|
|
1218
|
+
ROLLIPOP_VERSION,
|
|
1219
|
+
filterTransformAffectedOptions(buildOptions),
|
|
1220
|
+
filterTransformAffectedConfig(config)
|
|
1221
|
+
]));
|
|
1222
|
+
}
|
|
1223
|
+
function filterTransformAffectedOptions(buildOptions) {
|
|
1224
|
+
return pick(buildOptions, ["platform", "dev"]);
|
|
1225
|
+
}
|
|
1226
|
+
function filterTransformAffectedConfig(config) {
|
|
1227
|
+
const { transformer, serializer, reactNative, devMode, plugins = [] } = config;
|
|
1228
|
+
return [
|
|
1229
|
+
transformer,
|
|
1230
|
+
serializer.polyfills,
|
|
1231
|
+
serializer.prelude,
|
|
1232
|
+
reactNative.assetRegistryPath,
|
|
1233
|
+
devMode,
|
|
1234
|
+
plugins.map((plugin, index) => `${plugin.name}#${index}`)
|
|
1235
|
+
];
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
//#endregion
|
|
1239
|
+
//#region src/core/fs/storage.ts
|
|
1240
|
+
const DEFAULT_DATA = { build: {} };
|
|
1241
|
+
var FileStorage = class FileStorage {
|
|
1242
|
+
static instance = null;
|
|
1243
|
+
dataFilePath;
|
|
1244
|
+
data;
|
|
1245
|
+
static getInstance(basePath) {
|
|
1246
|
+
if (FileStorage.instance == null) FileStorage.instance = new FileStorage(basePath);
|
|
1247
|
+
return new FileStorage(basePath);
|
|
1202
1248
|
}
|
|
1203
|
-
|
|
1204
|
-
this.
|
|
1249
|
+
constructor(basePath) {
|
|
1250
|
+
this.basePath = basePath;
|
|
1251
|
+
this.dataFilePath = path.join(getSharedDataPath(basePath), "rollipop.json");
|
|
1252
|
+
if (fs.existsSync(this.dataFilePath)) this.data = JSON.parse(fs.readFileSync(this.dataFilePath, "utf-8"));
|
|
1253
|
+
else this.data = DEFAULT_DATA;
|
|
1205
1254
|
}
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
this._render();
|
|
1209
|
-
this.streamManager.done();
|
|
1210
|
-
console.log();
|
|
1211
|
-
}
|
|
1255
|
+
get() {
|
|
1256
|
+
return this.data;
|
|
1212
1257
|
}
|
|
1213
|
-
|
|
1214
|
-
this.
|
|
1258
|
+
set(data) {
|
|
1259
|
+
this.data = merge(this.data, data);
|
|
1260
|
+
fs.writeFileSync(this.dataFilePath, JSON.stringify(this.data, null, 2));
|
|
1215
1261
|
}
|
|
1216
1262
|
};
|
|
1217
1263
|
|
|
1218
1264
|
//#endregion
|
|
1219
|
-
//#region src/
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
ProgressFlags$1[ProgressFlags$1["BUILD_IN_PROGRESS"] = 1] = "BUILD_IN_PROGRESS";
|
|
1223
|
-
ProgressFlags$1[ProgressFlags$1["FILE_CHANGED"] = 2] = "FILE_CHANGED";
|
|
1224
|
-
return ProgressFlags$1;
|
|
1225
|
-
}(ProgressFlags || {});
|
|
1226
|
-
function none(reporter) {
|
|
1227
|
-
return withReporter(reporter);
|
|
1265
|
+
//#region src/utils/string.ts
|
|
1266
|
+
function indent(text, indent, space = " ") {
|
|
1267
|
+
return text.replace(/^/gm, space.repeat(indent));
|
|
1228
1268
|
}
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
onEnd({ totalModules, duration, error }) {
|
|
1235
|
-
const time = chalk.blue(`${duration.toFixed(2)}ms`);
|
|
1236
|
-
const modules = chalk.blue(`(${totalModules} modules)`);
|
|
1237
|
-
if (error) logger$1.error(`Build failed in ${time} ${modules}`);
|
|
1238
|
-
else logger$1.info(`Build completed in ${time} ${modules}`);
|
|
1239
|
-
}
|
|
1240
|
-
});
|
|
1269
|
+
|
|
1270
|
+
//#endregion
|
|
1271
|
+
//#region src/common/code.ts
|
|
1272
|
+
function asLiteral(value) {
|
|
1273
|
+
return JSON.stringify(value);
|
|
1241
1274
|
}
|
|
1242
|
-
function
|
|
1243
|
-
|
|
1244
|
-
const initialTotalModules = getBuildTotalModules(context.storage, context.id);
|
|
1245
|
-
const renderManager = ProgressBarRenderManager.getInstance();
|
|
1246
|
-
const progressBar$1 = renderManager.register(context.id, {
|
|
1247
|
-
label,
|
|
1248
|
-
total: initialTotalModules
|
|
1249
|
-
});
|
|
1250
|
-
const renderProgress = (id$1, totalModules, transformedModules) => {
|
|
1251
|
-
if (totalModules != null) progressBar$1.setTotal(totalModules);
|
|
1252
|
-
progressBar$1.setCurrent(transformedModules).setModuleId(id$1);
|
|
1253
|
-
renderManager.render();
|
|
1254
|
-
};
|
|
1255
|
-
return withReporter(reporter, {
|
|
1256
|
-
initialTotalModules,
|
|
1257
|
-
onStart() {
|
|
1258
|
-
flags |= ProgressFlags.BUILD_IN_PROGRESS;
|
|
1259
|
-
progressBar$1.start();
|
|
1260
|
-
renderManager.start();
|
|
1261
|
-
},
|
|
1262
|
-
onEnd({ error, duration, totalModules }) {
|
|
1263
|
-
flags = ProgressFlags.NONE;
|
|
1264
|
-
progressBar$1.setTotal(totalModules).complete(duration, Boolean(error));
|
|
1265
|
-
renderManager.release();
|
|
1266
|
-
setBuildTotalModules(context.storage, context.id, totalModules);
|
|
1267
|
-
},
|
|
1268
|
-
onTransform({ id: id$1, totalModules, transformedModules }) {
|
|
1269
|
-
if (flags & ProgressFlags.FILE_CHANGED) {
|
|
1270
|
-
logger$1.debug("Transformed changed file", { id: id$1 });
|
|
1271
|
-
return;
|
|
1272
|
-
}
|
|
1273
|
-
renderProgress(id$1, totalModules, transformedModules);
|
|
1274
|
-
},
|
|
1275
|
-
onWatchChange() {
|
|
1276
|
-
flags |= ProgressFlags.FILE_CHANGED;
|
|
1277
|
-
}
|
|
1278
|
-
});
|
|
1275
|
+
function asIdentifier(name) {
|
|
1276
|
+
return name;
|
|
1279
1277
|
}
|
|
1280
|
-
function
|
|
1281
|
-
return
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
});
|
|
1292
|
-
else reporter.update({ type: "bundle_build_done" });
|
|
1293
|
-
statusPluginOptions?.onEnd?.(result);
|
|
1294
|
-
},
|
|
1295
|
-
onTransform(result) {
|
|
1296
|
-
reporter.update({
|
|
1297
|
-
type: "transform",
|
|
1298
|
-
...result
|
|
1299
|
-
});
|
|
1300
|
-
statusPluginOptions?.onTransform?.(result);
|
|
1301
|
-
},
|
|
1302
|
-
onWatchChange(id$1) {
|
|
1303
|
-
reporter.update({
|
|
1304
|
-
type: "watch_change",
|
|
1305
|
-
id: id$1
|
|
1306
|
-
});
|
|
1307
|
-
statusPluginOptions?.onWatchChange?.(id$1);
|
|
1308
|
-
}
|
|
1309
|
-
};
|
|
1278
|
+
function nodeEnvironment(dev) {
|
|
1279
|
+
return dev ? "development" : "production";
|
|
1280
|
+
}
|
|
1281
|
+
function iife(body, path = "<unknown>") {
|
|
1282
|
+
const bodyPlaceholder = "__BODY__";
|
|
1283
|
+
return dedent`
|
|
1284
|
+
// ${path}
|
|
1285
|
+
(function (global) {
|
|
1286
|
+
${bodyPlaceholder}
|
|
1287
|
+
})(${GLOBAL_IDENTIFIER});
|
|
1288
|
+
`.replace(bodyPlaceholder, indent(body, 1));
|
|
1310
1289
|
}
|
|
1311
|
-
const statusPresets = {
|
|
1312
|
-
none,
|
|
1313
|
-
compat,
|
|
1314
|
-
progressBar
|
|
1315
|
-
};
|
|
1316
1290
|
|
|
1317
1291
|
//#endregion
|
|
1318
1292
|
//#region src/utils/config.ts
|
|
@@ -1336,7 +1310,7 @@ function bindReporter(config, eventSource) {
|
|
|
1336
1310
|
eventSource.emit("watchChange", event.id);
|
|
1337
1311
|
break;
|
|
1338
1312
|
}
|
|
1339
|
-
originalReporter
|
|
1313
|
+
originalReporter?.update(event);
|
|
1340
1314
|
} };
|
|
1341
1315
|
return config;
|
|
1342
1316
|
}
|
|
@@ -1371,6 +1345,12 @@ function getBaseUrl(host, port, https) {
|
|
|
1371
1345
|
return `${https ? "https" : "http"}://${host}:${port}`;
|
|
1372
1346
|
}
|
|
1373
1347
|
|
|
1348
|
+
//#endregion
|
|
1349
|
+
//#region src/utils/storage.ts
|
|
1350
|
+
function getBuildTotalModules(storage, id) {
|
|
1351
|
+
return storage.get().build[id]?.totalModules ?? 0;
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1374
1354
|
//#endregion
|
|
1375
1355
|
//#region src/core/env.ts
|
|
1376
1356
|
function loadEnv(options) {
|
|
@@ -1400,30 +1380,6 @@ function loadEnv(options) {
|
|
|
1400
1380
|
return env;
|
|
1401
1381
|
}
|
|
1402
1382
|
|
|
1403
|
-
//#endregion
|
|
1404
|
-
//#region node_modules/mitt/dist/mitt.mjs
|
|
1405
|
-
function mitt_default(n) {
|
|
1406
|
-
return {
|
|
1407
|
-
all: n = n || /* @__PURE__ */ new Map(),
|
|
1408
|
-
on: function(t, e) {
|
|
1409
|
-
var i = n.get(t);
|
|
1410
|
-
i ? i.push(e) : n.set(t, [e]);
|
|
1411
|
-
},
|
|
1412
|
-
off: function(t, e) {
|
|
1413
|
-
var i = n.get(t);
|
|
1414
|
-
i && (e ? i.splice(i.indexOf(e) >>> 0, 1) : n.set(t, []));
|
|
1415
|
-
},
|
|
1416
|
-
emit: function(t, e) {
|
|
1417
|
-
var i = n.get(t);
|
|
1418
|
-
i && i.slice().map(function(n$1) {
|
|
1419
|
-
n$1(e);
|
|
1420
|
-
}), (i = n.get("*")) && i.slice().map(function(n$1) {
|
|
1421
|
-
n$1(t, e);
|
|
1422
|
-
});
|
|
1423
|
-
}
|
|
1424
|
-
};
|
|
1425
|
-
}
|
|
1426
|
-
|
|
1427
1383
|
//#endregion
|
|
1428
1384
|
//#region src/server/logger.ts
|
|
1429
1385
|
const logger = new Logger("dev-server");
|
|
@@ -1473,12 +1429,12 @@ async function assertDevServerStatus(options) {
|
|
|
1473
1429
|
}
|
|
1474
1430
|
if (shouldExit) process.exit(1);
|
|
1475
1431
|
}
|
|
1476
|
-
var DevServerStatus = /* @__PURE__ */ function(DevServerStatus
|
|
1477
|
-
DevServerStatus
|
|
1478
|
-
DevServerStatus
|
|
1479
|
-
DevServerStatus
|
|
1480
|
-
DevServerStatus
|
|
1481
|
-
return DevServerStatus
|
|
1432
|
+
var DevServerStatus = /* @__PURE__ */ function(DevServerStatus) {
|
|
1433
|
+
DevServerStatus[DevServerStatus["NOT_RUNNING"] = 0] = "NOT_RUNNING";
|
|
1434
|
+
DevServerStatus[DevServerStatus["MATCHED_SERVER_RUNNING"] = 1] = "MATCHED_SERVER_RUNNING";
|
|
1435
|
+
DevServerStatus[DevServerStatus["PORT_TAKEN"] = 2] = "PORT_TAKEN";
|
|
1436
|
+
DevServerStatus[DevServerStatus["UNKNOWN"] = 3] = "UNKNOWN";
|
|
1437
|
+
return DevServerStatus;
|
|
1482
1438
|
}(DevServerStatus || {});
|
|
1483
1439
|
async function getDevServerStatus(devServerUrl, projectRoot) {
|
|
1484
1440
|
const { hostname, port } = new URL(devServerUrl);
|
|
@@ -1609,9 +1565,9 @@ var BundlerDevEngine = class extends EventEmitter {
|
|
|
1609
1565
|
}
|
|
1610
1566
|
get sourceMappingURL() {
|
|
1611
1567
|
const { host, port } = this.options.server;
|
|
1612
|
-
const { platform, dev
|
|
1568
|
+
const { platform, dev } = this.buildOptions;
|
|
1613
1569
|
const [name] = this.config.entry.split(".");
|
|
1614
|
-
return `http://${host}:${port}/${name}.bundle.map?platform=${platform}&dev=${dev
|
|
1570
|
+
return `http://${host}:${port}/${name}.bundle.map?platform=${platform}&dev=${dev}`;
|
|
1615
1571
|
}
|
|
1616
1572
|
async initialize() {
|
|
1617
1573
|
if (this._state !== "idle" || this._devEngine != null) return this;
|
|
@@ -1692,10 +1648,10 @@ var BundlerPool = class BundlerPool {
|
|
|
1692
1648
|
bundleName,
|
|
1693
1649
|
key
|
|
1694
1650
|
});
|
|
1695
|
-
const instance
|
|
1651
|
+
const instance = new BundlerDevEngine({ server: this.resolvedServerOptions }, this.config, buildOptions);
|
|
1696
1652
|
logger.debug("Setting new bundler instance", { key });
|
|
1697
|
-
BundlerPool.instances.set(key, instance
|
|
1698
|
-
return instance
|
|
1653
|
+
BundlerPool.instances.set(key, instance);
|
|
1654
|
+
return instance;
|
|
1699
1655
|
}
|
|
1700
1656
|
}
|
|
1701
1657
|
};
|
|
@@ -1745,9 +1701,9 @@ const plugin$2 = fp((fastify, options) => {
|
|
|
1745
1701
|
fastify.get(`/${DEV_SERVER_ASSET_PATH}/*`, {
|
|
1746
1702
|
schema: { querystring: queryParamSchema },
|
|
1747
1703
|
async handler(request, reply) {
|
|
1748
|
-
const { url
|
|
1749
|
-
const { pathname } = new URL(url
|
|
1750
|
-
const assetPath = resolveAsset(pathname.replace(
|
|
1704
|
+
const { url, query } = request;
|
|
1705
|
+
const { pathname } = new URL(url, baseUrl);
|
|
1706
|
+
const assetPath = resolveAsset(pathname.replace(new RegExp(`^/${DEV_SERVER_ASSET_PATH}/?`), ""));
|
|
1751
1707
|
let handle = null;
|
|
1752
1708
|
try {
|
|
1753
1709
|
handle = await fs.promises.open(resolveAssetPath(assetPath, {
|
|
@@ -1942,1394 +1898,30 @@ const plugin$1 = fp((fastify, options) => {
|
|
|
1942
1898
|
}, { name: "serve-bundle" });
|
|
1943
1899
|
|
|
1944
1900
|
//#endregion
|
|
1945
|
-
//#region
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
let formatter = (open, close, replace = open) => (input) => {
|
|
1950
|
-
let string = "" + input, index = string.indexOf(close, open.length);
|
|
1951
|
-
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
1952
|
-
};
|
|
1953
|
-
let replaceClose = (string, close, replace, index) => {
|
|
1954
|
-
let result = "", cursor = 0;
|
|
1955
|
-
do {
|
|
1956
|
-
result += string.substring(cursor, index) + replace;
|
|
1957
|
-
cursor = index + close.length;
|
|
1958
|
-
index = string.indexOf(close, cursor);
|
|
1959
|
-
} while (~index);
|
|
1960
|
-
return result + string.substring(cursor);
|
|
1961
|
-
};
|
|
1962
|
-
let createColors = (enabled = isColorSupported) => {
|
|
1963
|
-
let f = enabled ? formatter : () => String;
|
|
1901
|
+
//#region src/utils/url.ts
|
|
1902
|
+
function parseUrl(value) {
|
|
1903
|
+
if (value.startsWith("/")) {
|
|
1904
|
+
const [pathname, query] = value.split("?");
|
|
1964
1905
|
return {
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
1968
|
-
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
1969
|
-
italic: f("\x1B[3m", "\x1B[23m"),
|
|
1970
|
-
underline: f("\x1B[4m", "\x1B[24m"),
|
|
1971
|
-
inverse: f("\x1B[7m", "\x1B[27m"),
|
|
1972
|
-
hidden: f("\x1B[8m", "\x1B[28m"),
|
|
1973
|
-
strikethrough: f("\x1B[9m", "\x1B[29m"),
|
|
1974
|
-
black: f("\x1B[30m", "\x1B[39m"),
|
|
1975
|
-
red: f("\x1B[31m", "\x1B[39m"),
|
|
1976
|
-
green: f("\x1B[32m", "\x1B[39m"),
|
|
1977
|
-
yellow: f("\x1B[33m", "\x1B[39m"),
|
|
1978
|
-
blue: f("\x1B[34m", "\x1B[39m"),
|
|
1979
|
-
magenta: f("\x1B[35m", "\x1B[39m"),
|
|
1980
|
-
cyan: f("\x1B[36m", "\x1B[39m"),
|
|
1981
|
-
white: f("\x1B[37m", "\x1B[39m"),
|
|
1982
|
-
gray: f("\x1B[90m", "\x1B[39m"),
|
|
1983
|
-
bgBlack: f("\x1B[40m", "\x1B[49m"),
|
|
1984
|
-
bgRed: f("\x1B[41m", "\x1B[49m"),
|
|
1985
|
-
bgGreen: f("\x1B[42m", "\x1B[49m"),
|
|
1986
|
-
bgYellow: f("\x1B[43m", "\x1B[49m"),
|
|
1987
|
-
bgBlue: f("\x1B[44m", "\x1B[49m"),
|
|
1988
|
-
bgMagenta: f("\x1B[45m", "\x1B[49m"),
|
|
1989
|
-
bgCyan: f("\x1B[46m", "\x1B[49m"),
|
|
1990
|
-
bgWhite: f("\x1B[47m", "\x1B[49m"),
|
|
1991
|
-
blackBright: f("\x1B[90m", "\x1B[39m"),
|
|
1992
|
-
redBright: f("\x1B[91m", "\x1B[39m"),
|
|
1993
|
-
greenBright: f("\x1B[92m", "\x1B[39m"),
|
|
1994
|
-
yellowBright: f("\x1B[93m", "\x1B[39m"),
|
|
1995
|
-
blueBright: f("\x1B[94m", "\x1B[39m"),
|
|
1996
|
-
magentaBright: f("\x1B[95m", "\x1B[39m"),
|
|
1997
|
-
cyanBright: f("\x1B[96m", "\x1B[39m"),
|
|
1998
|
-
whiteBright: f("\x1B[97m", "\x1B[39m"),
|
|
1999
|
-
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
|
|
2000
|
-
bgRedBright: f("\x1B[101m", "\x1B[49m"),
|
|
2001
|
-
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
|
|
2002
|
-
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
|
|
2003
|
-
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
|
|
2004
|
-
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
|
|
2005
|
-
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
|
|
2006
|
-
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
2007
|
-
};
|
|
2008
|
-
};
|
|
2009
|
-
module.exports = createColors();
|
|
2010
|
-
module.exports.createColors = createColors;
|
|
2011
|
-
}));
|
|
2012
|
-
|
|
2013
|
-
//#endregion
|
|
2014
|
-
//#region node_modules/js-tokens/index.js
|
|
2015
|
-
var require_js_tokens = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2016
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2017
|
-
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;
|
|
2018
|
-
exports.matchToToken = function(match) {
|
|
2019
|
-
var token = {
|
|
2020
|
-
type: "invalid",
|
|
2021
|
-
value: match[0],
|
|
2022
|
-
closed: void 0
|
|
1906
|
+
pathname,
|
|
1907
|
+
query: query ? toQueryObject(new URLSearchParams(query)) : {}
|
|
2023
1908
|
};
|
|
2024
|
-
if (match[1]) token.type = "string", token.closed = !!(match[3] || match[4]);
|
|
2025
|
-
else if (match[5]) token.type = "comment";
|
|
2026
|
-
else if (match[6]) token.type = "comment", token.closed = !!match[7];
|
|
2027
|
-
else if (match[8]) token.type = "regex";
|
|
2028
|
-
else if (match[9]) token.type = "number";
|
|
2029
|
-
else if (match[10]) token.type = "name";
|
|
2030
|
-
else if (match[11]) token.type = "punctuator";
|
|
2031
|
-
else if (match[12]) token.type = "whitespace";
|
|
2032
|
-
return token;
|
|
2033
|
-
};
|
|
2034
|
-
}));
|
|
2035
|
-
|
|
2036
|
-
//#endregion
|
|
2037
|
-
//#region node_modules/@babel/helper-validator-identifier/lib/identifier.js
|
|
2038
|
-
var require_identifier = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2039
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2040
|
-
exports.isIdentifierChar = isIdentifierChar;
|
|
2041
|
-
exports.isIdentifierName = isIdentifierName;
|
|
2042
|
-
exports.isIdentifierStart = isIdentifierStart;
|
|
2043
|
-
let nonASCIIidentifierStartChars = "ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽ-ೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-Ა-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ--ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ";
|
|
2044
|
-
let nonASCIIidentifierChars = "·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ--ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・";
|
|
2045
|
-
const nonASCIIidentifierStart = /* @__PURE__ */ new RegExp("[" + nonASCIIidentifierStartChars + "]");
|
|
2046
|
-
const nonASCIIidentifier = /* @__PURE__ */ new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
|
|
2047
|
-
nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
|
|
2048
|
-
const astralIdentifierStartCodes = [
|
|
2049
|
-
0,
|
|
2050
|
-
11,
|
|
2051
|
-
2,
|
|
2052
|
-
25,
|
|
2053
|
-
2,
|
|
2054
|
-
18,
|
|
2055
|
-
2,
|
|
2056
|
-
1,
|
|
2057
|
-
2,
|
|
2058
|
-
14,
|
|
2059
|
-
3,
|
|
2060
|
-
13,
|
|
2061
|
-
35,
|
|
2062
|
-
122,
|
|
2063
|
-
70,
|
|
2064
|
-
52,
|
|
2065
|
-
268,
|
|
2066
|
-
28,
|
|
2067
|
-
4,
|
|
2068
|
-
48,
|
|
2069
|
-
48,
|
|
2070
|
-
31,
|
|
2071
|
-
14,
|
|
2072
|
-
29,
|
|
2073
|
-
6,
|
|
2074
|
-
37,
|
|
2075
|
-
11,
|
|
2076
|
-
29,
|
|
2077
|
-
3,
|
|
2078
|
-
35,
|
|
2079
|
-
5,
|
|
2080
|
-
7,
|
|
2081
|
-
2,
|
|
2082
|
-
4,
|
|
2083
|
-
43,
|
|
2084
|
-
157,
|
|
2085
|
-
19,
|
|
2086
|
-
35,
|
|
2087
|
-
5,
|
|
2088
|
-
35,
|
|
2089
|
-
5,
|
|
2090
|
-
39,
|
|
2091
|
-
9,
|
|
2092
|
-
51,
|
|
2093
|
-
13,
|
|
2094
|
-
10,
|
|
2095
|
-
2,
|
|
2096
|
-
14,
|
|
2097
|
-
2,
|
|
2098
|
-
6,
|
|
2099
|
-
2,
|
|
2100
|
-
1,
|
|
2101
|
-
2,
|
|
2102
|
-
10,
|
|
2103
|
-
2,
|
|
2104
|
-
14,
|
|
2105
|
-
2,
|
|
2106
|
-
6,
|
|
2107
|
-
2,
|
|
2108
|
-
1,
|
|
2109
|
-
4,
|
|
2110
|
-
51,
|
|
2111
|
-
13,
|
|
2112
|
-
310,
|
|
2113
|
-
10,
|
|
2114
|
-
21,
|
|
2115
|
-
11,
|
|
2116
|
-
7,
|
|
2117
|
-
25,
|
|
2118
|
-
5,
|
|
2119
|
-
2,
|
|
2120
|
-
41,
|
|
2121
|
-
2,
|
|
2122
|
-
8,
|
|
2123
|
-
70,
|
|
2124
|
-
5,
|
|
2125
|
-
3,
|
|
2126
|
-
0,
|
|
2127
|
-
2,
|
|
2128
|
-
43,
|
|
2129
|
-
2,
|
|
2130
|
-
1,
|
|
2131
|
-
4,
|
|
2132
|
-
0,
|
|
2133
|
-
3,
|
|
2134
|
-
22,
|
|
2135
|
-
11,
|
|
2136
|
-
22,
|
|
2137
|
-
10,
|
|
2138
|
-
30,
|
|
2139
|
-
66,
|
|
2140
|
-
18,
|
|
2141
|
-
2,
|
|
2142
|
-
1,
|
|
2143
|
-
11,
|
|
2144
|
-
21,
|
|
2145
|
-
11,
|
|
2146
|
-
25,
|
|
2147
|
-
7,
|
|
2148
|
-
25,
|
|
2149
|
-
39,
|
|
2150
|
-
55,
|
|
2151
|
-
7,
|
|
2152
|
-
1,
|
|
2153
|
-
65,
|
|
2154
|
-
0,
|
|
2155
|
-
16,
|
|
2156
|
-
3,
|
|
2157
|
-
2,
|
|
2158
|
-
2,
|
|
2159
|
-
2,
|
|
2160
|
-
28,
|
|
2161
|
-
43,
|
|
2162
|
-
28,
|
|
2163
|
-
4,
|
|
2164
|
-
28,
|
|
2165
|
-
36,
|
|
2166
|
-
7,
|
|
2167
|
-
2,
|
|
2168
|
-
27,
|
|
2169
|
-
28,
|
|
2170
|
-
53,
|
|
2171
|
-
11,
|
|
2172
|
-
21,
|
|
2173
|
-
11,
|
|
2174
|
-
18,
|
|
2175
|
-
14,
|
|
2176
|
-
17,
|
|
2177
|
-
111,
|
|
2178
|
-
72,
|
|
2179
|
-
56,
|
|
2180
|
-
50,
|
|
2181
|
-
14,
|
|
2182
|
-
50,
|
|
2183
|
-
14,
|
|
2184
|
-
35,
|
|
2185
|
-
39,
|
|
2186
|
-
27,
|
|
2187
|
-
10,
|
|
2188
|
-
22,
|
|
2189
|
-
251,
|
|
2190
|
-
41,
|
|
2191
|
-
7,
|
|
2192
|
-
1,
|
|
2193
|
-
17,
|
|
2194
|
-
5,
|
|
2195
|
-
57,
|
|
2196
|
-
28,
|
|
2197
|
-
11,
|
|
2198
|
-
0,
|
|
2199
|
-
9,
|
|
2200
|
-
21,
|
|
2201
|
-
43,
|
|
2202
|
-
17,
|
|
2203
|
-
47,
|
|
2204
|
-
20,
|
|
2205
|
-
28,
|
|
2206
|
-
22,
|
|
2207
|
-
13,
|
|
2208
|
-
52,
|
|
2209
|
-
58,
|
|
2210
|
-
1,
|
|
2211
|
-
3,
|
|
2212
|
-
0,
|
|
2213
|
-
14,
|
|
2214
|
-
44,
|
|
2215
|
-
33,
|
|
2216
|
-
24,
|
|
2217
|
-
27,
|
|
2218
|
-
35,
|
|
2219
|
-
30,
|
|
2220
|
-
0,
|
|
2221
|
-
3,
|
|
2222
|
-
0,
|
|
2223
|
-
9,
|
|
2224
|
-
34,
|
|
2225
|
-
4,
|
|
2226
|
-
0,
|
|
2227
|
-
13,
|
|
2228
|
-
47,
|
|
2229
|
-
15,
|
|
2230
|
-
3,
|
|
2231
|
-
22,
|
|
2232
|
-
0,
|
|
2233
|
-
2,
|
|
2234
|
-
0,
|
|
2235
|
-
36,
|
|
2236
|
-
17,
|
|
2237
|
-
2,
|
|
2238
|
-
24,
|
|
2239
|
-
20,
|
|
2240
|
-
1,
|
|
2241
|
-
64,
|
|
2242
|
-
6,
|
|
2243
|
-
2,
|
|
2244
|
-
0,
|
|
2245
|
-
2,
|
|
2246
|
-
3,
|
|
2247
|
-
2,
|
|
2248
|
-
14,
|
|
2249
|
-
2,
|
|
2250
|
-
9,
|
|
2251
|
-
8,
|
|
2252
|
-
46,
|
|
2253
|
-
39,
|
|
2254
|
-
7,
|
|
2255
|
-
3,
|
|
2256
|
-
1,
|
|
2257
|
-
3,
|
|
2258
|
-
21,
|
|
2259
|
-
2,
|
|
2260
|
-
6,
|
|
2261
|
-
2,
|
|
2262
|
-
1,
|
|
2263
|
-
2,
|
|
2264
|
-
4,
|
|
2265
|
-
4,
|
|
2266
|
-
0,
|
|
2267
|
-
19,
|
|
2268
|
-
0,
|
|
2269
|
-
13,
|
|
2270
|
-
4,
|
|
2271
|
-
31,
|
|
2272
|
-
9,
|
|
2273
|
-
2,
|
|
2274
|
-
0,
|
|
2275
|
-
3,
|
|
2276
|
-
0,
|
|
2277
|
-
2,
|
|
2278
|
-
37,
|
|
2279
|
-
2,
|
|
2280
|
-
0,
|
|
2281
|
-
26,
|
|
2282
|
-
0,
|
|
2283
|
-
2,
|
|
2284
|
-
0,
|
|
2285
|
-
45,
|
|
2286
|
-
52,
|
|
2287
|
-
19,
|
|
2288
|
-
3,
|
|
2289
|
-
21,
|
|
2290
|
-
2,
|
|
2291
|
-
31,
|
|
2292
|
-
47,
|
|
2293
|
-
21,
|
|
2294
|
-
1,
|
|
2295
|
-
2,
|
|
2296
|
-
0,
|
|
2297
|
-
185,
|
|
2298
|
-
46,
|
|
2299
|
-
42,
|
|
2300
|
-
3,
|
|
2301
|
-
37,
|
|
2302
|
-
47,
|
|
2303
|
-
21,
|
|
2304
|
-
0,
|
|
2305
|
-
60,
|
|
2306
|
-
42,
|
|
2307
|
-
14,
|
|
2308
|
-
0,
|
|
2309
|
-
72,
|
|
2310
|
-
26,
|
|
2311
|
-
38,
|
|
2312
|
-
6,
|
|
2313
|
-
186,
|
|
2314
|
-
43,
|
|
2315
|
-
117,
|
|
2316
|
-
63,
|
|
2317
|
-
32,
|
|
2318
|
-
7,
|
|
2319
|
-
3,
|
|
2320
|
-
0,
|
|
2321
|
-
3,
|
|
2322
|
-
7,
|
|
2323
|
-
2,
|
|
2324
|
-
1,
|
|
2325
|
-
2,
|
|
2326
|
-
23,
|
|
2327
|
-
16,
|
|
2328
|
-
0,
|
|
2329
|
-
2,
|
|
2330
|
-
0,
|
|
2331
|
-
95,
|
|
2332
|
-
7,
|
|
2333
|
-
3,
|
|
2334
|
-
38,
|
|
2335
|
-
17,
|
|
2336
|
-
0,
|
|
2337
|
-
2,
|
|
2338
|
-
0,
|
|
2339
|
-
29,
|
|
2340
|
-
0,
|
|
2341
|
-
11,
|
|
2342
|
-
39,
|
|
2343
|
-
8,
|
|
2344
|
-
0,
|
|
2345
|
-
22,
|
|
2346
|
-
0,
|
|
2347
|
-
12,
|
|
2348
|
-
45,
|
|
2349
|
-
20,
|
|
2350
|
-
0,
|
|
2351
|
-
19,
|
|
2352
|
-
72,
|
|
2353
|
-
200,
|
|
2354
|
-
32,
|
|
2355
|
-
32,
|
|
2356
|
-
8,
|
|
2357
|
-
2,
|
|
2358
|
-
36,
|
|
2359
|
-
18,
|
|
2360
|
-
0,
|
|
2361
|
-
50,
|
|
2362
|
-
29,
|
|
2363
|
-
113,
|
|
2364
|
-
6,
|
|
2365
|
-
2,
|
|
2366
|
-
1,
|
|
2367
|
-
2,
|
|
2368
|
-
37,
|
|
2369
|
-
22,
|
|
2370
|
-
0,
|
|
2371
|
-
26,
|
|
2372
|
-
5,
|
|
2373
|
-
2,
|
|
2374
|
-
1,
|
|
2375
|
-
2,
|
|
2376
|
-
31,
|
|
2377
|
-
15,
|
|
2378
|
-
0,
|
|
2379
|
-
24,
|
|
2380
|
-
43,
|
|
2381
|
-
261,
|
|
2382
|
-
18,
|
|
2383
|
-
16,
|
|
2384
|
-
0,
|
|
2385
|
-
2,
|
|
2386
|
-
12,
|
|
2387
|
-
2,
|
|
2388
|
-
33,
|
|
2389
|
-
125,
|
|
2390
|
-
0,
|
|
2391
|
-
80,
|
|
2392
|
-
921,
|
|
2393
|
-
103,
|
|
2394
|
-
110,
|
|
2395
|
-
18,
|
|
2396
|
-
195,
|
|
2397
|
-
2637,
|
|
2398
|
-
96,
|
|
2399
|
-
16,
|
|
2400
|
-
1071,
|
|
2401
|
-
18,
|
|
2402
|
-
5,
|
|
2403
|
-
26,
|
|
2404
|
-
3994,
|
|
2405
|
-
6,
|
|
2406
|
-
582,
|
|
2407
|
-
6842,
|
|
2408
|
-
29,
|
|
2409
|
-
1763,
|
|
2410
|
-
568,
|
|
2411
|
-
8,
|
|
2412
|
-
30,
|
|
2413
|
-
18,
|
|
2414
|
-
78,
|
|
2415
|
-
18,
|
|
2416
|
-
29,
|
|
2417
|
-
19,
|
|
2418
|
-
47,
|
|
2419
|
-
17,
|
|
2420
|
-
3,
|
|
2421
|
-
32,
|
|
2422
|
-
20,
|
|
2423
|
-
6,
|
|
2424
|
-
18,
|
|
2425
|
-
433,
|
|
2426
|
-
44,
|
|
2427
|
-
212,
|
|
2428
|
-
63,
|
|
2429
|
-
33,
|
|
2430
|
-
24,
|
|
2431
|
-
3,
|
|
2432
|
-
24,
|
|
2433
|
-
45,
|
|
2434
|
-
74,
|
|
2435
|
-
6,
|
|
2436
|
-
0,
|
|
2437
|
-
67,
|
|
2438
|
-
12,
|
|
2439
|
-
65,
|
|
2440
|
-
1,
|
|
2441
|
-
2,
|
|
2442
|
-
0,
|
|
2443
|
-
15,
|
|
2444
|
-
4,
|
|
2445
|
-
10,
|
|
2446
|
-
7381,
|
|
2447
|
-
42,
|
|
2448
|
-
31,
|
|
2449
|
-
98,
|
|
2450
|
-
114,
|
|
2451
|
-
8702,
|
|
2452
|
-
3,
|
|
2453
|
-
2,
|
|
2454
|
-
6,
|
|
2455
|
-
2,
|
|
2456
|
-
1,
|
|
2457
|
-
2,
|
|
2458
|
-
290,
|
|
2459
|
-
16,
|
|
2460
|
-
0,
|
|
2461
|
-
30,
|
|
2462
|
-
2,
|
|
2463
|
-
3,
|
|
2464
|
-
0,
|
|
2465
|
-
15,
|
|
2466
|
-
3,
|
|
2467
|
-
9,
|
|
2468
|
-
395,
|
|
2469
|
-
2309,
|
|
2470
|
-
106,
|
|
2471
|
-
6,
|
|
2472
|
-
12,
|
|
2473
|
-
4,
|
|
2474
|
-
8,
|
|
2475
|
-
8,
|
|
2476
|
-
9,
|
|
2477
|
-
5991,
|
|
2478
|
-
84,
|
|
2479
|
-
2,
|
|
2480
|
-
70,
|
|
2481
|
-
2,
|
|
2482
|
-
1,
|
|
2483
|
-
3,
|
|
2484
|
-
0,
|
|
2485
|
-
3,
|
|
2486
|
-
1,
|
|
2487
|
-
3,
|
|
2488
|
-
3,
|
|
2489
|
-
2,
|
|
2490
|
-
11,
|
|
2491
|
-
2,
|
|
2492
|
-
0,
|
|
2493
|
-
2,
|
|
2494
|
-
6,
|
|
2495
|
-
2,
|
|
2496
|
-
64,
|
|
2497
|
-
2,
|
|
2498
|
-
3,
|
|
2499
|
-
3,
|
|
2500
|
-
7,
|
|
2501
|
-
2,
|
|
2502
|
-
6,
|
|
2503
|
-
2,
|
|
2504
|
-
27,
|
|
2505
|
-
2,
|
|
2506
|
-
3,
|
|
2507
|
-
2,
|
|
2508
|
-
4,
|
|
2509
|
-
2,
|
|
2510
|
-
0,
|
|
2511
|
-
4,
|
|
2512
|
-
6,
|
|
2513
|
-
2,
|
|
2514
|
-
339,
|
|
2515
|
-
3,
|
|
2516
|
-
24,
|
|
2517
|
-
2,
|
|
2518
|
-
24,
|
|
2519
|
-
2,
|
|
2520
|
-
30,
|
|
2521
|
-
2,
|
|
2522
|
-
24,
|
|
2523
|
-
2,
|
|
2524
|
-
30,
|
|
2525
|
-
2,
|
|
2526
|
-
24,
|
|
2527
|
-
2,
|
|
2528
|
-
30,
|
|
2529
|
-
2,
|
|
2530
|
-
24,
|
|
2531
|
-
2,
|
|
2532
|
-
30,
|
|
2533
|
-
2,
|
|
2534
|
-
24,
|
|
2535
|
-
2,
|
|
2536
|
-
7,
|
|
2537
|
-
1845,
|
|
2538
|
-
30,
|
|
2539
|
-
7,
|
|
2540
|
-
5,
|
|
2541
|
-
262,
|
|
2542
|
-
61,
|
|
2543
|
-
147,
|
|
2544
|
-
44,
|
|
2545
|
-
11,
|
|
2546
|
-
6,
|
|
2547
|
-
17,
|
|
2548
|
-
0,
|
|
2549
|
-
322,
|
|
2550
|
-
29,
|
|
2551
|
-
19,
|
|
2552
|
-
43,
|
|
2553
|
-
485,
|
|
2554
|
-
27,
|
|
2555
|
-
229,
|
|
2556
|
-
29,
|
|
2557
|
-
3,
|
|
2558
|
-
0,
|
|
2559
|
-
208,
|
|
2560
|
-
30,
|
|
2561
|
-
2,
|
|
2562
|
-
2,
|
|
2563
|
-
2,
|
|
2564
|
-
1,
|
|
2565
|
-
2,
|
|
2566
|
-
6,
|
|
2567
|
-
3,
|
|
2568
|
-
4,
|
|
2569
|
-
10,
|
|
2570
|
-
1,
|
|
2571
|
-
225,
|
|
2572
|
-
6,
|
|
2573
|
-
2,
|
|
2574
|
-
3,
|
|
2575
|
-
2,
|
|
2576
|
-
1,
|
|
2577
|
-
2,
|
|
2578
|
-
14,
|
|
2579
|
-
2,
|
|
2580
|
-
196,
|
|
2581
|
-
60,
|
|
2582
|
-
67,
|
|
2583
|
-
8,
|
|
2584
|
-
0,
|
|
2585
|
-
1205,
|
|
2586
|
-
3,
|
|
2587
|
-
2,
|
|
2588
|
-
26,
|
|
2589
|
-
2,
|
|
2590
|
-
1,
|
|
2591
|
-
2,
|
|
2592
|
-
0,
|
|
2593
|
-
3,
|
|
2594
|
-
0,
|
|
2595
|
-
2,
|
|
2596
|
-
9,
|
|
2597
|
-
2,
|
|
2598
|
-
3,
|
|
2599
|
-
2,
|
|
2600
|
-
0,
|
|
2601
|
-
2,
|
|
2602
|
-
0,
|
|
2603
|
-
7,
|
|
2604
|
-
0,
|
|
2605
|
-
5,
|
|
2606
|
-
0,
|
|
2607
|
-
2,
|
|
2608
|
-
0,
|
|
2609
|
-
2,
|
|
2610
|
-
0,
|
|
2611
|
-
2,
|
|
2612
|
-
2,
|
|
2613
|
-
2,
|
|
2614
|
-
1,
|
|
2615
|
-
2,
|
|
2616
|
-
0,
|
|
2617
|
-
3,
|
|
2618
|
-
0,
|
|
2619
|
-
2,
|
|
2620
|
-
0,
|
|
2621
|
-
2,
|
|
2622
|
-
0,
|
|
2623
|
-
2,
|
|
2624
|
-
0,
|
|
2625
|
-
2,
|
|
2626
|
-
0,
|
|
2627
|
-
2,
|
|
2628
|
-
1,
|
|
2629
|
-
2,
|
|
2630
|
-
0,
|
|
2631
|
-
3,
|
|
2632
|
-
3,
|
|
2633
|
-
2,
|
|
2634
|
-
6,
|
|
2635
|
-
2,
|
|
2636
|
-
3,
|
|
2637
|
-
2,
|
|
2638
|
-
3,
|
|
2639
|
-
2,
|
|
2640
|
-
0,
|
|
2641
|
-
2,
|
|
2642
|
-
9,
|
|
2643
|
-
2,
|
|
2644
|
-
16,
|
|
2645
|
-
6,
|
|
2646
|
-
2,
|
|
2647
|
-
2,
|
|
2648
|
-
4,
|
|
2649
|
-
2,
|
|
2650
|
-
16,
|
|
2651
|
-
4421,
|
|
2652
|
-
42719,
|
|
2653
|
-
33,
|
|
2654
|
-
4381,
|
|
2655
|
-
3,
|
|
2656
|
-
5773,
|
|
2657
|
-
3,
|
|
2658
|
-
7472,
|
|
2659
|
-
16,
|
|
2660
|
-
621,
|
|
2661
|
-
2467,
|
|
2662
|
-
541,
|
|
2663
|
-
1507,
|
|
2664
|
-
4938,
|
|
2665
|
-
6,
|
|
2666
|
-
8489
|
|
2667
|
-
];
|
|
2668
|
-
const astralIdentifierCodes = [
|
|
2669
|
-
509,
|
|
2670
|
-
0,
|
|
2671
|
-
227,
|
|
2672
|
-
0,
|
|
2673
|
-
150,
|
|
2674
|
-
4,
|
|
2675
|
-
294,
|
|
2676
|
-
9,
|
|
2677
|
-
1368,
|
|
2678
|
-
2,
|
|
2679
|
-
2,
|
|
2680
|
-
1,
|
|
2681
|
-
6,
|
|
2682
|
-
3,
|
|
2683
|
-
41,
|
|
2684
|
-
2,
|
|
2685
|
-
5,
|
|
2686
|
-
0,
|
|
2687
|
-
166,
|
|
2688
|
-
1,
|
|
2689
|
-
574,
|
|
2690
|
-
3,
|
|
2691
|
-
9,
|
|
2692
|
-
9,
|
|
2693
|
-
7,
|
|
2694
|
-
9,
|
|
2695
|
-
32,
|
|
2696
|
-
4,
|
|
2697
|
-
318,
|
|
2698
|
-
1,
|
|
2699
|
-
78,
|
|
2700
|
-
5,
|
|
2701
|
-
71,
|
|
2702
|
-
10,
|
|
2703
|
-
50,
|
|
2704
|
-
3,
|
|
2705
|
-
123,
|
|
2706
|
-
2,
|
|
2707
|
-
54,
|
|
2708
|
-
14,
|
|
2709
|
-
32,
|
|
2710
|
-
10,
|
|
2711
|
-
3,
|
|
2712
|
-
1,
|
|
2713
|
-
11,
|
|
2714
|
-
3,
|
|
2715
|
-
46,
|
|
2716
|
-
10,
|
|
2717
|
-
8,
|
|
2718
|
-
0,
|
|
2719
|
-
46,
|
|
2720
|
-
9,
|
|
2721
|
-
7,
|
|
2722
|
-
2,
|
|
2723
|
-
37,
|
|
2724
|
-
13,
|
|
2725
|
-
2,
|
|
2726
|
-
9,
|
|
2727
|
-
6,
|
|
2728
|
-
1,
|
|
2729
|
-
45,
|
|
2730
|
-
0,
|
|
2731
|
-
13,
|
|
2732
|
-
2,
|
|
2733
|
-
49,
|
|
2734
|
-
13,
|
|
2735
|
-
9,
|
|
2736
|
-
3,
|
|
2737
|
-
2,
|
|
2738
|
-
11,
|
|
2739
|
-
83,
|
|
2740
|
-
11,
|
|
2741
|
-
7,
|
|
2742
|
-
0,
|
|
2743
|
-
3,
|
|
2744
|
-
0,
|
|
2745
|
-
158,
|
|
2746
|
-
11,
|
|
2747
|
-
6,
|
|
2748
|
-
9,
|
|
2749
|
-
7,
|
|
2750
|
-
3,
|
|
2751
|
-
56,
|
|
2752
|
-
1,
|
|
2753
|
-
2,
|
|
2754
|
-
6,
|
|
2755
|
-
3,
|
|
2756
|
-
1,
|
|
2757
|
-
3,
|
|
2758
|
-
2,
|
|
2759
|
-
10,
|
|
2760
|
-
0,
|
|
2761
|
-
11,
|
|
2762
|
-
1,
|
|
2763
|
-
3,
|
|
2764
|
-
6,
|
|
2765
|
-
4,
|
|
2766
|
-
4,
|
|
2767
|
-
68,
|
|
2768
|
-
8,
|
|
2769
|
-
2,
|
|
2770
|
-
0,
|
|
2771
|
-
3,
|
|
2772
|
-
0,
|
|
2773
|
-
2,
|
|
2774
|
-
3,
|
|
2775
|
-
2,
|
|
2776
|
-
4,
|
|
2777
|
-
2,
|
|
2778
|
-
0,
|
|
2779
|
-
15,
|
|
2780
|
-
1,
|
|
2781
|
-
83,
|
|
2782
|
-
17,
|
|
2783
|
-
10,
|
|
2784
|
-
9,
|
|
2785
|
-
5,
|
|
2786
|
-
0,
|
|
2787
|
-
82,
|
|
2788
|
-
19,
|
|
2789
|
-
13,
|
|
2790
|
-
9,
|
|
2791
|
-
214,
|
|
2792
|
-
6,
|
|
2793
|
-
3,
|
|
2794
|
-
8,
|
|
2795
|
-
28,
|
|
2796
|
-
1,
|
|
2797
|
-
83,
|
|
2798
|
-
16,
|
|
2799
|
-
16,
|
|
2800
|
-
9,
|
|
2801
|
-
82,
|
|
2802
|
-
12,
|
|
2803
|
-
9,
|
|
2804
|
-
9,
|
|
2805
|
-
7,
|
|
2806
|
-
19,
|
|
2807
|
-
58,
|
|
2808
|
-
14,
|
|
2809
|
-
5,
|
|
2810
|
-
9,
|
|
2811
|
-
243,
|
|
2812
|
-
14,
|
|
2813
|
-
166,
|
|
2814
|
-
9,
|
|
2815
|
-
71,
|
|
2816
|
-
5,
|
|
2817
|
-
2,
|
|
2818
|
-
1,
|
|
2819
|
-
3,
|
|
2820
|
-
3,
|
|
2821
|
-
2,
|
|
2822
|
-
0,
|
|
2823
|
-
2,
|
|
2824
|
-
1,
|
|
2825
|
-
13,
|
|
2826
|
-
9,
|
|
2827
|
-
120,
|
|
2828
|
-
6,
|
|
2829
|
-
3,
|
|
2830
|
-
6,
|
|
2831
|
-
4,
|
|
2832
|
-
0,
|
|
2833
|
-
29,
|
|
2834
|
-
9,
|
|
2835
|
-
41,
|
|
2836
|
-
6,
|
|
2837
|
-
2,
|
|
2838
|
-
3,
|
|
2839
|
-
9,
|
|
2840
|
-
0,
|
|
2841
|
-
10,
|
|
2842
|
-
10,
|
|
2843
|
-
47,
|
|
2844
|
-
15,
|
|
2845
|
-
199,
|
|
2846
|
-
7,
|
|
2847
|
-
137,
|
|
2848
|
-
9,
|
|
2849
|
-
54,
|
|
2850
|
-
7,
|
|
2851
|
-
2,
|
|
2852
|
-
7,
|
|
2853
|
-
17,
|
|
2854
|
-
9,
|
|
2855
|
-
57,
|
|
2856
|
-
21,
|
|
2857
|
-
2,
|
|
2858
|
-
13,
|
|
2859
|
-
123,
|
|
2860
|
-
5,
|
|
2861
|
-
4,
|
|
2862
|
-
0,
|
|
2863
|
-
2,
|
|
2864
|
-
1,
|
|
2865
|
-
2,
|
|
2866
|
-
6,
|
|
2867
|
-
2,
|
|
2868
|
-
0,
|
|
2869
|
-
9,
|
|
2870
|
-
9,
|
|
2871
|
-
49,
|
|
2872
|
-
4,
|
|
2873
|
-
2,
|
|
2874
|
-
1,
|
|
2875
|
-
2,
|
|
2876
|
-
4,
|
|
2877
|
-
9,
|
|
2878
|
-
9,
|
|
2879
|
-
55,
|
|
2880
|
-
9,
|
|
2881
|
-
266,
|
|
2882
|
-
3,
|
|
2883
|
-
10,
|
|
2884
|
-
1,
|
|
2885
|
-
2,
|
|
2886
|
-
0,
|
|
2887
|
-
49,
|
|
2888
|
-
6,
|
|
2889
|
-
4,
|
|
2890
|
-
4,
|
|
2891
|
-
14,
|
|
2892
|
-
10,
|
|
2893
|
-
5350,
|
|
2894
|
-
0,
|
|
2895
|
-
7,
|
|
2896
|
-
14,
|
|
2897
|
-
11465,
|
|
2898
|
-
27,
|
|
2899
|
-
2343,
|
|
2900
|
-
9,
|
|
2901
|
-
87,
|
|
2902
|
-
9,
|
|
2903
|
-
39,
|
|
2904
|
-
4,
|
|
2905
|
-
60,
|
|
2906
|
-
6,
|
|
2907
|
-
26,
|
|
2908
|
-
9,
|
|
2909
|
-
535,
|
|
2910
|
-
9,
|
|
2911
|
-
470,
|
|
2912
|
-
0,
|
|
2913
|
-
2,
|
|
2914
|
-
54,
|
|
2915
|
-
8,
|
|
2916
|
-
3,
|
|
2917
|
-
82,
|
|
2918
|
-
0,
|
|
2919
|
-
12,
|
|
2920
|
-
1,
|
|
2921
|
-
19628,
|
|
2922
|
-
1,
|
|
2923
|
-
4178,
|
|
2924
|
-
9,
|
|
2925
|
-
519,
|
|
2926
|
-
45,
|
|
2927
|
-
3,
|
|
2928
|
-
22,
|
|
2929
|
-
543,
|
|
2930
|
-
4,
|
|
2931
|
-
4,
|
|
2932
|
-
5,
|
|
2933
|
-
9,
|
|
2934
|
-
7,
|
|
2935
|
-
3,
|
|
2936
|
-
6,
|
|
2937
|
-
31,
|
|
2938
|
-
3,
|
|
2939
|
-
149,
|
|
2940
|
-
2,
|
|
2941
|
-
1418,
|
|
2942
|
-
49,
|
|
2943
|
-
513,
|
|
2944
|
-
54,
|
|
2945
|
-
5,
|
|
2946
|
-
49,
|
|
2947
|
-
9,
|
|
2948
|
-
0,
|
|
2949
|
-
15,
|
|
2950
|
-
0,
|
|
2951
|
-
23,
|
|
2952
|
-
4,
|
|
2953
|
-
2,
|
|
2954
|
-
14,
|
|
2955
|
-
1361,
|
|
2956
|
-
6,
|
|
2957
|
-
2,
|
|
2958
|
-
16,
|
|
2959
|
-
3,
|
|
2960
|
-
6,
|
|
2961
|
-
2,
|
|
2962
|
-
1,
|
|
2963
|
-
2,
|
|
2964
|
-
4,
|
|
2965
|
-
101,
|
|
2966
|
-
0,
|
|
2967
|
-
161,
|
|
2968
|
-
6,
|
|
2969
|
-
10,
|
|
2970
|
-
9,
|
|
2971
|
-
357,
|
|
2972
|
-
0,
|
|
2973
|
-
62,
|
|
2974
|
-
13,
|
|
2975
|
-
499,
|
|
2976
|
-
13,
|
|
2977
|
-
245,
|
|
2978
|
-
1,
|
|
2979
|
-
2,
|
|
2980
|
-
9,
|
|
2981
|
-
233,
|
|
2982
|
-
0,
|
|
2983
|
-
3,
|
|
2984
|
-
0,
|
|
2985
|
-
8,
|
|
2986
|
-
1,
|
|
2987
|
-
6,
|
|
2988
|
-
0,
|
|
2989
|
-
475,
|
|
2990
|
-
6,
|
|
2991
|
-
110,
|
|
2992
|
-
6,
|
|
2993
|
-
6,
|
|
2994
|
-
9,
|
|
2995
|
-
4759,
|
|
2996
|
-
9,
|
|
2997
|
-
787719,
|
|
2998
|
-
239
|
|
2999
|
-
];
|
|
3000
|
-
function isInAstralSet(code, set) {
|
|
3001
|
-
let pos = 65536;
|
|
3002
|
-
for (let i = 0, length = set.length; i < length; i += 2) {
|
|
3003
|
-
pos += set[i];
|
|
3004
|
-
if (pos > code) return false;
|
|
3005
|
-
pos += set[i + 1];
|
|
3006
|
-
if (pos >= code) return true;
|
|
3007
|
-
}
|
|
3008
|
-
return false;
|
|
3009
|
-
}
|
|
3010
|
-
function isIdentifierStart(code) {
|
|
3011
|
-
if (code < 65) return code === 36;
|
|
3012
|
-
if (code <= 90) return true;
|
|
3013
|
-
if (code < 97) return code === 95;
|
|
3014
|
-
if (code <= 122) return true;
|
|
3015
|
-
if (code <= 65535) return code >= 170 && nonASCIIidentifierStart.test(String.fromCharCode(code));
|
|
3016
|
-
return isInAstralSet(code, astralIdentifierStartCodes);
|
|
3017
|
-
}
|
|
3018
|
-
function isIdentifierChar(code) {
|
|
3019
|
-
if (code < 48) return code === 36;
|
|
3020
|
-
if (code < 58) return true;
|
|
3021
|
-
if (code < 65) return false;
|
|
3022
|
-
if (code <= 90) return true;
|
|
3023
|
-
if (code < 97) return code === 95;
|
|
3024
|
-
if (code <= 122) return true;
|
|
3025
|
-
if (code <= 65535) return code >= 170 && nonASCIIidentifier.test(String.fromCharCode(code));
|
|
3026
|
-
return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
|
|
3027
|
-
}
|
|
3028
|
-
function isIdentifierName(name) {
|
|
3029
|
-
let isFirst = true;
|
|
3030
|
-
for (let i = 0; i < name.length; i++) {
|
|
3031
|
-
let cp = name.charCodeAt(i);
|
|
3032
|
-
if ((cp & 64512) === 55296 && i + 1 < name.length) {
|
|
3033
|
-
const trail = name.charCodeAt(++i);
|
|
3034
|
-
if ((trail & 64512) === 56320) cp = 65536 + ((cp & 1023) << 10) + (trail & 1023);
|
|
3035
|
-
}
|
|
3036
|
-
if (isFirst) {
|
|
3037
|
-
isFirst = false;
|
|
3038
|
-
if (!isIdentifierStart(cp)) return false;
|
|
3039
|
-
} else if (!isIdentifierChar(cp)) return false;
|
|
3040
|
-
}
|
|
3041
|
-
return !isFirst;
|
|
3042
1909
|
}
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
var require_keyword = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
3048
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3049
|
-
exports.isKeyword = isKeyword;
|
|
3050
|
-
exports.isReservedWord = isReservedWord;
|
|
3051
|
-
exports.isStrictBindOnlyReservedWord = isStrictBindOnlyReservedWord;
|
|
3052
|
-
exports.isStrictBindReservedWord = isStrictBindReservedWord;
|
|
3053
|
-
exports.isStrictReservedWord = isStrictReservedWord;
|
|
3054
|
-
const reservedWords = {
|
|
3055
|
-
keyword: [
|
|
3056
|
-
"break",
|
|
3057
|
-
"case",
|
|
3058
|
-
"catch",
|
|
3059
|
-
"continue",
|
|
3060
|
-
"debugger",
|
|
3061
|
-
"default",
|
|
3062
|
-
"do",
|
|
3063
|
-
"else",
|
|
3064
|
-
"finally",
|
|
3065
|
-
"for",
|
|
3066
|
-
"function",
|
|
3067
|
-
"if",
|
|
3068
|
-
"return",
|
|
3069
|
-
"switch",
|
|
3070
|
-
"throw",
|
|
3071
|
-
"try",
|
|
3072
|
-
"var",
|
|
3073
|
-
"const",
|
|
3074
|
-
"while",
|
|
3075
|
-
"with",
|
|
3076
|
-
"new",
|
|
3077
|
-
"this",
|
|
3078
|
-
"super",
|
|
3079
|
-
"class",
|
|
3080
|
-
"extends",
|
|
3081
|
-
"export",
|
|
3082
|
-
"import",
|
|
3083
|
-
"null",
|
|
3084
|
-
"true",
|
|
3085
|
-
"false",
|
|
3086
|
-
"in",
|
|
3087
|
-
"instanceof",
|
|
3088
|
-
"typeof",
|
|
3089
|
-
"void",
|
|
3090
|
-
"delete"
|
|
3091
|
-
],
|
|
3092
|
-
strict: [
|
|
3093
|
-
"implements",
|
|
3094
|
-
"interface",
|
|
3095
|
-
"let",
|
|
3096
|
-
"package",
|
|
3097
|
-
"private",
|
|
3098
|
-
"protected",
|
|
3099
|
-
"public",
|
|
3100
|
-
"static",
|
|
3101
|
-
"yield"
|
|
3102
|
-
],
|
|
3103
|
-
strictBind: ["eval", "arguments"]
|
|
1910
|
+
const url = new URL(value);
|
|
1911
|
+
return {
|
|
1912
|
+
pathname: url.pathname,
|
|
1913
|
+
query: toQueryObject(url.searchParams)
|
|
3104
1914
|
};
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
}
|
|
3111
|
-
|
|
3112
|
-
return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);
|
|
3113
|
-
}
|
|
3114
|
-
function isStrictBindOnlyReservedWord(word) {
|
|
3115
|
-
return reservedWordsStrictBindSet.has(word);
|
|
3116
|
-
}
|
|
3117
|
-
function isStrictBindReservedWord(word, inModule) {
|
|
3118
|
-
return isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word);
|
|
3119
|
-
}
|
|
3120
|
-
function isKeyword(word) {
|
|
3121
|
-
return keywords.has(word);
|
|
3122
|
-
}
|
|
3123
|
-
}));
|
|
3124
|
-
|
|
3125
|
-
//#endregion
|
|
3126
|
-
//#region node_modules/@babel/helper-validator-identifier/lib/index.js
|
|
3127
|
-
var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
3128
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3129
|
-
Object.defineProperty(exports, "isIdentifierChar", {
|
|
3130
|
-
enumerable: true,
|
|
3131
|
-
get: function() {
|
|
3132
|
-
return _identifier.isIdentifierChar;
|
|
3133
|
-
}
|
|
3134
|
-
});
|
|
3135
|
-
Object.defineProperty(exports, "isIdentifierName", {
|
|
3136
|
-
enumerable: true,
|
|
3137
|
-
get: function() {
|
|
3138
|
-
return _identifier.isIdentifierName;
|
|
3139
|
-
}
|
|
3140
|
-
});
|
|
3141
|
-
Object.defineProperty(exports, "isIdentifierStart", {
|
|
3142
|
-
enumerable: true,
|
|
3143
|
-
get: function() {
|
|
3144
|
-
return _identifier.isIdentifierStart;
|
|
3145
|
-
}
|
|
3146
|
-
});
|
|
3147
|
-
Object.defineProperty(exports, "isKeyword", {
|
|
3148
|
-
enumerable: true,
|
|
3149
|
-
get: function() {
|
|
3150
|
-
return _keyword.isKeyword;
|
|
3151
|
-
}
|
|
3152
|
-
});
|
|
3153
|
-
Object.defineProperty(exports, "isReservedWord", {
|
|
3154
|
-
enumerable: true,
|
|
3155
|
-
get: function() {
|
|
3156
|
-
return _keyword.isReservedWord;
|
|
3157
|
-
}
|
|
3158
|
-
});
|
|
3159
|
-
Object.defineProperty(exports, "isStrictBindOnlyReservedWord", {
|
|
3160
|
-
enumerable: true,
|
|
3161
|
-
get: function() {
|
|
3162
|
-
return _keyword.isStrictBindOnlyReservedWord;
|
|
3163
|
-
}
|
|
3164
|
-
});
|
|
3165
|
-
Object.defineProperty(exports, "isStrictBindReservedWord", {
|
|
3166
|
-
enumerable: true,
|
|
3167
|
-
get: function() {
|
|
3168
|
-
return _keyword.isStrictBindReservedWord;
|
|
3169
|
-
}
|
|
3170
|
-
});
|
|
3171
|
-
Object.defineProperty(exports, "isStrictReservedWord", {
|
|
3172
|
-
enumerable: true,
|
|
3173
|
-
get: function() {
|
|
3174
|
-
return _keyword.isStrictReservedWord;
|
|
3175
|
-
}
|
|
3176
|
-
});
|
|
3177
|
-
var _identifier = require_identifier();
|
|
3178
|
-
var _keyword = require_keyword();
|
|
3179
|
-
}));
|
|
3180
|
-
|
|
3181
|
-
//#endregion
|
|
3182
|
-
//#region node_modules/@babel/code-frame/lib/index.js
|
|
3183
|
-
var require_lib = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
3184
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3185
|
-
var picocolors = require_picocolors();
|
|
3186
|
-
var jsTokens = require_js_tokens();
|
|
3187
|
-
var helperValidatorIdentifier = require_lib$1();
|
|
3188
|
-
function isColorSupported() {
|
|
3189
|
-
return typeof process === "object" && (process.env.FORCE_COLOR === "0" || process.env.FORCE_COLOR === "false") ? false : picocolors.isColorSupported;
|
|
3190
|
-
}
|
|
3191
|
-
const compose = (f, g) => (v) => f(g(v));
|
|
3192
|
-
function buildDefs(colors) {
|
|
3193
|
-
return {
|
|
3194
|
-
keyword: colors.cyan,
|
|
3195
|
-
capitalized: colors.yellow,
|
|
3196
|
-
jsxIdentifier: colors.yellow,
|
|
3197
|
-
punctuator: colors.yellow,
|
|
3198
|
-
number: colors.magenta,
|
|
3199
|
-
string: colors.green,
|
|
3200
|
-
regex: colors.magenta,
|
|
3201
|
-
comment: colors.gray,
|
|
3202
|
-
invalid: compose(compose(colors.white, colors.bgRed), colors.bold),
|
|
3203
|
-
gutter: colors.gray,
|
|
3204
|
-
marker: compose(colors.red, colors.bold),
|
|
3205
|
-
message: compose(colors.red, colors.bold),
|
|
3206
|
-
reset: colors.reset
|
|
3207
|
-
};
|
|
3208
|
-
}
|
|
3209
|
-
const defsOn = buildDefs(picocolors.createColors(true));
|
|
3210
|
-
const defsOff = buildDefs(picocolors.createColors(false));
|
|
3211
|
-
function getDefs(enabled) {
|
|
3212
|
-
return enabled ? defsOn : defsOff;
|
|
3213
|
-
}
|
|
3214
|
-
const sometimesKeywords = new Set([
|
|
3215
|
-
"as",
|
|
3216
|
-
"async",
|
|
3217
|
-
"from",
|
|
3218
|
-
"get",
|
|
3219
|
-
"of",
|
|
3220
|
-
"set"
|
|
3221
|
-
]);
|
|
3222
|
-
const NEWLINE$1 = /\r\n|[\n\r\u2028\u2029]/;
|
|
3223
|
-
const BRACKET = /^[()[\]{}]$/;
|
|
3224
|
-
let tokenize;
|
|
3225
|
-
{
|
|
3226
|
-
const JSX_TAG = /^[a-z][\w-]*$/i;
|
|
3227
|
-
const getTokenType = function(token, offset, text) {
|
|
3228
|
-
if (token.type === "name") {
|
|
3229
|
-
if (helperValidatorIdentifier.isKeyword(token.value) || helperValidatorIdentifier.isStrictReservedWord(token.value, true) || sometimesKeywords.has(token.value)) return "keyword";
|
|
3230
|
-
if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.slice(offset - 2, offset) === "</")) return "jsxIdentifier";
|
|
3231
|
-
if (token.value[0] !== token.value[0].toLowerCase()) return "capitalized";
|
|
3232
|
-
}
|
|
3233
|
-
if (token.type === "punctuator" && BRACKET.test(token.value)) return "bracket";
|
|
3234
|
-
if (token.type === "invalid" && (token.value === "@" || token.value === "#")) return "punctuator";
|
|
3235
|
-
return token.type;
|
|
3236
|
-
};
|
|
3237
|
-
tokenize = function* (text) {
|
|
3238
|
-
let match;
|
|
3239
|
-
while (match = jsTokens.default.exec(text)) {
|
|
3240
|
-
const token = jsTokens.matchToToken(match);
|
|
3241
|
-
yield {
|
|
3242
|
-
type: getTokenType(token, match.index, text),
|
|
3243
|
-
value: token.value
|
|
3244
|
-
};
|
|
3245
|
-
}
|
|
3246
|
-
};
|
|
3247
|
-
}
|
|
3248
|
-
function highlight(text) {
|
|
3249
|
-
if (text === "") return "";
|
|
3250
|
-
const defs = getDefs(true);
|
|
3251
|
-
let highlighted = "";
|
|
3252
|
-
for (const { type, value } of tokenize(text)) if (type in defs) highlighted += value.split(NEWLINE$1).map((str) => defs[type](str)).join("\n");
|
|
3253
|
-
else highlighted += value;
|
|
3254
|
-
return highlighted;
|
|
3255
|
-
}
|
|
3256
|
-
const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
|
|
3257
|
-
function getMarkerLines(loc, source, opts) {
|
|
3258
|
-
const startLoc = Object.assign({
|
|
3259
|
-
column: 0,
|
|
3260
|
-
line: -1
|
|
3261
|
-
}, loc.start);
|
|
3262
|
-
const endLoc = Object.assign({}, startLoc, loc.end);
|
|
3263
|
-
const { linesAbove = 2, linesBelow = 3 } = opts || {};
|
|
3264
|
-
const startLine = startLoc.line;
|
|
3265
|
-
const startColumn = startLoc.column;
|
|
3266
|
-
const endLine = endLoc.line;
|
|
3267
|
-
const endColumn = endLoc.column;
|
|
3268
|
-
let start = Math.max(startLine - (linesAbove + 1), 0);
|
|
3269
|
-
let end = Math.min(source.length, endLine + linesBelow);
|
|
3270
|
-
if (startLine === -1) start = 0;
|
|
3271
|
-
if (endLine === -1) end = source.length;
|
|
3272
|
-
const lineDiff = endLine - startLine;
|
|
3273
|
-
const markerLines = {};
|
|
3274
|
-
if (lineDiff) for (let i = 0; i <= lineDiff; i++) {
|
|
3275
|
-
const lineNumber = i + startLine;
|
|
3276
|
-
if (!startColumn) markerLines[lineNumber] = true;
|
|
3277
|
-
else if (i === 0) markerLines[lineNumber] = [startColumn, source[lineNumber - 1].length - startColumn + 1];
|
|
3278
|
-
else if (i === lineDiff) markerLines[lineNumber] = [0, endColumn];
|
|
3279
|
-
else markerLines[lineNumber] = [0, source[lineNumber - i].length];
|
|
3280
|
-
}
|
|
3281
|
-
else if (startColumn === endColumn) if (startColumn) markerLines[startLine] = [startColumn, 0];
|
|
3282
|
-
else markerLines[startLine] = true;
|
|
3283
|
-
else markerLines[startLine] = [startColumn, endColumn - startColumn];
|
|
3284
|
-
return {
|
|
3285
|
-
start,
|
|
3286
|
-
end,
|
|
3287
|
-
markerLines
|
|
3288
|
-
};
|
|
3289
|
-
}
|
|
3290
|
-
function codeFrameColumns(rawLines, loc, opts = {}) {
|
|
3291
|
-
const shouldHighlight = opts.forceColor || isColorSupported() && opts.highlightCode;
|
|
3292
|
-
const defs = getDefs(shouldHighlight);
|
|
3293
|
-
const { start, end, markerLines } = getMarkerLines(loc, rawLines.split(NEWLINE), opts);
|
|
3294
|
-
const hasColumns = loc.start && typeof loc.start.column === "number";
|
|
3295
|
-
const numberMaxWidth = String(end).length;
|
|
3296
|
-
let frame = (shouldHighlight ? highlight(rawLines) : rawLines).split(NEWLINE, end).slice(start, end).map((line, index) => {
|
|
3297
|
-
const number = start + 1 + index;
|
|
3298
|
-
const gutter = ` ${` ${number}`.slice(-numberMaxWidth)} |`;
|
|
3299
|
-
const hasMarker = markerLines[number];
|
|
3300
|
-
const lastMarkerLine = !markerLines[number + 1];
|
|
3301
|
-
if (hasMarker) {
|
|
3302
|
-
let markerLine = "";
|
|
3303
|
-
if (Array.isArray(hasMarker)) {
|
|
3304
|
-
const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
|
|
3305
|
-
const numberOfMarkers = hasMarker[1] || 1;
|
|
3306
|
-
markerLine = [
|
|
3307
|
-
"\n ",
|
|
3308
|
-
defs.gutter(gutter.replace(/\d/g, " ")),
|
|
3309
|
-
" ",
|
|
3310
|
-
markerSpacing,
|
|
3311
|
-
defs.marker("^").repeat(numberOfMarkers)
|
|
3312
|
-
].join("");
|
|
3313
|
-
if (lastMarkerLine && opts.message) markerLine += " " + defs.message(opts.message);
|
|
3314
|
-
}
|
|
3315
|
-
return [
|
|
3316
|
-
defs.marker(">"),
|
|
3317
|
-
defs.gutter(gutter),
|
|
3318
|
-
line.length > 0 ? ` ${line}` : "",
|
|
3319
|
-
markerLine
|
|
3320
|
-
].join("");
|
|
3321
|
-
} else return ` ${defs.gutter(gutter)}${line.length > 0 ? ` ${line}` : ""}`;
|
|
3322
|
-
}).join("\n");
|
|
3323
|
-
if (opts.message && !hasColumns) frame = `${" ".repeat(numberMaxWidth + 1)}${opts.message}\n${frame}`;
|
|
3324
|
-
if (shouldHighlight) return defs.reset(frame);
|
|
3325
|
-
else return frame;
|
|
3326
|
-
}
|
|
3327
|
-
exports.codeFrameColumns = codeFrameColumns;
|
|
3328
|
-
}));
|
|
1915
|
+
}
|
|
1916
|
+
function toQueryObject(searchParams) {
|
|
1917
|
+
return searchParams.entries().reduce((acc, [key, value]) => ({
|
|
1918
|
+
...acc,
|
|
1919
|
+
[key]: value
|
|
1920
|
+
}), {});
|
|
1921
|
+
}
|
|
3329
1922
|
|
|
3330
1923
|
//#endregion
|
|
3331
1924
|
//#region src/server/symbolicate.ts
|
|
3332
|
-
var import_lib = require_lib();
|
|
3333
1925
|
/**
|
|
3334
1926
|
* @see https://github.com/facebook/react-native/blob/0.83-stable/packages/metro-config/src/index.flow.js#L17
|
|
3335
1927
|
*/
|
|
@@ -3368,10 +1960,10 @@ function originalPositionFor(sourceMapConsumer, frame) {
|
|
|
3368
1960
|
column: frame.column,
|
|
3369
1961
|
line: frame.lineNumber
|
|
3370
1962
|
});
|
|
3371
|
-
return Object.entries(originalPosition).reduce((frame
|
|
1963
|
+
return Object.entries(originalPosition).reduce((frame, [key, value]) => {
|
|
3372
1964
|
const targetKey = convertFrameKey(key);
|
|
3373
1965
|
return {
|
|
3374
|
-
...frame
|
|
1966
|
+
...frame,
|
|
3375
1967
|
...value ? { [targetKey]: value } : null
|
|
3376
1968
|
};
|
|
3377
1969
|
}, frame);
|
|
@@ -3392,17 +1984,17 @@ function convertFrameKey(key) {
|
|
|
3392
1984
|
return key;
|
|
3393
1985
|
}
|
|
3394
1986
|
function getCodeFrame(sourceMapConsumer, frames, bundle) {
|
|
3395
|
-
const frame = frames.find((frame
|
|
3396
|
-
return frame
|
|
1987
|
+
const frame = frames.find((frame) => {
|
|
1988
|
+
return frame.lineNumber != null && frame.column != null && !isCollapsed(frame);
|
|
3397
1989
|
});
|
|
3398
1990
|
if (frame?.file == null || frame.column == null || frame.lineNumber == null) return null;
|
|
3399
1991
|
try {
|
|
3400
1992
|
const { lineNumber, column, file } = frame;
|
|
3401
1993
|
const unresolved = file.startsWith("http");
|
|
3402
1994
|
const source = unresolved ? bundle.code : sourceMapConsumer.sourceContentFor(frame.file);
|
|
3403
|
-
const fileName = unresolved ?
|
|
1995
|
+
const fileName = unresolved ? parseUrl(file).pathname ?? "unknown" : file;
|
|
3404
1996
|
let content = "";
|
|
3405
|
-
if (source) content =
|
|
1997
|
+
if (source) content = codeFrameColumns(source, { start: {
|
|
3406
1998
|
column,
|
|
3407
1999
|
line: lineNumber
|
|
3408
2000
|
} }, { highlightCode: true });
|
|
@@ -3440,7 +2032,7 @@ const plugin = fp((fastify, options) => {
|
|
|
3440
2032
|
const { stack } = request.body;
|
|
3441
2033
|
const bundleUrl = stack.find((frame) => frame.file?.startsWith("http"));
|
|
3442
2034
|
invariant(bundleUrl?.file, "No bundle URL found in stack frames");
|
|
3443
|
-
const { pathname, query } =
|
|
2035
|
+
const { pathname, query } = parseUrl(bundleUrl.file);
|
|
3444
2036
|
invariant(pathname, "No pathname found in bundle URL");
|
|
3445
2037
|
invariant(query.platform, "No platform found in query");
|
|
3446
2038
|
invariant(query.dev, "No dev found in query");
|
|
@@ -3509,11 +2101,11 @@ function getWebSocketUpgradeHandler(websocketEndpoints) {
|
|
|
3509
2101
|
socket.destroy();
|
|
3510
2102
|
return;
|
|
3511
2103
|
}
|
|
3512
|
-
const { pathname } =
|
|
2104
|
+
const { pathname } = parseUrl(request.url);
|
|
3513
2105
|
if (pathname != null && websocketEndpoints[pathname]) {
|
|
3514
2106
|
const wss = websocketEndpoints[pathname];
|
|
3515
|
-
wss.handleUpgrade(request, socket, head, (socket
|
|
3516
|
-
wss.emit("connection", socket
|
|
2107
|
+
wss.handleUpgrade(request, socket, head, (socket) => {
|
|
2108
|
+
wss.emit("connection", socket, request);
|
|
3517
2109
|
});
|
|
3518
2110
|
} else socket.destroy();
|
|
3519
2111
|
};
|
|
@@ -3642,8 +2234,8 @@ var HMRServer = class extends WebSocketServer {
|
|
|
3642
2234
|
sendError(client, error) {
|
|
3643
2235
|
try {
|
|
3644
2236
|
this.send(client, JSON.stringify(error));
|
|
3645
|
-
} catch (error
|
|
3646
|
-
this.logger.error(`Failed to send HMR error message to client (clientId: ${client.id})`, error
|
|
2237
|
+
} catch (error) {
|
|
2238
|
+
this.logger.error(`Failed to send HMR error message to client (clientId: ${client.id})`, error);
|
|
3647
2239
|
}
|
|
3648
2240
|
}
|
|
3649
2241
|
cleanup(client) {
|
|
@@ -3674,12 +2266,12 @@ var HMRServer = class extends WebSocketServer {
|
|
|
3674
2266
|
};
|
|
3675
2267
|
this.logger.trace("HMR client message received", traceMessage);
|
|
3676
2268
|
} catch (error) {
|
|
3677
|
-
const message
|
|
3678
|
-
this.logger.error(message
|
|
2269
|
+
const message = "Failed to parse HMR client message";
|
|
2270
|
+
this.logger.error(message, error);
|
|
3679
2271
|
this.sendError(client, {
|
|
3680
2272
|
type: "InternalError",
|
|
3681
2273
|
errors: [{ description: error instanceof Error ? error.message : String(error) }],
|
|
3682
|
-
message
|
|
2274
|
+
message
|
|
3683
2275
|
});
|
|
3684
2276
|
return;
|
|
3685
2277
|
}
|
|
@@ -3740,7 +2332,7 @@ async function createDevServer(config, options) {
|
|
|
3740
2332
|
projectRoot,
|
|
3741
2333
|
port
|
|
3742
2334
|
});
|
|
3743
|
-
const emitter =
|
|
2335
|
+
const emitter = mitt();
|
|
3744
2336
|
const fastify = Fastify({
|
|
3745
2337
|
loggerInstance: new DevServerLogger(),
|
|
3746
2338
|
disableRequestLogging: true
|
|
@@ -3776,7 +2368,7 @@ async function createDevServer(config, options) {
|
|
|
3776
2368
|
bundlerPool,
|
|
3777
2369
|
reportEvent: (event) => {
|
|
3778
2370
|
reportEvent?.(event);
|
|
3779
|
-
config.reporter
|
|
2371
|
+
config.reporter?.update(event);
|
|
3780
2372
|
}
|
|
3781
2373
|
}).on("connection", (client) => emitter.emit("device.connected", { client })).on("message", (client, data) => emitter.emit("device.message", {
|
|
3782
2374
|
client,
|
|
@@ -3826,9 +2418,9 @@ async function createDevServer(config, options) {
|
|
|
3826
2418
|
}
|
|
3827
2419
|
async function invokeConfigureServer(server, plugins) {
|
|
3828
2420
|
const postConfigureServerHandlers = [];
|
|
3829
|
-
for (const plugin
|
|
3830
|
-
const context = createPluginContext(plugin
|
|
3831
|
-
const result = await plugin
|
|
2421
|
+
for (const plugin of plugins) {
|
|
2422
|
+
const context = createPluginContext(plugin.name);
|
|
2423
|
+
const result = await plugin.configureServer?.call(context, server);
|
|
3832
2424
|
if (typeof result === "function") postConfigureServerHandlers.push(result);
|
|
3833
2425
|
}
|
|
3834
2426
|
return { invokePostConfigureServer: async () => {
|
|
@@ -3878,7 +2470,7 @@ async function resolveScaledAssets(options) {
|
|
|
3878
2470
|
const files = fs.readdirSync(dirname);
|
|
3879
2471
|
const stripedBasename = stripSuffix(assetPath, context);
|
|
3880
2472
|
const suffixPattern = platformSuffixPattern(context);
|
|
3881
|
-
const assetRegExp =
|
|
2473
|
+
const assetRegExp = new RegExp(`${stripedBasename}(${SCALE_PATTERN})?(?:${suffixPattern})?${extension}$`);
|
|
3882
2474
|
const scaledAssets = {};
|
|
3883
2475
|
for (const file of files.sort((a, b) => getAssetPriority(b, context) - getAssetPriority(a, context))) {
|
|
3884
2476
|
const match = assetRegExp.exec(file);
|
|
@@ -3923,13 +2515,13 @@ function stripSuffix(assetPath, context) {
|
|
|
3923
2515
|
const basename = path.basename(assetPath);
|
|
3924
2516
|
const extension = path.extname(assetPath);
|
|
3925
2517
|
const suffixPattern = platformSuffixPattern(context);
|
|
3926
|
-
return basename.replace(
|
|
2518
|
+
return basename.replace(new RegExp(`(${SCALE_PATTERN})?(?:${suffixPattern})?${extension}$`), "");
|
|
3927
2519
|
}
|
|
3928
2520
|
function getAssetPriority(assetPath, context) {
|
|
3929
2521
|
const suffixPattern = platformSuffixPattern(context);
|
|
3930
|
-
if (
|
|
3931
|
-
else if (
|
|
3932
|
-
else if (
|
|
2522
|
+
if (new RegExp(`${SCALE_PATTERN}(?:${suffixPattern})`).test(assetPath)) return 3;
|
|
2523
|
+
else if (new RegExp(`(?:${suffixPattern})`).test(assetPath)) return 2;
|
|
2524
|
+
else if (new RegExp(`${SCALE_PATTERN}`).test(assetPath)) return 1;
|
|
3933
2525
|
return 0;
|
|
3934
2526
|
}
|
|
3935
2527
|
function addSuffix(assetPath, context, options) {
|
|
@@ -4012,10 +2604,10 @@ async function copyAssetsToDestination(options) {
|
|
|
4012
2604
|
return Promise.all(assets.map((asset) => {
|
|
4013
2605
|
return Promise.all(asset.scales.map(async (scale) => {
|
|
4014
2606
|
if (platform !== "android") {
|
|
4015
|
-
const from
|
|
4016
|
-
const to
|
|
4017
|
-
mkdirWithAssertPath(to
|
|
4018
|
-
return fs.copyFileSync(from
|
|
2607
|
+
const from = resolveAssetPath(asset.id, context, scale);
|
|
2608
|
+
const to = path.join(assetsDir, getIosAssetDestinationPath(asset, scale));
|
|
2609
|
+
mkdirWithAssertPath(to);
|
|
2610
|
+
return fs.copyFileSync(from, to);
|
|
4019
2611
|
}
|
|
4020
2612
|
const from = resolveAssetPath(asset.id, context, scale);
|
|
4021
2613
|
const to = path.join(assetsDir, getAndroidAssetDestinationPath(asset, scale));
|
|
@@ -4062,15 +2654,15 @@ function generateAssetRegistryCode(assetRegistryPath, asset) {
|
|
|
4062
2654
|
//#endregion
|
|
4063
2655
|
//#region src/core/plugins/utils/transform-utils.ts
|
|
4064
2656
|
const TRANSFORM_FLAGS_KEY = Symbol("transform-flags");
|
|
4065
|
-
let TransformFlag = /* @__PURE__ */ function(TransformFlag
|
|
4066
|
-
TransformFlag
|
|
4067
|
-
TransformFlag
|
|
4068
|
-
TransformFlag
|
|
4069
|
-
TransformFlag
|
|
4070
|
-
return TransformFlag
|
|
2657
|
+
let TransformFlag = /* @__PURE__ */ function(TransformFlag) {
|
|
2658
|
+
TransformFlag[TransformFlag["NONE"] = 0] = "NONE";
|
|
2659
|
+
TransformFlag[TransformFlag["CODEGEN_REQUIRED"] = 1] = "CODEGEN_REQUIRED";
|
|
2660
|
+
TransformFlag[TransformFlag["STRIP_FLOW_REQUIRED"] = 2] = "STRIP_FLOW_REQUIRED";
|
|
2661
|
+
TransformFlag[TransformFlag["SKIP_ALL"] = 128] = "SKIP_ALL";
|
|
2662
|
+
return TransformFlag;
|
|
4071
2663
|
}({});
|
|
4072
|
-
function setFlag(context, id
|
|
4073
|
-
const moduleInfo = context.getModuleInfo(id
|
|
2664
|
+
function setFlag(context, id, flag, options) {
|
|
2665
|
+
const moduleInfo = context.getModuleInfo(id);
|
|
4074
2666
|
if (moduleInfo && hasFlag(moduleInfo.meta)) {
|
|
4075
2667
|
if (options?.override) moduleInfo.meta[TRANSFORM_FLAGS_KEY] = flag;
|
|
4076
2668
|
else moduleInfo.meta[TRANSFORM_FLAGS_KEY] |= flag;
|
|
@@ -4080,8 +2672,8 @@ function setFlag(context, id$1, flag, options) {
|
|
|
4080
2672
|
function hasFlag(meta) {
|
|
4081
2673
|
return TRANSFORM_FLAGS_KEY in meta;
|
|
4082
2674
|
}
|
|
4083
|
-
function getFlag(context, id
|
|
4084
|
-
return getFlagFromModuleInfo(context.getModuleInfo(id
|
|
2675
|
+
function getFlag(context, id) {
|
|
2676
|
+
return getFlagFromModuleInfo(context.getModuleInfo(id));
|
|
4085
2677
|
}
|
|
4086
2678
|
function getFlagFromModuleInfo(moduleInfo) {
|
|
4087
2679
|
if (moduleInfo && hasFlag(moduleInfo.meta)) return moduleInfo.meta[TRANSFORM_FLAGS_KEY];
|
|
@@ -4094,18 +2686,18 @@ function withTransformBoundary(plugins, options) {
|
|
|
4094
2686
|
name: "rollipop:transform-initializer",
|
|
4095
2687
|
transform: {
|
|
4096
2688
|
order: "pre",
|
|
4097
|
-
handler(_code, id
|
|
4098
|
-
if (context.state.hmrUpdates.has(id
|
|
4099
|
-
context.state.hmrUpdates.delete(id
|
|
4100
|
-
return { meta: setFlag(this, id
|
|
2689
|
+
handler(_code, id) {
|
|
2690
|
+
if (context.state.hmrUpdates.has(id)) {
|
|
2691
|
+
context.state.hmrUpdates.delete(id);
|
|
2692
|
+
return { meta: setFlag(this, id, TransformFlag.NONE, { override: true }) };
|
|
4101
2693
|
}
|
|
4102
2694
|
}
|
|
4103
2695
|
}
|
|
4104
2696
|
},
|
|
4105
2697
|
{
|
|
4106
2698
|
name: "rollipop:transform-change-watcher",
|
|
4107
|
-
watchChange(id
|
|
4108
|
-
context.state.hmrUpdates.add(id
|
|
2699
|
+
watchChange(id) {
|
|
2700
|
+
context.state.hmrUpdates.add(id);
|
|
4109
2701
|
}
|
|
4110
2702
|
},
|
|
4111
2703
|
options?.beforeTransform,
|
|
@@ -4122,8 +2714,8 @@ function getPersistCachePlugins(options) {
|
|
|
4122
2714
|
afterTransform: null
|
|
4123
2715
|
};
|
|
4124
2716
|
const { sourceExtensions, context } = options;
|
|
4125
|
-
const includePattern =
|
|
4126
|
-
const filter = [exclude(id(/@oxc-project\+runtime/)), include(id(includePattern))];
|
|
2717
|
+
const includePattern = new RegExp(`\\.(?:${sourceExtensions.join("|")})$`);
|
|
2718
|
+
const filter = [exclude(or(id(/rolldown\/runtime/), id(/@oxc-project\+runtime/))), include(id(includePattern))];
|
|
4127
2719
|
let cacheHits = 0;
|
|
4128
2720
|
return {
|
|
4129
2721
|
beforeTransform: {
|
|
@@ -4137,15 +2729,15 @@ function getPersistCachePlugins(options) {
|
|
|
4137
2729
|
transform: {
|
|
4138
2730
|
order: "pre",
|
|
4139
2731
|
filter,
|
|
4140
|
-
handler(_code, id
|
|
4141
|
-
const key = getCacheKey(id
|
|
2732
|
+
handler(_code, id) {
|
|
2733
|
+
const key = getCacheKey(id, context.id);
|
|
4142
2734
|
const cache = context.cache.get(key);
|
|
4143
2735
|
if (cache != null) {
|
|
4144
2736
|
cacheHits++;
|
|
4145
2737
|
return {
|
|
4146
2738
|
code: cache,
|
|
4147
2739
|
moduleType: "tsx",
|
|
4148
|
-
meta: setFlag(this, id
|
|
2740
|
+
meta: setFlag(this, id, TransformFlag.SKIP_ALL)
|
|
4149
2741
|
};
|
|
4150
2742
|
}
|
|
4151
2743
|
}
|
|
@@ -4156,9 +2748,9 @@ function getPersistCachePlugins(options) {
|
|
|
4156
2748
|
transform: {
|
|
4157
2749
|
order: "post",
|
|
4158
2750
|
filter,
|
|
4159
|
-
handler(code, id
|
|
4160
|
-
if (getFlag(this, id
|
|
4161
|
-
context.cache.set(getCacheKey(id
|
|
2751
|
+
handler(code, id) {
|
|
2752
|
+
if (getFlag(this, id) & TransformFlag.SKIP_ALL) return;
|
|
2753
|
+
context.cache.set(getCacheKey(id, context.id), code);
|
|
4162
2754
|
}
|
|
4163
2755
|
},
|
|
4164
2756
|
buildEnd() {
|
|
@@ -4167,60 +2759,60 @@ function getPersistCachePlugins(options) {
|
|
|
4167
2759
|
}
|
|
4168
2760
|
};
|
|
4169
2761
|
}
|
|
4170
|
-
function getCacheKey(id
|
|
4171
|
-
const { mtimeMs } = fs.statSync(id
|
|
4172
|
-
return xxhash(`${id
|
|
2762
|
+
function getCacheKey(id, buildHash) {
|
|
2763
|
+
const { mtimeMs } = fs.statSync(id);
|
|
2764
|
+
return xxhash(`${id}${buildHash}${mtimeMs}`);
|
|
4173
2765
|
}
|
|
4174
2766
|
/**
|
|
4175
2767
|
* Enhance a plugin to cache the result. (transform hook only)
|
|
4176
2768
|
*/
|
|
4177
|
-
function cacheable(plugin
|
|
2769
|
+
function cacheable(plugin) {
|
|
4178
2770
|
let configured = false;
|
|
4179
|
-
const originalTransform = plugin
|
|
2771
|
+
const originalTransform = plugin.transform;
|
|
4180
2772
|
if (typeof originalTransform === "function") {
|
|
4181
|
-
plugin
|
|
4182
|
-
if (getFlag(this, id
|
|
4183
|
-
return originalTransform.call(this, code, id
|
|
2773
|
+
plugin.transform = function(code, id, meta) {
|
|
2774
|
+
if (getFlag(this, id) & TransformFlag.SKIP_ALL) return;
|
|
2775
|
+
return originalTransform.call(this, code, id, meta);
|
|
4184
2776
|
};
|
|
4185
2777
|
configured = true;
|
|
4186
2778
|
}
|
|
4187
2779
|
if (typeof originalTransform === "object") {
|
|
4188
|
-
plugin
|
|
2780
|
+
plugin.transform = {
|
|
4189
2781
|
...originalTransform,
|
|
4190
|
-
handler(code, id
|
|
4191
|
-
if (getFlag(this, id
|
|
4192
|
-
return originalTransform.handler.call(this, code, id
|
|
2782
|
+
handler(code, id, meta) {
|
|
2783
|
+
if (getFlag(this, id) & TransformFlag.SKIP_ALL) return;
|
|
2784
|
+
return originalTransform.handler.call(this, code, id, meta);
|
|
4193
2785
|
}
|
|
4194
2786
|
};
|
|
4195
2787
|
configured = true;
|
|
4196
2788
|
}
|
|
4197
|
-
if (configured) plugin
|
|
4198
|
-
else logger$1.warn(`Plugin '${plugin
|
|
4199
|
-
return plugin
|
|
2789
|
+
if (configured) plugin.name = `${plugin.name}:cacheable`;
|
|
2790
|
+
else logger$1.warn(`Plugin '${plugin.name}' is could not be cached`);
|
|
2791
|
+
return plugin;
|
|
4200
2792
|
}
|
|
4201
2793
|
|
|
4202
2794
|
//#endregion
|
|
4203
2795
|
//#region src/core/plugins/utils/source.ts
|
|
4204
2796
|
const TS_EXTENSION_REGEXP = /\.tsx?$/;
|
|
4205
|
-
function isTS(id
|
|
4206
|
-
return TS_EXTENSION_REGEXP.test(id
|
|
2797
|
+
function isTS(id) {
|
|
2798
|
+
return TS_EXTENSION_REGEXP.test(id);
|
|
4207
2799
|
}
|
|
4208
|
-
function isJSX(id
|
|
4209
|
-
return id
|
|
2800
|
+
function isJSX(id) {
|
|
2801
|
+
return id.endsWith("x");
|
|
4210
2802
|
}
|
|
4211
2803
|
|
|
4212
2804
|
//#endregion
|
|
4213
2805
|
//#region src/core/plugins/react-native-plugin.ts
|
|
4214
2806
|
function reactNativePlugin(config, options) {
|
|
4215
2807
|
const { buildType, flowFilter, codegenFilter, assetsDir, assetExtensions, assetRegistryPath } = options;
|
|
4216
|
-
const assetExtensionRegex =
|
|
2808
|
+
const assetExtensionRegex = new RegExp(`\\.(?:${assetExtensions.join("|")})$`);
|
|
4217
2809
|
const codegenPlugin = {
|
|
4218
2810
|
name: "rollipop:react-native-codegen-marker",
|
|
4219
2811
|
transform: {
|
|
4220
2812
|
order: "pre",
|
|
4221
2813
|
filter: codegenFilter,
|
|
4222
|
-
handler(_code, id
|
|
4223
|
-
return { meta: setFlag(this, id
|
|
2814
|
+
handler(_code, id) {
|
|
2815
|
+
return { meta: setFlag(this, id, TransformFlag.CODEGEN_REQUIRED) };
|
|
4224
2816
|
}
|
|
4225
2817
|
}
|
|
4226
2818
|
};
|
|
@@ -4229,11 +2821,11 @@ function reactNativePlugin(config, options) {
|
|
|
4229
2821
|
transform: {
|
|
4230
2822
|
order: "pre",
|
|
4231
2823
|
filter: flowFilter,
|
|
4232
|
-
handler(code, id
|
|
4233
|
-
const flags = getFlag(this, id
|
|
2824
|
+
handler(code, id) {
|
|
2825
|
+
const flags = getFlag(this, id);
|
|
4234
2826
|
if (flags & TransformFlag.SKIP_ALL) return;
|
|
4235
|
-
if (flags & TransformFlag.CODEGEN_REQUIRED) return { meta: setFlag(this, id
|
|
4236
|
-
const result = generateSourceFromAst(stripFlowSyntax(code), id
|
|
2827
|
+
if (flags & TransformFlag.CODEGEN_REQUIRED) return { meta: setFlag(this, id, TransformFlag.STRIP_FLOW_REQUIRED) };
|
|
2828
|
+
const result = generateSourceFromAst(stripFlowSyntax(code), id);
|
|
4237
2829
|
return {
|
|
4238
2830
|
code: result.code,
|
|
4239
2831
|
map: result.map,
|
|
@@ -4247,18 +2839,18 @@ function reactNativePlugin(config, options) {
|
|
|
4247
2839
|
name: "rollipop:react-native-asset",
|
|
4248
2840
|
load: {
|
|
4249
2841
|
filter: [include(id(assetExtensionRegex))],
|
|
4250
|
-
async handler(id
|
|
4251
|
-
this.debug(`Asset ${id
|
|
2842
|
+
async handler(id) {
|
|
2843
|
+
this.debug(`Asset ${id} found`);
|
|
4252
2844
|
const assetData = await resolveScaledAssets({
|
|
4253
2845
|
projectRoot: config.root,
|
|
4254
|
-
assetPath: id
|
|
2846
|
+
assetPath: id,
|
|
4255
2847
|
platform: options.platform,
|
|
4256
2848
|
preferNativePlatform: config.resolver.preferNativePlatform
|
|
4257
2849
|
});
|
|
4258
2850
|
assets.push(assetData);
|
|
4259
2851
|
return {
|
|
4260
2852
|
code: generateAssetRegistryCode(assetRegistryPath, assetData),
|
|
4261
|
-
meta: setFlag(this, id
|
|
2853
|
+
meta: setFlag(this, id, TransformFlag.SKIP_ALL),
|
|
4262
2854
|
moduleType: "js"
|
|
4263
2855
|
};
|
|
4264
2856
|
}
|
|
@@ -4286,15 +2878,15 @@ function reactNativePlugin(config, options) {
|
|
|
4286
2878
|
name: "rollipop:react-native-replace-hmr-client",
|
|
4287
2879
|
resolveId: {
|
|
4288
2880
|
filter: [include(id(/\/HMRClient\.js$/))],
|
|
4289
|
-
async handler(id
|
|
4290
|
-
const resolvedId = await this.resolve(id
|
|
2881
|
+
async handler(id, importer) {
|
|
2882
|
+
const resolvedId = await this.resolve(id, importer, { skipSelf: true });
|
|
4291
2883
|
if (resolvedId?.id === hmrClientPath) await this.load({ id: resolvedId.id });
|
|
4292
2884
|
}
|
|
4293
2885
|
},
|
|
4294
2886
|
load: {
|
|
4295
2887
|
filter: [include(id(exactRegex(hmrClientPath)))],
|
|
4296
|
-
handler(id
|
|
4297
|
-
this.debug(`Replacing HMR client: ${id
|
|
2888
|
+
handler(id) {
|
|
2889
|
+
this.debug(`Replacing HMR client: ${id}`);
|
|
4298
2890
|
return hmrConfig?.clientImplement ?? defaultRuntimeImplements.clientImplement;
|
|
4299
2891
|
}
|
|
4300
2892
|
}
|
|
@@ -4315,17 +2907,17 @@ const DEFAULT_EXCLUDE_REGEX = /\/node_modules\//;
|
|
|
4315
2907
|
const HAS_REFRESH_REGEX = /\$RefreshReg\$\(/;
|
|
4316
2908
|
const ONLY_REACT_COMPONENT_REGEX = /extends\s+(?:React\.)?(?:Pure)?Component/;
|
|
4317
2909
|
function reactRefreshPlugin(options) {
|
|
4318
|
-
const { include
|
|
2910
|
+
const { include = DEFAULT_INCLUDE_REGEX, exclude = DEFAULT_EXCLUDE_REGEX } = options ?? {};
|
|
4319
2911
|
return [{
|
|
4320
2912
|
name: "rollipop:transform-react-refresh",
|
|
4321
2913
|
transform: {
|
|
4322
2914
|
filter: { id: {
|
|
4323
|
-
include
|
|
4324
|
-
exclude
|
|
2915
|
+
include,
|
|
2916
|
+
exclude
|
|
4325
2917
|
} },
|
|
4326
|
-
handler(code, id
|
|
4327
|
-
if (getFlag(this, id
|
|
4328
|
-
const result = transformSync(id
|
|
2918
|
+
handler(code, id) {
|
|
2919
|
+
if (getFlag(this, id) & TransformFlag.SKIP_ALL) return;
|
|
2920
|
+
const result = transformSync(id, code, {
|
|
4329
2921
|
sourcemap: true,
|
|
4330
2922
|
jsx: {
|
|
4331
2923
|
runtime: "automatic",
|
|
@@ -4346,15 +2938,15 @@ function reactRefreshPlugin(options) {
|
|
|
4346
2938
|
name: "rollipop:react-refresh-boundary",
|
|
4347
2939
|
transform: {
|
|
4348
2940
|
filter: { id: {
|
|
4349
|
-
include
|
|
4350
|
-
exclude
|
|
2941
|
+
include,
|
|
2942
|
+
exclude
|
|
4351
2943
|
} },
|
|
4352
|
-
handler(code, id
|
|
4353
|
-
if (getFlag(this, id
|
|
2944
|
+
handler(code, id, meta) {
|
|
2945
|
+
if (getFlag(this, id) & TransformFlag.SKIP_ALL) return;
|
|
4354
2946
|
const { magicString } = meta;
|
|
4355
2947
|
invariant(magicString != null, "magicString is not available");
|
|
4356
2948
|
applyRefreshWrapper(magicString, {
|
|
4357
|
-
id
|
|
2949
|
+
id,
|
|
4358
2950
|
hasRefresh: HAS_REFRESH_REGEX.test(code),
|
|
4359
2951
|
onlyReactComponent: ONLY_REACT_COMPONENT_REGEX.test(code)
|
|
4360
2952
|
});
|
|
@@ -4364,12 +2956,12 @@ function reactRefreshPlugin(options) {
|
|
|
4364
2956
|
}];
|
|
4365
2957
|
}
|
|
4366
2958
|
function applyRefreshWrapper(s, options) {
|
|
4367
|
-
const { id
|
|
2959
|
+
const { id, hasRefresh, onlyReactComponent } = options;
|
|
4368
2960
|
if (!(hasRefresh || onlyReactComponent)) return;
|
|
4369
2961
|
if (hasRefresh) s.prepend(`
|
|
4370
2962
|
var __prev$RefreshReg$ = global.$RefreshReg$;
|
|
4371
2963
|
var __prev$RefreshSig$ = global.$RefreshSig$;
|
|
4372
|
-
global.$RefreshReg$ = function(type, id) { return __ReactRefresh.register(type, ${JSON.stringify(id
|
|
2964
|
+
global.$RefreshReg$ = function(type, id) { return __ReactRefresh.register(type, ${JSON.stringify(id)} + ' ' + id) }
|
|
4373
2965
|
global.$RefreshSig$ = function() { return __ReactRefresh.createSignatureFunctionForTransform(); }
|
|
4374
2966
|
`);
|
|
4375
2967
|
s.append(`
|
|
@@ -4406,12 +2998,12 @@ function preludePlugin(options) {
|
|
|
4406
2998
|
meta: { [IS_ENTRY]: true }
|
|
4407
2999
|
};
|
|
4408
3000
|
} },
|
|
4409
|
-
load: { handler(id
|
|
3001
|
+
load: { handler(id) {
|
|
4410
3002
|
if (processed) return;
|
|
4411
|
-
const moduleInfo = this.getModuleInfo(id
|
|
3003
|
+
const moduleInfo = this.getModuleInfo(id);
|
|
4412
3004
|
if (moduleInfo && isEntry(moduleInfo.meta)) {
|
|
4413
|
-
this.debug(`Prelude plugin found entry ${id
|
|
4414
|
-
const modifiedSource = [preludeImportStatements, fs.readFileSync(id
|
|
3005
|
+
this.debug(`Prelude plugin found entry ${id}`);
|
|
3006
|
+
const modifiedSource = [preludeImportStatements, fs.readFileSync(id, "utf-8")].join("\n");
|
|
4415
3007
|
processed = true;
|
|
4416
3008
|
return modifiedSource;
|
|
4417
3009
|
}
|
|
@@ -4422,47 +3014,6 @@ function isEntry(meta) {
|
|
|
4422
3014
|
return IS_ENTRY in meta;
|
|
4423
3015
|
}
|
|
4424
3016
|
|
|
4425
|
-
//#endregion
|
|
4426
|
-
//#region src/core/plugins/status-plugin.ts
|
|
4427
|
-
function statusPlugin(options) {
|
|
4428
|
-
let totalModules = options?.initialTotalModules ?? 0;
|
|
4429
|
-
let startedAt = 0;
|
|
4430
|
-
let transformedModules = 0;
|
|
4431
|
-
let unknownTotalModules = totalModules === 0;
|
|
4432
|
-
return {
|
|
4433
|
-
name: "rollipop:status",
|
|
4434
|
-
buildStart() {
|
|
4435
|
-
startedAt = performance.now();
|
|
4436
|
-
transformedModules = 0;
|
|
4437
|
-
options?.onStart?.();
|
|
4438
|
-
},
|
|
4439
|
-
buildEnd(error) {
|
|
4440
|
-
if (transformedModules !== 0) totalModules = transformedModules;
|
|
4441
|
-
unknownTotalModules = false;
|
|
4442
|
-
options?.onEnd?.({
|
|
4443
|
-
error,
|
|
4444
|
-
totalModules,
|
|
4445
|
-
duration: performance.now() - startedAt
|
|
4446
|
-
});
|
|
4447
|
-
},
|
|
4448
|
-
transform: {
|
|
4449
|
-
order: "post",
|
|
4450
|
-
handler(_code, id$1) {
|
|
4451
|
-
++transformedModules;
|
|
4452
|
-
if (!unknownTotalModules && totalModules < transformedModules) totalModules = transformedModules;
|
|
4453
|
-
options?.onTransform?.({
|
|
4454
|
-
id: id$1,
|
|
4455
|
-
totalModules: unknownTotalModules ? void 0 : totalModules,
|
|
4456
|
-
transformedModules
|
|
4457
|
-
});
|
|
4458
|
-
}
|
|
4459
|
-
},
|
|
4460
|
-
watchChange(id$1) {
|
|
4461
|
-
options?.onWatchChange?.(id$1);
|
|
4462
|
-
}
|
|
4463
|
-
};
|
|
4464
|
-
}
|
|
4465
|
-
|
|
4466
3017
|
//#endregion
|
|
4467
3018
|
//#region src/core/plugins/json-plugin.ts
|
|
4468
3019
|
function jsonPlugin() {
|
|
@@ -4470,10 +3021,10 @@ function jsonPlugin() {
|
|
|
4470
3021
|
name: "rollipop:json",
|
|
4471
3022
|
load: {
|
|
4472
3023
|
filter: [include(id(/\.json$/))],
|
|
4473
|
-
handler(id
|
|
3024
|
+
handler(id) {
|
|
4474
3025
|
return {
|
|
4475
|
-
code: `export = ${fs.readFileSync(id
|
|
4476
|
-
meta: setFlag(this, id
|
|
3026
|
+
code: `export = ${fs.readFileSync(id, "utf-8")};`,
|
|
3027
|
+
meta: setFlag(this, id, TransformFlag.SKIP_ALL),
|
|
4477
3028
|
moduleType: "ts"
|
|
4478
3029
|
};
|
|
4479
3030
|
}
|
|
@@ -4489,13 +3040,13 @@ function svgPlugin(options) {
|
|
|
4489
3040
|
name: "rollipop:svg",
|
|
4490
3041
|
load: {
|
|
4491
3042
|
filter: { id: /\.svg$/ },
|
|
4492
|
-
async handler(id
|
|
3043
|
+
async handler(id) {
|
|
4493
3044
|
return {
|
|
4494
|
-
code: await transform(fs.readFileSync(id
|
|
3045
|
+
code: await transform(fs.readFileSync(id, "utf-8"), {
|
|
4495
3046
|
template: defaultTemplate,
|
|
4496
3047
|
plugins: [__require.resolve("@svgr/plugin-jsx")],
|
|
4497
3048
|
native: true
|
|
4498
|
-
}, { filePath: id
|
|
3049
|
+
}, { filePath: id }),
|
|
4499
3050
|
moduleType: "jsx"
|
|
4500
3051
|
};
|
|
4501
3052
|
}
|
|
@@ -4518,7 +3069,7 @@ export default ${SVG_COMPONENT_NAME};`;
|
|
|
4518
3069
|
//#endregion
|
|
4519
3070
|
//#region src/utils/babel.ts
|
|
4520
3071
|
function mergeBabelOptions(baseOptions, ...options) {
|
|
4521
|
-
return options.reduce((acc, options
|
|
3072
|
+
return options.reduce((acc, options) => mergeWith(acc, options, merge$2), baseOptions);
|
|
4522
3073
|
}
|
|
4523
3074
|
function merge$2(target, source, key) {
|
|
4524
3075
|
if (key === "plugins") return [...target ?? [], ...source ?? []];
|
|
@@ -4530,47 +3081,47 @@ function merge$2(target, source, key) {
|
|
|
4530
3081
|
function babelPlugin(options) {
|
|
4531
3082
|
const { rules = [] } = options ?? {};
|
|
4532
3083
|
const babelOptionsById = /* @__PURE__ */ new Map();
|
|
4533
|
-
const babelRules = rules.map(({ filter, options
|
|
3084
|
+
const babelRules = rules.map(({ filter, options }, index) => {
|
|
4534
3085
|
return {
|
|
4535
3086
|
name: `rollipop:babel-rule-${index}`,
|
|
4536
3087
|
transform: {
|
|
4537
3088
|
filter,
|
|
4538
|
-
handler(code, id
|
|
4539
|
-
const existingBabelOptions = babelOptionsById.get(id
|
|
4540
|
-
const resolvedOptions = typeof options
|
|
4541
|
-
existingBabelOptions ? existingBabelOptions.push(resolvedOptions) : babelOptionsById.set(id
|
|
3089
|
+
handler(code, id) {
|
|
3090
|
+
const existingBabelOptions = babelOptionsById.get(id);
|
|
3091
|
+
const resolvedOptions = typeof options === "function" ? options(code, id) : options;
|
|
3092
|
+
existingBabelOptions ? existingBabelOptions.push(resolvedOptions) : babelOptionsById.set(id, [resolvedOptions]);
|
|
4542
3093
|
}
|
|
4543
3094
|
}
|
|
4544
3095
|
};
|
|
4545
3096
|
});
|
|
4546
|
-
const babelPlugin
|
|
3097
|
+
const babelPlugin = {
|
|
4547
3098
|
name: "rollipop:babel",
|
|
4548
3099
|
buildStart() {
|
|
4549
3100
|
babelOptionsById.clear();
|
|
4550
3101
|
},
|
|
4551
|
-
transform: { handler(code, id
|
|
4552
|
-
const flags = getFlag(this, id
|
|
3102
|
+
transform: { handler(code, id) {
|
|
3103
|
+
const flags = getFlag(this, id);
|
|
4553
3104
|
if (flags & TransformFlag.SKIP_ALL) return;
|
|
4554
|
-
const babelOptions = babelOptionsById.get(id
|
|
3105
|
+
const babelOptions = babelOptionsById.get(id) ?? [];
|
|
4555
3106
|
if (!(flags & TransformFlag.CODEGEN_REQUIRED || babelOptions.length > 0)) return;
|
|
4556
|
-
const baseOptions = getPreset$1(flags, id
|
|
3107
|
+
const baseOptions = getPreset$1(flags, id);
|
|
4557
3108
|
const result = babel.transformSync(code, {
|
|
4558
|
-
filename: id
|
|
3109
|
+
filename: id,
|
|
4559
3110
|
babelrc: false,
|
|
4560
3111
|
configFile: false,
|
|
4561
3112
|
sourceMaps: true,
|
|
4562
3113
|
...mergeBabelOptions(baseOptions, ...babelOptions)
|
|
4563
3114
|
});
|
|
4564
|
-
invariant(result?.code, `Failed to transform with babel: ${id
|
|
3115
|
+
invariant(result?.code, `Failed to transform with babel: ${id}`);
|
|
4565
3116
|
return {
|
|
4566
3117
|
code: result.code,
|
|
4567
3118
|
map: result.map
|
|
4568
3119
|
};
|
|
4569
3120
|
} }
|
|
4570
3121
|
};
|
|
4571
|
-
return [...babelRules, babelPlugin
|
|
3122
|
+
return [...babelRules, babelPlugin].map(cacheable);
|
|
4572
3123
|
}
|
|
4573
|
-
function getPreset$1(flags, id
|
|
3124
|
+
function getPreset$1(flags, id) {
|
|
4574
3125
|
const presets = [];
|
|
4575
3126
|
const plugins = [];
|
|
4576
3127
|
let parserOpts = null;
|
|
@@ -4580,8 +3131,8 @@ function getPreset$1(flags, id$1) {
|
|
|
4580
3131
|
parseLangTypes: "flow",
|
|
4581
3132
|
reactRuntimeTarget: "19"
|
|
4582
3133
|
}], __require.resolve("@babel/plugin-transform-flow-strip-types"));
|
|
4583
|
-
} else if (isTS(id
|
|
4584
|
-
isTSX: isJSX(id
|
|
3134
|
+
} else if (isTS(id)) plugins.push([__require.resolve("@babel/plugin-transform-typescript"), {
|
|
3135
|
+
isTSX: isJSX(id),
|
|
4585
3136
|
allowNamespaces: true
|
|
4586
3137
|
}]);
|
|
4587
3138
|
if (flags & TransformFlag.CODEGEN_REQUIRED) plugins.push([__require.resolve("@react-native/babel-plugin-codegen")]);
|
|
@@ -4596,7 +3147,7 @@ function getPreset$1(flags, id$1) {
|
|
|
4596
3147
|
//#endregion
|
|
4597
3148
|
//#region src/utils/swc.ts
|
|
4598
3149
|
function mergeSwcOptions(baseOptions, ...options) {
|
|
4599
|
-
return options.reduce((acc, options
|
|
3150
|
+
return options.reduce((acc, options) => mergeWith(acc, options, merge$1), baseOptions);
|
|
4600
3151
|
}
|
|
4601
3152
|
function merge$1(target, source, key) {
|
|
4602
3153
|
if (key === "plugins") return [...target ?? [], ...source ?? []];
|
|
@@ -4607,30 +3158,30 @@ function merge$1(target, source, key) {
|
|
|
4607
3158
|
function swcPlugin(options) {
|
|
4608
3159
|
const { rules = [] } = options ?? {};
|
|
4609
3160
|
const swcOptionsById = /* @__PURE__ */ new Map();
|
|
4610
|
-
const swcRules = rules.map(({ filter, options
|
|
3161
|
+
const swcRules = rules.map(({ filter, options }, index) => {
|
|
4611
3162
|
return {
|
|
4612
3163
|
name: `rollipop:swc-rule-${index}`,
|
|
4613
3164
|
transform: {
|
|
4614
3165
|
filter,
|
|
4615
|
-
handler(code, id
|
|
4616
|
-
const existingBabelOptions = swcOptionsById.get(id
|
|
4617
|
-
const resolvedOptions = typeof options
|
|
4618
|
-
existingBabelOptions ? existingBabelOptions.push(resolvedOptions) : swcOptionsById.set(id
|
|
3166
|
+
handler(code, id) {
|
|
3167
|
+
const existingBabelOptions = swcOptionsById.get(id);
|
|
3168
|
+
const resolvedOptions = typeof options === "function" ? options(code, id) : options;
|
|
3169
|
+
existingBabelOptions ? existingBabelOptions.push(resolvedOptions) : swcOptionsById.set(id, [resolvedOptions]);
|
|
4619
3170
|
}
|
|
4620
3171
|
}
|
|
4621
3172
|
};
|
|
4622
3173
|
});
|
|
4623
|
-
const swcPlugin
|
|
3174
|
+
const swcPlugin = {
|
|
4624
3175
|
name: "rollipop:swc",
|
|
4625
3176
|
buildStart() {
|
|
4626
3177
|
swcOptionsById.clear();
|
|
4627
3178
|
},
|
|
4628
|
-
transform: { handler(code, id
|
|
4629
|
-
if (getFlag(this, id
|
|
4630
|
-
const swcOptions = swcOptionsById.get(id
|
|
3179
|
+
transform: { handler(code, id) {
|
|
3180
|
+
if (getFlag(this, id) & TransformFlag.SKIP_ALL) return;
|
|
3181
|
+
const swcOptions = swcOptionsById.get(id) ?? [];
|
|
4631
3182
|
const baseOptions = getPreset();
|
|
4632
3183
|
const result = swc.transformSync(code, {
|
|
4633
|
-
filename: id
|
|
3184
|
+
filename: id,
|
|
4634
3185
|
configFile: false,
|
|
4635
3186
|
swcrc: false,
|
|
4636
3187
|
sourceMaps: true,
|
|
@@ -4643,7 +3194,7 @@ function swcPlugin(options) {
|
|
|
4643
3194
|
};
|
|
4644
3195
|
} }
|
|
4645
3196
|
};
|
|
4646
|
-
return [...swcRules, swcPlugin
|
|
3197
|
+
return [...swcRules, swcPlugin].map(cacheable);
|
|
4647
3198
|
}
|
|
4648
3199
|
function getPreset() {
|
|
4649
3200
|
return {
|
|
@@ -4665,14 +3216,64 @@ function getPreset() {
|
|
|
4665
3216
|
};
|
|
4666
3217
|
}
|
|
4667
3218
|
|
|
3219
|
+
//#endregion
|
|
3220
|
+
//#region src/core/plugins/reporter-plugin.ts
|
|
3221
|
+
function reporterPlugin(options) {
|
|
3222
|
+
const { reporter, initialTotalModules = 0 } = options ?? {};
|
|
3223
|
+
let totalModules = initialTotalModules;
|
|
3224
|
+
let startedAt = 0;
|
|
3225
|
+
let transformedModules = 0;
|
|
3226
|
+
let unknownTotalModules = totalModules === 0;
|
|
3227
|
+
return {
|
|
3228
|
+
name: "rollipop:status",
|
|
3229
|
+
buildStart() {
|
|
3230
|
+
startedAt = performance.now();
|
|
3231
|
+
transformedModules = 0;
|
|
3232
|
+
reporter?.update({ type: "bundle_build_started" });
|
|
3233
|
+
},
|
|
3234
|
+
buildEnd(error) {
|
|
3235
|
+
const endedAt = performance.now();
|
|
3236
|
+
if (transformedModules !== 0) totalModules = transformedModules;
|
|
3237
|
+
unknownTotalModules = false;
|
|
3238
|
+
reporter?.update(error == null ? {
|
|
3239
|
+
type: "bundle_build_done",
|
|
3240
|
+
totalModules,
|
|
3241
|
+
duration: endedAt - startedAt
|
|
3242
|
+
} : {
|
|
3243
|
+
type: "bundle_build_failed",
|
|
3244
|
+
error
|
|
3245
|
+
});
|
|
3246
|
+
},
|
|
3247
|
+
transform: {
|
|
3248
|
+
order: "post",
|
|
3249
|
+
handler(_code, id) {
|
|
3250
|
+
++transformedModules;
|
|
3251
|
+
if (!unknownTotalModules && totalModules < transformedModules) totalModules = transformedModules;
|
|
3252
|
+
reporter?.update({
|
|
3253
|
+
type: "transform",
|
|
3254
|
+
id,
|
|
3255
|
+
totalModules: unknownTotalModules ? void 0 : totalModules,
|
|
3256
|
+
transformedModules
|
|
3257
|
+
});
|
|
3258
|
+
}
|
|
3259
|
+
},
|
|
3260
|
+
watchChange(id) {
|
|
3261
|
+
reporter?.update({
|
|
3262
|
+
type: "watch_change",
|
|
3263
|
+
id
|
|
3264
|
+
});
|
|
3265
|
+
}
|
|
3266
|
+
};
|
|
3267
|
+
}
|
|
3268
|
+
|
|
4668
3269
|
//#endregion
|
|
4669
3270
|
//#region src/core/rolldown.ts
|
|
4670
3271
|
resolveRolldownOptions.cache = /* @__PURE__ */ new Map();
|
|
4671
3272
|
async function resolveRolldownOptions(context, config, buildOptions, devEngineOptions) {
|
|
4672
3273
|
const cachedOptions = resolveRolldownOptions.cache.get(context.id);
|
|
4673
3274
|
if (cachedOptions != null) return cachedOptions;
|
|
4674
|
-
const { platform, dev
|
|
4675
|
-
const isDevServerMode = dev
|
|
3275
|
+
const { platform, dev, cache } = buildOptions;
|
|
3276
|
+
const isDevServerMode = dev && context.buildType === "serve";
|
|
4676
3277
|
invariant(isDevServerMode ? devEngineOptions != null : true, "devEngineOptions is required in dev server mode");
|
|
4677
3278
|
const env = loadEnv(config);
|
|
4678
3279
|
const builtInEnv = {
|
|
@@ -4682,7 +3283,7 @@ async function resolveRolldownOptions(context, config, buildOptions, devEngineOp
|
|
|
4682
3283
|
const { sourceExtensions, assetExtensions, preferNativePlatform, external: rolldownExternal, ...rolldownResolve } = config.resolver;
|
|
4683
3284
|
const { prelude: preludePaths, polyfills, banner: rolldownBanner, footer: rolldownFooter, postBanner: rolldownPostBanner, postFooter: rolldownPostFooter, intro: rolldownIntro, outro: rolldownOutro, shimMissingExports: rolldownShimMissingExports } = config.serializer;
|
|
4684
3285
|
const { flow, babel: babelConfig, swc: swcConfig, ...rolldownTransform } = config.transformer;
|
|
4685
|
-
const { treeshake: rolldownTreeshake, minify: rolldownMinify, ...rolldownOptimization } = config.optimization;
|
|
3286
|
+
const { treeshake: rolldownTreeshake, minify: rolldownMinify, lazyBarrel: rolldownLazyBarrel, ...rolldownOptimization } = config.optimization;
|
|
4686
3287
|
const { codegen, assetRegistryPath, globalIdentifiers: rolldownGlobalIdentifiers } = config.reactNative;
|
|
4687
3288
|
const { sourcemap: rolldownSourcemap, sourcemapBaseUrl: rolldownSourcemapBaseUrl, sourcemapDebugIds: rolldownSourcemapDebugIds, sourcemapIgnoreList: rolldownSourcemapIgnoreList, sourcemapPathTransform: rolldownSourcemapPathTransform } = config;
|
|
4688
3289
|
const transformSvg = config.transformer.svg;
|
|
@@ -4699,12 +3300,12 @@ async function resolveRolldownOptions(context, config, buildOptions, devEngineOp
|
|
|
4699
3300
|
target: "es2015",
|
|
4700
3301
|
jsx: {
|
|
4701
3302
|
runtime: "automatic",
|
|
4702
|
-
development: dev
|
|
3303
|
+
development: dev
|
|
4703
3304
|
},
|
|
4704
3305
|
define: {
|
|
4705
|
-
__DEV__: asLiteral(dev
|
|
3306
|
+
__DEV__: asLiteral(dev),
|
|
4706
3307
|
global: asIdentifier(GLOBAL_IDENTIFIER),
|
|
4707
|
-
"process.env.NODE_ENV": asLiteral(nodeEnvironment(dev
|
|
3308
|
+
"process.env.NODE_ENV": asLiteral(nodeEnvironment(dev)),
|
|
4708
3309
|
"process.env.DEBUG_ROLLIPOP": asLiteral(isDebugEnabled()),
|
|
4709
3310
|
...defineEnvFromObject(env),
|
|
4710
3311
|
...defineEnvFromObject(builtInEnv)
|
|
@@ -4719,14 +3320,16 @@ async function resolveRolldownOptions(context, config, buildOptions, devEngineOp
|
|
|
4719
3320
|
sourceExtensions,
|
|
4720
3321
|
context
|
|
4721
3322
|
});
|
|
4722
|
-
const
|
|
3323
|
+
const defaultReporters = [(() => {
|
|
4723
3324
|
switch (config.terminal.status) {
|
|
4724
|
-
case "compat": return
|
|
4725
|
-
case "progress": return
|
|
4726
|
-
case "none":
|
|
4727
|
-
default: return statusPresets.none(config.reporter);
|
|
3325
|
+
case "compat": return new CompatStatusReporter();
|
|
3326
|
+
case "progress": return new ProgressBarStatusReporter(context.id, `[${platform}, ${buildOptions.dev ? "dev" : "prod"}]`, getBuildTotalModules(context.storage, context.id));
|
|
4728
3327
|
}
|
|
4729
|
-
})();
|
|
3328
|
+
})()];
|
|
3329
|
+
const reporterOptions = {
|
|
3330
|
+
initialTotalModules: getBuildTotalModules(context.storage, context.id),
|
|
3331
|
+
reporter: mergeReporters([...defaultReporters, config.reporter].filter(isNotNil))
|
|
3332
|
+
};
|
|
4730
3333
|
const finalOptions = await applyDangerouslyOverrideOptionsFinalizer(config, {
|
|
4731
3334
|
platform: "neutral",
|
|
4732
3335
|
cwd: config.root,
|
|
@@ -4738,10 +3341,11 @@ async function resolveRolldownOptions(context, config, buildOptions, devEngineOp
|
|
|
4738
3341
|
treeshake: rolldownTreeshake,
|
|
4739
3342
|
external: rolldownExternal,
|
|
4740
3343
|
shimMissingExports: rolldownShimMissingExports,
|
|
3344
|
+
experimental: { lazyBarrel: rolldownLazyBarrel },
|
|
4741
3345
|
plugins: withTransformBoundary([
|
|
4742
3346
|
preludePlugin({ modulePaths: preludePaths }),
|
|
4743
3347
|
reactNativePlugin(config, {
|
|
4744
|
-
dev
|
|
3348
|
+
dev,
|
|
4745
3349
|
platform,
|
|
4746
3350
|
buildType: context.buildType,
|
|
4747
3351
|
codegenFilter: codegen.filter,
|
|
@@ -4754,7 +3358,7 @@ async function resolveRolldownOptions(context, config, buildOptions, devEngineOp
|
|
|
4754
3358
|
svgPlugin({ enabled: transformSvg }),
|
|
4755
3359
|
babelPlugin(babelConfig),
|
|
4756
3360
|
swcPlugin(swcConfig),
|
|
4757
|
-
|
|
3361
|
+
reporterPlugin(reporterOptions),
|
|
4758
3362
|
devServerPlugins,
|
|
4759
3363
|
config.plugins
|
|
4760
3364
|
], {
|
|
@@ -4781,19 +3385,18 @@ async function resolveRolldownOptions(context, config, buildOptions, devEngineOp
|
|
|
4781
3385
|
outro: rolldownOutro,
|
|
4782
3386
|
intro: async (chunk) => {
|
|
4783
3387
|
return [
|
|
4784
|
-
...getGlobalVariables(dev
|
|
3388
|
+
...getGlobalVariables(dev, context.buildType),
|
|
4785
3389
|
...loadPolyfills(polyfills),
|
|
4786
3390
|
typeof rolldownIntro === "function" ? await rolldownIntro(chunk) : rolldownIntro
|
|
4787
3391
|
].filter(isNotNil).join("\n");
|
|
4788
3392
|
},
|
|
4789
|
-
keepNames: dev$1,
|
|
4790
3393
|
minify: buildOptions.minify ?? rolldownMinify,
|
|
4791
3394
|
sourcemap: buildOptions.sourcemap ?? rolldownSourcemap,
|
|
4792
3395
|
sourcemapBaseUrl: rolldownSourcemapBaseUrl,
|
|
4793
3396
|
sourcemapDebugIds: rolldownSourcemapDebugIds,
|
|
4794
3397
|
sourcemapIgnoreList: rolldownSourcemapIgnoreList,
|
|
4795
3398
|
sourcemapPathTransform: rolldownSourcemapPathTransform,
|
|
4796
|
-
|
|
3399
|
+
codeSplitting: false,
|
|
4797
3400
|
strictExecutionOrder: true,
|
|
4798
3401
|
globalIdentifiers: rolldownGlobalIdentifiers
|
|
4799
3402
|
});
|
|
@@ -4802,16 +3405,16 @@ async function resolveRolldownOptions(context, config, buildOptions, devEngineOp
|
|
|
4802
3405
|
}
|
|
4803
3406
|
function getResolveExtensions({ platform, sourceExtensions, assetExtensions, preferNativePlatform }) {
|
|
4804
3407
|
const supportedExtensions = [...sourceExtensions, ...assetExtensions];
|
|
4805
|
-
return [...[platform, preferNativePlatform ? "native" : null].filter(isNotNil).map((platform
|
|
4806
|
-
return supportedExtensions.map((extension) => `.${platform
|
|
3408
|
+
return [...[platform, preferNativePlatform ? "native" : null].filter(isNotNil).map((platform) => {
|
|
3409
|
+
return supportedExtensions.map((extension) => `.${platform}.${extension}`);
|
|
4807
3410
|
}), ...supportedExtensions.map((extension) => `.${extension}`)].flat();
|
|
4808
3411
|
}
|
|
4809
3412
|
function loadPolyfills(polyfills) {
|
|
4810
3413
|
return polyfills.map((polyfill) => {
|
|
4811
3414
|
if (typeof polyfill === "string") return fs.readFileSync(polyfill, "utf-8");
|
|
4812
|
-
const path
|
|
3415
|
+
const path = "path" in polyfill ? polyfill.path : void 0;
|
|
4813
3416
|
const content = "code" in polyfill ? polyfill.code : fs.readFileSync(polyfill.path, "utf-8");
|
|
4814
|
-
return polyfill.type === "iife" ? iife(content, path
|
|
3417
|
+
return polyfill.type === "iife" ? iife(content, path) : content;
|
|
4815
3418
|
});
|
|
4816
3419
|
}
|
|
4817
3420
|
async function applyDangerouslyOverrideOptionsFinalizer(config, inputOptions, outputOptions) {
|
|
@@ -4871,11 +3474,11 @@ var Bundler = class Bundler {
|
|
|
4871
3474
|
return createId(config, buildOptions);
|
|
4872
3475
|
}
|
|
4873
3476
|
static createContext(buildType, config, buildOptions) {
|
|
4874
|
-
const id
|
|
3477
|
+
const id = Bundler.createId(config, buildOptions);
|
|
4875
3478
|
return {
|
|
4876
|
-
id
|
|
3479
|
+
id,
|
|
4877
3480
|
root: config.root,
|
|
4878
|
-
cache: new FileSystemCache(config.root, id
|
|
3481
|
+
cache: new FileSystemCache(config.root, id),
|
|
4879
3482
|
storage: FileStorage.getInstance(config.root),
|
|
4880
3483
|
buildType,
|
|
4881
3484
|
state: { hmrUpdates: /* @__PURE__ */ new Set() }
|
|
@@ -5166,7 +3769,6 @@ const command = {
|
|
|
5166
3769
|
//#endregion
|
|
5167
3770
|
//#region src/commands.ts
|
|
5168
3771
|
const commands = [createReactNativeCliCommand(command$1), createReactNativeCliCommand(command)];
|
|
5169
|
-
var commands_default = commands;
|
|
5170
3772
|
|
|
5171
3773
|
//#endregion
|
|
5172
|
-
export {
|
|
3774
|
+
export { commands as default };
|