@rolldown/browser 1.0.0-rc.2 → 1.0.0-rc.4

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 (51) hide show
  1. package/dist/cli.mjs +11 -990
  2. package/dist/config.d.mts +1 -4
  3. package/dist/config.mjs +8 -11
  4. package/dist/{constructors-B8gqcrFr.js → constructors-D2wC6vT5.js} +2 -5
  5. package/dist/error-DfXdOVMF.js +158 -0
  6. package/dist/experimental-index.browser.mjs +61 -5
  7. package/dist/experimental-index.d.mts +74 -16
  8. package/dist/experimental-index.mjs +63 -7
  9. package/dist/filter-index.d.mts +1 -1
  10. package/dist/get-log-filter.d.mts +1 -1
  11. package/dist/get-log-filter.mjs +1 -2
  12. package/dist/index.browser.mjs +4 -3
  13. package/dist/index.d.mts +5 -4
  14. package/dist/index.mjs +9 -8
  15. package/dist/{normalize-string-or-regex-CL-PJZI7.js → normalize-string-or-regex-B0X1hEA4.js} +1 -1
  16. package/dist/parallel-plugin-worker.mjs +4 -3
  17. package/dist/parallel-plugin.d.mts +2 -2
  18. package/dist/parse-ast-index.d.mts +1 -1
  19. package/dist/parse-ast-index.mjs +44 -1
  20. package/dist/plugins-index.browser.mjs +2 -2
  21. package/dist/plugins-index.d.mts +2 -2
  22. package/dist/plugins-index.mjs +2 -2
  23. package/dist/rolldown-binding.wasi-browser.js +6 -0
  24. package/dist/rolldown-binding.wasi.cjs +6 -0
  25. package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
  26. package/dist/{rolldown-build-BntP6Bjl.js → rolldown-build-gXO5p6r0.js} +507 -161
  27. package/dist/shared/{bindingify-input-options-CObJx_Uj.mjs → bindingify-input-options-B32m-wO8.mjs} +40 -97
  28. package/dist/shared/{constructors-5bt5oBhE.d.mts → constructors-CtryxP-m.d.mts} +3 -4
  29. package/dist/shared/{constructors-BTW-c3jX.mjs → constructors-f9W8MQZ_.mjs} +2 -5
  30. package/dist/shared/{define-config-C-sO_cLw.d.mts → define-config-MImu5XA0.d.mts} +63 -26
  31. package/dist/shared/error-DTJQ7tjB.mjs +89 -0
  32. package/dist/shared/{load-config-hx3WBhLe.mjs → load-config-nINjF42i.mjs} +2 -2
  33. package/dist/shared/{logs-B2CASPcx.mjs → logs-CCc_0vhs.mjs} +1 -1
  34. package/dist/shared/{normalize-string-or-regex-DIwprzLy.mjs → normalize-string-or-regex-CdT2cmt4.mjs} +1 -1
  35. package/dist/shared/parse-C5IFYsFB.mjs +72 -0
  36. package/dist/shared/{rolldown-D2E0YTeB.mjs → rolldown-CkjERUOD.mjs} +1 -1
  37. package/dist/shared/{rolldown-build-Do6WlRGM.mjs → rolldown-build-nvl-pSiK.mjs} +1011 -17
  38. package/dist/shared/transform-ChAcTNv3.d.mts +92 -0
  39. package/dist/shared/transform-DhHPKnL-.mjs +90 -0
  40. package/dist/shared/{types-CIhJMr1h.d.mts → types-C2Sw7GCQ.d.mts} +1 -1
  41. package/dist/shared/{watch-BsneBCNP.mjs → watch-CC4jn0NJ.mjs} +4 -3
  42. package/dist/transform-DmR2FE2Q.js +90 -0
  43. package/dist/utils-index.browser.mjs +4 -0
  44. package/dist/utils-index.d.mts +2 -0
  45. package/dist/utils-index.mjs +5 -0
  46. package/package.json +1 -1
  47. package/dist/shared/parse-ast-index-BQpfNG1v.mjs +0 -98
  48. /package/dist/shared/{define-config-Dlptvz3X.mjs → define-config-BVG4QvnP.mjs} +0 -0
  49. /package/dist/shared/{logging-RB67zQ4N.d.mts → logging-C28dTP71.d.mts} +0 -0
  50. /package/dist/shared/{prompt-CYPmuhh-.mjs → prompt-BcvPElI8.mjs} +0 -0
  51. /package/dist/shared/{utils-CqMTwlsR.d.mts → utils-DOXNRW_3.d.mts} +0 -0
@@ -1,4 +1,4 @@
1
- import { t as Program } from "./shared/types-CIhJMr1h.mjs";
1
+ import { t as Program } from "./shared/types-C2Sw7GCQ.mjs";
2
2
  import { ParseResult, ParserOptions } from "./binding.cjs";
3
3
 
4
4
  //#region src/parse-ast-index.d.ts
