@ubean/preset 0.4.4 → 0.4.6
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 +54 -54
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/capabilities.d.ts
|
|
2
|
-
type RuntimeTarget = 'node' | 'worker' | 'browser' | 'deno' | 'bun' | 'edge-light';
|
|
3
|
-
interface CapabilitySet {
|
|
2
|
+
export type RuntimeTarget = 'node' | 'worker' | 'browser' | 'deno' | 'bun' | 'edge-light';
|
|
3
|
+
export interface CapabilitySet {
|
|
4
4
|
staticServe: boolean;
|
|
5
5
|
websocket: boolean;
|
|
6
6
|
sse: boolean;
|
|
@@ -21,36 +21,36 @@ interface CapabilitySet {
|
|
|
21
21
|
multipart: boolean;
|
|
22
22
|
rpc: boolean;
|
|
23
23
|
}
|
|
24
|
-
interface CapabilityInfo extends CapabilitySet {
|
|
24
|
+
export interface CapabilityInfo extends CapabilitySet {
|
|
25
25
|
runtime: RuntimeTarget[];
|
|
26
26
|
}
|
|
27
|
-
type CapabilityName = keyof CapabilitySet;
|
|
28
|
-
interface CapabilityRequirement {
|
|
27
|
+
export type CapabilityName = keyof CapabilitySet;
|
|
28
|
+
export interface CapabilityRequirement {
|
|
29
29
|
capability: CapabilityName;
|
|
30
30
|
required: boolean;
|
|
31
31
|
message?: string;
|
|
32
32
|
}
|
|
33
|
-
interface CapabilityDiagnostic {
|
|
33
|
+
export interface CapabilityDiagnostic {
|
|
34
34
|
capability: CapabilityName;
|
|
35
35
|
supported: boolean;
|
|
36
36
|
required: boolean;
|
|
37
37
|
message: string;
|
|
38
38
|
}
|
|
39
|
-
interface CapabilityDiagnosisResult {
|
|
39
|
+
export interface CapabilityDiagnosisResult {
|
|
40
40
|
valid: boolean;
|
|
41
41
|
diagnostics: CapabilityDiagnostic[];
|
|
42
42
|
errors: string[];
|
|
43
43
|
warnings: string[];
|
|
44
44
|
presetName: string;
|
|
45
45
|
}
|
|
46
|
-
declare function createCapabilitySet(overrides?: Partial<CapabilitySet>): CapabilitySet;
|
|
47
|
-
declare function diagnoseCapabilities(presetName: string, presetCapabilities: Partial<CapabilitySet>, requirements: CapabilityRequirement[]): CapabilityDiagnosisResult;
|
|
48
|
-
declare function requireCapability(capability: CapabilityName, required?: boolean, message?: string): CapabilityRequirement;
|
|
49
|
-
declare const NODE_CAPABILITIES: CapabilitySet;
|
|
50
|
-
declare const STANDARD_CAPABILITIES: CapabilitySet;
|
|
51
|
-
declare const WORKER_CAPABILITIES: CapabilitySet;
|
|
52
|
-
declare const DEV_REQUIREMENTS: CapabilityRequirement[];
|
|
53
|
-
declare const NODE_REQUIREMENTS: CapabilityRequirement[];
|
|
46
|
+
export declare function createCapabilitySet(overrides?: Partial<CapabilitySet>): CapabilitySet;
|
|
47
|
+
export declare function diagnoseCapabilities(presetName: string, presetCapabilities: Partial<CapabilitySet>, requirements: CapabilityRequirement[]): CapabilityDiagnosisResult;
|
|
48
|
+
export declare function requireCapability(capability: CapabilityName, required?: boolean, message?: string): CapabilityRequirement;
|
|
49
|
+
export declare const NODE_CAPABILITIES: CapabilitySet;
|
|
50
|
+
export declare const STANDARD_CAPABILITIES: CapabilitySet;
|
|
51
|
+
export declare const WORKER_CAPABILITIES: CapabilitySet;
|
|
52
|
+
export declare const DEV_REQUIREMENTS: CapabilityRequirement[];
|
|
53
|
+
export declare const NODE_REQUIREMENTS: CapabilityRequirement[];
|
|
54
54
|
//#endregion
|
|
55
55
|
//#region src/registry.d.ts
|
|
56
56
|
type PresetHooks = {
|
|
@@ -137,17 +137,17 @@ interface ResolvedPreset extends PresetDefinition {
|
|
|
137
137
|
name: string;
|
|
138
138
|
_meta: PresetMeta;
|
|
139
139
|
}
|
|
140
|
-
declare function definePreset<P extends PresetDefinition>(preset: P, meta?: PresetMeta): P & {
|
|
140
|
+
export declare function definePreset<P extends PresetDefinition>(preset: P, meta?: PresetMeta): P & {
|
|
141
141
|
_meta: PresetMeta;
|
|
142
142
|
name: string;
|
|
143
143
|
};
|
|
144
|
-
declare function resolvePreset(name: string): ResolvedPreset | undefined;
|
|
145
|
-
declare function getRegisteredPresets(): Array<PresetDefinition & {
|
|
144
|
+
export declare function resolvePreset(name: string): ResolvedPreset | undefined;
|
|
145
|
+
export declare function getRegisteredPresets(): Array<PresetDefinition & {
|
|
146
146
|
_meta: PresetMeta;
|
|
147
147
|
}>;
|
|
148
|
-
declare function registerPreset(preset: Preset, meta?: PresetMeta): void;
|
|
149
|
-
declare function getPresetNames(): string[];
|
|
150
|
-
declare function getPresetAliases(): Map<string, string>;
|
|
148
|
+
export declare function registerPreset(preset: Preset, meta?: PresetMeta): void;
|
|
149
|
+
export declare function getPresetNames(): string[];
|
|
150
|
+
export declare function getPresetAliases(): Map<string, string>;
|
|
151
151
|
//#endregion
|
|
152
152
|
//#region src/aws.d.ts
|
|
153
153
|
/**
|
|
@@ -162,7 +162,7 @@ declare function getPresetAliases(): Map<string, string>;
|
|
|
162
162
|
* export const handler = async (event, context) => { ... };
|
|
163
163
|
* ```
|
|
164
164
|
*/
|
|
165
|
-
declare const awsPreset: {
|
|
165
|
+
export declare const awsPreset: {
|
|
166
166
|
extends: string;
|
|
167
167
|
capabilities: CapabilitySet;
|
|
168
168
|
entry: string;
|
|
@@ -260,7 +260,7 @@ interface AwsSamResource {
|
|
|
260
260
|
/**
|
|
261
261
|
* 生成 AWS SAM template.yaml 配置对象
|
|
262
262
|
*/
|
|
263
|
-
declare function generateAwsSamConfig(options: {
|
|
263
|
+
export declare function generateAwsSamConfig(options: {
|
|
264
264
|
functionName?: string;
|
|
265
265
|
handler?: string;
|
|
266
266
|
runtime?: string;
|
|
@@ -278,7 +278,7 @@ declare function generateAwsSamConfig(options: {
|
|
|
278
278
|
/**
|
|
279
279
|
* 序列化 AWS SAM template 为 YAML 字符串
|
|
280
280
|
*/
|
|
281
|
-
declare function serializeAwsSamConfig(template: AwsSamTemplate): string;
|
|
281
|
+
export declare function serializeAwsSamConfig(template: AwsSamTemplate): string;
|
|
282
282
|
//#endregion
|
|
283
283
|
//#region src/azure.d.ts
|
|
284
284
|
/**
|
|
@@ -293,7 +293,7 @@ declare function serializeAwsSamConfig(template: AwsSamTemplate): string;
|
|
|
293
293
|
* export default async function handler(context, req) { ... };
|
|
294
294
|
* ```
|
|
295
295
|
*/
|
|
296
|
-
declare const azurePreset: {
|
|
296
|
+
export declare const azurePreset: {
|
|
297
297
|
extends: string;
|
|
298
298
|
capabilities: CapabilitySet;
|
|
299
299
|
entry: string;
|
|
@@ -379,7 +379,7 @@ interface StaticWebAppConfig {
|
|
|
379
379
|
/**
|
|
380
380
|
* 生成 Azure Static Web Apps 配置对象
|
|
381
381
|
*/
|
|
382
|
-
declare function generateStaticWebAppConfig(options: {
|
|
382
|
+
export declare function generateStaticWebAppConfig(options: {
|
|
383
383
|
apiEntry?: string;
|
|
384
384
|
routes?: Array<{
|
|
385
385
|
route: string;
|
|
@@ -396,7 +396,7 @@ declare function generateStaticWebAppConfig(options: {
|
|
|
396
396
|
/**
|
|
397
397
|
* 序列化 staticwebapp.config.json 为 JSON 字符串
|
|
398
398
|
*/
|
|
399
|
-
declare function serializeStaticWebAppConfig(config: StaticWebAppConfig): string;
|
|
399
|
+
export declare function serializeStaticWebAppConfig(config: StaticWebAppConfig): string;
|
|
400
400
|
//#endregion
|
|
401
401
|
//#region src/bun.d.ts
|
|
402
402
|
/**
|
|
@@ -412,7 +412,7 @@ declare function serializeStaticWebAppConfig(config: StaticWebAppConfig): string
|
|
|
412
412
|
* 预览命令:`bun run dist/bun/server/index.mjs`
|
|
413
413
|
* 部署命令:`bun run dist/bun/server/index.mjs`
|
|
414
414
|
*/
|
|
415
|
-
declare const bunPreset: {
|
|
415
|
+
export declare const bunPreset: {
|
|
416
416
|
extends: string;
|
|
417
417
|
capabilities: CapabilitySet;
|
|
418
418
|
entry: string;
|
|
@@ -472,7 +472,7 @@ interface BunfigConfig {
|
|
|
472
472
|
/**
|
|
473
473
|
* 生成 Bunfig 配置对象
|
|
474
474
|
*/
|
|
475
|
-
declare function generateBunfigConfig(options: {
|
|
475
|
+
export declare function generateBunfigConfig(options: {
|
|
476
476
|
registry?: string;
|
|
477
477
|
lockfile?: boolean;
|
|
478
478
|
production?: boolean;
|
|
@@ -481,10 +481,10 @@ declare function generateBunfigConfig(options: {
|
|
|
481
481
|
/**
|
|
482
482
|
* 序列化 Bunfig 配置为 TOML 字符串
|
|
483
483
|
*/
|
|
484
|
-
declare function serializeBunfigConfig(config: BunfigConfig): string;
|
|
484
|
+
export declare function serializeBunfigConfig(config: BunfigConfig): string;
|
|
485
485
|
//#endregion
|
|
486
486
|
//#region src/cloudflare.d.ts
|
|
487
|
-
declare const cloudflarePreset: {
|
|
487
|
+
export declare const cloudflarePreset: {
|
|
488
488
|
capabilities: CapabilitySet;
|
|
489
489
|
entry: string;
|
|
490
490
|
exportConditions: string[];
|
|
@@ -528,7 +528,7 @@ declare const cloudflarePreset: {
|
|
|
528
528
|
_meta: PresetMeta;
|
|
529
529
|
name: string;
|
|
530
530
|
};
|
|
531
|
-
declare const cloudflareDevPreset: {
|
|
531
|
+
export declare const cloudflareDevPreset: {
|
|
532
532
|
extends: string;
|
|
533
533
|
devServer: {
|
|
534
534
|
runner: string;
|
|
@@ -578,7 +578,7 @@ interface WranglerConfig {
|
|
|
578
578
|
binding?: string;
|
|
579
579
|
};
|
|
580
580
|
}
|
|
581
|
-
declare function generateWranglerConfig(options: {
|
|
581
|
+
export declare function generateWranglerConfig(options: {
|
|
582
582
|
name: string;
|
|
583
583
|
entry?: string;
|
|
584
584
|
compatibilityDate?: string;
|
|
@@ -606,7 +606,7 @@ declare function generateWranglerConfig(options: {
|
|
|
606
606
|
assetsDir?: string;
|
|
607
607
|
observability?: boolean;
|
|
608
608
|
}): WranglerConfig;
|
|
609
|
-
declare function serializeWranglerToml(config: WranglerConfig): string;
|
|
609
|
+
export declare function serializeWranglerToml(config: WranglerConfig): string;
|
|
610
610
|
//#endregion
|
|
611
611
|
//#region src/deno.d.ts
|
|
612
612
|
/**
|
|
@@ -622,7 +622,7 @@ declare function serializeWranglerToml(config: WranglerConfig): string;
|
|
|
622
622
|
* 预览命令:`deno run --allow-net dist/deno/server/index.mjs`
|
|
623
623
|
* 部署命令:`deno run --allow-net dist/deno/server/index.mjs`
|
|
624
624
|
*/
|
|
625
|
-
declare const denoPreset: {
|
|
625
|
+
export declare const denoPreset: {
|
|
626
626
|
extends: string;
|
|
627
627
|
capabilities: CapabilitySet;
|
|
628
628
|
entry: string;
|
|
@@ -701,7 +701,7 @@ interface DenoConfig {
|
|
|
701
701
|
*
|
|
702
702
|
* @param options.lock - 传 `false` 禁用 lockfile,传字符串指定 lockfile 路径
|
|
703
703
|
*/
|
|
704
|
-
declare function generateDenoConfig(options: {
|
|
704
|
+
export declare function generateDenoConfig(options: {
|
|
705
705
|
tasks?: Record<string, string>;
|
|
706
706
|
importMap?: string;
|
|
707
707
|
lock?: string | false;
|
|
@@ -711,7 +711,7 @@ declare function generateDenoConfig(options: {
|
|
|
711
711
|
/**
|
|
712
712
|
* 序列化 Deno 配置为 JSON 字符串
|
|
713
713
|
*/
|
|
714
|
-
declare function serializeDenoConfig(config: DenoConfig): string;
|
|
714
|
+
export declare function serializeDenoConfig(config: DenoConfig): string;
|
|
715
715
|
//#endregion
|
|
716
716
|
//#region src/netlify.d.ts
|
|
717
717
|
/**
|
|
@@ -721,7 +721,7 @@ declare function serializeDenoConfig(config: DenoConfig): string;
|
|
|
721
721
|
* 预览命令:`netlify dev`
|
|
722
722
|
* 部署命令:`netlify deploy --prod`
|
|
723
723
|
*/
|
|
724
|
-
declare const netlifyPreset: {
|
|
724
|
+
export declare const netlifyPreset: {
|
|
725
725
|
extends: string;
|
|
726
726
|
capabilities: CapabilitySet;
|
|
727
727
|
entry: string;
|
|
@@ -787,7 +787,7 @@ interface NetlifyConfig {
|
|
|
787
787
|
/**
|
|
788
788
|
* 生成 Netlify 配置对象
|
|
789
789
|
*/
|
|
790
|
-
declare function generateNetlifyConfig(options: {
|
|
790
|
+
export declare function generateNetlifyConfig(options: {
|
|
791
791
|
functionsDir?: string;
|
|
792
792
|
publishDir?: string;
|
|
793
793
|
buildCommand?: string;
|
|
@@ -806,10 +806,10 @@ declare function generateNetlifyConfig(options: {
|
|
|
806
806
|
/**
|
|
807
807
|
* 序列化 Netlify 配置为 TOML 字符串
|
|
808
808
|
*/
|
|
809
|
-
declare function serializeNetlifyConfig(config: NetlifyConfig): string;
|
|
809
|
+
export declare function serializeNetlifyConfig(config: NetlifyConfig): string;
|
|
810
810
|
//#endregion
|
|
811
811
|
//#region src/node.d.ts
|
|
812
|
-
declare const nodePreset: {
|
|
812
|
+
export declare const nodePreset: {
|
|
813
813
|
extends: string;
|
|
814
814
|
capabilities: CapabilitySet;
|
|
815
815
|
build: {
|
|
@@ -834,7 +834,7 @@ declare const nodePreset: {
|
|
|
834
834
|
};
|
|
835
835
|
//#endregion
|
|
836
836
|
//#region src/standard.d.ts
|
|
837
|
-
declare const standardPreset: {
|
|
837
|
+
export declare const standardPreset: {
|
|
838
838
|
capabilities: CapabilitySet;
|
|
839
839
|
build: {
|
|
840
840
|
outputDir: string;
|
|
@@ -861,7 +861,7 @@ declare const standardPreset: {
|
|
|
861
861
|
* 预览命令:`vercel dev`
|
|
862
862
|
* 部署命令:`vercel --prod`
|
|
863
863
|
*/
|
|
864
|
-
declare const vercelPreset: {
|
|
864
|
+
export declare const vercelPreset: {
|
|
865
865
|
extends: string;
|
|
866
866
|
capabilities: CapabilitySet;
|
|
867
867
|
entry: string;
|
|
@@ -902,7 +902,7 @@ declare const vercelPreset: {
|
|
|
902
902
|
* 基于 V8 isolates,无 Node.js 兼容,全球低延迟。
|
|
903
903
|
* 构建输出:`dist/vercel-edge/edge/index.mjs`
|
|
904
904
|
*/
|
|
905
|
-
declare const vercelEdgePreset: {
|
|
905
|
+
export declare const vercelEdgePreset: {
|
|
906
906
|
extends: string;
|
|
907
907
|
capabilities: CapabilitySet;
|
|
908
908
|
entry: string;
|
|
@@ -990,7 +990,7 @@ interface VercelConfig {
|
|
|
990
990
|
/**
|
|
991
991
|
* 生成 Vercel 配置对象
|
|
992
992
|
*/
|
|
993
|
-
declare function generateVercelConfig(options: {
|
|
993
|
+
export declare function generateVercelConfig(options: {
|
|
994
994
|
entry?: string;
|
|
995
995
|
functions?: Record<string, {
|
|
996
996
|
maxDuration?: number;
|
|
@@ -1018,7 +1018,7 @@ declare function generateVercelConfig(options: {
|
|
|
1018
1018
|
/**
|
|
1019
1019
|
* 序列化 Vercel 配置为 JSON 字符串
|
|
1020
1020
|
*/
|
|
1021
|
-
declare function serializeVercelConfig(config: VercelConfig): string;
|
|
1021
|
+
export declare function serializeVercelConfig(config: VercelConfig): string;
|
|
1022
1022
|
//#endregion
|
|
1023
1023
|
//#region src/detect.d.ts
|
|
1024
1024
|
interface PresetDetectionHints {
|
|
@@ -1032,9 +1032,9 @@ interface PresetDetectionResult {
|
|
|
1032
1032
|
source: 'explicit' | 'config-file' | 'environment' | 'default';
|
|
1033
1033
|
reason?: string;
|
|
1034
1034
|
}
|
|
1035
|
-
declare function detectPreset(hints?: PresetDetectionHints): PresetDetectionResult;
|
|
1036
|
-
declare function resolvePresetWithDetection(explicitPreset?: string, cwd?: string): PresetDetectionResult;
|
|
1037
|
-
declare function listDetectablePresets(): PresetDefinition[];
|
|
1035
|
+
export declare function detectPreset(hints?: PresetDetectionHints): PresetDetectionResult;
|
|
1036
|
+
export declare function resolvePresetWithDetection(explicitPreset?: string, cwd?: string): PresetDetectionResult;
|
|
1037
|
+
export declare function listDetectablePresets(): PresetDefinition[];
|
|
1038
1038
|
//#endregion
|
|
1039
1039
|
//#region src/cache-default.d.ts
|
|
1040
1040
|
/**
|
|
@@ -1055,17 +1055,17 @@ interface ResolvedCacheStoreConfig {
|
|
|
1055
1055
|
store: 'memory' | 'fs';
|
|
1056
1056
|
dir?: string;
|
|
1057
1057
|
}
|
|
1058
|
-
declare function isEphemeralCachePreset(presetName: string): boolean;
|
|
1058
|
+
export declare function isEphemeralCachePreset(presetName: string): boolean;
|
|
1059
1059
|
/**
|
|
1060
1060
|
* Resolve the production cache backend for a build preset.
|
|
1061
1061
|
*
|
|
1062
1062
|
* Dev / `createUbeanApp` still treat `auto` as memory so tests and
|
|
1063
1063
|
* local servers do not write a cache directory unless asked.
|
|
1064
1064
|
*/
|
|
1065
|
-
declare function resolveProductionCacheStore(presetName: string, explicit?: CacheStoreConfig): ResolvedCacheStoreConfig;
|
|
1065
|
+
export declare function resolveProductionCacheStore(presetName: string, explicit?: CacheStoreConfig): ResolvedCacheStoreConfig;
|
|
1066
1066
|
//#endregion
|
|
1067
1067
|
//#region src/index.d.ts
|
|
1068
|
-
declare function registerBuiltinPresets(): void;
|
|
1069
|
-
declare function resolvePresetByName(name: string): ResolvedPreset;
|
|
1068
|
+
export declare function registerBuiltinPresets(): void;
|
|
1069
|
+
export declare function resolvePresetByName(name: string): ResolvedPreset;
|
|
1070
1070
|
//#endregion
|
|
1071
|
-
export {
|
|
1071
|
+
export type { AwsSamResource, AwsSamTemplate, BunfigConfig, CacheStoreConfig, CacheStoreKind, DenoConfig, NetlifyConfig, Preset, PresetBuildContext, PresetDefinition, PresetDetectionHints, PresetDetectionResult, PresetDevContext, PresetHooks, PresetMeta, ResolvedCacheStoreConfig, ResolvedPreset, StaticWebAppConfig, VercelConfig, WranglerConfig };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ubean/preset",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.6",
|
|
4
4
|
"description": "Deployment presets for ubean (standard, node, cloudflare, vercel, netlify, bun, deno)",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@types/node": "^26.5.0",
|
|
20
|
-
"typescript": "
|
|
21
|
-
"vite-plus": "0.3.
|
|
20
|
+
"typescript": "npm:typescript-native-bridge@latest",
|
|
21
|
+
"vite-plus": "0.3.1"
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
24
|
"build": "vp pack",
|