miniflare 0.0.0-e747ddf6a → 0.0.0-e7c7235fd
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 +28 -0
- package/dist/src/index.js +31 -10
- package/dist/src/index.js.map +2 -2
- package/dist/src/workers/assets/assets.worker.js +191 -106
- package/dist/src/workers/assets/assets.worker.js.map +2 -2
- package/dist/src/workers/assets/router.worker.js +64 -17
- package/dist/src/workers/assets/router.worker.js.map +2 -2
- package/package.json +4 -4
package/dist/src/index.d.ts
CHANGED
|
@@ -75,12 +75,18 @@ export declare const AssetsOptionsSchema: z.ZodObject<{
|
|
|
75
75
|
routingConfig: z.ZodOptional<z.ZodObject<{
|
|
76
76
|
has_user_worker: z.ZodOptional<z.ZodBoolean>;
|
|
77
77
|
invoke_user_worker_ahead_of_assets: z.ZodOptional<z.ZodBoolean>;
|
|
78
|
+
account_id: z.ZodOptional<z.ZodNumber>;
|
|
79
|
+
script_id: z.ZodOptional<z.ZodNumber>;
|
|
78
80
|
}, "strip", z.ZodTypeAny, {
|
|
79
81
|
has_user_worker?: boolean;
|
|
80
82
|
invoke_user_worker_ahead_of_assets?: boolean;
|
|
83
|
+
account_id?: number;
|
|
84
|
+
script_id?: number;
|
|
81
85
|
}, {
|
|
82
86
|
has_user_worker?: boolean;
|
|
83
87
|
invoke_user_worker_ahead_of_assets?: boolean;
|
|
88
|
+
account_id?: number;
|
|
89
|
+
script_id?: number;
|
|
84
90
|
}>>;
|
|
85
91
|
assetConfig: z.ZodOptional<z.ZodObject<{
|
|
86
92
|
html_handling: z.ZodOptional<z.ZodEnum<["auto-trailing-slash", "force-trailing-slash", "drop-trailing-slash", "none"]>>;
|
|
@@ -102,6 +108,8 @@ export declare const AssetsOptionsSchema: z.ZodObject<{
|
|
|
102
108
|
routingConfig?: {
|
|
103
109
|
has_user_worker?: boolean;
|
|
104
110
|
invoke_user_worker_ahead_of_assets?: boolean;
|
|
111
|
+
account_id?: number;
|
|
112
|
+
script_id?: number;
|
|
105
113
|
} | undefined;
|
|
106
114
|
assetConfig?: {
|
|
107
115
|
html_handling?: "none" | "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash";
|
|
@@ -115,6 +123,8 @@ export declare const AssetsOptionsSchema: z.ZodObject<{
|
|
|
115
123
|
routingConfig?: {
|
|
116
124
|
has_user_worker?: boolean;
|
|
117
125
|
invoke_user_worker_ahead_of_assets?: boolean;
|
|
126
|
+
account_id?: number;
|
|
127
|
+
script_id?: number;
|
|
118
128
|
} | undefined;
|
|
119
129
|
assetConfig?: {
|
|
120
130
|
html_handling?: "none" | "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash";
|
|
@@ -130,6 +140,8 @@ export declare const AssetsOptionsSchema: z.ZodObject<{
|
|
|
130
140
|
routingConfig?: {
|
|
131
141
|
has_user_worker?: boolean;
|
|
132
142
|
invoke_user_worker_ahead_of_assets?: boolean;
|
|
143
|
+
account_id?: number;
|
|
144
|
+
script_id?: number;
|
|
133
145
|
} | undefined;
|
|
134
146
|
assetConfig?: {
|
|
135
147
|
html_handling?: "none" | "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash";
|
|
@@ -145,6 +157,8 @@ export declare const AssetsOptionsSchema: z.ZodObject<{
|
|
|
145
157
|
routingConfig?: {
|
|
146
158
|
has_user_worker?: boolean;
|
|
147
159
|
invoke_user_worker_ahead_of_assets?: boolean;
|
|
160
|
+
account_id?: number;
|
|
161
|
+
script_id?: number;
|
|
148
162
|
} | undefined;
|
|
149
163
|
assetConfig?: {
|
|
150
164
|
html_handling?: "none" | "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash";
|
|
@@ -3272,12 +3286,18 @@ export declare const PLUGINS: {
|
|
|
3272
3286
|
routingConfig: z.ZodOptional<z.ZodObject<{
|
|
3273
3287
|
has_user_worker: z.ZodOptional<z.ZodBoolean>;
|
|
3274
3288
|
invoke_user_worker_ahead_of_assets: z.ZodOptional<z.ZodBoolean>;
|
|
3289
|
+
account_id: z.ZodOptional<z.ZodNumber>;
|
|
3290
|
+
script_id: z.ZodOptional<z.ZodNumber>;
|
|
3275
3291
|
}, "strip", z.ZodTypeAny, {
|
|
3276
3292
|
has_user_worker?: boolean;
|
|
3277
3293
|
invoke_user_worker_ahead_of_assets?: boolean;
|
|
3294
|
+
account_id?: number;
|
|
3295
|
+
script_id?: number;
|
|
3278
3296
|
}, {
|
|
3279
3297
|
has_user_worker?: boolean;
|
|
3280
3298
|
invoke_user_worker_ahead_of_assets?: boolean;
|
|
3299
|
+
account_id?: number;
|
|
3300
|
+
script_id?: number;
|
|
3281
3301
|
}>>;
|
|
3282
3302
|
assetConfig: z.ZodOptional<z.ZodObject<{
|
|
3283
3303
|
html_handling: z.ZodOptional<z.ZodEnum<["auto-trailing-slash", "force-trailing-slash", "drop-trailing-slash", "none"]>>;
|
|
@@ -3299,6 +3319,8 @@ export declare const PLUGINS: {
|
|
|
3299
3319
|
routingConfig?: {
|
|
3300
3320
|
has_user_worker?: boolean;
|
|
3301
3321
|
invoke_user_worker_ahead_of_assets?: boolean;
|
|
3322
|
+
account_id?: number;
|
|
3323
|
+
script_id?: number;
|
|
3302
3324
|
} | undefined;
|
|
3303
3325
|
assetConfig?: {
|
|
3304
3326
|
html_handling?: "none" | "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash";
|
|
@@ -3312,6 +3334,8 @@ export declare const PLUGINS: {
|
|
|
3312
3334
|
routingConfig?: {
|
|
3313
3335
|
has_user_worker?: boolean;
|
|
3314
3336
|
invoke_user_worker_ahead_of_assets?: boolean;
|
|
3337
|
+
account_id?: number;
|
|
3338
|
+
script_id?: number;
|
|
3315
3339
|
} | undefined;
|
|
3316
3340
|
assetConfig?: {
|
|
3317
3341
|
html_handling?: "none" | "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash";
|
|
@@ -3327,6 +3351,8 @@ export declare const PLUGINS: {
|
|
|
3327
3351
|
routingConfig?: {
|
|
3328
3352
|
has_user_worker?: boolean;
|
|
3329
3353
|
invoke_user_worker_ahead_of_assets?: boolean;
|
|
3354
|
+
account_id?: number;
|
|
3355
|
+
script_id?: number;
|
|
3330
3356
|
} | undefined;
|
|
3331
3357
|
assetConfig?: {
|
|
3332
3358
|
html_handling?: "none" | "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash";
|
|
@@ -3342,6 +3368,8 @@ export declare const PLUGINS: {
|
|
|
3342
3368
|
routingConfig?: {
|
|
3343
3369
|
has_user_worker?: boolean;
|
|
3344
3370
|
invoke_user_worker_ahead_of_assets?: boolean;
|
|
3371
|
+
account_id?: number;
|
|
3372
|
+
script_id?: number;
|
|
3345
3373
|
} | undefined;
|
|
3346
3374
|
assetConfig?: {
|
|
3347
3375
|
html_handling?: "none" | "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash";
|
package/dist/src/index.js
CHANGED
|
@@ -4610,7 +4610,10 @@ var MAX_ASSET_SIZE = 25 * 1024 * 1024;
|
|
|
4610
4610
|
var import_zod4 = require("zod");
|
|
4611
4611
|
var RoutingConfigSchema = import_zod4.z.object({
|
|
4612
4612
|
has_user_worker: import_zod4.z.boolean().optional(),
|
|
4613
|
-
invoke_user_worker_ahead_of_assets: import_zod4.z.boolean().optional()
|
|
4613
|
+
invoke_user_worker_ahead_of_assets: import_zod4.z.boolean().optional(),
|
|
4614
|
+
// Used for analytics and reporting
|
|
4615
|
+
account_id: import_zod4.z.number().optional(),
|
|
4616
|
+
script_id: import_zod4.z.number().optional()
|
|
4614
4617
|
});
|
|
4615
4618
|
var AssetConfigSchema = import_zod4.z.object({
|
|
4616
4619
|
html_handling: import_zod4.z.enum([
|
|
@@ -4622,6 +4625,15 @@ var AssetConfigSchema = import_zod4.z.object({
|
|
|
4622
4625
|
not_found_handling: import_zod4.z.enum(["single-page-application", "404-page", "none"]).optional(),
|
|
4623
4626
|
serve_directly: import_zod4.z.boolean().optional()
|
|
4624
4627
|
});
|
|
4628
|
+
var InternalConfigSchema = import_zod4.z.object({
|
|
4629
|
+
// Used for analytics and reporting
|
|
4630
|
+
account_id: import_zod4.z.number().optional(),
|
|
4631
|
+
script_id: import_zod4.z.number().optional()
|
|
4632
|
+
});
|
|
4633
|
+
var AssetWorkerConfigShema = import_zod4.z.object({
|
|
4634
|
+
...AssetConfigSchema.shape,
|
|
4635
|
+
...InternalConfigSchema.shape
|
|
4636
|
+
});
|
|
4625
4637
|
|
|
4626
4638
|
// ../workers-shared/utils/helpers.ts
|
|
4627
4639
|
var import_node_path = require("node:path");
|
|
@@ -7082,11 +7094,20 @@ function validateCompatibilityDate(log, compatibilityDate) {
|
|
|
7082
7094
|
}
|
|
7083
7095
|
return compatibilityDate;
|
|
7084
7096
|
}
|
|
7085
|
-
function
|
|
7086
|
-
return Object.entries(bindings).map(([name, value]) =>
|
|
7087
|
-
|
|
7088
|
-
|
|
7089
|
-
|
|
7097
|
+
function buildBindings(bindings) {
|
|
7098
|
+
return Object.entries(bindings).map(([name, value]) => {
|
|
7099
|
+
if (typeof value === "string") {
|
|
7100
|
+
return {
|
|
7101
|
+
name,
|
|
7102
|
+
text: value
|
|
7103
|
+
};
|
|
7104
|
+
} else {
|
|
7105
|
+
return {
|
|
7106
|
+
name,
|
|
7107
|
+
json: JSON.stringify(value)
|
|
7108
|
+
};
|
|
7109
|
+
}
|
|
7110
|
+
});
|
|
7090
7111
|
}
|
|
7091
7112
|
var WRAPPED_MODULE_PREFIX = "miniflare-internal:wrapped:";
|
|
7092
7113
|
function workerNameToWrappedModule(workerName) {
|
|
@@ -7103,7 +7124,7 @@ var CORE_PLUGIN = {
|
|
|
7103
7124
|
getBindings(options, workerIndex) {
|
|
7104
7125
|
const bindings = [];
|
|
7105
7126
|
if (options.bindings !== void 0) {
|
|
7106
|
-
bindings.push(...
|
|
7127
|
+
bindings.push(...buildBindings(options.bindings));
|
|
7107
7128
|
}
|
|
7108
7129
|
if (options.wasmBindings !== void 0) {
|
|
7109
7130
|
bindings.push(
|
|
@@ -7152,7 +7173,7 @@ var CORE_PLUGIN = {
|
|
|
7152
7173
|
const entrypoint = isObject ? designator.entrypoint : void 0;
|
|
7153
7174
|
const bindings2 = isObject ? designator.bindings : void 0;
|
|
7154
7175
|
const moduleName2 = workerNameToWrappedModule(scriptName);
|
|
7155
|
-
const innerBindings = bindings2 === void 0 ? [] :
|
|
7176
|
+
const innerBindings = bindings2 === void 0 ? [] : buildBindings(bindings2);
|
|
7156
7177
|
return {
|
|
7157
7178
|
name,
|
|
7158
7179
|
wrapped: { moduleName: moduleName2, entrypoint, innerBindings }
|
|
@@ -8543,7 +8564,7 @@ var RatelimitOptionsSchema = import_zod19.z.object({
|
|
|
8543
8564
|
var RATELIMIT_PLUGIN_NAME = "ratelimit";
|
|
8544
8565
|
var SERVICE_RATELIMIT_PREFIX = `${RATELIMIT_PLUGIN_NAME}`;
|
|
8545
8566
|
var SERVICE_RATELIMIT_MODULE = `cloudflare-internal:${SERVICE_RATELIMIT_PREFIX}:module`;
|
|
8546
|
-
function
|
|
8567
|
+
function buildJsonBindings(bindings) {
|
|
8547
8568
|
return Object.entries(bindings).map(([name, value]) => ({
|
|
8548
8569
|
name,
|
|
8549
8570
|
json: JSON.stringify(value)
|
|
@@ -8560,7 +8581,7 @@ var RATELIMIT_PLUGIN = {
|
|
|
8560
8581
|
name,
|
|
8561
8582
|
wrapped: {
|
|
8562
8583
|
moduleName: SERVICE_RATELIMIT_MODULE,
|
|
8563
|
-
innerBindings:
|
|
8584
|
+
innerBindings: buildJsonBindings({
|
|
8564
8585
|
namespaceId: name,
|
|
8565
8586
|
limit: config.simple.limit,
|
|
8566
8587
|
period: config.simple.period
|