rollipop 1.0.0-alpha.28 → 1.0.0-alpha.30

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 (181) hide show
  1. package/bin/index.js +7 -2
  2. package/dist/_virtual/_rolldown/runtime.js +1 -1
  3. package/dist/commands.js +4 -4
  4. package/dist/common/code.js +1 -1
  5. package/dist/common/env.js +1 -1
  6. package/dist/common/logger.d.ts +7 -5
  7. package/dist/common/logger.js +6 -4
  8. package/dist/common/progress-bar.js +25 -8
  9. package/dist/config/compose-override.js +9 -11
  10. package/dist/config/defaults.d.ts +26 -50
  11. package/dist/config/defaults.js +23 -34
  12. package/dist/config/define-config.d.ts +5 -7
  13. package/dist/config/index.d.ts +5 -3
  14. package/dist/config/index.js +5 -5
  15. package/dist/config/load-config.d.ts +9 -11
  16. package/dist/config/load-config.js +5 -4
  17. package/dist/config/merge-config.d.ts +5 -7
  18. package/dist/config/merge-config.js +11 -6
  19. package/dist/config/notice.js +1 -1
  20. package/dist/config/types.d.ts +56 -261
  21. package/dist/constants.d.ts +19 -18
  22. package/dist/constants.js +4 -2
  23. package/dist/core/analyze.js +1 -1
  24. package/dist/core/assets.d.ts +15 -15
  25. package/dist/core/assets.js +2 -2
  26. package/dist/core/bundler.d.ts +3 -5
  27. package/dist/core/bundler.js +30 -21
  28. package/dist/core/env.d.ts +4 -4
  29. package/dist/core/plugins/alias-plugin.d.ts +3 -4
  30. package/dist/core/plugins/alias-plugin.js +1 -1
  31. package/dist/core/plugins/analyze-plugin.d.ts +3 -3
  32. package/dist/core/plugins/analyze-plugin.js +1 -1
  33. package/dist/core/plugins/babel-plugin.d.ts +6 -16
  34. package/dist/core/plugins/babel-plugin.js +55 -50
  35. package/dist/core/plugins/context.d.ts +3 -4
  36. package/dist/core/plugins/context.js +1 -1
  37. package/dist/core/plugins/dev-server-plugin.d.ts +13 -5
  38. package/dist/core/plugins/dev-server-plugin.js +63 -18
  39. package/dist/core/plugins/entry-plugin.d.ts +4 -4
  40. package/dist/core/plugins/entry-plugin.js +34 -6
  41. package/dist/core/plugins/import-glob-plugin.d.ts +2 -3
  42. package/dist/core/plugins/import-glob-plugin.js +1 -1
  43. package/dist/core/plugins/index.d.ts +12 -13
  44. package/dist/core/plugins/index.js +12 -10
  45. package/dist/core/plugins/react-native-plugin.d.ts +4 -21
  46. package/dist/core/plugins/react-native-plugin.js +4 -37
  47. package/dist/core/plugins/reporter-plugin.d.ts +4 -5
  48. package/dist/core/plugins/reporter-plugin.js +6 -6
  49. package/dist/core/plugins/resolution-topology-plugin.d.ts +11 -0
  50. package/dist/core/plugins/resolution-topology-plugin.js +318 -0
  51. package/dist/core/plugins/shared/filters.js +16 -3
  52. package/dist/core/plugins/swc-plugin.d.ts +6 -20
  53. package/dist/core/plugins/swc-plugin.js +45 -66
  54. package/dist/core/plugins/types.d.ts +20 -7
  55. package/dist/core/plugins/utils/transform-utils.js +3 -5
  56. package/dist/core/rolldown.d.ts +15 -0
  57. package/dist/core/rolldown.js +138 -121
  58. package/dist/core/settings.js +4 -3
  59. package/dist/core/types.d.ts +21 -11
  60. package/dist/events/builtin-reporters.js +132 -0
  61. package/dist/events/consumers.js +33 -0
  62. package/dist/events/event-bus.d.ts +9 -0
  63. package/dist/{server/events → events}/event-bus.js +2 -3
  64. package/dist/events/types.d.ts +93 -0
  65. package/dist/events/utils.js +6 -0
  66. package/dist/hmr-runtime.iife.js +581 -94
  67. package/dist/index.d.ts +16 -10
  68. package/dist/index.js +11 -4
  69. package/dist/internal/react-native.js +2 -1
  70. package/dist/node/cli-utils.d.ts +3 -4
  71. package/dist/node/cli-utils.js +2 -2
  72. package/dist/node/cli.d.ts +1 -1
  73. package/dist/node/cli.js +1 -1
  74. package/dist/node/commands/agent/action.js +11 -30
  75. package/dist/node/commands/agent/index.js +2 -2
  76. package/dist/node/commands/bundle/action.js +2 -2
  77. package/dist/node/commands/bundle/command.js +4 -2
  78. package/dist/node/commands/bundle/index.js +2 -2
  79. package/dist/node/commands/skills/action.js +1 -1
  80. package/dist/node/commands/start/action.js +12 -8
  81. package/dist/node/commands/start/command.js +4 -6
  82. package/dist/node/commands/start/debugger.js +2 -2
  83. package/dist/node/commands/start/index.js +2 -2
  84. package/dist/node/commands/start/setup-interactive-mode.d.ts +7 -7
  85. package/dist/node/commands/start/setup-interactive-mode.js +5 -5
  86. package/dist/node/types.d.ts +6 -7
  87. package/dist/package.js +1 -1
  88. package/dist/{chunk-DJV587Yu.js → rolldown-runtime-BHXq-rbM.js} +4 -4
  89. package/dist/runtime.d.ts +2 -0
  90. package/dist/runtime.js +1 -1
  91. package/dist/server/bundle-url.js +16 -0
  92. package/dist/server/bundle.d.ts +2 -4
  93. package/dist/server/bundle.js +10 -5
  94. package/dist/server/bundler-pool.d.ts +18 -14
  95. package/dist/server/bundler-pool.js +90 -60
  96. package/dist/server/common/schema.js +0 -2
  97. package/dist/server/constants.d.ts +4 -5
  98. package/dist/server/create-dev-server.js +37 -55
  99. package/dist/server/{mcp → devframe/agent}/context.js +3 -3
  100. package/dist/server/{mcp → devframe/agent}/tools/app-log-diagnostics.js +1 -1
  101. package/dist/server/{mcp → devframe/agent}/tools/build-diagnostics.js +7 -9
  102. package/dist/server/devframe/agent/tools/build-info.js +11 -0
  103. package/dist/server/{mcp → devframe/agent}/tools/client-diagnostics.js +1 -1
  104. package/dist/server/{mcp → devframe/agent}/tools/index.js +51 -74
  105. package/dist/server/{rest → devframe}/data.js +9 -9
  106. package/dist/server/{rest → devframe}/devtools-targets.js +1 -1
  107. package/dist/server/{sse/adapter.js → devframe/events.js} +6 -17
  108. package/dist/server/{rest/serializers.js → devframe/formatters.js} +22 -11
  109. package/dist/server/devframe/index.js +218 -0
  110. package/dist/server/devframe/setup.js +98 -0
  111. package/dist/server/hot-update-store.d.ts +19 -0
  112. package/dist/server/hot-update-store.js +109 -0
  113. package/dist/server/index.d.ts +6 -2
  114. package/dist/server/index.js +8 -3
  115. package/dist/server/middlewares/dashboard.js +4 -3
  116. package/dist/server/middlewares/serve-assets.js +5 -13
  117. package/dist/server/middlewares/serve-bundle.js +4 -4
  118. package/dist/server/middlewares/serve-hot-updates.js +25 -0
  119. package/dist/server/middlewares/symbolicate.js +9 -1
  120. package/dist/server/state/store.d.ts +11 -15
  121. package/dist/server/state/store.js +7 -10
  122. package/dist/server/types.d.ts +13 -14
  123. package/dist/server/wss/hmr-server.js +75 -55
  124. package/dist/server/wss/server.d.ts +3 -4
  125. package/dist/storage/file-storage.d.ts +4 -7
  126. package/dist/storage/file-storage.js +3 -3
  127. package/dist/types/hmr.d.ts +17 -14
  128. package/dist/types.d.ts +17 -69
  129. package/dist/utils/babel.js +2 -2
  130. package/dist/utils/build-options.d.ts +6 -6
  131. package/dist/utils/build-options.js +8 -7
  132. package/dist/utils/config.d.ts +7 -4
  133. package/dist/utils/config.js +3 -3
  134. package/dist/utils/dev-server.js +0 -1
  135. package/dist/utils/hash.js +0 -1
  136. package/dist/utils/id.js +19 -9
  137. package/dist/utils/reporters.js +1 -113
  138. package/dist/utils/reset-cache.d.ts +2 -3
  139. package/dist/utils/run-server.js +2 -8
  140. package/dist/utils/serialize.js +1 -0
  141. package/dist/utils/server.js +6 -1
  142. package/dist/utils/source-map.js +22 -0
  143. package/dist/utils/storage.js +1 -0
  144. package/dist/utils/string.js +36 -1
  145. package/dist/utils/swc.js +2 -2
  146. package/dist/utils/terminal.js +1 -1
  147. package/dist/utils/transform.js +5 -2
  148. package/dist/utils/url.js +1 -1
  149. package/package.json +45 -37
  150. package/skills/configuration.md +4 -4
  151. package/skills/core.md +3 -3
  152. package/skills/debugging.md +2 -6
  153. package/skills/dev-server.md +2 -6
  154. package/skills/migration.md +1 -1
  155. package/skills/troubleshooting.md +4 -4
  156. package/src/runtime/__tests__/hmr-runtime.spec.ts +562 -0
  157. package/src/runtime/hmr-client.ts +132 -97
  158. package/src/runtime/hmr-runtime.ts +381 -54
  159. package/dist/core/plugins/utils/source.js +0 -10
  160. package/dist/server/create-dev-server.d.ts +0 -6
  161. package/dist/server/events/event-bus.d.ts +0 -12
  162. package/dist/server/events/types.d.ts +0 -37
  163. package/dist/server/events/types.js +0 -6
  164. package/dist/server/mcp/server.js +0 -86
  165. package/dist/server/mcp/tools/build-info.js +0 -11
  166. package/dist/server/middlewares/sse.js +0 -36
  167. package/dist/server/rest/domains/actions.js +0 -24
  168. package/dist/server/rest/domains/builds.js +0 -37
  169. package/dist/server/rest/domains/bundlers.js +0 -30
  170. package/dist/server/rest/domains/config.js +0 -14
  171. package/dist/server/rest/domains/dev-server.js +0 -14
  172. package/dist/server/rest/domains/devices.js +0 -20
  173. package/dist/server/rest/domains/feature-flags.js +0 -14
  174. package/dist/server/rest/domains/snapshot.js +0 -14
  175. package/dist/server/rest/index.js +0 -56
  176. package/dist/server/rest/response.js +0 -9
  177. package/dist/server/sse/event-bus.js +0 -26
  178. package/dist/utils/promise.js +0 -15
  179. package/dist/utils/run-build.d.ts +0 -8
  180. package/dist/utils/run-server.d.ts +0 -6
  181. package/src/runtime/runtime-utils.ts +0 -57
