@rollipop/core 0.1.0-alpha.1 → 0.1.0-alpha.2
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/CHANGELOG.md +11 -0
- package/dist/{chunk-BYW8Mqxw.js → chunk-DJulfCLt.js} +2 -1
- package/dist/hmr-client.cjs +3 -0
- package/dist/index.cjs +2427 -46
- package/dist/index.d.cts +184 -77
- package/dist/index.d.ts +187 -78
- package/dist/index.js +2413 -44
- package/dist/runtime.cjs +18 -0
- package/dist/runtime.d.cts +55 -0
- package/dist/runtime.d.ts +55 -0
- package/dist/runtime.js +17 -0
- package/package.json +24 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import * as rolldown_experimental0 from "rolldown/experimental";
|
|
2
2
|
import { DevOptions, DevWatchOptions, TransformOptions } from "rolldown/experimental";
|
|
3
3
|
import * as rolldown from "rolldown";
|
|
4
|
+
import { RollupLogWithString } from "rolldown";
|
|
5
|
+
import { FastifyInstance } from "fastify";
|
|
6
|
+
import * as ws from "ws";
|
|
4
7
|
import { FileStorage } from "@rollipop/common";
|
|
5
8
|
|
|
6
9
|
//#region rolldown:runtime
|
|
@@ -54,17 +57,189 @@ interface LoadConfigOptions {
|
|
|
54
57
|
}
|
|
55
58
|
declare function loadConfig(options?: LoadConfigOptions): Promise<ResolvedConfig>;
|
|
56
59
|
declare function resolvePluginConfig(baseConfig: Config, plugins: Plugin[]): Promise<Config>;
|
|
57
|
-
declare function
|
|
60
|
+
declare function invokeConfigResolved(config: ResolvedConfig, plugins: Plugin[]): Promise<void>;
|
|
58
61
|
//#endregion
|
|
59
62
|
//#region src/config/merge-config.d.ts
|
|
60
63
|
declare function mergeConfig(baseConfig: Config, ...overrideConfigs: Config[]): Config;
|
|
61
64
|
declare function mergeConfig(baseConfig: DefaultConfig, ...overrideConfigs: Config[]): ResolvedConfig;
|
|
62
65
|
//#endregion
|
|
66
|
+
//#region src/server/wss/server.d.ts
|
|
67
|
+
type BufferLike = Parameters<ws.WebSocket['send']>[0];
|
|
68
|
+
type WebSocketClient = ws.WebSocket & {
|
|
69
|
+
id: number;
|
|
70
|
+
};
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region src/server/types.d.ts
|
|
73
|
+
interface ServerOptions {
|
|
74
|
+
port?: number;
|
|
75
|
+
host?: string;
|
|
76
|
+
https?: boolean;
|
|
77
|
+
key?: string;
|
|
78
|
+
cert?: string;
|
|
79
|
+
onDeviceConnected?: (client: WebSocketClient) => void;
|
|
80
|
+
onDeviceMessage?: (client: WebSocketClient, data: ws.RawData) => void;
|
|
81
|
+
onDeviceConnectionError?: (client: WebSocketClient, error: Error) => void;
|
|
82
|
+
onDeviceDisconnected?: (client: WebSocketClient) => void;
|
|
83
|
+
}
|
|
84
|
+
interface Middlewares {
|
|
85
|
+
/**
|
|
86
|
+
* Register a middleware to the Fastify instance.
|
|
87
|
+
*
|
|
88
|
+
* **NOTE**: This is a wrapper of `instance.use`.
|
|
89
|
+
*/
|
|
90
|
+
use: FastifyInstance['use'];
|
|
91
|
+
}
|
|
92
|
+
interface DevServer {
|
|
93
|
+
/**
|
|
94
|
+
* Resolved Rollipop config.
|
|
95
|
+
*/
|
|
96
|
+
config: ResolvedConfig;
|
|
97
|
+
/**
|
|
98
|
+
* The Fastify instance.
|
|
99
|
+
*/
|
|
100
|
+
instance: FastifyInstance;
|
|
101
|
+
/**
|
|
102
|
+
* `express` and `connect` style middleware registration API.
|
|
103
|
+
*/
|
|
104
|
+
middlewares: Middlewares;
|
|
105
|
+
/**
|
|
106
|
+
* The message websocket server API.
|
|
107
|
+
*/
|
|
108
|
+
message: ws.Server & {
|
|
109
|
+
/**
|
|
110
|
+
* Broadcast a message to all connected devices.
|
|
111
|
+
*/
|
|
112
|
+
broadcast: (method: string, params?: Record<string, any>) => void;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* The events websocket server API.
|
|
116
|
+
*/
|
|
117
|
+
events: ws.Server & {
|
|
118
|
+
/**
|
|
119
|
+
* Report an event to the reporter.
|
|
120
|
+
*/
|
|
121
|
+
reportEvent: (event: {
|
|
122
|
+
type: string;
|
|
123
|
+
[key: string]: unknown;
|
|
124
|
+
}) => void;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* HMR websocket server API
|
|
128
|
+
*/
|
|
129
|
+
hot: ws.Server & {
|
|
130
|
+
send: (client: ws.WebSocket, data: BufferLike) => void;
|
|
131
|
+
sendAll: (data: BufferLike) => void;
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
interface BundleDetails {
|
|
135
|
+
bundleType: string;
|
|
136
|
+
dev: boolean;
|
|
137
|
+
entryFile: string;
|
|
138
|
+
minify: boolean;
|
|
139
|
+
platform?: string;
|
|
140
|
+
}
|
|
141
|
+
interface FormattedError {
|
|
142
|
+
type: string;
|
|
143
|
+
message: string;
|
|
144
|
+
errors: {
|
|
145
|
+
description: string;
|
|
146
|
+
}[];
|
|
147
|
+
}
|
|
148
|
+
//#endregion
|
|
149
|
+
//#region src/server/create-dev-server.d.ts
|
|
150
|
+
declare function createDevServer(config: ResolvedConfig, options?: ServerOptions): Promise<DevServer>;
|
|
151
|
+
//#endregion
|
|
152
|
+
//#region src/server/constants.d.ts
|
|
153
|
+
declare const DEFAULT_PORT = 8081;
|
|
154
|
+
declare const DEFAULT_HOST = "localhost";
|
|
155
|
+
//#endregion
|
|
156
|
+
//#region src/core/cache/cache.d.ts
|
|
157
|
+
interface Cache<Key$1, Input, Output = Input> {
|
|
158
|
+
get(key: Key$1): Output | null | undefined;
|
|
159
|
+
set(key: Key$1, value: Input): void;
|
|
160
|
+
clear(): void;
|
|
161
|
+
}
|
|
162
|
+
//#endregion
|
|
163
|
+
//#region src/core/cache/file-system-cache.d.ts
|
|
164
|
+
type Key = string;
|
|
165
|
+
declare class FileSystemCache implements Cache<Key, string> {
|
|
166
|
+
private readonly cacheDirectory;
|
|
167
|
+
constructor(cacheDirectory: string);
|
|
168
|
+
private ensureCacheDirectory;
|
|
169
|
+
get(key: Key): string | undefined;
|
|
170
|
+
set(key: Key, value: string): void;
|
|
171
|
+
clear(): void;
|
|
172
|
+
}
|
|
173
|
+
//#endregion
|
|
174
|
+
//#region src/core/types.d.ts
|
|
175
|
+
interface BuildOptions {
|
|
176
|
+
/**
|
|
177
|
+
* The platform to build for.
|
|
178
|
+
*/
|
|
179
|
+
platform: string;
|
|
180
|
+
/**
|
|
181
|
+
* Whether to build in development mode.
|
|
182
|
+
*
|
|
183
|
+
* Defaults to `true`.
|
|
184
|
+
*/
|
|
185
|
+
dev?: boolean;
|
|
186
|
+
/**
|
|
187
|
+
* Whether to minify the bundle.
|
|
188
|
+
*
|
|
189
|
+
* Defaults to `false`.
|
|
190
|
+
*/
|
|
191
|
+
minify?: boolean;
|
|
192
|
+
/**
|
|
193
|
+
* Enable or disable the cache.
|
|
194
|
+
*
|
|
195
|
+
* Defaults to `true`.
|
|
196
|
+
*/
|
|
197
|
+
cache?: boolean;
|
|
198
|
+
/**
|
|
199
|
+
* The output file.
|
|
200
|
+
*/
|
|
201
|
+
outfile?: string;
|
|
202
|
+
/**
|
|
203
|
+
* The sourcemap file.
|
|
204
|
+
*/
|
|
205
|
+
sourcemap?: string;
|
|
206
|
+
/**
|
|
207
|
+
* The assets directory.
|
|
208
|
+
*/
|
|
209
|
+
assetsDir?: string;
|
|
210
|
+
}
|
|
211
|
+
type DevEngineOptions = DevOptions & {
|
|
212
|
+
/**
|
|
213
|
+
* The host to run the dev server on.
|
|
214
|
+
*/
|
|
215
|
+
host: string;
|
|
216
|
+
/**
|
|
217
|
+
* The port to run the dev server on.
|
|
218
|
+
*/
|
|
219
|
+
port: number;
|
|
220
|
+
};
|
|
221
|
+
interface BundlerContext {
|
|
222
|
+
id: string;
|
|
223
|
+
cache: FileSystemCache;
|
|
224
|
+
storage: FileStorage;
|
|
225
|
+
mode: BuildMode;
|
|
226
|
+
}
|
|
227
|
+
type BuildMode = 'build' | 'serve';
|
|
228
|
+
type AsyncResult<T> = T | Promise<T>;
|
|
229
|
+
//#endregion
|
|
230
|
+
//#region src/core/plugins/context.d.ts
|
|
231
|
+
interface PluginContext {
|
|
232
|
+
debug: (log: RollupLogWithString) => void;
|
|
233
|
+
info: (log: RollupLogWithString) => void;
|
|
234
|
+
warn: (log: RollupLogWithString) => void;
|
|
235
|
+
}
|
|
236
|
+
//#endregion
|
|
63
237
|
//#region src/core/plugins/types.d.ts
|
|
64
238
|
type PluginConfig = Omit<Config, 'plugins' | 'dangerously_overrideRolldownOptions'>;
|
|
65
239
|
type Plugin = rolldown.Plugin & {
|
|
66
|
-
config?: PluginConfig | ((
|
|
67
|
-
configResolved?: (config: ResolvedConfig) =>
|
|
240
|
+
config?: PluginConfig | ((this: PluginContext, config: PluginConfig) => AsyncResult<PluginConfig | null | void>);
|
|
241
|
+
configResolved?: (this: PluginContext, config: ResolvedConfig) => AsyncResult<void>;
|
|
242
|
+
configureServer?: (this: PluginContext, server: DevServer) => AsyncResult<void | (() => AsyncResult<void>)>;
|
|
68
243
|
};
|
|
69
244
|
//#endregion
|
|
70
245
|
//#region src/config/types.d.ts
|
|
@@ -258,79 +433,6 @@ declare function getDefaultConfig(basePath: string): {
|
|
|
258
433
|
type DefaultConfig = ReturnType<typeof getDefaultConfig>;
|
|
259
434
|
type ResolvedConfig = Config & DefaultConfig;
|
|
260
435
|
//#endregion
|
|
261
|
-
//#region src/core/cache/cache.d.ts
|
|
262
|
-
interface Cache<Key$1, Input, Output = Input> {
|
|
263
|
-
get(key: Key$1): Output | null | undefined;
|
|
264
|
-
set(key: Key$1, value: Input): void;
|
|
265
|
-
clear(): void;
|
|
266
|
-
}
|
|
267
|
-
//#endregion
|
|
268
|
-
//#region src/core/cache/file-system-cache.d.ts
|
|
269
|
-
type Key = string;
|
|
270
|
-
declare class FileSystemCache implements Cache<Key, string> {
|
|
271
|
-
private readonly cacheDirectory;
|
|
272
|
-
constructor(cacheDirectory: string);
|
|
273
|
-
private ensureCacheDirectory;
|
|
274
|
-
get(key: Key): string | undefined;
|
|
275
|
-
set(key: Key, value: string): void;
|
|
276
|
-
clear(): void;
|
|
277
|
-
}
|
|
278
|
-
//#endregion
|
|
279
|
-
//#region src/core/types.d.ts
|
|
280
|
-
interface BuildOptions {
|
|
281
|
-
/**
|
|
282
|
-
* The platform to build for.
|
|
283
|
-
*/
|
|
284
|
-
platform: string;
|
|
285
|
-
/**
|
|
286
|
-
* Whether to build in development mode.
|
|
287
|
-
*
|
|
288
|
-
* Defaults to `true`.
|
|
289
|
-
*/
|
|
290
|
-
dev?: boolean;
|
|
291
|
-
/**
|
|
292
|
-
* Whether to minify the bundle.
|
|
293
|
-
*
|
|
294
|
-
* Defaults to `false`.
|
|
295
|
-
*/
|
|
296
|
-
minify?: boolean;
|
|
297
|
-
/**
|
|
298
|
-
* Enable or disable the cache.
|
|
299
|
-
*
|
|
300
|
-
* Defaults to `true`.
|
|
301
|
-
*/
|
|
302
|
-
cache?: boolean;
|
|
303
|
-
/**
|
|
304
|
-
* The output file.
|
|
305
|
-
*/
|
|
306
|
-
outfile?: string;
|
|
307
|
-
/**
|
|
308
|
-
* The sourcemap file.
|
|
309
|
-
*/
|
|
310
|
-
sourcemap?: string;
|
|
311
|
-
/**
|
|
312
|
-
* The assets directory.
|
|
313
|
-
*/
|
|
314
|
-
assetsDir?: string;
|
|
315
|
-
}
|
|
316
|
-
type DevEngineOptions = DevOptions & {
|
|
317
|
-
/**
|
|
318
|
-
* The host to run the dev server on.
|
|
319
|
-
*/
|
|
320
|
-
host: string;
|
|
321
|
-
/**
|
|
322
|
-
* The port to run the dev server on.
|
|
323
|
-
*/
|
|
324
|
-
port: number;
|
|
325
|
-
};
|
|
326
|
-
interface BundlerContext {
|
|
327
|
-
id: string;
|
|
328
|
-
cache: FileSystemCache;
|
|
329
|
-
storage: FileStorage;
|
|
330
|
-
mode: BuildMode;
|
|
331
|
-
}
|
|
332
|
-
type BuildMode = 'build' | 'serve';
|
|
333
|
-
//#endregion
|
|
334
436
|
//#region src/core/bundler.d.ts
|
|
335
437
|
declare class Bundler {
|
|
336
438
|
private readonly config;
|
|
@@ -533,6 +635,11 @@ type HMRServerMessage = {
|
|
|
533
635
|
type: 'hmr:error';
|
|
534
636
|
payload: HMRServerError;
|
|
535
637
|
};
|
|
638
|
+
type HMRCustomServerMessage = {
|
|
639
|
+
type: string;
|
|
640
|
+
payload: unknown;
|
|
641
|
+
};
|
|
642
|
+
type HMRCustomHandler = (message: HMRCustomServerMessage) => void;
|
|
536
643
|
interface HMRServerError {
|
|
537
644
|
type: string;
|
|
538
645
|
message: string;
|
|
@@ -547,4 +654,4 @@ declare class TerminalReporter implements Reporter {
|
|
|
547
654
|
update(event: ReportableEvent): void;
|
|
548
655
|
}
|
|
549
656
|
//#endregion
|
|
550
|
-
export { assets_d_exports as AssetUtils, BuildMode, BuildOptions, Bundler, BundlerContext, CodegenConfig, Config, DefaultConfig, TerminalReporter as DefaultReporter, DefineConfigContext, DevEngineOptions, DynamicConfig, FlowConfig, HMRClientLogLevel, HMRClientMessage, HMRServerError, HMRServerMessage, LoadConfigOptions, type Plugin, type PluginConfig, PluginUtils, Polyfill, PolyfillType, PolyfillWithCode, PolyfillWithPath, ReactNativeConfig, ReportableEvent, Reporter, ResolvedConfig, ResolverConfig, RolldownConfig, SerializerConfig, TerminalConfig, TransformerConfig, UserConfig, WatcherConfig, defineConfig, getDefaultConfig,
|
|
657
|
+
export { assets_d_exports as AssetUtils, AsyncResult, BuildMode, BuildOptions, BundleDetails, Bundler, BundlerContext, CodegenConfig, Config, DEFAULT_HOST, DEFAULT_PORT, DefaultConfig, TerminalReporter as DefaultReporter, DefineConfigContext, DevEngineOptions, DevServer, DynamicConfig, FlowConfig, FormattedError, HMRClientLogLevel, HMRClientMessage, HMRCustomHandler, HMRCustomServerMessage, HMRServerError, HMRServerMessage, LoadConfigOptions, Middlewares, type Plugin, type PluginConfig, PluginUtils, Polyfill, PolyfillType, PolyfillWithCode, PolyfillWithPath, ReactNativeConfig, ReportableEvent, Reporter, ResolvedConfig, ResolverConfig, RolldownConfig, SerializerConfig, ServerOptions, TerminalConfig, TransformerConfig, UserConfig, WatcherConfig, createDevServer, defineConfig, getDefaultConfig, invokeConfigResolved, loadConfig, mergeConfig, index_d_exports as plugins, resolvePluginConfig, rolldown, rolldown_experimental0 as rolldownExperimental };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import { FileStorage } from "@rollipop/common";
|
|
1
|
+
import { FileStorage, Logger } from "@rollipop/common";
|
|
2
2
|
import * as rolldown from "rolldown";
|
|
3
|
+
import { RollupLogWithString } from "rolldown";
|
|
3
4
|
import * as rolldown_experimental0 from "rolldown/experimental";
|
|
4
5
|
import { DevOptions, DevWatchOptions, TransformOptions } from "rolldown/experimental";
|
|
6
|
+
import { FastifyInstance } from "fastify";
|
|
7
|
+
import EventEmitter from "node:events";
|
|
8
|
+
import * as ws from "ws";
|
|
9
|
+
import "@fastify/middie";
|
|
5
10
|
|
|
6
11
|
//#region src/types.d.ts
|
|
7
12
|
interface Reporter {
|
|
@@ -52,17 +57,189 @@ interface LoadConfigOptions {
|
|
|
52
57
|
}
|
|
53
58
|
declare function loadConfig(options?: LoadConfigOptions): Promise<ResolvedConfig>;
|
|
54
59
|
declare function resolvePluginConfig(baseConfig: Config, plugins: Plugin[]): Promise<Config>;
|
|
55
|
-
declare function
|
|
60
|
+
declare function invokeConfigResolved(config: ResolvedConfig, plugins: Plugin[]): Promise<void>;
|
|
56
61
|
//#endregion
|
|
57
62
|
//#region src/config/merge-config.d.ts
|
|
58
63
|
declare function mergeConfig(baseConfig: Config, ...overrideConfigs: Config[]): Config;
|
|
59
64
|
declare function mergeConfig(baseConfig: DefaultConfig, ...overrideConfigs: Config[]): ResolvedConfig;
|
|
60
65
|
//#endregion
|
|
66
|
+
//#region src/server/wss/server.d.ts
|
|
67
|
+
type BufferLike = Parameters<ws.WebSocket['send']>[0];
|
|
68
|
+
type WebSocketClient = ws.WebSocket & {
|
|
69
|
+
id: number;
|
|
70
|
+
};
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region src/server/types.d.ts
|
|
73
|
+
interface ServerOptions {
|
|
74
|
+
port?: number;
|
|
75
|
+
host?: string;
|
|
76
|
+
https?: boolean;
|
|
77
|
+
key?: string;
|
|
78
|
+
cert?: string;
|
|
79
|
+
onDeviceConnected?: (client: WebSocketClient) => void;
|
|
80
|
+
onDeviceMessage?: (client: WebSocketClient, data: ws.RawData) => void;
|
|
81
|
+
onDeviceConnectionError?: (client: WebSocketClient, error: Error) => void;
|
|
82
|
+
onDeviceDisconnected?: (client: WebSocketClient) => void;
|
|
83
|
+
}
|
|
84
|
+
interface Middlewares {
|
|
85
|
+
/**
|
|
86
|
+
* Register a middleware to the Fastify instance.
|
|
87
|
+
*
|
|
88
|
+
* **NOTE**: This is a wrapper of `instance.use`.
|
|
89
|
+
*/
|
|
90
|
+
use: FastifyInstance['use'];
|
|
91
|
+
}
|
|
92
|
+
interface DevServer {
|
|
93
|
+
/**
|
|
94
|
+
* Resolved Rollipop config.
|
|
95
|
+
*/
|
|
96
|
+
config: ResolvedConfig;
|
|
97
|
+
/**
|
|
98
|
+
* The Fastify instance.
|
|
99
|
+
*/
|
|
100
|
+
instance: FastifyInstance;
|
|
101
|
+
/**
|
|
102
|
+
* `express` and `connect` style middleware registration API.
|
|
103
|
+
*/
|
|
104
|
+
middlewares: Middlewares;
|
|
105
|
+
/**
|
|
106
|
+
* The message websocket server API.
|
|
107
|
+
*/
|
|
108
|
+
message: ws.Server & {
|
|
109
|
+
/**
|
|
110
|
+
* Broadcast a message to all connected devices.
|
|
111
|
+
*/
|
|
112
|
+
broadcast: (method: string, params?: Record<string, any>) => void;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* The events websocket server API.
|
|
116
|
+
*/
|
|
117
|
+
events: ws.Server & {
|
|
118
|
+
/**
|
|
119
|
+
* Report an event to the reporter.
|
|
120
|
+
*/
|
|
121
|
+
reportEvent: (event: {
|
|
122
|
+
type: string;
|
|
123
|
+
[key: string]: unknown;
|
|
124
|
+
}) => void;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* HMR websocket server API
|
|
128
|
+
*/
|
|
129
|
+
hot: ws.Server & {
|
|
130
|
+
send: (client: ws.WebSocket, data: BufferLike) => void;
|
|
131
|
+
sendAll: (data: BufferLike) => void;
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
interface BundleDetails {
|
|
135
|
+
bundleType: string;
|
|
136
|
+
dev: boolean;
|
|
137
|
+
entryFile: string;
|
|
138
|
+
minify: boolean;
|
|
139
|
+
platform?: string;
|
|
140
|
+
}
|
|
141
|
+
interface FormattedError {
|
|
142
|
+
type: string;
|
|
143
|
+
message: string;
|
|
144
|
+
errors: {
|
|
145
|
+
description: string;
|
|
146
|
+
}[];
|
|
147
|
+
}
|
|
148
|
+
//#endregion
|
|
149
|
+
//#region src/server/create-dev-server.d.ts
|
|
150
|
+
declare function createDevServer(config: ResolvedConfig, options?: ServerOptions): Promise<DevServer>;
|
|
151
|
+
//#endregion
|
|
152
|
+
//#region src/server/constants.d.ts
|
|
153
|
+
declare const DEFAULT_PORT = 8081;
|
|
154
|
+
declare const DEFAULT_HOST = "localhost";
|
|
155
|
+
//#endregion
|
|
156
|
+
//#region src/core/cache/cache.d.ts
|
|
157
|
+
interface Cache<Key$1, Input, Output = Input> {
|
|
158
|
+
get(key: Key$1): Output | null | undefined;
|
|
159
|
+
set(key: Key$1, value: Input): void;
|
|
160
|
+
clear(): void;
|
|
161
|
+
}
|
|
162
|
+
//#endregion
|
|
163
|
+
//#region src/core/cache/file-system-cache.d.ts
|
|
164
|
+
type Key = string;
|
|
165
|
+
declare class FileSystemCache implements Cache<Key, string> {
|
|
166
|
+
private readonly cacheDirectory;
|
|
167
|
+
constructor(cacheDirectory: string);
|
|
168
|
+
private ensureCacheDirectory;
|
|
169
|
+
get(key: Key): string | undefined;
|
|
170
|
+
set(key: Key, value: string): void;
|
|
171
|
+
clear(): void;
|
|
172
|
+
}
|
|
173
|
+
//#endregion
|
|
174
|
+
//#region src/core/types.d.ts
|
|
175
|
+
interface BuildOptions {
|
|
176
|
+
/**
|
|
177
|
+
* The platform to build for.
|
|
178
|
+
*/
|
|
179
|
+
platform: string;
|
|
180
|
+
/**
|
|
181
|
+
* Whether to build in development mode.
|
|
182
|
+
*
|
|
183
|
+
* Defaults to `true`.
|
|
184
|
+
*/
|
|
185
|
+
dev?: boolean;
|
|
186
|
+
/**
|
|
187
|
+
* Whether to minify the bundle.
|
|
188
|
+
*
|
|
189
|
+
* Defaults to `false`.
|
|
190
|
+
*/
|
|
191
|
+
minify?: boolean;
|
|
192
|
+
/**
|
|
193
|
+
* Enable or disable the cache.
|
|
194
|
+
*
|
|
195
|
+
* Defaults to `true`.
|
|
196
|
+
*/
|
|
197
|
+
cache?: boolean;
|
|
198
|
+
/**
|
|
199
|
+
* The output file.
|
|
200
|
+
*/
|
|
201
|
+
outfile?: string;
|
|
202
|
+
/**
|
|
203
|
+
* The sourcemap file.
|
|
204
|
+
*/
|
|
205
|
+
sourcemap?: string;
|
|
206
|
+
/**
|
|
207
|
+
* The assets directory.
|
|
208
|
+
*/
|
|
209
|
+
assetsDir?: string;
|
|
210
|
+
}
|
|
211
|
+
type DevEngineOptions = DevOptions & {
|
|
212
|
+
/**
|
|
213
|
+
* The host to run the dev server on.
|
|
214
|
+
*/
|
|
215
|
+
host: string;
|
|
216
|
+
/**
|
|
217
|
+
* The port to run the dev server on.
|
|
218
|
+
*/
|
|
219
|
+
port: number;
|
|
220
|
+
};
|
|
221
|
+
interface BundlerContext {
|
|
222
|
+
id: string;
|
|
223
|
+
cache: FileSystemCache;
|
|
224
|
+
storage: FileStorage;
|
|
225
|
+
mode: BuildMode;
|
|
226
|
+
}
|
|
227
|
+
type BuildMode = 'build' | 'serve';
|
|
228
|
+
type AsyncResult<T> = T | Promise<T>;
|
|
229
|
+
//#endregion
|
|
230
|
+
//#region src/core/plugins/context.d.ts
|
|
231
|
+
interface PluginContext {
|
|
232
|
+
debug: (log: RollupLogWithString) => void;
|
|
233
|
+
info: (log: RollupLogWithString) => void;
|
|
234
|
+
warn: (log: RollupLogWithString) => void;
|
|
235
|
+
}
|
|
236
|
+
//#endregion
|
|
61
237
|
//#region src/core/plugins/types.d.ts
|
|
62
238
|
type PluginConfig = Omit<Config, 'plugins' | 'dangerously_overrideRolldownOptions'>;
|
|
63
239
|
type Plugin = rolldown.Plugin & {
|
|
64
|
-
config?: PluginConfig | ((
|
|
65
|
-
configResolved?: (config: ResolvedConfig) =>
|
|
240
|
+
config?: PluginConfig | ((this: PluginContext, config: PluginConfig) => AsyncResult<PluginConfig | null | void>);
|
|
241
|
+
configResolved?: (this: PluginContext, config: ResolvedConfig) => AsyncResult<void>;
|
|
242
|
+
configureServer?: (this: PluginContext, server: DevServer) => AsyncResult<void | (() => AsyncResult<void>)>;
|
|
66
243
|
};
|
|
67
244
|
//#endregion
|
|
68
245
|
//#region src/config/types.d.ts
|
|
@@ -256,79 +433,6 @@ declare function getDefaultConfig(basePath: string): {
|
|
|
256
433
|
type DefaultConfig = ReturnType<typeof getDefaultConfig>;
|
|
257
434
|
type ResolvedConfig = Config & DefaultConfig;
|
|
258
435
|
//#endregion
|
|
259
|
-
//#region src/core/cache/cache.d.ts
|
|
260
|
-
interface Cache<Key$1, Input, Output = Input> {
|
|
261
|
-
get(key: Key$1): Output | null | undefined;
|
|
262
|
-
set(key: Key$1, value: Input): void;
|
|
263
|
-
clear(): void;
|
|
264
|
-
}
|
|
265
|
-
//#endregion
|
|
266
|
-
//#region src/core/cache/file-system-cache.d.ts
|
|
267
|
-
type Key = string;
|
|
268
|
-
declare class FileSystemCache implements Cache<Key, string> {
|
|
269
|
-
private readonly cacheDirectory;
|
|
270
|
-
constructor(cacheDirectory: string);
|
|
271
|
-
private ensureCacheDirectory;
|
|
272
|
-
get(key: Key): string | undefined;
|
|
273
|
-
set(key: Key, value: string): void;
|
|
274
|
-
clear(): void;
|
|
275
|
-
}
|
|
276
|
-
//#endregion
|
|
277
|
-
//#region src/core/types.d.ts
|
|
278
|
-
interface BuildOptions {
|
|
279
|
-
/**
|
|
280
|
-
* The platform to build for.
|
|
281
|
-
*/
|
|
282
|
-
platform: string;
|
|
283
|
-
/**
|
|
284
|
-
* Whether to build in development mode.
|
|
285
|
-
*
|
|
286
|
-
* Defaults to `true`.
|
|
287
|
-
*/
|
|
288
|
-
dev?: boolean;
|
|
289
|
-
/**
|
|
290
|
-
* Whether to minify the bundle.
|
|
291
|
-
*
|
|
292
|
-
* Defaults to `false`.
|
|
293
|
-
*/
|
|
294
|
-
minify?: boolean;
|
|
295
|
-
/**
|
|
296
|
-
* Enable or disable the cache.
|
|
297
|
-
*
|
|
298
|
-
* Defaults to `true`.
|
|
299
|
-
*/
|
|
300
|
-
cache?: boolean;
|
|
301
|
-
/**
|
|
302
|
-
* The output file.
|
|
303
|
-
*/
|
|
304
|
-
outfile?: string;
|
|
305
|
-
/**
|
|
306
|
-
* The sourcemap file.
|
|
307
|
-
*/
|
|
308
|
-
sourcemap?: string;
|
|
309
|
-
/**
|
|
310
|
-
* The assets directory.
|
|
311
|
-
*/
|
|
312
|
-
assetsDir?: string;
|
|
313
|
-
}
|
|
314
|
-
type DevEngineOptions = DevOptions & {
|
|
315
|
-
/**
|
|
316
|
-
* The host to run the dev server on.
|
|
317
|
-
*/
|
|
318
|
-
host: string;
|
|
319
|
-
/**
|
|
320
|
-
* The port to run the dev server on.
|
|
321
|
-
*/
|
|
322
|
-
port: number;
|
|
323
|
-
};
|
|
324
|
-
interface BundlerContext {
|
|
325
|
-
id: string;
|
|
326
|
-
cache: FileSystemCache;
|
|
327
|
-
storage: FileStorage;
|
|
328
|
-
mode: BuildMode;
|
|
329
|
-
}
|
|
330
|
-
type BuildMode = 'build' | 'serve';
|
|
331
|
-
//#endregion
|
|
332
436
|
//#region src/core/bundler.d.ts
|
|
333
437
|
declare class Bundler {
|
|
334
438
|
private readonly config;
|
|
@@ -531,6 +635,11 @@ type HMRServerMessage = {
|
|
|
531
635
|
type: 'hmr:error';
|
|
532
636
|
payload: HMRServerError;
|
|
533
637
|
};
|
|
638
|
+
type HMRCustomServerMessage = {
|
|
639
|
+
type: string;
|
|
640
|
+
payload: unknown;
|
|
641
|
+
};
|
|
642
|
+
type HMRCustomHandler = (message: HMRCustomServerMessage) => void;
|
|
534
643
|
interface HMRServerError {
|
|
535
644
|
type: string;
|
|
536
645
|
message: string;
|
|
@@ -545,4 +654,4 @@ declare class TerminalReporter implements Reporter {
|
|
|
545
654
|
update(event: ReportableEvent): void;
|
|
546
655
|
}
|
|
547
656
|
//#endregion
|
|
548
|
-
export { assets_d_exports as AssetUtils, BuildMode, BuildOptions, Bundler, BundlerContext, CodegenConfig, Config, DefaultConfig, TerminalReporter as DefaultReporter, DefineConfigContext, DevEngineOptions, DynamicConfig, FlowConfig, HMRClientLogLevel, HMRClientMessage, HMRServerError, HMRServerMessage, LoadConfigOptions, type Plugin, type PluginConfig, PluginUtils, Polyfill, PolyfillType, PolyfillWithCode, PolyfillWithPath, ReactNativeConfig, ReportableEvent, Reporter, ResolvedConfig, ResolverConfig, RolldownConfig, SerializerConfig, TerminalConfig, TransformerConfig, UserConfig, WatcherConfig, defineConfig, getDefaultConfig,
|
|
657
|
+
export { assets_d_exports as AssetUtils, AsyncResult, BuildMode, BuildOptions, BundleDetails, Bundler, BundlerContext, CodegenConfig, Config, DEFAULT_HOST, DEFAULT_PORT, DefaultConfig, TerminalReporter as DefaultReporter, DefineConfigContext, DevEngineOptions, DevServer, DynamicConfig, FlowConfig, FormattedError, HMRClientLogLevel, HMRClientMessage, HMRCustomHandler, HMRCustomServerMessage, HMRServerError, HMRServerMessage, LoadConfigOptions, Middlewares, type Plugin, type PluginConfig, PluginUtils, Polyfill, PolyfillType, PolyfillWithCode, PolyfillWithPath, ReactNativeConfig, ReportableEvent, Reporter, ResolvedConfig, ResolverConfig, RolldownConfig, SerializerConfig, ServerOptions, TerminalConfig, TransformerConfig, UserConfig, WatcherConfig, createDevServer, defineConfig, getDefaultConfig, invokeConfigResolved, loadConfig, mergeConfig, index_d_exports as plugins, resolvePluginConfig, rolldown, rolldown_experimental0 as rolldownExperimental };
|