@rollipop/rolldown 0.0.0-beta.3 → 1.0.0-rc.1

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 (39) hide show
  1. package/dist/cli-setup.mjs +1 -1
  2. package/dist/cli.mjs +121 -114
  3. package/dist/config.d.mts +2 -2
  4. package/dist/config.mjs +8 -8
  5. package/dist/experimental-index.d.mts +43 -43
  6. package/dist/experimental-index.mjs +6 -6
  7. package/dist/filter-index.d.mts +197 -4
  8. package/dist/filter-index.mjs +1 -1
  9. package/dist/get-log-filter.d.mts +3 -3
  10. package/dist/index.d.mts +4 -4
  11. package/dist/index.mjs +27 -8
  12. package/dist/parallel-plugin-worker.mjs +4 -4
  13. package/dist/parallel-plugin.d.mts +4 -4
  14. package/dist/parse-ast-index.d.mts +1 -1
  15. package/dist/parse-ast-index.mjs +2 -2
  16. package/dist/plugins-index.d.mts +3 -4
  17. package/dist/plugins-index.mjs +3 -3
  18. package/dist/shared/binding-B92Lq__Q.d.mts +1687 -0
  19. package/dist/shared/{binding-uOeDeDzp.mjs → binding-tNJoEqAa.mjs} +28 -26
  20. package/dist/shared/{bindingify-input-options-CuBDHglZ.mjs → bindingify-input-options-CfhrNd_y.mjs} +117 -58
  21. package/dist/shared/{constructors-D9F4Aj4h.d.mts → constructors--k1uxZrh.d.mts} +2 -2
  22. package/dist/shared/{constructors-DmSv3tnW.mjs → constructors-414MPkgB.mjs} +1 -1
  23. package/dist/shared/define-config-D8xP5iyL.d.mts +3463 -0
  24. package/dist/shared/{load-config-Bo3y98vw.mjs → load-config-Qtd9pHJ5.mjs} +1 -1
  25. package/dist/shared/logging-wIy4zY9I.d.mts +50 -0
  26. package/dist/shared/{normalize-string-or-regex-0f6WITto.mjs → normalize-string-or-regex-DeB7vQ75.mjs} +2 -2
  27. package/dist/shared/{parse-ast-index-B0iVLbj6.mjs → parse-ast-index-BcP4Ts_P.mjs} +3 -3
  28. package/dist/shared/{prompt-BZ-QjPVS.mjs → prompt-tlfjalEt.mjs} +1 -1
  29. package/dist/shared/rolldown-BMzJcmQ7.mjs +42 -0
  30. package/dist/shared/{rolldown-build-BqHWBpp7.mjs → rolldown-build-DWeKtJOy.mjs} +123 -47
  31. package/dist/shared/{watch-Ce8bKBAn.mjs → watch-HmN4U4B9.mjs} +34 -6
  32. package/package.json +18 -16
  33. package/dist/shared/binding-C9YdqoUG.d.mts +0 -1657
  34. package/dist/shared/define-config-glNgjHCc.d.mts +0 -2573
  35. package/dist/shared/logging-DsnCZi19.d.mts +0 -42
  36. package/dist/shared/rolldown-mAJGca5O.mjs +0 -11
  37. /package/dist/shared/{define-config-BF4P-Pum.mjs → define-config-BVG4QvnP.mjs} +0 -0
  38. /package/dist/shared/{logs-N5Akftom.mjs → logs-NH298mHo.mjs} +0 -0
  39. /package/dist/shared/{misc-0HsaOsAX.mjs → misc-CCZIsXVO.mjs} +0 -0
@@ -1,4 +1,4 @@
1
- import { t as rolldown } from "./rolldown-mAJGca5O.mjs";
1
+ import { t as rolldown } from "./rolldown-BMzJcmQ7.mjs";
2
2
  import fs from "node:fs";
3
3
  import path from "node:path";
4
4
  import { readdir } from "node:fs/promises";
