rolldown 1.0.0-beta.7-commit.51b53fd → 1.0.0-beta.7-commit.25f3c61
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/bin/cli.js +1 -1
- package/dist/cjs/cli.cjs +457 -457
- package/dist/cjs/experimental-index.cjs +24 -24
- package/dist/cjs/index.cjs +2 -2
- package/dist/cjs/parallel-plugin-worker.cjs +2 -2
- package/dist/cjs/parse-ast-index.cjs +1 -1
- package/dist/esm/cli.mjs +457 -457
- package/dist/esm/experimental-index.mjs +24 -24
- package/dist/esm/index.mjs +2 -2
- package/dist/esm/parallel-plugin-worker.mjs +2 -2
- package/dist/esm/parse-ast-index.mjs +1 -1
- package/dist/shared/{parse-ast-index-DbQWN9pL.cjs → parse-ast-index-0ei4fTjl.cjs} +253 -252
- package/dist/shared/{parse-ast-index-B-UemHTj.mjs → parse-ast-index-DNOUVcBy.mjs} +253 -252
- package/dist/shared/{src-eC0JqPTa.cjs → src-BPcsb-4N.cjs} +464 -464
- package/dist/shared/{src-DJ0d0UY6.mjs → src-DllTyFDp.mjs} +464 -464
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/binding.d.ts +5 -1
- package/dist/types/builtin-plugin/constructors.d.ts +1 -1
- package/dist/types/builtin-plugin/replace-plugin.d.ts +0 -1
- package/dist/types/cli/arguments/index.d.ts +1 -1
- package/dist/types/cli/arguments/normalize.d.ts +5 -1
- package/dist/types/experimental-index.d.ts +5 -5
- package/dist/types/index.d.ts +23 -23
- package/dist/types/log/logger.d.ts +2 -2
- package/dist/types/options/generated/checks-options.d.ts +11 -11
- package/dist/types/options/input-options.d.ts +4 -4
- package/dist/types/options/normalized-input-options.d.ts +2 -2
- package/dist/types/options/normalized-output-options.d.ts +1 -1
- package/dist/types/options/output-options.d.ts +2 -2
- package/dist/types/parallel-plugin.d.ts +1 -1
- package/dist/types/plugin/bindingify-build-hooks.d.ts +1 -1
- package/dist/types/plugin/bindingify-hook-filter.d.ts +2 -2
- package/dist/types/plugin/bindingify-output-hooks.d.ts +2 -2
- package/dist/types/plugin/bindingify-plugin-hook-meta.d.ts +1 -1
- package/dist/types/plugin/bindingify-plugin.d.ts +3 -3
- package/dist/types/plugin/bindingify-watch-hooks.d.ts +1 -1
- package/dist/types/plugin/hook-filter.d.ts +1 -1
- package/dist/types/plugin/index.d.ts +15 -16
- package/dist/types/plugin/plugin-context-data.d.ts +2 -2
- package/dist/types/plugin/plugin-context.d.ts +7 -7
- package/dist/types/plugin/plugin-driver.d.ts +2 -2
- package/dist/types/plugin/transform-plugin-context.d.ts +4 -4
- package/dist/types/types/rolldown-output.d.ts +1 -1
- package/dist/types/utils/bindingify-input-options.d.ts +3 -3
- package/dist/types/utils/create-bundler-option.d.ts +1 -1
- package/dist/types/utils/define-config.d.ts +1 -1
- package/dist/types/utils/initialize-parallel-plugins.d.ts +1 -1
- package/dist/types/utils/normalize-hook.d.ts +1 -1
- package/dist/types/utils/normalize-plugin-option.d.ts +1 -1
- package/dist/types/utils/transform-module-info.d.ts +2 -2
- package/dist/types/utils/transform-to-rollup-output.d.ts +2 -2
- package/package.json +25 -26
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
import { import_binding } from "../shared/parse-ast-index-
|
|
2
|
-
import { BuiltinPlugin, buildImportAnalysisPlugin, composeJsPlugins, createBundler, dynamicImportVarsPlugin, handleOutputErrors, importGlobPlugin, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin } from "../shared/src-
|
|
1
|
+
import { import_binding } from "../shared/parse-ast-index-DNOUVcBy.mjs";
|
|
2
|
+
import { BuiltinPlugin, buildImportAnalysisPlugin, composeJsPlugins, createBundler, dynamicImportVarsPlugin, handleOutputErrors, importGlobPlugin, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin } from "../shared/src-DllTyFDp.mjs";
|
|
3
3
|
import { pathToFileURL } from "node:url";
|
|
4
4
|
|
|
5
|
+
//#region src/api/experimental.ts
|
|
6
|
+
const experimental_scan = async (input) => {
|
|
7
|
+
const { bundler, stopWorkers } = await createBundler(input, {});
|
|
8
|
+
const output = await bundler.scan();
|
|
9
|
+
handleOutputErrors(output);
|
|
10
|
+
await stopWorkers?.();
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
5
14
|
//#region src/plugin/parallel-plugin.ts
|
|
6
15
|
function defineParallelPlugin(pluginPath) {
|
|
7
16
|
return (options) => {
|
|
@@ -13,13 +22,19 @@ function defineParallelPlugin(pluginPath) {
|
|
|
13
22
|
}
|
|
14
23
|
|
|
15
24
|
//#endregion
|
|
16
|
-
//#region src/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
25
|
+
//#region src/builtin-plugin/alias-plugin.ts
|
|
26
|
+
function aliasPlugin(config) {
|
|
27
|
+
return new BuiltinPlugin("builtin:alias", config);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/builtin-plugin/replace-plugin.ts
|
|
32
|
+
function replacePlugin(values = {}, options = {}) {
|
|
33
|
+
return new BuiltinPlugin("builtin:replace", {
|
|
34
|
+
...options,
|
|
35
|
+
values
|
|
36
|
+
});
|
|
37
|
+
}
|
|
23
38
|
|
|
24
39
|
//#endregion
|
|
25
40
|
//#region src/builtin-plugin/transform-plugin.ts
|
|
@@ -36,21 +51,6 @@ function transformPlugin(config) {
|
|
|
36
51
|
return new BuiltinPlugin("builtin:transform", normalizeEcmaTransformPluginConfig(config));
|
|
37
52
|
}
|
|
38
53
|
|
|
39
|
-
//#endregion
|
|
40
|
-
//#region src/builtin-plugin/replace-plugin.ts
|
|
41
|
-
function replacePlugin(values = {}, options = {}) {
|
|
42
|
-
return new BuiltinPlugin("builtin:replace", {
|
|
43
|
-
...options,
|
|
44
|
-
values
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
//#endregion
|
|
49
|
-
//#region src/builtin-plugin/alias-plugin.ts
|
|
50
|
-
function aliasPlugin(config) {
|
|
51
|
-
return new BuiltinPlugin("builtin:alias", config);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
54
|
//#endregion
|
|
55
55
|
var moduleRunnerTransform = import_binding.moduleRunnerTransform;
|
|
56
56
|
var transform = import_binding.transform;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../shared/parse-ast-index-
|
|
2
|
-
import { VERSION, build, defineConfig, rolldown, watch } from "../shared/src-
|
|
1
|
+
import "../shared/parse-ast-index-DNOUVcBy.mjs";
|
|
2
|
+
import { VERSION, build, defineConfig, rolldown, watch } from "../shared/src-DllTyFDp.mjs";
|
|
3
3
|
|
|
4
4
|
export { VERSION, build, defineConfig, rolldown, watch };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { import_binding } from "../shared/parse-ast-index-
|
|
2
|
-
import { PluginContextData, bindingifyPlugin } from "../shared/src-
|
|
1
|
+
import { import_binding } from "../shared/parse-ast-index-DNOUVcBy.mjs";
|
|
2
|
+
import { PluginContextData, bindingifyPlugin } from "../shared/src-DllTyFDp.mjs";
|
|
3
3
|
import { parentPort, workerData } from "node:worker_threads";
|
|
4
4
|
|
|
5
5
|
//#region src/parallel-plugin-worker.ts
|
|
@@ -1,257 +1,7 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-qZFfknuJ.cjs');
|
|
2
|
-
const node_process = require_chunk.__toESM(require("node:process"));
|
|
3
2
|
const tty = require_chunk.__toESM(require("tty"));
|
|
3
|
+
const node_process = require_chunk.__toESM(require("node:process"));
|
|
4
4
|
|
|
5
|
-
//#region src/utils/code-frame.ts
|
|
6
|
-
function spaces(index) {
|
|
7
|
-
let result = "";
|
|
8
|
-
while (index--) result += " ";
|
|
9
|
-
return result;
|
|
10
|
-
}
|
|
11
|
-
function tabsToSpaces(value) {
|
|
12
|
-
return value.replace(/^\t+/, (match) => match.split(" ").join(" "));
|
|
13
|
-
}
|
|
14
|
-
const LINE_TRUNCATE_LENGTH = 120;
|
|
15
|
-
const MIN_CHARACTERS_SHOWN_AFTER_LOCATION = 10;
|
|
16
|
-
const ELLIPSIS = "...";
|
|
17
|
-
function getCodeFrame(source, line, column) {
|
|
18
|
-
let lines = source.split("\n");
|
|
19
|
-
if (line > lines.length) return "";
|
|
20
|
-
const maxLineLength = Math.max(tabsToSpaces(lines[line - 1].slice(0, column)).length + MIN_CHARACTERS_SHOWN_AFTER_LOCATION + ELLIPSIS.length, LINE_TRUNCATE_LENGTH);
|
|
21
|
-
const frameStart = Math.max(0, line - 3);
|
|
22
|
-
let frameEnd = Math.min(line + 2, lines.length);
|
|
23
|
-
lines = lines.slice(frameStart, frameEnd);
|
|
24
|
-
while (!/\S/.test(lines[lines.length - 1])) {
|
|
25
|
-
lines.pop();
|
|
26
|
-
frameEnd -= 1;
|
|
27
|
-
}
|
|
28
|
-
const digits = String(frameEnd).length;
|
|
29
|
-
return lines.map((sourceLine, index) => {
|
|
30
|
-
const isErrorLine = frameStart + index + 1 === line;
|
|
31
|
-
let lineNumber = String(index + frameStart + 1);
|
|
32
|
-
while (lineNumber.length < digits) lineNumber = ` ${lineNumber}`;
|
|
33
|
-
let displayedLine = tabsToSpaces(sourceLine);
|
|
34
|
-
if (displayedLine.length > maxLineLength) displayedLine = `${displayedLine.slice(0, maxLineLength - ELLIPSIS.length)}${ELLIPSIS}`;
|
|
35
|
-
if (isErrorLine) {
|
|
36
|
-
const indicator = spaces(digits + 2 + tabsToSpaces(sourceLine.slice(0, column)).length) + "^";
|
|
37
|
-
return `${lineNumber}: ${displayedLine}\n${indicator}`;
|
|
38
|
-
}
|
|
39
|
-
return `${lineNumber}: ${displayedLine}`;
|
|
40
|
-
}).join("\n");
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
//#endregion
|
|
44
|
-
//#region src/log/locate-character/index.js
|
|
45
|
-
/** @typedef {import('./types').Location} Location */
|
|
46
|
-
/**
|
|
47
|
-
* @param {import('./types').Range} range
|
|
48
|
-
* @param {number} index
|
|
49
|
-
*/
|
|
50
|
-
function rangeContains(range, index) {
|
|
51
|
-
return range.start <= index && index < range.end;
|
|
52
|
-
}
|
|
53
|
-
function getLocator(source, options = {}) {
|
|
54
|
-
const { offsetLine = 0, offsetColumn = 0 } = options;
|
|
55
|
-
let start = 0;
|
|
56
|
-
const ranges = source.split("\n").map((line, i$1) => {
|
|
57
|
-
const end = start + line.length + 1;
|
|
58
|
-
/** @type {import('./types').Range} */
|
|
59
|
-
const range = {
|
|
60
|
-
start,
|
|
61
|
-
end,
|
|
62
|
-
line: i$1
|
|
63
|
-
};
|
|
64
|
-
start = end;
|
|
65
|
-
return range;
|
|
66
|
-
});
|
|
67
|
-
let i = 0;
|
|
68
|
-
/**
|
|
69
|
-
* @param {string | number} search
|
|
70
|
-
* @param {number} [index]
|
|
71
|
-
* @returns {Location | undefined}
|
|
72
|
-
*/
|
|
73
|
-
function locator(search, index) {
|
|
74
|
-
if (typeof search === "string") search = source.indexOf(search, index ?? 0);
|
|
75
|
-
if (search === -1) return void 0;
|
|
76
|
-
let range = ranges[i];
|
|
77
|
-
const d = search >= range.end ? 1 : -1;
|
|
78
|
-
while (range) {
|
|
79
|
-
if (rangeContains(range, search)) return {
|
|
80
|
-
line: offsetLine + range.line,
|
|
81
|
-
column: offsetColumn + search - range.start,
|
|
82
|
-
character: search
|
|
83
|
-
};
|
|
84
|
-
i += d;
|
|
85
|
-
range = ranges[i];
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return locator;
|
|
89
|
-
}
|
|
90
|
-
function locate(source, search, options) {
|
|
91
|
-
return getLocator(source, options)(search, options && options.startIndex);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
//#endregion
|
|
95
|
-
//#region ../../node_modules/.pnpm/colorette@2.0.20/node_modules/colorette/index.js
|
|
96
|
-
const { env: env$1 = {}, argv = [], platform = "" } = typeof process === "undefined" ? {} : process;
|
|
97
|
-
const isDisabled = "NO_COLOR" in env$1 || argv.includes("--no-color");
|
|
98
|
-
const isForced = "FORCE_COLOR" in env$1 || argv.includes("--color");
|
|
99
|
-
const isWindows = platform === "win32";
|
|
100
|
-
const isDumbTerminal = env$1.TERM === "dumb";
|
|
101
|
-
const isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env$1.TERM && !isDumbTerminal;
|
|
102
|
-
const isCI = "CI" in env$1 && ("GITHUB_ACTIONS" in env$1 || "GITLAB_CI" in env$1 || "CIRCLECI" in env$1);
|
|
103
|
-
const isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
|
|
104
|
-
const replaceClose = (index, string, close, replace, head = string.substring(0, index) + replace, tail = string.substring(index + close.length), next = tail.indexOf(close)) => head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
|
|
105
|
-
const clearBleed = (index, string, open, close, replace) => index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
|
|
106
|
-
const filterEmpty = (open, close, replace = open, at = open.length + 1) => (string) => string || !(string === "" || string === void 0) ? clearBleed(("" + string).indexOf(close, at), string, open, close, replace) : "";
|
|
107
|
-
const init = (open, close, replace) => filterEmpty(`\x1b[${open}m`, `\x1b[${close}m`, replace);
|
|
108
|
-
const colors$1 = {
|
|
109
|
-
reset: init(0, 0),
|
|
110
|
-
bold: init(1, 22, "\x1B[22m\x1B[1m"),
|
|
111
|
-
dim: init(2, 22, "\x1B[22m\x1B[2m"),
|
|
112
|
-
italic: init(3, 23),
|
|
113
|
-
underline: init(4, 24),
|
|
114
|
-
inverse: init(7, 27),
|
|
115
|
-
hidden: init(8, 28),
|
|
116
|
-
strikethrough: init(9, 29),
|
|
117
|
-
black: init(30, 39),
|
|
118
|
-
red: init(31, 39),
|
|
119
|
-
green: init(32, 39),
|
|
120
|
-
yellow: init(33, 39),
|
|
121
|
-
blue: init(34, 39),
|
|
122
|
-
magenta: init(35, 39),
|
|
123
|
-
cyan: init(36, 39),
|
|
124
|
-
white: init(37, 39),
|
|
125
|
-
gray: init(90, 39),
|
|
126
|
-
bgBlack: init(40, 49),
|
|
127
|
-
bgRed: init(41, 49),
|
|
128
|
-
bgGreen: init(42, 49),
|
|
129
|
-
bgYellow: init(43, 49),
|
|
130
|
-
bgBlue: init(44, 49),
|
|
131
|
-
bgMagenta: init(45, 49),
|
|
132
|
-
bgCyan: init(46, 49),
|
|
133
|
-
bgWhite: init(47, 49),
|
|
134
|
-
blackBright: init(90, 39),
|
|
135
|
-
redBright: init(91, 39),
|
|
136
|
-
greenBright: init(92, 39),
|
|
137
|
-
yellowBright: init(93, 39),
|
|
138
|
-
blueBright: init(94, 39),
|
|
139
|
-
magentaBright: init(95, 39),
|
|
140
|
-
cyanBright: init(96, 39),
|
|
141
|
-
whiteBright: init(97, 39),
|
|
142
|
-
bgBlackBright: init(100, 49),
|
|
143
|
-
bgRedBright: init(101, 49),
|
|
144
|
-
bgGreenBright: init(102, 49),
|
|
145
|
-
bgYellowBright: init(103, 49),
|
|
146
|
-
bgBlueBright: init(104, 49),
|
|
147
|
-
bgMagentaBright: init(105, 49),
|
|
148
|
-
bgCyanBright: init(106, 49),
|
|
149
|
-
bgWhiteBright: init(107, 49)
|
|
150
|
-
};
|
|
151
|
-
const createColors = ({ useColor = isColorSupported } = {}) => useColor ? colors$1 : Object.keys(colors$1).reduce((colors$2, key) => ({
|
|
152
|
-
...colors$2,
|
|
153
|
-
[key]: String
|
|
154
|
-
}), {});
|
|
155
|
-
const { reset, bold: bold$1, dim: dim$1, italic, underline: underline$1, inverse, hidden, strikethrough, black, red: red$1, green: green$1, yellow: yellow$1, blue, magenta, cyan: cyan$1, white, gray: gray$1, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, blackBright, redBright, greenBright, yellowBright, blueBright, magentaBright, cyanBright, whiteBright, bgBlackBright, bgRedBright, bgGreenBright, bgYellowBright, bgBlueBright, bgMagentaBright, bgCyanBright, bgWhiteBright } = createColors();
|
|
156
|
-
|
|
157
|
-
//#endregion
|
|
158
|
-
//#region src/cli/colors.ts
|
|
159
|
-
const { bold, cyan, dim, gray, green, red, underline, yellow } = createColors({ useColor: node_process.env.FORCE_COLOR !== "0" && !node_process.env.NO_COLOR });
|
|
160
|
-
const colors = {
|
|
161
|
-
bold,
|
|
162
|
-
cyan,
|
|
163
|
-
dim,
|
|
164
|
-
gray,
|
|
165
|
-
green,
|
|
166
|
-
red,
|
|
167
|
-
underline,
|
|
168
|
-
yellow
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
//#endregion
|
|
172
|
-
//#region src/log/logs.ts
|
|
173
|
-
const INVALID_LOG_POSITION = "INVALID_LOG_POSITION", PLUGIN_ERROR = "PLUGIN_ERROR", INPUT_HOOK_IN_OUTPUT_PLUGIN = "INPUT_HOOK_IN_OUTPUT_PLUGIN", CYCLE_LOADING = "CYCLE_LOADING", MULTIPLY_NOTIFY_OPTION = "MULTIPLY_NOTIFY_OPTION", MINIFY_WARNING = "MINIFY_WARNING", PARSE_ERROR = "PARSE_ERROR";
|
|
174
|
-
function logParseError(message) {
|
|
175
|
-
return {
|
|
176
|
-
code: PARSE_ERROR,
|
|
177
|
-
message
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
|
-
function logMinifyWarning() {
|
|
181
|
-
return {
|
|
182
|
-
code: MINIFY_WARNING,
|
|
183
|
-
message: colors.yellow("The built-in minifier is still under development. Setting \"minify: true\" is not recommended for production use.")
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
function logInvalidLogPosition(pluginName) {
|
|
187
|
-
return {
|
|
188
|
-
code: INVALID_LOG_POSITION,
|
|
189
|
-
message: `Plugin "${pluginName}" tried to add a file position to a log or warning. This is only supported in the "transform" hook at the moment and will be ignored.`
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
function logInputHookInOutputPlugin(pluginName, hookName) {
|
|
193
|
-
return {
|
|
194
|
-
code: INPUT_HOOK_IN_OUTPUT_PLUGIN,
|
|
195
|
-
message: `The "${hookName}" hook used by the output plugin ${pluginName} is a build time hook and will not be run for that plugin. Either this plugin cannot be used as an output plugin, or it should have an option to configure it as an output plugin.`
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
function logCycleLoading(pluginName, moduleId) {
|
|
199
|
-
return {
|
|
200
|
-
code: CYCLE_LOADING,
|
|
201
|
-
message: `Found the module "${moduleId}" cycle loading at ${pluginName} plugin, it maybe blocking fetching modules.`
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
function logMultiplyNotifyOption() {
|
|
205
|
-
return {
|
|
206
|
-
code: MULTIPLY_NOTIFY_OPTION,
|
|
207
|
-
message: `Found multiply notify option at watch options, using first one to start notify watcher.`
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
function logPluginError(error$1, plugin, { hook, id } = {}) {
|
|
211
|
-
const code = error$1.code;
|
|
212
|
-
if (!error$1.pluginCode && code != null && (typeof code !== "string" || !code.startsWith("PLUGIN_"))) error$1.pluginCode = code;
|
|
213
|
-
error$1.code = PLUGIN_ERROR;
|
|
214
|
-
error$1.plugin = plugin;
|
|
215
|
-
if (hook) error$1.hook = hook;
|
|
216
|
-
if (id) error$1.id = id;
|
|
217
|
-
return error$1;
|
|
218
|
-
}
|
|
219
|
-
function error(base) {
|
|
220
|
-
if (!(base instanceof Error)) {
|
|
221
|
-
base = Object.assign(new Error(base.message), base);
|
|
222
|
-
Object.defineProperty(base, "name", {
|
|
223
|
-
value: "RollupError",
|
|
224
|
-
writable: true
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
throw base;
|
|
228
|
-
}
|
|
229
|
-
function augmentCodeLocation(properties, pos, source, id) {
|
|
230
|
-
if (typeof pos === "object") {
|
|
231
|
-
const { line, column } = pos;
|
|
232
|
-
properties.loc = {
|
|
233
|
-
column,
|
|
234
|
-
file: id,
|
|
235
|
-
line
|
|
236
|
-
};
|
|
237
|
-
} else {
|
|
238
|
-
properties.pos = pos;
|
|
239
|
-
const location = locate(source, pos, { offsetLine: 1 });
|
|
240
|
-
if (!location) return;
|
|
241
|
-
const { line, column } = location;
|
|
242
|
-
properties.loc = {
|
|
243
|
-
column,
|
|
244
|
-
file: id,
|
|
245
|
-
line
|
|
246
|
-
};
|
|
247
|
-
}
|
|
248
|
-
if (properties.frame === void 0) {
|
|
249
|
-
const { line, column } = properties.loc;
|
|
250
|
-
properties.frame = getCodeFrame(source, line, column);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
//#endregion
|
|
255
5
|
//#region src/webcontainer-fallback.js
|
|
256
6
|
var require_webcontainer_fallback = require_chunk.__commonJS({ "src/webcontainer-fallback.js"(exports, module) {
|
|
257
7
|
const fs = require("node:fs");
|
|
@@ -585,6 +335,7 @@ var require_binding = require_chunk.__commonJS({ "src/binding.js"(exports, modul
|
|
|
585
335
|
module.exports.BindingOutputs = nativeBinding.BindingOutputs;
|
|
586
336
|
module.exports.BindingPluginContext = nativeBinding.BindingPluginContext;
|
|
587
337
|
module.exports.BindingRenderedChunk = nativeBinding.BindingRenderedChunk;
|
|
338
|
+
module.exports.BindingRenderedChunkMeta = nativeBinding.BindingRenderedChunkMeta;
|
|
588
339
|
module.exports.BindingRenderedModule = nativeBinding.BindingRenderedModule;
|
|
589
340
|
module.exports.BindingTransformPluginContext = nativeBinding.BindingTransformPluginContext;
|
|
590
341
|
module.exports.BindingWatcher = nativeBinding.BindingWatcher;
|
|
@@ -618,7 +369,257 @@ var require_binding = require_chunk.__commonJS({ "src/binding.js"(exports, modul
|
|
|
618
369
|
var import_binding = require_chunk.__toESM(require_binding());
|
|
619
370
|
|
|
620
371
|
//#endregion
|
|
621
|
-
//#region ../../node_modules/.pnpm/
|
|
372
|
+
//#region ../../node_modules/.pnpm/colorette@2.0.20/node_modules/colorette/index.js
|
|
373
|
+
const { env: env$1 = {}, argv = [], platform = "" } = typeof process === "undefined" ? {} : process;
|
|
374
|
+
const isDisabled = "NO_COLOR" in env$1 || argv.includes("--no-color");
|
|
375
|
+
const isForced = "FORCE_COLOR" in env$1 || argv.includes("--color");
|
|
376
|
+
const isWindows = platform === "win32";
|
|
377
|
+
const isDumbTerminal = env$1.TERM === "dumb";
|
|
378
|
+
const isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env$1.TERM && !isDumbTerminal;
|
|
379
|
+
const isCI = "CI" in env$1 && ("GITHUB_ACTIONS" in env$1 || "GITLAB_CI" in env$1 || "CIRCLECI" in env$1);
|
|
380
|
+
const isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
|
|
381
|
+
const replaceClose = (index, string, close, replace, head = string.substring(0, index) + replace, tail = string.substring(index + close.length), next = tail.indexOf(close)) => head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
|
|
382
|
+
const clearBleed = (index, string, open, close, replace) => index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
|
|
383
|
+
const filterEmpty = (open, close, replace = open, at = open.length + 1) => (string) => string || !(string === "" || string === void 0) ? clearBleed(("" + string).indexOf(close, at), string, open, close, replace) : "";
|
|
384
|
+
const init = (open, close, replace) => filterEmpty(`\x1b[${open}m`, `\x1b[${close}m`, replace);
|
|
385
|
+
const colors$1 = {
|
|
386
|
+
reset: init(0, 0),
|
|
387
|
+
bold: init(1, 22, "\x1B[22m\x1B[1m"),
|
|
388
|
+
dim: init(2, 22, "\x1B[22m\x1B[2m"),
|
|
389
|
+
italic: init(3, 23),
|
|
390
|
+
underline: init(4, 24),
|
|
391
|
+
inverse: init(7, 27),
|
|
392
|
+
hidden: init(8, 28),
|
|
393
|
+
strikethrough: init(9, 29),
|
|
394
|
+
black: init(30, 39),
|
|
395
|
+
red: init(31, 39),
|
|
396
|
+
green: init(32, 39),
|
|
397
|
+
yellow: init(33, 39),
|
|
398
|
+
blue: init(34, 39),
|
|
399
|
+
magenta: init(35, 39),
|
|
400
|
+
cyan: init(36, 39),
|
|
401
|
+
white: init(37, 39),
|
|
402
|
+
gray: init(90, 39),
|
|
403
|
+
bgBlack: init(40, 49),
|
|
404
|
+
bgRed: init(41, 49),
|
|
405
|
+
bgGreen: init(42, 49),
|
|
406
|
+
bgYellow: init(43, 49),
|
|
407
|
+
bgBlue: init(44, 49),
|
|
408
|
+
bgMagenta: init(45, 49),
|
|
409
|
+
bgCyan: init(46, 49),
|
|
410
|
+
bgWhite: init(47, 49),
|
|
411
|
+
blackBright: init(90, 39),
|
|
412
|
+
redBright: init(91, 39),
|
|
413
|
+
greenBright: init(92, 39),
|
|
414
|
+
yellowBright: init(93, 39),
|
|
415
|
+
blueBright: init(94, 39),
|
|
416
|
+
magentaBright: init(95, 39),
|
|
417
|
+
cyanBright: init(96, 39),
|
|
418
|
+
whiteBright: init(97, 39),
|
|
419
|
+
bgBlackBright: init(100, 49),
|
|
420
|
+
bgRedBright: init(101, 49),
|
|
421
|
+
bgGreenBright: init(102, 49),
|
|
422
|
+
bgYellowBright: init(103, 49),
|
|
423
|
+
bgBlueBright: init(104, 49),
|
|
424
|
+
bgMagentaBright: init(105, 49),
|
|
425
|
+
bgCyanBright: init(106, 49),
|
|
426
|
+
bgWhiteBright: init(107, 49)
|
|
427
|
+
};
|
|
428
|
+
const createColors = ({ useColor = isColorSupported } = {}) => useColor ? colors$1 : Object.keys(colors$1).reduce((colors$2, key) => ({
|
|
429
|
+
...colors$2,
|
|
430
|
+
[key]: String
|
|
431
|
+
}), {});
|
|
432
|
+
const { reset, bold: bold$1, dim: dim$1, italic, underline: underline$1, inverse, hidden, strikethrough, black, red: red$1, green: green$1, yellow: yellow$1, blue, magenta, cyan: cyan$1, white, gray: gray$1, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, blackBright, redBright, greenBright, yellowBright, blueBright, magentaBright, cyanBright, whiteBright, bgBlackBright, bgRedBright, bgGreenBright, bgYellowBright, bgBlueBright, bgMagentaBright, bgCyanBright, bgWhiteBright } = createColors();
|
|
433
|
+
|
|
434
|
+
//#endregion
|
|
435
|
+
//#region src/cli/colors.ts
|
|
436
|
+
const { bold, cyan, dim, gray, green, red, underline, yellow } = createColors({ useColor: node_process.env.FORCE_COLOR !== "0" && !node_process.env.NO_COLOR });
|
|
437
|
+
const colors = {
|
|
438
|
+
bold,
|
|
439
|
+
cyan,
|
|
440
|
+
dim,
|
|
441
|
+
gray,
|
|
442
|
+
green,
|
|
443
|
+
red,
|
|
444
|
+
underline,
|
|
445
|
+
yellow
|
|
446
|
+
};
|
|
447
|
+
|
|
448
|
+
//#endregion
|
|
449
|
+
//#region src/utils/code-frame.ts
|
|
450
|
+
function spaces(index) {
|
|
451
|
+
let result = "";
|
|
452
|
+
while (index--) result += " ";
|
|
453
|
+
return result;
|
|
454
|
+
}
|
|
455
|
+
function tabsToSpaces(value) {
|
|
456
|
+
return value.replace(/^\t+/, (match) => match.split(" ").join(" "));
|
|
457
|
+
}
|
|
458
|
+
const LINE_TRUNCATE_LENGTH = 120;
|
|
459
|
+
const MIN_CHARACTERS_SHOWN_AFTER_LOCATION = 10;
|
|
460
|
+
const ELLIPSIS = "...";
|
|
461
|
+
function getCodeFrame(source, line, column) {
|
|
462
|
+
let lines = source.split("\n");
|
|
463
|
+
if (line > lines.length) return "";
|
|
464
|
+
const maxLineLength = Math.max(tabsToSpaces(lines[line - 1].slice(0, column)).length + MIN_CHARACTERS_SHOWN_AFTER_LOCATION + ELLIPSIS.length, LINE_TRUNCATE_LENGTH);
|
|
465
|
+
const frameStart = Math.max(0, line - 3);
|
|
466
|
+
let frameEnd = Math.min(line + 2, lines.length);
|
|
467
|
+
lines = lines.slice(frameStart, frameEnd);
|
|
468
|
+
while (!/\S/.test(lines[lines.length - 1])) {
|
|
469
|
+
lines.pop();
|
|
470
|
+
frameEnd -= 1;
|
|
471
|
+
}
|
|
472
|
+
const digits = String(frameEnd).length;
|
|
473
|
+
return lines.map((sourceLine, index) => {
|
|
474
|
+
const isErrorLine = frameStart + index + 1 === line;
|
|
475
|
+
let lineNumber = String(index + frameStart + 1);
|
|
476
|
+
while (lineNumber.length < digits) lineNumber = ` ${lineNumber}`;
|
|
477
|
+
let displayedLine = tabsToSpaces(sourceLine);
|
|
478
|
+
if (displayedLine.length > maxLineLength) displayedLine = `${displayedLine.slice(0, maxLineLength - ELLIPSIS.length)}${ELLIPSIS}`;
|
|
479
|
+
if (isErrorLine) {
|
|
480
|
+
const indicator = spaces(digits + 2 + tabsToSpaces(sourceLine.slice(0, column)).length) + "^";
|
|
481
|
+
return `${lineNumber}: ${displayedLine}\n${indicator}`;
|
|
482
|
+
}
|
|
483
|
+
return `${lineNumber}: ${displayedLine}`;
|
|
484
|
+
}).join("\n");
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
//#endregion
|
|
488
|
+
//#region src/log/locate-character/index.js
|
|
489
|
+
/** @typedef {import('./types').Location} Location */
|
|
490
|
+
/**
|
|
491
|
+
* @param {import('./types').Range} range
|
|
492
|
+
* @param {number} index
|
|
493
|
+
*/
|
|
494
|
+
function rangeContains(range, index) {
|
|
495
|
+
return range.start <= index && index < range.end;
|
|
496
|
+
}
|
|
497
|
+
function getLocator(source, options = {}) {
|
|
498
|
+
const { offsetLine = 0, offsetColumn = 0 } = options;
|
|
499
|
+
let start = 0;
|
|
500
|
+
const ranges = source.split("\n").map((line, i$1) => {
|
|
501
|
+
const end = start + line.length + 1;
|
|
502
|
+
/** @type {import('./types').Range} */
|
|
503
|
+
const range = {
|
|
504
|
+
start,
|
|
505
|
+
end,
|
|
506
|
+
line: i$1
|
|
507
|
+
};
|
|
508
|
+
start = end;
|
|
509
|
+
return range;
|
|
510
|
+
});
|
|
511
|
+
let i = 0;
|
|
512
|
+
/**
|
|
513
|
+
* @param {string | number} search
|
|
514
|
+
* @param {number} [index]
|
|
515
|
+
* @returns {Location | undefined}
|
|
516
|
+
*/
|
|
517
|
+
function locator(search, index) {
|
|
518
|
+
if (typeof search === "string") search = source.indexOf(search, index ?? 0);
|
|
519
|
+
if (search === -1) return void 0;
|
|
520
|
+
let range = ranges[i];
|
|
521
|
+
const d = search >= range.end ? 1 : -1;
|
|
522
|
+
while (range) {
|
|
523
|
+
if (rangeContains(range, search)) return {
|
|
524
|
+
line: offsetLine + range.line,
|
|
525
|
+
column: offsetColumn + search - range.start,
|
|
526
|
+
character: search
|
|
527
|
+
};
|
|
528
|
+
i += d;
|
|
529
|
+
range = ranges[i];
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
return locator;
|
|
533
|
+
}
|
|
534
|
+
function locate(source, search, options) {
|
|
535
|
+
return getLocator(source, options)(search, options && options.startIndex);
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
//#endregion
|
|
539
|
+
//#region src/log/logs.ts
|
|
540
|
+
const INVALID_LOG_POSITION = "INVALID_LOG_POSITION", PLUGIN_ERROR = "PLUGIN_ERROR", INPUT_HOOK_IN_OUTPUT_PLUGIN = "INPUT_HOOK_IN_OUTPUT_PLUGIN", CYCLE_LOADING = "CYCLE_LOADING", MULTIPLY_NOTIFY_OPTION = "MULTIPLY_NOTIFY_OPTION", MINIFY_WARNING = "MINIFY_WARNING", PARSE_ERROR = "PARSE_ERROR";
|
|
541
|
+
function logParseError(message) {
|
|
542
|
+
return {
|
|
543
|
+
code: PARSE_ERROR,
|
|
544
|
+
message
|
|
545
|
+
};
|
|
546
|
+
}
|
|
547
|
+
function logMinifyWarning() {
|
|
548
|
+
return {
|
|
549
|
+
code: MINIFY_WARNING,
|
|
550
|
+
message: colors.yellow("The built-in minifier is still under development. Setting \"minify: true\" is not recommended for production use.")
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
function logInvalidLogPosition(pluginName) {
|
|
554
|
+
return {
|
|
555
|
+
code: INVALID_LOG_POSITION,
|
|
556
|
+
message: `Plugin "${pluginName}" tried to add a file position to a log or warning. This is only supported in the "transform" hook at the moment and will be ignored.`
|
|
557
|
+
};
|
|
558
|
+
}
|
|
559
|
+
function logInputHookInOutputPlugin(pluginName, hookName) {
|
|
560
|
+
return {
|
|
561
|
+
code: INPUT_HOOK_IN_OUTPUT_PLUGIN,
|
|
562
|
+
message: `The "${hookName}" hook used by the output plugin ${pluginName} is a build time hook and will not be run for that plugin. Either this plugin cannot be used as an output plugin, or it should have an option to configure it as an output plugin.`
|
|
563
|
+
};
|
|
564
|
+
}
|
|
565
|
+
function logCycleLoading(pluginName, moduleId) {
|
|
566
|
+
return {
|
|
567
|
+
code: CYCLE_LOADING,
|
|
568
|
+
message: `Found the module "${moduleId}" cycle loading at ${pluginName} plugin, it maybe blocking fetching modules.`
|
|
569
|
+
};
|
|
570
|
+
}
|
|
571
|
+
function logMultiplyNotifyOption() {
|
|
572
|
+
return {
|
|
573
|
+
code: MULTIPLY_NOTIFY_OPTION,
|
|
574
|
+
message: `Found multiply notify option at watch options, using first one to start notify watcher.`
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
function logPluginError(error$1, plugin, { hook, id } = {}) {
|
|
578
|
+
const code = error$1.code;
|
|
579
|
+
if (!error$1.pluginCode && code != null && (typeof code !== "string" || !code.startsWith("PLUGIN_"))) error$1.pluginCode = code;
|
|
580
|
+
error$1.code = PLUGIN_ERROR;
|
|
581
|
+
error$1.plugin = plugin;
|
|
582
|
+
if (hook) error$1.hook = hook;
|
|
583
|
+
if (id) error$1.id = id;
|
|
584
|
+
return error$1;
|
|
585
|
+
}
|
|
586
|
+
function error(base) {
|
|
587
|
+
if (!(base instanceof Error)) {
|
|
588
|
+
base = Object.assign(new Error(base.message), base);
|
|
589
|
+
Object.defineProperty(base, "name", {
|
|
590
|
+
value: "RollupError",
|
|
591
|
+
writable: true
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
throw base;
|
|
595
|
+
}
|
|
596
|
+
function augmentCodeLocation(properties, pos, source, id) {
|
|
597
|
+
if (typeof pos === "object") {
|
|
598
|
+
const { line, column } = pos;
|
|
599
|
+
properties.loc = {
|
|
600
|
+
column,
|
|
601
|
+
file: id,
|
|
602
|
+
line
|
|
603
|
+
};
|
|
604
|
+
} else {
|
|
605
|
+
properties.pos = pos;
|
|
606
|
+
const location = locate(source, pos, { offsetLine: 1 });
|
|
607
|
+
if (!location) return;
|
|
608
|
+
const { line, column } = location;
|
|
609
|
+
properties.loc = {
|
|
610
|
+
column,
|
|
611
|
+
file: id,
|
|
612
|
+
line
|
|
613
|
+
};
|
|
614
|
+
}
|
|
615
|
+
if (properties.frame === void 0) {
|
|
616
|
+
const { line, column } = properties.loc;
|
|
617
|
+
properties.frame = getCodeFrame(source, line, column);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
//#endregion
|
|
622
|
+
//#region ../../node_modules/.pnpm/oxc-parser@0.62.0/node_modules/oxc-parser/wrap.mjs
|
|
622
623
|
function wrap$1(result) {
|
|
623
624
|
let program, module$1, comments, errors;
|
|
624
625
|
return {
|