wrangler 4.131.2 → 4.133.0
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/config-schema.json +25 -75
- package/package.json +24 -19
- package/templates/middleware/loader-sw.ts +52 -18
- package/wrangler-dist/cli.d.ts +16 -22
- package/wrangler-dist/cli.js +31004 -29917
- package/wrangler-dist/experimental-config.d.mts +3 -20
- package/wrangler-dist/experimental-config.d.mts.map +1 -1
- package/wrangler-dist/experimental-config.mjs +1 -5
- package/wrangler-dist/experimental-config.mjs.map +1 -1
- package/templates/__tests__/pages-dev-util.test.ts +0 -124
- package/templates/__tests__/tsconfig-sanity.ts +0 -12
- package/templates/__tests__/tsconfig.json +0 -8
- package/templates/facade.d.ts +0 -19
- package/templates/middleware/middleware-patch-console-prefix.d.ts +0 -3
- package/templates/new-worker-scheduled.js +0 -17
- package/templates/new-worker-scheduled.ts +0 -32
- package/templates/new-worker.js +0 -15
- package/templates/new-worker.ts +0 -33
- package/templates/startDevWorker/InspectorProxyWorker.ts +0 -713
- package/templates/startDevWorker/ProxyWorker.ts +0 -478
- package/templates/tsconfig-sanity.ts +0 -11
- package/templates/tsconfig.init.json +0 -22
- package/templates/tsconfig.json +0 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"experimental-config.mjs","names":[],"sources":["../../config/dist/public-
|
|
1
|
+
{"version":3,"file":"experimental-config.mjs","names":[],"sources":["../../config/dist/public-Dyr8BJqf.mjs","../src/experimental-config/wrangler-definition.ts"],"sourcesContent":["//#region src/bindings.ts\nconst bindings = {\n\tagentMemory: (options) => ({\n\t\ttype: \"agent-memory\",\n\t\t...options\n\t}),\n\tai: (options) => ({\n\t\ttype: \"ai\",\n\t\t...options\n\t}),\n\taiSearch: (options) => ({\n\t\ttype: \"ai-search\",\n\t\t...options\n\t}),\n\taiSearchNamespace: (options) => ({\n\t\ttype: \"ai-search-namespace\",\n\t\t...options\n\t}),\n\tanalyticsEngineDataset: (options) => ({\n\t\ttype: \"analytics-engine-dataset\",\n\t\t...options\n\t}),\n\tartifacts: (options) => ({\n\t\ttype: \"artifacts\",\n\t\t...options\n\t}),\n\tassets: () => ({ type: \"assets\" }),\n\tbrowser: (options) => ({\n\t\ttype: \"browser\",\n\t\t...options\n\t}),\n\td1: (options) => ({\n\t\ttype: \"d1\",\n\t\t...options\n\t}),\n\tdispatchNamespace: (options) => ({\n\t\ttype: \"dispatch-namespace\",\n\t\t...options\n\t}),\n\tdurableObject: (options) => ({\n\t\ttype: \"durable-object\",\n\t\t...options\n\t}),\n\tflagship: (options) => ({\n\t\ttype: \"flagship\",\n\t\t...options\n\t}),\n\thyperdrive: (options) => ({\n\t\ttype: \"hyperdrive\",\n\t\t...options\n\t}),\n\timages: (options) => ({\n\t\ttype: \"images\",\n\t\t...options\n\t}),\n\tjson: (value) => ({\n\t\ttype: \"json\",\n\t\tvalue\n\t}),\n\tkv: (options) => ({\n\t\ttype: \"kv\",\n\t\t...options\n\t}),\n\tlogfwdr: (options) => ({\n\t\ttype: \"logfwdr\",\n\t\t...options\n\t}),\n\tmedia: (options) => ({\n\t\ttype: \"media\",\n\t\t...options\n\t}),\n\tmtlsCertificate: (options) => ({\n\t\ttype: \"mtls-certificate\",\n\t\t...options\n\t}),\n\tpipeline: (options) => ({\n\t\ttype: \"pipeline\",\n\t\t...options\n\t}),\n\tqueue: (options) => ({\n\t\ttype: \"queue\",\n\t\t...options\n\t}),\n\trateLimit: (options) => ({\n\t\ttype: \"rate-limit\",\n\t\t...options\n\t}),\n\tr2: (options) => ({\n\t\ttype: \"r2\",\n\t\t...options\n\t}),\n\tsecret: () => ({ type: \"secret\" }),\n\tsecretsStoreSecret: (options) => ({\n\t\ttype: \"secrets-store-secret\",\n\t\t...options\n\t}),\n\tsendEmail: (options) => ({\n\t\ttype: \"send-email\",\n\t\t...options\n\t}),\n\tstream: (options) => ({\n\t\ttype: \"stream\",\n\t\t...options\n\t}),\n\ttext: (value) => ({\n\t\ttype: \"text\",\n\t\tvalue\n\t}),\n\tvectorize: (options) => ({\n\t\ttype: \"vectorize\",\n\t\t...options\n\t}),\n\tversionMetadata: () => ({ type: \"version-metadata\" }),\n\tvpcService: (options) => ({\n\t\ttype: \"vpc-service\",\n\t\t...options\n\t}),\n\tvpcNetwork: (options) => ({\n\t\ttype: \"vpc-network\",\n\t\t...options\n\t}),\n\tworker: (options) => ({\n\t\ttype: \"worker\",\n\t\t...options\n\t}),\n\tworkerLoader: () => ({ type: \"worker-loader\" })\n};\n\n//#endregion\n//#region src/triggers.ts\n/**\n* Triggers builder for configuring event triggers.\n*\n* @example\n* ```typescript\n* import { defineWorker, triggers } from \"@cloudflare/config\";\n*\n* export default defineWorker({\n* triggers: [\n* triggers.fetch({ pattern: \"example.com/*\", zone: \"example.com\" }),\n* triggers.queue({ name: \"my-queue\" }),\n* triggers.scheduled({ schedule: \"0 * * * *\" }),\n* triggers.scheduled({ schedule: \"30 0 * * *\" }),\n* triggers.email({ addresses: [\"support@example.com\"] }),\n* triggers.connect({ protocol: \"tcp\", port: 5432 }),\n* ],\n* });\n* ```\n*/\nconst triggers = {\n\tfetch: (options) => ({\n\t\ttype: \"fetch\",\n\t\t...options\n\t}),\n\tqueue: (options) => ({\n\t\ttype: \"queue\",\n\t\t...options\n\t}),\n\tscheduled: (options) => ({\n\t\ttype: \"scheduled\",\n\t\t...options\n\t}),\n\temail: (options) => ({\n\t\ttype: \"email\",\n\t\t...options\n\t}),\n\tconnect: (options) => ({\n\t\ttype: \"connect\",\n\t\t...options\n\t})\n};\n\n//#endregion\n//#region src/exports.ts\nfunction durableObject(options) {\n\treturn {\n\t\ttype: \"durable-object\",\n\t\t...options\n\t};\n}\nfunction worker(options = {}) {\n\treturn {\n\t\ttype: \"worker\",\n\t\t...options\n\t};\n}\n/**\n* Exports builder for configuring Worker exports.\n*\n* @example\n* ```typescript\n* import { defineContainer, defineWorker, exports } from \"@cloudflare/config\";\n*\n* const myContainer = defineContainer({\n* name: \"my-container\",\n* image: { dockerfile: \"./Dockerfile\" },\n* });\n*\n* export default defineWorker({\n* exports: {\n* MyDurableObject: exports.durableObject({ storage: \"sqlite\" }),\n* MyContainerDO: exports.durableObject({ storage: \"sqlite\", container: myContainer }),\n* OldClass: exports.durableObject({ state: \"deleted\" }),\n* OldName: exports.durableObject({ state: \"renamed\", renamedTo: \"NewName\" }),\n* Outgoing: exports.durableObject({ state: \"transferred\", transferredTo: \"target-worker\" }),\n* Incoming: exports.durableObject({ state: \"expecting-transfer\", storage: \"sqlite\", transferFrom: \"source-worker\" }),\n* },\n* });\n* ```\n*/\nconst exports = {\n\tdurableObject,\n\tworker\n};\n\n//#endregion\n//#region src/definition.ts\n/** Add a config type while preserving its value, promise, or function shape. */\nfunction addConfigType(config, type) {\n\tfunction addType(value) {\n\t\treturn {\n\t\t\t...value,\n\t\t\ttype\n\t\t};\n\t}\n\tif (typeof config === \"function\") return (ctx) => {\n\t\tconst result = config(ctx);\n\t\treturn result instanceof Promise ? result.then(addType) : addType(result);\n\t};\n\treturn config instanceof Promise ? config.then(addType) : addType(config);\n}\n/** Create a type-safe config helper for a particular export type. */\nfunction createConfigDefiner(type) {\n\tfunction define(config) {\n\t\treturn addConfigType(config, type);\n\t}\n\treturn define;\n}\n\n//#endregion\n//#region src/container-definition.ts\n/** Declare a Container application. */\nconst defineContainer = createConfigDefiner(\"container\");\n\n//#endregion\n//#region src/worker-definition.ts\nconst defineWorker = createConfigDefiner(\"worker\");\n\n//#endregion\n//#region src/settings-definition.ts\n/**\n* Declare shared settings.\n* Authored as a named `settings` export.\n*/\nconst defineSettings = createConfigDefiner(\"settings\");\n\n//#endregion\nexport { triggers as a, exports as i, defineWorker as n, bindings as o, defineContainer as r, defineSettings as t };","import type { WranglerConfig } from \"./types\";\nimport type { ConfigContext } from \"@cloudflare/config/public\";\n\nexport type WranglerConfigExport =\n\t| WranglerConfig\n\t| Promise<WranglerConfig>\n\t| ((ctx: ConfigContext) => WranglerConfig | Promise<WranglerConfig>);\n\nexport function defineWranglerConfig(\n\tconfig: WranglerConfigExport\n): WranglerConfigExport {\n\treturn config;\n}\n\nexport async function resolveWranglerConfig(\n\tdef: unknown,\n\tctx: ConfigContext\n): Promise<unknown> {\n\tlet raw = def;\n\tif (typeof raw === \"function\") {\n\t\traw = (raw as (ctx: ConfigContext) => unknown)(ctx);\n\t}\n\treturn await raw;\n}\n"],"mappings":";AACA,MAAM,WAAW;CAChB,cAAc,aAAa;EAC1B,MAAM;EACN,GAAG;EACH;CACD,KAAK,aAAa;EACjB,MAAM;EACN,GAAG;EACH;CACD,WAAW,aAAa;EACvB,MAAM;EACN,GAAG;EACH;CACD,oBAAoB,aAAa;EAChC,MAAM;EACN,GAAG;EACH;CACD,yBAAyB,aAAa;EACrC,MAAM;EACN,GAAG;EACH;CACD,YAAY,aAAa;EACxB,MAAM;EACN,GAAG;EACH;CACD,eAAe,EAAE,MAAM,UAAU;CACjC,UAAU,aAAa;EACtB,MAAM;EACN,GAAG;EACH;CACD,KAAK,aAAa;EACjB,MAAM;EACN,GAAG;EACH;CACD,oBAAoB,aAAa;EAChC,MAAM;EACN,GAAG;EACH;CACD,gBAAgB,aAAa;EAC5B,MAAM;EACN,GAAG;EACH;CACD,WAAW,aAAa;EACvB,MAAM;EACN,GAAG;EACH;CACD,aAAa,aAAa;EACzB,MAAM;EACN,GAAG;EACH;CACD,SAAS,aAAa;EACrB,MAAM;EACN,GAAG;EACH;CACD,OAAO,WAAW;EACjB,MAAM;EACN;EACA;CACD,KAAK,aAAa;EACjB,MAAM;EACN,GAAG;EACH;CACD,UAAU,aAAa;EACtB,MAAM;EACN,GAAG;EACH;CACD,QAAQ,aAAa;EACpB,MAAM;EACN,GAAG;EACH;CACD,kBAAkB,aAAa;EAC9B,MAAM;EACN,GAAG;EACH;CACD,WAAW,aAAa;EACvB,MAAM;EACN,GAAG;EACH;CACD,QAAQ,aAAa;EACpB,MAAM;EACN,GAAG;EACH;CACD,YAAY,aAAa;EACxB,MAAM;EACN,GAAG;EACH;CACD,KAAK,aAAa;EACjB,MAAM;EACN,GAAG;EACH;CACD,eAAe,EAAE,MAAM,UAAU;CACjC,qBAAqB,aAAa;EACjC,MAAM;EACN,GAAG;EACH;CACD,YAAY,aAAa;EACxB,MAAM;EACN,GAAG;EACH;CACD,SAAS,aAAa;EACrB,MAAM;EACN,GAAG;EACH;CACD,OAAO,WAAW;EACjB,MAAM;EACN;EACA;CACD,YAAY,aAAa;EACxB,MAAM;EACN,GAAG;EACH;CACD,wBAAwB,EAAE,MAAM,oBAAoB;CACpD,aAAa,aAAa;EACzB,MAAM;EACN,GAAG;EACH;CACD,aAAa,aAAa;EACzB,MAAM;EACN,GAAG;EACH;CACD,SAAS,aAAa;EACrB,MAAM;EACN,GAAG;EACH;CACD,qBAAqB,EAAE,MAAM,iBAAiB;CAC9C;;;;;;;;;;;;;;;;;;;;AAuBD,MAAM,WAAW;CAChB,QAAQ,aAAa;EACpB,MAAM;EACN,GAAG;EACH;CACD,QAAQ,aAAa;EACpB,MAAM;EACN,GAAG;EACH;CACD,YAAY,aAAa;EACxB,MAAM;EACN,GAAG;EACH;CACD,QAAQ,aAAa;EACpB,MAAM;EACN,GAAG;EACH;CACD,UAAU,aAAa;EACtB,MAAM;EACN,GAAG;EACH;CACD;AAID,SAAS,cAAc,SAAS;AAC/B,QAAO;EACN,MAAM;EACN,GAAG;EACH;;AAEF,SAAS,OAAO,UAAU,EAAE,EAAE;AAC7B,QAAO;EACN,MAAM;EACN,GAAG;EACH;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BF,MAAM,UAAU;CACf;CACA;CACA;;AAKD,SAAS,cAAc,QAAQ,MAAM;CACpC,SAAS,QAAQ,OAAO;AACvB,SAAO;GACN,GAAG;GACH;GACA;;AAEF,KAAI,OAAO,WAAW,WAAY,SAAQ,QAAQ;EACjD,MAAM,SAAS,OAAO,IAAI;AAC1B,SAAO,kBAAkB,UAAU,OAAO,KAAK,QAAQ,GAAG,QAAQ,OAAO;;AAE1E,QAAO,kBAAkB,UAAU,OAAO,KAAK,QAAQ,GAAG,QAAQ,OAAO;;;AAG1E,SAAS,oBAAoB,MAAM;CAClC,SAAS,OAAO,QAAQ;AACvB,SAAO,cAAc,QAAQ,KAAK;;AAEnC,QAAO;;;AAMR,MAAM,kBAAkB,oBAAoB,YAAY;AAIxD,MAAM,eAAe,oBAAoB,SAAS;;;;;AAQlD,MAAM,iBAAiB,oBAAoB,WAAW;;;;ACtPtD,SAAgB,qBACf,QACuB;AACvB,QAAO"}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { isRoutingRuleMatch } from "../pages-dev-util";
|
|
2
|
-
|
|
3
|
-
describe("isRoutingRuleMatch", () => {
|
|
4
|
-
it("should match rules referencing root level correctly", () => {
|
|
5
|
-
const routingRule = "/";
|
|
6
|
-
|
|
7
|
-
expect(isRoutingRuleMatch("/", routingRule)).toBeTruthy();
|
|
8
|
-
expect(isRoutingRuleMatch("/foo", routingRule)).toBeFalsy();
|
|
9
|
-
expect(isRoutingRuleMatch("/foo/", routingRule)).toBeFalsy();
|
|
10
|
-
expect(isRoutingRuleMatch("/foo/bar", routingRule)).toBeFalsy();
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it("should match include-all rules correctly", () => {
|
|
14
|
-
const routingRule = "/*";
|
|
15
|
-
|
|
16
|
-
expect(isRoutingRuleMatch("/", routingRule)).toBeTruthy();
|
|
17
|
-
expect(isRoutingRuleMatch("/foo", routingRule)).toBeTruthy();
|
|
18
|
-
expect(isRoutingRuleMatch("/foo/", routingRule)).toBeTruthy();
|
|
19
|
-
expect(isRoutingRuleMatch("/foo/bar", routingRule)).toBeTruthy();
|
|
20
|
-
expect(isRoutingRuleMatch("/foo/bar/", routingRule)).toBeTruthy();
|
|
21
|
-
expect(isRoutingRuleMatch("/foo/bar/baz", routingRule)).toBeTruthy();
|
|
22
|
-
expect(isRoutingRuleMatch("/foo/bar/baz/", routingRule)).toBeTruthy();
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it("should match `/*` suffix-ed rules correctly", () => {
|
|
26
|
-
let routingRule = "/foo/*";
|
|
27
|
-
|
|
28
|
-
expect(isRoutingRuleMatch("/foo", routingRule)).toBeTruthy();
|
|
29
|
-
expect(isRoutingRuleMatch("/foo/", routingRule)).toBeTruthy();
|
|
30
|
-
expect(isRoutingRuleMatch("/foobar", routingRule)).toBeFalsy();
|
|
31
|
-
expect(isRoutingRuleMatch("/foo/bar", routingRule)).toBeTruthy();
|
|
32
|
-
expect(isRoutingRuleMatch("/foo/bar/baz", routingRule)).toBeTruthy();
|
|
33
|
-
expect(isRoutingRuleMatch("/bar/foo", routingRule)).toBeFalsy();
|
|
34
|
-
expect(isRoutingRuleMatch("/bar/foo/baz", routingRule)).toBeFalsy();
|
|
35
|
-
|
|
36
|
-
routingRule = "/foo/bar/*";
|
|
37
|
-
|
|
38
|
-
expect(isRoutingRuleMatch("/foo", routingRule)).toBeFalsy();
|
|
39
|
-
expect(isRoutingRuleMatch("/foo/", routingRule)).toBeFalsy();
|
|
40
|
-
expect(isRoutingRuleMatch("/foo/bar", routingRule)).toBeTruthy();
|
|
41
|
-
expect(isRoutingRuleMatch("/foo/bar/baz", routingRule)).toBeTruthy();
|
|
42
|
-
expect(isRoutingRuleMatch("/foo/barfoo", routingRule)).toBeFalsy();
|
|
43
|
-
expect(isRoutingRuleMatch("baz/foo/bar", routingRule)).toBeFalsy();
|
|
44
|
-
expect(isRoutingRuleMatch("baz/foo/bar/", routingRule)).toBeFalsy();
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it("should match `/` suffix-ed rules correctly", () => {
|
|
48
|
-
let routingRule = "/foo/";
|
|
49
|
-
expect(isRoutingRuleMatch("/foo/", routingRule)).toBeTruthy();
|
|
50
|
-
expect(isRoutingRuleMatch("/foo", routingRule)).toBeTruthy();
|
|
51
|
-
|
|
52
|
-
routingRule = "/foo/bar/";
|
|
53
|
-
expect(isRoutingRuleMatch("/foo/bar/", routingRule)).toBeTruthy();
|
|
54
|
-
expect(isRoutingRuleMatch("/foo/bar", routingRule)).toBeTruthy();
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
it("should match `*` suffix-ed rules correctly", () => {
|
|
58
|
-
let routingRule = "/foo*";
|
|
59
|
-
expect(isRoutingRuleMatch("/foo", routingRule)).toBeTruthy();
|
|
60
|
-
expect(isRoutingRuleMatch("/foo/", routingRule)).toBeTruthy();
|
|
61
|
-
expect(isRoutingRuleMatch("/foobar", routingRule)).toBeTruthy();
|
|
62
|
-
expect(isRoutingRuleMatch("/barfoo", routingRule)).toBeFalsy();
|
|
63
|
-
expect(isRoutingRuleMatch("/foo/bar", routingRule)).toBeTruthy();
|
|
64
|
-
expect(isRoutingRuleMatch("/bar/foo", routingRule)).toBeFalsy();
|
|
65
|
-
expect(isRoutingRuleMatch("/bar/foobar", routingRule)).toBeFalsy();
|
|
66
|
-
expect(isRoutingRuleMatch("/foo/bar/baz", routingRule)).toBeTruthy();
|
|
67
|
-
expect(isRoutingRuleMatch("/bar/foo/baz", routingRule)).toBeFalsy();
|
|
68
|
-
|
|
69
|
-
routingRule = "/foo/bar*";
|
|
70
|
-
expect(isRoutingRuleMatch("/foo/bar", routingRule)).toBeTruthy();
|
|
71
|
-
expect(isRoutingRuleMatch("/foo/bar/", routingRule)).toBeTruthy();
|
|
72
|
-
expect(isRoutingRuleMatch("/foo/barfoo", routingRule)).toBeTruthy();
|
|
73
|
-
expect(isRoutingRuleMatch("/bar/foo/barfoo", routingRule)).toBeFalsy();
|
|
74
|
-
expect(isRoutingRuleMatch("/foo/bar/baz", routingRule)).toBeTruthy();
|
|
75
|
-
expect(isRoutingRuleMatch("/bar/foo/bar/baz", routingRule)).toBeFalsy();
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
it("should match rules without wildcards correctly", () => {
|
|
79
|
-
let routingRule = "/foo";
|
|
80
|
-
|
|
81
|
-
expect(isRoutingRuleMatch("/foo", routingRule)).toBeTruthy();
|
|
82
|
-
expect(isRoutingRuleMatch("/foo/", routingRule)).toBeTruthy();
|
|
83
|
-
expect(isRoutingRuleMatch("/foo/bar", routingRule)).toBeFalsy();
|
|
84
|
-
expect(isRoutingRuleMatch("/bar/foo", routingRule)).toBeFalsy();
|
|
85
|
-
|
|
86
|
-
routingRule = "/foo/bar";
|
|
87
|
-
expect(isRoutingRuleMatch("/foo/bar", routingRule)).toBeTruthy();
|
|
88
|
-
expect(isRoutingRuleMatch("/foo/bar/", routingRule)).toBeTruthy();
|
|
89
|
-
expect(isRoutingRuleMatch("/foo/bar/baz", routingRule)).toBeFalsy();
|
|
90
|
-
expect(isRoutingRuleMatch("/baz/foo/bar", routingRule)).toBeFalsy();
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it("should throw an error if pathname or routing rule params are missing", () => {
|
|
94
|
-
// MISSING PATHNAME
|
|
95
|
-
expect(() =>
|
|
96
|
-
// @ts-expect-error -- Intentionally testing invalid types
|
|
97
|
-
isRoutingRuleMatch(undefined, "/*")
|
|
98
|
-
).toThrow("Pathname is undefined.");
|
|
99
|
-
|
|
100
|
-
expect(() =>
|
|
101
|
-
// @ts-expect-error -- Intentionally testing invalid types
|
|
102
|
-
isRoutingRuleMatch(null, "/*")
|
|
103
|
-
).toThrow("Pathname is undefined.");
|
|
104
|
-
|
|
105
|
-
expect(() => isRoutingRuleMatch("", "/*")).toThrow(
|
|
106
|
-
"Pathname is undefined."
|
|
107
|
-
);
|
|
108
|
-
|
|
109
|
-
// MISSING ROUTING RULE
|
|
110
|
-
expect(() =>
|
|
111
|
-
// @ts-expect-error -- Intentionally testing invalid types
|
|
112
|
-
isRoutingRuleMatch("/foo", undefined)
|
|
113
|
-
).toThrow("Routing rule is undefined.");
|
|
114
|
-
|
|
115
|
-
expect(() =>
|
|
116
|
-
// @ts-expect-error -- Intentionally testing invalid types
|
|
117
|
-
isRoutingRuleMatch("/foo", null)
|
|
118
|
-
).toThrow("Routing rule is undefined.");
|
|
119
|
-
|
|
120
|
-
expect(() => isRoutingRuleMatch("/foo", "")).toThrow(
|
|
121
|
-
"Routing rule is undefined."
|
|
122
|
-
);
|
|
123
|
-
});
|
|
124
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// `@types/node` should be included
|
|
2
|
-
Buffer.from("test");
|
|
3
|
-
|
|
4
|
-
// `@types/jest` should be included
|
|
5
|
-
test("test");
|
|
6
|
-
|
|
7
|
-
// @ts-expect-error `@cloudflare/workers-types` should NOT be included
|
|
8
|
-
const _handler: ExportedHandler = {};
|
|
9
|
-
// @ts-expect-error `@cloudflare/workers-types` should NOT be included
|
|
10
|
-
new HTMLRewriter();
|
|
11
|
-
|
|
12
|
-
export {};
|
package/templates/facade.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
declare module "__ENTRY_POINT__" {
|
|
2
|
-
import { WorkerEntrypoint } from "cloudflare:workers";
|
|
3
|
-
import { Middleware } from "./middleware/common";
|
|
4
|
-
|
|
5
|
-
export type WorkerEntrypointConstructor = typeof WorkerEntrypoint;
|
|
6
|
-
|
|
7
|
-
const worker: ExportedHandler | WorkerEntrypointConstructor;
|
|
8
|
-
export default worker;
|
|
9
|
-
export const __INTERNAL_WRANGLER_MIDDLEWARE__: Middleware[];
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
declare module "__KV_ASSET_HANDLER__" {
|
|
13
|
-
export * from "@cloudflare/kv-asset-handler";
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
declare module "__STATIC_CONTENT_MANIFEST" {
|
|
17
|
-
const manifest: string;
|
|
18
|
-
export default manifest;
|
|
19
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Welcome to Cloudflare Workers! This is your first scheduled worker.
|
|
3
|
-
*
|
|
4
|
-
* - Run `wrangler dev` in your terminal to start a development server
|
|
5
|
-
* - Run `curl "http://localhost:8787/cdn-cgi/local/scheduled"` to trigger the scheduled event
|
|
6
|
-
* - Go back to the console to see what your worker has logged
|
|
7
|
-
* - Update the Cron trigger in wrangler.toml (see https://developers.cloudflare.com/workers/configuration/cron-triggers/)
|
|
8
|
-
* - Run `wrangler publish --name my-worker` to publish your worker
|
|
9
|
-
*
|
|
10
|
-
* Learn more at https://developers.cloudflare.com/workers/runtime-apis/scheduled-event/
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
export default {
|
|
14
|
-
async scheduled(controller, env, ctx) {
|
|
15
|
-
console.log(`Hello World!`);
|
|
16
|
-
},
|
|
17
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Welcome to Cloudflare Workers! This is your first scheduled worker.
|
|
3
|
-
*
|
|
4
|
-
* - Run `wrangler dev` in your terminal to start a development server
|
|
5
|
-
* - Run `curl "http://localhost:8787/cdn-cgi/local/scheduled"` to trigger the scheduled event
|
|
6
|
-
* - Go back to the console to see what your worker has logged
|
|
7
|
-
* - Update the Cron trigger in wrangler.toml (see https://developers.cloudflare.com/workers/configuration/cron-triggers/)
|
|
8
|
-
* - Run `wrangler deploy --name my-worker` to deploy your worker
|
|
9
|
-
*
|
|
10
|
-
* Learn more at https://developers.cloudflare.com/workers/runtime-apis/scheduled-event/
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
export interface Env {
|
|
14
|
-
// Example binding to KV. Learn more at https://developers.cloudflare.com/workers/runtime-apis/kv/
|
|
15
|
-
// MY_KV_NAMESPACE: KVNamespace;
|
|
16
|
-
//
|
|
17
|
-
// Example binding to Durable Object. Learn more at https://developers.cloudflare.com/workers/runtime-apis/durable-objects/
|
|
18
|
-
// MY_DURABLE_OBJECT: DurableObjectNamespace;
|
|
19
|
-
//
|
|
20
|
-
// Example binding to R2. Learn more at https://developers.cloudflare.com/workers/runtime-apis/r2/
|
|
21
|
-
// MY_BUCKET: R2Bucket;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export default {
|
|
25
|
-
async scheduled(
|
|
26
|
-
controller: ScheduledController,
|
|
27
|
-
env: Env,
|
|
28
|
-
ctx: ExecutionContext
|
|
29
|
-
): Promise<void> {
|
|
30
|
-
console.log(`Hello World!`);
|
|
31
|
-
},
|
|
32
|
-
};
|
package/templates/new-worker.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Welcome to Cloudflare Workers! This is your first worker.
|
|
3
|
-
*
|
|
4
|
-
* - Run `npx wrangler dev src/index.js` in your terminal to start a development server
|
|
5
|
-
* - Open a browser tab at http://localhost:8787/ to see your worker in action
|
|
6
|
-
* - Run `npx wrangler publish src/index.js --name my-worker` to publish your worker
|
|
7
|
-
*
|
|
8
|
-
* Learn more at https://developers.cloudflare.com/workers/
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
export default {
|
|
12
|
-
async fetch(request, env, ctx) {
|
|
13
|
-
return new Response("Hello World!");
|
|
14
|
-
},
|
|
15
|
-
};
|
package/templates/new-worker.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Welcome to Cloudflare Workers! This is your first worker.
|
|
3
|
-
*
|
|
4
|
-
* - Run `wrangler dev src/index.ts` in your terminal to start a development server
|
|
5
|
-
* - Open a browser tab at http://localhost:8787/ to see your worker in action
|
|
6
|
-
* - Run `wrangler deploy src/index.ts --name my-worker` to deploy your worker
|
|
7
|
-
*
|
|
8
|
-
* Learn more at https://developers.cloudflare.com/workers/
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
export interface Env {
|
|
12
|
-
// Example binding to KV. Learn more at https://developers.cloudflare.com/workers/runtime-apis/kv/
|
|
13
|
-
// MY_KV_NAMESPACE: KVNamespace;
|
|
14
|
-
//
|
|
15
|
-
// Example binding to Durable Object. Learn more at https://developers.cloudflare.com/workers/runtime-apis/durable-objects/
|
|
16
|
-
// MY_DURABLE_OBJECT: DurableObjectNamespace;
|
|
17
|
-
//
|
|
18
|
-
// Example binding to R2. Learn more at https://developers.cloudflare.com/workers/runtime-apis/r2/
|
|
19
|
-
// MY_BUCKET: R2Bucket;
|
|
20
|
-
//
|
|
21
|
-
// Example binding to a Service. Learn more at https://developers.cloudflare.com/workers/runtime-apis/service-bindings/
|
|
22
|
-
// MY_SERVICE: Fetcher;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export default {
|
|
26
|
-
async fetch(
|
|
27
|
-
request: Request,
|
|
28
|
-
env: Env,
|
|
29
|
-
ctx: ExecutionContext
|
|
30
|
-
): Promise<Response> {
|
|
31
|
-
return new Response("Hello World!");
|
|
32
|
-
},
|
|
33
|
-
};
|