@@ -1,3 +1,46 @@
1
- import { n as parseAstAsync, t as parseAst } from "./shared/parse-ast-index-BQpfNG1v.mjs";
1
+ import { l as locate, n as error, s as logParseError, t as augmentCodeLocation, u as getCodeFrame } from "./shared/logs-CCc_0vhs.mjs";
2
+ import { n as parseSync, t as parse } from "./shared/parse-C5IFYsFB.mjs";
2
3
 
4
+ //#region src/parse-ast-index.ts
5
+ function wrap(result, filename, sourceText) {
6
+ if (result.errors.length > 0) return normalizeParseError(filename, sourceText, result.errors);
7
+ return result.program;
8
+ }
9
+ function normalizeParseError(filename, sourceText, errors) {
10
+ let message = `Parse failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
11
+ const pos = errors[0]?.labels?.[0]?.start;
12
+ for (let i = 0; i < errors.length; i++) {
13
+ if (i >= 5) {
14
+ message += "\n...";
15
+ break;
16
+ }
17
+ const e = errors[i];
18
+ message += e.message + "\n" + e.labels.map((label) => {
19
+ const location = locate(sourceText, label.start, { offsetLine: 1 });
20
+ if (!location) return;
21
+ return getCodeFrame(sourceText, location.line, location.column);
22
+ }).filter(Boolean).join("\n");
23
+ }
24
+ const log = logParseError(message, filename, pos);
25
+ if (pos !== void 0 && filename) augmentCodeLocation(log, pos, sourceText, filename);
26
+ return error(log);
27
+ }
28
+ const defaultParserOptions = {
29
+ lang: "js",
30
+ preserveParens: false
31
+ };
32
+ function parseAst(sourceText, options, filename) {
33
+ return wrap(parseSync(filename ?? "file.js", sourceText, {
34
+ ...defaultParserOptions,
35
+ ...options
36
+ }), filename, sourceText);
37
+ }
38
+ async function parseAstAsync(sourceText, options, filename) {
39
+ return wrap(await parse(filename ?? "file.js", sourceText, {
40
+ ...defaultParserOptions,
41
+ ...options
42
+ }), filename, sourceText);
43
+ }
44
+
45
+ //#endregion
3
46
  export { parseAst, parseAstAsync };
@@ -1,5 +1,5 @@
1
- import { a as makeBuiltinPluginCallable, n as BuiltinPlugin } from "./normalize-string-or-regex-CL-PJZI7.js";
2
- import { t as esmExternalRequirePlugin } from "./constructors-B8gqcrFr.js";
1
+ import { a as makeBuiltinPluginCallable, n as BuiltinPlugin } from "./normalize-string-or-regex-B0X1hEA4.js";
2
+ import { t as esmExternalRequirePlugin } from "./constructors-D2wC6vT5.js";
3
3
 
4
4
  //#region src/builtin-plugin/replace-plugin.ts
5
5
  /**
@@ -1,5 +1,5 @@
1
- import { t as BuiltinPlugin } from "./shared/utils-CqMTwlsR.mjs";
2
- import { t as esmExternalRequirePlugin } from "./shared/constructors-5bt5oBhE.mjs";
1
+ import { t as BuiltinPlugin } from "./shared/utils-DOXNRW_3.mjs";
2
+ import { t as esmExternalRequirePlugin } from "./shared/constructors-CtryxP-m.mjs";
3
3
  import { BindingReplacePluginConfig } from "../binding.cjs";
4
4
 
5
5
  //#region src/builtin-plugin/replace-plugin.d.ts
@@ -1,5 +1,5 @@
1
- import { a as makeBuiltinPluginCallable, n as BuiltinPlugin } from "./shared/normalize-string-or-regex-DIwprzLy.mjs";
2
- import { t as esmExternalRequirePlugin } from "./shared/constructors-BTW-c3jX.mjs";
1
+ import { a as makeBuiltinPluginCallable, n as BuiltinPlugin } from "./shared/normalize-string-or-regex-CdT2cmt4.mjs";
2
+ import { t as esmExternalRequirePlugin } from "./shared/constructors-f9W8MQZ_.mjs";
3
3
 
4
4
  //#region src/builtin-plugin/replace-plugin.ts
5
5
  /**
@@ -92,6 +92,7 @@ export const BindingCallableBuiltinPlugin = __napiModule.exports.BindingCallable
92
92
  export const BindingChunkingContext = __napiModule.exports.BindingChunkingContext
93
93
  export const BindingDecodedMap = __napiModule.exports.BindingDecodedMap
94
94
  export const BindingDevEngine = __napiModule.exports.BindingDevEngine
95
+ export const BindingLoadPluginContext = __napiModule.exports.BindingLoadPluginContext
95
96
  export const BindingMagicString = __napiModule.exports.BindingMagicString
96
97
  export const BindingModuleInfo = __napiModule.exports.BindingModuleInfo
97
98
  export const BindingNormalizedOptions = __napiModule.exports.BindingNormalizedOptions
@@ -110,6 +111,7 @@ export const BindingWatcherEvent = __napiModule.exports.BindingWatcherEvent
110
111
  export const ParallelJsPluginRegistry = __napiModule.exports.ParallelJsPluginRegistry
111
112
  export const ScheduledBuild = __napiModule.exports.ScheduledBuild
112
113
  export const TraceSubscriberGuard = __napiModule.exports.TraceSubscriberGuard
114
+ export const TsconfigCache = __napiModule.exports.TsconfigCache
113
115
  export const BindingAttachDebugInfo = __napiModule.exports.BindingAttachDebugInfo
114
116
  export const BindingBuiltinPluginName = __napiModule.exports.BindingBuiltinPluginName
115
117
  export const BindingChunkModuleOrderBy = __napiModule.exports.BindingChunkModuleOrderBy
@@ -118,9 +120,13 @@ export const BindingPluginOrder = __napiModule.exports.BindingPluginOrder
118
120
  export const BindingPropertyReadSideEffects = __napiModule.exports.BindingPropertyReadSideEffects
119
121
  export const BindingPropertyWriteSideEffects = __napiModule.exports.BindingPropertyWriteSideEffects
120
122
  export const BindingRebuildStrategy = __napiModule.exports.BindingRebuildStrategy
123
+ export const collapseSourcemaps = __napiModule.exports.collapseSourcemaps
121
124
  export const createTokioRuntime = __napiModule.exports.createTokioRuntime
125
+ export const enhancedTransform = __napiModule.exports.enhancedTransform
126
+ export const enhancedTransformSync = __napiModule.exports.enhancedTransformSync
122
127
  export const FilterTokenKind = __napiModule.exports.FilterTokenKind
123
128
  export const initTraceSubscriber = __napiModule.exports.initTraceSubscriber
124
129
  export const registerPlugins = __napiModule.exports.registerPlugins
130
+ export const resolveTsconfig = __napiModule.exports.resolveTsconfig
125
131
  export const shutdownAsyncRuntime = __napiModule.exports.shutdownAsyncRuntime
126
132
  export const startAsyncRuntime = __napiModule.exports.startAsyncRuntime
@@ -137,6 +137,7 @@ module.exports.BindingCallableBuiltinPlugin = __napiModule.exports.BindingCallab
137
137
  module.exports.BindingChunkingContext = __napiModule.exports.BindingChunkingContext
138
138
  module.exports.BindingDecodedMap = __napiModule.exports.BindingDecodedMap
139
139
  module.exports.BindingDevEngine = __napiModule.exports.BindingDevEngine
140
+ module.exports.BindingLoadPluginContext = __napiModule.exports.BindingLoadPluginContext
140
141
  module.exports.BindingMagicString = __napiModule.exports.BindingMagicString
141
142
  module.exports.BindingModuleInfo = __napiModule.exports.BindingModuleInfo
142
143
  module.exports.BindingNormalizedOptions = __napiModule.exports.BindingNormalizedOptions
@@ -155,6 +156,7 @@ module.exports.BindingWatcherEvent = __napiModule.exports.BindingWatcherEvent
155
156
  module.exports.ParallelJsPluginRegistry = __napiModule.exports.ParallelJsPluginRegistry
156
157
  module.exports.ScheduledBuild = __napiModule.exports.ScheduledBuild
157
158
  module.exports.TraceSubscriberGuard = __napiModule.exports.TraceSubscriberGuard
159
+ module.exports.TsconfigCache = __napiModule.exports.TsconfigCache
158
160
  module.exports.BindingAttachDebugInfo = __napiModule.exports.BindingAttachDebugInfo
159
161
  module.exports.BindingBuiltinPluginName = __napiModule.exports.BindingBuiltinPluginName
160
162
  module.exports.BindingChunkModuleOrderBy = __napiModule.exports.BindingChunkModuleOrderBy
@@ -163,9 +165,13 @@ module.exports.BindingPluginOrder = __napiModule.exports.BindingPluginOrder
163
165
  module.exports.BindingPropertyReadSideEffects = __napiModule.exports.BindingPropertyReadSideEffects
164
166
  module.exports.BindingPropertyWriteSideEffects = __napiModule.exports.BindingPropertyWriteSideEffects
165
167
  module.exports.BindingRebuildStrategy = __napiModule.exports.BindingRebuildStrategy
168
+ module.exports.collapseSourcemaps = __napiModule.exports.collapseSourcemaps
166
169
  module.exports.createTokioRuntime = __napiModule.exports.createTokioRuntime
170
+ module.exports.enhancedTransform = __napiModule.exports.enhancedTransform
171
+ module.exports.enhancedTransformSync = __napiModule.exports.enhancedTransformSync
167
172
  module.exports.FilterTokenKind = __napiModule.exports.FilterTokenKind
168
173
  module.exports.initTraceSubscriber = __napiModule.exports.initTraceSubscriber
169
174
  module.exports.registerPlugins = __napiModule.exports.registerPlugins
175
+ module.exports.resolveTsconfig = __napiModule.exports.resolveTsconfig
170
176
  module.exports.shutdownAsyncRuntime = __napiModule.exports.shutdownAsyncRuntime
171
177
  module.exports.startAsyncRuntime = __napiModule.exports.startAsyncRuntime