@ubean/preset 0.1.13 → 0.2.1
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/dist/index.d.ts +702 -1
- package/dist/index.js +962 -29
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -149,6 +149,340 @@ declare function registerPreset(preset: Preset, meta?: PresetMeta): void;
|
|
|
149
149
|
declare function getPresetNames(): string[];
|
|
150
150
|
declare function getPresetAliases(): Map<string, string>;
|
|
151
151
|
//#endregion
|
|
152
|
+
//#region src/aws.d.ts
|
|
153
|
+
/**
|
|
154
|
+
* AWS Lambda preset —— AWS Lambda + API Gateway / Function URL 模式
|
|
155
|
+
*
|
|
156
|
+
* 构建输出:`dist/aws/lambda/index.mjs`(Lambda handler)
|
|
157
|
+
* 预览命令:`sam local start-api`(通过 AWS SAM 本地模拟)
|
|
158
|
+
* 部署命令:`sam deploy --guided`(交互式部署)
|
|
159
|
+
*
|
|
160
|
+
* Lambda handler 签名:
|
|
161
|
+
* ```typescript
|
|
162
|
+
* export const handler = async (event, context) => { ... };
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
declare const awsPreset: {
|
|
166
|
+
extends: string;
|
|
167
|
+
capabilities: CapabilitySet;
|
|
168
|
+
entry: string;
|
|
169
|
+
exportConditions: string[];
|
|
170
|
+
build: {
|
|
171
|
+
outputDir: string;
|
|
172
|
+
format: "esm";
|
|
173
|
+
externals: string[];
|
|
174
|
+
};
|
|
175
|
+
output: {
|
|
176
|
+
dir: string;
|
|
177
|
+
serverDir: string;
|
|
178
|
+
publicDir: string;
|
|
179
|
+
};
|
|
180
|
+
runtime: {
|
|
181
|
+
entry: string;
|
|
182
|
+
handler: string;
|
|
183
|
+
compatibilityDate: string;
|
|
184
|
+
};
|
|
185
|
+
serve: {
|
|
186
|
+
host: string;
|
|
187
|
+
port: number;
|
|
188
|
+
};
|
|
189
|
+
commands: {
|
|
190
|
+
preview: string;
|
|
191
|
+
deploy: string;
|
|
192
|
+
};
|
|
193
|
+
hooks: {
|
|
194
|
+
'build:before': () => Promise<void>;
|
|
195
|
+
'build:after': () => Promise<void>;
|
|
196
|
+
};
|
|
197
|
+
} & {
|
|
198
|
+
_meta: PresetMeta;
|
|
199
|
+
name: string;
|
|
200
|
+
};
|
|
201
|
+
/**
|
|
202
|
+
* AWS SAM 配置文件(`template.yaml`)类型(简化版)
|
|
203
|
+
*
|
|
204
|
+
* 完整规范见:https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-specification.html
|
|
205
|
+
*/
|
|
206
|
+
interface AwsSamTemplate {
|
|
207
|
+
AWSTemplateFormatVersion?: string;
|
|
208
|
+
Transform?: string;
|
|
209
|
+
Description?: string;
|
|
210
|
+
Resources: Record<string, AwsSamResource>;
|
|
211
|
+
Outputs?: Record<string, {
|
|
212
|
+
Description?: string;
|
|
213
|
+
Value: string | Record<string, unknown>;
|
|
214
|
+
Export?: {
|
|
215
|
+
Name: string;
|
|
216
|
+
};
|
|
217
|
+
}>;
|
|
218
|
+
Parameters?: Record<string, {
|
|
219
|
+
Type: string;
|
|
220
|
+
Default?: string;
|
|
221
|
+
Description?: string;
|
|
222
|
+
}>;
|
|
223
|
+
Globals?: {
|
|
224
|
+
Function?: {
|
|
225
|
+
Runtime?: string;
|
|
226
|
+
MemorySize?: number;
|
|
227
|
+
Timeout?: number;
|
|
228
|
+
Environment?: {
|
|
229
|
+
Variables?: Record<string, string>;
|
|
230
|
+
};
|
|
231
|
+
Handler?: string;
|
|
232
|
+
};
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
interface AwsSamResource {
|
|
236
|
+
Type: string;
|
|
237
|
+
Properties: {
|
|
238
|
+
FunctionName?: string;
|
|
239
|
+
Handler?: string;
|
|
240
|
+
Runtime?: string;
|
|
241
|
+
CodeUri?: string;
|
|
242
|
+
MemorySize?: number;
|
|
243
|
+
Timeout?: number;
|
|
244
|
+
Environment?: {
|
|
245
|
+
Variables?: Record<string, string>;
|
|
246
|
+
};
|
|
247
|
+
Events?: Record<string, {
|
|
248
|
+
Type: string;
|
|
249
|
+
Properties: Record<string, unknown>;
|
|
250
|
+
}>;
|
|
251
|
+
Policies?: string[];
|
|
252
|
+
AutoPublishAlias?: string;
|
|
253
|
+
DeploymentPreference?: {
|
|
254
|
+
Type: string;
|
|
255
|
+
};
|
|
256
|
+
/** 各 SAM 资源类型有不同属性(如 ApiGateway 的 StageName),允许扩展 */
|
|
257
|
+
[key: string]: unknown;
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* 生成 AWS SAM template.yaml 配置对象
|
|
262
|
+
*/
|
|
263
|
+
declare function generateAwsSamConfig(options: {
|
|
264
|
+
functionName?: string;
|
|
265
|
+
handler?: string;
|
|
266
|
+
runtime?: string;
|
|
267
|
+
codeUri?: string;
|
|
268
|
+
memorySize?: number;
|
|
269
|
+
timeout?: number;
|
|
270
|
+
environment?: Record<string, string>;
|
|
271
|
+
apiStage?: string;
|
|
272
|
+
cronSchedules?: Array<{
|
|
273
|
+
name: string;
|
|
274
|
+
schedule: string;
|
|
275
|
+
enabled?: boolean;
|
|
276
|
+
}>;
|
|
277
|
+
}): AwsSamTemplate;
|
|
278
|
+
/**
|
|
279
|
+
* 序列化 AWS SAM template 为 YAML 字符串
|
|
280
|
+
*/
|
|
281
|
+
declare function serializeAwsSamConfig(template: AwsSamTemplate): string;
|
|
282
|
+
//#endregion
|
|
283
|
+
//#region src/azure.d.ts
|
|
284
|
+
/**
|
|
285
|
+
* Azure Static Web Apps preset
|
|
286
|
+
*
|
|
287
|
+
* 构建输出:`dist/azure/functions/index.mjs`(Azure Functions handler)
|
|
288
|
+
* 预览命令:`swa start`(Azure SWA CLI 本地模拟)
|
|
289
|
+
* 部署命令:`swa deploy`
|
|
290
|
+
*
|
|
291
|
+
* Azure Functions handler 签名:
|
|
292
|
+
* ```typescript
|
|
293
|
+
* export default async function handler(context, req) { ... };
|
|
294
|
+
* ```
|
|
295
|
+
*/
|
|
296
|
+
declare const azurePreset: {
|
|
297
|
+
extends: string;
|
|
298
|
+
capabilities: CapabilitySet;
|
|
299
|
+
entry: string;
|
|
300
|
+
exportConditions: string[];
|
|
301
|
+
build: {
|
|
302
|
+
outputDir: string;
|
|
303
|
+
format: "esm";
|
|
304
|
+
externals: string[];
|
|
305
|
+
};
|
|
306
|
+
output: {
|
|
307
|
+
dir: string;
|
|
308
|
+
serverDir: string;
|
|
309
|
+
publicDir: string;
|
|
310
|
+
};
|
|
311
|
+
runtime: {
|
|
312
|
+
entry: string;
|
|
313
|
+
handler: string;
|
|
314
|
+
compatibilityDate: string;
|
|
315
|
+
};
|
|
316
|
+
serve: {
|
|
317
|
+
host: string;
|
|
318
|
+
port: number;
|
|
319
|
+
};
|
|
320
|
+
commands: {
|
|
321
|
+
preview: string;
|
|
322
|
+
deploy: string;
|
|
323
|
+
};
|
|
324
|
+
hooks: {
|
|
325
|
+
'build:before': () => Promise<void>;
|
|
326
|
+
'build:after': () => Promise<void>;
|
|
327
|
+
};
|
|
328
|
+
} & {
|
|
329
|
+
_meta: PresetMeta;
|
|
330
|
+
name: string;
|
|
331
|
+
};
|
|
332
|
+
/**
|
|
333
|
+
* Azure Static Web Apps 配置文件(`staticwebapp.config.json`)类型
|
|
334
|
+
*
|
|
335
|
+
* 完整规范见:https://learn.microsoft.com/en-us/azure/static-web-apps/configuration
|
|
336
|
+
*/
|
|
337
|
+
interface StaticWebAppConfig {
|
|
338
|
+
navigationFallback?: {
|
|
339
|
+
rewrite?: string;
|
|
340
|
+
redirect?: string;
|
|
341
|
+
statusCode?: number;
|
|
342
|
+
exclude?: string[];
|
|
343
|
+
};
|
|
344
|
+
routes?: Array<{
|
|
345
|
+
route: string;
|
|
346
|
+
rewrite?: string;
|
|
347
|
+
redirect?: string;
|
|
348
|
+
statusCode?: number;
|
|
349
|
+
methods?: string[];
|
|
350
|
+
headers?: Record<string, string>;
|
|
351
|
+
allowedRoles?: string[];
|
|
352
|
+
}>;
|
|
353
|
+
responseOverrides?: Record<string, {
|
|
354
|
+
rewrite?: string;
|
|
355
|
+
redirect?: string;
|
|
356
|
+
statusCode?: number;
|
|
357
|
+
}>;
|
|
358
|
+
mimeTypes?: Record<string, string>;
|
|
359
|
+
globalHeaders?: Record<string, string>;
|
|
360
|
+
auth?: {
|
|
361
|
+
identityProviders?: {
|
|
362
|
+
azureActiveDirectory?: {
|
|
363
|
+
registration?: {
|
|
364
|
+
openIdIssuer?: string;
|
|
365
|
+
clientIdSettingName?: string;
|
|
366
|
+
clientSecretSettingName?: string;
|
|
367
|
+
};
|
|
368
|
+
userMetadata?: {
|
|
369
|
+
issuer?: string;
|
|
370
|
+
};
|
|
371
|
+
};
|
|
372
|
+
};
|
|
373
|
+
};
|
|
374
|
+
platform?: {
|
|
375
|
+
apiRuntime?: string;
|
|
376
|
+
apiRuntimeVersion?: string;
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* 生成 Azure Static Web Apps 配置对象
|
|
381
|
+
*/
|
|
382
|
+
declare function generateStaticWebAppConfig(options: {
|
|
383
|
+
apiEntry?: string;
|
|
384
|
+
routes?: Array<{
|
|
385
|
+
route: string;
|
|
386
|
+
rewrite?: string;
|
|
387
|
+
redirect?: string;
|
|
388
|
+
statusCode?: number;
|
|
389
|
+
methods?: string[];
|
|
390
|
+
headers?: Record<string, string>;
|
|
391
|
+
}>;
|
|
392
|
+
navigationFallback?: string;
|
|
393
|
+
globalHeaders?: Record<string, string>;
|
|
394
|
+
apiRuntime?: string;
|
|
395
|
+
}): StaticWebAppConfig;
|
|
396
|
+
/**
|
|
397
|
+
* 序列化 staticwebapp.config.json 为 JSON 字符串
|
|
398
|
+
*/
|
|
399
|
+
declare function serializeStaticWebAppConfig(config: StaticWebAppConfig): string;
|
|
400
|
+
//#endregion
|
|
401
|
+
//#region src/bun.d.ts
|
|
402
|
+
/**
|
|
403
|
+
* Bun preset —— Bun 运行时模式
|
|
404
|
+
*
|
|
405
|
+
* 继承 Node preset 的全部能力,使用 Bun 运行时特性:
|
|
406
|
+
* - 原生 TypeScript 支持(无需编译)
|
|
407
|
+
* - 内置 SQLite (bun:sqlite)
|
|
408
|
+
* - 原生 WebSocket (Bun.serve)
|
|
409
|
+
* - 更快的启动和运行速度
|
|
410
|
+
*
|
|
411
|
+
* 构建输出:`dist/bun/server/index.mjs`
|
|
412
|
+
* 预览命令:`bun run dist/bun/server/index.mjs`
|
|
413
|
+
* 部署命令:`bun run dist/bun/server/index.mjs`
|
|
414
|
+
*/
|
|
415
|
+
declare const bunPreset: {
|
|
416
|
+
extends: string;
|
|
417
|
+
capabilities: CapabilitySet;
|
|
418
|
+
entry: string;
|
|
419
|
+
exportConditions: string[];
|
|
420
|
+
build: {
|
|
421
|
+
outputDir: string;
|
|
422
|
+
format: "esm";
|
|
423
|
+
externals: string[];
|
|
424
|
+
};
|
|
425
|
+
output: {
|
|
426
|
+
dir: string;
|
|
427
|
+
serverDir: string;
|
|
428
|
+
publicDir: string;
|
|
429
|
+
};
|
|
430
|
+
runtime: {
|
|
431
|
+
entry: string;
|
|
432
|
+
handler: string;
|
|
433
|
+
compatibilityDate: string;
|
|
434
|
+
};
|
|
435
|
+
serve: {
|
|
436
|
+
host: string;
|
|
437
|
+
port: number;
|
|
438
|
+
};
|
|
439
|
+
commands: {
|
|
440
|
+
preview: string;
|
|
441
|
+
deploy: string;
|
|
442
|
+
};
|
|
443
|
+
hooks: {
|
|
444
|
+
'build:before': () => Promise<void>;
|
|
445
|
+
'build:after': () => Promise<void>;
|
|
446
|
+
};
|
|
447
|
+
} & {
|
|
448
|
+
_meta: PresetMeta;
|
|
449
|
+
name: string;
|
|
450
|
+
};
|
|
451
|
+
/**
|
|
452
|
+
* Bun 配置文件类型
|
|
453
|
+
*
|
|
454
|
+
* Bun 使用 `bunfig.toml` 进行配置(可选,大多数场景无需配置)。
|
|
455
|
+
*/
|
|
456
|
+
interface BunfigConfig {
|
|
457
|
+
install?: {
|
|
458
|
+
registry?: string;
|
|
459
|
+
lockfile?: boolean;
|
|
460
|
+
production?: boolean;
|
|
461
|
+
};
|
|
462
|
+
test?: {
|
|
463
|
+
coverage?: boolean;
|
|
464
|
+
coverageThreshold?: number;
|
|
465
|
+
preload?: string[];
|
|
466
|
+
};
|
|
467
|
+
macro?: Record<string, string>;
|
|
468
|
+
bun?: {
|
|
469
|
+
framework?: boolean;
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* 生成 Bunfig 配置对象
|
|
474
|
+
*/
|
|
475
|
+
declare function generateBunfigConfig(options: {
|
|
476
|
+
registry?: string;
|
|
477
|
+
lockfile?: boolean;
|
|
478
|
+
production?: boolean;
|
|
479
|
+
preload?: string[];
|
|
480
|
+
}): BunfigConfig;
|
|
481
|
+
/**
|
|
482
|
+
* 序列化 Bunfig 配置为 TOML 字符串
|
|
483
|
+
*/
|
|
484
|
+
declare function serializeBunfigConfig(config: BunfigConfig): string;
|
|
485
|
+
//#endregion
|
|
152
486
|
//#region src/cloudflare.d.ts
|
|
153
487
|
declare const cloudflarePreset: {
|
|
154
488
|
capabilities: CapabilitySet;
|
|
@@ -274,6 +608,206 @@ declare function generateWranglerConfig(options: {
|
|
|
274
608
|
}): WranglerConfig;
|
|
275
609
|
declare function serializeWranglerToml(config: WranglerConfig): string;
|
|
276
610
|
//#endregion
|
|
611
|
+
//#region src/deno.d.ts
|
|
612
|
+
/**
|
|
613
|
+
* Deno preset —— Deno 运行时模式
|
|
614
|
+
*
|
|
615
|
+
* 继承 Node preset 的配置,使用 Deno 运行时特性:
|
|
616
|
+
* - 原生 TypeScript 支持(无需编译)
|
|
617
|
+
* - 内置 Deno KV / Deno.cron / Deno.Queue
|
|
618
|
+
* - 原生 WebSocket (Deno.serve)
|
|
619
|
+
* - 安全沙箱(默认无文件系统/网络访问,需显式授权)
|
|
620
|
+
*
|
|
621
|
+
* 构建输出:`dist/deno/server/index.mjs`
|
|
622
|
+
* 预览命令:`deno run --allow-net dist/deno/server/index.mjs`
|
|
623
|
+
* 部署命令:`deno run --allow-net dist/deno/server/index.mjs`
|
|
624
|
+
*/
|
|
625
|
+
declare const denoPreset: {
|
|
626
|
+
extends: string;
|
|
627
|
+
capabilities: CapabilitySet;
|
|
628
|
+
entry: string;
|
|
629
|
+
exportConditions: string[];
|
|
630
|
+
build: {
|
|
631
|
+
outputDir: string;
|
|
632
|
+
format: "esm";
|
|
633
|
+
externals: string[];
|
|
634
|
+
};
|
|
635
|
+
output: {
|
|
636
|
+
dir: string;
|
|
637
|
+
serverDir: string;
|
|
638
|
+
publicDir: string;
|
|
639
|
+
};
|
|
640
|
+
runtime: {
|
|
641
|
+
entry: string;
|
|
642
|
+
handler: string;
|
|
643
|
+
compatibilityDate: string;
|
|
644
|
+
};
|
|
645
|
+
serve: {
|
|
646
|
+
host: string;
|
|
647
|
+
port: number;
|
|
648
|
+
};
|
|
649
|
+
commands: {
|
|
650
|
+
preview: string;
|
|
651
|
+
deploy: string;
|
|
652
|
+
};
|
|
653
|
+
hooks: {
|
|
654
|
+
'build:before': () => Promise<void>;
|
|
655
|
+
'build:after': () => Promise<void>;
|
|
656
|
+
};
|
|
657
|
+
} & {
|
|
658
|
+
_meta: PresetMeta;
|
|
659
|
+
name: string;
|
|
660
|
+
};
|
|
661
|
+
/**
|
|
662
|
+
* Deno 配置文件类型
|
|
663
|
+
*
|
|
664
|
+
* Deno 使用 `deno.json` / `deno.jsonc` 进行配置。
|
|
665
|
+
*/
|
|
666
|
+
interface DenoConfig {
|
|
667
|
+
tasks?: Record<string, string>;
|
|
668
|
+
importMap?: string;
|
|
669
|
+
compilerOptions?: {
|
|
670
|
+
strict?: boolean;
|
|
671
|
+
lib?: string[];
|
|
672
|
+
jsx?: 'jsx' | 'react-jsx' | 'react-jsxdev' | 'preserve';
|
|
673
|
+
jsxImportSource?: string;
|
|
674
|
+
};
|
|
675
|
+
lint?: boolean | {
|
|
676
|
+
files?: {
|
|
677
|
+
include?: string[];
|
|
678
|
+
exclude?: string[];
|
|
679
|
+
};
|
|
680
|
+
rules?: Record<string, 'deny' | 'warn' | 'off'>;
|
|
681
|
+
};
|
|
682
|
+
fmt?: boolean | {
|
|
683
|
+
files?: {
|
|
684
|
+
include?: string[];
|
|
685
|
+
exclude?: string[];
|
|
686
|
+
};
|
|
687
|
+
options?: {
|
|
688
|
+
indentWidth?: number;
|
|
689
|
+
lineWidth?: number;
|
|
690
|
+
singleQuote?: boolean;
|
|
691
|
+
semiColons?: boolean;
|
|
692
|
+
};
|
|
693
|
+
};
|
|
694
|
+
lock?: string | false;
|
|
695
|
+
nodeModulesDir?: boolean;
|
|
696
|
+
vendor?: boolean;
|
|
697
|
+
unstable?: string[];
|
|
698
|
+
}
|
|
699
|
+
/**
|
|
700
|
+
* 生成 Deno 配置对象
|
|
701
|
+
*
|
|
702
|
+
* @param options.lock - 传 `false` 禁用 lockfile,传字符串指定 lockfile 路径
|
|
703
|
+
*/
|
|
704
|
+
declare function generateDenoConfig(options: {
|
|
705
|
+
tasks?: Record<string, string>;
|
|
706
|
+
importMap?: string;
|
|
707
|
+
lock?: string | false;
|
|
708
|
+
nodeModulesDir?: boolean;
|
|
709
|
+
unstable?: string[];
|
|
710
|
+
}): DenoConfig;
|
|
711
|
+
/**
|
|
712
|
+
* 序列化 Deno 配置为 JSON 字符串
|
|
713
|
+
*/
|
|
714
|
+
declare function serializeDenoConfig(config: DenoConfig): string;
|
|
715
|
+
//#endregion
|
|
716
|
+
//#region src/netlify.d.ts
|
|
717
|
+
/**
|
|
718
|
+
* Netlify preset —— Netlify Functions 模式
|
|
719
|
+
*
|
|
720
|
+
* 构建输出:`dist/netlify/functions/index.mjs`(Netlify 自动检测 `functions/` 目录)
|
|
721
|
+
* 预览命令:`netlify dev`
|
|
722
|
+
* 部署命令:`netlify deploy --prod`
|
|
723
|
+
*/
|
|
724
|
+
declare const netlifyPreset: {
|
|
725
|
+
extends: string;
|
|
726
|
+
capabilities: CapabilitySet;
|
|
727
|
+
entry: string;
|
|
728
|
+
exportConditions: string[];
|
|
729
|
+
build: {
|
|
730
|
+
outputDir: string;
|
|
731
|
+
format: "esm";
|
|
732
|
+
externals: string[];
|
|
733
|
+
};
|
|
734
|
+
output: {
|
|
735
|
+
dir: string;
|
|
736
|
+
serverDir: string;
|
|
737
|
+
publicDir: string;
|
|
738
|
+
};
|
|
739
|
+
runtime: {
|
|
740
|
+
entry: string;
|
|
741
|
+
handler: string;
|
|
742
|
+
};
|
|
743
|
+
serve: {
|
|
744
|
+
host: string;
|
|
745
|
+
port: number;
|
|
746
|
+
};
|
|
747
|
+
commands: {
|
|
748
|
+
preview: string;
|
|
749
|
+
deploy: string;
|
|
750
|
+
};
|
|
751
|
+
hooks: {
|
|
752
|
+
'build:before': () => Promise<void>;
|
|
753
|
+
'build:after': () => Promise<void>;
|
|
754
|
+
};
|
|
755
|
+
} & {
|
|
756
|
+
_meta: PresetMeta;
|
|
757
|
+
name: string;
|
|
758
|
+
};
|
|
759
|
+
/**
|
|
760
|
+
* Netlify 配置文件(`netlify.toml`)类型
|
|
761
|
+
*/
|
|
762
|
+
interface NetlifyConfig {
|
|
763
|
+
build?: {
|
|
764
|
+
command?: string;
|
|
765
|
+
publish?: string;
|
|
766
|
+
functions?: string;
|
|
767
|
+
environment?: Record<string, string>;
|
|
768
|
+
};
|
|
769
|
+
functions?: {
|
|
770
|
+
directory?: string;
|
|
771
|
+
node_bundler?: 'esbuild' | 'zisi' | 'nft';
|
|
772
|
+
external_node_modules?: string[];
|
|
773
|
+
included_files?: string[];
|
|
774
|
+
excluded_files?: string[];
|
|
775
|
+
};
|
|
776
|
+
redirects?: Array<{
|
|
777
|
+
from: string;
|
|
778
|
+
to: string;
|
|
779
|
+
status?: number;
|
|
780
|
+
force?: boolean;
|
|
781
|
+
}>;
|
|
782
|
+
headers?: Array<{
|
|
783
|
+
for: string;
|
|
784
|
+
values: Record<string, string>;
|
|
785
|
+
}>;
|
|
786
|
+
}
|
|
787
|
+
/**
|
|
788
|
+
* 生成 Netlify 配置对象
|
|
789
|
+
*/
|
|
790
|
+
declare function generateNetlifyConfig(options: {
|
|
791
|
+
functionsDir?: string;
|
|
792
|
+
publishDir?: string;
|
|
793
|
+
buildCommand?: string;
|
|
794
|
+
redirects?: Array<{
|
|
795
|
+
from: string;
|
|
796
|
+
to: string;
|
|
797
|
+
status?: number;
|
|
798
|
+
force?: boolean;
|
|
799
|
+
}>;
|
|
800
|
+
headers?: Array<{
|
|
801
|
+
for: string;
|
|
802
|
+
values: Record<string, string>;
|
|
803
|
+
}>;
|
|
804
|
+
environment?: Record<string, string>;
|
|
805
|
+
}): NetlifyConfig;
|
|
806
|
+
/**
|
|
807
|
+
* 序列化 Netlify 配置为 TOML 字符串
|
|
808
|
+
*/
|
|
809
|
+
declare function serializeNetlifyConfig(config: NetlifyConfig): string;
|
|
810
|
+
//#endregion
|
|
277
811
|
//#region src/node.d.ts
|
|
278
812
|
declare const nodePreset: {
|
|
279
813
|
extends: string;
|
|
@@ -319,6 +853,173 @@ declare const standardPreset: {
|
|
|
319
853
|
name: string;
|
|
320
854
|
};
|
|
321
855
|
//#endregion
|
|
856
|
+
//#region src/vercel.d.ts
|
|
857
|
+
/**
|
|
858
|
+
* Vercel preset —— Serverless Functions 模式
|
|
859
|
+
*
|
|
860
|
+
* 构建输出:`dist/vercel/server/index.mjs`(供 Vercel 自动检测为 Serverless Function)
|
|
861
|
+
* 预览命令:`vercel dev`
|
|
862
|
+
* 部署命令:`vercel --prod`
|
|
863
|
+
*/
|
|
864
|
+
declare const vercelPreset: {
|
|
865
|
+
extends: string;
|
|
866
|
+
capabilities: CapabilitySet;
|
|
867
|
+
entry: string;
|
|
868
|
+
exportConditions: string[];
|
|
869
|
+
build: {
|
|
870
|
+
outputDir: string;
|
|
871
|
+
format: "esm";
|
|
872
|
+
externals: string[];
|
|
873
|
+
};
|
|
874
|
+
output: {
|
|
875
|
+
dir: string;
|
|
876
|
+
serverDir: string;
|
|
877
|
+
publicDir: string;
|
|
878
|
+
};
|
|
879
|
+
runtime: {
|
|
880
|
+
entry: string;
|
|
881
|
+
handler: string;
|
|
882
|
+
};
|
|
883
|
+
serve: {
|
|
884
|
+
host: string;
|
|
885
|
+
port: number;
|
|
886
|
+
};
|
|
887
|
+
commands: {
|
|
888
|
+
preview: string;
|
|
889
|
+
deploy: string;
|
|
890
|
+
};
|
|
891
|
+
hooks: {
|
|
892
|
+
'build:before': () => Promise<void>;
|
|
893
|
+
'build:after': () => Promise<void>;
|
|
894
|
+
};
|
|
895
|
+
} & {
|
|
896
|
+
_meta: PresetMeta;
|
|
897
|
+
name: string;
|
|
898
|
+
};
|
|
899
|
+
/**
|
|
900
|
+
* Vercel Edge preset —— Edge Functions 模式
|
|
901
|
+
*
|
|
902
|
+
* 基于 V8 isolates,无 Node.js 兼容,全球低延迟。
|
|
903
|
+
* 构建输出:`dist/vercel-edge/edge/index.mjs`
|
|
904
|
+
*/
|
|
905
|
+
declare const vercelEdgePreset: {
|
|
906
|
+
extends: string;
|
|
907
|
+
capabilities: CapabilitySet;
|
|
908
|
+
entry: string;
|
|
909
|
+
exportConditions: string[];
|
|
910
|
+
build: {
|
|
911
|
+
outputDir: string;
|
|
912
|
+
format: "esm";
|
|
913
|
+
minify: true;
|
|
914
|
+
externals: string[];
|
|
915
|
+
rollupConfig: {
|
|
916
|
+
external: string[];
|
|
917
|
+
};
|
|
918
|
+
};
|
|
919
|
+
output: {
|
|
920
|
+
dir: string;
|
|
921
|
+
serverDir: string;
|
|
922
|
+
publicDir: string;
|
|
923
|
+
};
|
|
924
|
+
runtime: {
|
|
925
|
+
entry: string;
|
|
926
|
+
handler: string;
|
|
927
|
+
compatibilityDate: string;
|
|
928
|
+
};
|
|
929
|
+
serve: {
|
|
930
|
+
host: string;
|
|
931
|
+
port: number;
|
|
932
|
+
};
|
|
933
|
+
commands: {
|
|
934
|
+
preview: string;
|
|
935
|
+
deploy: string;
|
|
936
|
+
};
|
|
937
|
+
} & {
|
|
938
|
+
_meta: PresetMeta;
|
|
939
|
+
name: string;
|
|
940
|
+
};
|
|
941
|
+
/**
|
|
942
|
+
* Vercel 配置文件(`vercel.json`)类型
|
|
943
|
+
*/
|
|
944
|
+
interface VercelConfig {
|
|
945
|
+
version?: number;
|
|
946
|
+
builds?: Array<{
|
|
947
|
+
src: string;
|
|
948
|
+
use?: string;
|
|
949
|
+
config?: Record<string, unknown>;
|
|
950
|
+
}>;
|
|
951
|
+
functions?: Record<string, {
|
|
952
|
+
runtime?: string;
|
|
953
|
+
memory?: number;
|
|
954
|
+
maxDuration?: number;
|
|
955
|
+
includeFiles?: string | string[];
|
|
956
|
+
excludeFiles?: string | string[];
|
|
957
|
+
}>;
|
|
958
|
+
routes?: Array<{
|
|
959
|
+
src: string;
|
|
960
|
+
dest?: string;
|
|
961
|
+
status?: number;
|
|
962
|
+
headers?: Record<string, string>;
|
|
963
|
+
}>;
|
|
964
|
+
rewrites?: Array<{
|
|
965
|
+
source: string;
|
|
966
|
+
destination: string;
|
|
967
|
+
}>;
|
|
968
|
+
redirects?: Array<{
|
|
969
|
+
source: string;
|
|
970
|
+
destination: string;
|
|
971
|
+
permanent?: boolean;
|
|
972
|
+
}>;
|
|
973
|
+
headers?: Array<{
|
|
974
|
+
source: string;
|
|
975
|
+
headers: Array<{
|
|
976
|
+
key: string;
|
|
977
|
+
value: string;
|
|
978
|
+
}>;
|
|
979
|
+
}>;
|
|
980
|
+
cron?: Array<{
|
|
981
|
+
path: string;
|
|
982
|
+
schedule: string;
|
|
983
|
+
}>;
|
|
984
|
+
env?: Record<string, string>;
|
|
985
|
+
build?: {
|
|
986
|
+
env?: Record<string, string>;
|
|
987
|
+
command?: string;
|
|
988
|
+
};
|
|
989
|
+
}
|
|
990
|
+
/**
|
|
991
|
+
* 生成 Vercel 配置对象
|
|
992
|
+
*/
|
|
993
|
+
declare function generateVercelConfig(options: {
|
|
994
|
+
entry?: string;
|
|
995
|
+
functions?: Record<string, {
|
|
996
|
+
maxDuration?: number;
|
|
997
|
+
memory?: number;
|
|
998
|
+
}>;
|
|
999
|
+
rewrites?: Array<{
|
|
1000
|
+
source: string;
|
|
1001
|
+
destination: string;
|
|
1002
|
+
}>;
|
|
1003
|
+
redirects?: Array<{
|
|
1004
|
+
source: string;
|
|
1005
|
+
destination: string;
|
|
1006
|
+
permanent?: boolean;
|
|
1007
|
+
}>;
|
|
1008
|
+
headers?: Array<{
|
|
1009
|
+
source: string;
|
|
1010
|
+
headers: Record<string, string>;
|
|
1011
|
+
}>;
|
|
1012
|
+
cron?: Array<{
|
|
1013
|
+
path: string;
|
|
1014
|
+
schedule: string;
|
|
1015
|
+
}>;
|
|
1016
|
+
env?: Record<string, string>;
|
|
1017
|
+
}): VercelConfig;
|
|
1018
|
+
/**
|
|
1019
|
+
* 序列化 Vercel 配置为 JSON 字符串
|
|
1020
|
+
*/
|
|
1021
|
+
declare function serializeVercelConfig(config: VercelConfig): string;
|
|
1022
|
+
//#endregion
|
|
322
1023
|
//#region src/detect.d.ts
|
|
323
1024
|
interface PresetDetectionHints {
|
|
324
1025
|
cwd?: string;
|
|
@@ -339,4 +1040,4 @@ declare function listDetectablePresets(): PresetDefinition[];
|
|
|
339
1040
|
declare function registerBuiltinPresets(): void;
|
|
340
1041
|
declare function resolvePresetByName(name: string): ResolvedPreset;
|
|
341
1042
|
//#endregion
|
|
342
|
-
export { CapabilityDiagnosisResult, CapabilityDiagnostic, CapabilityInfo, CapabilityName, CapabilityRequirement, CapabilitySet, DEV_REQUIREMENTS, NODE_CAPABILITIES, NODE_REQUIREMENTS, type Preset, type PresetBuildContext, type PresetDefinition, type PresetDetectionHints, type PresetDetectionResult, type PresetDevContext, type PresetHooks, type PresetMeta, type ResolvedPreset, RuntimeTarget, STANDARD_CAPABILITIES, WORKER_CAPABILITIES, type WranglerConfig, cloudflareDevPreset, cloudflarePreset, createCapabilitySet, definePreset, detectPreset, diagnoseCapabilities, generateWranglerConfig, getPresetAliases, getPresetNames, getRegisteredPresets, listDetectablePresets, nodePreset, registerBuiltinPresets, registerPreset, requireCapability, resolvePreset, resolvePresetByName, resolvePresetWithDetection, serializeWranglerToml, standardPreset };
|
|
1043
|
+
export { type AwsSamResource, type AwsSamTemplate, type BunfigConfig, CapabilityDiagnosisResult, CapabilityDiagnostic, CapabilityInfo, CapabilityName, CapabilityRequirement, CapabilitySet, DEV_REQUIREMENTS, type DenoConfig, NODE_CAPABILITIES, NODE_REQUIREMENTS, type NetlifyConfig, type Preset, type PresetBuildContext, type PresetDefinition, type PresetDetectionHints, type PresetDetectionResult, type PresetDevContext, type PresetHooks, type PresetMeta, type ResolvedPreset, RuntimeTarget, STANDARD_CAPABILITIES, type StaticWebAppConfig, type VercelConfig, WORKER_CAPABILITIES, type WranglerConfig, awsPreset, azurePreset, bunPreset, cloudflareDevPreset, cloudflarePreset, createCapabilitySet, definePreset, denoPreset, detectPreset, diagnoseCapabilities, generateAwsSamConfig, generateBunfigConfig, generateDenoConfig, generateNetlifyConfig, generateStaticWebAppConfig, generateVercelConfig, generateWranglerConfig, getPresetAliases, getPresetNames, getRegisteredPresets, listDetectablePresets, netlifyPreset, nodePreset, registerBuiltinPresets, registerPreset, requireCapability, resolvePreset, resolvePresetByName, resolvePresetWithDetection, serializeAwsSamConfig, serializeBunfigConfig, serializeDenoConfig, serializeNetlifyConfig, serializeStaticWebAppConfig, serializeVercelConfig, serializeWranglerToml, standardPreset, vercelEdgePreset, vercelPreset };
|