miniflare 0.0.0-a027c1fa8 → 0.0.0-a602de088
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/src/index.d.ts +105 -24
- package/dist/src/index.js +337 -256
- package/dist/src/index.js.map +3 -3
- package/dist/src/workers/assets/assets.worker.js +9196 -92
- package/dist/src/workers/assets/assets.worker.js.map +3 -3
- package/dist/src/workers/assets/router.worker.js +8684 -6
- package/dist/src/workers/assets/router.worker.js.map +3 -3
- package/dist/src/workers/queues/broker.worker.js +11 -5
- package/dist/src/workers/queues/broker.worker.js.map +1 -1
- package/package.json +2 -2
package/dist/src/index.d.ts
CHANGED
|
@@ -58,6 +58,13 @@ export declare class __MiniflareFunctionWrapper {
|
|
|
58
58
|
|
|
59
59
|
export declare type AnyHeaders = http.IncomingHttpHeaders | string[];
|
|
60
60
|
|
|
61
|
+
export declare type AssetReverseMap = {
|
|
62
|
+
[pathHash: string]: {
|
|
63
|
+
filePath: string;
|
|
64
|
+
contentType: string;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
|
|
61
68
|
export declare const ASSETS_PLUGIN: Plugin<typeof AssetsOptionsSchema>;
|
|
62
69
|
|
|
63
70
|
export declare const AssetsOptionsSchema: z.ZodObject<{
|
|
@@ -66,23 +73,41 @@ export declare const AssetsOptionsSchema: z.ZodObject<{
|
|
|
66
73
|
path: z.ZodEffects<z.ZodString, string, string>;
|
|
67
74
|
bindingName: z.ZodOptional<z.ZodString>;
|
|
68
75
|
routingConfig: z.ZodObject<{
|
|
69
|
-
|
|
76
|
+
has_user_worker: z.ZodOptional<z.ZodBoolean>;
|
|
70
77
|
}, "strip", z.ZodTypeAny, {
|
|
71
|
-
|
|
78
|
+
has_user_worker?: boolean;
|
|
72
79
|
}, {
|
|
73
|
-
|
|
80
|
+
has_user_worker?: boolean;
|
|
81
|
+
}>;
|
|
82
|
+
assetConfig: z.ZodObject<{
|
|
83
|
+
html_handling: z.ZodOptional<z.ZodEnum<["auto-trailing-slash", "force-trailing-slash", "drop-trailing-slash", "none"]>>;
|
|
84
|
+
not_found_handling: z.ZodOptional<z.ZodEnum<["single-page-application", "404-page", "none"]>>;
|
|
85
|
+
}, "strip", z.ZodTypeAny, {
|
|
86
|
+
html_handling?: "none" | "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash";
|
|
87
|
+
not_found_handling?: "none" | "single-page-application" | "404-page";
|
|
88
|
+
}, {
|
|
89
|
+
html_handling?: "none" | "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash";
|
|
90
|
+
not_found_handling?: "none" | "single-page-application" | "404-page";
|
|
74
91
|
}>;
|
|
75
92
|
}, "strip", z.ZodTypeAny, {
|
|
76
93
|
path: string;
|
|
77
94
|
routingConfig: {
|
|
78
|
-
|
|
95
|
+
has_user_worker?: boolean;
|
|
96
|
+
};
|
|
97
|
+
assetConfig: {
|
|
98
|
+
html_handling?: "none" | "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash";
|
|
99
|
+
not_found_handling?: "none" | "single-page-application" | "404-page";
|
|
79
100
|
};
|
|
80
101
|
workerName?: string | undefined;
|
|
81
102
|
bindingName?: string | undefined;
|
|
82
103
|
}, {
|
|
83
104
|
path: string;
|
|
84
105
|
routingConfig: {
|
|
85
|
-
|
|
106
|
+
has_user_worker?: boolean;
|
|
107
|
+
};
|
|
108
|
+
assetConfig: {
|
|
109
|
+
html_handling?: "none" | "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash";
|
|
110
|
+
not_found_handling?: "none" | "single-page-application" | "404-page";
|
|
86
111
|
};
|
|
87
112
|
workerName?: string | undefined;
|
|
88
113
|
bindingName?: string | undefined;
|
|
@@ -91,7 +116,11 @@ export declare const AssetsOptionsSchema: z.ZodObject<{
|
|
|
91
116
|
assets?: {
|
|
92
117
|
path: string;
|
|
93
118
|
routingConfig: {
|
|
94
|
-
|
|
119
|
+
has_user_worker?: boolean;
|
|
120
|
+
};
|
|
121
|
+
assetConfig: {
|
|
122
|
+
html_handling?: "none" | "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash";
|
|
123
|
+
not_found_handling?: "none" | "single-page-application" | "404-page";
|
|
95
124
|
};
|
|
96
125
|
workerName?: string | undefined;
|
|
97
126
|
bindingName?: string | undefined;
|
|
@@ -100,7 +129,11 @@ export declare const AssetsOptionsSchema: z.ZodObject<{
|
|
|
100
129
|
assets?: {
|
|
101
130
|
path: string;
|
|
102
131
|
routingConfig: {
|
|
103
|
-
|
|
132
|
+
has_user_worker?: boolean;
|
|
133
|
+
};
|
|
134
|
+
assetConfig: {
|
|
135
|
+
html_handling?: "none" | "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash";
|
|
136
|
+
not_found_handling?: "none" | "single-page-application" | "404-page";
|
|
104
137
|
};
|
|
105
138
|
workerName?: string | undefined;
|
|
106
139
|
bindingName?: string | undefined;
|
|
@@ -115,7 +148,19 @@ export declare function base64Encode(value: string): string;
|
|
|
115
148
|
|
|
116
149
|
export { BodyInit }
|
|
117
150
|
|
|
118
|
-
|
|
151
|
+
/**
|
|
152
|
+
* The Asset Manifest and Asset Reverse Map are used to map a request path to an asset.
|
|
153
|
+
* 1. Hash path of request
|
|
154
|
+
* 2. Use this path hash to find the manifest entry
|
|
155
|
+
* 3. Get content hash from manifest entry
|
|
156
|
+
* 4a. In prod, use content hash to get asset from KV
|
|
157
|
+
* 4b. In dev, we fake out the KV store and use the file system instead.
|
|
158
|
+
* Use content hash to get file path from asset reverse map.
|
|
159
|
+
*/
|
|
160
|
+
export declare const buildAssetManifest: (dir: string) => Promise<{
|
|
161
|
+
encodedAssetManifest: Uint8Array;
|
|
162
|
+
assetsReverseMap: AssetReverseMap;
|
|
163
|
+
}>;
|
|
119
164
|
|
|
120
165
|
export declare const CACHE_PLUGIN: Plugin<typeof CacheOptionsSchema, typeof CacheSharedOptionsSchema>;
|
|
121
166
|
|
|
@@ -1321,6 +1366,7 @@ export declare const DURABLE_OBJECTS_PLUGIN_NAME = "do";
|
|
|
1321
1366
|
export declare const DURABLE_OBJECTS_STORAGE_SERVICE_NAME = "do:storage";
|
|
1322
1367
|
|
|
1323
1368
|
export declare type DurableObjectClassNames = Map<string, Map<string, {
|
|
1369
|
+
enableSql?: boolean;
|
|
1324
1370
|
unsafeUniqueKey?: UnsafeUniqueKey;
|
|
1325
1371
|
unsafePreventEviction?: boolean;
|
|
1326
1372
|
}>>;
|
|
@@ -1329,16 +1375,19 @@ export declare const DurableObjectsOptionsSchema: z.ZodObject<{
|
|
|
1329
1375
|
durableObjects: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
1330
1376
|
className: z.ZodString;
|
|
1331
1377
|
scriptName: z.ZodOptional<z.ZodString>;
|
|
1378
|
+
useSQLite: z.ZodOptional<z.ZodBoolean>;
|
|
1332
1379
|
unsafeUniqueKey: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodLiteral<typeof kUnsafeEphemeralUniqueKey>]>>;
|
|
1333
1380
|
unsafePreventEviction: z.ZodOptional<z.ZodBoolean>;
|
|
1334
1381
|
}, "strip", z.ZodTypeAny, {
|
|
1335
1382
|
className: string;
|
|
1336
1383
|
scriptName?: string | undefined;
|
|
1384
|
+
useSQLite?: boolean | undefined;
|
|
1337
1385
|
unsafeUniqueKey?: string | typeof kUnsafeEphemeralUniqueKey | undefined;
|
|
1338
1386
|
unsafePreventEviction?: boolean | undefined;
|
|
1339
1387
|
}, {
|
|
1340
1388
|
className: string;
|
|
1341
1389
|
scriptName?: string | undefined;
|
|
1390
|
+
useSQLite?: boolean | undefined;
|
|
1342
1391
|
unsafeUniqueKey?: string | typeof kUnsafeEphemeralUniqueKey | undefined;
|
|
1343
1392
|
unsafePreventEviction?: boolean | undefined;
|
|
1344
1393
|
}>]>>>;
|
|
@@ -1346,6 +1395,7 @@ export declare const DurableObjectsOptionsSchema: z.ZodObject<{
|
|
|
1346
1395
|
durableObjects?: Record<string, string | {
|
|
1347
1396
|
className: string;
|
|
1348
1397
|
scriptName?: string | undefined;
|
|
1398
|
+
useSQLite?: boolean | undefined;
|
|
1349
1399
|
unsafeUniqueKey?: string | typeof kUnsafeEphemeralUniqueKey | undefined;
|
|
1350
1400
|
unsafePreventEviction?: boolean | undefined;
|
|
1351
1401
|
}> | undefined;
|
|
@@ -1353,6 +1403,7 @@ export declare const DurableObjectsOptionsSchema: z.ZodObject<{
|
|
|
1353
1403
|
durableObjects?: Record<string, string | {
|
|
1354
1404
|
className: string;
|
|
1355
1405
|
scriptName?: string | undefined;
|
|
1406
|
+
useSQLite?: boolean | undefined;
|
|
1356
1407
|
unsafeUniqueKey?: string | typeof kUnsafeEphemeralUniqueKey | undefined;
|
|
1357
1408
|
unsafePreventEviction?: boolean | undefined;
|
|
1358
1409
|
}> | undefined;
|
|
@@ -1641,6 +1692,11 @@ export declare interface LogOptions {
|
|
|
1641
1692
|
suffix?: string;
|
|
1642
1693
|
}
|
|
1643
1694
|
|
|
1695
|
+
export declare type ManifestEntry = {
|
|
1696
|
+
pathHash: Uint8Array;
|
|
1697
|
+
contentHash: Uint8Array;
|
|
1698
|
+
};
|
|
1699
|
+
|
|
1644
1700
|
export declare interface MatcherRegExps {
|
|
1645
1701
|
include: RegExp[];
|
|
1646
1702
|
exclude: RegExp[];
|
|
@@ -1694,7 +1750,7 @@ export declare class Miniflare {
|
|
|
1694
1750
|
export declare class MiniflareCoreError extends MiniflareError<MiniflareCoreErrorCode> {
|
|
1695
1751
|
}
|
|
1696
1752
|
|
|
1697
|
-
export declare type MiniflareCoreErrorCode = "ERR_RUNTIME_FAILURE" | "ERR_DISPOSED" | "ERR_MODULE_PARSE" | "ERR_MODULE_STRING_SCRIPT" | "ERR_MODULE_DYNAMIC_SPEC" | "ERR_MODULE_RULE" | "ERR_PERSIST_UNSUPPORTED" | "ERR_PERSIST_REMOTE_UNAUTHENTICATED" | "ERR_PERSIST_REMOTE_UNSUPPORTED" | "ERR_FUTURE_COMPATIBILITY_DATE" | "ERR_NO_WORKERS" | "ERR_VALIDATION" | "ERR_DUPLICATE_NAME" | "ERR_DIFFERENT_UNIQUE_KEYS" | "ERR_DIFFERENT_PREVENT_EVICTION" | "ERR_MULTIPLE_OUTBOUNDS" | "ERR_INVALID_WRAPPED" | "ERR_CYCLIC";
|
|
1753
|
+
export declare type MiniflareCoreErrorCode = "ERR_RUNTIME_FAILURE" | "ERR_DISPOSED" | "ERR_MODULE_PARSE" | "ERR_MODULE_STRING_SCRIPT" | "ERR_MODULE_DYNAMIC_SPEC" | "ERR_MODULE_RULE" | "ERR_PERSIST_UNSUPPORTED" | "ERR_PERSIST_REMOTE_UNAUTHENTICATED" | "ERR_PERSIST_REMOTE_UNSUPPORTED" | "ERR_FUTURE_COMPATIBILITY_DATE" | "ERR_NO_WORKERS" | "ERR_VALIDATION" | "ERR_DUPLICATE_NAME" | "ERR_DIFFERENT_STORAGE_BACKEND" | "ERR_DIFFERENT_UNIQUE_KEYS" | "ERR_DIFFERENT_PREVENT_EVICTION" | "ERR_MULTIPLE_OUTBOUNDS" | "ERR_INVALID_WRAPPED" | "ERR_CYCLIC";
|
|
1698
1754
|
|
|
1699
1755
|
export declare class MiniflareError<Code extends string | number = string | number> extends Error {
|
|
1700
1756
|
readonly code: Code;
|
|
@@ -1774,6 +1830,7 @@ export declare class NoOpLog extends Log {
|
|
|
1774
1830
|
export declare function normaliseDurableObject(designator: NonNullable<z.infer<typeof DurableObjectsOptionsSchema>["durableObjects"]>[string]): {
|
|
1775
1831
|
className: string;
|
|
1776
1832
|
serviceName?: string;
|
|
1833
|
+
enableSql?: boolean;
|
|
1777
1834
|
unsafeUniqueKey?: UnsafeUniqueKey;
|
|
1778
1835
|
unsafePreventEviction?: boolean;
|
|
1779
1836
|
};
|
|
@@ -2948,16 +3005,19 @@ export declare const PLUGINS: {
|
|
|
2948
3005
|
durableObjects: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
2949
3006
|
className: z.ZodString;
|
|
2950
3007
|
scriptName: z.ZodOptional<z.ZodString>;
|
|
3008
|
+
useSQLite: z.ZodOptional<z.ZodBoolean>;
|
|
2951
3009
|
unsafeUniqueKey: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodLiteral<kUnsafeEphemeralUniqueKey>]>>;
|
|
2952
3010
|
unsafePreventEviction: z.ZodOptional<z.ZodBoolean>;
|
|
2953
3011
|
}, "strip", z.ZodTypeAny, {
|
|
2954
3012
|
className: string;
|
|
2955
3013
|
scriptName?: string | undefined;
|
|
3014
|
+
useSQLite?: boolean | undefined;
|
|
2956
3015
|
unsafeUniqueKey?: string | kUnsafeEphemeralUniqueKey | undefined;
|
|
2957
3016
|
unsafePreventEviction?: boolean | undefined;
|
|
2958
3017
|
}, {
|
|
2959
3018
|
className: string;
|
|
2960
3019
|
scriptName?: string | undefined;
|
|
3020
|
+
useSQLite?: boolean | undefined;
|
|
2961
3021
|
unsafeUniqueKey?: string | kUnsafeEphemeralUniqueKey | undefined;
|
|
2962
3022
|
unsafePreventEviction?: boolean | undefined;
|
|
2963
3023
|
}>]>>>;
|
|
@@ -2965,6 +3025,7 @@ export declare const PLUGINS: {
|
|
|
2965
3025
|
durableObjects?: Record<string, string | {
|
|
2966
3026
|
className: string;
|
|
2967
3027
|
scriptName?: string | undefined;
|
|
3028
|
+
useSQLite?: boolean | undefined;
|
|
2968
3029
|
unsafeUniqueKey?: string | kUnsafeEphemeralUniqueKey | undefined;
|
|
2969
3030
|
unsafePreventEviction?: boolean | undefined;
|
|
2970
3031
|
}> | undefined;
|
|
@@ -2972,6 +3033,7 @@ export declare const PLUGINS: {
|
|
|
2972
3033
|
durableObjects?: Record<string, string | {
|
|
2973
3034
|
className: string;
|
|
2974
3035
|
scriptName?: string | undefined;
|
|
3036
|
+
useSQLite?: boolean | undefined;
|
|
2975
3037
|
unsafeUniqueKey?: string | kUnsafeEphemeralUniqueKey | undefined;
|
|
2976
3038
|
unsafePreventEviction?: boolean | undefined;
|
|
2977
3039
|
}> | undefined;
|
|
@@ -3123,23 +3185,41 @@ export declare const PLUGINS: {
|
|
|
3123
3185
|
path: z.ZodEffects<z.ZodString, string, string>;
|
|
3124
3186
|
bindingName: z.ZodOptional<z.ZodString>;
|
|
3125
3187
|
routingConfig: z.ZodObject<{
|
|
3126
|
-
|
|
3188
|
+
has_user_worker: z.ZodOptional<z.ZodBoolean>;
|
|
3127
3189
|
}, "strip", z.ZodTypeAny, {
|
|
3128
|
-
|
|
3190
|
+
has_user_worker?: boolean;
|
|
3129
3191
|
}, {
|
|
3130
|
-
|
|
3192
|
+
has_user_worker?: boolean;
|
|
3193
|
+
}>;
|
|
3194
|
+
assetConfig: z.ZodObject<{
|
|
3195
|
+
html_handling: z.ZodOptional<z.ZodEnum<["auto-trailing-slash", "force-trailing-slash", "drop-trailing-slash", "none"]>>;
|
|
3196
|
+
not_found_handling: z.ZodOptional<z.ZodEnum<["single-page-application", "404-page", "none"]>>;
|
|
3197
|
+
}, "strip", z.ZodTypeAny, {
|
|
3198
|
+
html_handling?: "none" | "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash";
|
|
3199
|
+
not_found_handling?: "none" | "single-page-application" | "404-page";
|
|
3200
|
+
}, {
|
|
3201
|
+
html_handling?: "none" | "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash";
|
|
3202
|
+
not_found_handling?: "none" | "single-page-application" | "404-page";
|
|
3131
3203
|
}>;
|
|
3132
3204
|
}, "strip", z.ZodTypeAny, {
|
|
3133
3205
|
path: string;
|
|
3134
3206
|
routingConfig: {
|
|
3135
|
-
|
|
3207
|
+
has_user_worker?: boolean;
|
|
3208
|
+
};
|
|
3209
|
+
assetConfig: {
|
|
3210
|
+
html_handling?: "none" | "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash";
|
|
3211
|
+
not_found_handling?: "none" | "single-page-application" | "404-page";
|
|
3136
3212
|
};
|
|
3137
3213
|
workerName?: string | undefined;
|
|
3138
3214
|
bindingName?: string | undefined;
|
|
3139
3215
|
}, {
|
|
3140
3216
|
path: string;
|
|
3141
3217
|
routingConfig: {
|
|
3142
|
-
|
|
3218
|
+
has_user_worker?: boolean;
|
|
3219
|
+
};
|
|
3220
|
+
assetConfig: {
|
|
3221
|
+
html_handling?: "none" | "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash";
|
|
3222
|
+
not_found_handling?: "none" | "single-page-application" | "404-page";
|
|
3143
3223
|
};
|
|
3144
3224
|
workerName?: string | undefined;
|
|
3145
3225
|
bindingName?: string | undefined;
|
|
@@ -3148,7 +3228,11 @@ export declare const PLUGINS: {
|
|
|
3148
3228
|
assets?: {
|
|
3149
3229
|
path: string;
|
|
3150
3230
|
routingConfig: {
|
|
3151
|
-
|
|
3231
|
+
has_user_worker?: boolean;
|
|
3232
|
+
};
|
|
3233
|
+
assetConfig: {
|
|
3234
|
+
html_handling?: "none" | "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash";
|
|
3235
|
+
not_found_handling?: "none" | "single-page-application" | "404-page";
|
|
3152
3236
|
};
|
|
3153
3237
|
workerName?: string | undefined;
|
|
3154
3238
|
bindingName?: string | undefined;
|
|
@@ -3157,7 +3241,11 @@ export declare const PLUGINS: {
|
|
|
3157
3241
|
assets?: {
|
|
3158
3242
|
path: string;
|
|
3159
3243
|
routingConfig: {
|
|
3160
|
-
|
|
3244
|
+
has_user_worker?: boolean;
|
|
3245
|
+
};
|
|
3246
|
+
assetConfig: {
|
|
3247
|
+
html_handling?: "none" | "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash";
|
|
3248
|
+
not_found_handling?: "none" | "single-page-application" | "404-page";
|
|
3161
3249
|
};
|
|
3162
3250
|
workerName?: string | undefined;
|
|
3163
3251
|
bindingName?: string | undefined;
|
|
@@ -3640,14 +3728,6 @@ export declare class RouterError extends MiniflareError<RouterErrorCode> {
|
|
|
3640
3728
|
|
|
3641
3729
|
export declare type RouterErrorCode = "ERR_QUERY_STRING" | "ERR_INFIX_WILDCARD";
|
|
3642
3730
|
|
|
3643
|
-
export declare const RoutingConfigSchema: z.ZodObject<{
|
|
3644
|
-
hasUserWorker: z.ZodBoolean;
|
|
3645
|
-
}, "strip", z.ZodTypeAny, {
|
|
3646
|
-
hasUserWorker: boolean;
|
|
3647
|
-
}, {
|
|
3648
|
-
hasUserWorker: boolean;
|
|
3649
|
-
}>;
|
|
3650
|
-
|
|
3651
3731
|
export declare class Runtime {
|
|
3652
3732
|
#private;
|
|
3653
3733
|
updateConfig(configBuffer: Buffer, options: Abortable & RuntimeOptions): Promise<SocketPorts | undefined>;
|
|
@@ -4130,6 +4210,7 @@ export declare interface Worker_Binding_WrappedBinding {
|
|
|
4130
4210
|
export declare type Worker_DurableObjectNamespace = {
|
|
4131
4211
|
className?: string;
|
|
4132
4212
|
preventEviction?: boolean;
|
|
4213
|
+
enableSql?: boolean;
|
|
4133
4214
|
} & ({
|
|
4134
4215
|
uniqueKey?: string;
|
|
4135
4216
|
} | {
|