rollipop 1.0.0-alpha.27 → 1.0.0-alpha.29

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 (150) hide show
  1. package/client.d.ts +5 -1
  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 +0 -1
  7. package/dist/common/logger.js +1 -1
  8. package/dist/common/progress-bar.js +19 -8
  9. package/dist/config/compose-override.js +8 -10
  10. package/dist/config/defaults.d.ts +14 -18
  11. package/dist/config/defaults.js +20 -19
  12. package/dist/config/define-config.d.ts +0 -1
  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 +2 -3
  16. package/dist/config/load-config.js +3 -3
  17. package/dist/config/merge-config.d.ts +1 -2
  18. package/dist/config/merge-config.js +11 -6
  19. package/dist/config/notice.js +1 -1
  20. package/dist/config/types.d.ts +67 -190
  21. package/dist/constants.d.ts +3 -2
  22. package/dist/constants.js +4 -2
  23. package/dist/core/analyze.js +1 -1
  24. package/dist/core/assets.d.ts +1 -1
  25. package/dist/core/assets.js +2 -2
  26. package/dist/core/bundler.d.ts +1 -2
  27. package/dist/core/bundler.js +28 -17
  28. package/dist/core/env.d.ts +1 -0
  29. package/dist/core/plugins/alias-plugin.d.ts +12 -0
  30. package/dist/core/plugins/alias-plugin.js +8 -0
  31. package/dist/core/plugins/analyze-plugin.d.ts +2 -2
  32. package/dist/core/plugins/analyze-plugin.js +1 -1
  33. package/dist/core/plugins/babel-plugin.d.ts +5 -9
  34. package/dist/core/plugins/babel-plugin.js +15 -3
  35. package/dist/core/plugins/context.d.ts +1 -1
  36. package/dist/core/plugins/context.js +1 -1
  37. package/dist/core/plugins/dev-server-plugin.d.ts +13 -3
  38. package/dist/core/plugins/dev-server-plugin.js +65 -19
  39. package/dist/core/plugins/entry-plugin.d.ts +3 -3
  40. package/dist/core/plugins/entry-plugin.js +34 -6
  41. package/dist/core/plugins/import-glob-plugin.d.ts +10 -0
  42. package/dist/core/plugins/import-glob-plugin.js +7 -0
  43. package/dist/core/plugins/index.d.ts +11 -11
  44. package/dist/core/plugins/index.js +14 -8
  45. package/dist/core/plugins/react-native-plugin.d.ts +2 -3
  46. package/dist/core/plugins/react-native-plugin.js +1 -1
  47. package/dist/core/plugins/reporter-plugin.d.ts +3 -4
  48. package/dist/core/plugins/reporter-plugin.js +6 -6
  49. package/dist/core/plugins/swc-plugin.d.ts +5 -10
  50. package/dist/core/plugins/swc-plugin.js +1 -1
  51. package/dist/core/plugins/types.d.ts +3 -2
  52. package/dist/core/plugins/utils/transform-utils.js +1 -1
  53. package/dist/core/rolldown.d.ts +16 -0
  54. package/dist/core/rolldown.js +147 -100
  55. package/dist/core/settings.js +1 -1
  56. package/dist/core/types.d.ts +13 -3
  57. package/dist/events/builtin-reporters.js +125 -0
  58. package/dist/events/consumers.js +35 -0
  59. package/dist/events/event-bus.d.ts +10 -0
  60. package/dist/{server/events → events}/event-bus.js +2 -3
  61. package/dist/events/types.d.ts +94 -0
  62. package/dist/events/utils.js +6 -0
  63. package/dist/hmr-runtime.iife.js +436 -84
  64. package/dist/index.d.ts +18 -11
  65. package/dist/index.js +12 -5
  66. package/dist/internal/react-native.js +2 -5
  67. package/dist/node/cli-utils.d.ts +1 -2
  68. package/dist/node/cli-utils.js +2 -2
  69. package/dist/node/cli.d.ts +1 -1
  70. package/dist/node/cli.js +1 -1
  71. package/dist/node/commands/agent/index.js +2 -2
  72. package/dist/node/commands/bundle/action.js +3 -3
  73. package/dist/node/commands/bundle/command.js +4 -2
  74. package/dist/node/commands/bundle/index.js +2 -2
  75. package/dist/node/commands/skills/action.js +1 -1
  76. package/dist/node/commands/start/action.js +4 -5
  77. package/dist/node/commands/start/command.js +4 -2
  78. package/dist/node/commands/start/index.js +2 -2
  79. package/dist/node/commands/start/setup-interactive-mode.d.ts +1 -0
  80. package/dist/node/commands/start/setup-interactive-mode.js +1 -1
  81. package/dist/node/types.d.ts +1 -1
  82. package/dist/package.js +1 -1
  83. package/dist/{chunk-DJV587Yu.js → rolldown-runtime-CYsRbd_x.js} +1 -1
  84. package/dist/runtime.d.ts +2 -0
  85. package/dist/runtime.js +1 -1
  86. package/dist/server/bundle-url.js +16 -0
  87. package/dist/server/bundle.d.ts +0 -1
  88. package/dist/server/bundle.js +3 -3
  89. package/dist/server/bundler-pool.d.ts +11 -6
  90. package/dist/server/bundler-pool.js +55 -45
  91. package/dist/server/common/schema.js +0 -2
  92. package/dist/server/create-dev-server.js +28 -51
  93. package/dist/server/hot-update-store.d.ts +20 -0
  94. package/dist/server/hot-update-store.js +109 -0
  95. package/dist/server/index.d.ts +7 -2
  96. package/dist/server/index.js +8 -3
  97. package/dist/server/mcp/server.js +3 -12
  98. package/dist/server/mcp/tools/index.js +2 -2
  99. package/dist/server/middlewares/dashboard.js +2 -2
  100. package/dist/server/middlewares/serve-assets.js +5 -13
  101. package/dist/server/middlewares/serve-bundle.js +3 -3
  102. package/dist/server/middlewares/serve-hot-updates.js +25 -0
  103. package/dist/server/middlewares/sse.js +1 -1
  104. package/dist/server/middlewares/symbolicate.js +9 -1
  105. package/dist/server/rest/data.js +8 -4
  106. package/dist/server/rest/domains/actions.js +2 -2
  107. package/dist/server/rest/{serializers.js → formatters.js} +22 -11
  108. package/dist/server/rest/index.js +1 -1
  109. package/dist/server/sse/adapter.js +3 -6
  110. package/dist/server/sse/types.d.ts +45 -0
  111. package/dist/server/state/store.d.ts +4 -7
  112. package/dist/server/state/store.js +6 -5
  113. package/dist/server/types.d.ts +6 -5
  114. package/dist/server/wss/hmr-server.js +73 -48
  115. package/dist/server/wss/server.d.ts +1 -1
  116. package/dist/storage/file-storage.d.ts +2 -4
  117. package/dist/storage/file-storage.js +1 -1
  118. package/dist/types/hmr.d.ts +9 -5
  119. package/dist/types.d.ts +3 -65
  120. package/dist/utils/build-options.d.ts +2 -1
  121. package/dist/utils/config.d.ts +6 -2
  122. package/dist/utils/config.js +3 -3
  123. package/dist/utils/hash.js +0 -1
  124. package/dist/utils/id.js +19 -9
  125. package/dist/utils/reporters.js +1 -113
  126. package/dist/utils/reset-cache.d.ts +2 -3
  127. package/dist/utils/reset-cache.js +4 -19
  128. package/dist/utils/run-server.js +2 -3
  129. package/dist/utils/serialize.js +1 -0
  130. package/dist/utils/source-map.js +22 -0
  131. package/dist/utils/storage.js +1 -0
  132. package/dist/utils/string.js +36 -1
  133. package/dist/utils/terminal.js +1 -1
  134. package/dist/utils/url.js +1 -1
  135. package/import-glob.d.ts +129 -0
  136. package/package.json +27 -28
  137. package/skills/configuration.md +4 -4
  138. package/skills/core.md +2 -2
  139. package/skills/migration.md +1 -1
  140. package/skills/troubleshooting.md +3 -3
  141. package/src/runtime/__tests__/hmr-runtime.spec.ts +312 -0
  142. package/src/runtime/hmr-client.ts +130 -100
  143. package/src/runtime/hmr-runtime.ts +357 -53
  144. package/dist/server/create-dev-server.d.ts +0 -6
  145. package/dist/server/events/event-bus.d.ts +0 -12
  146. package/dist/server/events/types.d.ts +0 -37
  147. package/dist/server/events/types.js +0 -6
  148. package/dist/utils/run-build.d.ts +0 -8
  149. package/dist/utils/run-server.d.ts +0 -6
  150. package/src/runtime/runtime-utils.ts +0 -57
