@rolldown/browser 1.0.0-beta.10

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.
Files changed (56) hide show
  1. package/LICENSE +25 -0
  2. package/bin/cli.mjs +2 -0
  3. package/dist/cli.cjs +1748 -0
  4. package/dist/cli.d.cts +1 -0
  5. package/dist/cli.d.mts +1 -0
  6. package/dist/cli.mjs +1771 -0
  7. package/dist/config.cjs +12 -0
  8. package/dist/config.d.cts +11 -0
  9. package/dist/config.d.mts +11 -0
  10. package/dist/config.mjs +10 -0
  11. package/dist/experimental-index.browser.mjs +76 -0
  12. package/dist/experimental-index.cjs +129 -0
  13. package/dist/experimental-index.d.cts +96 -0
  14. package/dist/experimental-index.d.mts +96 -0
  15. package/dist/experimental-index.mjs +84 -0
  16. package/dist/filter-index.cjs +53 -0
  17. package/dist/filter-index.d.cts +3 -0
  18. package/dist/filter-index.d.mts +3 -0
  19. package/dist/filter-index.mjs +43 -0
  20. package/dist/index.browser.mjs +3 -0
  21. package/dist/index.cjs +9 -0
  22. package/dist/index.d.cts +3 -0
  23. package/dist/index.d.mts +3 -0
  24. package/dist/index.mjs +5 -0
  25. package/dist/parallel-plugin-worker.cjs +33 -0
  26. package/dist/parallel-plugin-worker.d.cts +1 -0
  27. package/dist/parallel-plugin-worker.d.mts +1 -0
  28. package/dist/parallel-plugin-worker.mjs +32 -0
  29. package/dist/parallel-plugin.cjs +8 -0
  30. package/dist/parallel-plugin.d.cts +14 -0
  31. package/dist/parallel-plugin.d.mts +14 -0
  32. package/dist/parallel-plugin.mjs +7 -0
  33. package/dist/parse-ast-index.cjs +4 -0
  34. package/dist/parse-ast-index.d.cts +9 -0
  35. package/dist/parse-ast-index.d.mts +9 -0
  36. package/dist/parse-ast-index.mjs +3 -0
  37. package/dist/rolldown-binding.wasi-browser.js +111 -0
  38. package/dist/rolldown-binding.wasi.cjs +135 -0
  39. package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
  40. package/dist/shared/chunk-DDkG_k5U.cjs +39 -0
  41. package/dist/shared/define-config.d-BBxr6_Bs.d.mts +1167 -0
  42. package/dist/shared/define-config.d-DII1FzpF.d.cts +1167 -0
  43. package/dist/shared/dist-BMVjvV-v.cjs +249 -0
  44. package/dist/shared/dist-JdACkHJM.mjs +147 -0
  45. package/dist/shared/load-config-CS9U8pRI.cjs +125 -0
  46. package/dist/shared/load-config-MCu-vRGz.mjs +119 -0
  47. package/dist/shared/parse-ast-index-BuelS_NF.cjs +314 -0
  48. package/dist/shared/parse-ast-index-C31FpvkE.mjs +260 -0
  49. package/dist/shared/prompt-8EeOGx1_.cjs +854 -0
  50. package/dist/shared/prompt-C3zHEaSG.mjs +852 -0
  51. package/dist/shared/src-AQQVsE86.mjs +4449 -0
  52. package/dist/shared/src-DKImwtxN.cjs +4647 -0
  53. package/dist/src-8Q9XjZLd.js +4329 -0
  54. package/dist/wasi-worker-browser.mjs +39 -0
  55. package/dist/wasi-worker.mjs +63 -0
  56. package/package.json +71 -0