@@ -1,17 +1,21 @@
1
1
  import { MaybePromise, NullValue, Reporter } from "../types.js";
2
- import { Plugin } from "../core/plugins/types.js";
2
+ import { RolldownOptions, RolldownOptionsConfig, RolldownOptionsContext, RolldownOptionsFunction } from "../core/rolldown.js";
3
3
  import { AliasEntry } from "../core/plugins/alias-plugin.js";
4
+ import "../core/plugins/index.js";
4
5
  import { InteractiveCommand } from "../node/commands/start/setup-interactive-mode.js";
5
- import { DevWatchOptions, RollipopReactNativeFlowConfig, RollipopReactNativeWorkletsConfig } from "@rollipop/rolldown/experimental";
6
+ import "../node/cli-utils.js";
7
+ import { Plugin } from "../core/plugins/types.js";
8
+ import { DevWatchOptions, RollipopReactNativeFlowConfig, RollipopReactNativeSwcConfig, RollipopReactNativeWorkletsConfig } from "@rollipop/rolldown/experimental";
6
9
  import * as rolldown from "@rollipop/rolldown";
7
10
  import { TopLevelFilterExpression } from "@rollipop/rolldown/filter";
8
11
  import * as babel from "@babel/core";
9
12
  import * as swc from "@swc/core";
