rolldown 1.0.0-beta.7-commit.c4e9d4a → 1.0.0-beta.7-commit.139c54d
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/dist/cjs/cli.cjs +1 -1
- package/dist/cjs/experimental-index.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/parallel-plugin-worker.cjs +1 -1
- package/dist/esm/cli.mjs +1 -1
- package/dist/esm/experimental-index.mjs +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/parallel-plugin-worker.mjs +1 -1
- package/dist/shared/{src-DBj17z-_.mjs → src-B2OfQx0E.mjs} +59 -68
- package/dist/shared/{src-CpY5_PnH.cjs → src-DGUmeSRg.cjs} +59 -68
- package/dist/types/plugin/index.d.ts +2 -2
- package/dist/types/plugin/minimal-plugin-context.d.ts +2 -1
- package/dist/types/plugin/plugin-driver.d.ts +3 -1
- package/package.json +14 -14
package/dist/cjs/cli.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const require_chunk = require('../shared/chunk-qZFfknuJ.cjs');
|
|
3
|
-
const require_src = require('../shared/src-
|
|
3
|
+
const require_src = require('../shared/src-DGUmeSRg.cjs');
|
|
4
4
|
const require_parse_ast_index = require('../shared/parse-ast-index-DbQWN9pL.cjs');
|
|
5
5
|
const node_process = require_chunk.__toESM(require("node:process"));
|
|
6
6
|
const node_path = require_chunk.__toESM(require("node:path"));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const require_chunk = require('../shared/chunk-qZFfknuJ.cjs');
|
|
3
|
-
const require_src = require('../shared/src-
|
|
3
|
+
const require_src = require('../shared/src-DGUmeSRg.cjs');
|
|
4
4
|
const require_parse_ast_index = require('../shared/parse-ast-index-DbQWN9pL.cjs');
|
|
5
5
|
const node_url = require_chunk.__toESM(require("node:url"));
|
|
6
6
|
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const require_chunk = require('../shared/chunk-qZFfknuJ.cjs');
|
|
3
|
-
const require_src = require('../shared/src-
|
|
3
|
+
const require_src = require('../shared/src-DGUmeSRg.cjs');
|
|
4
4
|
const require_parse_ast_index = require('../shared/parse-ast-index-DbQWN9pL.cjs');
|
|
5
5
|
const node_worker_threads = require_chunk.__toESM(require("node:worker_threads"));
|
|
6
6
|
|
package/dist/esm/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { colors } from "../shared/parse-ast-index-B-UemHTj.mjs";
|
|
2
|
-
import { arraify, description, getInputCliKeys, getJsonSchema, getOutputCliKeys, rolldown, validateCliOptions, version, watch } from "../shared/src-
|
|
2
|
+
import { arraify, description, getInputCliKeys, getJsonSchema, getOutputCliKeys, rolldown, validateCliOptions, version, watch } from "../shared/src-B2OfQx0E.mjs";
|
|
3
3
|
import process$1, { cwd } from "node:process";
|
|
4
4
|
import path, { sep } from "node:path";
|
|
5
5
|
import fs from "node:fs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { import_binding } from "../shared/parse-ast-index-B-UemHTj.mjs";
|
|
2
|
-
import { BuiltinPlugin, buildImportAnalysisPlugin, composeJsPlugins, createBundler, dynamicImportVarsPlugin, handleOutputErrors, importGlobPlugin, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin } from "../shared/src-
|
|
2
|
+
import { BuiltinPlugin, buildImportAnalysisPlugin, composeJsPlugins, createBundler, dynamicImportVarsPlugin, handleOutputErrors, importGlobPlugin, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin } from "../shared/src-B2OfQx0E.mjs";
|
|
3
3
|
import { pathToFileURL } from "node:url";
|
|
4
4
|
|
|
5
5
|
//#region src/plugin/parallel-plugin.ts
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import "../shared/parse-ast-index-B-UemHTj.mjs";
|
|
2
|
-
import { VERSION, build, defineConfig, rolldown, watch } from "../shared/src-
|
|
2
|
+
import { VERSION, build, defineConfig, rolldown, watch } from "../shared/src-B2OfQx0E.mjs";
|
|
3
3
|
|
|
4
4
|
export { VERSION, build, defineConfig, rolldown, watch };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { import_binding } from "../shared/parse-ast-index-B-UemHTj.mjs";
|
|
2
|
-
import { PluginContextData, bindingifyPlugin } from "../shared/src-
|
|
2
|
+
import { PluginContextData, bindingifyPlugin } from "../shared/src-B2OfQx0E.mjs";
|
|
3
3
|
import { parentPort, workerData } from "node:worker_threads";
|
|
4
4
|
|
|
5
5
|
//#region src/parallel-plugin-worker.ts
|
|
@@ -11,6 +11,20 @@ function defineConfig(config) {
|
|
|
11
11
|
return config;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/log/logging.ts
|
|
16
|
+
const LOG_LEVEL_SILENT = "silent";
|
|
17
|
+
const LOG_LEVEL_ERROR = "error";
|
|
18
|
+
const LOG_LEVEL_WARN = "warn";
|
|
19
|
+
const LOG_LEVEL_INFO = "info";
|
|
20
|
+
const LOG_LEVEL_DEBUG = "debug";
|
|
21
|
+
const logLevelPriority = {
|
|
22
|
+
[LOG_LEVEL_DEBUG]: 0,
|
|
23
|
+
[LOG_LEVEL_INFO]: 1,
|
|
24
|
+
[LOG_LEVEL_WARN]: 2,
|
|
25
|
+
[LOG_LEVEL_SILENT]: 3
|
|
26
|
+
};
|
|
27
|
+
|
|
14
28
|
//#endregion
|
|
15
29
|
//#region src/utils/misc.ts
|
|
16
30
|
function arraify(value) {
|
|
@@ -32,35 +46,6 @@ function unsupported(info) {
|
|
|
32
46
|
}
|
|
33
47
|
function noop(..._args) {}
|
|
34
48
|
|
|
35
|
-
//#endregion
|
|
36
|
-
//#region src/log/logging.ts
|
|
37
|
-
const LOG_LEVEL_SILENT = "silent";
|
|
38
|
-
const LOG_LEVEL_ERROR = "error";
|
|
39
|
-
const LOG_LEVEL_WARN = "warn";
|
|
40
|
-
const LOG_LEVEL_INFO = "info";
|
|
41
|
-
const LOG_LEVEL_DEBUG = "debug";
|
|
42
|
-
const logLevelPriority = {
|
|
43
|
-
[LOG_LEVEL_DEBUG]: 0,
|
|
44
|
-
[LOG_LEVEL_INFO]: 1,
|
|
45
|
-
[LOG_LEVEL_WARN]: 2,
|
|
46
|
-
[LOG_LEVEL_SILENT]: 3
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
//#endregion
|
|
50
|
-
//#region src/log/log-handler.ts
|
|
51
|
-
const normalizeLog = (log) => typeof log === "string" ? { message: log } : typeof log === "function" ? normalizeLog(log()) : log;
|
|
52
|
-
function getLogHandler(level, code, logger, pluginName, logLevel) {
|
|
53
|
-
if (logLevelPriority[level] < logLevelPriority[logLevel]) return noop;
|
|
54
|
-
return (log, pos) => {
|
|
55
|
-
if (pos != null) logger(LOG_LEVEL_WARN, logInvalidLogPosition(pluginName));
|
|
56
|
-
log = normalizeLog(log);
|
|
57
|
-
if (log.code && !log.pluginCode) log.pluginCode = log.code;
|
|
58
|
-
log.code = code;
|
|
59
|
-
log.plugin = pluginName;
|
|
60
|
-
logger(level, log);
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
|
|
64
49
|
//#endregion
|
|
65
50
|
//#region src/utils/normalize-hook.ts
|
|
66
51
|
function normalizeHook(hook) {
|
|
@@ -80,6 +65,21 @@ function normalizeHook(hook) {
|
|
|
80
65
|
unreachable("Invalid hook type");
|
|
81
66
|
}
|
|
82
67
|
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/log/log-handler.ts
|
|
70
|
+
const normalizeLog = (log) => typeof log === "string" ? { message: log } : typeof log === "function" ? normalizeLog(log()) : log;
|
|
71
|
+
function getLogHandler(level, code, logger, pluginName, logLevel) {
|
|
72
|
+
if (logLevelPriority[level] < logLevelPriority[logLevel]) return noop;
|
|
73
|
+
return (log, pos) => {
|
|
74
|
+
if (pos != null) logger(LOG_LEVEL_WARN, logInvalidLogPosition(pluginName));
|
|
75
|
+
log = normalizeLog(log);
|
|
76
|
+
if (log.code && !log.pluginCode) log.pluginCode = log.code;
|
|
77
|
+
log.code = code;
|
|
78
|
+
log.plugin = pluginName;
|
|
79
|
+
logger(level, log);
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
83
|
//#endregion
|
|
84
84
|
//#region src/log/logger.ts
|
|
85
85
|
function getLogger(plugins, onLog, logLevel, watchMode) {
|
|
@@ -329,6 +329,30 @@ function normalizePlugins(plugins, anonymousPrefix) {
|
|
|
329
329
|
const ANONYMOUS_PLUGIN_PREFIX = "at position ";
|
|
330
330
|
const ANONYMOUS_OUTPUT_PLUGIN_PREFIX = "at output position ";
|
|
331
331
|
|
|
332
|
+
//#endregion
|
|
333
|
+
//#region src/plugin/minimal-plugin-context.ts
|
|
334
|
+
var MinimalPluginContextImpl = class {
|
|
335
|
+
info;
|
|
336
|
+
warn;
|
|
337
|
+
debug;
|
|
338
|
+
meta;
|
|
339
|
+
constructor(onLog, logLevel, pluginName, watchMode, hookName) {
|
|
340
|
+
this.pluginName = pluginName;
|
|
341
|
+
this.hookName = hookName;
|
|
342
|
+
this.debug = getLogHandler(LOG_LEVEL_DEBUG, "PLUGIN_LOG", onLog, pluginName, logLevel);
|
|
343
|
+
this.info = getLogHandler(LOG_LEVEL_INFO, "PLUGIN_LOG", onLog, pluginName, logLevel);
|
|
344
|
+
this.warn = getLogHandler(LOG_LEVEL_WARN, "PLUGIN_WARNING", onLog, pluginName, logLevel);
|
|
345
|
+
this.meta = {
|
|
346
|
+
rollupVersion: "4.23.0",
|
|
347
|
+
rolldownVersion: VERSION,
|
|
348
|
+
watchMode
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
error(e) {
|
|
352
|
+
return error(logPluginError(normalizeLog(e), this.pluginName, { hook: this.hookName }));
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
|
|
332
356
|
//#endregion
|
|
333
357
|
//#region src/plugin/plugin-driver.ts
|
|
334
358
|
var PluginDriver = class {
|
|
@@ -341,30 +365,20 @@ var PluginDriver = class {
|
|
|
341
365
|
const options = plugin.options;
|
|
342
366
|
if (options) {
|
|
343
367
|
const { handler } = normalizeHook(options);
|
|
344
|
-
const result = await handler.call(
|
|
345
|
-
debug: getLogHandler(LOG_LEVEL_DEBUG, "PLUGIN_LOG", logger, name, logLevel),
|
|
346
|
-
error: (e) => error(logPluginError(normalizeLog(e), name, { hook: "onLog" })),
|
|
347
|
-
info: getLogHandler(LOG_LEVEL_INFO, "PLUGIN_LOG", logger, name, logLevel),
|
|
348
|
-
meta: {
|
|
349
|
-
rollupVersion: "4.23.0",
|
|
350
|
-
rolldownVersion: VERSION,
|
|
351
|
-
watchMode
|
|
352
|
-
},
|
|
353
|
-
warn: getLogHandler(LOG_LEVEL_WARN, "PLUGIN_WARNING", logger, name, logLevel),
|
|
354
|
-
pluginName: name
|
|
355
|
-
}, inputOptions);
|
|
368
|
+
const result = await handler.call(new MinimalPluginContextImpl(logger, logLevel, name, watchMode, "onLog"), inputOptions);
|
|
356
369
|
if (result) inputOptions = result;
|
|
357
370
|
}
|
|
358
371
|
}
|
|
359
372
|
return inputOptions;
|
|
360
373
|
}
|
|
361
|
-
static callOutputOptionsHook(rawPlugins, outputOptions) {
|
|
374
|
+
static callOutputOptionsHook(rawPlugins, outputOptions, onLog, logLevel, watchMode) {
|
|
362
375
|
const sortedPlugins = getSortedPlugins("outputOptions", getObjectPlugins(rawPlugins));
|
|
363
376
|
for (const plugin of sortedPlugins) {
|
|
377
|
+
const name = plugin.name || "unknown";
|
|
364
378
|
const options = plugin.outputOptions;
|
|
365
379
|
if (options) {
|
|
366
380
|
const { handler } = normalizeHook(options);
|
|
367
|
-
const result = handler.call(
|
|
381
|
+
const result = handler.call(new MinimalPluginContextImpl(onLog, logLevel, name, watchMode), outputOptions);
|
|
368
382
|
if (result) outputOptions = result;
|
|
369
383
|
}
|
|
370
384
|
}
|
|
@@ -1093,29 +1107,6 @@ function transformModuleInfo(info, option) {
|
|
|
1093
1107
|
};
|
|
1094
1108
|
}
|
|
1095
1109
|
|
|
1096
|
-
//#endregion
|
|
1097
|
-
//#region src/plugin/minimal-plugin-context.ts
|
|
1098
|
-
var MinimalPluginContextImpl = class {
|
|
1099
|
-
info;
|
|
1100
|
-
warn;
|
|
1101
|
-
debug;
|
|
1102
|
-
meta;
|
|
1103
|
-
constructor(onLog, logLevel, pluginName, watchMode) {
|
|
1104
|
-
this.pluginName = pluginName;
|
|
1105
|
-
this.debug = getLogHandler(LOG_LEVEL_DEBUG, "PLUGIN_LOG", onLog, pluginName, logLevel);
|
|
1106
|
-
this.info = getLogHandler(LOG_LEVEL_INFO, "PLUGIN_LOG", onLog, pluginName, logLevel);
|
|
1107
|
-
this.warn = getLogHandler(LOG_LEVEL_WARN, "PLUGIN_WARNING", onLog, pluginName, logLevel);
|
|
1108
|
-
this.meta = {
|
|
1109
|
-
rollupVersion: "4.23.0",
|
|
1110
|
-
rolldownVersion: VERSION,
|
|
1111
|
-
watchMode
|
|
1112
|
-
};
|
|
1113
|
-
}
|
|
1114
|
-
error(e) {
|
|
1115
|
-
return error(logPluginError(normalizeLog(e), this.pluginName));
|
|
1116
|
-
}
|
|
1117
|
-
};
|
|
1118
|
-
|
|
1119
1110
|
//#endregion
|
|
1120
1111
|
//#region src/utils/transform-side-effects.ts
|
|
1121
1112
|
function bindingifySideEffects(sideEffects) {
|
|
@@ -2639,7 +2630,7 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode, isCl
|
|
|
2639
2630
|
const outputPlugins = await normalizePluginOption(outputOptions.plugins);
|
|
2640
2631
|
const logLevel = inputOptions.logLevel || LOG_LEVEL_INFO;
|
|
2641
2632
|
const onLog = getLogger(getObjectPlugins(inputPlugins), getOnLog(inputOptions, logLevel), logLevel, watchMode);
|
|
2642
|
-
if (!isClose) outputOptions = PluginDriver.callOutputOptionsHook([...inputPlugins, ...outputPlugins], outputOptions);
|
|
2633
|
+
if (!isClose) outputOptions = PluginDriver.callOutputOptionsHook([...inputPlugins, ...outputPlugins], outputOptions, onLog, logLevel, watchMode);
|
|
2643
2634
|
if (outputOptions.minify === true) onLog(LOG_LEVEL_WARN, logMinifyWarning());
|
|
2644
2635
|
const normalizedOutputPlugins = await normalizePluginOption(outputOptions.plugins);
|
|
2645
2636
|
let plugins = [...normalizePlugins(inputPlugins, ANONYMOUS_PLUGIN_PREFIX), ...checkOutputPluginOption(normalizePlugins(normalizedOutputPlugins, ANONYMOUS_OUTPUT_PLUGIN_PREFIX), onLog)];
|
|
@@ -2860,7 +2851,7 @@ const watch = (input) => {
|
|
|
2860
2851
|
|
|
2861
2852
|
//#endregion
|
|
2862
2853
|
//#region package.json
|
|
2863
|
-
var version = "1.0.0-beta.7-commit.
|
|
2854
|
+
var version = "1.0.0-beta.7-commit.139c54d";
|
|
2864
2855
|
var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
|
2865
2856
|
|
|
2866
2857
|
//#endregion
|
|
@@ -13,6 +13,20 @@ function defineConfig(config) {
|
|
|
13
13
|
return config;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/log/logging.ts
|
|
18
|
+
const LOG_LEVEL_SILENT = "silent";
|
|
19
|
+
const LOG_LEVEL_ERROR = "error";
|
|
20
|
+
const LOG_LEVEL_WARN = "warn";
|
|
21
|
+
const LOG_LEVEL_INFO = "info";
|
|
22
|
+
const LOG_LEVEL_DEBUG = "debug";
|
|
23
|
+
const logLevelPriority = {
|
|
24
|
+
[LOG_LEVEL_DEBUG]: 0,
|
|
25
|
+
[LOG_LEVEL_INFO]: 1,
|
|
26
|
+
[LOG_LEVEL_WARN]: 2,
|
|
27
|
+
[LOG_LEVEL_SILENT]: 3
|
|
28
|
+
};
|
|
29
|
+
|
|
16
30
|
//#endregion
|
|
17
31
|
//#region src/utils/misc.ts
|
|
18
32
|
function arraify(value) {
|
|
@@ -34,35 +48,6 @@ function unsupported(info) {
|
|
|
34
48
|
}
|
|
35
49
|
function noop(..._args) {}
|
|
36
50
|
|
|
37
|
-
//#endregion
|
|
38
|
-
//#region src/log/logging.ts
|
|
39
|
-
const LOG_LEVEL_SILENT = "silent";
|
|
40
|
-
const LOG_LEVEL_ERROR = "error";
|
|
41
|
-
const LOG_LEVEL_WARN = "warn";
|
|
42
|
-
const LOG_LEVEL_INFO = "info";
|
|
43
|
-
const LOG_LEVEL_DEBUG = "debug";
|
|
44
|
-
const logLevelPriority = {
|
|
45
|
-
[LOG_LEVEL_DEBUG]: 0,
|
|
46
|
-
[LOG_LEVEL_INFO]: 1,
|
|
47
|
-
[LOG_LEVEL_WARN]: 2,
|
|
48
|
-
[LOG_LEVEL_SILENT]: 3
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
//#endregion
|
|
52
|
-
//#region src/log/log-handler.ts
|
|
53
|
-
const normalizeLog = (log) => typeof log === "string" ? { message: log } : typeof log === "function" ? normalizeLog(log()) : log;
|
|
54
|
-
function getLogHandler(level, code, logger, pluginName, logLevel) {
|
|
55
|
-
if (logLevelPriority[level] < logLevelPriority[logLevel]) return noop;
|
|
56
|
-
return (log, pos) => {
|
|
57
|
-
if (pos != null) logger(LOG_LEVEL_WARN, require_parse_ast_index.logInvalidLogPosition(pluginName));
|
|
58
|
-
log = normalizeLog(log);
|
|
59
|
-
if (log.code && !log.pluginCode) log.pluginCode = log.code;
|
|
60
|
-
log.code = code;
|
|
61
|
-
log.plugin = pluginName;
|
|
62
|
-
logger(level, log);
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
|
|
66
51
|
//#endregion
|
|
67
52
|
//#region src/utils/normalize-hook.ts
|
|
68
53
|
function normalizeHook(hook) {
|
|
@@ -82,6 +67,21 @@ function normalizeHook(hook) {
|
|
|
82
67
|
unreachable("Invalid hook type");
|
|
83
68
|
}
|
|
84
69
|
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region src/log/log-handler.ts
|
|
72
|
+
const normalizeLog = (log) => typeof log === "string" ? { message: log } : typeof log === "function" ? normalizeLog(log()) : log;
|
|
73
|
+
function getLogHandler(level, code, logger, pluginName, logLevel) {
|
|
74
|
+
if (logLevelPriority[level] < logLevelPriority[logLevel]) return noop;
|
|
75
|
+
return (log, pos) => {
|
|
76
|
+
if (pos != null) logger(LOG_LEVEL_WARN, require_parse_ast_index.logInvalidLogPosition(pluginName));
|
|
77
|
+
log = normalizeLog(log);
|
|
78
|
+
if (log.code && !log.pluginCode) log.pluginCode = log.code;
|
|
79
|
+
log.code = code;
|
|
80
|
+
log.plugin = pluginName;
|
|
81
|
+
logger(level, log);
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
85
|
//#endregion
|
|
86
86
|
//#region src/log/logger.ts
|
|
87
87
|
function getLogger(plugins, onLog, logLevel, watchMode) {
|
|
@@ -331,6 +331,30 @@ function normalizePlugins(plugins, anonymousPrefix) {
|
|
|
331
331
|
const ANONYMOUS_PLUGIN_PREFIX = "at position ";
|
|
332
332
|
const ANONYMOUS_OUTPUT_PLUGIN_PREFIX = "at output position ";
|
|
333
333
|
|
|
334
|
+
//#endregion
|
|
335
|
+
//#region src/plugin/minimal-plugin-context.ts
|
|
336
|
+
var MinimalPluginContextImpl = class {
|
|
337
|
+
info;
|
|
338
|
+
warn;
|
|
339
|
+
debug;
|
|
340
|
+
meta;
|
|
341
|
+
constructor(onLog, logLevel, pluginName, watchMode, hookName) {
|
|
342
|
+
this.pluginName = pluginName;
|
|
343
|
+
this.hookName = hookName;
|
|
344
|
+
this.debug = getLogHandler(LOG_LEVEL_DEBUG, "PLUGIN_LOG", onLog, pluginName, logLevel);
|
|
345
|
+
this.info = getLogHandler(LOG_LEVEL_INFO, "PLUGIN_LOG", onLog, pluginName, logLevel);
|
|
346
|
+
this.warn = getLogHandler(LOG_LEVEL_WARN, "PLUGIN_WARNING", onLog, pluginName, logLevel);
|
|
347
|
+
this.meta = {
|
|
348
|
+
rollupVersion: "4.23.0",
|
|
349
|
+
rolldownVersion: VERSION,
|
|
350
|
+
watchMode
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
error(e) {
|
|
354
|
+
return require_parse_ast_index.error(require_parse_ast_index.logPluginError(normalizeLog(e), this.pluginName, { hook: this.hookName }));
|
|
355
|
+
}
|
|
356
|
+
};
|
|
357
|
+
|
|
334
358
|
//#endregion
|
|
335
359
|
//#region src/plugin/plugin-driver.ts
|
|
336
360
|
var PluginDriver = class {
|
|
@@ -343,30 +367,20 @@ var PluginDriver = class {
|
|
|
343
367
|
const options = plugin.options;
|
|
344
368
|
if (options) {
|
|
345
369
|
const { handler } = normalizeHook(options);
|
|
346
|
-
const result = await handler.call(
|
|
347
|
-
debug: getLogHandler(LOG_LEVEL_DEBUG, "PLUGIN_LOG", logger, name, logLevel),
|
|
348
|
-
error: (e) => require_parse_ast_index.error(require_parse_ast_index.logPluginError(normalizeLog(e), name, { hook: "onLog" })),
|
|
349
|
-
info: getLogHandler(LOG_LEVEL_INFO, "PLUGIN_LOG", logger, name, logLevel),
|
|
350
|
-
meta: {
|
|
351
|
-
rollupVersion: "4.23.0",
|
|
352
|
-
rolldownVersion: VERSION,
|
|
353
|
-
watchMode
|
|
354
|
-
},
|
|
355
|
-
warn: getLogHandler(LOG_LEVEL_WARN, "PLUGIN_WARNING", logger, name, logLevel),
|
|
356
|
-
pluginName: name
|
|
357
|
-
}, inputOptions);
|
|
370
|
+
const result = await handler.call(new MinimalPluginContextImpl(logger, logLevel, name, watchMode, "onLog"), inputOptions);
|
|
358
371
|
if (result) inputOptions = result;
|
|
359
372
|
}
|
|
360
373
|
}
|
|
361
374
|
return inputOptions;
|
|
362
375
|
}
|
|
363
|
-
static callOutputOptionsHook(rawPlugins, outputOptions) {
|
|
376
|
+
static callOutputOptionsHook(rawPlugins, outputOptions, onLog, logLevel, watchMode) {
|
|
364
377
|
const sortedPlugins = getSortedPlugins("outputOptions", getObjectPlugins(rawPlugins));
|
|
365
378
|
for (const plugin of sortedPlugins) {
|
|
379
|
+
const name = plugin.name || "unknown";
|
|
366
380
|
const options = plugin.outputOptions;
|
|
367
381
|
if (options) {
|
|
368
382
|
const { handler } = normalizeHook(options);
|
|
369
|
-
const result = handler.call(
|
|
383
|
+
const result = handler.call(new MinimalPluginContextImpl(onLog, logLevel, name, watchMode), outputOptions);
|
|
370
384
|
if (result) outputOptions = result;
|
|
371
385
|
}
|
|
372
386
|
}
|
|
@@ -1095,29 +1109,6 @@ function transformModuleInfo(info, option) {
|
|
|
1095
1109
|
};
|
|
1096
1110
|
}
|
|
1097
1111
|
|
|
1098
|
-
//#endregion
|
|
1099
|
-
//#region src/plugin/minimal-plugin-context.ts
|
|
1100
|
-
var MinimalPluginContextImpl = class {
|
|
1101
|
-
info;
|
|
1102
|
-
warn;
|
|
1103
|
-
debug;
|
|
1104
|
-
meta;
|
|
1105
|
-
constructor(onLog, logLevel, pluginName, watchMode) {
|
|
1106
|
-
this.pluginName = pluginName;
|
|
1107
|
-
this.debug = getLogHandler(LOG_LEVEL_DEBUG, "PLUGIN_LOG", onLog, pluginName, logLevel);
|
|
1108
|
-
this.info = getLogHandler(LOG_LEVEL_INFO, "PLUGIN_LOG", onLog, pluginName, logLevel);
|
|
1109
|
-
this.warn = getLogHandler(LOG_LEVEL_WARN, "PLUGIN_WARNING", onLog, pluginName, logLevel);
|
|
1110
|
-
this.meta = {
|
|
1111
|
-
rollupVersion: "4.23.0",
|
|
1112
|
-
rolldownVersion: VERSION,
|
|
1113
|
-
watchMode
|
|
1114
|
-
};
|
|
1115
|
-
}
|
|
1116
|
-
error(e) {
|
|
1117
|
-
return require_parse_ast_index.error(require_parse_ast_index.logPluginError(normalizeLog(e), this.pluginName));
|
|
1118
|
-
}
|
|
1119
|
-
};
|
|
1120
|
-
|
|
1121
1112
|
//#endregion
|
|
1122
1113
|
//#region src/utils/transform-side-effects.ts
|
|
1123
1114
|
function bindingifySideEffects(sideEffects) {
|
|
@@ -2641,7 +2632,7 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode, isCl
|
|
|
2641
2632
|
const outputPlugins = await normalizePluginOption(outputOptions.plugins);
|
|
2642
2633
|
const logLevel = inputOptions.logLevel || LOG_LEVEL_INFO;
|
|
2643
2634
|
const onLog = getLogger(getObjectPlugins(inputPlugins), getOnLog(inputOptions, logLevel), logLevel, watchMode);
|
|
2644
|
-
if (!isClose) outputOptions = PluginDriver.callOutputOptionsHook([...inputPlugins, ...outputPlugins], outputOptions);
|
|
2635
|
+
if (!isClose) outputOptions = PluginDriver.callOutputOptionsHook([...inputPlugins, ...outputPlugins], outputOptions, onLog, logLevel, watchMode);
|
|
2645
2636
|
if (outputOptions.minify === true) onLog(LOG_LEVEL_WARN, require_parse_ast_index.logMinifyWarning());
|
|
2646
2637
|
const normalizedOutputPlugins = await normalizePluginOption(outputOptions.plugins);
|
|
2647
2638
|
let plugins = [...normalizePlugins(inputPlugins, ANONYMOUS_PLUGIN_PREFIX), ...checkOutputPluginOption(normalizePlugins(normalizedOutputPlugins, ANONYMOUS_OUTPUT_PLUGIN_PREFIX), onLog)];
|
|
@@ -2862,7 +2853,7 @@ const watch = (input) => {
|
|
|
2862
2853
|
|
|
2863
2854
|
//#endregion
|
|
2864
2855
|
//#region package.json
|
|
2865
|
-
var version = "1.0.0-beta.7-commit.
|
|
2856
|
+
var version = "1.0.0-beta.7-commit.139c54d";
|
|
2866
2857
|
var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
|
2867
2858
|
|
|
2868
2859
|
//#endregion
|
|
@@ -56,7 +56,7 @@ export type TransformResult = NullValue | string | Partial<SourceDescription>;
|
|
|
56
56
|
export interface FunctionPluginHooks {
|
|
57
57
|
[DEFINED_HOOK_NAMES.onLog]: (this: MinimalPluginContext, level: LogLevel, log: RollupLog) => NullValue | boolean;
|
|
58
58
|
[DEFINED_HOOK_NAMES.options]: (this: MinimalPluginContext, options: InputOptions) => NullValue | InputOptions;
|
|
59
|
-
[DEFINED_HOOK_NAMES.outputOptions]: (this:
|
|
59
|
+
[DEFINED_HOOK_NAMES.outputOptions]: (this: MinimalPluginContext, options: OutputOptions) => NullValue | OutputOptions;
|
|
60
60
|
[DEFINED_HOOK_NAMES.buildStart]: (this: PluginContext, options: NormalizedInputOptions) => void;
|
|
61
61
|
[DEFINED_HOOK_NAMES.resolveId]: (this: PluginContext, source: string, importer: string | undefined, extraOptions: ResolveIdExtraOptions) => ResolveIdResult;
|
|
62
62
|
/**
|
|
@@ -108,7 +108,7 @@ export type HookFilterExtension<K extends keyof FunctionPluginHooks> = K extends
|
|
|
108
108
|
filter?: Pick<HookFilter, 'id'>;
|
|
109
109
|
} : K extends 'resolveId' ? {
|
|
110
110
|
filter?: {
|
|
111
|
-
id
|
|
111
|
+
id?: StringFilter<RegExp>;
|
|
112
112
|
};
|
|
113
113
|
} : {};
|
|
114
114
|
export type PluginHooks = {
|
|
@@ -14,10 +14,11 @@ export interface MinimalPluginContext {
|
|
|
14
14
|
}
|
|
15
15
|
export declare class MinimalPluginContextImpl {
|
|
16
16
|
readonly pluginName: string;
|
|
17
|
+
private readonly hookName?;
|
|
17
18
|
info: LoggingFunction;
|
|
18
19
|
warn: LoggingFunction;
|
|
19
20
|
debug: LoggingFunction;
|
|
20
21
|
meta: PluginContextMeta;
|
|
21
|
-
constructor(onLog: LogHandler, logLevel: LogLevelOption, pluginName: string, watchMode: boolean);
|
|
22
|
+
constructor(onLog: LogHandler, logLevel: LogLevelOption, pluginName: string, watchMode: boolean, hookName?: string | undefined);
|
|
22
23
|
error(e: RollupError | string): never;
|
|
23
24
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { type LogLevelOption } from '../log/logging';
|
|
1
2
|
import { Plugin } from './';
|
|
2
3
|
import { InputOptions, OutputOptions, RolldownPlugin } from '..';
|
|
4
|
+
import type { LogHandler } from '../types/misc';
|
|
3
5
|
export declare class PluginDriver {
|
|
4
6
|
static callOptionsHook(inputOptions: InputOptions, watchMode?: boolean): Promise<InputOptions>;
|
|
5
|
-
static callOutputOptionsHook(rawPlugins: RolldownPlugin[], outputOptions: OutputOptions): OutputOptions;
|
|
7
|
+
static callOutputOptionsHook(rawPlugins: RolldownPlugin[], outputOptions: OutputOptions, onLog: LogHandler, logLevel: LogLevelOption, watchMode: boolean): OutputOptions;
|
|
6
8
|
}
|
|
7
9
|
export declare function getObjectPlugins(plugins: RolldownPlugin[]): Plugin[];
|
|
8
10
|
export declare function getSortedPlugins(hookName: 'options' | 'outputOptions' | 'onLog', plugins: readonly Plugin[]): Plugin[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rolldown",
|
|
3
|
-
"version": "1.0.0-beta.7-commit.
|
|
3
|
+
"version": "1.0.0-beta.7-commit.139c54d",
|
|
4
4
|
"description": "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.",
|
|
5
5
|
"homepage": "https://rolldown.rs/",
|
|
6
6
|
"repository": {
|
|
@@ -123,21 +123,21 @@
|
|
|
123
123
|
"unbuild": "^3.0.0",
|
|
124
124
|
"why-is-node-running": "^3.0.0",
|
|
125
125
|
"@rolldown/testing": "0.0.1",
|
|
126
|
-
"rolldown": "1.0.0-beta.7-commit.
|
|
126
|
+
"rolldown": "1.0.0-beta.7-commit.139c54d"
|
|
127
127
|
},
|
|
128
128
|
"optionalDependencies": {
|
|
129
|
-
"@rolldown/binding-darwin-arm64": "1.0.0-beta.7-commit.
|
|
130
|
-
"@rolldown/binding-
|
|
131
|
-
"@rolldown/binding-
|
|
132
|
-
"@rolldown/binding-linux-
|
|
133
|
-
"@rolldown/binding-linux-
|
|
134
|
-
"@rolldown/binding-linux-
|
|
135
|
-
"@rolldown/binding-linux-
|
|
136
|
-
"@rolldown/binding-linux-x64-musl": "1.0.0-beta.7-commit.
|
|
137
|
-
"@rolldown/binding-wasm32-wasi": "1.0.0-beta.7-commit.
|
|
138
|
-
"@rolldown/binding-win32-arm64-msvc": "1.0.0-beta.7-commit.
|
|
139
|
-
"@rolldown/binding-win32-
|
|
140
|
-
"@rolldown/binding-win32-
|
|
129
|
+
"@rolldown/binding-darwin-arm64": "1.0.0-beta.7-commit.139c54d",
|
|
130
|
+
"@rolldown/binding-darwin-x64": "1.0.0-beta.7-commit.139c54d",
|
|
131
|
+
"@rolldown/binding-freebsd-x64": "1.0.0-beta.7-commit.139c54d",
|
|
132
|
+
"@rolldown/binding-linux-arm64-gnu": "1.0.0-beta.7-commit.139c54d",
|
|
133
|
+
"@rolldown/binding-linux-arm-gnueabihf": "1.0.0-beta.7-commit.139c54d",
|
|
134
|
+
"@rolldown/binding-linux-arm64-musl": "1.0.0-beta.7-commit.139c54d",
|
|
135
|
+
"@rolldown/binding-linux-x64-gnu": "1.0.0-beta.7-commit.139c54d",
|
|
136
|
+
"@rolldown/binding-linux-x64-musl": "1.0.0-beta.7-commit.139c54d",
|
|
137
|
+
"@rolldown/binding-wasm32-wasi": "1.0.0-beta.7-commit.139c54d",
|
|
138
|
+
"@rolldown/binding-win32-arm64-msvc": "1.0.0-beta.7-commit.139c54d",
|
|
139
|
+
"@rolldown/binding-win32-ia32-msvc": "1.0.0-beta.7-commit.139c54d",
|
|
140
|
+
"@rolldown/binding-win32-x64-msvc": "1.0.0-beta.7-commit.139c54d"
|
|
141
141
|
},
|
|
142
142
|
"scripts": {
|
|
143
143
|
"# Scrips for binding #": "_",
|