@@ -0,0 +1,12 @@
1
+ const require_src = require('./shared/src-DKImwtxN.cjs');
2
+ require('./shared/dist-BMVjvV-v.cjs');
3
+ require('./shared/parse-ast-index-BuelS_NF.cjs');
4
+ const require_load_config = require('./shared/load-config-CS9U8pRI.cjs');
5
+
6
+ //#region src/config.ts
7
+ const VERSION = require_src.version;
8
+
9
+ //#endregion
10
+ exports.VERSION = VERSION;
11
+ exports.defineConfig = require_src.defineConfig;
12
+ exports.loadConfig = require_load_config.loadConfig;
@@ -0,0 +1,11 @@
1
+ import { ConfigExport, defineConfig } from "./shared/define-config.d-DII1FzpF.cjs";
2
+
3
+ //#region src/utils/load-config.d.ts
4
+ declare function loadConfig(configPath: string): Promise<ConfigExport>;
5
+
6
+ //#endregion
7
+ //#region src/config.d.ts
8
+ declare const VERSION: string;
9
+
10
+ //#endregion
11
+ export { VERSION, defineConfig, loadConfig };
@@ -0,0 +1,11 @@
1
+ import { ConfigExport, defineConfig$1 as defineConfig } from "./shared/define-config.d-BBxr6_Bs.mjs";
2
+
3
+ //#region src/utils/load-config.d.ts
4
+ declare function loadConfig(configPath: string): Promise<ConfigExport>;
5
+
6
+ //#endregion
7
+ //#region src/config.d.ts
8
+ declare const VERSION: string;
9
+
10
+ //#endregion
11
+ export { VERSION, defineConfig, loadConfig };
@@ -0,0 +1,10 @@
1
+ import { defineConfig, version } from "./shared/src-AQQVsE86.mjs";
2
+ import "./shared/dist-JdACkHJM.mjs";
3
+ import "./shared/parse-ast-index-C31FpvkE.mjs";
4
+ import { loadConfig } from "./shared/load-config-MCu-vRGz.mjs";
5
+
6
+ //#region src/config.ts
7
+ const VERSION = version;
8
+
9
+ //#endregion
10
+ export { VERSION, defineConfig, loadConfig };
@@ -0,0 +1,76 @@
1
+ import { BuiltinPlugin, assetPlugin, buildImportAnalysisPlugin, composeJsPlugins, createBundler, dynamicImportVarsPlugin, handleOutputErrors, importGlobPlugin, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, reporterPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, webWorkerPostPlugin } from "./src-8Q9XjZLd.js";
2
+ import { ResolverFactory, isolatedDeclaration, moduleRunnerTransform, transform } from "./rolldown-binding.wasi-browser.js";
3
+
4
+ //#region src/api/experimental.ts
5
+ /**
6
+ * This is an experimental API. It's behavior may change in the future.
7
+ *
8
+ * Calling this API will only execute the scan stage of rolldown.
9
+ */
10
+ const experimental_scan = async (input) => {
11
+ const { bundler, stopWorkers } = await createBundler(input, {});
12
+ const output = await bundler.scan();
13
+ handleOutputErrors(output);
14
+ await stopWorkers?.();
15
+ };
16
+
17
+ //#endregion
18
+ //#region src/plugin/parallel-plugin.ts
19
+ function defineParallelPlugin(pluginPath) {
20
+ throw new Error("`defineParallelPlugin` is not supported in browser build");
21
+ }
22
+
23
+ //#endregion
24
+ //#region src/builtin-plugin/alias-plugin.ts
25
+ function aliasPlugin(config) {
26
+ return new BuiltinPlugin("builtin:alias", config);
27
+ }
28
+
29
+ //#endregion
30
+ //#region src/builtin-plugin/replace-plugin.ts
31
+ /**
32
+ * Replaces targeted strings in files while bundling.
33
+ *
34
+ * @example
35
+ * // Basic usage
36
+ * ```js
37
+ * replacePlugin({
38
+ * 'process.env.NODE_ENV': JSON.stringify('production'),
39
+ * __buildDate__: () => JSON.stringify(new Date()),
40
+ * __buildVersion: 15
41
+ * })
42
+ * ```
43
+ * @example
44
+ * // With options
45
+ * ```js
46
+ * replacePlugin({
47
+ * 'process.env.NODE_ENV': JSON.stringify('production'),
48
+ * __buildDate__: () => JSON.stringify(new Date()),
49
+ * __buildVersion: 15
50
+ * }, {
51
+ * preventAssignment: false,
52
+ * })
53
+ * ```
54
+ */
55
+ function replacePlugin(values = {}, options = {}) {
56
+ return new BuiltinPlugin("builtin:replace", {
57
+ ...options,
58
+ values
59
+ });
60
+ }
61
+
62
+ //#endregion
63
+ //#region src/builtin-plugin/transform-plugin.ts
64
+ function transformPlugin(config) {
65
+ if (config) config = {
66
+ ...config,
67
+ include: normalizedStringOrRegex(config.include),
68
+ exclude: normalizedStringOrRegex(config.exclude),
69
+ jsxRefreshInclude: normalizedStringOrRegex(config.jsxRefreshInclude),
70
+ jsxRefreshExclude: normalizedStringOrRegex(config.jsxRefreshExclude)
71
+ };
72
+ return new BuiltinPlugin("builtin:transform", config);
73
+ }
74
+
75
+ //#endregion
76
+ export { ResolverFactory, aliasPlugin, assetPlugin, buildImportAnalysisPlugin, composeJsPlugins as composePlugins, defineParallelPlugin, dynamicImportVarsPlugin, importGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, moduleRunnerTransform, replacePlugin, reporterPlugin, experimental_scan as scan, transform, transformPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, webWorkerPostPlugin };
@@ -0,0 +1,129 @@
1
+ const require_chunk = require('./shared/chunk-DDkG_k5U.cjs');
2
+ const require_src = require('./shared/src-DKImwtxN.cjs');
3
+ require('./shared/dist-BMVjvV-v.cjs');
4
+ require('./shared/parse-ast-index-BuelS_NF.cjs');
5
+ const src_rolldown_binding_wasi_cjs = require_chunk.__toESM(require("./rolldown-binding.wasi.cjs"));
6
+ const node_url = require_chunk.__toESM(require("node:url"));
7
+
8
+ //#region src/api/experimental.ts
9
+ /**
10
+ * This is an experimental API. It's behavior may change in the future.
11
+ *
12
+ * Calling this API will only execute the scan stage of rolldown.
13
+ */
14
+ const experimental_scan = async (input) => {
15
+ const { bundler, stopWorkers } = await require_src.createBundler(input, {});
16
+ const output = await bundler.scan();
17
+ require_src.handleOutputErrors(output);
18
+ await stopWorkers?.();
19
+ };
20
+
21
+ //#endregion
22
+ //#region src/plugin/parallel-plugin.ts
23
+ function defineParallelPlugin(pluginPath) {
24
+ return (options) => {
25
+ return { _parallel: {
26
+ fileUrl: (0, node_url.pathToFileURL)(pluginPath).href,
27
+ options
28
+ } };
29
+ };
30
+ }
31
+
32
+ //#endregion
33
+ //#region src/builtin-plugin/alias-plugin.ts
34
+ function aliasPlugin(config) {
35
+ return new require_src.BuiltinPlugin("builtin:alias", config);
36
+ }
37
+
38
+ //#endregion
39
+ //#region src/builtin-plugin/replace-plugin.ts
40
+ /**
41
+ * Replaces targeted strings in files while bundling.
42
+ *
43
+ * @example
44
+ * // Basic usage
45
+ * ```js
46
+ * replacePlugin({
47
+ * 'process.env.NODE_ENV': JSON.stringify('production'),
48
+ * __buildDate__: () => JSON.stringify(new Date()),
49
+ * __buildVersion: 15
50
+ * })
51
+ * ```
52
+ * @example
53
+ * // With options
54
+ * ```js
55
+ * replacePlugin({
56
+ * 'process.env.NODE_ENV': JSON.stringify('production'),
57
+ * __buildDate__: () => JSON.stringify(new Date()),
58
+ * __buildVersion: 15
59
+ * }, {
60
+ * preventAssignment: false,
61
+ * })
62
+ * ```
63
+ */
64
+ function replacePlugin(values = {}, options = {}) {
65
+ return new require_src.BuiltinPlugin("builtin:replace", {
66
+ ...options,
67
+ values
68
+ });
69
+ }
70
+
71
+ //#endregion
72
+ //#region src/builtin-plugin/transform-plugin.ts
73
+ function transformPlugin(config) {
74
+ if (config) config = {
75
+ ...config,
76
+ include: require_src.normalizedStringOrRegex(config.include),
77
+ exclude: require_src.normalizedStringOrRegex(config.exclude),
78
+ jsxRefreshInclude: require_src.normalizedStringOrRegex(config.jsxRefreshInclude),
79
+ jsxRefreshExclude: require_src.normalizedStringOrRegex(config.jsxRefreshExclude)
80
+ };
81
+ return new require_src.BuiltinPlugin("builtin:transform", config);
82
+ }
83
+
84
+ //#endregion
85
+ Object.defineProperty(exports, 'ResolverFactory', {
86
+ enumerable: true,
87
+ get: function () {
88
+ return src_rolldown_binding_wasi_cjs.ResolverFactory;
89
+ }
90
+ });
91
+ exports.aliasPlugin = aliasPlugin;
92
+ exports.assetPlugin = require_src.assetPlugin;
93
+ exports.buildImportAnalysisPlugin = require_src.buildImportAnalysisPlugin;
94
+ exports.composePlugins = require_src.composeJsPlugins;
95
+ exports.defineParallelPlugin = defineParallelPlugin;
96
+ exports.dynamicImportVarsPlugin = require_src.dynamicImportVarsPlugin;
97
+ exports.importGlobPlugin = require_src.importGlobPlugin;
98
+ Object.defineProperty(exports, 'isolatedDeclaration', {
99
+ enumerable: true,
100
+ get: function () {
101
+ return src_rolldown_binding_wasi_cjs.isolatedDeclaration;
102
+ }
103
+ });
104
+ exports.isolatedDeclarationPlugin = require_src.isolatedDeclarationPlugin;
105
+ exports.jsonPlugin = require_src.jsonPlugin;
106
+ exports.loadFallbackPlugin = require_src.loadFallbackPlugin;
107
+ exports.manifestPlugin = require_src.manifestPlugin;
108
+ exports.moduleFederationPlugin = require_src.moduleFederationPlugin;
109
+ exports.modulePreloadPolyfillPlugin = require_src.modulePreloadPolyfillPlugin;
110
+ Object.defineProperty(exports, 'moduleRunnerTransform', {
111
+ enumerable: true,
112
+ get: function () {
113
+ return src_rolldown_binding_wasi_cjs.moduleRunnerTransform;
114
+ }
115
+ });
116
+ exports.replacePlugin = replacePlugin;
117
+ exports.reporterPlugin = require_src.reporterPlugin;
118
+ exports.scan = experimental_scan;
119
+ Object.defineProperty(exports, 'transform', {
120
+ enumerable: true,
121
+ get: function () {
122
+ return src_rolldown_binding_wasi_cjs.transform;
123
+ }
124
+ });
125
+ exports.transformPlugin = transformPlugin;
126
+ exports.viteResolvePlugin = require_src.viteResolvePlugin;
127
+ exports.wasmFallbackPlugin = require_src.wasmFallbackPlugin;
128
+ exports.wasmHelperPlugin = require_src.wasmHelperPlugin;
129
+ exports.webWorkerPostPlugin = require_src.webWorkerPostPlugin;
@@ -0,0 +1,96 @@
1
+ import { BuiltinPlugin, InputOptions, RolldownPlugin, assetPlugin, buildImportAnalysisPlugin, defineParallelPlugin, dynamicImportVarsPlugin, importGlobPlugin, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, reporterPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, webWorkerPostPlugin } from "./shared/define-config.d-DII1FzpF.cjs";
2
+ import { BindingReplacePluginConfig, BindingTransformPluginConfig, IsolatedDeclarationsOptions, IsolatedDeclarationsResult, NapiResolveOptions as ResolveOptions, ResolveResult, ResolverFactory, TransformOptions, TransformResult, isolatedDeclaration, moduleRunnerTransform, transform } from "./rolldown-binding.wasi.cjs";
3
+
4
+ //#region src/api/experimental.d.ts
5
+ /**
6
+ * This is an experimental API. It's behavior may change in the future.
7
+ *
8
+ * Calling this API will only execute the scan stage of rolldown.
9
+ */
10
+ /**
11
+ * This is an experimental API. It's behavior may change in the future.
12
+ *
13
+ * Calling this API will only execute the scan stage of rolldown.
14
+ */
15
+ declare const experimental_scan: (input: InputOptions) => Promise<void>;
16
+
17
+ //#endregion
18
+ //#region src/utils/compose-js-plugins.d.ts
19
+ declare function composeJsPlugins(plugins: RolldownPlugin[]): RolldownPlugin[];
20
+
21
+ //#endregion
22
+ //#region src/builtin-plugin/alias-plugin.d.ts
23
+ type AliasPluginAlias = {
24
+ find: string | RegExp
25
+ replacement: string
26
+ };
27
+ type AliasPluginConfig = {
28
+ entries: AliasPluginAlias[]
29
+ };
30
+ declare function aliasPlugin(config: AliasPluginConfig): BuiltinPlugin;
31
+
32
+ //#endregion
33
+ //#region src/builtin-plugin/replace-plugin.d.ts
34
+ /**
35
+ * Replaces targeted strings in files while bundling.
36
+ *
37
+ * @example
38
+ * // Basic usage
39
+ * ```js
40
+ * replacePlugin({
41
+ * 'process.env.NODE_ENV': JSON.stringify('production'),
42
+ * __buildDate__: () => JSON.stringify(new Date()),
43
+ * __buildVersion: 15
44
+ * })
45
+ * ```
46
+ * @example
47
+ * // With options
48
+ * ```js
49
+ * replacePlugin({
50
+ * 'process.env.NODE_ENV': JSON.stringify('production'),
51
+ * __buildDate__: () => JSON.stringify(new Date()),
52
+ * __buildVersion: 15
53
+ * }, {
54
+ * preventAssignment: false,
55
+ * })
56
+ * ```
57
+ */
58
+ /**
59
+ * Replaces targeted strings in files while bundling.
60
+ *
61
+ * @example
62
+ * // Basic usage
63
+ * ```js
64
+ * replacePlugin({
65
+ * 'process.env.NODE_ENV': JSON.stringify('production'),
66
+ * __buildDate__: () => JSON.stringify(new Date()),
67
+ * __buildVersion: 15
68
+ * })
69
+ * ```
70
+ * @example
71
+ * // With options
72
+ * ```js
73
+ * replacePlugin({
74
+ * 'process.env.NODE_ENV': JSON.stringify('production'),
75
+ * __buildDate__: () => JSON.stringify(new Date()),
76
+ * __buildVersion: 15
77
+ * }, {
78
+ * preventAssignment: false,
79
+ * })
80
+ * ```
81
+ */
82
+ declare function replacePlugin(values?: BindingReplacePluginConfig["values"], options?: Omit<BindingReplacePluginConfig, "values">): BuiltinPlugin;
83
+
84
+ //#endregion
85
+ //#region src/builtin-plugin/transform-plugin.d.ts
86
+ type TransformPattern = string | RegExp | readonly (RegExp | string)[];
87
+ type TransformPluginConfig = Omit<BindingTransformPluginConfig, "include" | "exclude" | "jsxRefreshInclude" | "jsxRefreshExclude"> & {
88
+ include?: TransformPattern
89
+ exclude?: TransformPattern
90
+ jsxRefreshInclude?: TransformPattern
91
+ jsxRefreshExclude?: TransformPattern
92
+ };
93
+ declare function transformPlugin(config?: TransformPluginConfig): BuiltinPlugin;
94
+
95
+ //#endregion
96
+ export { IsolatedDeclarationsOptions, IsolatedDeclarationsResult, ResolveOptions, ResolveResult, ResolverFactory, TransformOptions, TransformResult, aliasPlugin, assetPlugin, buildImportAnalysisPlugin, composeJsPlugins as composePlugins, defineParallelPlugin, dynamicImportVarsPlugin, importGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, moduleRunnerTransform, replacePlugin, reporterPlugin, experimental_scan as scan, transform, transformPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, webWorkerPostPlugin };
@@ -0,0 +1,96 @@
1
+ import { BuiltinPlugin$1 as BuiltinPlugin, InputOptions, RolldownPlugin, assetPlugin$1 as assetPlugin, buildImportAnalysisPlugin$1 as buildImportAnalysisPlugin, defineParallelPlugin, dynamicImportVarsPlugin$1 as dynamicImportVarsPlugin, importGlobPlugin$1 as importGlobPlugin, isolatedDeclarationPlugin$1 as isolatedDeclarationPlugin, jsonPlugin$1 as jsonPlugin, loadFallbackPlugin$1 as loadFallbackPlugin, manifestPlugin$1 as manifestPlugin, moduleFederationPlugin$1 as moduleFederationPlugin, modulePreloadPolyfillPlugin$1 as modulePreloadPolyfillPlugin, reporterPlugin$1 as reporterPlugin, viteResolvePlugin$1 as viteResolvePlugin, wasmFallbackPlugin$1 as wasmFallbackPlugin, wasmHelperPlugin$1 as wasmHelperPlugin, webWorkerPostPlugin$1 as webWorkerPostPlugin } from "./shared/define-config.d-BBxr6_Bs.mjs";
2
+ import { BindingReplacePluginConfig, BindingTransformPluginConfig, IsolatedDeclarationsOptions, IsolatedDeclarationsResult, NapiResolveOptions as ResolveOptions, ResolveResult, ResolverFactory, TransformOptions, TransformResult, isolatedDeclaration, moduleRunnerTransform, transform } from "./rolldown-binding.wasi.cjs";
3
+
4
+ //#region src/api/experimental.d.ts
5
+ /**
6
+ * This is an experimental API. It's behavior may change in the future.
7
+ *
8
+ * Calling this API will only execute the scan stage of rolldown.
9
+ */
10
+ /**
11
+ * This is an experimental API. It's behavior may change in the future.
12
+ *
13
+ * Calling this API will only execute the scan stage of rolldown.
14
+ */
15
+ declare const experimental_scan: (input: InputOptions) => Promise<void>;
16
+
17
+ //#endregion
18
+ //#region src/utils/compose-js-plugins.d.ts
19
+ declare function composeJsPlugins(plugins: RolldownPlugin[]): RolldownPlugin[];
20
+
21
+ //#endregion
22
+ //#region src/builtin-plugin/alias-plugin.d.ts
23
+ type AliasPluginAlias = {
24
+ find: string | RegExp
25
+ replacement: string
26
+ };
27
+ type AliasPluginConfig = {
28
+ entries: AliasPluginAlias[]
29
+ };
30
+ declare function aliasPlugin(config: AliasPluginConfig): BuiltinPlugin;
31
+
32
+ //#endregion
33
+ //#region src/builtin-plugin/replace-plugin.d.ts
34
+ /**
35
+ * Replaces targeted strings in files while bundling.
36
+ *
37
+ * @example
38
+ * // Basic usage
39
+ * ```js
40
+ * replacePlugin({
41
+ * 'process.env.NODE_ENV': JSON.stringify('production'),
42
+ * __buildDate__: () => JSON.stringify(new Date()),
43
+ * __buildVersion: 15
44
+ * })
45
+ * ```
46
+ * @example
47
+ * // With options
48
+ * ```js
49
+ * replacePlugin({
50
+ * 'process.env.NODE_ENV': JSON.stringify('production'),
51
+ * __buildDate__: () => JSON.stringify(new Date()),
52
+ * __buildVersion: 15
53
+ * }, {
54
+ * preventAssignment: false,
55
+ * })
56
+ * ```
57
+ */
58
+ /**
59
+ * Replaces targeted strings in files while bundling.
60
+ *
61
+ * @example
62
+ * // Basic usage
63
+ * ```js
64
+ * replacePlugin({
65
+ * 'process.env.NODE_ENV': JSON.stringify('production'),
66
+ * __buildDate__: () => JSON.stringify(new Date()),
67
+ * __buildVersion: 15
68
+ * })
69
+ * ```
70
+ * @example
71
+ * // With options
72
+ * ```js
73
+ * replacePlugin({
74
+ * 'process.env.NODE_ENV': JSON.stringify('production'),
75
+ * __buildDate__: () => JSON.stringify(new Date()),
76
+ * __buildVersion: 15
77
+ * }, {
78
+ * preventAssignment: false,
79
+ * })
80
+ * ```
81
+ */
82
+ declare function replacePlugin(values?: BindingReplacePluginConfig["values"], options?: Omit<BindingReplacePluginConfig, "values">): BuiltinPlugin;
83
+
84
+ //#endregion
85
+ //#region src/builtin-plugin/transform-plugin.d.ts
86
+ type TransformPattern = string | RegExp | readonly (RegExp | string)[];
87
+ type TransformPluginConfig = Omit<BindingTransformPluginConfig, "include" | "exclude" | "jsxRefreshInclude" | "jsxRefreshExclude"> & {
88
+ include?: TransformPattern
89
+ exclude?: TransformPattern
90
+ jsxRefreshInclude?: TransformPattern
91
+ jsxRefreshExclude?: TransformPattern
92
+ };
93
+ declare function transformPlugin(config?: TransformPluginConfig): BuiltinPlugin;
94
+
95
+ //#endregion
96
+ export { IsolatedDeclarationsOptions, IsolatedDeclarationsResult, ResolveOptions, ResolveResult, ResolverFactory, TransformOptions, TransformResult, aliasPlugin, assetPlugin, buildImportAnalysisPlugin, composeJsPlugins as composePlugins, defineParallelPlugin, dynamicImportVarsPlugin, importGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, moduleRunnerTransform, replacePlugin, reporterPlugin, experimental_scan as scan, transform, transformPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, webWorkerPostPlugin };
@@ -0,0 +1,84 @@
1
+ import { BuiltinPlugin, assetPlugin, buildImportAnalysisPlugin, composeJsPlugins, createBundler, dynamicImportVarsPlugin, handleOutputErrors, importGlobPlugin, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, reporterPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, webWorkerPostPlugin } from "./shared/src-AQQVsE86.mjs";
2
+ import "./shared/dist-JdACkHJM.mjs";
3
+ import "./shared/parse-ast-index-C31FpvkE.mjs";
4
+ import { ResolverFactory, isolatedDeclaration, moduleRunnerTransform, transform } from "./rolldown-binding.wasi.cjs";
5
+ import { pathToFileURL } from "node:url";
6
+
7
+ //#region src/api/experimental.ts
8
+ /**
9
+ * This is an experimental API. It's behavior may change in the future.
10
+ *
11
+ * Calling this API will only execute the scan stage of rolldown.
12
+ */
13
+ const experimental_scan = async (input) => {
14
+ const { bundler, stopWorkers } = await createBundler(input, {});
15
+ const output = await bundler.scan();
16
+ handleOutputErrors(output);
17
+ await stopWorkers?.();
18
+ };
19
+
20
+ //#endregion
21
+ //#region src/plugin/parallel-plugin.ts
22
+ function defineParallelPlugin(pluginPath) {
23
+ return (options) => {
24
+ return { _parallel: {
25
+ fileUrl: pathToFileURL(pluginPath).href,
26
+ options
27
+ } };
28
+ };
29
+ }
30
+
31
+ //#endregion
32
+ //#region src/builtin-plugin/alias-plugin.ts
33
+ function aliasPlugin(config) {
34
+ return new BuiltinPlugin("builtin:alias", config);
35
+ }
36
+
37
+ //#endregion
38
+ //#region src/builtin-plugin/replace-plugin.ts
39
+ /**
40
+ * Replaces targeted strings in files while bundling.
41
+ *
42
+ * @example
43
+ * // Basic usage
44
+ * ```js
45
+ * replacePlugin({
46
+ * 'process.env.NODE_ENV': JSON.stringify('production'),
47
+ * __buildDate__: () => JSON.stringify(new Date()),
48
+ * __buildVersion: 15
49
+ * })
50
+ * ```
51
+ * @example
52
+ * // With options
53
+ * ```js
54
+ * replacePlugin({
55
+ * 'process.env.NODE_ENV': JSON.stringify('production'),
56
+ * __buildDate__: () => JSON.stringify(new Date()),
57
+ * __buildVersion: 15
58
+ * }, {
59
+ * preventAssignment: false,
60
+ * })
61
+ * ```
62
+ */
63
+ function replacePlugin(values = {}, options = {}) {
64
+ return new BuiltinPlugin("builtin:replace", {
65
+ ...options,
66
+ values
67
+ });
68
+ }
69
+
70
+ //#endregion
71
+ //#region src/builtin-plugin/transform-plugin.ts
72
+ function transformPlugin(config) {
73
+ if (config) config = {
74
+ ...config,
75
+ include: normalizedStringOrRegex(config.include),
76
+ exclude: normalizedStringOrRegex(config.exclude),
77
+ jsxRefreshInclude: normalizedStringOrRegex(config.jsxRefreshInclude),
78
+ jsxRefreshExclude: normalizedStringOrRegex(config.jsxRefreshExclude)
79
+ };
80
+ return new BuiltinPlugin("builtin:transform", config);
81
+ }
82
+
83
+ //#endregion
84
+ export { ResolverFactory, aliasPlugin, assetPlugin, buildImportAnalysisPlugin, composeJsPlugins as composePlugins, defineParallelPlugin, dynamicImportVarsPlugin, importGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, moduleRunnerTransform, replacePlugin, reporterPlugin, experimental_scan as scan, transform, transformPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, webWorkerPostPlugin };
@@ -0,0 +1,53 @@
1
+ const require_dist = require('./shared/dist-BMVjvV-v.cjs');
2
+
3
+ //#region src/plugin/with-filter.ts
4
+ function withFilterImpl(pluginOption, filterObjectList) {
5
+ if (require_dist.isPromiseLike(pluginOption)) return pluginOption.then((p) => withFilter(p, filterObjectList));
6
+ if (pluginOption == false || pluginOption == null) return pluginOption;
7
+ if (Array.isArray(pluginOption)) return pluginOption.map((p) => withFilter(p, filterObjectList));
8
+ let plugin = pluginOption;
9
+ let filterObjectIndex = findMatchedFilterObject(plugin.name, filterObjectList);
10
+ if (filterObjectIndex === -1) return plugin;
11
+ let filterObject = filterObjectList[filterObjectIndex];
12
+ Object.keys(plugin).forEach((key) => {
13
+ switch (key) {
14
+ case "transform":
15
+ case "resolveId":
16
+ case "load":
17
+ if (!plugin[key]) return;
18
+ if (typeof plugin[key] === "object") plugin[key].filter = filterObject[key] ?? plugin[key].filter;
19
+ else plugin[key] = {
20
+ handler: plugin[key],
21
+ filter: filterObject[key]
22
+ };
23
+ break;
24
+ default: break;
25
+ }
26
+ });
27
+ return plugin;
28
+ }
29
+ function withFilter(pluginOption, filterObject) {
30
+ return withFilterImpl(pluginOption, require_dist.arraify(filterObject));
31
+ }
32
+ function findMatchedFilterObject(pluginName, overrideFilterObjectList) {
33
+ if (overrideFilterObjectList.length === 1 && overrideFilterObjectList[0].pluginNamePattern === void 0) return 0;
34
+ for (let i = 0; i < overrideFilterObjectList.length; i++) for (let j = 0; j < (overrideFilterObjectList[i].pluginNamePattern ?? []).length; j++) {
35
+ let pattern = overrideFilterObjectList[i].pluginNamePattern[j];
36
+ if (typeof pattern === "string" && pattern === pluginName) return i;
37
+ else if (pattern instanceof RegExp && pattern.test(pluginName)) return i;
38
+ }
39
+ return -1;
40
+ }
41
+
42
+ //#endregion
43
+ exports.and = require_dist.and;
44
+ exports.code = require_dist.code;
45
+ exports.exclude = require_dist.exclude;
46
+ exports.id = require_dist.id;
47
+ exports.include = require_dist.include;
48
+ exports.moduleType = require_dist.moduleType;
49
+ exports.not = require_dist.not;
50
+ exports.or = require_dist.or;
51
+ exports.queries = require_dist.queries;
52
+ exports.query = require_dist.query;
53
+ exports.withFilter = withFilter;
@@ -0,0 +1,3 @@
1
+ import { and, code, exclude, id, include, moduleType, not, or, queries, query, withFilter } from "./shared/define-config.d-DII1FzpF.cjs";
2
+
3
+ export { and, code, exclude, id, include, moduleType, not, or, queries, query, withFilter };
@@ -0,0 +1,3 @@
1
+ import { and, code, exclude, id, include, moduleType, not, or, queries, query, withFilter } from "./shared/define-config.d-BBxr6_Bs.mjs";
2
+
3
+ export { and, code, exclude, id, include, moduleType, not, or, queries, query, withFilter };
@@ -0,0 +1,43 @@
1
+ import { and$1 as and, arraify, code$1 as code, exclude$1 as exclude, id$1 as id, include$1 as include, isPromiseLike, moduleType$1 as moduleType, not$1 as not, or$1 as or, queries$1 as queries, query$1 as query } from "./shared/dist-JdACkHJM.mjs";
2
+
3
+ //#region src/plugin/with-filter.ts
4
+ function withFilterImpl(pluginOption, filterObjectList) {
5
+ if (isPromiseLike(pluginOption)) return pluginOption.then((p) => withFilter(p, filterObjectList));
6
+ if (pluginOption == false || pluginOption == null) return pluginOption;
7
+ if (Array.isArray(pluginOption)) return pluginOption.map((p) => withFilter(p, filterObjectList));
8
+ let plugin = pluginOption;
9
+ let filterObjectIndex = findMatchedFilterObject(plugin.name, filterObjectList);
10
+ if (filterObjectIndex === -1) return plugin;
11
+ let filterObject = filterObjectList[filterObjectIndex];
12
+ Object.keys(plugin).forEach((key) => {
13
+ switch (key) {
14
+ case "transform":
15
+ case "resolveId":
16
+ case "load":
17
+ if (!plugin[key]) return;
18
+ if (typeof plugin[key] === "object") plugin[key].filter = filterObject[key] ?? plugin[key].filter;
19
+ else plugin[key] = {
20
+ handler: plugin[key],
21
+ filter: filterObject[key]
22
+ };
23
+ break;
24
+ default: break;
25
+ }
26
+ });
27
+ return plugin;
28
+ }
29
+ function withFilter(pluginOption, filterObject) {
30
+ return withFilterImpl(pluginOption, arraify(filterObject));
31
+ }
32
+ function findMatchedFilterObject(pluginName, overrideFilterObjectList) {
33
+ if (overrideFilterObjectList.length === 1 && overrideFilterObjectList[0].pluginNamePattern === void 0) return 0;
34
+ for (let i = 0; i < overrideFilterObjectList.length; i++) for (let j = 0; j < (overrideFilterObjectList[i].pluginNamePattern ?? []).length; j++) {
35
+ let pattern = overrideFilterObjectList[i].pluginNamePattern[j];
36
+ if (typeof pattern === "string" && pattern === pluginName) return i;
37
+ else if (pattern instanceof RegExp && pattern.test(pluginName)) return i;
38
+ }
39
+ return -1;
40
+ }
41
+
42
+ //#endregion
43
+ export { and, code, exclude, id, include, moduleType, not, or, queries, query, withFilter };
@@ -0,0 +1,3 @@
1
+ import { VERSION, build, defineConfig, rolldown, watch } from "./src-8Q9XjZLd.js";
2
+
3
+ export { VERSION, build, defineConfig, rolldown, watch };
package/dist/index.cjs ADDED
@@ -0,0 +1,9 @@
1
+ const require_src = require('./shared/src-DKImwtxN.cjs');
2
+ require('./shared/dist-BMVjvV-v.cjs');
3
+ require('./shared/parse-ast-index-BuelS_NF.cjs');
4
+
5
+ exports.VERSION = require_src.VERSION;
6
+ exports.build = require_src.build;
7
+ exports.defineConfig = require_src.defineConfig;
8
+ exports.rolldown = require_src.rolldown;
9
+ exports.watch = require_src.watch;
@@ -0,0 +1,3 @@
1
+ import { AddonFunction, AsyncPluginHooks, BuildOptions, ChunkFileNamesFunction, ConfigExport, CustomPluginOptions, DefineParallelPluginResult, EmittedAsset, EmittedFile, ExistingRawSourceMap, ExternalOption, FunctionPluginHooks, GeneralHookFilter, GetModuleInfo, GlobalsFunction, HookFilter, HookFilterExtension, ImportKind, InputOption, InputOptions, InternalModuleFormat, LoadResult, LogLevel, LogLevelOption, LogOrStringHandler, LoggingFunction, MinifyOptions, MinimalPluginContext, ModuleFormat, ModuleInfo, ModuleOptions, ModuleType, ModuleTypeFilter, ModuleTypes, NormalizedInputOptions, NormalizedOutputOptions, ObjectHook, OutputAsset, OutputBundle, OutputChunk, OutputOptions, ParallelPluginHooks, PartialNull, PartialResolvedId, Plugin, PluginContext, PluginContextMeta, PreRenderedAsset, PreRenderedChunk, RenderedChunk, RenderedModule, ResolveIdExtraOptions, ResolveIdResult, ResolvedId, RolldownBuild, RolldownOptions, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatcher, RolldownWatcherEvent, RollupError, RollupLog, RollupLogWithString, SourceDescription, SourceMap, SourceMapInput, SourcemapIgnoreListOption, TransformPluginContext, TransformResult, TreeshakingOptions, VERSION, WarningHandlerWithDefault, WatchOptions, WatcherOptions, build, defineConfig, rolldown, watch } from "./shared/define-config.d-DII1FzpF.cjs";
2
+
3
+ export { AddonFunction, AsyncPluginHooks, BuildOptions, ChunkFileNamesFunction, ConfigExport, CustomPluginOptions, DefineParallelPluginResult, EmittedAsset, EmittedFile, ExistingRawSourceMap, ExternalOption, FunctionPluginHooks, GeneralHookFilter, GetModuleInfo, GlobalsFunction, HookFilter, HookFilterExtension, ImportKind, InputOption, InputOptions, InternalModuleFormat, LoadResult, LogLevel, LogLevelOption, LogOrStringHandler, LoggingFunction, MinifyOptions, MinimalPluginContext, ModuleFormat, ModuleInfo, ModuleOptions, ModuleType, ModuleTypeFilter, ModuleTypes, NormalizedInputOptions, NormalizedOutputOptions, ObjectHook, OutputAsset, OutputBundle, OutputChunk, OutputOptions, ParallelPluginHooks, PartialNull, PartialResolvedId, Plugin, PluginContext, PluginContextMeta, PreRenderedAsset, PreRenderedChunk, RenderedChunk, RenderedModule, ResolveIdExtraOptions, ResolveIdResult, ResolvedId, RolldownBuild, RolldownOptions, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatcher, RolldownWatcherEvent, RollupError, RollupLog, RollupLogWithString, SourceDescription, SourceMap, SourceMapInput, SourcemapIgnoreListOption, TransformPluginContext, TransformResult, TreeshakingOptions, VERSION, WarningHandlerWithDefault, WatchOptions, WatcherOptions, build, defineConfig, rolldown, watch };