@rolldown/browser 1.0.0-beta.55 → 1.0.0-beta.56

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 (35) hide show
  1. package/dist/cli.mjs +7 -7
  2. package/dist/config.d.mts +1 -1
  3. package/dist/config.mjs +6 -6
  4. package/dist/{constructors-DoEj0CTZ.js → constructors-DMeuUDyD.js} +1 -1
  5. package/dist/experimental-index.browser.mjs +30 -3
  6. package/dist/experimental-index.d.mts +31 -4
  7. package/dist/experimental-index.mjs +32 -5
  8. package/dist/filter-index.d.mts +1 -1
  9. package/dist/index.browser.mjs +2 -2
  10. package/dist/index.d.mts +3 -3
  11. package/dist/index.mjs +6 -6
  12. package/dist/{normalize-string-or-regex-dwgRHUz6.js → normalize-string-or-regex-B-Y4k0qo.js} +5 -3
  13. package/dist/parallel-plugin-worker.mjs +3 -3
  14. package/dist/parallel-plugin.d.mts +2 -2
  15. package/dist/parse-ast-index.d.mts +1 -1
  16. package/dist/parse-ast-index.mjs +1 -1
  17. package/dist/plugins-index.browser.mjs +2 -2
  18. package/dist/plugins-index.d.mts +3 -3
  19. package/dist/plugins-index.mjs +2 -2
  20. package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
  21. package/dist/{rolldown-build-7uuCodq1.js → rolldown-build-BEV6JVIl.js} +42 -11
  22. package/dist/shared/{binding-r9j8jqRV.d.mts → binding-CDyF6W3D.d.mts} +13 -10
  23. package/dist/shared/{bindingify-input-options-nvXYfbt3.mjs → bindingify-input-options-kzSFdf_-.mjs} +33 -5
  24. package/dist/shared/{constructors-G-fr57ib.d.mts → constructors-B0L_9ar3.d.mts} +2 -2
  25. package/dist/shared/{constructors-oU7W7sz4.mjs → constructors-Dw9UOO6Z.mjs} +1 -1
  26. package/dist/shared/{define-config-Bwwa5Tc_.d.mts → define-config-CrCCK_Ci.d.mts} +6 -5
  27. package/dist/shared/{load-config-DumfiMa-.mjs → load-config-vlnYfd7q.mjs} +1 -1
  28. package/dist/shared/{logs-By66Jt-E.mjs → logs-DEfpOy5A.mjs} +4 -2
  29. package/dist/shared/{normalize-string-or-regex-FzNsMab1.mjs → normalize-string-or-regex-CwM9ci6w.mjs} +2 -2
  30. package/dist/shared/{parse-ast-index-BZ4FJxMm.mjs → parse-ast-index-DZPue_kI.mjs} +10 -7
  31. package/dist/shared/{rolldown-CTRsCETA.mjs → rolldown-DtiFL1Ph.mjs} +1 -1
  32. package/dist/shared/{rolldown-build-D8oOi181.mjs → rolldown-build-B3XDwemQ.mjs} +6 -6
  33. package/dist/shared/{utils-CMDrspre.d.mts → utils-B3dcnHc8.d.mts} +1 -1
  34. package/dist/shared/{watch-DDjo8C9u.mjs → watch-BHMj7YNj.mjs} +4 -4
  35. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -1,11 +1,11 @@
1
- import { n as onExit, t as watch } from "./shared/watch-DDjo8C9u.mjs";
1
+ import { n as onExit, t as watch } from "./shared/watch-BHMj7YNj.mjs";
2
2
  import { t as arraify } from "./shared/misc-BubmxcE3.mjs";
3
- import { b as description, x as version } from "./shared/normalize-string-or-regex-FzNsMab1.mjs";
4
- import { a as getOutputCliKeys, c as styleText$1, i as getInputCliKeys, o as validateCliOptions, r as getCliSchemaInfo } from "./shared/rolldown-build-D8oOi181.mjs";
5
- import "./shared/bindingify-input-options-nvXYfbt3.mjs";
6
- import "./shared/parse-ast-index-BZ4FJxMm.mjs";
7
- import { t as rolldown } from "./shared/rolldown-CTRsCETA.mjs";
8
- import { t as loadConfig } from "./shared/load-config-DumfiMa-.mjs";
3
+ import { b as description, x as version } from "./shared/normalize-string-or-regex-CwM9ci6w.mjs";
4
+ import { a as getOutputCliKeys, c as styleText$1, i as getInputCliKeys, o as validateCliOptions, r as getCliSchemaInfo } from "./shared/rolldown-build-B3XDwemQ.mjs";
5
+ import "./shared/bindingify-input-options-kzSFdf_-.mjs";
6
+ import "./shared/parse-ast-index-DZPue_kI.mjs";
7
+ import { t as rolldown } from "./shared/rolldown-DtiFL1Ph.mjs";
8
+ import { t as loadConfig } from "./shared/load-config-vlnYfd7q.mjs";
9
9
  import path, { sep } from "node:path";
10
10
  import { formatWithOptions, parseArgs } from "node:util";
11
11
  import process$1 from "node:process";
package/dist/config.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as ConfigExport, t as defineConfig } from "./shared/define-config-Bwwa5Tc_.mjs";
1
+ import { n as ConfigExport, t as defineConfig } from "./shared/define-config-CrCCK_Ci.mjs";
2
2
 
3
3
  //#region src/utils/load-config.d.ts
4
4
  declare function loadConfig(configPath: string): Promise<ConfigExport>;
package/dist/config.mjs CHANGED
@@ -1,10 +1,10 @@
1
- import { x as version } from "./shared/normalize-string-or-regex-FzNsMab1.mjs";
2
- import "./shared/rolldown-build-D8oOi181.mjs";
3
- import "./shared/bindingify-input-options-nvXYfbt3.mjs";
4
- import "./shared/parse-ast-index-BZ4FJxMm.mjs";
5
- import "./shared/rolldown-CTRsCETA.mjs";
1
+ import { x as version } from "./shared/normalize-string-or-regex-CwM9ci6w.mjs";
2
+ import "./shared/rolldown-build-B3XDwemQ.mjs";
3
+ import "./shared/bindingify-input-options-kzSFdf_-.mjs";
4
+ import "./shared/parse-ast-index-DZPue_kI.mjs";
5
+ import "./shared/rolldown-DtiFL1Ph.mjs";
6
6
  import { t as defineConfig } from "./shared/define-config-BF4P-Pum.mjs";
7
- import { t as loadConfig } from "./shared/load-config-DumfiMa-.mjs";
7
+ import { t as loadConfig } from "./shared/load-config-vlnYfd7q.mjs";
8
8
 
9
9
  //#region src/config.ts
10
10
  const VERSION = version;
@@ -1,4 +1,4 @@
1
- import { n as BuiltinPlugin, s as makeBuiltinPluginCallable, t as normalizedStringOrRegex } from "./normalize-string-or-regex-dwgRHUz6.js";
1
+ import { n as BuiltinPlugin, s as makeBuiltinPluginCallable, t as normalizedStringOrRegex } from "./normalize-string-or-regex-B-Y4k0qo.js";
2
2
 
3
3
  //#region src/builtin-plugin/constructors.ts