package/client.d.ts CHANGED
@@ -4,6 +4,10 @@ interface ImportMetaEnv {
4
4
  }
5
5
 
6
6
  interface ImportMeta {
7
- hot?: import('./dist').HMRContext;
7
+ glob: import('./import-glob').ImportGlobFunction;
8
8
  env: ImportMetaEnv;
9
+ /**
10
+ * Only available in development mode.
11
+ */
12
+ hot?: import('./dist').HMRContext;
9
13
  }
@@ -10,6 +10,6 @@ var __exportAll = (all, no_symbols) => {
10
10
  if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
11
11
  return target;
12
12
  };
13
- var __require = /* @__PURE__ */ createRequire(import.meta.url);
13
+ var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
14
14
  //#endregion
15
15
  export { __exportAll, __require };
package/dist/commands.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import { createReactNativeCliCommand } from "./node/cli-utils.js";
2
2
  import { command } from "./node/commands/agent/command.js";
3
3
  import "./node/commands/agent/index.js";
4
- import { command as command$1 } from "./node/commands/start/command.js";
5
- import "./node/commands/start/index.js";
6
- import { command as command$2 } from "./node/commands/bundle/command.js";
4
+ import { command as command$1 } from "./node/commands/bundle/command.js";
7
5
  import "./node/commands/bundle/index.js";
