rollipop 1.0.0-alpha.28 → 1.0.0-alpha.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/index.js +7 -2
- 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 +7 -5
- package/dist/common/logger.js +6 -4
- package/dist/common/progress-bar.js +25 -8
- package/dist/config/compose-override.js +9 -11
- package/dist/config/defaults.d.ts +26 -50
- package/dist/config/defaults.js +23 -34
- package/dist/config/define-config.d.ts +5 -7
- package/dist/config/index.d.ts +5 -3
- package/dist/config/index.js +5 -5
- package/dist/config/load-config.d.ts +9 -11
- package/dist/config/load-config.js +5 -4
- package/dist/config/merge-config.d.ts +5 -7
- package/dist/config/merge-config.js +11 -6
- package/dist/config/notice.js +1 -1
- package/dist/config/types.d.ts +56 -261
- package/dist/constants.d.ts +19 -18
- package/dist/constants.js +4 -2
- package/dist/core/analyze.js +1 -1
- package/dist/core/assets.d.ts +15 -15
- package/dist/core/assets.js +2 -2
- package/dist/core/bundler.d.ts +3 -5
- package/dist/core/bundler.js +30 -21
- package/dist/core/env.d.ts +4 -4
- package/dist/core/plugins/alias-plugin.d.ts +3 -4
- package/dist/core/plugins/alias-plugin.js +1 -1
- package/dist/core/plugins/analyze-plugin.d.ts +3 -3
- package/dist/core/plugins/analyze-plugin.js +1 -1
- package/dist/core/plugins/babel-plugin.d.ts +6 -16
- package/dist/core/plugins/babel-plugin.js +55 -50
- package/dist/core/plugins/context.d.ts +3 -4
- package/dist/core/plugins/context.js +1 -1
- package/dist/core/plugins/dev-server-plugin.d.ts +13 -5
- package/dist/core/plugins/dev-server-plugin.js +63 -18
- package/dist/core/plugins/entry-plugin.d.ts +4 -4
- package/dist/core/plugins/entry-plugin.js +34 -6
- package/dist/core/plugins/import-glob-plugin.d.ts +2 -3
- package/dist/core/plugins/import-glob-plugin.js +1 -1
- package/dist/core/plugins/index.d.ts +12 -13
- package/dist/core/plugins/index.js +12 -10
- package/dist/core/plugins/react-native-plugin.d.ts +4 -21
- package/dist/core/plugins/react-native-plugin.js +4 -37
- package/dist/core/plugins/reporter-plugin.d.ts +4 -5
- package/dist/core/plugins/reporter-plugin.js +6 -6
- package/dist/core/plugins/resolution-topology-plugin.d.ts +11 -0
- package/dist/core/plugins/resolution-topology-plugin.js +318 -0
- package/dist/core/plugins/shared/filters.js +16 -3
- package/dist/core/plugins/swc-plugin.d.ts +6 -20
- package/dist/core/plugins/swc-plugin.js +45 -66
- package/dist/core/plugins/types.d.ts +20 -7
- package/dist/core/plugins/utils/transform-utils.js +3 -5
- package/dist/core/rolldown.d.ts +15 -0
- package/dist/core/rolldown.js +138 -121
- package/dist/core/settings.js +4 -3
- package/dist/core/types.d.ts +21 -11
- package/dist/events/builtin-reporters.js +132 -0
- package/dist/events/consumers.js +33 -0
- package/dist/events/event-bus.d.ts +9 -0
- package/dist/{server/events → events}/event-bus.js +2 -3
- package/dist/events/types.d.ts +93 -0
- package/dist/events/utils.js +6 -0
- package/dist/hmr-runtime.iife.js +581 -94
- package/dist/index.d.ts +16 -10
- package/dist/index.js +11 -4
- package/dist/internal/react-native.js +2 -1
- package/dist/node/cli-utils.d.ts +3 -4
- 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/action.js +11 -30
- package/dist/node/commands/agent/index.js +2 -2
- package/dist/node/commands/bundle/action.js +2 -2
- 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 +12 -8
- package/dist/node/commands/start/command.js +4 -6
- package/dist/node/commands/start/debugger.js +2 -2
- package/dist/node/commands/start/index.js +2 -2
- package/dist/node/commands/start/setup-interactive-mode.d.ts +7 -7
- package/dist/node/commands/start/setup-interactive-mode.js +5 -5
- package/dist/node/types.d.ts +6 -7
- package/dist/package.js +1 -1
- package/dist/{chunk-DJV587Yu.js → rolldown-runtime-BHXq-rbM.js} +4 -4
- 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 +2 -4
- package/dist/server/bundle.js +10 -5
- package/dist/server/bundler-pool.d.ts +18 -14
- package/dist/server/bundler-pool.js +90 -60
- package/dist/server/common/schema.js +0 -2
- package/dist/server/constants.d.ts +4 -5
- package/dist/server/create-dev-server.js +37 -55
- package/dist/server/{mcp → devframe/agent}/context.js +3 -3
- package/dist/server/{mcp → devframe/agent}/tools/app-log-diagnostics.js +1 -1
- package/dist/server/{mcp → devframe/agent}/tools/build-diagnostics.js +7 -9
- package/dist/server/devframe/agent/tools/build-info.js +11 -0
- package/dist/server/{mcp → devframe/agent}/tools/client-diagnostics.js +1 -1
- package/dist/server/{mcp → devframe/agent}/tools/index.js +51 -74
- package/dist/server/{rest → devframe}/data.js +9 -9
- package/dist/server/{rest → devframe}/devtools-targets.js +1 -1
- package/dist/server/{sse/adapter.js → devframe/events.js} +6 -17
- package/dist/server/{rest/serializers.js → devframe/formatters.js} +22 -11
- package/dist/server/devframe/index.js +218 -0
- package/dist/server/devframe/setup.js +98 -0
- package/dist/server/hot-update-store.d.ts +19 -0
- package/dist/server/hot-update-store.js +109 -0
- package/dist/server/index.d.ts +6 -2
- package/dist/server/index.js +8 -3
- package/dist/server/middlewares/dashboard.js +4 -3
- package/dist/server/middlewares/serve-assets.js +5 -13
- package/dist/server/middlewares/serve-bundle.js +4 -4
- package/dist/server/middlewares/serve-hot-updates.js +25 -0
- package/dist/server/middlewares/symbolicate.js +9 -1
- package/dist/server/state/store.d.ts +11 -15
- package/dist/server/state/store.js +7 -10
- package/dist/server/types.d.ts +13 -14
- package/dist/server/wss/hmr-server.js +75 -55
- package/dist/server/wss/server.d.ts +3 -4
- package/dist/storage/file-storage.d.ts +4 -7
- package/dist/storage/file-storage.js +3 -3
- package/dist/types/hmr.d.ts +17 -14
- package/dist/types.d.ts +17 -69
- package/dist/utils/babel.js +2 -2
- package/dist/utils/build-options.d.ts +6 -6
- package/dist/utils/build-options.js +8 -7
- package/dist/utils/config.d.ts +7 -4
- package/dist/utils/config.js +3 -3
- package/dist/utils/dev-server.js +0 -1
- 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/run-server.js +2 -8
- package/dist/utils/serialize.js +1 -0
- package/dist/utils/server.js +6 -1
- 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/swc.js +2 -2
- package/dist/utils/terminal.js +1 -1
- package/dist/utils/transform.js +5 -2
- package/dist/utils/url.js +1 -1
- package/package.json +45 -37
- package/skills/configuration.md +4 -4
- package/skills/core.md +3 -3
- package/skills/debugging.md +2 -6
- package/skills/dev-server.md +2 -6
- package/skills/migration.md +1 -1
- package/skills/troubleshooting.md +4 -4
- package/src/runtime/__tests__/hmr-runtime.spec.ts +562 -0
- package/src/runtime/hmr-client.ts +132 -97
- package/src/runtime/hmr-runtime.ts +381 -54
- package/dist/core/plugins/utils/source.js +0 -10
- 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/server/mcp/server.js +0 -86
- package/dist/server/mcp/tools/build-info.js +0 -11
- package/dist/server/middlewares/sse.js +0 -36
- package/dist/server/rest/domains/actions.js +0 -24
- package/dist/server/rest/domains/builds.js +0 -37
- package/dist/server/rest/domains/bundlers.js +0 -30
- package/dist/server/rest/domains/config.js +0 -14
- package/dist/server/rest/domains/dev-server.js +0 -14
- package/dist/server/rest/domains/devices.js +0 -20
- package/dist/server/rest/domains/feature-flags.js +0 -14
- package/dist/server/rest/domains/snapshot.js +0 -14
- package/dist/server/rest/index.js +0 -56
- package/dist/server/rest/response.js +0 -9
- package/dist/server/sse/event-bus.js +0 -26
- package/dist/utils/promise.js +0 -15
- 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/bin/index.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import module from 'node:module';
|
|
4
4
|
|
|
5
|
-
|
|
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);
|
|
@@ -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
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { ChalkInstance } from "chalk";
|
|
2
|
-
|
|
3
2
|
//#region src/common/logger.d.ts
|
|
4
|
-
|
|
3
|
+
export interface LoggerOptions {
|
|
4
|
+
forcePrint?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare class Logger {
|
|
5
7
|
private readonly scope?;
|
|
8
|
+
private readonly options?;
|
|
6
9
|
private static blocked;
|
|
7
10
|
private static queuedMessages;
|
|
8
11
|
static Colors: {
|
|
@@ -17,7 +20,7 @@ declare class Logger {
|
|
|
17
20
|
private debugEnabled;
|
|
18
21
|
static block(): void;
|
|
19
22
|
static unblock(flush?: boolean): void;
|
|
20
|
-
constructor(scope?: string | undefined);
|
|
23
|
+
constructor(scope?: string | undefined, options?: LoggerOptions | undefined);
|
|
21
24
|
getFormat(): string;
|
|
22
25
|
setFormat(format: string): void;
|
|
23
26
|
private getTimestamp;
|
|
@@ -30,5 +33,4 @@ declare class Logger {
|
|
|
30
33
|
error(...args: unknown[]): void;
|
|
31
34
|
child(scope: string): Logger;
|
|
32
35
|
}
|
|
33
|
-
//#endregion
|
|
34
|
-
export { Logger };
|
|
36
|
+
//#endregion
|
package/dist/common/logger.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { isDebugEnabled } from "./env.js";
|
|
2
|
-
import { invariant } from "es-toolkit";
|
|
3
2
|
import chalk from "chalk";
|
|
4
3
|
import dayjs from "dayjs";
|
|
4
|
+
import { invariant } from "es-toolkit";
|
|
5
5
|
//#region src/common/logger.ts
|
|
6
6
|
var Logger = class Logger {
|
|
7
7
|
scope;
|
|
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);
|
|
@@ -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,21 @@ 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,
|
|
49
|
+
cancelled: { render: () => "" },
|
|
45
50
|
running: runningRenderer,
|
|
46
51
|
completed: completedRenderer,
|
|
47
|
-
"hmr-completed": hmrCompletedRenderer
|
|
52
|
+
"hmr-completed": hmrCompletedRenderer,
|
|
53
|
+
"hmr-failed": hmrFailedRenderer
|
|
48
54
|
};
|
|
49
55
|
render(state, context) {
|
|
50
56
|
return this.renderers[state.type].render(state, context);
|
|
@@ -64,7 +70,7 @@ var ProgressBar = class {
|
|
|
64
70
|
this.renderer = options.renderer ?? new ProgressBarRenderer();
|
|
65
71
|
}
|
|
66
72
|
get done() {
|
|
67
|
-
return this.state.type === "completed" || this.state.type === "hmr-completed";
|
|
73
|
+
return this.state.type === "cancelled" || this.state.type === "completed" || this.state.type === "hmr-completed" || this.state.type === "hmr-failed";
|
|
68
74
|
}
|
|
69
75
|
setCurrent(current) {
|
|
70
76
|
this.current = current;
|
|
@@ -81,6 +87,11 @@ var ProgressBar = class {
|
|
|
81
87
|
this.stale = true;
|
|
82
88
|
return this;
|
|
83
89
|
}
|
|
90
|
+
cancel() {
|
|
91
|
+
this.state = { type: "cancelled" };
|
|
92
|
+
this.stale = true;
|
|
93
|
+
return this;
|
|
94
|
+
}
|
|
84
95
|
setModuleId(moduleId) {
|
|
85
96
|
if (this.state.type !== "running") return this;
|
|
86
97
|
this.state = {
|
|
@@ -99,15 +110,20 @@ var ProgressBar = class {
|
|
|
99
110
|
this.stale = true;
|
|
100
111
|
return this;
|
|
101
112
|
}
|
|
102
|
-
completeHmr(
|
|
113
|
+
completeHmr(moduleIds, count) {
|
|
103
114
|
this.state = {
|
|
104
115
|
type: "hmr-completed",
|
|
105
116
|
count,
|
|
106
|
-
|
|
117
|
+
moduleIds
|
|
107
118
|
};
|
|
108
119
|
this.stale = true;
|
|
109
120
|
return this;
|
|
110
121
|
}
|
|
122
|
+
failHmr() {
|
|
123
|
+
this.state = { type: "hmr-failed" };
|
|
124
|
+
this.stale = true;
|
|
125
|
+
return this;
|
|
126
|
+
}
|
|
111
127
|
render() {
|
|
112
128
|
this.stale = false;
|
|
113
129
|
const context = {
|
|
@@ -145,6 +161,7 @@ var ProgressBarRenderManager = class ProgressBarRenderManager {
|
|
|
145
161
|
return progressBar;
|
|
146
162
|
}
|
|
147
163
|
start() {
|
|
164
|
+
this.throttledRender.cancel();
|
|
148
165
|
console.log();
|
|
149
166
|
this.streamManager.listen();
|
|
150
167
|
this._render();
|
|
@@ -164,4 +181,4 @@ var ProgressBarRenderManager = class ProgressBarRenderManager {
|
|
|
164
181
|
}
|
|
165
182
|
};
|
|
166
183
|
//#endregion
|
|
167
|
-
export { ProgressBarRenderManager };
|
|
184
|
+
export { ProgressBar, ProgressBarRenderManager, ProgressBarRenderer };
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { toMerged } 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 toMerged(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 toMerged(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
|
-
declare function getDefaultConfig(projectRoot: string, mode?: Config['mode']): Promise<{
|
|
5
|
+
export 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,62 +15,39 @@ declare function getDefaultConfig(projectRoot: string, mode?: Config['mode']): P
|
|
|
16
15
|
preferNativePlatform: true;
|
|
17
16
|
symlinks: true;
|
|
18
17
|
};
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
serializer: {
|
|
28
|
-
prelude: string[];
|
|
29
|
-
polyfills: Polyfill[];
|
|
30
|
-
};
|
|
31
|
-
watcher: {
|
|
32
|
-
skipWrite: true;
|
|
33
|
-
useDebounce: true;
|
|
34
|
-
debounceDuration: number;
|
|
35
|
-
};
|
|
36
|
-
optimization: {
|
|
37
|
-
treeshake: NonNullable<OptimizationConfig["treeshake"]>;
|
|
38
|
-
};
|
|
18
|
+
transform: NonNullable<Config['transform']>;
|
|
19
|
+
prelude: string[];
|
|
20
|
+
polyfills: Polyfill[];
|
|
21
|
+
output: {};
|
|
22
|
+
treeshake: NonNullable<Config['treeshake']>;
|
|
39
23
|
reactNative: {
|
|
40
24
|
reactNativePath: string;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
25
|
+
assetRegistryPath: NonNullable<NonNullable<ReactNativeConfig>['assetRegistryPath']>;
|
|
26
|
+
hmrClientPath: NonNullable<NonNullable<ReactNativeConfig>['hmrClientPath']>;
|
|
27
|
+
};
|
|
28
|
+
dev: {
|
|
29
|
+
watch: {
|
|
30
|
+
skipWrite: true;
|
|
31
|
+
useDebounce: true;
|
|
32
|
+
debounceDuration: number;
|
|
33
|
+
exclude: string[];
|
|
48
34
|
};
|
|
49
|
-
|
|
50
|
-
hmrClientPath: NonNullable<NonNullable<ReactNativeConfig>["hmrClientPath"]>;
|
|
51
|
-
};
|
|
52
|
-
devMode: {
|
|
53
|
-
hmr: NonNullable<DevModeConfig["hmr"]>;
|
|
35
|
+
hmr: NonNullable<DevConfig['hmr']>;
|
|
54
36
|
};
|
|
55
37
|
reporter: Reporter;
|
|
56
38
|
analyzer: Required<AnalyzerConfig>;
|
|
57
|
-
terminal: {
|
|
58
|
-
status: "none" | "compat" | "progress" | undefined;
|
|
59
|
-
};
|
|
60
39
|
envDir: string;
|
|
61
|
-
envFile: NonNullable<Config[
|
|
62
|
-
envPrefix: NonNullable<Config[
|
|
63
|
-
runtimeTarget: NonNullable<Config[
|
|
64
|
-
experimental: {
|
|
65
|
-
nativeTransformPipeline: boolean;
|
|
66
|
-
};
|
|
40
|
+
envFile: NonNullable<Config['envFile']>;
|
|
41
|
+
envPrefix: NonNullable<Config['envPrefix']>;
|
|
42
|
+
runtimeTarget: NonNullable<Config['runtimeTarget']>;
|
|
43
|
+
experimental: {};
|
|
67
44
|
}>;
|
|
68
|
-
interface InternalConfig {
|
|
45
|
+
export interface InternalConfig {
|
|
69
46
|
/**
|
|
70
47
|
* The path to the config file that was used to load the config.
|
|
71
48
|
*/
|
|
72
49
|
configFile: string;
|
|
73
50
|
}
|
|
74
|
-
type DefaultConfig = Awaited<ReturnType<typeof getDefaultConfig>>;
|
|
75
|
-
type ResolvedConfig = DefaultConfig & PluginFlattenConfig & InternalConfig;
|
|
76
|
-
//#endregion
|
|
77
|
-
export { DefaultConfig, InternalConfig, ResolvedConfig, getDefaultConfig };
|
|
51
|
+
export type DefaultConfig = Awaited<ReturnType<typeof getDefaultConfig>>;
|
|
52
|
+
export type ResolvedConfig = DefaultConfig & PluginFlattenConfig & InternalConfig;
|
|
53
|
+
//#endregion
|
package/dist/config/defaults.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
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";
|
|
3
|
+
import { ClientLogReporter } from "../events/builtin-reporters.js";
|
|
4
4
|
import { getInitializeCorePath, getPolyfillScriptPaths } from "../internal/react-native.js";
|
|
5
5
|
import { resolvePackagePath } from "../utils/node-resolve.js";
|
|
6
|
-
import { ClientLogReporter } from "../utils/reporters.js";
|
|
7
6
|
import fs from "node:fs";
|
|
8
7
|
//#region src/config/defaults.ts
|
|
9
8
|
async function getDefaultConfig(projectRoot, mode) {
|
|
@@ -17,7 +16,7 @@ async function getDefaultConfig(projectRoot, mode) {
|
|
|
17
16
|
root: projectRoot,
|
|
18
17
|
mode: mode ?? "development",
|
|
19
18
|
entry: "index.js",
|
|
20
|
-
|
|
19
|
+
resolve: {
|
|
21
20
|
sourceExtensions: DEFAULT_SOURCE_EXTENSIONS,
|
|
22
21
|
assetExtensions: DEFAULT_ASSET_EXTENSIONS,
|
|
23
22
|
mainFields: DEFAULT_RESOLVER_MAIN_FIELDS,
|
|
@@ -26,36 +25,31 @@ async function getDefaultConfig(projectRoot, mode) {
|
|
|
26
25
|
preferNativePlatform: true,
|
|
27
26
|
symlinks: true
|
|
28
27
|
},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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 },
|
|
28
|
+
transform: { swc: { native: { externalHelpers: true } } },
|
|
29
|
+
prelude: [getInitializeCorePath(projectRoot)],
|
|
30
|
+
polyfills: await Promise.all(getPolyfillScriptPaths(reactNativePath).map(async (path) => {
|
|
31
|
+
const code = fs.readFileSync(path, "utf-8");
|
|
32
|
+
return {
|
|
33
|
+
type: "iife",
|
|
34
|
+
code: (await stripFlowTypes(path, code)).code
|
|
35
|
+
};
|
|
36
|
+
})),
|
|
37
|
+
output: {},
|
|
38
|
+
treeshake: true,
|
|
48
39
|
reactNative: {
|
|
49
40
|
reactNativePath,
|
|
50
|
-
codegen: {
|
|
51
|
-
/**
|
|
52
|
-
* @see {@link https://github.com/facebook/react-native/blob/v0.83.1/packages/react-native-babel-preset/src/configs/main.js#L78}
|
|
53
|
-
*/
|
|
54
|
-
filter: { code: /\bcodegenNativeComponent</ } },
|
|
55
41
|
assetRegistryPath: DEFAULT_ASSET_REGISTRY_PATH,
|
|
56
42
|
hmrClientPath: DEFAULT_HMR_CLIENT_PATH
|
|
57
43
|
},
|
|
58
|
-
|
|
44
|
+
dev: {
|
|
45
|
+
watch: {
|
|
46
|
+
skipWrite: true,
|
|
47
|
+
useDebounce: true,
|
|
48
|
+
debounceDuration: 50,
|
|
49
|
+
exclude: ["**/.rollipop/**"]
|
|
50
|
+
},
|
|
51
|
+
hmr: true
|
|
52
|
+
},
|
|
59
53
|
reporter: new ClientLogReporter(),
|
|
60
54
|
analyzer: {
|
|
61
55
|
enabled: false,
|
|
@@ -63,16 +57,11 @@ filter: { code: /\bcodegenNativeComponent</ } },
|
|
|
63
57
|
reportFile: DEFAULT_ANALYZE_REPORT_FILE,
|
|
64
58
|
autoOpen: false
|
|
65
59
|
},
|
|
66
|
-
terminal: { status: (() => {
|
|
67
|
-
if (isDebugEnabled()) return "compat";
|
|
68
|
-
if (process.stderr.isTTY) return "progress";
|
|
69
|
-
return "compat";
|
|
70
|
-
})() },
|
|
71
60
|
envDir: projectRoot,
|
|
72
61
|
envFile: DEFAULT_ENV_FILE,
|
|
73
62
|
envPrefix: DEFAULT_ENV_PREFIX,
|
|
74
63
|
runtimeTarget: DEFAULT_RUNTIME_TARGET,
|
|
75
|
-
experimental: {
|
|
64
|
+
experimental: {}
|
|
76
65
|
};
|
|
77
66
|
}
|
|
78
67
|
//#endregion
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { Config } from "./types.js";
|
|
2
2
|
import { DefaultConfig } from "./defaults.js";
|
|
3
|
-
|
|
4
3
|
//#region src/config/define-config.d.ts
|
|
5
|
-
interface DefineConfigContext {
|
|
4
|
+
export interface DefineConfigContext {
|
|
6
5
|
command?: string;
|
|
7
6
|
defaultConfig: DefaultConfig;
|
|
8
7
|
}
|
|
9
|
-
type UserConfig = Config | DynamicUserConfig;
|
|
10
|
-
type DynamicUserConfig = ((context: DefineConfigContext) => Config) | ((context: DefineConfigContext) => Promise<Config>);
|
|
11
|
-
declare function defineConfig(userConfig: UserConfig): UserConfig;
|
|
12
|
-
//#endregion
|
|
13
|
-
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
|
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, 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
|
+
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 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 };
|
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,19 +1,17 @@
|
|
|
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
|
-
interface LoadConfigOptions {
|
|
6
|
+
export interface LoadConfigOptions {
|
|
8
7
|
cwd?: string;
|
|
9
8
|
configFile?: string;
|
|
10
9
|
mode?: Config['mode'];
|
|
11
10
|
context?: Omit<DefineConfigContext, 'defaultConfig'>;
|
|
12
11
|
}
|
|
13
|
-
declare function loadConfig(options?: LoadConfigOptions): Promise<ResolvedConfig>;
|
|
14
|
-
declare function flattenPluginOption(pluginOption: PluginOption): Promise<Plugin[]>;
|
|
15
|
-
declare function resolvePluginConfig(baseConfig: ResolvedConfig, plugins: Plugin[]): Promise<ResolvedPluginConfig>;
|
|
16
|
-
declare function resolvePluginConfig(baseConfig: Config, plugins: Plugin[]): Promise<PluginConfig>;
|
|
17
|
-
declare function invokeConfigResolved(config: ResolvedConfig, plugins: Plugin[]): Promise<void>;
|
|
18
|
-
//#endregion
|
|
19
|
-
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,
|
|
@@ -57,13 +58,13 @@ async function resolvePluginConfig(baseConfig, plugins) {
|
|
|
57
58
|
let mergedConfig = omit(baseConfig, ["plugins"]);
|
|
58
59
|
for (const plugin of plugins) {
|
|
59
60
|
const context = createPluginContext(plugin.name);
|
|
60
|
-
const
|
|
61
|
+
const rolldownOptionsBefore = mergedConfig.rolldownOptions;
|
|
61
62
|
if (typeof plugin.config === "function") {
|
|
62
63
|
const config = await plugin.config.call(context, mergedConfig);
|
|
63
64
|
if (config != null) mergedConfig = mergeConfig(mergedConfig, config);
|
|
64
65
|
} else if (typeof plugin.config === "object") mergedConfig = mergeConfig(mergedConfig, plugin.config);
|
|
65
|
-
const
|
|
66
|
-
if (
|
|
66
|
+
const rolldownOptionsAfter = mergedConfig.rolldownOptions;
|
|
67
|
+
if (rolldownOptionsAfter != null && rolldownOptionsAfter !== rolldownOptionsBefore) context.debug({ message: `set 'rolldownOptions'` });
|
|
67
68
|
}
|
|
68
69
|
return mergedConfig;
|
|
69
70
|
}
|
|
@@ -1,12 +1,10 @@
|
|
|
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
|
-
type PluginFlattenConfig = Omit<Config, 'plugins'> & {
|
|
5
|
+
export type PluginFlattenConfig = Omit<Config, 'plugins'> & {
|
|
7
6
|
plugins?: Plugin[];
|
|
8
7
|
};
|
|
9
|
-
declare function mergeConfig(baseConfig: PluginFlattenConfig, ...overrideConfigs: PluginFlattenConfig[]): Config;
|
|
10
|
-
declare function mergeConfig(baseConfig: DefaultConfig, ...overrideConfigs: PluginFlattenConfig[]): ResolvedConfig;
|
|
11
|
-
//#endregion
|
|
12
|
-
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
|
|
@@ -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 };
|