rollipop 1.0.0-alpha.29 → 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 (131) 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 +255 -5
  113. package/src/runtime/hmr-client.ts +10 -5
  114. package/src/runtime/hmr-runtime.ts +34 -11
  115. package/dist/core/plugins/utils/source.js +0 -10
  116. package/dist/server/mcp/server.js +0 -77
  117. package/dist/server/mcp/tools/build-info.js +0 -11
  118. package/dist/server/middlewares/sse.js +0 -36
  119. package/dist/server/rest/domains/actions.js +0 -24
  120. package/dist/server/rest/domains/builds.js +0 -37
  121. package/dist/server/rest/domains/bundlers.js +0 -30
  122. package/dist/server/rest/domains/config.js +0 -14
  123. package/dist/server/rest/domains/dev-server.js +0 -14
  124. package/dist/server/rest/domains/devices.js +0 -20
  125. package/dist/server/rest/domains/feature-flags.js +0 -14
  126. package/dist/server/rest/domains/snapshot.js +0 -14
  127. package/dist/server/rest/index.js +0 -56
  128. package/dist/server/rest/response.js +0 -9
  129. package/dist/server/sse/event-bus.js +0 -26
  130. package/dist/server/sse/types.d.ts +0 -45
  131. package/dist/utils/promise.js +0 -15
@@ -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
- export { AssetContext, AssetData, AssetDataFiltered, AssetDataWithoutFiles, AssetInfo, AssetScale, assets_d_exports, copyAssetsToDestination, filterPlatformAssetScales, generateAssetRegistryCode, getAssetPriority, getSuffixedPath, platformSuffixPattern, resolveAssetPath, resolveScaledAssets, stripSuffix };
92
+ export { assets_d_exports };
@@ -3,7 +3,7 @@ import { BuildOptions, DevEngine, DevEngineOptions } from "./types.js";
3
3
  import { ResolvedConfig } from "../config/defaults.js";
4
4
  import * as rolldown from "@rollipop/rolldown";
5
5
  //#region src/core/bundler.d.ts
