wrangler 0.0.0-e88a54e → 0.0.0-e8df68ee
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/Cloudflare_CA.pem +18 -0
- package/README.md +46 -15
- package/bin/wrangler.js +118 -32
- package/kv-asset-handler.js +1 -0
- package/package.json +194 -143
- package/templates/__tests__/pages-dev-util.test.ts +128 -0
- package/templates/__tests__/tsconfig-sanity.ts +12 -0
- package/templates/__tests__/tsconfig.json +8 -0
- package/templates/checked-fetch.js +23 -0
- package/templates/facade.d.ts +17 -0
- package/templates/gitignore +172 -0
- package/templates/init-tests/test-jest-new-worker.js +23 -0
- package/templates/init-tests/test-vitest-new-worker.js +24 -0
- package/templates/init-tests/test-vitest-new-worker.ts +25 -0
- package/templates/middleware/common.ts +67 -0
- package/templates/middleware/loader-modules.ts +127 -0
- package/templates/middleware/loader-sw.ts +228 -0
- package/templates/middleware/middleware-d1-beta.d.ts +3 -0
- package/templates/middleware/middleware-d1-beta.ts +244 -0
- package/templates/middleware/middleware-miniflare3-json-error.ts +32 -0
- package/templates/middleware/middleware-multiworker-dev.d.ts +4 -0
- package/templates/middleware/middleware-multiworker-dev.ts +59 -0
- package/templates/middleware/middleware-pretty-error.ts +40 -0
- package/templates/middleware/middleware-scheduled.ts +15 -0
- package/templates/middleware/middleware-serve-static-assets.d.ts +6 -0
- package/templates/middleware/middleware-serve-static-assets.ts +56 -0
- package/templates/new-worker-scheduled.js +17 -0
- package/templates/new-worker-scheduled.ts +32 -0
- package/templates/new-worker.js +3 -3
- package/templates/new-worker.ts +22 -4
- package/templates/no-op-worker.js +10 -0
- package/templates/pages-dev-pipeline.ts +31 -0
- package/templates/pages-dev-util.ts +55 -0
- package/templates/pages-shim.ts +9 -0
- package/templates/pages-template-plugin.ts +190 -0
- package/templates/pages-template-worker.ts +198 -0
- package/templates/tsconfig-sanity.ts +11 -0
- package/templates/tsconfig.init.json +105 -0
- package/templates/tsconfig.json +6 -103
- package/wrangler-dist/cli.d.ts +1726 -0
- package/wrangler-dist/cli.js +134048 -126481
- package/wrangler-dist/wasm-sync.wasm +0 -0
- package/import_meta_url.js +0 -3
- package/miniflare-config-stubs/.env.empty +0 -0
- package/miniflare-config-stubs/package.empty.json +0 -1
- package/miniflare-config-stubs/wrangler.empty.toml +0 -0
- package/miniflare-dist/index.mjs +0 -79
- package/miniflare-dist/index.mjs.map +0 -7
- package/pages/functions/buildWorker.ts +0 -62
- package/pages/functions/filepath-routing.test.ts +0 -223
- package/pages/functions/filepath-routing.ts +0 -181
- package/pages/functions/identifiers.ts +0 -78
- package/pages/functions/routes.ts +0 -151
- package/pages/functions/template-worker.ts +0 -130
- package/src/__tests__/configuration.test.ts +0 -2796
- package/src/__tests__/dev.test.tsx +0 -496
- package/src/__tests__/dev2.test.tsx +0 -154
- package/src/__tests__/guess-worker-format.test.ts +0 -58
- package/src/__tests__/helpers/clipboardy-mock.js +0 -4
- package/src/__tests__/helpers/cmd-shim.d.ts +0 -11
- package/src/__tests__/helpers/faye-websocket.d.ts +0 -6
- package/src/__tests__/helpers/mock-account-id.ts +0 -48
- package/src/__tests__/helpers/mock-bin.ts +0 -36
- package/src/__tests__/helpers/mock-cfetch.ts +0 -207
- package/src/__tests__/helpers/mock-console.ts +0 -70
- package/src/__tests__/helpers/mock-dialogs.ts +0 -65
- package/src/__tests__/helpers/mock-kv.ts +0 -33
- package/src/__tests__/helpers/mock-stdin.ts +0 -103
- package/src/__tests__/helpers/mock-web-socket.ts +0 -29
- package/src/__tests__/helpers/run-in-tmp.ts +0 -32
- package/src/__tests__/helpers/run-wrangler.ts +0 -16
- package/src/__tests__/helpers/write-wrangler-toml.ts +0 -17
- package/src/__tests__/https-options.test.ts +0 -127
- package/src/__tests__/index.test.ts +0 -991
- package/src/__tests__/jest.setup.ts +0 -69
- package/src/__tests__/kv.test.ts +0 -1382
- package/src/__tests__/logout.test.ts +0 -52
- package/src/__tests__/package-manager.test.ts +0 -206
- package/src/__tests__/pages.test.ts +0 -44
- package/src/__tests__/parse.test.ts +0 -322
- package/src/__tests__/publish.test.ts +0 -2704
- package/src/__tests__/r2.test.ts +0 -198
- package/src/__tests__/route.test.ts +0 -45
- package/src/__tests__/secret.test.ts +0 -425
- package/src/__tests__/sentry.test.ts +0 -146
- package/src/__tests__/tail.test.ts +0 -564
- package/src/__tests__/whoami.test.tsx +0 -100
- package/src/bundle.ts +0 -142
- package/src/cfetch/index.ts +0 -104
- package/src/cfetch/internal.ts +0 -139
- package/src/cli.ts +0 -19
- package/src/config/README.md +0 -107
- package/src/config/config.ts +0 -218
- package/src/config/diagnostics.ts +0 -80
- package/src/config/environment.ts +0 -366
- package/src/config/index.ts +0 -62
- package/src/config/validation-helpers.ts +0 -486
- package/src/config/validation.ts +0 -1090
- package/src/create-worker-preview.ts +0 -166
- package/src/create-worker-upload-form.ts +0 -217
- package/src/dev/dev.tsx +0 -364
- package/src/dev/local.tsx +0 -232
- package/src/dev/remote.tsx +0 -203
- package/src/dev/use-esbuild.ts +0 -100
- package/src/dialogs.tsx +0 -77
- package/src/entry.ts +0 -208
- package/src/environment-variables.ts +0 -33
- package/src/https-options.ts +0 -122
- package/src/index.tsx +0 -2373
- package/src/inspect.ts +0 -617
- package/src/kv.ts +0 -319
- package/src/miniflare-cli/README.md +0 -30
- package/src/miniflare-cli/enum-keys.ts +0 -17
- package/src/miniflare-cli/index.ts +0 -37
- package/src/module-collection.ts +0 -258
- package/src/open-in-browser.ts +0 -25
- package/src/package-manager.ts +0 -126
- package/src/pages.tsx +0 -1047
- package/src/parse.ts +0 -183
- package/src/paths.ts +0 -26
- package/src/proxy.ts +0 -440
- package/src/publish.ts +0 -347
- package/src/r2.ts +0 -50
- package/src/reporting.ts +0 -131
- package/src/selfsigned.d.ts +0 -29
- package/src/sites.tsx +0 -280
- package/src/tail/filters.ts +0 -279
- package/src/tail/index.ts +0 -299
- package/src/tail/printing.ts +0 -62
- package/src/user.tsx +0 -1118
- package/src/whoami.tsx +0 -69
- package/src/worker.ts +0 -163
- package/templates/static-asset-facade.js +0 -47
- package/vendor/@cloudflare/kv-asset-handler/CHANGELOG.md +0 -332
- package/vendor/@cloudflare/kv-asset-handler/LICENSE_APACHE +0 -176
- package/vendor/@cloudflare/kv-asset-handler/LICENSE_MIT +0 -25
- package/vendor/@cloudflare/kv-asset-handler/README.md +0 -245
- package/vendor/@cloudflare/kv-asset-handler/dist/index.d.ts +0 -32
- package/vendor/@cloudflare/kv-asset-handler/dist/index.js +0 -354
- package/vendor/@cloudflare/kv-asset-handler/dist/mocks.d.ts +0 -13
- package/vendor/@cloudflare/kv-asset-handler/dist/mocks.js +0 -148
- package/vendor/@cloudflare/kv-asset-handler/dist/test/getAssetFromKV.d.ts +0 -1
- package/vendor/@cloudflare/kv-asset-handler/dist/test/getAssetFromKV.js +0 -436
- package/vendor/@cloudflare/kv-asset-handler/dist/test/mapRequestToAsset.d.ts +0 -1
- package/vendor/@cloudflare/kv-asset-handler/dist/test/mapRequestToAsset.js +0 -40
- package/vendor/@cloudflare/kv-asset-handler/dist/test/serveSinglePageApp.d.ts +0 -1
- package/vendor/@cloudflare/kv-asset-handler/dist/test/serveSinglePageApp.js +0 -42
- package/vendor/@cloudflare/kv-asset-handler/dist/types.d.ts +0 -26
- package/vendor/@cloudflare/kv-asset-handler/dist/types.js +0 -31
- package/vendor/@cloudflare/kv-asset-handler/package.json +0 -52
- package/vendor/@cloudflare/kv-asset-handler/src/index.ts +0 -296
- package/vendor/@cloudflare/kv-asset-handler/src/mocks.ts +0 -136
- package/vendor/@cloudflare/kv-asset-handler/src/test/getAssetFromKV.ts +0 -464
- package/vendor/@cloudflare/kv-asset-handler/src/test/mapRequestToAsset.ts +0 -33
- package/vendor/@cloudflare/kv-asset-handler/src/test/serveSinglePageApp.ts +0 -42
- package/vendor/@cloudflare/kv-asset-handler/src/types.ts +0 -39
- package/vendor/wrangler-mime/CHANGELOG.md +0 -289
- package/vendor/wrangler-mime/LICENSE +0 -21
- package/vendor/wrangler-mime/Mime.js +0 -97
- package/vendor/wrangler-mime/README.md +0 -187
- package/vendor/wrangler-mime/cli.js +0 -46
- package/vendor/wrangler-mime/index.js +0 -4
- package/vendor/wrangler-mime/lite.js +0 -4
- package/vendor/wrangler-mime/package.json +0 -52
- package/vendor/wrangler-mime/types/other.js +0 -1
- package/vendor/wrangler-mime/types/standard.js +0 -1
- package/wrangler-dist/cli.js.map +0 -7
package/src/whoami.tsx
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { Text, render } from "ink";
|
|
2
|
-
import Table from "ink-table";
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { fetchListResult, fetchResult } from "./cfetch";
|
|
5
|
-
import { getAPIToken } from "./user";
|
|
6
|
-
|
|
7
|
-
export async function whoami() {
|
|
8
|
-
console.log("Getting User settings...");
|
|
9
|
-
const user = await getUserInfo();
|
|
10
|
-
render(<WhoAmI user={user}></WhoAmI>);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function WhoAmI({ user }: { user: UserInfo | undefined }) {
|
|
14
|
-
return user ? (
|
|
15
|
-
<>
|
|
16
|
-
<Email tokenType={user.authType} email={user.email}></Email>
|
|
17
|
-
<Accounts accounts={user.accounts}></Accounts>
|
|
18
|
-
</>
|
|
19
|
-
) : (
|
|
20
|
-
<Text>You are not authenticated. Please run `wrangler login`.</Text>
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function Email(props: { tokenType: string; email: string }) {
|
|
25
|
-
return (
|
|
26
|
-
<Text>
|
|
27
|
-
👋 You are logged in with an {props.tokenType} Token, associated with the
|
|
28
|
-
email '{props.email}'!
|
|
29
|
-
</Text>
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function Accounts(props: { accounts: AccountInfo[] }) {
|
|
34
|
-
const accounts = props.accounts.map((account) => ({
|
|
35
|
-
"Account Name": account.name,
|
|
36
|
-
"Account ID": account.id,
|
|
37
|
-
}));
|
|
38
|
-
return <Table data={accounts}></Table>;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export interface UserInfo {
|
|
42
|
-
apiToken: string;
|
|
43
|
-
authType: string;
|
|
44
|
-
email: string;
|
|
45
|
-
accounts: AccountInfo[];
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export async function getUserInfo(): Promise<UserInfo | undefined> {
|
|
49
|
-
const apiToken = getAPIToken();
|
|
50
|
-
return apiToken
|
|
51
|
-
? {
|
|
52
|
-
apiToken,
|
|
53
|
-
authType: "OAuth",
|
|
54
|
-
email: await getEmail(),
|
|
55
|
-
accounts: await getAccounts(),
|
|
56
|
-
}
|
|
57
|
-
: undefined;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
async function getEmail(): Promise<string> {
|
|
61
|
-
const { email } = await fetchResult<{ email: string }>("/user");
|
|
62
|
-
return email;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
type AccountInfo = { name: string; id: string };
|
|
66
|
-
|
|
67
|
-
async function getAccounts(): Promise<AccountInfo[]> {
|
|
68
|
-
return await fetchListResult<AccountInfo>("/accounts");
|
|
69
|
-
}
|
package/src/worker.ts
DELETED
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A Cloudflare account.
|
|
3
|
-
*/
|
|
4
|
-
export interface CfAccount {
|
|
5
|
-
/**
|
|
6
|
-
* An API token.
|
|
7
|
-
*
|
|
8
|
-
* @link https://api.cloudflare.com/#user-api-tokens-properties
|
|
9
|
-
*/
|
|
10
|
-
apiToken: string;
|
|
11
|
-
/**
|
|
12
|
-
* An account ID.
|
|
13
|
-
*/
|
|
14
|
-
accountId: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* The type of Worker
|
|
19
|
-
*/
|
|
20
|
-
export type CfScriptFormat = "modules" | "service-worker";
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* A module type.
|
|
24
|
-
*/
|
|
25
|
-
export type CfModuleType =
|
|
26
|
-
| "esm"
|
|
27
|
-
| "commonjs"
|
|
28
|
-
| "compiled-wasm"
|
|
29
|
-
| "text"
|
|
30
|
-
| "buffer";
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* An imported module.
|
|
34
|
-
*/
|
|
35
|
-
export interface CfModule {
|
|
36
|
-
/**
|
|
37
|
-
* The module name.
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* './src/index.js'
|
|
41
|
-
*/
|
|
42
|
-
name: string;
|
|
43
|
-
/**
|
|
44
|
-
* The module content, usually JavaScript or WASM code.
|
|
45
|
-
*
|
|
46
|
-
* @example
|
|
47
|
-
* export default {
|
|
48
|
-
* async fetch(request) {
|
|
49
|
-
* return new Response('Ok')
|
|
50
|
-
* }
|
|
51
|
-
* }
|
|
52
|
-
*/
|
|
53
|
-
content: string | Buffer;
|
|
54
|
-
/**
|
|
55
|
-
* The module type.
|
|
56
|
-
*
|
|
57
|
-
* If absent, will default to the main module's type.
|
|
58
|
-
*/
|
|
59
|
-
type?: CfModuleType;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* A map of variable names to values.
|
|
64
|
-
*/
|
|
65
|
-
interface CfVars {
|
|
66
|
-
[key: string]: unknown;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* A KV namespace.
|
|
71
|
-
*/
|
|
72
|
-
interface CfKvNamespace {
|
|
73
|
-
binding: string;
|
|
74
|
-
id: string;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* A binding to a wasm module (in service worker format)
|
|
79
|
-
*/
|
|
80
|
-
|
|
81
|
-
interface CfWasmModuleBindings {
|
|
82
|
-
[key: string]: string;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* A binding to a text blob (in service worker format)
|
|
87
|
-
*/
|
|
88
|
-
|
|
89
|
-
interface CfTextBlobBindings {
|
|
90
|
-
[key: string]: string;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* A Durable Object.
|
|
95
|
-
*/
|
|
96
|
-
interface CfDurableObject {
|
|
97
|
-
name: string;
|
|
98
|
-
class_name: string;
|
|
99
|
-
script_name?: string;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
interface CfR2Bucket {
|
|
103
|
-
binding: string;
|
|
104
|
-
bucket_name: string;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
interface CfUnsafeBinding {
|
|
108
|
-
name: string;
|
|
109
|
-
type: string;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export interface CfDurableObjectMigrations {
|
|
113
|
-
old_tag?: string;
|
|
114
|
-
new_tag: string;
|
|
115
|
-
steps: {
|
|
116
|
-
new_classes?: string[];
|
|
117
|
-
renamed_classes?: {
|
|
118
|
-
from: string;
|
|
119
|
-
to: string;
|
|
120
|
-
}[];
|
|
121
|
-
deleted_classes?: string[];
|
|
122
|
-
}[];
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Options for creating a `CfWorker`.
|
|
127
|
-
*/
|
|
128
|
-
export interface CfWorkerInit {
|
|
129
|
-
/**
|
|
130
|
-
* The name of the worker.
|
|
131
|
-
*/
|
|
132
|
-
name: string | undefined;
|
|
133
|
-
/**
|
|
134
|
-
* The entrypoint module.
|
|
135
|
-
*/
|
|
136
|
-
main: CfModule;
|
|
137
|
-
/**
|
|
138
|
-
* The list of additional modules.
|
|
139
|
-
*/
|
|
140
|
-
modules: undefined | CfModule[];
|
|
141
|
-
/**
|
|
142
|
-
* All the bindings
|
|
143
|
-
*/
|
|
144
|
-
bindings: {
|
|
145
|
-
vars: CfVars | undefined;
|
|
146
|
-
kv_namespaces: CfKvNamespace[] | undefined;
|
|
147
|
-
wasm_modules: CfWasmModuleBindings | undefined;
|
|
148
|
-
text_blobs: CfTextBlobBindings | undefined;
|
|
149
|
-
durable_objects: { bindings: CfDurableObject[] } | undefined;
|
|
150
|
-
r2_buckets: CfR2Bucket[] | undefined;
|
|
151
|
-
unsafe: CfUnsafeBinding[] | undefined;
|
|
152
|
-
};
|
|
153
|
-
migrations: undefined | CfDurableObjectMigrations;
|
|
154
|
-
compatibility_date: string | undefined;
|
|
155
|
-
compatibility_flags: undefined | string[];
|
|
156
|
-
usage_model: undefined | "bundled" | "unbound";
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
export interface CfWorkerContext {
|
|
160
|
-
env: string | undefined;
|
|
161
|
-
legacyEnv: boolean | undefined;
|
|
162
|
-
zone: { id: string; host: string } | undefined;
|
|
163
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
// DO NOT IMPORT THIS DIRECTLY
|
|
2
|
-
import worker from "__ENTRY_POINT__";
|
|
3
|
-
import { getAssetFromKV } from "@cloudflare/kv-asset-handler";
|
|
4
|
-
import manifest from "__STATIC_CONTENT_MANIFEST";
|
|
5
|
-
const ASSET_MANIFEST = JSON.parse(manifest);
|
|
6
|
-
|
|
7
|
-
// TODO: remove this
|
|
8
|
-
globalThis.__STATIC_CONTENT = undefined;
|
|
9
|
-
globalThis.__STATIC_CONTENT_MANIFEST = undefined;
|
|
10
|
-
|
|
11
|
-
export default {
|
|
12
|
-
async fetch(request, env, ctx) {
|
|
13
|
-
let options = {
|
|
14
|
-
ASSET_MANIFEST,
|
|
15
|
-
ASSET_NAMESPACE: env.__STATIC_CONTENT,
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
try {
|
|
19
|
-
const page = await getAssetFromKV(
|
|
20
|
-
{
|
|
21
|
-
request,
|
|
22
|
-
waitUntil(promise) {
|
|
23
|
-
return ctx.waitUntil(promise);
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
options
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
// allow headers to be altered
|
|
30
|
-
const response = new Response(page.body, page);
|
|
31
|
-
|
|
32
|
-
response.headers.set("X-XSS-Protection", "1; mode=block");
|
|
33
|
-
response.headers.set("X-Content-Type-Options", "nosniff");
|
|
34
|
-
response.headers.set("X-Frame-Options", "DENY");
|
|
35
|
-
response.headers.set("Referrer-Policy", "unsafe-url");
|
|
36
|
-
response.headers.set("Feature-Policy", "none");
|
|
37
|
-
|
|
38
|
-
return response;
|
|
39
|
-
} catch (e) {
|
|
40
|
-
console.error(e);
|
|
41
|
-
// if an error is thrown then serve from actual worker
|
|
42
|
-
return worker.fetch(request);
|
|
43
|
-
// TODO: throw here if worker is not available
|
|
44
|
-
// (which implies it may be a service worker)
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
};
|
|
@@ -1,332 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## 0.1.2
|
|
4
|
-
|
|
5
|
-
- ### Features
|
|
6
|
-
|
|
7
|
-
- **Support for `defaultDocument` configuration - [boemekeld], [pull/161]**
|
|
8
|
-
|
|
9
|
-
This PR adds support for customizing the `defaultDocument` option in `getAssetFromKV`. In situations where a project does not use `index.html` as the default document for a path, this can now be customized to values like `index.shtm`:
|
|
10
|
-
|
|
11
|
-
```js
|
|
12
|
-
return getAssetFromKV(event, {
|
|
13
|
-
defaultDocument: "index.shtm"
|
|
14
|
-
})
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
[boemekeld]: https://github.com/boemekeld
|
|
18
|
-
[pull/161]: https://github.com/cloudflare/kv-asset-handler/pull/161
|
|
19
|
-
|
|
20
|
-
- ### Fixes
|
|
21
|
-
|
|
22
|
-
- **Fire `mapRequestToAsset` for all requests, if explicitly defined - [Cherry], [pull/159]**
|
|
23
|
-
|
|
24
|
-
This PR fixes an issue where a custom `mapRequestToAsset` handler weren't fired if a matching asset path was found in `ASSET_MANIFEST` data. By correctly checking for this handler, we can conditionally handle any assets with this handler _even_ if they exist in the `ASSET_MANIFEST`.
|
|
25
|
-
|
|
26
|
-
**Note that this is a breaking change**, as previously, the mapRequestToAsset function was ignored if you set it, and an exact match was found in the `ASSET_MANIFEST`. That being said, this behavior was a bug, and unexpected behavior, as documented in [issue/158].
|
|
27
|
-
|
|
28
|
-
[Cherry]: https://github.com/Cherry
|
|
29
|
-
[issue/158]: https://github.com/kv-asset-handler/pull/158
|
|
30
|
-
[pull/159]: https://github.com/kv-asset-handler/pull/159
|
|
31
|
-
|
|
32
|
-
- **Etag logic refactor - [shagamemnon], [pull/133]**
|
|
33
|
-
|
|
34
|
-
This PR refactors a great deal of the Etag functionality introduced in [0.0.11](https://github.com/cloudflare/kv-asset-handler/milestone/7?closed=1). `kv-asset-handler` will now correctly set [strong and weak Etags](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag) both to the Cloudflare CDN and to client eyeballs, allowing for higher cache percentages with Workers Sites projects.
|
|
35
|
-
|
|
36
|
-
[pull/133]: https://github.com/cloudflare/kv-asset-handler/pull/133
|
|
37
|
-
[shagamemnon]: https://github.com/shagamemnon
|
|
38
|
-
|
|
39
|
-
- **Fix path decoding issue - [xiaolanglanglang], [pull/142]**
|
|
40
|
-
|
|
41
|
-
This PR improves support for non-alphanumeric character paths in `kv-asset-handler`, for instance, if the path requested is in Chinese.
|
|
42
|
-
|
|
43
|
-
[xiaolanglanglang]: https://github.com/xiaolanglanglang
|
|
44
|
-
[pull/142]: https://github.com/cloudflare/kv-asset-handler/pull/142
|
|
45
|
-
|
|
46
|
-
- **Check HTTP method after mapRequestToAsset - [oliverpool], [pull/178]**
|
|
47
|
-
|
|
48
|
-
This PR fixes an issue where the HTTP method for an asset is checked before the `mapRequestToAsset` handler is called. This has caused issues for users in the past, where they need to generate a `requestKey` based on an asset path, even if the request method is not `GET`. This fixes [issue/151].
|
|
49
|
-
|
|
50
|
-
[oliverpool]: https://github.com/oliverpool
|
|
51
|
-
[pull/178]: https://github.com/cloudflare/kv-asset-handler/pull/178
|
|
52
|
-
[issue/151]: https://github.com/cloudflare/kv-asset-handler/issues/151
|
|
53
|
-
|
|
54
|
-
- ### Maintenance
|
|
55
|
-
|
|
56
|
-
- **Add Markdown linting workflow to GitHub Actions - [jbampton], [pull/135]**
|
|
57
|
-
|
|
58
|
-
Our GitHub Actions workflow now includes a linting workflow for Markdown in the project, including the README, this CHANGELOG, and any other `.md` files in the source code.
|
|
59
|
-
|
|
60
|
-
[jbampton]: https://github.com/jbampton
|
|
61
|
-
[pull/135]: https://github.com/cloudflare/kv-asset-handler/pull/135
|
|
62
|
-
|
|
63
|
-
- **Dependabot updates**
|
|
64
|
-
|
|
65
|
-
A number of dependabot patch-level updates have been merged since our last release:
|
|
66
|
-
|
|
67
|
-
- Bump @types/node from 15.30.0 to 15.30.1 ([pull/180])
|
|
68
|
-
- Bump hosted-git-info from 2.8.8 to 2.8.9 ([pull/176])
|
|
69
|
-
- Bump ini from 1.3.5 to 1.3.8 ([pull/160])
|
|
70
|
-
- Bump lodash from 4.17.19 to 4.17.21 ([pull/175])
|
|
71
|
-
- Bump urijs from 1.19.2 to 1.19.6 ([pull/168])
|
|
72
|
-
- Bump y18n from 4.0.0 to 4.0.1 ([pull/173])
|
|
73
|
-
|
|
74
|
-
[pull/160]: https://github.com/cloudflare/kv-asset-handler/pull/160
|
|
75
|
-
[pull/168]: https://github.com/cloudflare/kv-asset-handler/pull/168
|
|
76
|
-
[pull/173]: https://github.com/cloudflare/kv-asset-handler/pull/173
|
|
77
|
-
[pull/175]: https://github.com/cloudflare/kv-asset-handler/pull/175
|
|
78
|
-
[pull/176]: https://github.com/cloudflare/kv-asset-handler/pull/176
|
|
79
|
-
[pull/180]: https://github.com/cloudflare/kv-asset-handler/pull/180
|
|
80
|
-
|
|
81
|
-
- **Repository maintenance - [Cherry], [pull/179]**
|
|
82
|
-
|
|
83
|
-
New project maintainer Cherry did a ton of maintenance in this release, improving workflows, code quality, and more. Check out the full list in [the PR][pull/179].
|
|
84
|
-
|
|
85
|
-
[Cherry]: https://github.com/Cherry
|
|
86
|
-
[pull/179]: https://github.com/cloudflare/kv-asset-handler/pull/179
|
|
87
|
-
|
|
88
|
-
- ### Documentation
|
|
89
|
-
|
|
90
|
-
- **Update README.md - [signalnerve], [pull/177]**
|
|
91
|
-
|
|
92
|
-
This PR adds context to our README, with mentions about _what_ this project is, how to use it, and some new things since the last version of this package: namely, [Cloudflare Pages](https://pages.dev) and the new [Cloudflare Workers Discord server](https://discord.gg/cloudflaredev)
|
|
93
|
-
|
|
94
|
-
[signalnerve]: https://github.com/signalnerve
|
|
95
|
-
[pull/177]: https://github.com/cloudflare/kv-asset-handler/pull/177
|
|
96
|
-
|
|
97
|
-
- **Add instructions for updating version in related repos - [caass], [pull/171]**
|
|
98
|
-
|
|
99
|
-
This PR adds instructions for updating the `kv-asset-handler` version in related repositories, such as our templates, that use `kv-asset-handler` and are exposed to end-users of Wrangler and Workers.
|
|
100
|
-
|
|
101
|
-
[caass]: https://github.com/caass
|
|
102
|
-
[pull/177]: https://github.com/cloudflare/kv-asset-handler/pull/171
|
|
103
|
-
|
|
104
|
-
## 0.1.1
|
|
105
|
-
|
|
106
|
-
- ### Fixes
|
|
107
|
-
|
|
108
|
-
- **kv-asset-handler can translate 206 responses to 200 - [harrishancock], [pull/166]**
|
|
109
|
-
|
|
110
|
-
Fixes [wrangler#1746](https://github.com/cloudflare/wrangler/issues/1746)
|
|
111
|
-
|
|
112
|
-
[harrishancock](https://github.com/harrishancock)
|
|
113
|
-
[pull/166](https://github.com/cloudflare/kv-asset-handler/pull/166)
|
|
114
|
-
|
|
115
|
-
## 0.0.12
|
|
116
|
-
|
|
117
|
-
- ### Features
|
|
118
|
-
|
|
119
|
-
- **Add defaultMimeType option to getAssetFromKV - [mgrahamjo], [pull/121]**
|
|
120
|
-
|
|
121
|
-
Some static website owners prefer not to create all of their web routes as directories containing index.html files. Instead, they prefer to create pages as extensionless HTML files. Providing a defaultMimeType option will allow users to set the Content-Type header for extensionless files to text/html, which will enable this use case.
|
|
122
|
-
|
|
123
|
-
[mgrahamjo]: https://github.com/mgrahamjo
|
|
124
|
-
[pull/121]: https://github.com/cloudflare/kv-asset-handler/pull/121
|
|
125
|
-
|
|
126
|
-
- **Add defaultMimeType to types - [shagamemnon], [pull/132]**
|
|
127
|
-
|
|
128
|
-
Adds the newly added defaultMimeType to the exported types for this package.
|
|
129
|
-
|
|
130
|
-
[pull/132]: https://github.com/cloudflare/kv-asset-handler/pull/132
|
|
131
|
-
|
|
132
|
-
- ### Fixes
|
|
133
|
-
|
|
134
|
-
- **Fix text/* charset - [EatonZ], [pull/130]**
|
|
135
|
-
|
|
136
|
-
Adds a missing `-` to the `utf-8` charset value in response mime types.
|
|
137
|
-
|
|
138
|
-
[EatonZ]: https://github.com/EatonZ
|
|
139
|
-
[pull/130]: https://github.com/cloudflare/kv-asset-handler/pull/130
|
|
140
|
-
|
|
141
|
-
- **Cache handling for HEAD requests - [klittlepage], [pull/141]**
|
|
142
|
-
|
|
143
|
-
This PR skips caching for incoming HEAD requests, as they should not be able to be edge cached.
|
|
144
|
-
|
|
145
|
-
[klittlepage]: https://github.com/klittlepage
|
|
146
|
-
[pull/141]: https://github.com/cloudflare/kv-asset-handler/pull/141
|
|
147
|
-
|
|
148
|
-
- ### Maintenance
|
|
149
|
-
|
|
150
|
-
- **Markdown linting/typos - [jbampton], [pull/123], [pull/125], [pull/126], [pull/127], [pull/128], [pull/129], [pull/131], [pull/134]**
|
|
151
|
-
|
|
152
|
-
These PRs contain various typo fixes and linting of existing Markdown files in our documentation and CHANGELOG.
|
|
153
|
-
|
|
154
|
-
[jbampton]: https://github.com/jbampton
|
|
155
|
-
[pull/123]: https://github.com/cloudflare/kv-asset-handler/pull/123
|
|
156
|
-
[pull/125]: https://github.com/cloudflare/kv-asset-handler/pull/125
|
|
157
|
-
[pull/126]: https://github.com/cloudflare/kv-asset-handler/pull/126
|
|
158
|
-
[pull/127]: https://github.com/cloudflare/kv-asset-handler/pull/127
|
|
159
|
-
[pull/128]: https://github.com/cloudflare/kv-asset-handler/pull/128
|
|
160
|
-
[pull/129]: https://github.com/cloudflare/kv-asset-handler/pull/129
|
|
161
|
-
[pull/131]: https://github.com/cloudflare/kv-asset-handler/pull/131
|
|
162
|
-
[pull/134]: https://github.com/cloudflare/kv-asset-handler/pull/134
|
|
163
|
-
|
|
164
|
-
## 0.0.11
|
|
165
|
-
|
|
166
|
-
- ### Features
|
|
167
|
-
|
|
168
|
-
- **Support cache revalidation using ETags and If-None-Match - [shagamemnon], [issue/62] [pull/94] [pull/113]**
|
|
169
|
-
|
|
170
|
-
Previously, cacheable resources were not looked up from the browser cache because `getAssetFromKV` would never return a `304 Not Modified` response.
|
|
171
|
-
|
|
172
|
-
Now, `getAssetFromKV` sets an `ETag` header on all cacheable assets before putting them in the Cache API, and therefore will return a `304` response when appropriate.
|
|
173
|
-
|
|
174
|
-
[shagamemnon]: https://github.com/shagamemnon
|
|
175
|
-
[pull/94]: https://github.com/cloudflare/kv-asset-handler/pull/94
|
|
176
|
-
[pull/113]: https://github.com/cloudflare/kv-asset-handler/issues/113
|
|
177
|
-
[issue/62]: https://github.com/cloudflare/kv-asset-handler/issues/62
|
|
178
|
-
|
|
179
|
-
- **Export TypeScript types - [ispivey], [issue/43] [pull/106]**
|
|
180
|
-
|
|
181
|
-
[ispivey]: https://github.com/ispivey
|
|
182
|
-
[pull/106]: https://github.com/cloudflare/kv-asset-handler/pull/106
|
|
183
|
-
[issue/43]: https://github.com/cloudflare/kv-asset-handler/issues/43
|
|
184
|
-
|
|
185
|
-
- ### Fixes
|
|
186
|
-
|
|
187
|
-
- **Support non-ASCII characters in paths - [SukkaW], [issue/99] [pull/105]**
|
|
188
|
-
|
|
189
|
-
Fixes an issue where non-ASCII paths were not URI-decoded before being looked up, causing non-ASCII paths to 404.
|
|
190
|
-
|
|
191
|
-
[SukkaW]: https://github.com/SukkaW
|
|
192
|
-
[pull/105]: https://github.com/cloudflare/kv-asset-handler/pull/105
|
|
193
|
-
[issue/99]: https://github.com/cloudflare/kv-asset-handler/issues/99
|
|
194
|
-
|
|
195
|
-
- **Support `charset=utf8` in MIME type - [theromis], [issue/92] [pull/97]**
|
|
196
|
-
|
|
197
|
-
Fixes an issue where `Content-Type: text/*` was never appended with `; charset=utf8`, meaning clients would not render non-ASCII characters properly.
|
|
198
|
-
|
|
199
|
-
[theromis]: https://github.com/theromis
|
|
200
|
-
[pull/97]: https://github.com/cloudflare/kv-asset-handler/pull/97
|
|
201
|
-
[issue/92]: https://github.com/cloudflare/kv-asset-handler/issues/92
|
|
202
|
-
|
|
203
|
-
- **Fix bugs in README examples - [kentonv] [bradyjoslin], [issue/93] [pull/102] [issue/88] [pull/116]**
|
|
204
|
-
|
|
205
|
-
[kentonv]: https://github.com/kentonv
|
|
206
|
-
[bradyjoslin]: https://github.com/bradyjoslin
|
|
207
|
-
[pull/102]: https://github.com/cloudflare/kv-asset-handler/pull/102
|
|
208
|
-
[pull/116]: https://github.com/cloudflare/kv-asset-handler/pull/116
|
|
209
|
-
[issue/93]: https://github.com/cloudflare/kv-asset-handler/issues/93
|
|
210
|
-
[issue/88]: https://github.com/cloudflare/kv-asset-handler/issues/88
|
|
211
|
-
|
|
212
|
-
- ### Maintenance
|
|
213
|
-
|
|
214
|
-
- **Make `@cloudflare/workers-types` a dependency and update deps - [ispivey], [pull/107]**
|
|
215
|
-
|
|
216
|
-
[ispivey]: https://github.com/ispivey
|
|
217
|
-
[pull/107]: https://github.com/cloudflare/kv-asset-handler/pull/107
|
|
218
|
-
|
|
219
|
-
- **Add Code of Conduct - [EverlastingBugstopper], [pull/101]**
|
|
220
|
-
|
|
221
|
-
[EverlastingBugstopper]: https://github.com/EverlastingBugstopper
|
|
222
|
-
[pull/101]: https://github.com/cloudflare/kv-asset-handler/pull/101
|
|
223
|
-
|
|
224
|
-
## 0.0.10
|
|
225
|
-
|
|
226
|
-
- ### Features
|
|
227
|
-
|
|
228
|
-
- **Allow extensionless files to be served - [victoriabernard92], [cloudflare/wrangler/issues/980], [pull/73]**
|
|
229
|
-
|
|
230
|
-
Prior to this PR, `getAssetFromKv` assumed extensionless requests (e.g. `/some-path`) would be set up to be served as the corresponding HTML file in storage (e.g. `some-path.html`).
|
|
231
|
-
This fix checks the `ASSET_MANIFEST` for the extensionless file name _before_ appending the HTML extension. If the extensionless file exists (e.g. `some-path` exists as a key in the ASSET_MANIFEST) then we serve that file first. If the extensionless file does not exist, then the behavior does not change (e.g. it still looks for `some-path.html`).
|
|
232
|
-
|
|
233
|
-
[victoriabernard92]: https://github.com/victoriabernard92
|
|
234
|
-
[cloudflare/wrangler/issues/980]: https://github.com/cloudflare/wrangler/issues/980
|
|
235
|
-
[pull/73]: https://github.com/cloudflare/kv-asset-handler/pull/73
|
|
236
|
-
|
|
237
|
-
- ### Fixes
|
|
238
|
-
|
|
239
|
-
- **Fix URL parsing in serveSinglePageApp - [signalnerve],[sgiacosa], [issue/72], [pull/82]**
|
|
240
|
-
|
|
241
|
-
This fixes an issue in `serveSinglePageApp` where the request.url is used as a string to retrieve static content. For example,
|
|
242
|
-
if a query parameter was set, the URL lookup would break. This fix uses a parsed URL instead of the string and adjusts the README.
|
|
243
|
-
|
|
244
|
-
[signalnerve]: https://github.com/signalnerve
|
|
245
|
-
[sgiacosa]: https://github.com/sgiacosa
|
|
246
|
-
[issue/72]: https://github.com/cloudflare/kv-asset-handler/issue/72
|
|
247
|
-
[pull/82]: https://github.com/cloudflare/kv-asset-handler/pull/82
|
|
248
|
-
|
|
249
|
-
## 0.0.9
|
|
250
|
-
|
|
251
|
-
- ### Fixes
|
|
252
|
-
|
|
253
|
-
- **Building and publishing to npm - [victoriabernard92], [pull/78], [pull/79]**
|
|
254
|
-
|
|
255
|
-
Added a `prepack` step that builds JavaScript files from the TypeScript source. This fixes previously broken `npm` publishes.
|
|
256
|
-
|
|
257
|
-
[victoriabernard92]: https://github.com/victoriabernard92
|
|
258
|
-
[issue/78]: https://github.com/cloudflare/kv-asset-handler/issue/78
|
|
259
|
-
[pull/79]: https://github.com/cloudflare/kv-asset-handler/pull/79
|
|
260
|
-
|
|
261
|
-
## 0.0.8
|
|
262
|
-
|
|
263
|
-
- ### Features
|
|
264
|
-
|
|
265
|
-
- **Support a variety of errors thrown from `getAssetFromKV` - [victoriabernard92], [issue/59] [pull/64]**
|
|
266
|
-
|
|
267
|
-
Previously, `getAssetFromKv` would throw the same error type if anything went wrong. Now it will throw different error types so that clients can catch and differentiate them.
|
|
268
|
-
For example, a 404 `NotFoundError` error implies nothing went wrong, the asset just didn't exist while
|
|
269
|
-
a 500 `InternalError` means an expected variable was undefined.
|
|
270
|
-
|
|
271
|
-
[victoriabernard92]: https://github.com/victoriabernard92
|
|
272
|
-
[issue/44]: https://github.com/cloudflare/kv-asset-handler/issues/44
|
|
273
|
-
[issue/59]: https://github.com/cloudflare/kv-asset-handler/issues/59
|
|
274
|
-
[pull/47]: https://github.com/cloudflare/kv-asset-handler/pull/47
|
|
275
|
-
|
|
276
|
-
- ### Fixes
|
|
277
|
-
|
|
278
|
-
- **Range Issue with Safari and videos - [victoriabernard92], [issue/60] [pull/66]**
|
|
279
|
-
|
|
280
|
-
Previously, if you wanted to serve a video from Workers KV using `kv-asset-handler`, it would be broken on Safari due to its requirement that all videos support the [`Content-Range` header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range). Cloudflare already has a feature that will handle these headers automatically, we just needed to take advantage of it by passing in a `Request` object to the [Cache API](https://developers.cloudflare.com/workers/reference/apis/cache/) rather than a URL string.
|
|
281
|
-
videos from not including the range headers.
|
|
282
|
-
|
|
283
|
-
[victoriabernard92]: https://github.com/victoriabernard92
|
|
284
|
-
[shagamemnon]: https://github.com/shagamemnon
|
|
285
|
-
[issue/60]: https://github.com/cloudflare/kv-asset-handler/issues/60
|
|
286
|
-
[issue/63]: https://github.com/cloudflare/kv-asset-handler/issues/63
|
|
287
|
-
[pull/47]: https://github.com/cloudflare/kv-asset-handler/pull/52
|
|
288
|
-
[pull/66]: https://github.com/cloudflare/kv-asset-handler/pull/66
|
|
289
|
-
|
|
290
|
-
- **Support custom asset namespaces passed into `getAssetFromKV` - [victoriabernard92], [issue/67] [pull/68]**
|
|
291
|
-
|
|
292
|
-
This functionality was documented but not properly supported. Tests and implementation fixes applied.
|
|
293
|
-
|
|
294
|
-
[victoriabernard92]: https://github.com/victoriabernard92
|
|
295
|
-
[issue/67]: https://github.com/cloudflare/kv-asset-handler/issues/67
|
|
296
|
-
[pull/68]: https://github.com/cloudflare/kv-asset-handler/pull/68
|
|
297
|
-
|
|
298
|
-
## 0.0.7
|
|
299
|
-
|
|
300
|
-
- ### Features
|
|
301
|
-
|
|
302
|
-
- **Add handler for SPAs - [ashleymichal], [issue/46] [pull/47]**
|
|
303
|
-
|
|
304
|
-
Some browser applications employ client-side routers that handle navigation in the browser rather than on the server. These applications will work as expected until a non-root URL is requested from the server. This PR adds a special handler, `serveSinglePageApp`, that maps all HTML requests to the root index.html. This is similar to setting a static asset route pattern in an Express.js app.
|
|
305
|
-
|
|
306
|
-
[ashleymichal]: https://github.com/ashleymichal
|
|
307
|
-
[issue/46]: https://github.com/cloudflare/kv-asset-handler/issues/46
|
|
308
|
-
[pull/47]: https://github.com/cloudflare/kv-asset-handler/pull/47
|
|
309
|
-
|
|
310
|
-
- ### Documentation
|
|
311
|
-
|
|
312
|
-
- **Add function API for `getAssetFromKV` to README.md - [ashleymichal], [issue/48] [pull/52]**
|
|
313
|
-
|
|
314
|
-
This function, used to abstract away the implementation for retrieving static assets from a Workers KV namespace, includes a lot of great options for configuring your own, bespoke "Workers Sites" implementation. This PR adds documentation to the README for use by those who would like to tinker with these options.
|
|
315
|
-
|
|
316
|
-
[ashleymichal]: https://github.com/ashleymichal
|
|
317
|
-
[issue/46]: https://github.com/cloudflare/kv-asset-handler/issues/48
|
|
318
|
-
[pull/47]: https://github.com/cloudflare/kv-asset-handler/pull/52
|
|
319
|
-
|
|
320
|
-
## 0.0.6
|
|
321
|
-
|
|
322
|
-
- ### Fixes
|
|
323
|
-
|
|
324
|
-
- **Improve caching - [victoriabernard92], [issue/38] [pull/37]**
|
|
325
|
-
|
|
326
|
-
- Don't use browser cache by default: Previously, `kv-asset-handler` would set a `Cache-Control` header on the response sent back from the Worker to the client. After this fix, the `Cache-Control` header will only be set if `options.cacheControl.browserTTL` is set by the caller.
|
|
327
|
-
|
|
328
|
-
- Set default edge caching to 2 days: Previously the default cache time for static assets was 100 days. This PR sets the default to 2 days. This can be overridden with `options.cacheControl.edgeTTL`.
|
|
329
|
-
|
|
330
|
-
[victoriabernard92]: https://github.com/victoriabernard92
|
|
331
|
-
[issue/38]: https://github.com/cloudflare/kv-asset-handler/issues/38
|
|
332
|
-
[pull/37]: https://github.com/cloudflare/kv-asset-handler/pull/37
|