6
+ import { command as command$2 } from "./node/commands/start/command.js";
7
+ import "./node/commands/start/index.js";
8
8
  //#region src/commands.ts
9
9
  const commands = [
10
- createReactNativeCliCommand(command$1),
11
10
  createReactNativeCliCommand(command$2),
11
+ createReactNativeCliCommand(command$1),
12
12
  createReactNativeCliCommand(command)
13
13
  ];
14
14
  //#endregion
@@ -22,4 +22,4 @@ function iife(body) {
22
22
  `.replace(bodyPlaceholder, indent(body, 1, " ")).trim();
23
23
  }
24
24
  //#endregion
25
- export { asLiteral, iife, nodeEnvironment };
25
+ export { GLOBAL_OBJECT_EXPRESSION, asLiteral, iife, nodeEnvironment };
@@ -30,4 +30,4 @@ function isDebugEnabled() {
30
30
  return debugKeys[DEBUG_KEY] ?? false;
31
31
  }
32
32
  //#endregion
33
- export { isDebugEnabled };
33
+ export { isDebugEnabled, parseDebugKeys };
@@ -1,5 +1,4 @@
1
1
  import { ChalkInstance } from "chalk";
2
-
3
2
  //#region src/common/logger.d.ts
4
3
  declare class Logger {
5
4
  private readonly scope?;
@@ -1,7 +1,7 @@
1
1
  import { isDebugEnabled } from "./env.js";
2
- import { invariant } from "es-toolkit";
3
2
  import chalk from "chalk";
4
3
  import dayjs from "dayjs";
4
+ import { invariant } from "es-toolkit";
5
5
  //#region src/common/logger.ts
6
6
  var Logger = class Logger {
7
7
  scope;
@@ -1,6 +1,6 @@
1
1
  import { StreamManager, ellipsisLeft } from "../utils/terminal.js";
2
- import { range, throttle } from "es-toolkit";
3
2
  import chalk from "chalk";
3
+ import { range, throttle } from "es-toolkit";
4
4
  //#region src/common/progress-bar.ts
5
5
  const BAR_LENGTH = 25;
6
6
  const BLOCK_CHAR = "█";
@@ -36,15 +36,20 @@ const completedRenderer = { render(state, context) {
36
36
  const hmrCompletedRenderer = { render(state, context) {
37
37
  const icon = chalk.green("✔");
38
38
  const count = chalk.yellow(`(x${state.count})`);
39
- const moduleId = chalk.gray(ellipsisLeft(state.moduleId, context.columns - 4));
40
- return `${icon} HMR Updated ${chalk.gray(context.label)} ${count}\n ${moduleId}`;
39
+ const header = `${icon} HMR Updated ${chalk.gray(context.label)} ${count}`;
40
+ const modules = state.moduleIds.map((moduleId) => ` ${chalk.gray(ellipsisLeft(moduleId, context.columns - 4))}`).join("\n");
41
+ return modules === "" ? header : `${header}\n${modules}`;
42
+ } };
43
+ const hmrFailedRenderer = { render(_state, context) {
44
+ return `${chalk.red("✘")} HMR failed ${chalk.gray(context.label)}`;
41
45
  } };
42
46
  var ProgressBarRenderer = class {
43
47
  renderers = {
44
48
  idle: idleRenderer,
45
49
  running: runningRenderer,
46
50
  completed: completedRenderer,
47
- "hmr-completed": hmrCompletedRenderer
51
+ "hmr-completed": hmrCompletedRenderer,
52
+ "hmr-failed": hmrFailedRenderer
48
53
  };
49
54
  render(state, context) {
50
55
  return this.renderers[state.type].render(state, context);
@@ -64,7 +69,7 @@ var ProgressBar = class {
64
69
  this.renderer = options.renderer ?? new ProgressBarRenderer();
65
70
  }
66
71
  get done() {
67
- return this.state.type === "completed" || this.state.type === "hmr-completed";
72
+ return this.state.type === "completed" || this.state.type === "hmr-completed" || this.state.type === "hmr-failed";
68
73
  }
69
74
  setCurrent(current) {
70
75
  this.current = current;
@@ -99,15 +104,20 @@ var ProgressBar = class {
99
104
  this.stale = true;
100
105
  return this;
101
106
  }
102
- completeHmr(moduleId, count) {
107
+ completeHmr(moduleIds, count) {
103
108
  this.state = {
104
109
  type: "hmr-completed",
105
110
  count,
106
- moduleId
111
+ moduleIds
107
112
  };
108
113
  this.stale = true;
109
114
  return this;
110
115
  }
116
+ failHmr() {
117
+ this.state = { type: "hmr-failed" };
118
+ this.stale = true;
119
+ return this;
120
+ }
111
121
  render() {
112
122
  this.stale = false;
113
123
  const context = {
@@ -145,6 +155,7 @@ var ProgressBarRenderManager = class ProgressBarRenderManager {
145
155
  return progressBar;
146
156
  }
147
157
  start() {
158
+ this.throttledRender.cancel();
148
159
  console.log();
149
160
  this.streamManager.listen();
150
161
  this._render();
@@ -164,4 +175,4 @@ var ProgressBarRenderManager = class ProgressBarRenderManager {
164
175
  }
165
176
  };
166
177
  //#endregion
167
- export { ProgressBarRenderManager };
178
+ export { ProgressBar, ProgressBarRenderManager, ProgressBarRenderer };
@@ -1,18 +1,16 @@
1
1
  import { merge } from "es-toolkit";
2
2
  //#region src/config/compose-override.ts
3
- async function applyOverrideRolldownOptions(override, rolldownOptions) {
4
- if (typeof override === "function") return await override(rolldownOptions);
5
- return {
6
- input: merge(rolldownOptions.input ?? {}, override.input ?? {}),
7
- output: merge(rolldownOptions.output ?? {}, override.output ?? {})
8
- };
3
+ async function applyRolldownOptionsConfig(config, options, context) {
4
+ if (typeof config === "function") return await config(options, context);
5
+ return merge(options, config);
9
6
  }
10
- function composeOverrideRolldownOptions(target, source) {
7
+ function composeRolldownOptions(target, source) {
11
8
  if (source == null) return target;
12
9
  if (target == null) return source;
13
- return async (rolldownOptions) => {
14
- return await applyOverrideRolldownOptions(source, await applyOverrideRolldownOptions(target, rolldownOptions));
10
+ if (typeof target !== "function" && typeof source !== "function") return merge(target, source);
11
+ return async (options, context) => {
12
+ return await applyRolldownOptionsConfig(source, await applyRolldownOptionsConfig(target, options, context), context);
15
13
  };
16
14
  }
17
15
  //#endregion
18
- export { applyOverrideRolldownOptions, composeOverrideRolldownOptions };
16
+ export { applyRolldownOptionsConfig, composeRolldownOptions };
@@ -1,13 +1,12 @@
1
1
  import { Reporter } from "../types.js";
2
- import { AnalyzerConfig, Config, DevModeConfig, OptimizationConfig, Polyfill, ReactNativeConfig } from "./types.js";
2
+ import { AnalyzerConfig, Config, DevConfig, Polyfill, ReactNativeConfig } from "./types.js";
3
3
  import { PluginFlattenConfig } from "./merge-config.js";
4
-
5
4
  //#region src/config/defaults.d.ts
6
5
  declare function getDefaultConfig(projectRoot: string, mode?: Config['mode']): Promise<{
7
6
  root: string;
8
7
  mode: "development" | "production";
9
8
  entry: string;
10
- resolver: {
9
+ resolve: {
11
10
  sourceExtensions: string[];
12
11
  assetExtensions: string[];
13
12
  mainFields: string[];
@@ -16,7 +15,7 @@ declare function getDefaultConfig(projectRoot: string, mode?: Config['mode']): P
16
15
  preferNativePlatform: true;
17
16
  symlinks: true;
18
17
  };
19
- transformer: {
18
+ transform: {
20
19
  flow: {
21
20
  filter: {
22
21
  id: RegExp;
@@ -24,18 +23,10 @@ declare function getDefaultConfig(projectRoot: string, mode?: Config['mode']): P
24
23
  };
25
24
  };
26
25
  };
27
- serializer: {
28
- prelude: string[];
29
- polyfills: Polyfill[];
30
- };
31
- watcher: {
32
- skipWrite: true;
33
- useDebounce: true;
34
- debounceDuration: number;
35
- };
36
- optimization: {
37
- treeshake: NonNullable<OptimizationConfig["treeshake"]>;
38
- };
26
+ prelude: string[];
27
+ polyfills: Polyfill[];
28
+ output: {};
29
+ treeshake: NonNullable<Config["treeshake"]>;
39
30
  reactNative: {
40
31
  reactNativePath: string;
41
32
  codegen: {
@@ -49,8 +40,13 @@ declare function getDefaultConfig(projectRoot: string, mode?: Config['mode']): P
49
40
  assetRegistryPath: NonNullable<NonNullable<ReactNativeConfig>["assetRegistryPath"]>;
50
41
  hmrClientPath: NonNullable<NonNullable<ReactNativeConfig>["hmrClientPath"]>;
51
42
  };
52
- devMode: {
53
- hmr: NonNullable<DevModeConfig["hmr"]>;
43
+ dev: {
44
+ watch: {
45
+ skipWrite: true;
46
+ useDebounce: true;
47
+ debounceDuration: number;
48
+ };
49
+ hmr: NonNullable<DevConfig["hmr"]>;
54
50
  };
55
51
  reporter: Reporter;
56
52
  analyzer: Required<AnalyzerConfig>;
@@ -1,9 +1,9 @@
1
1
  import { isDebugEnabled } from "../common/env.js";
2
2
  import { stripFlowTypes } from "../common/transformer.js";
3
3
  import { 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 } from "../constants.js";
4
+ import { ClientLogReporter } from "../events/builtin-reporters.js";
4
5
  import { getInitializeCorePath, getPolyfillScriptPaths } from "../internal/react-native.js";
5
6
  import { resolvePackagePath } from "../utils/node-resolve.js";
6
- import { ClientLogReporter } from "../utils/reporters.js";
7
7
  import fs from "node:fs";
8
8
  //#region src/config/defaults.ts
9
9
  async function getDefaultConfig(projectRoot, mode) {
@@ -17,7 +17,7 @@ async function getDefaultConfig(projectRoot, mode) {
17
17
  root: projectRoot,
18
18
  mode: mode ?? "development",
19
19
  entry: "index.js",
20
- resolver: {
20
+ resolve: {
21
21
  sourceExtensions: DEFAULT_SOURCE_EXTENSIONS,
22
22
  assetExtensions: DEFAULT_ASSET_EXTENSIONS,
23
23
  mainFields: DEFAULT_RESOLVER_MAIN_FIELDS,
@@ -26,25 +26,19 @@ async function getDefaultConfig(projectRoot, mode) {
26
26
  preferNativePlatform: true,
27
27
  symlinks: true
28
28
  },
29
- transformer: { flow: { filter: {
29
+ transform: { flow: { filter: {
30
30
  id: /\.jsx?$/,
31
31
  code: /@flow/
32
32
  } } },
33
- serializer: {
34
- prelude: [getInitializeCorePath(projectRoot)],
35
- polyfills: await Promise.all(getPolyfillScriptPaths(reactNativePath).map(async (path) => {
36
- return {
37
- type: "iife",
38
- code: (await stripFlowTypes(path, fs.readFileSync(path, "utf-8"))).code
39
- };
40
- }))
41
- },
42
- watcher: {
43
- skipWrite: true,
44
- useDebounce: true,
45
- debounceDuration: 50
46
- },
47
- optimization: { treeshake: true },
33
+ prelude: [getInitializeCorePath(projectRoot)],
34
+ polyfills: await Promise.all(getPolyfillScriptPaths(reactNativePath).map(async (path) => {
35
+ return {
36
+ type: "iife",
37
+ code: (await stripFlowTypes(path, fs.readFileSync(path, "utf-8"))).code
38
+ };
39
+ })),
40
+ output: {},
41
+ treeshake: true,
48
42
  reactNative: {
49
43
  reactNativePath,
50
44
  codegen: {
@@ -55,7 +49,14 @@ filter: { code: /\bcodegenNativeComponent</ } },
55
49
  assetRegistryPath: DEFAULT_ASSET_REGISTRY_PATH,
56
50
  hmrClientPath: DEFAULT_HMR_CLIENT_PATH
57
51
  },
58
- devMode: { hmr: true },
52
+ dev: {
53
+ watch: {
54
+ skipWrite: true,
55
+ useDebounce: true,
56
+ debounceDuration: 50
57
+ },
58
+ hmr: true
59
+ },
59
60
  reporter: new ClientLogReporter(),
60
61
  analyzer: {
61
62
  enabled: false,
@@ -1,6 +1,5 @@
1
1
  import { Config } from "./types.js";
2
2
  import { DefaultConfig } from "./defaults.js";
3
-
4
3
  //#region src/config/define-config.d.ts
5
4
  interface DefineConfigContext {
6
5
  command?: string;
@@ -1,5 +1,7 @@
1
- import { AnalyzerConfig, BabelTransformConfig, CodegenConfig, Config, DevModeConfig, ExperimentalConfig, FlowConfig, HmrConfig, OptimizationConfig, PluginOption, Polyfill, PolyfillOptions, PolyfillType, PolyfillWithCode, PolyfillWithPath, ReactNativeConfig, ResolverConfig, RolldownConfig, RollipopReactNativeFlowConfig, RollipopReactNativeWorkletsConfig, SerializerConfig, SwcTransformConfig, TerminalConfig, TransformRule, TransformerConfig, WatcherConfig } from "./types.js";
1
+ import { RolldownOptions, RolldownOptionsConfig, RolldownOptionsContext, RolldownOptionsFunction } from "../core/rolldown.js";
2
+ import { AliasConfig, AnalyzerConfig, BabelTransformConfig, CodegenConfig, Config, DevConfig, ExperimentalConfig, FlowConfig, HmrConfig, OptimizationConfig, OutputConfig, PluginOption, Polyfill, PolyfillOptions, PolyfillType, PolyfillWithCode, PolyfillWithPath, ReactNativeConfig, ResolveConfig, RollipopReactNativeFlowConfig, RollipopReactNativeWorkletsConfig, SwcTransformConfig, TerminalConfig, TransformConfig, TransformRule, WatcherConfig } from "./types.js";
3
+ import { DefineConfigContext, DynamicUserConfig, UserConfig, defineConfig } from "./define-config.js";
4
+ import { LoadConfigOptions, flattenPluginOption, invokeConfigResolved, loadConfig, resolvePluginConfig } from "./load-config.js";
2
5
  import { PluginFlattenConfig, mergeConfig } from "./merge-config.js";
3
6
  import { DefaultConfig, InternalConfig, ResolvedConfig, getDefaultConfig } from "./defaults.js";
4
- import { DefineConfigContext, DynamicUserConfig, UserConfig, defineConfig } from "./define-config.js";
5
- import { LoadConfigOptions, flattenPluginOption, invokeConfigResolved, loadConfig, resolvePluginConfig } from "./load-config.js";
7
+ export { type AliasConfig, type AnalyzerConfig, type BabelTransformConfig, type CodegenConfig, type Config, DefaultConfig, DefineConfigContext, type DevConfig, DynamicUserConfig, type ExperimentalConfig, type FlowConfig, type HmrConfig, InternalConfig, LoadConfigOptions, type OptimizationConfig, type OutputConfig, PluginFlattenConfig, type PluginOption, type Polyfill, type PolyfillOptions, type PolyfillType, type PolyfillWithCode, type PolyfillWithPath, type ReactNativeConfig, type ResolveConfig, ResolvedConfig, type RolldownOptions, type RolldownOptionsConfig, type RolldownOptionsContext, type RolldownOptionsFunction, type RollipopReactNativeFlowConfig, type RollipopReactNativeWorkletsConfig, type SwcTransformConfig, type TerminalConfig, type TransformConfig, type TransformRule, UserConfig, type WatcherConfig, defineConfig, flattenPluginOption, getDefaultConfig, invokeConfigResolved, loadConfig, mergeConfig, resolvePluginConfig };
@@ -1,5 +1,5 @@
1
- import "./defaults.js";
2
- import "./define-config.js";
3
- import "./merge-config.js";
4
- import "./load-config.js";
5
- export {};
1
+ import { getDefaultConfig } from "./defaults.js";
2
+ import { defineConfig } from "./define-config.js";
3
+ import { mergeConfig } from "./merge-config.js";
4
+ import { flattenPluginOption, invokeConfigResolved, loadConfig, resolvePluginConfig } from "./load-config.js";
5
+ export { defineConfig, flattenPluginOption, getDefaultConfig, invokeConfigResolved, loadConfig, mergeConfig, resolvePluginConfig };
@@ -1,8 +1,7 @@
1
- import { Plugin, PluginConfig, ResolvedPluginConfig } from "../core/plugins/types.js";
2
1
  import { Config, PluginOption } from "./types.js";
3
- import { ResolvedConfig } from "./defaults.js";
4
2
  import { DefineConfigContext } from "./define-config.js";
5
-
3
+ import { Plugin, PluginConfig, ResolvedPluginConfig } from "../core/plugins/types.js";
4
+ import { ResolvedConfig } from "./defaults.js";
6
5
  //#region src/config/load-config.d.ts
7
6
  interface LoadConfigOptions {
8
7
  cwd?: string;
@@ -57,13 +57,13 @@ async function resolvePluginConfig(baseConfig, plugins) {
57
57
  let mergedConfig = omit(baseConfig, ["plugins"]);
58
58
  for (const plugin of plugins) {
59
59
  const context = createPluginContext(plugin.name);
60
- const overrideBefore = mergedConfig.dangerously_overrideRolldownOptions;
60
+ const rolldownOptionsBefore = mergedConfig.rolldownOptions;
61
61
  if (typeof plugin.config === "function") {
62
62
  const config = await plugin.config.call(context, mergedConfig);
63
63
  if (config != null) mergedConfig = mergeConfig(mergedConfig, config);
64
64
  } else if (typeof plugin.config === "object") mergedConfig = mergeConfig(mergedConfig, plugin.config);
65
- const overrideAfter = mergedConfig.dangerously_overrideRolldownOptions;
66
- if (overrideAfter != null && overrideAfter !== overrideBefore) context.debug({ message: `set 'dangerously_overrideRolldownOptions'` });
65
+ const rolldownOptionsAfter = mergedConfig.rolldownOptions;
66
+ if (rolldownOptionsAfter != null && rolldownOptionsAfter !== rolldownOptionsBefore) context.debug({ message: `set 'rolldownOptions'` });
67
67
  }
68
68
  return mergedConfig;
69
69
  }
@@ -1,7 +1,6 @@
1
- import { Plugin } from "../core/plugins/types.js";
2
1
  import { Config } from "./types.js";
2
+ import { Plugin } from "../core/plugins/types.js";
3
3
  import { DefaultConfig, ResolvedConfig } from "./defaults.js";
4
-
5
4
  //#region src/config/merge-config.d.ts
6
5
  type PluginFlattenConfig = Omit<Config, 'plugins'> & {
7
6
  plugins?: Plugin[];
@@ -1,5 +1,6 @@
1
- import { composeOverrideRolldownOptions } from "./compose-override.js";
2
- import { mergeWith } from "es-toolkit";
1
+ import { mergeReporters } from "../utils/reporters.js";
2
+ import { composeRolldownOptions } from "./compose-override.js";
3
+ import { isNotNil, mergeWith } from "es-toolkit";
3
4
  //#region src/config/merge-config.ts
4
5
  function mergeConfig(baseConfig, ...overrideConfigs) {
5
6
  let mergedConfig = baseConfig;
@@ -7,12 +8,16 @@ function mergeConfig(baseConfig, ...overrideConfigs) {
7
8
  if ([
8
9
  "sourceExtensions",
9
10
  "assetExtensions",
10
- "polyfills",
11
11
  "prelude",
12
+ "polyfills",
12
13
  "plugins"
13
- ].includes(key)) return Array.from(new Set([...target ?? [], ...source ?? []]));
14
- if (key === "reporter") return source ?? target;
15
- if (key === "dangerously_overrideRolldownOptions") return composeOverrideRolldownOptions(target, source);
14
+ ].includes(key)) return Array.from(/* @__PURE__ */ new Set([...target ?? [], ...source ?? []]));
15
+ if (key === "reporter") {
16
+ if (target === source) return target;
17
+ const reporters = [target, source].filter(isNotNil);
18
+ return reporters.length > 0 ? mergeReporters(reporters) : void 0;
19
+ }
20
+ if (key === "rolldownOptions") return composeRolldownOptions(target, source);
16
21
  });
17
22
  return mergedConfig;
18
23
  }
@@ -1,7 +1,7 @@
1
1
  import { logger } from "../logger.js";
2
2
  //#region src/config/notice.ts
3
3
  function printConfigNotice(config) {
4
- if (config.transformer.reactCompiler != null) logger.info("✨ React Compiler is enabled");
4
+ if (typeof config.transform.jsx === "object" && config.transform.jsx.compiler != null) logger.info("✨ React Compiler is enabled");
5
5
  }
6
6
  //#endregion
7
7
  export { printConfigNotice };