4
4
  function viteModulePreloadPolyfillPlugin(config) {
@@ -1,6 +1,6 @@
1
- import { d as bindingifySourcemap, n as BuiltinPlugin, t as normalizedStringOrRegex, u as transformToRollupOutput } from "./normalize-string-or-regex-dwgRHUz6.js";
2
- import { a as unwrapBindingResult, c as validateOption, i as normalizeBindingResult, l as PluginDriver, n as createBundlerOptions, o as parse, s as parseSync, t as RolldownBuild } from "./rolldown-build-7uuCodq1.js";
3
- import { a as viteDynamicImportVarsPlugin, c as viteJsonPlugin, d as viteReactRefreshWrapperPlugin, f as viteReporterPlugin, g as viteWebWorkerPostPlugin, h as viteWasmHelperPlugin, i as viteBuildImportAnalysisPlugin, l as viteLoadFallbackPlugin, m as viteWasmFallbackPlugin, n as isolatedDeclarationPlugin, o as viteHtmlInlineProxyPlugin, p as viteResolvePlugin, r as viteAssetImportMetaUrlPlugin, s as viteImportGlobPlugin, u as viteModulePreloadPolyfillPlugin } from "./constructors-DoEj0CTZ.js";
1
+ import { d as bindingifySourcemap, n as BuiltinPlugin, t as normalizedStringOrRegex, u as transformToRollupOutput } from "./normalize-string-or-regex-B-Y4k0qo.js";
2
+ import { a as unwrapBindingResult, c as validateOption, i as normalizeBindingResult, l as PluginDriver, n as createBundlerOptions, o as parse, s as parseSync, t as RolldownBuild } from "./rolldown-build-BEV6JVIl.js";
3
+ import { a as viteDynamicImportVarsPlugin, c as viteJsonPlugin, d as viteReactRefreshWrapperPlugin, f as viteReporterPlugin, g as viteWebWorkerPostPlugin, h as viteWasmHelperPlugin, i as viteBuildImportAnalysisPlugin, l as viteLoadFallbackPlugin, m as viteWasmFallbackPlugin, n as isolatedDeclarationPlugin, o as viteHtmlInlineProxyPlugin, p as viteResolvePlugin, r as viteAssetImportMetaUrlPlugin, s as viteImportGlobPlugin, u as viteModulePreloadPolyfillPlugin } from "./constructors-DMeuUDyD.js";
4
4
  import * as binding from "./rolldown-binding.wasi-browser.js";
5
5
  import { BindingBundler, BindingDevEngine, BindingRebuildStrategy, BindingRebuildStrategy as BindingRebuildStrategy$1, ResolverFactory, createTokioRuntime, isolatedDeclaration, isolatedDeclarationSync, minify, minifySync, moduleRunnerTransform, shutdownAsyncRuntime, startAsyncRuntime, transform, transformSync } from "./rolldown-binding.wasi-browser.js";
6
6
 
@@ -234,6 +234,33 @@ function viteManifestPlugin(config) {
234
234
 
235
235
  //#endregion
236
236
  //#region src/experimental-index.ts
237
+ /**
238
+ * In-memory file system for browser builds.
239
+ *
240
+ * This is a re-export of the {@link https://github.com/streamich/memfs | memfs} package used by the WASI runtime.
241
+ * It allows you to read and write files to a virtual filesystem when using rolldown in browser environments.
242
+ *
243
+ * - `fs`: A Node.js-compatible filesystem API (`IFs` from memfs)
244
+ * - `volume`: The underlying `Volume` instance that stores the filesystem state
245
+ *
246
+ * Returns `undefined` in Node.js builds (only available in browser builds via `@rolldown/browser`).
247
+ *
248
+ * @example
249
+ * ```typescript
250
+ * import { memfs } from 'rolldown/experimental';
251
+ *
252
+ * // Write files to virtual filesystem before bundling
253
+ * memfs?.volume.fromJSON({
254
+ * '/src/index.js': 'export const foo = 42;',
255
+ * '/package.json': '{"name": "my-app"}'
256
+ * });
257
+ *
258
+ * // Read files from the virtual filesystem
259
+ * const content = memfs?.fs.readFileSync('/src/index.js', 'utf8');
260
+ * ```
261
+ *
262
+ * @see {@link https://github.com/streamich/memfs} for more information on the memfs API.
263
+ */
237
264
  const memfs = {
238
265
  fs: binding.__fs,
239
266
  volume: binding.__volume
@@ -1,7 +1,7 @@
1
- import { $ as transformSync, B as ParserOptions, C as BindingViteManifestPluginConfig, G as TransformResult, H as ResolveResult, I as MinifyOptions, J as isolatedDeclarationSync, K as createTokioRuntime, L as MinifyResult, N as IsolatedDeclarationsOptions, O as BindingViteTransformPluginConfig, P as IsolatedDeclarationsResult, Q as transform, R as NapiResolveOptions, U as ResolverFactory, W as TransformOptions, X as minifySync, Y as minify, Z as moduleRunnerTransform, _ as BindingViteCssPostPluginConfig, b as BindingViteHtmlPluginConfig, c as BindingRebuildStrategy, f as BindingUrlResolver, g as BindingViteCssPluginConfig, m as BindingViteAssetPluginConfig, n as BindingBundleState, q as isolatedDeclaration, r as BindingClientHmrUpdate, z as ParseResult } from "./shared/binding-r9j8jqRV.mjs";
2
- import { Et as freeExternalMemory, M as SourceMapInput, P as OutputBundle, U as defineParallelPlugin, W as MinimalPluginContext, et as NormalizedOutputOptions, o as InputOptions, vt as OutputOptions, wt as RolldownOutput, xt as OutputChunk } from "./shared/define-config-Bwwa5Tc_.mjs";
3
- import { t as BuiltinPlugin } from "./shared/utils-CMDrspre.mjs";
4
- import { a as viteDynamicImportVarsPlugin, c as viteJsonPlugin, d as viteReactRefreshWrapperPlugin, f as viteReporterPlugin, g as viteWebWorkerPostPlugin, h as viteWasmHelperPlugin, i as viteBuildImportAnalysisPlugin, l as viteLoadFallbackPlugin, m as viteWasmFallbackPlugin, n as isolatedDeclarationPlugin, o as viteHtmlInlineProxyPlugin, p as viteResolvePlugin, r as viteAssetImportMetaUrlPlugin, s as viteImportGlobPlugin, u as viteModulePreloadPolyfillPlugin } from "./shared/constructors-G-fr57ib.mjs";
1
+ import { $ as transformSync, B as ParserOptions, C as BindingViteManifestPluginConfig, G as TransformResult, H as ResolveResult, I as MinifyOptions, J as isolatedDeclarationSync, K as createTokioRuntime, L as MinifyResult, N as IsolatedDeclarationsOptions, O as BindingViteTransformPluginConfig, P as IsolatedDeclarationsResult, Q as transform, R as NapiResolveOptions, U as ResolverFactory, W as TransformOptions, X as minifySync, Y as minify, Z as moduleRunnerTransform, _ as BindingViteCssPostPluginConfig, b as BindingViteHtmlPluginConfig, c as BindingRebuildStrategy, f as BindingUrlResolver, g as BindingViteCssPluginConfig, m as BindingViteAssetPluginConfig, n as BindingBundleState, q as isolatedDeclaration, r as BindingClientHmrUpdate, z as ParseResult } from "./shared/binding-CDyF6W3D.mjs";
2
+ import { Et as freeExternalMemory, M as SourceMapInput, P as OutputBundle, U as defineParallelPlugin, W as MinimalPluginContext, et as NormalizedOutputOptions, o as InputOptions, vt as OutputOptions, wt as RolldownOutput, xt as OutputChunk } from "./shared/define-config-CrCCK_Ci.mjs";
3
+ import { t as BuiltinPlugin } from "./shared/utils-B3dcnHc8.mjs";
4
+ import { a as viteDynamicImportVarsPlugin, c as viteJsonPlugin, d as viteReactRefreshWrapperPlugin, f as viteReporterPlugin, g as viteWebWorkerPostPlugin, h as viteWasmHelperPlugin, i as viteBuildImportAnalysisPlugin, l as viteLoadFallbackPlugin, m as viteWasmFallbackPlugin, n as isolatedDeclarationPlugin, o as viteHtmlInlineProxyPlugin, p as viteResolvePlugin, r as viteAssetImportMetaUrlPlugin, s as viteImportGlobPlugin, u as viteModulePreloadPolyfillPlugin } from "./shared/constructors-B0L_9ar3.mjs";
5
5
 
6
6
  //#region src/api/dev/dev-options.d.ts
7
7
  type DevOnHmrUpdates = (result: Error | {
@@ -193,6 +193,33 @@ type ViteManifestPluginConfig = Omit<BindingViteManifestPluginConfig, "isLegacy"
193
193
  declare function viteManifestPlugin(config: ViteManifestPluginConfig): BuiltinPlugin;
194
194
  //#endregion
195
195
  //#region src/experimental-index.d.ts
196
+ /**
197
+ * In-memory file system for browser builds.
198
+ *
199
+ * This is a re-export of the {@link https://github.com/streamich/memfs | memfs} package used by the WASI runtime.
200
+ * It allows you to read and write files to a virtual filesystem when using rolldown in browser environments.
201
+ *
202
+ * - `fs`: A Node.js-compatible filesystem API (`IFs` from memfs)
203
+ * - `volume`: The underlying `Volume` instance that stores the filesystem state
204
+ *
205
+ * Returns `undefined` in Node.js builds (only available in browser builds via `@rolldown/browser`).
206
+ *
207
+ * @example
208
+ * ```typescript
209
+ * import { memfs } from 'rolldown/experimental';
210
+ *
211
+ * // Write files to virtual filesystem before bundling
212
+ * memfs?.volume.fromJSON({
213
+ * '/src/index.js': 'export const foo = 42;',
214
+ * '/package.json': '{"name": "my-app"}'
215
+ * });
216
+ *
217
+ * // Read files from the virtual filesystem
218
+ * const content = memfs?.fs.readFileSync('/src/index.js', 'utf8');
219
+ * ```
220
+ *
221
+ * @see {@link https://github.com/streamich/memfs} for more information on the memfs API.
222
+ */
196
223
  declare const memfs: {
197
224
  fs: any;
198
225
  volume: any;
@@ -1,8 +1,8 @@
1
- import { d as bindingifySourcemap, n as BuiltinPlugin, t as normalizedStringOrRegex, u as transformToRollupOutput } from "./shared/normalize-string-or-regex-FzNsMab1.mjs";
2
- import { l as PluginDriver, n as createBundlerOptions, s as validateOption, t as RolldownBuild } from "./shared/rolldown-build-D8oOi181.mjs";
3
- import { o as normalizeBindingResult, s as unwrapBindingResult } from "./shared/bindingify-input-options-nvXYfbt3.mjs";
4
- import { i as parseSync, r as parse } from "./shared/parse-ast-index-BZ4FJxMm.mjs";
5
- import { a as viteDynamicImportVarsPlugin, c as viteJsonPlugin, d as viteReactRefreshWrapperPlugin, f as viteReporterPlugin, g as viteWebWorkerPostPlugin, h as viteWasmHelperPlugin, i as viteBuildImportAnalysisPlugin, l as viteLoadFallbackPlugin, m as viteWasmFallbackPlugin, n as isolatedDeclarationPlugin, o as viteHtmlInlineProxyPlugin, p as viteResolvePlugin, r as viteAssetImportMetaUrlPlugin, s as viteImportGlobPlugin, u as viteModulePreloadPolyfillPlugin } from "./shared/constructors-oU7W7sz4.mjs";
1
+ import { d as bindingifySourcemap, n as BuiltinPlugin, t as normalizedStringOrRegex, u as transformToRollupOutput } from "./shared/normalize-string-or-regex-CwM9ci6w.mjs";
2
+ import { l as PluginDriver, n as createBundlerOptions, s as validateOption, t as RolldownBuild } from "./shared/rolldown-build-B3XDwemQ.mjs";
3
+ import { o as normalizeBindingResult, s as unwrapBindingResult } from "./shared/bindingify-input-options-kzSFdf_-.mjs";
4
+ import { i as parseSync, r as parse } from "./shared/parse-ast-index-DZPue_kI.mjs";
5
+ import { a as viteDynamicImportVarsPlugin, c as viteJsonPlugin, d as viteReactRefreshWrapperPlugin, f as viteReporterPlugin, g as viteWebWorkerPostPlugin, h as viteWasmHelperPlugin, i as viteBuildImportAnalysisPlugin, l as viteLoadFallbackPlugin, m as viteWasmFallbackPlugin, n as isolatedDeclarationPlugin, o as viteHtmlInlineProxyPlugin, p as viteResolvePlugin, r as viteAssetImportMetaUrlPlugin, s as viteImportGlobPlugin, u as viteModulePreloadPolyfillPlugin } from "./shared/constructors-Dw9UOO6Z.mjs";
6
6
  import { BindingBundler, BindingDevEngine, BindingRebuildStrategy, BindingRebuildStrategy as BindingRebuildStrategy$1, ResolverFactory, createTokioRuntime, isolatedDeclaration, isolatedDeclarationSync, minify, minifySync, moduleRunnerTransform, shutdownAsyncRuntime, startAsyncRuntime, transform, transformSync } from "./rolldown-binding.wasi.cjs";
7
7
  import { pathToFileURL } from "node:url";
8
8
 
@@ -241,6 +241,33 @@ function viteManifestPlugin(config) {
241
241
 
242
242
  //#endregion
243
243
  //#region src/experimental-index.ts
244
+ /**
245
+ * In-memory file system for browser builds.
246
+ *
247
+ * This is a re-export of the {@link https://github.com/streamich/memfs | memfs} package used by the WASI runtime.
248
+ * It allows you to read and write files to a virtual filesystem when using rolldown in browser environments.
249
+ *
250
+ * - `fs`: A Node.js-compatible filesystem API (`IFs` from memfs)
251
+ * - `volume`: The underlying `Volume` instance that stores the filesystem state
252
+ *
253
+ * Returns `undefined` in Node.js builds (only available in browser builds via `@rolldown/browser`).
254
+ *
255
+ * @example
256
+ * ```typescript
257
+ * import { memfs } from 'rolldown/experimental';
258
+ *
259
+ * // Write files to virtual filesystem before bundling
260
+ * memfs?.volume.fromJSON({
261
+ * '/src/index.js': 'export const foo = 42;',
262
+ * '/package.json': '{"name": "my-app"}'
263
+ * });
264
+ *
265
+ * // Read files from the virtual filesystem
266
+ * const content = memfs?.fs.readFileSync('/src/index.js', 'utf8');
267
+ * ```
268
+ *
269
+ * @see {@link https://github.com/streamich/memfs} for more information on the memfs API.
270
+ */
244
271
  const memfs = void 0;
245
272
 
246
273
  //#endregion
@@ -1,3 +1,3 @@
1
- import { k as withFilter } from "./shared/define-config-Bwwa5Tc_.mjs";
1
+ import { k as withFilter } from "./shared/define-config-CrCCK_Ci.mjs";
2
2
  import { and, code, exclude, id, include, moduleType, not, or, queries, query } from "@rolldown/pluginutils";
3
3
  export { and, code, exclude, id, include, moduleType, not, or, queries, query, withFilter };
@@ -1,5 +1,5 @@
1
- import { E as arraify, P as logMultiplyNotifyOption, w as LOG_LEVEL_WARN, y as VERSION } from "./normalize-string-or-regex-dwgRHUz6.js";
2
- import { c as validateOption, l as PluginDriver, n as createBundlerOptions, r as aggregateBindingErrorsIntoJsError, t as RolldownBuild } from "./rolldown-build-7uuCodq1.js";
1
+ import { E as arraify, P as logMultiplyNotifyOption, w as LOG_LEVEL_WARN, y as VERSION } from "./normalize-string-or-regex-B-Y4k0qo.js";
2
+ import { c as validateOption, l as PluginDriver, n as createBundlerOptions, r as aggregateBindingErrorsIntoJsError, t as RolldownBuild } from "./rolldown-build-BEV6JVIl.js";
3
3
  import { BindingMagicString, BindingWatcher, shutdownAsyncRuntime } from "./rolldown-binding.wasi-browser.js";
4
4
 
5
5
  //#region src/api/rolldown/index.ts
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { a as RollupLog, i as RollupError, n as LogLevelOption, o as RollupLogWithString, r as LogOrStringHandler, t as LogLevel } from "./shared/logging-BpAvp7KV.mjs";
2
- import { V as PreRenderedChunk, s as BindingMagicString } from "./shared/binding-r9j8jqRV.mjs";
3
- import { $ as InternalModuleFormat, A as VERSION, B as GetModuleInfo, C as ResolveIdResult, Ct as RenderedModule, D as SourceDescription, Dt as ModuleInfo, E as RolldownPluginOption, F as TreeshakingOptions, G as PluginContextMeta, H as DefineParallelPluginResult, I as TransformPluginContext, J as ModuleTypeFilter, K as GeneralHookFilter, L as EmittedAsset, M as SourceMapInput, N as RolldownOptionsFunction, O as TransformResult, Ot as SourcemapIgnoreListOption, P as OutputBundle, Q as RolldownFsModule, R as EmittedFile, S as ResolveIdExtraOptions, St as RenderedChunk, T as RolldownPlugin, Tt as SourceMap, V as PluginContext, W as MinimalPluginContext, X as RolldownDirectoryEntry, Y as BufferEncoding, Z as RolldownFileStats, _ as ModuleType, _t as ModuleFormat, a as InputOption, at as WatchOptions, b as PartialResolvedId, bt as OutputAsset, c as OptimizationOptions, ct as BuildOptions, d as CustomPluginOptions, dt as ChunkFileNamesFunction, et as NormalizedOutputOptions, f as FunctionPluginHooks, ft as ChunkingContext, g as ModuleOptions, gt as MinifyOptions, h as LoadResult, ht as GlobalsFunction, i as ExternalOption, it as RolldownWatcherEvent, j as ExistingRawSourceMap, l as WatcherOptions, lt as build, m as ImportKind, mt as GeneratedCodePreset, n as ConfigExport, nt as watch, o as InputOptions, ot as rolldown, p as HookFilterExtension, pt as GeneratedCodeOptions, q as HookFilter, r as RolldownOptions, rt as RolldownWatcher, s as ModuleTypes, st as RolldownBuild, t as defineConfig, tt as NormalizedInputOptions, u as AsyncPluginHooks, ut as AddonFunction, v as ObjectHook, vt as OutputOptions, w as ResolvedId, wt as RolldownOutput, x as Plugin, xt as OutputChunk, y as ParallelPluginHooks, yt as PreRenderedAsset, z as EmittedPrebuiltChunk } from "./shared/define-config-Bwwa5Tc_.mjs";
4
- import { i as WarningHandlerWithDefault, l as PartialNull, n as LoggingFunction } from "./shared/utils-CMDrspre.mjs";
2
+ import { V as PreRenderedChunk, s as BindingMagicString } from "./shared/binding-CDyF6W3D.mjs";
3
+ import { $ as InternalModuleFormat, A as VERSION, B as GetModuleInfo, C as ResolveIdResult, Ct as RenderedModule, D as SourceDescription, Dt as ModuleInfo, E as RolldownPluginOption, F as TreeshakingOptions, G as PluginContextMeta, H as DefineParallelPluginResult, I as TransformPluginContext, J as ModuleTypeFilter, K as GeneralHookFilter, L as EmittedAsset, M as SourceMapInput, N as RolldownOptionsFunction, O as TransformResult, Ot as SourcemapIgnoreListOption, P as OutputBundle, Q as RolldownFsModule, R as EmittedFile, S as ResolveIdExtraOptions, St as RenderedChunk, T as RolldownPlugin, Tt as SourceMap, V as PluginContext, W as MinimalPluginContext, X as RolldownDirectoryEntry, Y as BufferEncoding, Z as RolldownFileStats, _ as ModuleType, _t as ModuleFormat, a as InputOption, at as WatchOptions, b as PartialResolvedId, bt as OutputAsset, c as OptimizationOptions, ct as BuildOptions, d as CustomPluginOptions, dt as ChunkFileNamesFunction, et as NormalizedOutputOptions, f as FunctionPluginHooks, ft as ChunkingContext, g as ModuleOptions, gt as MinifyOptions, h as LoadResult, ht as GlobalsFunction, i as ExternalOption, it as RolldownWatcherEvent, j as ExistingRawSourceMap, l as WatcherOptions, lt as build, m as ImportKind, mt as GeneratedCodePreset, n as ConfigExport, nt as watch, o as InputOptions, ot as rolldown, p as HookFilterExtension, pt as GeneratedCodeOptions, q as HookFilter, r as RolldownOptions, rt as RolldownWatcher, s as ModuleTypes, st as RolldownBuild, t as defineConfig, tt as NormalizedInputOptions, u as AsyncPluginHooks, ut as AddonFunction, v as ObjectHook, vt as OutputOptions, w as ResolvedId, wt as RolldownOutput, x as Plugin, xt as OutputChunk, y as ParallelPluginHooks, yt as PreRenderedAsset, z as EmittedPrebuiltChunk } from "./shared/define-config-CrCCK_Ci.mjs";
4
+ import { i as WarningHandlerWithDefault, l as PartialNull, n as LoggingFunction } from "./shared/utils-B3dcnHc8.mjs";
5
5
  export { AddonFunction, AsyncPluginHooks, BindingMagicString, BufferEncoding, BuildOptions, ChunkFileNamesFunction, ChunkingContext, ConfigExport, CustomPluginOptions, DefineParallelPluginResult, EmittedAsset, EmittedFile, EmittedPrebuiltChunk, ExistingRawSourceMap, ExternalOption, FunctionPluginHooks, GeneralHookFilter, GeneratedCodeOptions, GeneratedCodePreset, GetModuleInfo, GlobalsFunction, HookFilter, HookFilterExtension, ImportKind, InputOption, InputOptions, InternalModuleFormat, LoadResult, LogLevel, LogLevelOption, LogOrStringHandler, LoggingFunction, MinifyOptions, MinimalPluginContext, ModuleFormat, ModuleInfo, ModuleOptions, ModuleType, ModuleTypeFilter, ModuleTypes, NormalizedInputOptions, NormalizedOutputOptions, ObjectHook, OptimizationOptions, OutputAsset, OutputBundle, OutputChunk, OutputOptions, ParallelPluginHooks, PartialNull, PartialResolvedId, Plugin, PluginContext, PluginContextMeta, PreRenderedAsset, PreRenderedChunk, RenderedChunk, RenderedModule, ResolveIdExtraOptions, ResolveIdResult, ResolvedId, RolldownBuild, RolldownDirectoryEntry, RolldownFileStats, RolldownFsModule, RolldownOptions, RolldownOptionsFunction, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatcher, RolldownWatcherEvent, RollupError, RollupLog, RollupLogWithString, SourceDescription, SourceMap, SourceMapInput, SourcemapIgnoreListOption, TransformPluginContext, TransformResult, TreeshakingOptions, VERSION, WarningHandlerWithDefault, WatchOptions, WatcherOptions, build, defineConfig, rolldown, watch };
package/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
- import { n as onExit, t as watch } from "./shared/watch-DDjo8C9u.mjs";
2
- import { y as VERSION } from "./shared/normalize-string-or-regex-FzNsMab1.mjs";
3
- import "./shared/rolldown-build-D8oOi181.mjs";
4
- import "./shared/bindingify-input-options-nvXYfbt3.mjs";
5
- import "./shared/parse-ast-index-BZ4FJxMm.mjs";
6
- import { t as rolldown } from "./shared/rolldown-CTRsCETA.mjs";
1
+ import { n as onExit, t as watch } from "./shared/watch-BHMj7YNj.mjs";
2
+ import { y as VERSION } from "./shared/normalize-string-or-regex-CwM9ci6w.mjs";
3
+ import "./shared/rolldown-build-B3XDwemQ.mjs";
4
+ import "./shared/bindingify-input-options-kzSFdf_-.mjs";
5
+ import "./shared/parse-ast-index-DZPue_kI.mjs";
6
+ import { t as rolldown } from "./shared/rolldown-DtiFL1Ph.mjs";
7
7
  import { t as defineConfig } from "./shared/define-config-BF4P-Pum.mjs";
8
8
  import { isMainThread } from "node:worker_threads";
9
9
  import { BindingMagicString, initTraceSubscriber } from "./rolldown-binding.wasi.cjs";
@@ -102,10 +102,12 @@ function locate(source, search, options) {
102
102
  //#endregion
103
103
  //#region src/log/logs.ts
104
104
  const INVALID_LOG_POSITION = "INVALID_LOG_POSITION", PLUGIN_ERROR = "PLUGIN_ERROR", INPUT_HOOK_IN_OUTPUT_PLUGIN = "INPUT_HOOK_IN_OUTPUT_PLUGIN", CYCLE_LOADING = "CYCLE_LOADING", MULTIPLY_NOTIFY_OPTION = "MULTIPLY_NOTIFY_OPTION", PARSE_ERROR = "PARSE_ERROR", NO_FS_IN_BROWSER = "NO_FS_IN_BROWSER";
105
- function logParseError(message) {
105
+ function logParseError(message, id, pos) {
106
106
  return {
107
107
  code: PARSE_ERROR,
108
- message
108
+ id,
109
+ message,
110
+ pos
109
111
  };
110
112
  }
111
113
  function logInvalidLogPosition(pluginName) {
@@ -234,7 +236,7 @@ function getLogHandler(level, code, logger, pluginName, logLevel) {
234
236
 
235
237
  //#endregion
236
238
  //#region package.json
237
- var version = "1.0.0-beta.55";
239
+ var version = "1.0.0-beta.56";
238
240
 
239
241
  //#endregion
240
242
  //#region src/version.ts
@@ -1,6 +1,6 @@
1
- import "./shared/normalize-string-or-regex-FzNsMab1.mjs";
2
- import { n as PluginContextData, r as bindingifyPlugin } from "./shared/bindingify-input-options-nvXYfbt3.mjs";
3
- import "./shared/parse-ast-index-BZ4FJxMm.mjs";
1
+ import "./shared/normalize-string-or-regex-CwM9ci6w.mjs";
2
+ import { n as PluginContextData, r as bindingifyPlugin } from "./shared/bindingify-input-options-kzSFdf_-.mjs";
3
+ import "./shared/parse-ast-index-DZPue_kI.mjs";
4
4
  import { parentPort, workerData } from "node:worker_threads";
5
5
  import { registerPlugins } from "./rolldown-binding.wasi.cjs";
6
6
 
@@ -1,5 +1,5 @@
1
- import { x as Plugin } from "./shared/define-config-Bwwa5Tc_.mjs";
2
- import { s as MaybePromise } from "./shared/utils-CMDrspre.mjs";
1
+ import { x as Plugin } from "./shared/define-config-CrCCK_Ci.mjs";
2
+ import { s as MaybePromise } from "./shared/utils-B3dcnHc8.mjs";
3
3
 
4
4
  //#region src/plugin/parallel-plugin-implementation.d.ts
5
5
  type ParallelPluginImplementation = Plugin;
@@ -1,4 +1,4 @@
1
- import { B as ParserOptions, z as ParseResult } from "./shared/binding-r9j8jqRV.mjs";
1
+ import { B as ParserOptions, z as ParseResult } from "./shared/binding-CDyF6W3D.mjs";
2
2
  import { Program } from "@oxc-project/types";
3
3
 
4
4
  //#region src/parse-ast-index.d.ts
@@ -1,3 +1,3 @@
1
- import { n as parseAstAsync, t as parseAst } from "./shared/parse-ast-index-BZ4FJxMm.mjs";
1
+ import { n as parseAstAsync, t as parseAst } from "./shared/parse-ast-index-DZPue_kI.mjs";
2
2
 
3
3
  export { parseAst, parseAstAsync };
@@ -1,5 +1,5 @@
1
- import { n as BuiltinPlugin, s as makeBuiltinPluginCallable } from "./normalize-string-or-regex-dwgRHUz6.js";
2
- import { t as esmExternalRequirePlugin } from "./constructors-DoEj0CTZ.js";
1
+ import { n as BuiltinPlugin, s as makeBuiltinPluginCallable } from "./normalize-string-or-regex-B-Y4k0qo.js";
2
+ import { t as esmExternalRequirePlugin } from "./constructors-DMeuUDyD.js";
3
3
 
4
4
  //#region src/builtin-plugin/replace-plugin.ts
5
5
  /**
@@ -1,6 +1,6 @@
1
- import { u as BindingReplacePluginConfig } from "./shared/binding-r9j8jqRV.mjs";
2
- import { t as BuiltinPlugin } from "./shared/utils-CMDrspre.mjs";
3
- import { t as esmExternalRequirePlugin } from "./shared/constructors-G-fr57ib.mjs";
1
+ import { u as BindingReplacePluginConfig } from "./shared/binding-CDyF6W3D.mjs";
2
+ import { t as BuiltinPlugin } from "./shared/utils-B3dcnHc8.mjs";
3
+ import { t as esmExternalRequirePlugin } from "./shared/constructors-B0L_9ar3.mjs";
4
4
 
5
5
  //#region src/builtin-plugin/replace-plugin.d.ts
6
6
 
@@ -1,5 +1,5 @@
1
- import { n as BuiltinPlugin, s as makeBuiltinPluginCallable } from "./shared/normalize-string-or-regex-FzNsMab1.mjs";
2
- import { t as esmExternalRequirePlugin } from "./shared/constructors-oU7W7sz4.mjs";
1
+ import { n as BuiltinPlugin, s as makeBuiltinPluginCallable } from "./shared/normalize-string-or-regex-CwM9ci6w.mjs";
2
+ import { t as esmExternalRequirePlugin } from "./shared/constructors-Dw9UOO6Z.mjs";
3
3
 
4
4
  //#region src/builtin-plugin/replace-plugin.ts
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { A as augmentCodeLocation, C as LOG_LEVEL_INFO, D as unimplemented, E as arraify, F as logNoFileSystemInBrowser, I as logParseError, L as logPluginError, M as logCycleLoading, N as logInputHookInOutputPlugin, O as unreachable, R as locate, S as LOG_LEVEL_ERROR, T as logLevelPriority, _ as PlainObjectLike, a as bindingifyManifestPlugin, b as normalizeLog, c as collectChangedBundle, d as bindingifySourcemap$1, f as transformRenderedChunk, g as lazyProp, h as transformAssetSource, i as bindingifyCSSPostPlugin, j as error, k as unsupported, l as transformToOutputBundle, m as bindingAssetSource, n as BuiltinPlugin, o as bindingifyViteHtmlPlugin, p as __decorate, r as bindingifyBuiltInPlugin, t as normalizedStringOrRegex, u as transformToRollupOutput, v as MinimalPluginContextImpl, w as LOG_LEVEL_WARN, x as LOG_LEVEL_DEBUG, y as VERSION, z as getCodeFrame } from "./normalize-string-or-regex-dwgRHUz6.js";
1
+ import { A as augmentCodeLocation, C as LOG_LEVEL_INFO, D as unimplemented, E as arraify, F as logNoFileSystemInBrowser, I as logParseError, L as logPluginError, M as logCycleLoading, N as logInputHookInOutputPlugin, O as unreachable, R as locate, S as LOG_LEVEL_ERROR, T as logLevelPriority, _ as PlainObjectLike, a as bindingifyManifestPlugin, b as normalizeLog, c as collectChangedBundle, d as bindingifySourcemap$1, f as transformRenderedChunk, g as lazyProp, h as transformAssetSource, i as bindingifyCSSPostPlugin, j as error, k as unsupported, l as transformToOutputBundle, m as bindingAssetSource, n as BuiltinPlugin, o as bindingifyViteHtmlPlugin, p as __decorate, r as bindingifyBuiltInPlugin, t as normalizedStringOrRegex, u as transformToRollupOutput, v as MinimalPluginContextImpl, w as LOG_LEVEL_WARN, x as LOG_LEVEL_DEBUG, y as VERSION, z as getCodeFrame } from "./normalize-string-or-regex-B-Y4k0qo.js";
2
2
  import { BindingAttachDebugInfo, BindingBundler, BindingChunkModuleOrderBy, BindingLogLevel, BindingMagicString, BindingPluginOrder, BindingPropertyReadSideEffects, BindingPropertyWriteSideEffects, parse, parseSync, shutdownAsyncRuntime, startAsyncRuntime } from "./rolldown-binding.wasi-browser.js";
3
3
 
4
4
  //#region ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
@@ -1974,7 +1974,7 @@ const ChecksOptionsSchema = strictObject({
1974
1974
  eval: pipe(optional(boolean()), description("Whether to emit warning when detecting eval")),
1975
1975
  missingGlobalName: pipe(optional(boolean()), description("Whether to emit warning when detecting missing global name")),
1976
1976
  missingNameOptionForIifeExport: pipe(optional(boolean()), description("Whether to emit warning when detecting missing name option for iife export")),
1977
- mixedExport: pipe(optional(boolean()), description("Whether to emit warning when detecting mixed export")),
1977
+ mixedExports: pipe(optional(boolean()), description("Whether to emit warning when detecting mixed exports")),
1978
1978
  unresolvedEntry: pipe(optional(boolean()), description("Whether to emit warning when detecting unresolved entry")),
1979
1979
  unresolvedImport: pipe(optional(boolean()), description("Whether to emit warning when detecting unresolved import")),
1980
1980
  filenameConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting filename conflict")),
@@ -2064,10 +2064,10 @@ const OnLogSchema = pipe(vFunction(), args(tuple([
2064
2064
  ])));
2065
2065
  const OnwarnSchema = pipe(vFunction(), args(tuple([RollupLogSchema, pipe(vFunction(), args(tuple([union([RollupLogWithStringSchema, pipe(vFunction(), returns(RollupLogWithStringSchema))])])))])));
2066
2066
  const DevModeSchema = union([boolean(), strictObject({
2067
- new: optional(boolean()),
2068
2067
  port: optional(number()),
2069
2068
  host: optional(string()),
2070
- implement: optional(string())
2069
+ implement: optional(string()),
2070
+ lazy: optional(boolean())
2071
2071
  })]);
2072
2072
  const InputOptionsSchema = strictObject({
2073
2073
  input: optional(InputOptionSchema),
@@ -2405,12 +2405,13 @@ function parseSync$1(filename, sourceText, options) {
2405
2405
 
2406
2406
  //#endregion
2407
2407
  //#region src/parse-ast-index.ts
2408
- function wrap(result, sourceText) {
2409
- if (result.errors.length > 0) return normalizeParseError(sourceText, result.errors);
2408
+ function wrap(result, filename, sourceText) {
2409
+ if (result.errors.length > 0) return normalizeParseError(filename, sourceText, result.errors);
2410
2410
  return result.program;
2411
2411
  }
2412
- function normalizeParseError(sourceText, errors) {
2412
+ function normalizeParseError(filename, sourceText, errors) {
2413
2413
  let message = `Parse failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
2414
+ const pos = errors[0]?.labels?.[0]?.start;
2414
2415
  for (let i = 0; i < errors.length; i++) {
2415
2416
  if (i >= 5) {
2416
2417
  message += "\n...";
@@ -2423,7 +2424,9 @@ function normalizeParseError(sourceText, errors) {
2423
2424
  return getCodeFrame(sourceText, location.line, location.column);
2424
2425
  }).filter(Boolean).join("\n");
2425
2426
  }
2426
- return error(logParseError(message));
2427
+ const log = logParseError(message, filename, pos);
2428
+ if (pos !== void 0 && filename) augmentCodeLocation(log, pos, sourceText, filename);
2429
+ return error(log);
2427
2430
  }
2428
2431
  const defaultParserOptions = {
2429
2432
  lang: "js",
@@ -2433,7 +2436,7 @@ function parseAst(sourceText, options, filename) {
2433
2436
  return wrap(parseSync$1(filename ?? "file.js", sourceText, {
2434
2437
  ...defaultParserOptions,
2435
2438
  ...options
2436
- }), sourceText);
2439
+ }), filename, sourceText);
2437
2440
  }
2438
2441
 
2439
2442
  //#endregion
@@ -2703,6 +2706,20 @@ function bindingifyFilterExpr(expr) {
2703
2706
  bindingifyFilterExprImpl(expr, list);
2704
2707
  return list;
2705
2708
  }
2709
+ function containsImporterId(expr) {
2710
+ switch (expr.kind) {
2711
+ case "and":
2712
+ case "or": return expr.args.some(containsImporterId);
2713
+ case "not":
2714
+ case "include":
2715
+ case "exclude": return containsImporterId(expr.expr);
2716
+ case "importerId": return true;
2717
+ default: return false;
2718
+ }
2719
+ }
2720
+ function assertNoImporterId(filterExprs, hookName) {
2721
+ if (filterExprs?.some(containsImporterId)) throw new Error(`The \`importerId\` filter can only be used with the \`resolveId\` hook, but it was used with the \`${hookName}\` hook.`);
2722
+ }
2706
2723
  function bindingifyFilterExprImpl(expr, list) {
2707
2724
  switch (expr.kind) {
2708
2725
  case "and": {
@@ -2734,6 +2751,13 @@ function bindingifyFilterExprImpl(expr, list) {
2734
2751
  });
2735
2752
  if (expr.params.cleanUrl) list.push({ kind: "CleanUrl" });
2736
2753
  break;
2754
+ case "importerId":
2755
+ list.push({
2756
+ kind: "ImporterId",
2757
+ payload: expr.pattern
2758
+ });
2759
+ if (expr.params.cleanUrl) list.push({ kind: "CleanUrl" });
2760
+ break;
2737
2761
  case "moduleType":
2738
2762
  list.push({
2739
2763
  kind: "ModuleType",
@@ -2774,19 +2798,26 @@ function bindingifyResolveIdFilter(filterOption) {
2774
2798
  }
2775
2799
  function bindingifyLoadFilter(filterOption) {
2776
2800
  if (!filterOption) return;
2777
- if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
2801
+ if (Array.isArray(filterOption)) {
2802
+ assertNoImporterId(filterOption, "load");
2803
+ return { value: filterOption.map(bindingifyFilterExpr) };
2804
+ }
2778
2805
  return filterOption.id ? bindingifyGeneralHookFilter("id", filterOption.id) : void 0;
2779
2806
  }
2780
2807
  function bindingifyTransformFilter(filterOption) {
2781
2808
  if (!filterOption) return;
2782
2809
  let filterExprs = transformFilterMatcherToFilterExprs(filterOption);
2810
+ assertNoImporterId(filterExprs, "transform");
2783
2811
  let ret = [];
2784
2812
  if (filterExprs) ret = filterExprs.map(bindingifyFilterExpr);
2785
2813
  return { value: ret.length > 0 ? ret : void 0 };
2786
2814
  }
2787
2815
  function bindingifyRenderChunkFilter(filterOption) {
2788
2816
  if (!filterOption) return;
2789
- if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
2817
+ if (Array.isArray(filterOption)) {
2818
+ assertNoImporterId(filterOption, "renderChunk");
2819
+ return { value: filterOption.map(bindingifyFilterExpr) };
2820
+ }
2790
2821
  return filterOption.code ? bindingifyGeneralHookFilter("code", filterOption.code) : void 0;
2791
2822
  }
2792
2823
 
@@ -409,7 +409,11 @@ declare class ResolverFactory {
409
409
  static default(): ResolverFactory;
410
410
  /** Clone the resolver using the same underlying cache. */
411
411
  cloneWithOptions(options: NapiResolveOptions): ResolverFactory;
412
- /** Clear the underlying cache. */
412
+ /**
413
+ * Clear the underlying cache.
414
+ *
415
+ * Warning: The caller must ensure that there're no ongoing resolution operations when calling this method. Otherwise, it may cause those operations to return an incorrect result.
416
+ */
413
417
  clearCache(): void;
414
418
  /** Synchronously resolve `specifier` at an absolute path to a `directory`. */
415
419
  sync(directory: string, request: string): ResolveResult;
@@ -1450,6 +1454,13 @@ interface BindingJsonSourcemap {
1450
1454
  debugId?: string;
1451
1455
  x_google_ignoreList?: Array<number>;
1452
1456
  }
1457
+ interface BindingLogLocation {
1458
+ /** 1-based */
1459
+ line: number;
1460
+ /** 0-based position in the line in UTF-16 code units */
1461
+ column: number;
1462
+ file?: string;
1463
+ }
1453
1464
  interface BindingModulePreloadOptions {
1454
1465
  polyfill: boolean;
1455
1466
  resolveDependencies?: (filename: string, deps: string[], context: {
@@ -1696,18 +1707,10 @@ interface NativeError {
1696
1707
  /** The exporter associated with the error (for import/export errors) */
1697
1708
  exporter?: string;
1698
1709
  /** Location information (line, column, file) */
1699
- loc?: NativeErrorLocation;
1710
+ loc?: BindingLogLocation;
1700
1711
  /** Position in the source file in UTF-16 code units */
1701
1712
  pos?: number;
1702
1713
  }
1703
- /** Location information for errors */
1704
- interface NativeErrorLocation {
1705
- /** 1-based */
1706
- line: number;
1707
- /** 0-based position in the line in UTF-16 code units */
1708
- column: number;
1709
- file?: string;
1710
- }
1711
1714
  interface PreRenderedChunk {
1712
1715
  name: string;
1713
1716
  isEntry: boolean;
@@ -1,7 +1,7 @@
1
- import { c as logPluginError, n as error, r as logCycleLoading, t as augmentCodeLocation } from "./logs-By66Jt-E.mjs";
1
+ import { c as logPluginError, n as error, r as logCycleLoading, t as augmentCodeLocation } from "./logs-DEfpOy5A.mjs";
2
2
  import { a as unreachable, o as unsupported, t as arraify } from "./misc-BubmxcE3.mjs";
3
- import { E as LOG_LEVEL_WARN, S as normalizeLog, _ as PlainObjectLike, a as bindingifyManifestPlugin, c as collectChangedBundle, d as bindingifySourcemap, f as transformRenderedChunk, g as lazyProp, i as bindingifyCSSPostPlugin, l as transformToOutputBundle, m as bindingAssetSource, n as BuiltinPlugin, o as bindingifyViteHtmlPlugin, p as __decorate, r as bindingifyBuiltInPlugin, t as normalizedStringOrRegex, v as MinimalPluginContextImpl } from "./normalize-string-or-regex-FzNsMab1.mjs";
4
- import { t as parseAst } from "./parse-ast-index-BZ4FJxMm.mjs";
3
+ import { E as LOG_LEVEL_WARN, S as normalizeLog, _ as PlainObjectLike, a as bindingifyManifestPlugin, c as collectChangedBundle, d as bindingifySourcemap, f as transformRenderedChunk, g as lazyProp, i as bindingifyCSSPostPlugin, l as transformToOutputBundle, m as bindingAssetSource, n as BuiltinPlugin, o as bindingifyViteHtmlPlugin, p as __decorate, r as bindingifyBuiltInPlugin, t as normalizedStringOrRegex, v as MinimalPluginContextImpl } from "./normalize-string-or-regex-CwM9ci6w.mjs";
4
+ import { t as parseAst } from "./parse-ast-index-DZPue_kI.mjs";
5
5
  import { a as include, c as or, i as id, n as code, o as moduleType, r as exclude, t as and } from "./composable-filters-G1eqjHFo.mjs";
6
6
  import { BindingAttachDebugInfo, BindingChunkModuleOrderBy, BindingLogLevel, BindingMagicString, BindingPluginOrder, BindingPropertyReadSideEffects, BindingPropertyWriteSideEffects } from "../rolldown-binding.wasi.cjs";
7
7
  import path from "node:path";
@@ -208,6 +208,20 @@ function bindingifyFilterExpr(expr) {
208
208
  bindingifyFilterExprImpl(expr, list);
209
209
  return list;
210
210
  }
211
+ function containsImporterId(expr) {
212
+ switch (expr.kind) {
213
+ case "and":
214
+ case "or": return expr.args.some(containsImporterId);
215
+ case "not":
216
+ case "include":
217
+ case "exclude": return containsImporterId(expr.expr);
218
+ case "importerId": return true;
219
+ default: return false;
220
+ }
221
+ }
222
+ function assertNoImporterId(filterExprs, hookName) {
223
+ if (filterExprs?.some(containsImporterId)) throw new Error(`The \`importerId\` filter can only be used with the \`resolveId\` hook, but it was used with the \`${hookName}\` hook.`);
224
+ }
211
225
  function bindingifyFilterExprImpl(expr, list) {
212
226
  switch (expr.kind) {
213
227
  case "and": {
@@ -239,6 +253,13 @@ function bindingifyFilterExprImpl(expr, list) {
239
253
  });
240
254
  if (expr.params.cleanUrl) list.push({ kind: "CleanUrl" });
241
255
  break;
256
+ case "importerId":
257
+ list.push({
258
+ kind: "ImporterId",
259
+ payload: expr.pattern
260
+ });
261
+ if (expr.params.cleanUrl) list.push({ kind: "CleanUrl" });
262
+ break;
242
263
  case "moduleType":
243
264
  list.push({
244
265
  kind: "ModuleType",
@@ -279,19 +300,26 @@ function bindingifyResolveIdFilter(filterOption) {
279
300
  }
280
301
  function bindingifyLoadFilter(filterOption) {
281
302
  if (!filterOption) return;
282
- if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
303
+ if (Array.isArray(filterOption)) {
304
+ assertNoImporterId(filterOption, "load");
305
+ return { value: filterOption.map(bindingifyFilterExpr) };
306
+ }
283
307
  return filterOption.id ? bindingifyGeneralHookFilter("id", filterOption.id) : void 0;
284
308
  }
285
309
  function bindingifyTransformFilter(filterOption) {
286
310
  if (!filterOption) return;
287
311
  let filterExprs = transformFilterMatcherToFilterExprs(filterOption);
312
+ assertNoImporterId(filterExprs, "transform");
288
313
  let ret = [];
289
314
  if (filterExprs) ret = filterExprs.map(bindingifyFilterExpr);
290
315
  return { value: ret.length > 0 ? ret : void 0 };
291
316
  }
292
317
  function bindingifyRenderChunkFilter(filterOption) {
293
318
  if (!filterOption) return;
294
- if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
319
+ if (Array.isArray(filterOption)) {
320
+ assertNoImporterId(filterOption, "renderChunk");
321
+ return { value: filterOption.map(bindingifyFilterExpr) };
322
+ }
295
323
  return filterOption.code ? bindingifyGeneralHookFilter("code", filterOption.code) : void 0;
296
324
  }
297
325
 
@@ -1,5 +1,5 @@
1
- import { D as BindingViteResolvePluginConfig, E as BindingViteReporterPluginConfig, S as BindingViteJsonPluginConfig, T as BindingViteReactRefreshWrapperPluginConfig, h as BindingViteBuildImportAnalysisPluginConfig, i as BindingEsmExternalRequirePluginConfig, k as BindingViteWasmHelperPluginConfig, o as BindingIsolatedDeclarationPluginConfig, p as BindingViteAssetImportMetaUrlPluginConfig, v as BindingViteDynamicImportVarsPluginConfig, w as BindingViteModulePreloadPolyfillPluginConfig, x as BindingViteImportGlobPluginConfig, y as BindingViteHtmlInlineProxyPluginConfig } from "./binding-r9j8jqRV.mjs";
2
- import { t as BuiltinPlugin, u as StringOrRegExp } from "./utils-CMDrspre.mjs";
1
+ import { D as BindingViteResolvePluginConfig, E as BindingViteReporterPluginConfig, S as BindingViteJsonPluginConfig, T as BindingViteReactRefreshWrapperPluginConfig, h as BindingViteBuildImportAnalysisPluginConfig, i as BindingEsmExternalRequirePluginConfig, k as BindingViteWasmHelperPluginConfig, o as BindingIsolatedDeclarationPluginConfig, p as BindingViteAssetImportMetaUrlPluginConfig, v as BindingViteDynamicImportVarsPluginConfig, w as BindingViteModulePreloadPolyfillPluginConfig, x as BindingViteImportGlobPluginConfig, y as BindingViteHtmlInlineProxyPluginConfig } from "./binding-CDyF6W3D.mjs";
2
+ import { t as BuiltinPlugin, u as StringOrRegExp } from "./utils-B3dcnHc8.mjs";
3
3
 
4
4
  //#region src/builtin-plugin/constructors.d.ts
5
5
  declare function viteModulePreloadPolyfillPlugin(config?: BindingViteModulePreloadPolyfillPluginConfig): BuiltinPlugin;
@@ -1,4 +1,4 @@
1
- import { n as BuiltinPlugin, s as makeBuiltinPluginCallable, t as normalizedStringOrRegex } from "./normalize-string-or-regex-FzNsMab1.mjs";
1
+ import { n as BuiltinPlugin, s as makeBuiltinPluginCallable, t as normalizedStringOrRegex } from "./normalize-string-or-regex-CwM9ci6w.mjs";
2
2
 
3
3
  //#region src/builtin-plugin/constructors.ts
4
4
  function viteModulePreloadPolyfillPlugin(config) {
@@ -1,6 +1,6 @@
1
1
  import { a as RollupLog, i as RollupError, n as LogLevelOption, o as RollupLogWithString, r as LogOrStringHandler, t as LogLevel } from "./logging-BpAvp7KV.mjs";
2
- import { A as BindingWatcherBundler, B as ParserOptions, F as JsxOptions, I as MinifyOptions$1, M as ExternalMemoryStatus, V as PreRenderedChunk, W as TransformOptions$1, a as BindingHookResolveIdExtraArgs, d as BindingTransformHookExtraArgs, j as BindingWatcherEvent, l as BindingRenderedChunk, s as BindingMagicString } from "./binding-r9j8jqRV.mjs";
3
- import { a as MakeAsync, c as NullValue, l as PartialNull, n as LoggingFunction, o as MaybeArray, r as LoggingFunctionWithPosition, s as MaybePromise, t as BuiltinPlugin, u as StringOrRegExp } from "./utils-CMDrspre.mjs";
2
+ import { A as BindingWatcherBundler, B as ParserOptions, F as JsxOptions, I as MinifyOptions$1, M as ExternalMemoryStatus, V as PreRenderedChunk, W as TransformOptions$1, a as BindingHookResolveIdExtraArgs, d as BindingTransformHookExtraArgs, j as BindingWatcherEvent, l as BindingRenderedChunk, s as BindingMagicString } from "./binding-CDyF6W3D.mjs";
3
+ import { a as MakeAsync, c as NullValue, l as PartialNull, n as LoggingFunction, o as MaybeArray, r as LoggingFunctionWithPosition, s as MaybePromise, t as BuiltinPlugin, u as StringOrRegExp } from "./utils-B3dcnHc8.mjs";
4
4
  import { Program } from "@oxc-project/types";
5
5
  import { TopLevelFilterExpression } from "@rolldown/pluginutils";
6
6
 
@@ -1106,7 +1106,7 @@ type PluginHooks = { [K in keyof FunctionPluginHooks]: ObjectHook<K extends Asyn
1106
1106
  } : {})> };
1107
1107
  type AddonHookFunction = (this: PluginContext, chunk: RenderedChunk) => string | Promise<string>;
1108
1108
  type AddonHook = string | AddonHookFunction;
1109
- interface OutputPlugin extends Partial<{ [K in OutputPluginHooks]: PluginHooks[K] }>, Partial<{ [K in AddonHooks]: ObjectHook<AddonHook> }> {
1109
+ interface OutputPlugin extends Partial<{ [K in keyof PluginHooks as K & OutputPluginHooks]: PluginHooks[K] }>, Partial<{ [K in AddonHooks]: ObjectHook<AddonHook> }> {
1110
1110
  name: string;
1111
1111
  }
1112
1112
  interface Plugin<A = any> extends OutputPlugin, Partial<PluginHooks> {
@@ -1144,10 +1144,10 @@ interface ChecksOptions {
1144
1144
  */
1145
1145
  missingNameOptionForIifeExport?: boolean;
1146
1146
  /**
1147
- * Whether to emit warning when detecting mixed export
1147
+ * Whether to emit warning when detecting mixed exports
1148
1148
  * @default true
1149
1149
  */
1150
- mixedExport?: boolean;
1150
+ mixedExports?: boolean;
1151
1151
  /**
1152
1152
  * Whether to emit warning when detecting unresolved entry
1153
1153
  * @default true
@@ -1328,6 +1328,7 @@ type DevModeOptions = boolean | {
1328
1328
  host?: string;
1329
1329
  port?: number;
1330
1330
  implement?: string;
1331
+ lazy?: boolean;
1331
1332
  };
1332
1333
  type OptimizationOptions = {
1333
1334
  /**
@@ -1,4 +1,4 @@
1
- import { t as rolldown } from "./rolldown-CTRsCETA.mjs";
1
+ import { t as rolldown } from "./rolldown-DtiFL1Ph.mjs";
2
2
  import path from "node:path";
3
3
  import { readdir } from "node:fs/promises";
4
4
  import { pathToFileURL } from "node:url";
@@ -100,10 +100,12 @@ function locate(source, search, options) {
100
100
  //#endregion
101
101
  //#region src/log/logs.ts
102
102
  const INVALID_LOG_POSITION = "INVALID_LOG_POSITION", PLUGIN_ERROR = "PLUGIN_ERROR", INPUT_HOOK_IN_OUTPUT_PLUGIN = "INPUT_HOOK_IN_OUTPUT_PLUGIN", CYCLE_LOADING = "CYCLE_LOADING", MULTIPLY_NOTIFY_OPTION = "MULTIPLY_NOTIFY_OPTION", PARSE_ERROR = "PARSE_ERROR", NO_FS_IN_BROWSER = "NO_FS_IN_BROWSER";
103
- function logParseError(message) {
103
+ function logParseError(message, id, pos) {
104
104
  return {
105
105
  code: PARSE_ERROR,
106
- message
106
+ id,
107
+ message,
108
+ pos
107
109
  };
108
110
  }
109
111
  function logInvalidLogPosition(pluginName) {
@@ -1,4 +1,4 @@
1
- import { a as logInvalidLogPosition, c as logPluginError, n as error } from "./logs-By66Jt-E.mjs";
1
+ import { a as logInvalidLogPosition, c as logPluginError, n as error } from "./logs-DEfpOy5A.mjs";
2
2
  import { r as noop } from "./misc-BubmxcE3.mjs";
3
3
  import { BindingCallableBuiltinPlugin } from "../rolldown-binding.wasi.cjs";
4
4
 
@@ -32,7 +32,7 @@ function getLogHandler(level, code, logger, pluginName, logLevel) {
32
32
 
33
33
  //#endregion
34
34
  //#region package.json
35
- var version = "1.0.0-beta.55";
35
+ var version = "1.0.0-beta.56";
36
36
  var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
37
37
 
38
38
  //#endregion
@@ -1,4 +1,4 @@
1
- import { l as locate, n as error, s as logParseError, u as getCodeFrame } from "./logs-By66Jt-E.mjs";
1
+ import { l as locate, n as error, s as logParseError, t as augmentCodeLocation, u as getCodeFrame } from "./logs-DEfpOy5A.mjs";
2
2
  import { parse, parseSync } from "../rolldown-binding.wasi.cjs";
3
3
 
4
4
  //#region ../../node_modules/.pnpm/oxc-parser@0.103.0/node_modules/oxc-parser/src-js/wrap.js
@@ -54,12 +54,13 @@ function parseSync$1(filename, sourceText, options) {
54
54
 
55
55
  //#endregion
56
56
  //#region src/parse-ast-index.ts
57
- function wrap(result, sourceText) {
58
- if (result.errors.length > 0) return normalizeParseError(sourceText, result.errors);
57
+ function wrap(result, filename, sourceText) {
58
+ if (result.errors.length > 0) return normalizeParseError(filename, sourceText, result.errors);
59
59
  return result.program;
60
60
  }
61
- function normalizeParseError(sourceText, errors) {
61
+ function normalizeParseError(filename, sourceText, errors) {
62
62
  let message = `Parse failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
63
+ const pos = errors[0]?.labels?.[0]?.start;
63
64
  for (let i = 0; i < errors.length; i++) {
64
65
  if (i >= 5) {
65
66
  message += "\n...";
@@ -72,7 +73,9 @@ function normalizeParseError(sourceText, errors) {
72
73
  return getCodeFrame(sourceText, location.line, location.column);
73
74
  }).filter(Boolean).join("\n");
74
75
  }
75
- return error(logParseError(message));
76
+ const log = logParseError(message, filename, pos);
77
+ if (pos !== void 0 && filename) augmentCodeLocation(log, pos, sourceText, filename);
78
+ return error(log);
76
79
  }
77
80
  const defaultParserOptions = {
78
81
  lang: "js",
@@ -82,13 +85,13 @@ function parseAst(sourceText, options, filename) {
82
85
  return wrap(parseSync$1(filename ?? "file.js", sourceText, {
83
86
  ...defaultParserOptions,
84
87
  ...options
85
- }), sourceText);
88
+ }), filename, sourceText);
86
89
  }
87
90
  async function parseAstAsync(sourceText, options, filename) {
88
91
  return wrap(await parse$1(filename ?? "file.js", sourceText, {
89
92
  ...defaultParserOptions,
90
93
  ...options
91
- }), sourceText);
94
+ }), filename, sourceText);
92
95
  }
93
96
 
94
97
  //#endregion
@@ -1,4 +1,4 @@
1
- import { l as PluginDriver, s as validateOption, t as RolldownBuild } from "./rolldown-build-D8oOi181.mjs";
1
+ import { l as PluginDriver, s as validateOption, t as RolldownBuild } from "./rolldown-build-B3XDwemQ.mjs";
2
2
 
3
3
  //#region src/api/rolldown/index.ts
4
4
  const rolldown = async (input) => {
@@ -1,7 +1,7 @@
1
- import { i as logInputHookInOutputPlugin, n as error } from "./logs-By66Jt-E.mjs";
1
+ import { i as logInputHookInOutputPlugin, n as error } from "./logs-DEfpOy5A.mjs";
2
2
  import { i as unimplemented } from "./misc-BubmxcE3.mjs";
3
- import { C as LOG_LEVEL_DEBUG, D as logLevelPriority, E as LOG_LEVEL_WARN, S as normalizeLog, T as LOG_LEVEL_INFO, _ as PlainObjectLike, f as transformRenderedChunk, g as lazyProp, h as transformAssetSource, n as BuiltinPlugin, p as __decorate, u as transformToRollupOutput, v as MinimalPluginContextImpl, w as LOG_LEVEL_ERROR, y as VERSION } from "./normalize-string-or-regex-FzNsMab1.mjs";
4
- import { c as normalizeHook, i as transformModuleInfo, s as unwrapBindingResult, t as bindingifyInputOptions } from "./bindingify-input-options-nvXYfbt3.mjs";
3
+ import { C as LOG_LEVEL_DEBUG, D as logLevelPriority, E as LOG_LEVEL_WARN, S as normalizeLog, T as LOG_LEVEL_INFO, _ as PlainObjectLike, f as transformRenderedChunk, g as lazyProp, h as transformAssetSource, n as BuiltinPlugin, p as __decorate, u as transformToRollupOutput, v as MinimalPluginContextImpl, w as LOG_LEVEL_ERROR, y as VERSION } from "./normalize-string-or-regex-CwM9ci6w.mjs";
4
+ import { c as normalizeHook, i as transformModuleInfo, s as unwrapBindingResult, t as bindingifyInputOptions } from "./bindingify-input-options-kzSFdf_-.mjs";
5
5
  import { Worker } from "node:worker_threads";
6
6
  import { BindingBundler, ParallelJsPluginRegistry, shutdownAsyncRuntime, startAsyncRuntime } from "../rolldown-binding.wasi.cjs";
7
7
  import path from "node:path";
@@ -1607,7 +1607,7 @@ const ChecksOptionsSchema = strictObject({
1607
1607
  eval: pipe(optional(boolean()), description("Whether to emit warning when detecting eval")),
1608
1608
  missingGlobalName: pipe(optional(boolean()), description("Whether to emit warning when detecting missing global name")),
1609
1609
  missingNameOptionForIifeExport: pipe(optional(boolean()), description("Whether to emit warning when detecting missing name option for iife export")),
1610
- mixedExport: pipe(optional(boolean()), description("Whether to emit warning when detecting mixed export")),
1610
+ mixedExports: pipe(optional(boolean()), description("Whether to emit warning when detecting mixed exports")),
1611
1611
  unresolvedEntry: pipe(optional(boolean()), description("Whether to emit warning when detecting unresolved entry")),
1612
1612
  unresolvedImport: pipe(optional(boolean()), description("Whether to emit warning when detecting unresolved import")),
1613
1613
  filenameConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting filename conflict")),
@@ -1697,10 +1697,10 @@ const OnLogSchema = pipe(vFunction(), args(tuple([
1697
1697
  ])));
1698
1698
  const OnwarnSchema = pipe(vFunction(), args(tuple([RollupLogSchema, pipe(vFunction(), args(tuple([union([RollupLogWithStringSchema, pipe(vFunction(), returns(RollupLogWithStringSchema))])])))])));
1699
1699
  const DevModeSchema = union([boolean(), strictObject({
1700
- new: optional(boolean()),
1701
1700
  port: optional(number()),
1702
1701
  host: optional(string()),
1703
- implement: optional(string())
1702
+ implement: optional(string()),
1703
+ lazy: optional(boolean())
1704
1704
  })]);
1705
1705
  const InputOptionsSchema = strictObject({
1706
1706
  input: optional(InputOptionSchema),
@@ -1,5 +1,5 @@
1
1
  import { a as RollupLog } from "./logging-BpAvp7KV.mjs";
2
- import { t as BindingBuiltinPluginName } from "./binding-r9j8jqRV.mjs";
2
+ import { t as BindingBuiltinPluginName } from "./binding-CDyF6W3D.mjs";
3
3
 
4
4
  //#region src/types/utils.d.ts
5
5
  type MaybePromise<T> = T | Promise<T>;
@@ -1,8 +1,8 @@
1
- import { o as logMultiplyNotifyOption } from "./logs-By66Jt-E.mjs";
1
+ import { o as logMultiplyNotifyOption } from "./logs-DEfpOy5A.mjs";
2
2
  import { t as arraify } from "./misc-BubmxcE3.mjs";
3
- import { E as LOG_LEVEL_WARN } from "./normalize-string-or-regex-FzNsMab1.mjs";
4
- import { l as PluginDriver, n as createBundlerOptions } from "./rolldown-build-D8oOi181.mjs";
5
- import { a as aggregateBindingErrorsIntoJsError } from "./bindingify-input-options-nvXYfbt3.mjs";
3
+ import { E as LOG_LEVEL_WARN } from "./normalize-string-or-regex-CwM9ci6w.mjs";
4
+ import { l as PluginDriver, n as createBundlerOptions } from "./rolldown-build-B3XDwemQ.mjs";
5
+ import { a as aggregateBindingErrorsIntoJsError } from "./bindingify-input-options-kzSFdf_-.mjs";
6
6
  import { BindingWatcher, shutdownAsyncRuntime } from "../rolldown-binding.wasi.cjs";
7
7
 
8
8
  //#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rolldown/browser",
3
- "version": "1.0.0-beta.55",
3
+ "version": "1.0.0-beta.56",
4
4
  "description": "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.",
5
5
  "homepage": "https://rolldown.rs/",
6
6
  "type": "module",