10
- import { TransformOptions } from "@rollipop/rolldown/utils";
11
-
12
13
  //#region src/config/types.d.ts
13
14
  type RolldownExperimentalOptions = NonNullable<rolldown.InputOptions['experimental']>;
14
- interface Config {
15
+ type RolldownTransformOptions = NonNullable<rolldown.InputOptions['transform']>;
16
+ type RollipopManagedInputOption = 'input' | 'plugins' | 'cwd' | 'platform' | 'checks' | 'logLevel' | 'onLog' | 'onwarn' | 'resolve' | 'transform' | 'watch' | 'experimental' | 'id';
17
+ type RollipopManagedOutputOption = 'dir' | 'file' | 'format' | 'codeSplitting' | 'persistentCache';
18
+ export interface Config extends Omit<rolldown.InputOptions, RollipopManagedInputOption> {
15
19
  /**
16
20
  * Defaults to current working directory.
17
21
  */
@@ -29,31 +33,31 @@ interface Config {
29
33
  /**
30
34
  * Resolver configuration.
31
35
  */
32
- resolver?: ResolverConfig;
36
+ resolve?: ResolveConfig;
33
37
  /**
34
38
  * Transformer configuration.
35
39
  */
36
- transformer?: TransformerConfig;
40
+ transform?: TransformConfig;
37
41
  /**
38
- * Serializer configuration.
42
+ * Prelude modules imported before the app entry module.
39
43
  */
40
- serializer?: SerializerConfig;
44
+ prelude?: string[];
41
45
  /**
42
- * Watcher configuration.
46
+ * Polyfills injected before the app modules run.
43
47
  */
44
- watcher?: WatcherConfig;
48
+ polyfills?: Polyfill[];
45
49
  /**
46
- * Optimization configuration.
50
+ * Output configuration.
47
51
  */
48
- optimization?: OptimizationConfig;
52
+ output?: OutputConfig;
49
53
  /**
50
54
  * React Native specific configuration.
51
55
  */
52
56
  reactNative?: ReactNativeConfig;
53
57
  /**
54
- * Terminal configuration.
58
+ * Custom commands to display in the interactive mode.
55
59
  */
56
- terminal?: TerminalConfig;
60
+ commands?: InteractiveCommand[];
57
61
  /**
58
62
  * Reporter configuration.
59
63
  */
@@ -65,7 +69,7 @@ interface Config {
65
69
  /**
66
70
  * Dev mode specific configuration. (for dev server)
67
71
  */
68
- devMode?: DevModeConfig;
72
+ dev?: DevConfig;
69
73
  /**
70
74
  * Directory to load environment variables from.
71
75
  *
@@ -91,88 +95,6 @@ interface Config {
91
95
  * Defaults to: `'ROLLIPOP_'`
92
96
  */
93
97
  envPrefix?: string;
94
- /**
95
- * Configures TypeScript configuration file resolution and usage.
96
- *
97
- * Defaults to: `true`
98
- */
99
- tsconfig?: rolldown.InputOptions['tsconfig'];
100
- /**
101
- * Whether to generate sourcemaps.
102
- *
103
- * - `false`: No sourcemap will be generated.
104
- * - `true`: A separate sourcemap file will be generated.
105
- * - `'inline'`: The sourcemap will be appended to the output file as a data URL.
106
- * - `'hidden'`: A separate sourcemap file will be generated, but the link to the sourcemap (//# sourceMappingURL comment) will not be included in the output file.
107
- *
108
- * Defaults to: `true` when in development mode, `false` otherwise.
109
- */
110
- sourcemap?: rolldown.OutputOptions['sourcemap'];
111
- /**
112
- * The base URL for the links to the sourcemap file in the output file.
113
- *
114
- * By default, relative URLs are generated. If this option is set, an absolute URL with that base URL will be generated.
115
- * This is useful when deploying source maps to a different location than your code, such as a CDN or separate debugging server.
116
- */
117
- sourcemapBaseUrl?: rolldown.OutputOptions['sourcemapBaseUrl'];
118
- /**
119
- * Whether to include [debug IDs](https://github.com/tc39/ecma426/blob/main/proposals/debug-id.md) in the sourcemap.
120
- *
121
- * When `true`, a unique debug ID will be emitted in source and sourcemaps which streamlines identifying sourcemaps across different builds.
122
- *
123
- * Defaults to: `false`
124
- */
125
- sourcemapDebugIds?: rolldown.OutputOptions['sourcemapDebugIds'];
126
- /**
127
- * Control which source files are included in the sourcemap ignore list.
128
- *
129
- * Files in the ignore list are excluded from debugger stepping and error stack traces.
130
- *
131
- * - `false`: Include no source files in the ignore list
132
- * - `true`: Include all source files in the ignore list
133
- * - `string`: Files containing this string in their path will be included in the ignore list
134
- * - `RegExp`: Files matching this regular expression will be included in the ignore list
135
- * - `function`: Custom function to determine if a source should be ignored
136
- *
137
- * :::tip Performance
138
- * Using static values (`boolean`, `string`, or `RegExp`) is significantly more performant than functions.
139
- * Calling JavaScript functions from Rust has extremely high overhead, so prefer static patterns when possible.
140
- * :::
141
- *
142
- * @example
143
- * ```js
144
- * // ✅ Preferred: Use RegExp for better performance
145
- * sourcemapIgnoreList: /node_modules/
146
- *
147
- * // ✅ Preferred: Use string pattern for better performance
148
- * sourcemapIgnoreList: "vendor"
149
- *
150
- * // ! Use sparingly: Function calls have high overhead
151
- * sourcemapIgnoreList: (source, sourcemapPath) => {
152
- * return source.includes('node_modules') || source.includes('.min.');
153
- * }
154
- * ```
155
- *
156
- * Defaults to: `/node_modules/`
157
- */
158
- sourcemapIgnoreList?: rolldown.OutputOptions['sourcemapIgnoreList'];
159
- /**
160
- * A transformation to apply to each path in a sourcemap.
161
- *
162
- * @example
163
- * ```js
164
- * export default defineConfig({
165
- * output: {
166
- * sourcemap: true,
167
- * sourcemapPathTransform: (source, sourcemapPath) => {
168
- * // Remove 'src/' prefix from all source paths
169
- * return source.replace(/^src\//, '');
170
- * },
171
- * },
172
- * });
173
- * ```
174
- */
175
- sourcemapPathTransform?: rolldown.OutputOptions['sourcemapPathTransform'];
176
98
  /**
177
99
  * Plugins to apply to the build.
178
100
  */
@@ -189,16 +111,18 @@ interface Config {
189
111
  */
190
112
  experimental?: ExperimentalConfig;
191
113
  /**
192
- * Rollipop provides default options for Rolldown, but you can override them by this option.
114
+ * **WARNING** Rollipop provides default options for Rolldown, but you can override the final
115
+ * generated options with this config.
193
116
  *
194
- * **DANGEROUS**: This option is dangerous because it can break the build.
117
+ * Object values are merged after Rollipop's generated options. Function values
118
+ * receive the generated options and can return a replacement.
195
119
  */
196
- dangerously_overrideRolldownOptions?: RolldownConfig | ((config: RolldownConfig) => RolldownConfig) | ((config: RolldownConfig) => Promise<RolldownConfig>);
120
+ rolldownOptions?: RolldownOptionsConfig;
197
121
  }
198
- type PluginOption = MaybePromise<NullValue<Plugin> | {
122
+ export type PluginOption = MaybePromise<NullValue<Plugin> | {
199
123
  name: string;
200
124
  } | false | PluginOption[]>;
201
- type ResolverConfig = Omit<NonNullable<rolldown.InputOptions['resolve']>, 'alias' | 'extensions'> & {
125
+ export type ResolveConfig = Omit<NonNullable<rolldown.InputOptions['resolve']>, 'alias' | 'extensions'> & {
202
126
  /**
203
127
  * Substitute one package or module path for another.
204
128
  *
@@ -251,23 +175,13 @@ type ResolverConfig = Omit<NonNullable<rolldown.InputOptions['resolve']>, 'alias
251
175
  * Defaults to: `true`
252
176
  */
253
177
  preferNativePlatform?: boolean;
254
- /**
255
- * Specifies which modules should be treated as external and not bundled.
256
- *
257
- * External modules will be left as import statements in the output.
258
- */
259
- external?: rolldown.InputOptions['external'];
260
178
  };
261
- type AliasConfig = NonNullable<rolldown.InputOptions['resolve']>['alias'] | AliasEntry[];
262
- type TransformerConfig = Omit<TransformOptions, 'cwd' | 'lang' | 'sourceType' | 'plugins'> & {
179
+ export type AliasConfig = NonNullable<rolldown.InputOptions['resolve']>['alias'] | AliasEntry[];
180
+ export type TransformConfig = Omit<RolldownTransformOptions, 'cwd' | 'lang' | 'sourceType' | 'plugins'> & {
263
181
  /**
264
- * Flow specific configuration.
265
- *
266
- * Only applied when `experimental.nativeTransformPipeline` is **disabled** (the
267
- * default). With the native pipeline enabled, the rust-side plugin
268
- * handles Flow stripping internally.
182
+ * Flow handling configuration for the built-in transform pipeline.
269
183
  */
270
- flow?: FlowConfig;
184
+ flow?: RollipopReactNativeFlowConfig;
271
185
  /**
272
186
  * Babel transformation configuration.
273
187
  */
@@ -277,139 +191,50 @@ type TransformerConfig = Omit<TransformOptions, 'cwd' | 'lang' | 'sourceType' |
277
191
  */
278
192
  swc?: SwcTransformConfig;
279
193
  };
280
- type BabelTransformConfig = {
281
- rules?: TransformRule<babel.TransformOptions>[];
194
+ export type BabelTransformConfig = {
195
+ rules?: TransformRule<babel.InputOptions>[];
282
196
  };
283
- type SwcTransformConfig = {
197
+ export type SwcTransformConfig = {
198
+ native?: RollipopReactNativeSwcConfig;
284
199
  rules?: TransformRule<swc.Options>[];
285
200
  };
286
- interface TransformRule<T = unknown> {
201
+ export interface TransformRule<T = unknown> {
287
202
  filter?: rolldown.HookFilter | TopLevelFilterExpression[];
288
203
  options: T | ((code: string, id: string) => T);
289
- }
290
- interface FlowConfig {
291
204
  /**
292
- * Filter for Flow transformation pipeline.
205
+ * Transform independently in a filtered hook instead of merging options with other rules.
206
+ * Standalone rules run in declaration order before the merged rules.
207
+ * @default false
293
208
  */
294
- filter?: rolldown.HookFilter | TopLevelFilterExpression[];
209
+ standalone?: boolean;
295
210
  }
296
- interface ExperimentalConfig {
297
- /**
298
- * Enables the native (rust) transform pipeline, which replaces the
299
- * legacy JS-side codegen marker, Flow strip, and SWC/babel preset
300
- * machinery with a single built-in `rollipopReactNativePlugin`.
301
- *
302
- * This is a breaking change for projects that customised the legacy
303
- * pipeline via `transformer.flow.filter`, `reactNative.codegen.filter`,
304
- * or `runtimeTarget`. Opt in once you have validated builds locally.
305
- *
306
- * Defaults to `false`.
307
- */
308
- nativeTransformPipeline?: boolean;
309
- /**
310
- * Flow handling configuration for the native transform pipeline.
311
- *
312
- * Only applied when `experimental.nativeTransformPipeline` is enabled.
313
- */
314
- flow?: RollipopReactNativeFlowConfig;
211
+ export interface ExperimentalConfig extends RolldownExperimentalOptions {
315
212
  /**
316
213
  * `react-native-worklets` transformation configuration.
317
- *
318
- * Only applied when `experimental.nativeTransformPipeline` is enabled.
319
214
  */
320
215
  worklets?: RollipopReactNativeWorkletsConfig;
321
216
  }
322
- interface SerializerConfig {
323
- /**
324
- * Paths to prelude files.
325
- *
326
- * Prelude files are imported in the top of the entry module.
327
- */
328
- prelude?: string[];
329
- /**
330
- * Polyfills to include in the output bundle.
331
- *
332
- * Polyfills are injected in the top of the output bundle.
333
- */
334
- polyfills?: Polyfill[];
335
- /**
336
- * A string to prepend to the bundle before `renderChunk` hook.
337
- */
338
- banner?: rolldown.OutputOptions['banner'];
339
- /**
340
- * A string to append to the bundle before `renderChunk` hook.
341
- */
342
- footer?: rolldown.OutputOptions['footer'];
343
- /**
344
- * A string to prepend to the bundle after `renderChunk` hook and minification.
345
- */
346
- postBanner?: rolldown.OutputOptions['postBanner'];
347
- /**
348
- * A string to append to the bundle after `renderChunk` hook and minification.
349
- */
350
- postFooter?: rolldown.OutputOptions['postFooter'];
351
- /**
352
- * A string to prepend inside any format-specific wrapper.
353
- */
354
- intro?: rolldown.OutputOptions['intro'];
355
- /**
356
- * A string to append inside any format-specific wrapper.
357
- */
358
- outro?: rolldown.OutputOptions['outro'];
359
- /**
360
- * When `true`, creates shim variables for missing exports instead of throwing an error.
361
- *
362
- * Defaults to: `false`
363
- */
364
- shimMissingExports?: rolldown.InputOptions['shimMissingExports'];
365
- }
366
- type Polyfill = string | PolyfillWithCode | PolyfillWithPath;
367
- type PolyfillOptions = {
217
+ export interface OutputConfig extends Omit<rolldown.OutputOptions, RollipopManagedOutputOption> {}
218
+ export type Polyfill = string | PolyfillWithCode | PolyfillWithPath;
219
+ export type PolyfillOptions = {
368
220
  withTransform?: boolean;
369
221
  };
370
- type PolyfillWithCode = {
222
+ export type PolyfillWithCode = {
371
223
  type: PolyfillType;
372
224
  code: string;
373
225
  } & PolyfillOptions;
374
- type PolyfillWithPath = {
226
+ export type PolyfillWithPath = {
375
227
  type: PolyfillType;
376
228
  path: string;
377
229
  } & PolyfillOptions;
378
- type PolyfillType = 'plain' | 'iife';
379
- type OptimizationConfig = rolldown.OptimizationOptions & {
230
+ export type PolyfillType = 'plain' | 'iife';
231
+ export type OptimizationConfig = rolldown.OptimizationOptions;
232
+ export type WatcherConfig = DevWatchOptions;
233
+ export interface DevConfig {
380
234
  /**
381
- * Controls tree-shaking (dead code elimination).
382
- *
383
- * When `false`, tree-shaking will be disabled. When `true`, it is equivalent to setting each options to the default value.
384
- *
385
- * Defaults to: `true`
386
- */
387
- treeshake?: rolldown.InputOptions['treeshake'];
388
- /**
389
- * Control code minification.
390
- *
391
- * - `true`: Enable full minification including code compression and dead code elimination
392
- * - `false`: Disable minification (default)
393
- * - `'dce-only'`: Only perform dead code elimination without code compression
394
- * - `MinifyOptions`: Fine-grained control over minification settings
395
- *
396
- * Defaults to: `false`
397
- */
398
- minify?: rolldown.OutputOptions['minify'];
399
- /**
400
- * Control whether to enable lazy barrel optimization.
401
- *
402
- * Lazy barrel optimization avoids compiling unused re-export modules in side-effect-free barrel modules,
403
- * significantly improving build performance for large codebases with many barrel modules.
404
- *
405
- * Defaults to: `false`
406
- *
407
- * @see {@link https://rolldown.rs/in-depth/lazy-barrel-optimization | Lazy Barrel Documentation}
235
+ * Watcher configuration.
408
236
  */
409
- lazyBarrel?: RolldownExperimentalOptions['lazyBarrel'];
410
- };
411
- type WatcherConfig = DevWatchOptions;
412
- interface DevModeConfig {
237
+ watch?: WatcherConfig;
413
238
  /**
414
239
  * Hot Module Replacement configurations.
415
240
  * This feature is only available in `development` mode.
@@ -418,7 +243,7 @@ interface DevModeConfig {
418
243
  */
419
244
  hmr?: boolean | HmrConfig;
420
245
  }
421
- interface HmrConfig {
246
+ export interface HmrConfig {
422
247
  /**
423
248
  * Source code of the HMR runtime implementation.
424
249
  *
@@ -432,21 +257,13 @@ interface HmrConfig {
432
257
  */
433
258
  clientImplement?: string;
434
259
  }
435
- interface ReactNativeConfig {
260
+ export interface ReactNativeConfig {
436
261
  /**
437
262
  * Path to React Native package.
438
263
  *
439
264
  * Defaults to: resolving `react-native` package from `projectRoot`.
440
265
  */
441
266
  reactNativePath?: string;
442
- /**
443
- * Codegen specific configuration.
444
- *
445
- * Only applied when `experimental.nativeTransformPipeline` is **disabled** (the
446
- * default). With the native pipeline enabled, the rust-side plugin
447
- * handles codegen marking internally.
448
- */
449
- codegen?: CodegenConfig;
450
267
  /**
451
268
  * Path to asset registry file.
452
269
  *
@@ -460,13 +277,7 @@ interface ReactNativeConfig {
460
277
  */
461
278
  hmrClientPath?: string | ((root: string) => MaybePromise<string>);
462
279
  }
463
- interface CodegenConfig {
464
- /**
465
- * Filter for codegen transformation pipeline.
466
- */
467
- filter?: rolldown.HookFilter | TopLevelFilterExpression[];
468
- }
469
- interface AnalyzerConfig {
280
+ export interface AnalyzerConfig {
470
281
  /**
471
282
  * Whether to enable the bundle analyzer.
472
283
  *
@@ -493,21 +304,5 @@ interface AnalyzerConfig {
493
304
  */
494
305
  autoOpen?: boolean;
495
306
  }
496
- interface TerminalConfig {
497
- /**
498
- * Status of the terminal.
499
- *
500
- * Defaults to: `process.stderr.isTTY ? 'progress' : 'compat'`
501
- */
502
- status?: 'none' | 'compat' | 'progress';
503
- /**
504
- * Extra commands to display in the interactive mode.
505
- */
506
- extraCommands?: InteractiveCommand[];
507
- }
508
- interface RolldownConfig {
509
- input?: rolldown.InputOptions;
510
- output?: rolldown.OutputOptions;
511
- }
512
307
  //#endregion
513
- export { AliasConfig, AnalyzerConfig, BabelTransformConfig, CodegenConfig, Config, DevModeConfig, ExperimentalConfig, FlowConfig, HmrConfig, OptimizationConfig, PluginOption, Polyfill, PolyfillOptions, PolyfillType, PolyfillWithCode, PolyfillWithPath, ReactNativeConfig, ResolverConfig, RolldownConfig, type RollipopReactNativeFlowConfig, type RollipopReactNativeWorkletsConfig, SerializerConfig, SwcTransformConfig, TerminalConfig, TransformRule, TransformerConfig, WatcherConfig };
308
+ export type { RolldownOptions, RolldownOptionsConfig, RolldownOptionsContext, RolldownOptionsFunction, RollipopReactNativeFlowConfig, RollipopReactNativeSwcConfig, RollipopReactNativeWorkletsConfig };
@@ -1,5 +1,5 @@
1
1
  declare namespace constants_d_exports {
2
- export { DEFAULT_ANALYZE_FILE, DEFAULT_ANALYZE_REPORT_FILE, DEFAULT_ASSET_EXTENSIONS, DEFAULT_ASSET_REGISTRY_PATH, DEFAULT_ENV_FILE, DEFAULT_ENV_PREFIX, DEFAULT_HMR_CLIENT_PATH, DEFAULT_IMAGE_EXTENSIONS, DEFAULT_RESOLVER_ALIAS_FIELDS, DEFAULT_RESOLVER_CONDITION_NAMES, DEFAULT_RESOLVER_MAIN_FIELDS, DEFAULT_RUNTIME_TARGET, DEFAULT_SOURCE_EXTENSIONS, IMAGE_EXTENSIONS, ROLLIPOP_VERSION, ROLLIPOP_VIRTUAL_ENTRY_ID, ROLLIPOP_VIRTUAL_PREFIX };
2
+ export { DEFAULT_ANALYZE_FILE, DEFAULT_ANALYZE_REPORT_FILE, DEFAULT_ASSET_EXTENSIONS, DEFAULT_ASSET_REGISTRY_PATH, DEFAULT_ENV_FILE, DEFAULT_ENV_PREFIX, DEFAULT_HMR_CLIENT_PATH, DEFAULT_IMAGE_EXTENSIONS, DEFAULT_RESOLVER_ALIAS_FIELDS, DEFAULT_RESOLVER_CONDITION_NAMES, DEFAULT_RESOLVER_MAIN_FIELDS, DEFAULT_RUNTIME_TARGET, DEFAULT_SOURCE_EXTENSIONS, IMAGE_EXTENSIONS, ROLLIPOP_VERSION, ROLLIPOP_VIRTUAL_BOOTSTRAP_ID, ROLLIPOP_VIRTUAL_ENTRY_ID, ROLLIPOP_VIRTUAL_PREFIX };
3
3
  }
4
4
  /**
5
5
  * @see `vite.config.ts`
@@ -7,31 +7,32 @@ declare namespace constants_d_exports {
7
7
  declare global {
8
8
  var __ROLLIPOP_VERSION__: string;
9
9
  }
10
- declare const ROLLIPOP_VERSION: string;
11
- declare const ROLLIPOP_VIRTUAL_PREFIX = "\0rollipop/";
12
- declare const ROLLIPOP_VIRTUAL_ENTRY_ID = "\0rollipop/entry";
10
+ export declare const ROLLIPOP_VERSION: string;
11
+ export declare const ROLLIPOP_VIRTUAL_PREFIX = "\0rollipop/";
12
+ export declare const ROLLIPOP_VIRTUAL_BOOTSTRAP_ID = "\0rollipop/bootstrap";
13
+ export declare const ROLLIPOP_VIRTUAL_ENTRY_ID = "\0rollipop/entry";
13
14
  /**
14
15
  * @see {@link https://github.com/facebook/metro/blob/0.81.x/docs/Configuration.md#resolvermainfields}
15
16
  */
16
- declare const DEFAULT_RESOLVER_MAIN_FIELDS: string[];
17
- declare const DEFAULT_RESOLVER_ALIAS_FIELDS: string[][];
18
- declare const DEFAULT_RESOLVER_CONDITION_NAMES: string[];
17
+ export declare const DEFAULT_RESOLVER_MAIN_FIELDS: string[];
18
+ export declare const DEFAULT_RESOLVER_ALIAS_FIELDS: string[][];
19
+ export declare const DEFAULT_RESOLVER_CONDITION_NAMES: string[];
19
20
  /**
20
21
  * Unlike the Metro bundler configuration, this prioritizes resolving TypeScript and ESM first.
21
22
  *
22
23
  * @see {@link https://github.com/facebook/metro/blob/0.81.x/packages/metro-config/src/defaults/defaults.js}
23
24
  * @see {@link https://github.com/facebook/metro/blob/0.81.x/packages/metro-file-map/src/workerExclusionList.js}
24
25
  */
25
- declare const DEFAULT_SOURCE_EXTENSIONS: string[];
26
- declare const DEFAULT_IMAGE_EXTENSIONS: string[];
27
- declare const IMAGE_EXTENSIONS: string[];
28
- declare const DEFAULT_ASSET_EXTENSIONS: string[];
29
- declare const DEFAULT_ASSET_REGISTRY_PATH = "react-native/Libraries/Image/AssetRegistry.js";
30
- declare const DEFAULT_HMR_CLIENT_PATH = "react-native/Libraries/Utilities/HMRClient.js";
31
- declare const DEFAULT_ENV_PREFIX = "ROLLIPOP_";
32
- declare const DEFAULT_ENV_FILE = ".env";
33
- declare const DEFAULT_RUNTIME_TARGET = "hermes-v1";
34
- declare const DEFAULT_ANALYZE_FILE = "analyze-data.json";
35
- declare const DEFAULT_ANALYZE_REPORT_FILE = "report.html";
26
+ export declare const DEFAULT_SOURCE_EXTENSIONS: string[];
27
+ export declare const DEFAULT_IMAGE_EXTENSIONS: string[];
28
+ export declare const IMAGE_EXTENSIONS: string[];
29
+ export declare const DEFAULT_ASSET_EXTENSIONS: string[];
30
+ export declare const DEFAULT_ASSET_REGISTRY_PATH = "react-native/Libraries/Image/AssetRegistry.js";
31
+ export declare const DEFAULT_HMR_CLIENT_PATH = "react-native/Libraries/Utilities/HMRClient.js";
32
+ export declare const DEFAULT_ENV_PREFIX = "ROLLIPOP_";
33
+ export declare const DEFAULT_ENV_FILE = ".env";
34
+ export declare const DEFAULT_RUNTIME_TARGET = "hermes-v1";
35
+ export declare const DEFAULT_ANALYZE_FILE = "analyze-data.json";
36
+ export declare const DEFAULT_ANALYZE_REPORT_FILE = "report.html";
36
37
  //#endregion
37
38
  export { constants_d_exports };
package/dist/constants.js CHANGED
@@ -16,11 +16,13 @@ var constants_exports = /* @__PURE__ */ __exportAll({
16
16
  DEFAULT_SOURCE_EXTENSIONS: () => DEFAULT_SOURCE_EXTENSIONS,
17
17
  IMAGE_EXTENSIONS: () => IMAGE_EXTENSIONS,
18
18
  ROLLIPOP_VERSION: () => ROLLIPOP_VERSION,
19
+ ROLLIPOP_VIRTUAL_BOOTSTRAP_ID: () => ROLLIPOP_VIRTUAL_BOOTSTRAP_ID,
19
20
  ROLLIPOP_VIRTUAL_ENTRY_ID: () => ROLLIPOP_VIRTUAL_ENTRY_ID,
20
21
  ROLLIPOP_VIRTUAL_PREFIX: () => ROLLIPOP_VIRTUAL_PREFIX
21
22
  });
22
- const ROLLIPOP_VERSION = "1.0.0-alpha.28";
23
+ const ROLLIPOP_VERSION = "1.0.0-alpha.30";
23
24
  const ROLLIPOP_VIRTUAL_PREFIX = "\0rollipop/";
25
+ const ROLLIPOP_VIRTUAL_BOOTSTRAP_ID = `${ROLLIPOP_VIRTUAL_PREFIX}bootstrap`;
24
26
  const ROLLIPOP_VIRTUAL_ENTRY_ID = `${ROLLIPOP_VIRTUAL_PREFIX}entry`;
25
27
  /**
26
28
  * @see {@link https://github.com/facebook/metro/blob/0.81.x/docs/Configuration.md#resolvermainfields}
@@ -93,4 +95,4 @@ const DEFAULT_RUNTIME_TARGET = "hermes-v1";
93
95
  const DEFAULT_ANALYZE_FILE = "analyze-data.json";
94
96
  const DEFAULT_ANALYZE_REPORT_FILE = "report.html";
95
97
  //#endregion
96
- export { DEFAULT_ANALYZE_FILE, DEFAULT_ANALYZE_REPORT_FILE, DEFAULT_ASSET_EXTENSIONS, DEFAULT_ASSET_REGISTRY_PATH, DEFAULT_ENV_FILE, DEFAULT_ENV_PREFIX, DEFAULT_HMR_CLIENT_PATH, DEFAULT_RESOLVER_ALIAS_FIELDS, DEFAULT_RESOLVER_CONDITION_NAMES, DEFAULT_RESOLVER_MAIN_FIELDS, DEFAULT_RUNTIME_TARGET, DEFAULT_SOURCE_EXTENSIONS, IMAGE_EXTENSIONS, ROLLIPOP_VERSION, ROLLIPOP_VIRTUAL_ENTRY_ID, ROLLIPOP_VIRTUAL_PREFIX, constants_exports };
98
+ export { DEFAULT_ANALYZE_FILE, DEFAULT_ANALYZE_REPORT_FILE, DEFAULT_ASSET_EXTENSIONS, DEFAULT_ASSET_REGISTRY_PATH, DEFAULT_ENV_FILE, DEFAULT_ENV_PREFIX, DEFAULT_HMR_CLIENT_PATH, DEFAULT_IMAGE_EXTENSIONS, DEFAULT_RESOLVER_ALIAS_FIELDS, DEFAULT_RESOLVER_CONDITION_NAMES, DEFAULT_RESOLVER_MAIN_FIELDS, DEFAULT_RUNTIME_TARGET, DEFAULT_SOURCE_EXTENSIONS, IMAGE_EXTENSIONS, ROLLIPOP_VERSION, ROLLIPOP_VIRTUAL_BOOTSTRAP_ID, ROLLIPOP_VIRTUAL_ENTRY_ID, ROLLIPOP_VIRTUAL_PREFIX, constants_exports };
@@ -11,4 +11,4 @@ function getAnalyzeReportPath(projectRoot, bundlerId) {
11
11
  return path.join(getAnalyzeDirectory(projectRoot), `${bundlerId}.html`);
12
12
  }
13
13
  //#endregion
14
- export { getAnalyzeDataPath, getAnalyzeReportPath };
14
+ export { getAnalyzeDataPath, getAnalyzeDirectory, getAnalyzeReportPath };
@@ -6,18 +6,18 @@ declare namespace assets_d_exports {
6
6
  *
7
7
  * @see https://github.com/facebook/metro/blob/0.81.x/packages/metro/src/Assets.js
8
8
  */
9
- interface AssetContext {
9
+ export interface AssetContext {
10
10
  platform: string;
11
11
  preferNativePlatform: boolean;
12
12
  }
13
- interface AssetInfo {
13
+ export interface AssetInfo {
14
14
  files: string[];
15
15
  hash: string;
16
16
  name: string;
17
17
  scales: number[];
18
18
  type: string;
19
19
  }
20
- interface AssetDataWithoutFiles {
20
+ export interface AssetDataWithoutFiles {
21
21
  __packager_asset: boolean;
22
22
  fileSystemLocation: string;
23
23
  hash: string;
@@ -28,7 +28,7 @@ interface AssetDataWithoutFiles {
28
28
  width?: number;
29
29
  height?: number;
30
30
  }
31
- interface AssetDataFiltered {
31
+ export interface AssetDataFiltered {
32
32
  __packager_asset: boolean;
33
33
  hash: string;
34
34
  httpServerLocation: string;
@@ -38,21 +38,21 @@ interface AssetDataFiltered {
38
38
  width?: number;
39
39
  height?: number;
40
40
  }
41
- interface AssetData extends AssetDataWithoutFiles {
41
+ export interface AssetData extends AssetDataWithoutFiles {
42
42
  id: string;
43
43
  files: string[];
44
44
  }
45
- type AssetScale = number;
45
+ export type AssetScale = number;
46
46
  interface ResolveScaledAssetsOptions {
47
47
  projectRoot: string;
48
48
  assetPath: string;
49
49
  platform: string;
50
50
  preferNativePlatform: boolean;
51
51
  }
52
- declare function resolveScaledAssets(options: ResolveScaledAssetsOptions): Promise<AssetData>;
53
- declare function platformSuffixPattern(context: AssetContext): string;
54
- declare function stripSuffix(assetPath: string, context: AssetContext): string;
55
- declare function getAssetPriority(assetPath: string, context: AssetContext): 3 | 2 | 1 | 0;
52
+ export declare function resolveScaledAssets(options: ResolveScaledAssetsOptions): Promise<AssetData>;
53
+ export declare function platformSuffixPattern(context: AssetContext): string;
54
+ export declare function stripSuffix(assetPath: string, context: AssetContext): string;
55
+ export declare function getAssetPriority(assetPath: string, context: AssetContext): 0 | 1 | 2 | 3;
56
56
  interface GetSuffixedPathOptions {
57
57
  scale?: AssetScale;
58
58
  platform?: string;
@@ -74,8 +74,8 @@ interface GetSuffixedPathOptions {
74
74
  * '/path/to/assets/image@1x.android.png'
75
75
  * ```
76
76
  */
77
- declare function getSuffixedPath(assetPath: string, context: AssetContext, options: GetSuffixedPathOptions): string;
78
- declare function resolveAssetPath(assetPath: string, context: AssetContext, scale?: AssetScale): string;
77
+ export declare function getSuffixedPath(assetPath: string, context: AssetContext, options: GetSuffixedPathOptions): string;
78
+ export declare function resolveAssetPath(assetPath: string, context: AssetContext, scale?: AssetScale): string;
79
79
  interface CopyAssetsToDestinationOptions {
80
80
  assets: AssetData[];
81
81
  assetsDir: string;
@@ -85,8 +85,8 @@ interface CopyAssetsToDestinationOptions {
85
85
  /**
86
86
  * @see https://github.com/facebook/react-native/blob/0.83-stable/packages/community-cli-plugin/src/commands/bundle/assetPathUtils.js
87
87
  */
88
- declare function copyAssetsToDestination(options: CopyAssetsToDestinationOptions): Promise<undefined>;
89
- declare function filterPlatformAssetScales(platform: string, scales: readonly AssetScale[]): AssetScale[];
90
- declare function generateAssetRegistryCode(assetRegistryPath: string, asset: AssetData): string;
88
+ export declare function copyAssetsToDestination(options: CopyAssetsToDestinationOptions): Promise<undefined>;
89
+ export declare function filterPlatformAssetScales(platform: string, scales: readonly AssetScale[]): AssetScale[];
90
+ export declare function generateAssetRegistryCode(assetRegistryPath: string, asset: AssetData): string;
91
91
  //#endregion
92
92
  export { assets_d_exports };
@@ -79,7 +79,7 @@ async function resolveScaledAssets(options) {
79
79
  }
80
80
  function getHttpServerLocation(relativePath) {
81
81
  const dirname = path.dirname(relativePath);
82
- return normalizePathSeparatorsToPosix(relativePath.startsWith("..") ? `/${DEV_SERVER_ASSET_PATH}/${dirname}` : path.join("/", DEV_SERVER_ASSET_PATH, dirname));
82
+ return normalizePathSeparatorsToPosix(relativePath.startsWith("..") ? `/${DEV_SERVER_ASSET_PATH}/${encodeURIComponent(dirname)}` : path.join("/", DEV_SERVER_ASSET_PATH, dirname));
83
83
  }
84
84
  function normalizePathSeparatorsToPosix(filePath) {
85
85
  return filePath.replace(/\\/g, "/");
@@ -287,4 +287,4 @@ function generateAssetRegistryCode(assetRegistryPath, asset) {
287
287
  return `module.exports = require('${assetRegistryPath}').registerAsset(${JSON.stringify(registryAsset)});`;
288
288
  }
289
289
  //#endregion
290
- export { assets_exports, copyAssetsToDestination, generateAssetRegistryCode, resolveAssetPath, resolveScaledAssets };
290
+ export { assets_exports, copyAssetsToDestination, filterPlatformAssetScales, generateAssetRegistryCode, getAssetPriority, getSuffixedPath, platformSuffixPattern, resolveAssetPath, resolveScaledAssets, stripSuffix };
@@ -1,10 +1,9 @@
1
- import { BuildOptions, DevEngine, DevEngineOptions } from "./types.js";
2
1
  import { ResolvedBuildOptions } from "../utils/build-options.js";
2
+ import { BuildOptions, DevEngine, DevEngineOptions } from "./types.js";
3
3
  import { ResolvedConfig } from "../config/defaults.js";
4
4
  import * as rolldown from "@rollipop/rolldown";
5
-
6
5
  //#region src/core/bundler.d.ts
7
- declare class Bundler {
6
+ export declare class Bundler {
8
7
  private readonly config;
9
8
  static devEngine(config: ResolvedConfig, buildOptions: Omit<BuildOptions, 'dev' | 'outfile'>, devEngineOptions: DevEngineOptions): Promise<DevEngine>;
10
9
  static createId(config: ResolvedConfig, buildOptions: ResolvedBuildOptions): string;
@@ -12,5 +11,4 @@ declare class Bundler {
12
11
  constructor(config: ResolvedConfig);
13
12
  build(buildOptions: BuildOptions): Promise<rolldown.OutputChunk>;
14
13
  }
15
- //#endregion
16
- export { Bundler };
14
+ //#endregion