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.
- package/client.d.ts +5 -1
- package/dist/_virtual/_rolldown/runtime.js +1 -1
- package/dist/commands.js +4 -4
- package/dist/common/code.js +1 -1
- package/dist/common/env.js +1 -1
- package/dist/common/logger.d.ts +0 -1
- package/dist/common/logger.js +1 -1
- package/dist/common/progress-bar.js +19 -8
- package/dist/config/compose-override.js +8 -10
- package/dist/config/defaults.d.ts +14 -18
- package/dist/config/defaults.js +20 -19
- package/dist/config/define-config.d.ts +0 -1
- package/dist/config/index.d.ts +5 -3
- package/dist/config/index.js +5 -5
- package/dist/config/load-config.d.ts +2 -3
- package/dist/config/load-config.js +3 -3
- package/dist/config/merge-config.d.ts +1 -2
- package/dist/config/merge-config.js +11 -6
- package/dist/config/notice.js +1 -1
- package/dist/config/types.d.ts +67 -190
- package/dist/constants.d.ts +3 -2
- package/dist/constants.js +4 -2
- package/dist/core/analyze.js +1 -1
- package/dist/core/assets.d.ts +1 -1
- package/dist/core/assets.js +2 -2
- package/dist/core/bundler.d.ts +1 -2
- package/dist/core/bundler.js +28 -17
- package/dist/core/env.d.ts +1 -0
- package/dist/core/plugins/alias-plugin.d.ts +12 -0
- package/dist/core/plugins/alias-plugin.js +8 -0
- package/dist/core/plugins/analyze-plugin.d.ts +2 -2
- package/dist/core/plugins/analyze-plugin.js +1 -1
- package/dist/core/plugins/babel-plugin.d.ts +5 -9
- package/dist/core/plugins/babel-plugin.js +15 -3
- package/dist/core/plugins/context.d.ts +1 -1
- package/dist/core/plugins/context.js +1 -1
- package/dist/core/plugins/dev-server-plugin.d.ts +13 -3
- package/dist/core/plugins/dev-server-plugin.js +65 -19
- package/dist/core/plugins/entry-plugin.d.ts +3 -3
- package/dist/core/plugins/entry-plugin.js +34 -6
- package/dist/core/plugins/import-glob-plugin.d.ts +10 -0
- package/dist/core/plugins/import-glob-plugin.js +7 -0
- package/dist/core/plugins/index.d.ts +11 -11
- package/dist/core/plugins/index.js +14 -8
- package/dist/core/plugins/react-native-plugin.d.ts +2 -3
- package/dist/core/plugins/react-native-plugin.js +1 -1
- package/dist/core/plugins/reporter-plugin.d.ts +3 -4
- package/dist/core/plugins/reporter-plugin.js +6 -6
- package/dist/core/plugins/swc-plugin.d.ts +5 -10
- package/dist/core/plugins/swc-plugin.js +1 -1
- package/dist/core/plugins/types.d.ts +3 -2
- package/dist/core/plugins/utils/transform-utils.js +1 -1
- package/dist/core/rolldown.d.ts +16 -0
- package/dist/core/rolldown.js +147 -100
- package/dist/core/settings.js +1 -1
- package/dist/core/types.d.ts +13 -3
- package/dist/events/builtin-reporters.js +125 -0
- package/dist/events/consumers.js +35 -0
- package/dist/events/event-bus.d.ts +10 -0
- package/dist/{server/events → events}/event-bus.js +2 -3
- package/dist/events/types.d.ts +94 -0
- package/dist/events/utils.js +6 -0
- package/dist/hmr-runtime.iife.js +436 -84
- package/dist/index.d.ts +18 -11
- package/dist/index.js +12 -5
- package/dist/internal/react-native.js +2 -5
- package/dist/node/cli-utils.d.ts +1 -2
- package/dist/node/cli-utils.js +2 -2
- package/dist/node/cli.d.ts +1 -1
- package/dist/node/cli.js +1 -1
- package/dist/node/commands/agent/index.js +2 -2
- package/dist/node/commands/bundle/action.js +3 -3
- package/dist/node/commands/bundle/command.js +4 -2
- package/dist/node/commands/bundle/index.js +2 -2
- package/dist/node/commands/skills/action.js +1 -1
- package/dist/node/commands/start/action.js +4 -5
- package/dist/node/commands/start/command.js +4 -2
- package/dist/node/commands/start/index.js +2 -2
- package/dist/node/commands/start/setup-interactive-mode.d.ts +1 -0
- package/dist/node/commands/start/setup-interactive-mode.js +1 -1
- package/dist/node/types.d.ts +1 -1
- package/dist/package.js +1 -1
- package/dist/{chunk-DJV587Yu.js → rolldown-runtime-CYsRbd_x.js} +1 -1
- package/dist/runtime.d.ts +2 -0
- package/dist/runtime.js +1 -1
- package/dist/server/bundle-url.js +16 -0
- package/dist/server/bundle.d.ts +0 -1
- package/dist/server/bundle.js +3 -3
- package/dist/server/bundler-pool.d.ts +11 -6
- package/dist/server/bundler-pool.js +55 -45
- package/dist/server/common/schema.js +0 -2
- package/dist/server/create-dev-server.js +28 -51
- package/dist/server/hot-update-store.d.ts +20 -0
- package/dist/server/hot-update-store.js +109 -0
- package/dist/server/index.d.ts +7 -2
- package/dist/server/index.js +8 -3
- package/dist/server/mcp/server.js +3 -12
- package/dist/server/mcp/tools/index.js +2 -2
- package/dist/server/middlewares/dashboard.js +2 -2
- package/dist/server/middlewares/serve-assets.js +5 -13
- package/dist/server/middlewares/serve-bundle.js +3 -3
- package/dist/server/middlewares/serve-hot-updates.js +25 -0
- package/dist/server/middlewares/sse.js +1 -1
- package/dist/server/middlewares/symbolicate.js +9 -1
- package/dist/server/rest/data.js +8 -4
- package/dist/server/rest/domains/actions.js +2 -2
- package/dist/server/rest/{serializers.js → formatters.js} +22 -11
- package/dist/server/rest/index.js +1 -1
- package/dist/server/sse/adapter.js +3 -6
- package/dist/server/sse/types.d.ts +45 -0
- package/dist/server/state/store.d.ts +4 -7
- package/dist/server/state/store.js +6 -5
- package/dist/server/types.d.ts +6 -5
- package/dist/server/wss/hmr-server.js +73 -48
- package/dist/server/wss/server.d.ts +1 -1
- package/dist/storage/file-storage.d.ts +2 -4
- package/dist/storage/file-storage.js +1 -1
- package/dist/types/hmr.d.ts +9 -5
- package/dist/types.d.ts +3 -65
- package/dist/utils/build-options.d.ts +2 -1
- package/dist/utils/config.d.ts +6 -2
- package/dist/utils/config.js +3 -3
- package/dist/utils/hash.js +0 -1
- package/dist/utils/id.js +19 -9
- package/dist/utils/reporters.js +1 -113
- package/dist/utils/reset-cache.d.ts +2 -3
- package/dist/utils/reset-cache.js +4 -19
- package/dist/utils/run-server.js +2 -3
- package/dist/utils/serialize.js +1 -0
- package/dist/utils/source-map.js +22 -0
- package/dist/utils/storage.js +1 -0
- package/dist/utils/string.js +36 -1
- package/dist/utils/terminal.js +1 -1
- package/dist/utils/url.js +1 -1
- package/import-glob.d.ts +129 -0
- package/package.json +27 -28
- package/skills/configuration.md +4 -4
- package/skills/core.md +2 -2
- package/skills/migration.md +1 -1
- package/skills/troubleshooting.md +3 -3
- package/src/runtime/__tests__/hmr-runtime.spec.ts +312 -0
- package/src/runtime/hmr-client.ts +130 -100
- package/src/runtime/hmr-runtime.ts +357 -53
- package/dist/server/create-dev-server.d.ts +0 -6
- package/dist/server/events/event-bus.d.ts +0 -12
- package/dist/server/events/types.d.ts +0 -37
- package/dist/server/events/types.js +0 -6
- package/dist/utils/run-build.d.ts +0 -8
- package/dist/utils/run-server.d.ts +0 -6
- 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
|
-
|
|
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 = /*
|
|
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/
|
|
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
|
package/dist/common/code.js
CHANGED
package/dist/common/env.js
CHANGED
package/dist/common/logger.d.ts
CHANGED
package/dist/common/logger.js
CHANGED
|
@@ -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
|
|
40
|
-
|
|
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(
|
|
107
|
+
completeHmr(moduleIds, count) {
|
|
103
108
|
this.state = {
|
|
104
109
|
type: "hmr-completed",
|
|
105
110
|
count,
|
|
106
|
-
|
|
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
|
|
4
|
-
if (typeof
|
|
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
|
|
7
|
+
function composeRolldownOptions(target, source) {
|
|
11
8
|
if (source == null) return target;
|
|
12
9
|
if (target == null) return source;
|
|
13
|
-
|
|
14
|
-
|
|
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 {
|
|
16
|
+
export { applyRolldownOptionsConfig, composeRolldownOptions };
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { Reporter } from "../types.js";
|
|
2
|
-
import { AnalyzerConfig, Config,
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
|
|
53
|
-
|
|
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>;
|
package/dist/config/defaults.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
29
|
+
transform: { flow: { filter: {
|
|
30
30
|
id: /\.jsx?$/,
|
|
31
31
|
code: /@flow/
|
|
32
32
|
} } },
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
|
|
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,
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
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
|
-
|
|
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 };
|
package/dist/config/index.js
CHANGED
|
@@ -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
|
|
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
|
|
66
|
-
if (
|
|
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 {
|
|
2
|
-
import {
|
|
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")
|
|
15
|
-
|
|
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
|
}
|
package/dist/config/notice.js
CHANGED
|
@@ -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.
|
|
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 };
|