6
- declare class Bundler {
6
+ export declare class Bundler {
7
7
  private readonly config;
8
8
  static devEngine(config: ResolvedConfig, buildOptions: Omit<BuildOptions, 'dev' | 'outfile'>, devEngineOptions: DevEngineOptions): Promise<DevEngine>;
9
9
  static createId(config: ResolvedConfig, buildOptions: ResolvedBuildOptions): string;
@@ -11,5 +11,4 @@ declare class Bundler {
11
11
  constructor(config: ResolvedConfig);
12
12
  build(buildOptions: BuildOptions): Promise<rolldown.OutputChunk>;
13
13
  }
14
- //#endregion
15
- export { Bundler };
14
+ //#endregion
@@ -18,10 +18,12 @@ var Bundler = class Bundler {
18
18
  const context = Bundler.createContext(buildType, config, resolvedBuildOptions);
19
19
  const rolldownOptions = await resolveRolldownOptions(context, config, resolvedBuildOptions, devEngineOptions);
20
20
  const { input = {}, output = {} } = rolldownOptions;
21
- const devEngine = await dev(input, output, {
21
+ const resolvedDevEngineOptions = {
22
22
  watch: config.dev.watch,
23
- ...devEngineOptions
24
- });
23
+ ...devEngineOptions,
24
+ hotUpdate: true
25
+ };
26
+ const devEngine = await dev(input, output, resolvedDevEngineOptions);
25
27
  Object.defineProperties(devEngine, {
26
28
  getContext: {
27
29
  value: () => context,
@@ -65,14 +67,10 @@ var Bundler = class Bundler {
65
67
  const buildType = "build";
66
68
  const resolvedBuildOptions = resolveBuildOptions(this.config, buildOptions);
67
69
  const context = Bundler.createContext(buildType, this.config, resolvedBuildOptions);
68
- const sourcemap = resolvedBuildOptions.sourcemap ? true : false;
69
70
  const { input = {}, output = {} } = await resolveRolldownOptions(context, this.config, resolvedBuildOptions);
70
71
  const rolldownBuildOptions = {
71
72
  ...input,
72
- output: {
73
- ...output,
74
- sourcemap
75
- },
73
+ output,
76
74
  write: Boolean(resolvedBuildOptions.outfile)
77
75
  };
78
76
  const chunk = (await rolldown.build(rolldownBuildOptions)).output[0];
@@ -1,12 +1,11 @@
1
1
  import { Config } from "../config/types.js";
2
2
  import "../config/index.js";
3
3
  //#region src/core/env.d.ts
4
- interface LoadEnvOptions {
4
+ export interface LoadEnvOptions {
5
5
  envDir: string;
6
6
  envPrefix: string;
7
7
  envFile: string;
8
8
  mode?: Config['mode'];
9
9
  }
10
- declare function loadEnv(options: LoadEnvOptions): Record<string, string>;
11
- //#endregion
12
- export { LoadEnvOptions, loadEnv };
10
+ export declare function loadEnv(options: LoadEnvOptions): Record<string, string>;
11
+ //#endregion
@@ -1,12 +1,12 @@
1
1
  import * as rolldown from "@rollipop/rolldown";
2
2
  //#region src/core/plugins/alias-plugin.d.ts
3
- interface AliasEntry {
3
+ export interface AliasEntry {
4
4
  find: string | RegExp;
5
5
  replacement: string;
6
6
  }
7
- interface AliasPluginOptions {
7
+ export interface AliasPluginOptions {
8
8
  entries: AliasEntry[];
9
9
  }
10
10
  declare function aliasPlugin(options: AliasPluginOptions): rolldown.Plugin | null;
11
11
  //#endregion
12
- export { AliasEntry, AliasPluginOptions, aliasPlugin as alias };
12
+ export { aliasPlugin as alias };
@@ -3,9 +3,9 @@ import { AnalyzerConfig } from "../../config/types.js";
3
3
  import "../../config/index.js";
4
4
  import * as rolldown from "@rollipop/rolldown";
5
5
  //#region src/core/plugins/analyze-plugin.d.ts
6
- interface AnalyzePluginOptions extends Required<AnalyzerConfig> {
6
+ export interface AnalyzePluginOptions extends Required<AnalyzerConfig> {
7
7
  context: BundlerContext;
8
8
  }
9
9
  declare function analyzePlugin(options: AnalyzePluginOptions): rolldown.Plugin[] | null;
10
10
  //#endregion
11
- export { AnalyzePluginOptions, analyzePlugin as analyze };
11
+ export { analyzePlugin as analyze };
@@ -3,16 +3,10 @@ import { TransformConfig } from "../../config/types.js";
3
3
  import "../../config/index.js";
4
4
  import * as rolldown from "@rollipop/rolldown";
5
5
  //#region src/core/plugins/babel-plugin.d.ts
6
- interface BabelPluginOptions {
6
+ export interface BabelPluginOptions {
7
7
  context: BundlerContext;
8
- /**
9
- * When `false`, the legacy JS preset (TS strip / Flow strip / RN
10
- * codegen) is applied. When `true`, the preset is skipped and only
11
- * user-provided rules run — the rust-side pipeline handles the rest.
12
- */
13
- useNativeTransformPipeline: boolean;
14
8
  transformConfig?: TransformConfig['babel'];
15
9
  }
16
- declare function babelPlugin({ context, useNativeTransformPipeline, transformConfig }: BabelPluginOptions): rolldown.Plugin[];
10
+ declare function babelPlugin({ context, transformConfig }: BabelPluginOptions): rolldown.Plugin[];
17
11
  //#endregion
18
- export { BabelPluginOptions, babelPlugin as babel };
12
+ export { babelPlugin as babel };
@@ -1,22 +1,37 @@
1
- import { __require } from "../../_virtual/_rolldown/runtime.js";
2
1
  import { getFlag } from "./utils/transform-utils.js";
3
2
  import { mergeBabelOptions } from "../../utils/babel.js";
4
- import { isJSX, isTS } from "./utils/source.js";
5
- import { invariant } from "es-toolkit";
3
+ import { ROLLDOWN_RUNTIME_EXCLUDE_FILTER, withRuntimeExclude } from "./shared/filters.js";
4
+ import { invariant, partition } from "es-toolkit";
6
5
  import * as babel from "@babel/core";
7
6
  //#region src/core/plugins/babel-plugin.ts
8
- function babelPlugin({ context, useNativeTransformPipeline, transformConfig }) {
7
+ function babelPlugin({ context, transformConfig }) {
9
8
  const { rules = [] } = transformConfig ?? {};
10
9
  const babelOptionsById = /* @__PURE__ */ new Map();
11
- const babelRules = rules.map(({ filter, options }, index) => {
10
+ const [standaloneRules, mergedRules] = partition([...rules.entries()], ([, rule]) => rule.standalone);
11
+ const standalonePlugins = standaloneRules.map(([index, { filter, options }]) => ({
12
+ name: `rollipop:babel-standalone-rule-${index}`,
13
+ transform: {
14
+ filter: withRuntimeExclude(filter),
15
+ handler(code, id) {
16
+ if (getFlag.call(this, context, id) & 128) return;
17
+ return transform(code, id, typeof options === "function" ? options(code, id) : options);
18
+ }
19
+ }
20
+ }));
21
+ const babelRules = mergedRules.map(([index, { filter, options }]) => {
12
22
  return {
13
23
  name: `rollipop:babel-rule-${index}`,
14
24
  transform: {
15
- filter,
25
+ filter: withRuntimeExclude(filter),
16
26
  handler(code, id) {
17
- const existingBabelOptions = babelOptionsById.get(id);
18
- const resolvedOptions = typeof options === "function" ? options(code, id) : options;
19
- existingBabelOptions ? existingBabelOptions.push(resolvedOptions) : babelOptionsById.set(id, [resolvedOptions]);
27
+ try {
28
+ const existingBabelOptions = babelOptionsById.get(id);
29
+ const resolvedOptions = typeof options === "function" ? options(code, id) : options;
30
+ existingBabelOptions ? existingBabelOptions.push(resolvedOptions) : babelOptionsById.set(id, [resolvedOptions]);
31
+ } catch (error) {
32
+ babelOptionsById.delete(id);
33
+ throw error;
34
+ }
20
35
  }
21
36
  }
22
37
  };
@@ -26,61 +41,39 @@ function babelPlugin({ context, useNativeTransformPipeline, transformConfig }) {
26
41
  buildStart() {
27
42
  babelOptionsById.clear();
28
43
  },
29
- transform: { handler(code, id) {
30
- const flags = getFlag.call(this, context, id);
31
- if (flags & 128) return;
32
- const babelOptions = babelOptionsById.get(id) ?? [];
33
- if (!(useNativeTransformPipeline ? babelOptions.length > 0 : flags & 1 || babelOptions.length > 0)) return;
34
- const baseOptions = useNativeTransformPipeline ? [] : [getPreset(flags, id)];
35
- const result = babel.transformSync(code, {
36
- filename: id,
37
- babelrc: false,
38
- configFile: false,
39
- sourceMaps: true,
40
- ...mergeBabelOptions([...baseOptions, ...babelOptions])
41
- });
42
- invariant(result?.code, `Failed to transform with babel: ${id}`);
43
- const map = result.map && {
44
- ...result.map,
45
- names: [...result.map.names],
46
- sources: [...result.map.sources],
47
- sourcesContent: result.map.sourcesContent ? [...result.map.sourcesContent] : void 0
48
- };
49
- return {
50
- code: result.code,
51
- map
52
- };
53
- } }
54
- };
55
- return [...babelRules, babelPlugin];
56
- }
57
- function getPreset(flags, id) {
58
- const presets = [];
59
- const plugins = [];
60
- let parserOpts = null;
61
- if (flags & 2) {
62
- parserOpts = { flow: "all" };
63
- plugins.push([__require.resolve("babel-plugin-syntax-hermes-parser"), {
64
- parseLangTypes: "flow",
65
- reactRuntimeTarget: "19"
66
- }], __require.resolve("@babel/plugin-transform-flow-strip-types"));
67
- } else if (isTS(id)) plugins.push([__require.resolve("@babel/plugin-transform-typescript"), {
68
- isTSX: isJSX(id),
69
- allowNamespaces: true
70
- }]);
71
- if (flags & 1) plugins.push(reactNativeCodegenPlugin);
72
- const options = {
73
- presets,
74
- plugins
44
+ transform: {
45
+ filter: [ROLLDOWN_RUNTIME_EXCLUDE_FILTER],
46
+ handler(code, id) {
47
+ const babelOptions = babelOptionsById.get(id);
48
+ if (babelOptions == null) return;
49
+ babelOptionsById.delete(id);
50
+ if (getFlag.call(this, context, id) & 128) return;
51
+ return transform(code, id, mergeBabelOptions(babelOptions));
52
+ }
53
+ }
75
54
  };
76
- if (parserOpts) options.parserOpts = parserOpts;
77
- return options;
55
+ return [...standalonePlugins, ...babelRules.length > 0 ? [...babelRules, babelPlugin] : []];
78
56
  }
79
- function reactNativeCodegenPlugin() {
80
- return __require(__require.resolve("@react-native/babel-plugin-codegen"))({
81
- parse: babel.parseSync,
82
- types: babel.types
57
+ function transform(code, id, options) {
58
+ const result = babel.transformSync(code, {
59
+ filename: id,
60
+ babelrc: false,
61
+ configFile: false,
62
+ sourceMaps: true,
63
+ ...options
83
64
  });
65
+ invariant(result?.code, `Failed to transform with babel: ${id}`);
66
+ const map = result.map && {
67
+ ...result.map,
68
+ names: [...result.map.names],
69
+ sources: [...result.map.sources],
70
+ sourcesContent: result.map.sourcesContent ? [...result.map.sourcesContent] : void 0,
71
+ ignoreList: result.map.ignoreList ? [...result.map.ignoreList] : void 0
72
+ };
73
+ return {
74
+ code: result.code,
75
+ map
76
+ };
84
77
  }
85
78
  //#endregion
86
79
  export { babelPlugin as babel };
@@ -1,10 +1,9 @@
1
1
  import "../../common/logger.js";
2
2
  import { RollupLogWithString } from "@rollipop/rolldown";
3
3
  //#region src/core/plugins/context.d.ts
4
- interface PluginContext {
4
+ export interface PluginContext {
5
5
  debug: (log: RollupLogWithString) => void;
6
6
  info: (log: RollupLogWithString) => void;
7
7
  warn: (log: RollupLogWithString) => void;
8
8
  }
9
- //#endregion
10
- export { PluginContext };
9
+ //#endregion
@@ -4,7 +4,7 @@ import { ResolvedConfig } from "../../config/defaults.js";
4
4
  import { RollipopReactRefreshWrapperPluginConfig } from "@rollipop/rolldown/experimental";
5
5
  import * as rolldown from "@rollipop/rolldown";
6
6
  //#region src/core/plugins/dev-server-plugin.d.ts
7
- interface DevServerPluginOptions {
7
+ export interface DevServerPluginOptions {
8
8
  cwd: string;
9
9
  id: string;
10
10
  origin?: string;
@@ -15,9 +15,9 @@ interface DevServerPluginOptions {
15
15
  reactRefreshFilter?: ReactRefreshFilter;
16
16
  sourceMapUrl?: string;
17
17
  }
18
- type ReactRefreshFilter = Pick<RollipopReactRefreshWrapperPluginConfig, 'include' | 'exclude'>;
19
- declare const DEFAULT_REACT_REFRESH_INCLUDE_PATTERNS: RegExp[];
20
- declare const DEFAULT_REACT_REFRESH_EXCLUDE_PATTERNS: RegExp[];
18
+ export type ReactRefreshFilter = Pick<RollipopReactRefreshWrapperPluginConfig, 'include' | 'exclude'>;
19
+ export declare const DEFAULT_REACT_REFRESH_INCLUDE_PATTERNS: RegExp[];
20
+ export declare const DEFAULT_REACT_REFRESH_EXCLUDE_PATTERNS: RegExp[];
21
21
  declare function devServerPlugin(options: DevServerPluginOptions): Promise<rolldown.Plugin[] | null>;
22
22
  //#endregion
23
- export { DEFAULT_REACT_REFRESH_EXCLUDE_PATTERNS, DEFAULT_REACT_REFRESH_INCLUDE_PATTERNS, DevServerPluginOptions, ReactRefreshFilter, devServerPlugin as devServer };
23
+ export { devServerPlugin as devServer };
@@ -24,10 +24,11 @@ async function devServerPlugin(options) {
24
24
  }, sourceMapUrl } = options;
25
25
  const plugins = [sourceMapUrlPlugin(sourceMapUrl)];
26
26
  if (hmrConfig != null) {
27
+ const resolvedHmrClientPath = resolveFrom(cwd, typeof hmrClientPath === "function" ? await hmrClientPath(cwd) : hmrClientPath);
27
28
  const replaceHMRClientPlugin = {
28
29
  name: "rollipop:replace-hmr-client",
29
30
  load: {
30
- filter: [include(id(exactRegex(resolveFrom(cwd, typeof hmrClientPath === "function" ? await hmrClientPath(cwd) : hmrClientPath))))],
31
+ filter: [include(id(exactRegex(resolvedHmrClientPath)))],
31
32
  handler(id) {
32
33
  this.debug(`Replacing HMR client: ${id}`);
33
34
  return {
@@ -1,10 +1,10 @@
1
1
  import * as rolldown from "@rollipop/rolldown";
2
2
  //#region src/core/plugins/entry-plugin.d.ts
3
- interface EntryPluginOptions {
3
+ export interface EntryPluginOptions {
4
4
  id: string;
5
5
  entryPath: string;
6
6
  preludePaths?: string[];
7
7
  }
8
8
  declare function entryPlugin(options: EntryPluginOptions): rolldown.Plugin[];
9
9
  //#endregion
10
- export { EntryPluginOptions, entryPlugin as entry };
10
+ export { entryPlugin as entry };
@@ -1,10 +1,10 @@
1
1
  import * as rolldown from "@rollipop/rolldown";
2
2
  //#region src/core/plugins/import-glob-plugin.d.ts
3
- interface ImportGlobPluginOptions {
3
+ export interface ImportGlobPluginOptions {
4
4
  root?: string;
5
5
  sourcemap?: boolean;
6
6
  restoreQueryExtension?: boolean;
7
7
  }
8
8
  declare function importGlobPlugin(options: ImportGlobPluginOptions): rolldown.Plugin;
9
9
  //#endregion
10
- export { ImportGlobPluginOptions, importGlobPlugin as importGlob };
10
+ export { importGlobPlugin as importGlob };
@@ -7,8 +7,9 @@ import { DEFAULT_REACT_REFRESH_EXCLUDE_PATTERNS, DEFAULT_REACT_REFRESH_INCLUDE_P
7
7
  import { AnalyzePluginOptions, analyze as analyzePlugin } from "./analyze-plugin.js";
8
8
  import { ImportGlobPluginOptions, importGlob as importGlobPlugin } from "./import-glob-plugin.js";
9
9
  import { AliasEntry, AliasPluginOptions, alias as aliasPlugin } from "./alias-plugin.js";
10
+ import { ResolutionTopologyPluginOptions, resolutionTopology as resolutionTopologyPlugin } from "./resolution-topology-plugin.js";
10
11
  declare namespace index_d_exports {
11
- export { AliasEntry, AliasPluginOptions, AnalyzePluginOptions, BabelPluginOptions, DEFAULT_REACT_REFRESH_EXCLUDE_PATTERNS, DEFAULT_REACT_REFRESH_INCLUDE_PATTERNS, DevServerPluginOptions, EntryPluginOptions, ImportGlobPluginOptions, ReactNativePluginOptions, ReactRefreshFilter, ReporterPluginOptions, SwcPluginOptions, aliasPlugin as alias, analyzePlugin as analyze, babelPlugin as babel, devServerPlugin as devServer, entryPlugin as entry, importGlobPlugin as importGlob, reactNativePlugin as reactNative, reporterPlugin as reporter, swcPlugin as swc };
12
+ export { AliasEntry, AliasPluginOptions, AnalyzePluginOptions, BabelPluginOptions, DEFAULT_REACT_REFRESH_EXCLUDE_PATTERNS, DEFAULT_REACT_REFRESH_INCLUDE_PATTERNS, DevServerPluginOptions, EntryPluginOptions, ImportGlobPluginOptions, ReactNativePluginOptions, ReactRefreshFilter, ReporterPluginOptions, ResolutionTopologyPluginOptions, SwcPluginOptions, aliasPlugin as alias, analyzePlugin as analyze, babelPlugin as babel, devServerPlugin as devServer, entryPlugin as entry, importGlobPlugin as importGlob, reactNativePlugin as reactNative, reporterPlugin as reporter, resolutionTopologyPlugin as resolutionTopology, swcPlugin as swc };
12
13
  }
13
14
  //#endregion
14
- export { AliasEntry, AliasPluginOptions, AnalyzePluginOptions, BabelPluginOptions, DEFAULT_REACT_REFRESH_EXCLUDE_PATTERNS, DEFAULT_REACT_REFRESH_INCLUDE_PATTERNS, DevServerPluginOptions, EntryPluginOptions, ImportGlobPluginOptions, ReactNativePluginOptions, ReactRefreshFilter, ReporterPluginOptions, SwcPluginOptions, aliasPlugin as alias, analyzePlugin as analyze, babelPlugin as babel, devServerPlugin as devServer, entryPlugin as entry, importGlobPlugin as importGlob, index_d_exports, reactNativePlugin as reactNative, reporterPlugin as reporter, swcPlugin as swc };
15
+ export { AliasEntry, AliasPluginOptions, AnalyzePluginOptions, BabelPluginOptions, DEFAULT_REACT_REFRESH_EXCLUDE_PATTERNS, DEFAULT_REACT_REFRESH_INCLUDE_PATTERNS, DevServerPluginOptions, EntryPluginOptions, ImportGlobPluginOptions, ReactNativePluginOptions, ReactRefreshFilter, ReporterPluginOptions, ResolutionTopologyPluginOptions, SwcPluginOptions, aliasPlugin as alias, analyzePlugin as analyze, babelPlugin as babel, devServerPlugin as devServer, entryPlugin as entry, importGlobPlugin as importGlob, index_d_exports, reactNativePlugin as reactNative, reporterPlugin as reporter, resolutionTopologyPlugin as resolutionTopology, swcPlugin as swc };
@@ -8,6 +8,7 @@ import { DEFAULT_REACT_REFRESH_EXCLUDE_PATTERNS, DEFAULT_REACT_REFRESH_INCLUDE_P
8
8
  import { analyze as analyzePlugin } from "./analyze-plugin.js";
9
9
  import { importGlob as importGlobPlugin } from "./import-glob-plugin.js";
10
10
  import { alias as aliasPlugin } from "./alias-plugin.js";
11
+ import { resolutionTopology as resolutionTopologyPlugin } from "./resolution-topology-plugin.js";
11
12
  //#region src/core/plugins/index.ts
12
13
  var plugins_exports = /* @__PURE__ */ __exportAll({
13
14
  DEFAULT_REACT_REFRESH_EXCLUDE_PATTERNS: () => DEFAULT_REACT_REFRESH_EXCLUDE_PATTERNS,
@@ -20,7 +21,8 @@ var plugins_exports = /* @__PURE__ */ __exportAll({
20
21
  importGlob: () => importGlobPlugin,
21
22
  reactNative: () => reactNativePlugin,
22
23
  reporter: () => reporterPlugin,
24
+ resolutionTopology: () => resolutionTopologyPlugin,
23
25
  swc: () => swcPlugin
24
26
  });
25
27
  //#endregion
26
- export { DEFAULT_REACT_REFRESH_EXCLUDE_PATTERNS, DEFAULT_REACT_REFRESH_INCLUDE_PATTERNS, aliasPlugin as alias, analyzePlugin as analyze, babelPlugin as babel, devServerPlugin as devServer, entryPlugin as entry, importGlobPlugin as importGlob, plugins_exports, reactNativePlugin as reactNative, reporterPlugin as reporter, swcPlugin as swc };
28
+ export { DEFAULT_REACT_REFRESH_EXCLUDE_PATTERNS, DEFAULT_REACT_REFRESH_INCLUDE_PATTERNS, aliasPlugin as alias, analyzePlugin as analyze, babelPlugin as babel, devServerPlugin as devServer, entryPlugin as entry, importGlobPlugin as importGlob, plugins_exports, reactNativePlugin as reactNative, reporterPlugin as reporter, resolutionTopologyPlugin as resolutionTopology, swcPlugin as swc };
@@ -1,9 +1,8 @@
1
1
  import { BuildType, BundlerContext } from "../types.js";
2
2
  import { RollipopReactNativePluginConfig } from "@rollipop/rolldown/experimental";
3
3
  import * as rolldown from "@rollipop/rolldown";
4
- import { TopLevelFilterExpression } from "@rollipop/rolldown/filter";
5
4
  //#region src/core/plugins/react-native-plugin.d.ts
6
- interface ReactNativePluginOptions {
5
+ export interface ReactNativePluginOptions {
7
6
  context: BundlerContext;
8
7
  projectRoot: string;
9
8
  platform: string;
@@ -12,24 +11,9 @@ interface ReactNativePluginOptions {
12
11
  assetsDir?: string;
13
12
  assetExtensions: string[];
14
13
  assetRegistryPath: string;
15
- /**
16
- * Native pipeline configuration. When `null`, the legacy JS plugins
17
- * (codegen marker + Flow strip) are installed instead.
18
- *
19
- * @internal builtin plugin config
20
- */
21
- builtinPluginConfig: RollipopReactNativePluginConfig | null;
22
- /**
23
- * Filter for the legacy Flow-strip transform pipeline. Used when the
24
- * native pipeline is disabled.
25
- */
26
- flowFilter: rolldown.HookFilter | TopLevelFilterExpression[];
27
- /**
28
- * Filter for the legacy codegen marker pipeline. Used when the native
29
- * pipeline is disabled.
30
- */
31
- codegenFilter: rolldown.HookFilter | TopLevelFilterExpression[];
14
+ /** @internal builtin plugin config */
15
+ builtinPluginConfig: RollipopReactNativePluginConfig;
32
16
  }
33
17
  declare function reactNativePlugin(options: ReactNativePluginOptions): rolldown.Plugin[];
34
18
  //#endregion
35
- export { ReactNativePluginOptions, reactNativePlugin as reactNative };
19
+ export { reactNativePlugin as reactNative };
@@ -1,43 +1,10 @@
1
- import { stripFlowTypes } from "../../common/transformer.js";
2
1
  import { copyAssetsToDestination, generateAssetRegistryCode, resolveScaledAssets } from "../assets.js";
3
- import { getFlag, setFlag } from "./utils/transform-utils.js";
2
+ import { setFlag } from "./utils/transform-utils.js";
4
3
  import { rollipopReactNativePlugin } from "@rollipop/rolldown/experimental";
5
4
  import { id, include } from "@rollipop/rolldown/filter";
6
5
  //#region src/core/plugins/react-native-plugin.ts
7
6
  function reactNativePlugin(options) {
8
- const { projectRoot, platform, preferNativePlatform, buildType, context, assetsDir, assetExtensions, assetRegistryPath, flowFilter, codegenFilter, builtinPluginConfig } = options;
9
- const codegenPlugin = {
10
- name: "rollipop:react-native-codegen-marker",
11
- transform: {
12
- order: "pre",
13
- filter: codegenFilter,
14
- handler(_code, id) {
15
- return { meta: setFlag.call(this, context, id, 1) };
16
- }
17
- }
18
- };
19
- const stripFlowSyntaxPlugin = {
20
- name: "rollipop:react-native-strip-flow-syntax",
21
- transform: {
22
- order: "pre",
23
- filter: flowFilter,
24
- async handler(code, id) {
25
- const flags = getFlag.call(this, context, id);
26
- if (flags & 128) return;
27
- if (flags & 1) return { meta: setFlag.call(this, context, id, 2) };
28
- const result = await stripFlowTypes(id, code);
29
- return {
30
- code: result.code,
31
- map: result.map,
32
- /**
33
- * Treat the transformed code as TSX code
34
- * because Flow modules can be `.js` files with type annotations and JSX syntax.
35
- */
36
- moduleType: "tsx"
37
- };
38
- }
39
- }
40
- };
7
+ const { projectRoot, platform, preferNativePlatform, buildType, context, assetsDir, assetExtensions, assetRegistryPath, builtinPluginConfig } = options;
41
8
  const assets = [];
42
9
  const assetPlugin = {
43
10
  name: "rollipop:react-native-asset",
@@ -75,7 +42,7 @@ function reactNativePlugin(options) {
75
42
  }
76
43
  }
77
44
  };
78
- return [...builtinPluginConfig ? [rollipopReactNativePlugin(builtinPluginConfig)] : [codegenPlugin, stripFlowSyntaxPlugin], assetPlugin];
45
+ return [rollipopReactNativePlugin(builtinPluginConfig), assetPlugin];
79
46
  }
80
47
  //#endregion
81
48
  export { reactNativePlugin as reactNative };
@@ -1,10 +1,10 @@
1
1
  import { EventBus } from "../../events/event-bus.js";
2
2
  import * as rolldown from "@rollipop/rolldown";
3
3
  //#region src/core/plugins/reporter-plugin.d.ts
4
- interface ReporterPluginOptions {
4
+ export interface ReporterPluginOptions {
5
5
  initialTotalModules?: number;
6
6
  eventBus?: EventBus;
7
7
  }
8
8
  declare function reporterPlugin(options?: ReporterPluginOptions): rolldown.Plugin | null;
9
9
  //#endregion
10
- export { ReporterPluginOptions, reporterPlugin as reporter };
10
+ export { reporterPlugin as reporter };
@@ -0,0 +1,11 @@
1
+ import { PluginWithHotUpdate } from "../../types.js";
2
+ import * as rolldown from "@rollipop/rolldown";
3
+ //#region src/core/plugins/resolution-topology-plugin.d.ts
4
+ export interface ResolutionTopologyPluginOptions {
5
+ root: string;
6
+ resolve: NonNullable<rolldown.InputOptions['resolve']>;
7
+ tsconfig?: boolean | string;
8
+ }
9
+ declare function resolutionTopologyPlugin(options?: ResolutionTopologyPluginOptions): PluginWithHotUpdate | null;
10
+ //#endregion
11
+ export { resolutionTopologyPlugin as resolutionTopology };