@@ -0,0 +1,50 @@
1
+ //#region src/log/logging.d.ts
2
+ /** @inline */
3
+ type LogLevel = "info" | "debug" | "warn";
4
+ /** @inline */
5
+ type LogLevelOption = LogLevel | "silent";
6
+ /** @inline */
7
+ type LogLevelWithError = LogLevel | "error";
8
+ interface RolldownLog {
9
+ binding?: string;
10
+ cause?: unknown;
11
+ /**
12
+ * The log code for this log object.
13
+ * @example 'PLUGIN_ERROR'
14
+ */
15
+ code?: string;
16
+ exporter?: string;
17
+ frame?: string;
18
+ hook?: string;
19
+ id?: string;
20
+ ids?: string[];
21
+ loc?: {
22
+ column: number;
23
+ file?: string;
24
+ line: number;
25
+ };
26
+ /**
27
+ * The message for this log object.
28
+ * @example 'The "transform" hook used by the output plugin "rolldown-plugin-foo" 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.'
29
+ */
30
+ message: string;
31
+ meta?: any;
32
+ names?: string[];
33
+ plugin?: string;
34
+ pluginCode?: unknown;
35
+ pos?: number;
36
+ reexporter?: string;
37
+ stack?: string;
38
+ url?: string;
39
+ }
40
+ /** @inline */
41
+ type RolldownLogWithString = RolldownLog | string;
42
+ /** @category Plugin APIs */
43
+ interface RolldownError extends RolldownLog {
44
+ name?: string;
45
+ stack?: string;
46
+ watchFiles?: string[];
47
+ }
48
+ type LogOrStringHandler = (level: LogLevelWithError, log: RolldownLogWithString) => void;
49
+ //#endregion
50
+ export { RolldownLog as a, RolldownError as i, LogLevelOption as n, RolldownLogWithString as o, LogOrStringHandler as r, LogLevel as t };
@@ -1,5 +1,5 @@
1
- import { n as __toESM, t as require_binding } from "./binding-uOeDeDzp.mjs";
2
- import { c as logPluginError, n as error } from "./logs-N5Akftom.mjs";
1
+ import { n as __toESM, t as require_binding } from "./binding-tNJoEqAa.mjs";
2
+ import { c as logPluginError, n as error } from "./logs-NH298mHo.mjs";
3
3
 
4
4
  //#region src/builtin-plugin/utils.ts
5
5
  var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
@@ -1,7 +1,7 @@
1
- import { n as __toESM, t as require_binding } from "./binding-uOeDeDzp.mjs";
2
- import { l as locate, n as error, s as logParseError, t as augmentCodeLocation, u as getCodeFrame } from "./logs-N5Akftom.mjs";
1
+ import { n as __toESM, t as require_binding } from "./binding-tNJoEqAa.mjs";
2
+ import { l as locate, n as error, s as logParseError, t as augmentCodeLocation, u as getCodeFrame } from "./logs-NH298mHo.mjs";
3
3
 
