rollipop 1.0.0-alpha.29 → 1.0.0-alpha.31

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 (132) hide show
  1. package/bin/index.js +7 -2
  2. package/dist/common/logger.d.ts +7 -4
  3. package/dist/common/logger.js +5 -3
  4. package/dist/common/progress-bar.js +7 -1
  5. package/dist/config/compose-override.js +3 -3
  6. package/dist/config/defaults.d.ts +15 -35
  7. package/dist/config/defaults.js +6 -18
  8. package/dist/config/define-config.d.ts +5 -6
  9. package/dist/config/index.d.ts +2 -2
  10. package/dist/config/load-config.d.ts +7 -8
  11. package/dist/config/load-config.js +2 -1
  12. package/dist/config/merge-config.d.ts +4 -5
  13. package/dist/config/types.d.ts +32 -81
  14. package/dist/constants.d.ts +19 -19
  15. package/dist/constants.js +1 -1
  16. package/dist/core/assets.d.ts +16 -16
  17. package/dist/core/bundler.d.ts +2 -3
  18. package/dist/core/bundler.js +6 -8
  19. package/dist/core/env.d.ts +3 -4
  20. package/dist/core/plugins/alias-plugin.d.ts +3 -3
  21. package/dist/core/plugins/analyze-plugin.d.ts +2 -2
  22. package/dist/core/plugins/babel-plugin.d.ts +3 -9
  23. package/dist/core/plugins/babel-plugin.js +54 -61
  24. package/dist/core/plugins/context.d.ts +2 -3
  25. package/dist/core/plugins/dev-server-plugin.d.ts +5 -5
  26. package/dist/core/plugins/dev-server-plugin.js +2 -1
  27. package/dist/core/plugins/entry-plugin.d.ts +2 -2
  28. package/dist/core/plugins/import-glob-plugin.d.ts +2 -2
  29. package/dist/core/plugins/index.d.ts +3 -2
  30. package/dist/core/plugins/index.js +3 -1
  31. package/dist/core/plugins/react-native-plugin.d.ts +4 -20
  32. package/dist/core/plugins/react-native-plugin.js +3 -36
  33. package/dist/core/plugins/reporter-plugin.d.ts +2 -2
  34. package/dist/core/plugins/resolution-topology-plugin.d.ts +11 -0
  35. package/dist/core/plugins/resolution-topology-plugin.js +318 -0
  36. package/dist/core/plugins/shared/filters.js +16 -3
  37. package/dist/core/plugins/swc-plugin.d.ts +3 -12
  38. package/dist/core/plugins/swc-plugin.js +44 -65
  39. package/dist/core/plugins/types.d.ts +17 -5
  40. package/dist/core/plugins/utils/transform-utils.js +2 -4
  41. package/dist/core/rolldown.d.ts +5 -6
  42. package/dist/core/rolldown.js +30 -31
  43. package/dist/core/settings.js +3 -2
  44. package/dist/core/types.d.ts +9 -9
  45. package/dist/events/builtin-reporters.js +10 -3
  46. package/dist/events/consumers.js +1 -3
  47. package/dist/events/event-bus.d.ts +3 -4
  48. package/dist/events/types.d.ts +3 -4
  49. package/dist/hmr-runtime.iife.js +162 -27
  50. package/dist/index.d.ts +6 -7
  51. package/dist/internal/react-native.js +2 -1
  52. package/dist/node/cli-utils.d.ts +3 -3
  53. package/dist/node/cli.d.ts +2 -2
  54. package/dist/node/commands/agent/action.js +11 -30
  55. package/dist/node/commands/start/action.js +10 -6
  56. package/dist/node/commands/start/command.js +0 -4
  57. package/dist/node/commands/start/debugger.js +2 -2
  58. package/dist/node/commands/start/setup-interactive-mode.d.ts +6 -7
  59. package/dist/node/commands/start/setup-interactive-mode.js +4 -4
  60. package/dist/node/types.d.ts +6 -7
  61. package/dist/package.js +1 -1
  62. package/dist/{rolldown-runtime-CYsRbd_x.js → rolldown-runtime-BHXq-rbM.js} +3 -3
  63. package/dist/runtime.d.ts +1 -1
  64. package/dist/runtime.js +1 -1
  65. package/dist/server/bundle.d.ts +2 -3
  66. package/dist/server/bundle.js +7 -2
  67. package/dist/server/bundler-pool.d.ts +9 -10
  68. package/dist/server/bundler-pool.js +35 -15
  69. package/dist/server/constants.d.ts +4 -5
  70. package/dist/server/create-dev-server.js +22 -17
  71. package/dist/server/{mcp → devframe/agent}/context.js +3 -3
  72. package/dist/server/{mcp → devframe/agent}/tools/app-log-diagnostics.js +1 -1
  73. package/dist/server/{mcp → devframe/agent}/tools/build-diagnostics.js +7 -9
  74. package/dist/server/devframe/agent/tools/build-info.js +11 -0
  75. package/dist/server/{mcp → devframe/agent}/tools/client-diagnostics.js +1 -1
  76. package/dist/server/{mcp → devframe/agent}/tools/index.js +51 -74
  77. package/dist/server/{rest → devframe}/data.js +2 -6
  78. package/dist/server/{rest → devframe}/devtools-targets.js +1 -1
  79. package/dist/server/{sse/adapter.js → devframe/events.js} +5 -13
  80. package/dist/server/{rest → devframe}/formatters.js +1 -1
  81. package/dist/server/devframe/index.js +218 -0
  82. package/dist/server/devframe/setup.js +98 -0
  83. package/dist/server/hot-update-store.d.ts +3 -4
  84. package/dist/server/index.d.ts +2 -3
  85. package/dist/server/middlewares/dashboard.js +2 -1
  86. package/dist/server/middlewares/serve-bundle.js +1 -1
  87. package/dist/server/state/store.d.ts +8 -9
  88. package/dist/server/state/store.js +2 -6
  89. package/dist/server/types.d.ts +9 -11
  90. package/dist/server/wss/hmr-server.js +2 -7
  91. package/dist/server/wss/server.d.ts +2 -3
  92. package/dist/storage/file-storage.d.ts +3 -4
  93. package/dist/storage/file-storage.js +3 -3
  94. package/dist/types/hmr.d.ts +8 -9
  95. package/dist/types.d.ts +16 -6
  96. package/dist/utils/babel.js +2 -2
  97. package/dist/utils/build-options.d.ts +5 -6
  98. package/dist/utils/build-options.js +8 -7
  99. package/dist/utils/config.d.ts +2 -3
  100. package/dist/utils/dev-server.js +0 -1
  101. package/dist/utils/reset-cache.d.ts +2 -3
  102. package/dist/utils/run-server.js +1 -6
  103. package/dist/utils/server.js +6 -1
  104. package/dist/utils/swc.js +2 -2
  105. package/dist/utils/transform.js +5 -2
  106. package/package.json +39 -29
  107. package/skills/configuration.md +1 -1
  108. package/skills/core.md +1 -1
  109. package/skills/debugging.md +2 -6
  110. package/skills/dev-server.md +2 -6
  111. package/skills/troubleshooting.md +1 -1
  112. package/src/runtime/__tests__/hmr-runtime.spec.ts +403 -5
  113. package/src/runtime/hmr-client.ts +24 -10
  114. package/src/runtime/hmr-runtime.ts +34 -11
  115. package/src/runtime/react-native-core.d.ts +0 -11
  116. package/dist/core/plugins/utils/source.js +0 -10
  117. package/dist/server/mcp/server.js +0 -77
  118. package/dist/server/mcp/tools/build-info.js +0 -11
  119. package/dist/server/middlewares/sse.js +0 -36
  120. package/dist/server/rest/domains/actions.js +0 -24
  121. package/dist/server/rest/domains/builds.js +0 -37
  122. package/dist/server/rest/domains/bundlers.js +0 -30
  123. package/dist/server/rest/domains/config.js +0 -14
  124. package/dist/server/rest/domains/dev-server.js +0 -14
  125. package/dist/server/rest/domains/devices.js +0 -20
  126. package/dist/server/rest/domains/feature-flags.js +0 -14
  127. package/dist/server/rest/domains/snapshot.js +0 -14
  128. package/dist/server/rest/index.js +0 -56
  129. package/dist/server/rest/response.js +0 -9
  130. package/dist/server/sse/event-bus.js +0 -26
  131. package/dist/server/sse/types.d.ts +0 -45
  132. package/dist/utils/promise.js +0 -15