4
- //#region ../../node_modules/.pnpm/oxc-parser@0.108.0/node_modules/oxc-parser/src-js/wrap.js
4
+ //#region ../../node_modules/.pnpm/oxc-parser@0.110.0/node_modules/oxc-parser/src-js/wrap.js
5
5
  function wrap$1(result) {
6
6
  let program, module, comments, errors;
7
7
  return {
@@ -380,7 +380,7 @@ const iD = sD(), v = new Set(["\x1B", "›"]), CD = 39, w$1 = "\x07", W$1 = "[",
380
380
  `)];
381
381
  for (const [E, a] of o.entries()) {
382
382
  if (e += a, v.has(a)) {
383
- const { groups: B } = (/* @__PURE__ */ new RegExp(`(?:\\${W$1}(?<code>\\d+)m|\\${y}(?<uri>.*)${w$1})`)).exec(o.slice(E).join("")) || { groups: {} };
383
+ const { groups: B } = new RegExp(`(?:\\${W$1}(?<code>\\d+)m|\\${y}(?<uri>.*)${w$1})`).exec(o.slice(E).join("")) || { groups: {} };
384
384
  if (B.code !== void 0) {
385
385
  const p = Number.parseFloat(B.code);
386
386
  s = p === CD ? void 0 : p;
@@ -0,0 +1,42 @@
1
+ import { l as PluginDriver, s as validateOption, t as RolldownBuild } from "./rolldown-build-DWeKtJOy.mjs";
2
+
3
+ //#region src/api/rolldown/index.ts
4
+ /**
5
+ * The API compatible with Rollup's `rollup` function.
6
+ *
7
+ * Unlike Rollup, the module graph is not built until the methods of the bundle object are called.
8
+ *
9
+ * @param input The input options object.
10
+ * @returns A Promise that resolves to a bundle object.
11
+ *
12
+ * @example
13
+ * ```js
14
+ * import { rolldown } from 'rolldown';
15
+ *
16
+ * let bundle, failed = false;
17
+ * try {
18
+ * bundle = await rolldown({
19
+ * input: 'src/main.js',
20
+ * });
21
+ * await bundle.write({
22
+ * format: 'esm',
23
+ * });
24
+ * } catch (e) {
25
+ * console.error(e);
26
+ * failed = true;
27
+ * }
28
+ * if (bundle) {
29
+ * await bundle.close();
30
+ * }
31
+ * process.exitCode = failed ? 1 : 0;
32
+ * ```
33
+ *
34
+ * @category Programmatic APIs
35
+ */
36
+ const rolldown = async (input) => {
37
+ validateOption("input", input);
38
+ return new RolldownBuild(await PluginDriver.callOptionsHook(input));
39
+ };
40
+
41
+ //#endregion
42
+ export { rolldown as t };
@@ -1,8 +1,8 @@
1
- import { n as __toESM, t as require_binding } from "./binding-uOeDeDzp.mjs";
2
- import { i as logInputHookInOutputPlugin, n as error } from "./logs-N5Akftom.mjs";
3
- import { n as BuiltinPlugin } from "./normalize-string-or-regex-0f6WITto.mjs";
4
- import { S as VERSION, _ as LOG_LEVEL_DEBUG, b as LOG_LEVEL_WARN, c as transformToRollupOutput, d as transformAssetSource, f as lazyProp, g as normalizeLog, h as normalizeHook, i as transformModuleInfo, l as transformRenderedChunk, m as MinimalPluginContextImpl, p as PlainObjectLike, s as unwrapBindingResult, t as bindingifyInputOptions, u as __decorate, v as LOG_LEVEL_ERROR, x as logLevelPriority, y as LOG_LEVEL_INFO } from "./bindingify-input-options-CuBDHglZ.mjs";
5
- import { i as unimplemented } from "./misc-0HsaOsAX.mjs";
1
+ import { n as __toESM, t as require_binding } from "./binding-tNJoEqAa.mjs";
2
+ import { i as logInputHookInOutputPlugin, n as error } from "./logs-NH298mHo.mjs";
3
+ import { n as BuiltinPlugin } from "./normalize-string-or-regex-DeB7vQ75.mjs";
4
+ import { S as VERSION, _ as LOG_LEVEL_DEBUG, b as LOG_LEVEL_WARN, c as transformToRollupOutput, d as transformAssetSource, f as lazyProp, g as normalizeLog, h as normalizeHook, i as transformModuleInfo, l as transformRenderedChunk, m as MinimalPluginContextImpl, p as PlainObjectLike, s as unwrapBindingResult, t as bindingifyInputOptions, u as __decorate, v as LOG_LEVEL_ERROR, x as logLevelPriority, y as LOG_LEVEL_INFO } from "./bindingify-input-options-CfhrNd_y.mjs";
5
+ import { i as unimplemented } from "./misc-CCZIsXVO.mjs";
6
6
  import { Worker } from "node:worker_threads";
7
7
  import path from "node:path";
8
8
  import { styleText } from "node:util";
@@ -152,11 +152,11 @@ const DEFINED_HOOK_NAMES = {
152
152
 
153
153
  //#endregion
154
154
  //#region src/utils/async-flatten.ts
155
- async function asyncFlatten(array$1) {
155
+ async function asyncFlatten(array) {
156
156
  do
157
- array$1 = (await Promise.all(array$1)).flat(Infinity);
158
- while (array$1.some((v) => v?.then));
159
- return array$1;
157
+ array = (await Promise.all(array)).flat(Infinity);
158
+ while (array.some((v) => v?.then));
159
+ return array;
160
160
  }
161
161
 
162
162
  //#endregion
@@ -1461,17 +1461,17 @@ function flattenValibotSchema(schema, result = {}, prefix = "") {
1461
1461
  const fullKey = prefix ? `${prefix}.${key}` : key;
1462
1462
  const valueSchema = value;
1463
1463
  const type = getValibotSchemaType(valueSchema);
1464
- const description$1 = getValibotDescription(valueSchema);
1464
+ const description = getValibotDescription(valueSchema);
1465
1465
  if (type === "object") {
1466
1466
  const unwrappedSchema = unwrapSchema(valueSchema);
1467
1467
  if (unwrappedSchema && unwrappedSchema.entries) flattenValibotSchema(unwrappedSchema, result, fullKey);
1468
1468
  else result[fullKey] = {
1469
1469
  type,
1470
- description: description$1
1470
+ description
1471
1471
  };
1472
1472
  } else result[fullKey] = {
1473
1473
  type,
1474
- description: description$1
1474
+ description
1475
1475
  };
1476
1476
  }
1477
1477
  }
@@ -1485,8 +1485,8 @@ function flattenValibotSchema(schema, result = {}, prefix = "") {
1485
1485
  * In Node.js, it uses the native `styleText` from `node:util`
1486
1486
  * In browser, it provides empty styling functions for compatibility
1487
1487
  */
1488
- function styleText$1(...args$1) {
1489
- return styleText(...args$1);
1488
+ function styleText$1(...args) {
1489
+ return styleText(...args);
1490
1490
  }
1491
1491
 
1492
1492
  //#endregion
@@ -1680,6 +1680,7 @@ const TreeshakingOptionsSchema = union([boolean(), looseObject({
1680
1680
  annotations: optional(boolean()),
1681
1681
  manualPureFunctions: optional(array(string())),
1682
1682
  unknownGlobalSideEffects: optional(boolean()),
1683
+ invalidImportSideEffects: optional(boolean()),
1683
1684
  commonjs: optional(boolean()),
1684
1685
  propertyReadSideEffects: optional(union([literal(false), literal("always")])),
1685
1686
  propertyWriteSideEffects: optional(union([literal(false), literal("always")]))
@@ -1879,7 +1880,7 @@ const OutputOptionsSchema = strictObject({
1879
1880
  inlineDynamicImports: pipe(optional(boolean()), description("Inline dynamic imports")),
1880
1881
  dynamicImportInCjs: pipe(optional(boolean()), description("Dynamic import in CJS output")),
1881
1882
  manualChunks: optional(ManualChunksFunctionSchema),
1882
- codeSplitting: optional(AdvancedChunksSchema),
1883
+ codeSplitting: optional(union([boolean(), AdvancedChunksSchema])),
1883
1884
  advancedChunks: optional(AdvancedChunksSchema),
1884
1885
  legalComments: pipe(optional(union([literal("none"), literal("inline")])), description("Control comments in the output")),
1885
1886
  plugins: optional(custom(() => true)),
@@ -1912,10 +1913,10 @@ const OutputCliOverrideSchema = strictObject({
1912
1913
  outro: pipe(optional(string()), description(getAddonDescription("bottom", "inside"))),
1913
1914
  esModule: pipe(optional(boolean()), description("Always generate `__esModule` marks in non-ESM formats, defaults to `if-default-prop` (use `--no-esModule` to always disable)")),
1914
1915
  globals: pipe(optional(record(string(), string())), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
1915
- codeSplitting: pipe(optional(strictObject({
1916
+ codeSplitting: pipe(optional(union([boolean(), strictObject({
1916
1917
  minSize: pipe(optional(number()), description("Minimum size of the chunk")),
1917
1918
  minShareCount: pipe(optional(number()), description("Minimum share count of the chunk"))
1918
- })), description("Code splitting options")),
1919
+ })])), description("Code splitting options (true, false, or object)")),
1919
1920
  advancedChunks: pipe(optional(strictObject({
1920
1921
  minSize: pipe(optional(number()), description("Minimum size of the chunk")),
1921
1922
  minShareCount: pipe(optional(number()), description("Minimum share count of the chunk"))
@@ -1958,11 +1959,11 @@ function validateOption(key, options) {
1958
1959
  if (!parsed.success) {
1959
1960
  const errors = parsed.issues.map((issue) => {
1960
1961
  let issueMsg = issue.message;
1961
- const issuePaths = issue.path.map((path$1) => path$1.key);
1962
+ const issuePaths = issue.path.map((path) => path.key);
1962
1963
  if (issue.type === "union") {
1963
1964
  const subIssue = issue.issues?.find((i) => !(i.type !== issue.received && i.input === issue.input));
1964
1965
  if (subIssue) {
1965
- if (subIssue.path) issuePaths.push(subIssue.path.map((path$1) => path$1.key));
1966
+ if (subIssue.path) issuePaths.push(subIssue.path.map((path) => path.key));
1966
1967
  issueMsg = subIssue.message;
1967
1968
  }
1968
1969
  }
@@ -2027,11 +2028,8 @@ var ChunkingContextImpl = class {
2027
2028
  //#endregion
2028
2029
  //#region src/utils/bindingify-output-options.ts
2029
2030
  function bindingifyOutputOptions(outputOptions) {
2030
- const { dir, format, exports, hashCharacters, sourcemap, sourcemapBaseUrl, sourcemapDebugIds, sourcemapIgnoreList, sourcemapPathTransform, name, assetFileNames, entryFileNames, chunkFileNames, cssEntryFileNames, cssChunkFileNames, banner, footer, postBanner, postFooter, intro, outro, esModule, globals, paths, generatedCode, file, sanitizeFileName, preserveModules, virtualDirname, legalComments, preserveModulesRoot, manualChunks, topLevelVar, cleanDir, globalIdentifiers } = outputOptions;
2031
- if (outputOptions.inlineDynamicImports === true) {
2032
- if (manualChunks != null) throw new Error("Invalid value \"true\" for option \"output.inlineDynamicImports\" - this option is not supported for \"output.manualChunks\".");
2033
- }
2034
- const advancedChunks = bindingifyAdvancedChunks(outputOptions.codeSplitting, outputOptions.advancedChunks, manualChunks);
2031
+ const { dir, format, exports, hashCharacters, sourcemap, sourcemapBaseUrl, sourcemapDebugIds, sourcemapIgnoreList, sourcemapPathTransform, name, assetFileNames, entryFileNames, chunkFileNames, cssEntryFileNames, cssChunkFileNames, banner, footer, postBanner, postFooter, intro, outro, esModule, globals, paths, generatedCode, file, sanitizeFileName, preserveModules, virtualDirname, legalComments, preserveModulesRoot, manualChunks, topLevelVar, cleanDir, strictExecutionOrder, globalIdentifiers } = outputOptions;
2032
+ const { inlineDynamicImports, advancedChunks } = bindingifyCodeSplitting(outputOptions.codeSplitting, outputOptions.inlineDynamicImports, outputOptions.advancedChunks, manualChunks);
2035
2033
  return {
2036
2034
  dir,
2037
2035
  file: file == null ? void 0 : file,
@@ -2063,7 +2061,7 @@ function bindingifyOutputOptions(outputOptions) {
2063
2061
  plugins: [],
2064
2062
  minify: outputOptions.minify,
2065
2063
  externalLiveBindings: outputOptions.externalLiveBindings,
2066
- inlineDynamicImports: outputOptions.inlineDynamicImports,
2064
+ inlineDynamicImports,
2067
2065
  dynamicImportInCjs: outputOptions.dynamicImportInCjs,
2068
2066
  manualCodeSplitting: advancedChunks,
2069
2067
  polyfillRequire: outputOptions.polyfillRequire,
@@ -2075,6 +2073,7 @@ function bindingifyOutputOptions(outputOptions) {
2075
2073
  topLevelVar,
2076
2074
  minifyInternalExports: outputOptions.minifyInternalExports,
2077
2075
  cleanDir,
2076
+ strictExecutionOrder,
2078
2077
  globalIdentifiers
2079
2078
  };
2080
2079
  }
@@ -2119,28 +2118,56 @@ function bindingifyAssetFilenames(assetFileNames) {
2119
2118
  };
2120
2119
  return assetFileNames;
2121
2120
  }
2122
- function bindingifyAdvancedChunks(codeSplitting, advancedChunks, manualChunks) {
2123
- let effectiveOption = codeSplitting;
2124
- if (codeSplitting != null && advancedChunks != null) console.warn("`advancedChunks` option is ignored due to `codeSplitting` option is specified.");
2125
- else if (codeSplitting == null && advancedChunks != null) {
2126
- console.warn("`advancedChunks` option is deprecated, please use `codeSplitting` instead.");
2127
- effectiveOption = advancedChunks;
2121
+ function bindingifyCodeSplitting(codeSplitting, inlineDynamicImportsOption, advancedChunks, manualChunks) {
2122
+ let inlineDynamicImports;
2123
+ let effectiveChunksOption;
2124
+ if (codeSplitting === false) {
2125
+ if (inlineDynamicImportsOption != null) console.warn("`inlineDynamicImports` option is ignored because `codeSplitting: false` is set.");
2126
+ if (manualChunks != null) throw new Error("Invalid configuration: \"output.manualChunks\" cannot be used when \"output.codeSplitting\" is set to false.");
2127
+ if (advancedChunks != null) console.warn("`advancedChunks` option is ignored because `codeSplitting` is set to `false`.");
2128
+ return {
2129
+ inlineDynamicImports: true,
2130
+ advancedChunks: void 0
2131
+ };
2132
+ } else if (codeSplitting === true) {
2133
+ if (inlineDynamicImportsOption != null) console.warn("`inlineDynamicImports` option is ignored because `codeSplitting: true` is set.");
2134
+ } else if (codeSplitting == null) {
2135
+ if (inlineDynamicImportsOption != null) {
2136
+ console.warn("`inlineDynamicImports` option is deprecated, please use `codeSplitting: false` instead.");
2137
+ inlineDynamicImports = inlineDynamicImportsOption;
2138
+ }
2139
+ } else {
2140
+ effectiveChunksOption = codeSplitting;
2141
+ if (inlineDynamicImportsOption != null) console.warn("`inlineDynamicImports` option is ignored because the `codeSplitting` option is specified.");
2128
2142
  }
2129
- if (manualChunks != null && effectiveOption != null) console.warn("`manualChunks` option is ignored due to `codeSplitting` option is specified.");
2130
- else if (manualChunks != null) effectiveOption = { groups: [{ name(moduleId, ctx) {
2143
+ if (inlineDynamicImports === true && manualChunks != null) throw new Error("Invalid value \"true\" for option \"output.inlineDynamicImports\" - this option is not supported for \"output.manualChunks\".");
2144
+ if (effectiveChunksOption == null) {
2145
+ if (advancedChunks != null) {
2146
+ console.warn("`advancedChunks` option is deprecated, please use `codeSplitting` instead.");
2147
+ effectiveChunksOption = advancedChunks;
2148
+ }
2149
+ } else if (advancedChunks != null) console.warn("`advancedChunks` option is ignored because the `codeSplitting` option is specified.");
2150
+ if (manualChunks != null && effectiveChunksOption != null) console.warn("`manualChunks` option is ignored because the `codeSplitting` option is specified.");
2151
+ else if (manualChunks != null) effectiveChunksOption = { groups: [{ name(moduleId, ctx) {
2131
2152
  return manualChunks(moduleId, { getModuleInfo: (id) => ctx.getModuleInfo(id) });
2132
2153
  } }] };
2133
- if (effectiveOption == null) return;
2134
- const { groups, ...restOptions } = effectiveOption;
2154
+ let advancedChunksResult;
2155
+ if (effectiveChunksOption != null) {
2156
+ const { groups, ...restOptions } = effectiveChunksOption;
2157
+ advancedChunksResult = {
2158
+ ...restOptions,
2159
+ groups: groups?.map((group) => {
2160
+ const { name, ...restGroup } = group;
2161
+ return {
2162
+ ...restGroup,
2163
+ name: typeof name === "function" ? (id, ctx) => name(id, new ChunkingContextImpl(ctx)) : name
2164
+ };
2165
+ })
2166
+ };
2167
+ }
2135
2168
  return {
2136
- ...restOptions,
2137
- groups: groups?.map((group) => {
2138
- const { name, ...restGroup } = group;
2139
- return {
2140
- ...restGroup,
2141
- name: typeof name === "function" ? (id, ctx) => name(id, new ChunkingContextImpl(ctx)) : name
2142
- };
2143
- })
2169
+ inlineDynamicImports,
2170
+ advancedChunks: advancedChunksResult
2144
2171
  };
2145
2172
  }
2146
2173
 
@@ -2175,14 +2202,14 @@ function initializeWorkers(registryId, count, pluginInfos) {
2175
2202
  }
2176
2203
  async function initializeWorker(registryId, pluginInfos, threadNumber) {
2177
2204
  const urlString = import.meta.resolve("#parallel-plugin-worker");
2178
- const workerData$1 = {
2205
+ const workerData = {
2179
2206
  registryId,
2180
2207
  pluginInfos,
2181
2208
  threadNumber
2182
2209
  };
2183
2210
  let worker;
2184
2211
  try {
2185
- worker = new Worker(new URL(urlString), { workerData: workerData$1 });
2212
+ worker = new Worker(new URL(urlString), { workerData });
2186
2213
  worker.unref();
2187
2214
  await new Promise((resolve, reject) => {
2188
2215
  worker.once("message", async (message) => {
@@ -2218,6 +2245,7 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
2218
2245
  const normalizedOutputPlugins = await normalizePluginOption(outputOptions.plugins);
2219
2246
  let plugins = [...normalizePlugins(inputPlugins, ANONYMOUS_PLUGIN_PREFIX), ...checkOutputPluginOption(normalizePlugins(normalizedOutputPlugins, ANONYMOUS_OUTPUT_PLUGIN_PREFIX), onLog)];
2220
2247
  const parallelPluginInitResult = await initializeParallelPlugins(plugins);
2248
+ if (inputOptions.experimental?.strictExecutionOrder !== void 0) console.warn("`experimental.strictExecutionOrder` has been stabilized and moved to `output.strictExecutionOrder`. Please update your configuration.");
2221
2249
  try {
2222
2250
  return {
2223
2251
  bundlerOptions: {
@@ -2238,27 +2266,70 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
2238
2266
  //#endregion
2239
2267
  //#region src/api/rolldown/rolldown-build.ts
2240
2268
  Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
2241
- /** @category Programmatic APIs */
2269
+ /**
2270
+ * The bundle object returned by {@linkcode rolldown} function.
2271
+ *
2272
+ * @category Programmatic APIs
2273
+ */
2242
2274
  var RolldownBuild = class RolldownBuild {
2243
2275
  #inputOptions;
2244
2276
  #bundler;
2245
2277
  #stopWorkers;
2278
+ /** @internal */
2246
2279
  static asyncRuntimeShutdown = false;
2280
+ /** @hidden should not be used directly */
2247
2281
  constructor(inputOptions) {
2248
2282
  this.#inputOptions = inputOptions;
2249
2283
  this.#bundler = new import_binding.BindingBundler();
2250
2284
  }
2285
+ /**
2286
+ * Whether the bundle has been closed.
2287
+ *
2288
+ * If the bundle is closed, calling other methods will throw an error.
2289
+ */
2251
2290
  get closed() {
2252
2291
  return this.#bundler.closed;
2253
2292
  }
2293
+ /**
2294
+ * Generate bundles in-memory.
2295
+ *
2296
+ * If you directly want to write bundles to disk, use the {@linkcode write} method instead.
2297
+ *
2298
+ * @param outputOptions The output options.
2299
+ * @returns The generated bundle.
2300
+ * @throws {@linkcode RolldownError} When an error occurs during the build.
2301
+ */
2254
2302
  async generate(outputOptions = {}) {
2255
2303
  return this.#build(false, outputOptions);
2256
2304
  }
2305
+ /**
2306
+ * Generate and write bundles to disk.
2307
+ *
2308
+ * If you want to generate bundles in-memory, use the {@linkcode generate} method instead.
2309
+ *
2310
+ * @param outputOptions The output options.
2311
+ * @returns The generated bundle.
2312
+ * @throws {@linkcode RolldownError} When an error occurs during the build.
2313
+ */
2257
2314
  async write(outputOptions = {}) {
2258
2315
  return this.#build(true, outputOptions);
2259
2316
  }
2260
2317
  /**
2261
- * Close the build and free resources.
2318
+ * Close the bundle and free resources.
2319
+ *
2320
+ * This method is called automatically when using `using` syntax.
2321
+ *
2322
+ * @example
2323
+ * ```js
2324
+ * import { rolldown } from 'rolldown';
2325
+ *
2326
+ * {
2327
+ * using bundle = await rolldown({ input: 'src/main.js' });
2328
+ * const output = await bundle.generate({ format: 'esm' });
2329
+ * console.log(output);
2330
+ * // bundle.close() is called automatically here
2331
+ * }
2332
+ * ```
2262
2333
  */
2263
2334
  async close() {
2264
2335
  await this.#stopWorkers?.();
@@ -2267,9 +2338,14 @@ var RolldownBuild = class RolldownBuild {
2267
2338
  RolldownBuild.asyncRuntimeShutdown = true;
2268
2339
  this.#stopWorkers = void 0;
2269
2340
  }
2341
+ /** @hidden documented in close method */
2270
2342
  async [Symbol.asyncDispose]() {
2271
2343
  await this.close();
2272
2344
  }
2345
+ /**
2346
+ * @experimental
2347
+ * @hidden not ready for public usage yet
2348
+ */
2273
2349
  get watchFiles() {
2274
2350
  return Promise.resolve(this.#bundler.getWatchFiles());
2275
2351
  }
@@ -1,8 +1,8 @@
1
- import { n as __toESM, t as require_binding } from "./binding-uOeDeDzp.mjs";
2
- import { o as logMultiplyNotifyOption } from "./logs-N5Akftom.mjs";
3
- import { a as aggregateBindingErrorsIntoJsError, b as LOG_LEVEL_WARN } from "./bindingify-input-options-CuBDHglZ.mjs";
4
- import { t as arraify } from "./misc-0HsaOsAX.mjs";
5
- import { l as PluginDriver, n as createBundlerOptions } from "./rolldown-build-BqHWBpp7.mjs";
1
+ import { n as __toESM, t as require_binding } from "./binding-tNJoEqAa.mjs";
2
+ import { o as logMultiplyNotifyOption } from "./logs-NH298mHo.mjs";
3
+ import { a as aggregateBindingErrorsIntoJsError, b as LOG_LEVEL_WARN } from "./bindingify-input-options-CfhrNd_y.mjs";
4
+ import { t as arraify } from "./misc-CCZIsXVO.mjs";
5
+ import { l as PluginDriver, n as createBundlerOptions } from "./rolldown-build-DWeKtJOy.mjs";
6
6
 
7
7
  //#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
8
8
  /**
@@ -340,7 +340,35 @@ function getValidNotifyOption(bundlerOptions) {
340
340
 
341
341
  //#endregion
342
342
  //#region src/api/watch/index.ts
343
- /** @category Programmatic APIs */
343
+ /**
344
+ * The API compatible with Rollup's `watch` function.
345
+ *
346
+ * This function will rebuild the bundle when it detects that the individual modules have changed on disk.
347
+ *
348
+ * Note that when using this function, it is your responsibility to call `event.result.close()` in response to the `BUNDLE_END` event to avoid resource leaks.
349
+ *
350
+ * @param input The watch options object or the list of them.
351
+ * @returns A watcher object.
352
+ *
353
+ * @example
354
+ * ```js
355
+ * import { watch } from 'rolldown';
356
+ *
357
+ * const watcher = watch({ /* ... *\/ });
358
+ * watcher.on('event', (event) => {
359
+ * if (event.code === 'BUNDLE_END') {
360
+ * console.log(event.duration);
361
+ * event.result.close();
362
+ * }
363
+ * });
364
+ *
365
+ * // Stop watching
366
+ * watcher.close();
367
+ * ```
368
+ *
369
+ * @experimental
370
+ * @category Programmatic APIs
371
+ */
344
372
  const watch = (input) => {
345
373
  const emitter = new WatcherEmitter();
346
374
  createWatcher(emitter, input);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rollipop/rolldown",
3
- "version": "0.0.0-beta.3",
3
+ "version": "1.0.0-rc.1",
4
4
  "description": "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.",
5
5
  "keywords": [
6
6
  "bundler",
@@ -52,8 +52,8 @@
52
52
  "registry": "https://registry.npmjs.org/"
53
53
  },
54
54
  "dependencies": {
55
- "@oxc-project/types": "=0.108.0",
56
- "@rollipop/rolldown-pluginutils": "0.0.0-beta.3"
55
+ "@oxc-project/types": "=0.110.0",
56
+ "@rollipop/rolldown-pluginutils": "1.0.0-rc.1"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@napi-rs/cli": "^3.4.1",
@@ -64,16 +64,17 @@
64
64
  "consola": "^3.4.2",
65
65
  "execa": "^9.2.0",
66
66
  "glob": "^13.0.0",
67
- "oxc-parser": "=0.108.0",
67
+ "oxc-parser": "=0.110.0",
68
68
  "pathe": "^2.0.3",
69
69
  "remeda": "^2.10.0",
70
- "rolldown-plugin-dts": "^0.20.0",
70
+ "rolldown": "1.0.0-rc.1",
71
+ "rolldown-plugin-dts": "^0.21.0",
71
72
  "rollup": "^4.18.0",
72
73
  "signal-exit": "4.1.0",
73
- "source-map": "^0.7.6",
74
+ "source-map": "0.7.6",
74
75
  "typescript": "^5.8.3",
75
76
  "valibot": "1.2.0",
76
- "@rollipop/rolldown": "0.0.0-beta.3"
77
+ "@rollipop/rolldown": "1.0.0-rc.1"
77
78
  },
78
79
  "napi": {
79
80
  "binaryName": "rolldown-binding",
@@ -94,14 +95,14 @@
94
95
  "node": "^20.19.0 || >=22.12.0"
95
96
  },
96
97
  "optionalDependencies": {
97
- "@rollipop/rolldown-binding-darwin-x64": "0.0.0-beta.3",
98
- "@rollipop/rolldown-binding-win32-x64-msvc": "0.0.0-beta.3",
99
- "@rollipop/rolldown-binding-linux-x64-gnu": "0.0.0-beta.3",
100
- "@rollipop/rolldown-binding-linux-x64-musl": "0.0.0-beta.3",
101
- "@rollipop/rolldown-binding-linux-arm64-gnu": "0.0.0-beta.3",
102
- "@rollipop/rolldown-binding-darwin-arm64": "0.0.0-beta.3",
103
- "@rollipop/rolldown-binding-linux-arm64-musl": "0.0.0-beta.3",
104
- "@rollipop/rolldown-binding-win32-arm64-msvc": "0.0.0-beta.3"
98
+ "@rollipop/rolldown-binding-darwin-x64": "1.0.0-rc.1",
99
+ "@rollipop/rolldown-binding-win32-x64-msvc": "1.0.0-rc.1",
100
+ "@rollipop/rolldown-binding-linux-x64-gnu": "1.0.0-rc.1",
101
+ "@rollipop/rolldown-binding-linux-x64-musl": "1.0.0-rc.1",
102
+ "@rollipop/rolldown-binding-linux-arm64-gnu": "1.0.0-rc.1",
103
+ "@rollipop/rolldown-binding-darwin-arm64": "1.0.0-rc.1",
104
+ "@rollipop/rolldown-binding-linux-arm64-musl": "1.0.0-rc.1",
105
+ "@rollipop/rolldown-binding-win32-arm64-msvc": "1.0.0-rc.1"
105
106
  },
106
107
  "scripts": {
107
108
  "# Scrips for binding #": "_",
@@ -123,6 +124,7 @@
123
124
  "build-wasi:release": "TARGET='rolldown-wasi' pnpm run --sequential '/^build-(binding|binding:wasi:release|node)$/'",
124
125
  "build-browser-pkg:debug": "TARGET='browser' pnpm run --sequential '/^build-(binding|binding:wasi|node)$/'",
125
126
  "build-browser-pkg:release": "TARGET='browser' pnpm run --sequential '/^build-(binding|binding:wasi:release|node)$/'",
126
- "# Scrips for docs #": "_"
127
+ "# Scrips for docs #": "_",
128
+ "publint": "publint ."
127
129
  }
128
130
  }