package/bin/index.js CHANGED
@@ -1,5 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { cli } from '../dist/index.js';
3
+ import module from 'node:module';
4
4
 
5
- cli.run(process.argv);
5
+ if (typeof module.enableCompileCache === 'function') {
6
+ // Available in Node.js >=22.8.0
7
+ module.enableCompileCache();
8
+ }
9
+
10
+ (await import('../dist/index.js')).cli.run(process.argv);
@@ -1,7 +1,11 @@
1
1
  import { ChalkInstance } from "chalk";
2
2
  //#region src/common/logger.d.ts
3
- declare class Logger {
3
+ export interface LoggerOptions {
4
+ forcePrint?: boolean;
5
+ }
6
+ export declare class Logger {
4
7
  private readonly scope?;
8
+ private readonly options?;
5
9
  private static blocked;
6
10
  private static queuedMessages;
7
11
  static Colors: {
@@ -16,7 +20,7 @@ declare class Logger {
16
20
  private debugEnabled;
17
21
  static block(): void;
18
22
  static unblock(flush?: boolean): void;
19
- constructor(scope?: string | undefined);
23
+ constructor(scope?: string | undefined, options?: LoggerOptions | undefined);
20
24
  getFormat(): string;
21
25
  setFormat(format: string): void;
22
26
  private getTimestamp;
@@ -29,5 +33,4 @@ declare class Logger {
29
33
  error(...args: unknown[]): void;
30
34
  child(scope: string): Logger;
31
35
  }
32
- //#endregion
33
- export { Logger };
36
+ //#endregion
@@ -5,6 +5,7 @@ import { invariant } from "es-toolkit";
5
5
  //#region src/common/logger.ts
6
6
  var Logger = class Logger {
7
7
  scope;
8
+ options;
8
9
  static blocked = false;
9
10
  static queuedMessages = [];
10
11
  static Colors = {
@@ -25,8 +26,9 @@ var Logger = class Logger {
25
26
  if (flush) for (const args of Logger.queuedMessages) console.log(...args);
26
27
  Logger.queuedMessages.length = 0;
27
28
  }
28
- constructor(scope) {
29
+ constructor(scope, options) {
29
30
  this.scope = scope;
31
+ this.options = options;
30
32
  this.debugEnabled = isDebugEnabled();
31
33
  }
32
34
  getFormat() {
@@ -56,10 +58,10 @@ var Logger = class Logger {
56
58
  else console.log(...args);
57
59
  }
58
60
  trace(...args) {
59
- this.debugEnabled && this.print("trace", ...args);
61
+ (this.options?.forcePrint || this.debugEnabled) && this.print("trace", ...args);
60
62
  }
61
63
  debug(...args) {
62
- this.debugEnabled && this.print("debug", ...args);
64
+ (this.options?.forcePrint || this.debugEnabled) && this.print("debug", ...args);
63
65
  }
64
66
  log(...args) {
65
67
  this.print("log", ...args);
@@ -46,6 +46,7 @@ const hmrFailedRenderer = { render(_state, context) {
46
46
  var ProgressBarRenderer = class {
47
47
  renderers = {
48
48
  idle: idleRenderer,
49
+ cancelled: { render: () => "" },
49
50
  running: runningRenderer,
50
51
  completed: completedRenderer,
51
52
  "hmr-completed": hmrCompletedRenderer,
@@ -69,7 +70,7 @@ var ProgressBar = class {
69
70
  this.renderer = options.renderer ?? new ProgressBarRenderer();
70
71
  }
71
72
  get done() {
72
- return this.state.type === "completed" || this.state.type === "hmr-completed" || this.state.type === "hmr-failed";
73
+ return this.state.type === "cancelled" || this.state.type === "completed" || this.state.type === "hmr-completed" || this.state.type === "hmr-failed";
73
74
  }
74
75
  setCurrent(current) {
75
76
  this.current = current;
@@ -86,6 +87,11 @@ var ProgressBar = class {
86
87
  this.stale = true;
87
88
  return this;
88
89
  }
90
+ cancel() {
91
+ this.state = { type: "cancelled" };
92
+ this.stale = true;
93
+ return this;
94
+ }
89
95
  setModuleId(moduleId) {
90
96
  if (this.state.type !== "running") return this;
91
97
  this.state = {
@@ -1,13 +1,13 @@
1
- import { merge } from "es-toolkit";
1
+ import { toMerged } from "es-toolkit";
2
2
  //#region src/config/compose-override.ts
3
3
  async function applyRolldownOptionsConfig(config, options, context) {
4
4
  if (typeof config === "function") return await config(options, context);
5
- return merge(options, config);
5
+ return toMerged(options, config);
6
6
  }
7
7
  function composeRolldownOptions(target, source) {
8
8
  if (source == null) return target;
9
9
  if (target == null) return source;
10
- if (typeof target !== "function" && typeof source !== "function") return merge(target, source);
10
+ if (typeof target !== "function" && typeof source !== "function") return toMerged(target, source);
11
11
  return async (options, context) => {
12
12
  return await applyRolldownOptionsConfig(source, await applyRolldownOptionsConfig(target, options, context), context);
13
13
  };
@@ -2,7 +2,7 @@ import { Reporter } from "../types.js";
2
2
  import { AnalyzerConfig, Config, DevConfig, Polyfill, ReactNativeConfig } from "./types.js";
3
3
  import { PluginFlattenConfig } from "./merge-config.js";
4
4
  //#region src/config/defaults.d.ts
5
- declare function getDefaultConfig(projectRoot: string, mode?: Config['mode']): Promise<{
5
+ export declare function getDefaultConfig(projectRoot: string, mode?: Config['mode']): Promise<{
6
6
  root: string;
7
7
  mode: "development" | "production";
8
8
  entry: string;
@@ -15,59 +15,39 @@ declare function getDefaultConfig(projectRoot: string, mode?: Config['mode']): P
15
15
  preferNativePlatform: true;
16
16
  symlinks: true;
17
17
  };
18
- transform: {
19
- flow: {
20
- filter: {
21
- id: RegExp;
22
- code: RegExp;
23
- };
24
- };
25
- };
18
+ transform: NonNullable<Config['transform']>;
26
19
  prelude: string[];
27
20
  polyfills: Polyfill[];
28
21
  output: {};
29
- treeshake: NonNullable<Config["treeshake"]>;
22
+ treeshake: NonNullable<Config['treeshake']>;
30
23
  reactNative: {
31
24
  reactNativePath: string;
32
- codegen: {
33
- /**
34
- * @see {@link https://github.com/facebook/react-native/blob/v0.83.1/packages/react-native-babel-preset/src/configs/main.js#L78}
35
- */
36
- filter: {
37
- code: RegExp;
38
- };
39
- };
40
- assetRegistryPath: NonNullable<NonNullable<ReactNativeConfig>["assetRegistryPath"]>;
41
- hmrClientPath: NonNullable<NonNullable<ReactNativeConfig>["hmrClientPath"]>;
25
+ assetRegistryPath: NonNullable<NonNullable<ReactNativeConfig>['assetRegistryPath']>;
26
+ hmrClientPath: NonNullable<NonNullable<ReactNativeConfig>['hmrClientPath']>;
42
27
  };
43
28
  dev: {
44
29
  watch: {
45
30
  skipWrite: true;
46
31
  useDebounce: true;
47
32
  debounceDuration: number;
33
+ exclude: string[];
48
34
  };
49
- hmr: NonNullable<DevConfig["hmr"]>;
35
+ hmr: NonNullable<DevConfig['hmr']>;
50
36
  };
51
37
  reporter: Reporter;
52
38
  analyzer: Required<AnalyzerConfig>;
53
- terminal: {
54
- status: "none" | "compat" | "progress" | undefined;
55
- };
56
39
  envDir: string;
57
- envFile: NonNullable<Config["envFile"]>;
58
- envPrefix: NonNullable<Config["envPrefix"]>;
59
- runtimeTarget: NonNullable<Config["runtimeTarget"]>;
60
- experimental: {
61
- nativeTransformPipeline: boolean;
62
- };
40
+ envFile: NonNullable<Config['envFile']>;
41
+ envPrefix: NonNullable<Config['envPrefix']>;
42
+ runtimeTarget: NonNullable<Config['runtimeTarget']>;
43
+ experimental: {};
63
44
  }>;
64
- interface InternalConfig {
45
+ export interface InternalConfig {
65
46
  /**
66
47
  * The path to the config file that was used to load the config.
67
48
  */
68
49
  configFile: string;
69
50
  }
70
- type DefaultConfig = Awaited<ReturnType<typeof getDefaultConfig>>;
71
- type ResolvedConfig = DefaultConfig & PluginFlattenConfig & InternalConfig;
72
- //#endregion
73
- export { DefaultConfig, InternalConfig, ResolvedConfig, getDefaultConfig };
51
+ export type DefaultConfig = Awaited<ReturnType<typeof getDefaultConfig>>;
52
+ export type ResolvedConfig = DefaultConfig & PluginFlattenConfig & InternalConfig;
53
+ //#endregion
@@ -1,4 +1,3 @@
1
- import { isDebugEnabled } from "../common/env.js";
2
1
  import { stripFlowTypes } from "../common/transformer.js";
3
2
  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
3
  import { ClientLogReporter } from "../events/builtin-reporters.js";
@@ -26,26 +25,19 @@ async function getDefaultConfig(projectRoot, mode) {
26
25
  preferNativePlatform: true,
27
26
  symlinks: true
28
27
  },
29
- transform: { flow: { filter: {
30
- id: /\.jsx?$/,
31
- code: /@flow/
32
- } } },
28
+ transform: { swc: { native: { externalHelpers: true } } },
33
29
  prelude: [getInitializeCorePath(projectRoot)],
34
30
  polyfills: await Promise.all(getPolyfillScriptPaths(reactNativePath).map(async (path) => {
31
+ const code = fs.readFileSync(path, "utf-8");
35
32
  return {
36
33
  type: "iife",
37
- code: (await stripFlowTypes(path, fs.readFileSync(path, "utf-8"))).code
34
+ code: (await stripFlowTypes(path, code)).code
38
35
  };
39
36
  })),
40
37
  output: {},
41
38
  treeshake: true,
42
39
  reactNative: {
43
40
  reactNativePath,
44
- codegen: {
45
- /**
46
- * @see {@link https://github.com/facebook/react-native/blob/v0.83.1/packages/react-native-babel-preset/src/configs/main.js#L78}
47
- */
48
- filter: { code: /\bcodegenNativeComponent</ } },
49
41
  assetRegistryPath: DEFAULT_ASSET_REGISTRY_PATH,
50
42
  hmrClientPath: DEFAULT_HMR_CLIENT_PATH
51
43
  },
@@ -53,7 +45,8 @@ filter: { code: /\bcodegenNativeComponent</ } },
53
45
  watch: {
54
46
  skipWrite: true,
55
47
  useDebounce: true,
56
- debounceDuration: 50
48
+ debounceDuration: 50,
49
+ exclude: ["**/.rollipop/**"]
57
50
  },
58
51
  hmr: true
59
52
  },
@@ -64,16 +57,11 @@ filter: { code: /\bcodegenNativeComponent</ } },
64
57
  reportFile: DEFAULT_ANALYZE_REPORT_FILE,
65
58
  autoOpen: false
66
59
  },
67
- terminal: { status: (() => {
68
- if (isDebugEnabled()) return "compat";
69
- if (process.stderr.isTTY) return "progress";
70
- return "compat";
71
- })() },
72
60
  envDir: projectRoot,
73
61
  envFile: DEFAULT_ENV_FILE,
74
62
  envPrefix: DEFAULT_ENV_PREFIX,
75
63
  runtimeTarget: DEFAULT_RUNTIME_TARGET,
76
- experimental: { nativeTransformPipeline: false }
64
+ experimental: {}
77
65
  };
78
66
  }
79
67
  //#endregion
@@ -1,12 +1,11 @@
1
1
  import { Config } from "./types.js";
2
2
  import { DefaultConfig } from "./defaults.js";
3
3
  //#region src/config/define-config.d.ts
4
- interface DefineConfigContext {
4
+ export interface DefineConfigContext {
5
5
  command?: string;
6
6
  defaultConfig: DefaultConfig;
7
7
  }
8
- type UserConfig = Config | DynamicUserConfig;
9
- type DynamicUserConfig = ((context: DefineConfigContext) => Config) | ((context: DefineConfigContext) => Promise<Config>);
10
- declare function defineConfig(userConfig: UserConfig): UserConfig;
11
- //#endregion
12
- export { DefineConfigContext, DynamicUserConfig, UserConfig, defineConfig };
8
+ export type UserConfig = Config | DynamicUserConfig;
9
+ export type DynamicUserConfig = ((context: DefineConfigContext) => Config) | ((context: DefineConfigContext) => Promise<Config>);
10
+ export declare function defineConfig(userConfig: UserConfig): UserConfig;
11
+ //#endregion
@@ -1,7 +1,7 @@
1
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";
2
+ import { AliasConfig, AnalyzerConfig, BabelTransformConfig, Config, DevConfig, ExperimentalConfig, HmrConfig, OptimizationConfig, OutputConfig, PluginOption, Polyfill, PolyfillOptions, PolyfillType, PolyfillWithCode, PolyfillWithPath, ReactNativeConfig, ResolveConfig, RollipopReactNativeFlowConfig, RollipopReactNativeSwcConfig, RollipopReactNativeWorkletsConfig, SwcTransformConfig, TransformConfig, TransformRule, WatcherConfig } from "./types.js";
3
3
  import { DefineConfigContext, DynamicUserConfig, UserConfig, defineConfig } from "./define-config.js";
4
4
  import { LoadConfigOptions, flattenPluginOption, invokeConfigResolved, loadConfig, resolvePluginConfig } from "./load-config.js";
5
5
  import { PluginFlattenConfig, mergeConfig } from "./merge-config.js";
6
6
  import { DefaultConfig, InternalConfig, ResolvedConfig, getDefaultConfig } from "./defaults.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 };
7
+ export { type AliasConfig, type AnalyzerConfig, type BabelTransformConfig, type Config, DefaultConfig, DefineConfigContext, type DevConfig, DynamicUserConfig, type ExperimentalConfig, 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 RollipopReactNativeSwcConfig, type RollipopReactNativeWorkletsConfig, type SwcTransformConfig, type TransformConfig, type TransformRule, UserConfig, type WatcherConfig, defineConfig, flattenPluginOption, getDefaultConfig, invokeConfigResolved, loadConfig, mergeConfig, resolvePluginConfig };
@@ -3,16 +3,15 @@ import { DefineConfigContext } from "./define-config.js";
3
3
  import { Plugin, PluginConfig, ResolvedPluginConfig } from "../core/plugins/types.js";
4
4
  import { ResolvedConfig } from "./defaults.js";
5
5
  //#region src/config/load-config.d.ts
6
- interface LoadConfigOptions {
6
+ export interface LoadConfigOptions {
7
7
  cwd?: string;
8
8
  configFile?: string;
9
9
  mode?: Config['mode'];
10
10
  context?: Omit<DefineConfigContext, 'defaultConfig'>;
11
11
  }
12
- declare function loadConfig(options?: LoadConfigOptions): Promise<ResolvedConfig>;
13
- declare function flattenPluginOption(pluginOption: PluginOption): Promise<Plugin[]>;
14
- declare function resolvePluginConfig(baseConfig: ResolvedConfig, plugins: Plugin[]): Promise<ResolvedPluginConfig>;
15
- declare function resolvePluginConfig(baseConfig: Config, plugins: Plugin[]): Promise<PluginConfig>;
16
- declare function invokeConfigResolved(config: ResolvedConfig, plugins: Plugin[]): Promise<void>;
17
- //#endregion
18
- export { LoadConfigOptions, flattenPluginOption, invokeConfigResolved, loadConfig, resolvePluginConfig };
12
+ export declare function loadConfig(options?: LoadConfigOptions): Promise<ResolvedConfig>;
13
+ export declare function flattenPluginOption(pluginOption: PluginOption): Promise<Plugin[]>;
14
+ export declare function resolvePluginConfig(baseConfig: ResolvedConfig, plugins: Plugin[]): Promise<ResolvedPluginConfig>;
15
+ export declare function resolvePluginConfig(baseConfig: Config, plugins: Plugin[]): Promise<PluginConfig>;
16
+ export declare function invokeConfigResolved(config: ResolvedConfig, plugins: Plugin[]): Promise<void>;
17
+ //#endregion
@@ -20,7 +20,8 @@ async function loadConfig(options = {}) {
20
20
  };
21
21
  const { config: userConfig, configFile: resolvedConfigFile } = await c12.loadConfig(configFile ? {
22
22
  configFile: path.resolve(cwd, configFile),
23
- configFileRequired: true
23
+ configFileRequired: true,
24
+ ...commonOptions
24
25
  } : {
25
26
  cwd,
26
27
  defaultConfig,
@@ -2,10 +2,9 @@ import { Config } from "./types.js";
2
2
  import { Plugin } from "../core/plugins/types.js";
3
3
  import { DefaultConfig, ResolvedConfig } from "./defaults.js";
4
4
  //#region src/config/merge-config.d.ts
5
- type PluginFlattenConfig = Omit<Config, 'plugins'> & {
5
+ export type PluginFlattenConfig = Omit<Config, 'plugins'> & {
6
6
  plugins?: Plugin[];
7
7
  };
8
- declare function mergeConfig(baseConfig: PluginFlattenConfig, ...overrideConfigs: PluginFlattenConfig[]): Config;
9
- declare function mergeConfig(baseConfig: DefaultConfig, ...overrideConfigs: PluginFlattenConfig[]): ResolvedConfig;
10
- //#endregion
11
- export { PluginFlattenConfig, mergeConfig };
8
+ export declare function mergeConfig(baseConfig: PluginFlattenConfig, ...overrideConfigs: PluginFlattenConfig[]): Config;
9
+ export declare function mergeConfig(baseConfig: DefaultConfig, ...overrideConfigs: PluginFlattenConfig[]): ResolvedConfig;
10
+ //#endregion
@@ -5,7 +5,7 @@ import "../core/plugins/index.js";
5
5
  import { InteractiveCommand } from "../node/commands/start/setup-interactive-mode.js";
6
6
  import "../node/cli-utils.js";
7
7
  import { Plugin } from "../core/plugins/types.js";
8
- import { DevWatchOptions, RollipopReactNativeFlowConfig, RollipopReactNativeWorkletsConfig } from "@rollipop/rolldown/experimental";
8
+ import { DevWatchOptions, RollipopReactNativeFlowConfig, RollipopReactNativeSwcConfig, RollipopReactNativeWorkletsConfig } from "@rollipop/rolldown/experimental";
9
9
  import * as rolldown from "@rollipop/rolldown";
10
10
  import { TopLevelFilterExpression } from "@rollipop/rolldown/filter";
11
11
  import * as babel from "@babel/core";
@@ -15,7 +15,7 @@ type RolldownExperimentalOptions = NonNullable<rolldown.InputOptions['experiment
15
15
  type RolldownTransformOptions = NonNullable<rolldown.InputOptions['transform']>;
16
16
  type RollipopManagedInputOption = 'input' | 'plugins' | 'cwd' | 'platform' | 'checks' | 'logLevel' | 'onLog' | 'onwarn' | 'resolve' | 'transform' | 'watch' | 'experimental' | 'id';
17
17
  type RollipopManagedOutputOption = 'dir' | 'file' | 'format' | 'codeSplitting' | 'persistentCache';
18
- interface Config extends Omit<rolldown.InputOptions, RollipopManagedInputOption> {
18
+ export interface Config extends Omit<rolldown.InputOptions, RollipopManagedInputOption> {
19
19
  /**
20
20
  * Defaults to current working directory.
21
21
  */
@@ -55,9 +55,9 @@ interface Config extends Omit<rolldown.InputOptions, RollipopManagedInputOption>
55
55
  */
56
56
  reactNative?: ReactNativeConfig;
57
57
  /**
58
- * Terminal configuration.
58
+ * Custom commands to display in the interactive mode.
59
59
  */
60
- terminal?: TerminalConfig;
60
+ commands?: InteractiveCommand[];
61
61
  /**
62
62
  * Reporter configuration.
63
63
  */
@@ -119,10 +119,10 @@ interface Config extends Omit<rolldown.InputOptions, RollipopManagedInputOption>
119
119
  */
120
120
  rolldownOptions?: RolldownOptionsConfig;
121
121
  }
122
- type PluginOption = MaybePromise<NullValue<Plugin> | {
122
+ export type PluginOption = MaybePromise<NullValue<Plugin> | {
123
123
  name: string;
124
124
  } | false | PluginOption[]>;
125
- type ResolveConfig = Omit<NonNullable<rolldown.InputOptions['resolve']>, 'alias' | 'extensions'> & {
125
+ export type ResolveConfig = Omit<NonNullable<rolldown.InputOptions['resolve']>, 'alias' | 'extensions'> & {
126
126
  /**
127
127
  * Substitute one package or module path for another.
128
128
  *
@@ -176,16 +176,12 @@ type ResolveConfig = Omit<NonNullable<rolldown.InputOptions['resolve']>, 'alias'
176
176
  */
177
177
  preferNativePlatform?: boolean;
178
178
  };
179
- type AliasConfig = NonNullable<rolldown.InputOptions['resolve']>['alias'] | AliasEntry[];
180
- type TransformConfig = Omit<RolldownTransformOptions, 'cwd' | 'lang' | 'sourceType' | 'plugins'> & {
179
+ export type AliasConfig = NonNullable<rolldown.InputOptions['resolve']>['alias'] | AliasEntry[];
180
+ export type TransformConfig = Omit<RolldownTransformOptions, 'cwd' | 'lang' | 'sourceType' | 'plugins'> & {
181
181
  /**
182
- * Flow specific configuration.
183
- *
184
- * Only applied when `experimental.nativeTransformPipeline` is **disabled** (the
185
- * default). With the native pipeline enabled, the rust-side plugin
186
- * handles Flow stripping internally.
182
+ * Flow handling configuration for the built-in transform pipeline.
187
183
  */
188
- flow?: FlowConfig;
184
+ flow?: RollipopReactNativeFlowConfig;
189
185
  /**
190
186
  * Babel transformation configuration.
191
187
  */
@@ -195,65 +191,46 @@ type TransformConfig = Omit<RolldownTransformOptions, 'cwd' | 'lang' | 'sourceTy
195
191
  */
196
192
  swc?: SwcTransformConfig;
197
193
  };
198
- type BabelTransformConfig = {
194
+ export type BabelTransformConfig = {
199
195
  rules?: TransformRule<babel.InputOptions>[];
200
196
  };
201
- type SwcTransformConfig = {
197
+ export type SwcTransformConfig = {
198
+ native?: RollipopReactNativeSwcConfig;
202
199
  rules?: TransformRule<swc.Options>[];
203
200
  };
204
- interface TransformRule<T = unknown> {
201
+ export interface TransformRule<T = unknown> {
205
202
  filter?: rolldown.HookFilter | TopLevelFilterExpression[];
206
203
  options: T | ((code: string, id: string) => T);
207
- }
208
- interface FlowConfig {
209
204
  /**
210
- * 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
211
208
  */
212
- filter?: rolldown.HookFilter | TopLevelFilterExpression[];
209
+ standalone?: boolean;
213
210
  }
214
- interface ExperimentalConfig extends RolldownExperimentalOptions {
215
- /**
216
- * Enables the native (rust) transform pipeline, which replaces the
217
- * legacy JS-side codegen marker, Flow strip, and SWC/babel preset
218
- * machinery with a single built-in `rollipopReactNativePlugin`.
219
- *
220
- * This is a breaking change for projects that customised the legacy
221
- * pipeline via `transformer.flow.filter`, `reactNative.codegen.filter`,
222
- * or `runtimeTarget`. Opt in once you have validated builds locally.
223
- *
224
- * Defaults to `false`.
225
- */
226
- nativeTransformPipeline?: boolean;
227
- /**
228
- * Flow handling configuration for the native transform pipeline.
229
- *
230
- * Only applied when `experimental.nativeTransformPipeline` is enabled.
231
- */
232
- flow?: RollipopReactNativeFlowConfig;
211
+ export interface ExperimentalConfig extends RolldownExperimentalOptions {
233
212
  /**
234
213
  * `react-native-worklets` transformation configuration.
235
- *
236
- * Only applied when `experimental.nativeTransformPipeline` is enabled.
237
214
  */
238
215
  worklets?: RollipopReactNativeWorkletsConfig;
239
216
  }
240
- interface OutputConfig extends Omit<rolldown.OutputOptions, RollipopManagedOutputOption> {}
241
- type Polyfill = string | PolyfillWithCode | PolyfillWithPath;
242
- type PolyfillOptions = {
217
+ export interface OutputConfig extends Omit<rolldown.OutputOptions, RollipopManagedOutputOption> {}
218
+ export type Polyfill = string | PolyfillWithCode | PolyfillWithPath;
219
+ export type PolyfillOptions = {
243
220
  withTransform?: boolean;
244
221
  };
245
- type PolyfillWithCode = {
222
+ export type PolyfillWithCode = {
246
223
  type: PolyfillType;
247
224
  code: string;
248
225
  } & PolyfillOptions;
249
- type PolyfillWithPath = {
226
+ export type PolyfillWithPath = {
250
227
  type: PolyfillType;
251
228
  path: string;
252
229
  } & PolyfillOptions;
253
- type PolyfillType = 'plain' | 'iife';
254
- type OptimizationConfig = rolldown.OptimizationOptions;
255
- type WatcherConfig = DevWatchOptions;
256
- interface DevConfig {
230
+ export type PolyfillType = 'plain' | 'iife';
231
+ export type OptimizationConfig = rolldown.OptimizationOptions;
232
+ export type WatcherConfig = DevWatchOptions;
233
+ export interface DevConfig {
257
234
  /**
258
235
  * Watcher configuration.
259
236
  */
@@ -266,7 +243,7 @@ interface DevConfig {
266
243
  */
267
244
  hmr?: boolean | HmrConfig;
268
245
  }
269
- interface HmrConfig {
246
+ export interface HmrConfig {
270
247
  /**
271
248
  * Source code of the HMR runtime implementation.
272
249
  *
@@ -280,21 +257,13 @@ interface HmrConfig {
280
257
  */
281
258
  clientImplement?: string;
282
259
  }
283
- interface ReactNativeConfig {
260
+ export interface ReactNativeConfig {
284
261
  /**
285
262
  * Path to React Native package.
286
263
  *
287
264
  * Defaults to: resolving `react-native` package from `projectRoot`.
288
265
  */
289
266
  reactNativePath?: string;
290
- /**
291
- * Codegen specific configuration.
292
- *
293
- * Only applied when `experimental.nativeTransformPipeline` is **disabled** (the
294
- * default). With the native pipeline enabled, the rust-side plugin
295
- * handles codegen marking internally.
296
- */
297
- codegen?: CodegenConfig;
298
267
  /**
299
268
  * Path to asset registry file.
300
269
  *
@@ -308,13 +277,7 @@ interface ReactNativeConfig {
308
277
  */
309
278
  hmrClientPath?: string | ((root: string) => MaybePromise<string>);
310
279
  }
311
- interface CodegenConfig {
312
- /**
313
- * Filter for codegen transformation pipeline.
314
- */
315
- filter?: rolldown.HookFilter | TopLevelFilterExpression[];
316
- }
317
- interface AnalyzerConfig {
280
+ export interface AnalyzerConfig {
318
281
  /**
319
282
  * Whether to enable the bundle analyzer.
320
283
  *
@@ -341,17 +304,5 @@ interface AnalyzerConfig {
341
304
  */
342
305
  autoOpen?: boolean;
343
306
  }
344
- interface TerminalConfig {
345
- /**
346
- * Status of the terminal.
347
- *
348
- * Defaults to: `process.stderr.isTTY ? 'progress' : 'compat'`
349
- */
350
- status?: 'none' | 'compat' | 'progress';
351
- /**
352
- * Extra commands to display in the interactive mode.
353
- */
354
- extraCommands?: InteractiveCommand[];
355
- }
356
307
  //#endregion
357
- export { AliasConfig, AnalyzerConfig, BabelTransformConfig, CodegenConfig, Config, DevConfig, ExperimentalConfig, FlowConfig, HmrConfig, OptimizationConfig, OutputConfig, PluginOption, Polyfill, PolyfillOptions, PolyfillType, PolyfillWithCode, PolyfillWithPath, ReactNativeConfig, ResolveConfig, type RolldownOptions, type RolldownOptionsConfig, type RolldownOptionsContext, type RolldownOptionsFunction, type RollipopReactNativeFlowConfig, type RollipopReactNativeWorkletsConfig, SwcTransformConfig, TerminalConfig, TransformConfig, TransformRule, WatcherConfig };
308
+ export type { RolldownOptions, RolldownOptionsConfig, RolldownOptionsContext, RolldownOptionsFunction, RollipopReactNativeFlowConfig, RollipopReactNativeSwcConfig, RollipopReactNativeWorkletsConfig };
@@ -7,32 +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_BOOTSTRAP_ID = "\0rollipop/bootstrap";
13
- 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";
14
14
  /**
15
15
  * @see {@link https://github.com/facebook/metro/blob/0.81.x/docs/Configuration.md#resolvermainfields}
16
16
  */
17
- declare const DEFAULT_RESOLVER_MAIN_FIELDS: string[];
18
- declare const DEFAULT_RESOLVER_ALIAS_FIELDS: string[][];
19
- 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[];
20
20
  /**
21
21
  * Unlike the Metro bundler configuration, this prioritizes resolving TypeScript and ESM first.
22
22
  *
23
23
  * @see {@link https://github.com/facebook/metro/blob/0.81.x/packages/metro-config/src/defaults/defaults.js}
24
24
  * @see {@link https://github.com/facebook/metro/blob/0.81.x/packages/metro-file-map/src/workerExclusionList.js}
25
25
  */
26
- declare const DEFAULT_SOURCE_EXTENSIONS: string[];
27
- declare const DEFAULT_IMAGE_EXTENSIONS: string[];
28
- declare const IMAGE_EXTENSIONS: string[];
29
- declare const DEFAULT_ASSET_EXTENSIONS: string[];
30
- declare const DEFAULT_ASSET_REGISTRY_PATH = "react-native/Libraries/Image/AssetRegistry.js";
31
- declare const DEFAULT_HMR_CLIENT_PATH = "react-native/Libraries/Utilities/HMRClient.js";
32
- declare const DEFAULT_ENV_PREFIX = "ROLLIPOP_";
33
- declare const DEFAULT_ENV_FILE = ".env";
34
- declare const DEFAULT_RUNTIME_TARGET = "hermes-v1";
35
- declare const DEFAULT_ANALYZE_FILE = "analyze-data.json";
36
- 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";
37
37
  //#endregion
38
- 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_d_exports };
38
+ export { constants_d_exports };
package/dist/constants.js CHANGED
@@ -20,7 +20,7 @@ var constants_exports = /* @__PURE__ */ __exportAll({
20
20
  ROLLIPOP_VIRTUAL_ENTRY_ID: () => ROLLIPOP_VIRTUAL_ENTRY_ID,
21
21
  ROLLIPOP_VIRTUAL_PREFIX: () => ROLLIPOP_VIRTUAL_PREFIX
22
22
  });
23
- const ROLLIPOP_VERSION = "1.0.0-alpha.29";
23
+ const ROLLIPOP_VERSION = "1.0.0-alpha.31";
24
24
  const ROLLIPOP_VIRTUAL_PREFIX = "\0rollipop/";
25
25
  const ROLLIPOP_VIRTUAL_BOOTSTRAP_ID = `${ROLLIPOP_VIRTUAL_PREFIX}bootstrap`;
26
26
  const ROLLIPOP_VIRTUAL_ENTRY_ID = `${ROLLIPOP_VIRTUAL_PREFIX}entry`;