wrangler 0.0.0-e6733a3 → 0.0.0-e6ada079

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.

Potentially problematic release.


This version of wrangler might be problematic. Click here for more details.

Files changed (119) hide show
  1. package/README.md +47 -16
  2. package/bin/wrangler.js +94 -31
  3. package/config-schema.json +3100 -0
  4. package/kv-asset-handler.js +1 -0
  5. package/package.json +154 -82
  6. package/templates/__tests__/pages-dev-util.test.ts +128 -0
  7. package/templates/__tests__/tsconfig-sanity.ts +12 -0
  8. package/templates/__tests__/tsconfig.json +8 -0
  9. package/templates/checked-fetch.js +30 -0
  10. package/templates/facade.d.ts +19 -0
  11. package/templates/gitignore +170 -0
  12. package/templates/init-tests/test-jest-new-worker.js +23 -0
  13. package/templates/init-tests/test-vitest-new-worker.js +24 -0
  14. package/templates/init-tests/test-vitest-new-worker.ts +25 -0
  15. package/templates/middleware/common.ts +67 -0
  16. package/templates/middleware/loader-modules.ts +134 -0
  17. package/templates/middleware/loader-sw.ts +229 -0
  18. package/templates/middleware/middleware-ensure-req-body-drained.ts +18 -0
  19. package/templates/middleware/middleware-miniflare3-json-error.ts +32 -0
  20. package/templates/middleware/middleware-pretty-error.ts +40 -0
  21. package/templates/middleware/middleware-scheduled.ts +15 -0
  22. package/templates/middleware/middleware-serve-static-assets.d.ts +6 -0
  23. package/templates/middleware/middleware-serve-static-assets.ts +56 -0
  24. package/templates/modules-watch-stub.js +4 -0
  25. package/templates/new-worker-scheduled.js +17 -0
  26. package/templates/new-worker-scheduled.ts +32 -0
  27. package/templates/new-worker.js +15 -0
  28. package/templates/new-worker.ts +33 -0
  29. package/templates/no-op-worker.js +10 -0
  30. package/templates/pages-dev-pipeline.ts +32 -0
  31. package/templates/pages-dev-util.ts +55 -0
  32. package/templates/pages-shim.ts +9 -0
  33. package/templates/pages-template-plugin.ts +190 -0
  34. package/templates/pages-template-worker.ts +198 -0
  35. package/templates/startDevWorker/InspectorProxyWorker.ts +664 -0
  36. package/templates/startDevWorker/ProxyWorker.ts +334 -0
  37. package/templates/tsconfig-sanity.ts +11 -0
  38. package/templates/tsconfig.init.json +22 -0
  39. package/templates/tsconfig.json +8 -0
  40. package/wrangler-dist/InspectorProxyWorker.js +464 -0
  41. package/wrangler-dist/InspectorProxyWorker.js.map +6 -0
  42. package/wrangler-dist/ProxyWorker.js +240 -0
  43. package/wrangler-dist/ProxyWorker.js.map +6 -0
  44. package/wrangler-dist/cli.d.ts +26391 -0
  45. package/wrangler-dist/cli.js +204293 -116652
  46. package/wrangler-dist/wasm-sync.wasm +0 -0
  47. package/import_meta_url.js +0 -3
  48. package/miniflare-config-stubs/.env.empty +0 -0
  49. package/miniflare-config-stubs/package.empty.json +0 -1
  50. package/miniflare-config-stubs/wrangler.empty.toml +0 -0
  51. package/pages/functions/buildWorker.ts +0 -62
  52. package/pages/functions/filepath-routing.test.ts +0 -39
  53. package/pages/functions/filepath-routing.ts +0 -221
  54. package/pages/functions/identifiers.ts +0 -78
  55. package/pages/functions/routes.ts +0 -158
  56. package/pages/functions/template-worker.ts +0 -144
  57. package/src/__tests__/clipboardy-mock.js +0 -4
  58. package/src/__tests__/dev.test.tsx +0 -66
  59. package/src/__tests__/index.test.ts +0 -287
  60. package/src/__tests__/jest.setup.ts +0 -22
  61. package/src/__tests__/kv.test.ts +0 -1098
  62. package/src/__tests__/mock-cfetch.ts +0 -171
  63. package/src/__tests__/mock-dialogs.ts +0 -65
  64. package/src/__tests__/run-in-tmp.ts +0 -19
  65. package/src/__tests__/run-wrangler.ts +0 -32
  66. package/src/api/form_data.ts +0 -131
  67. package/src/api/preview.ts +0 -128
  68. package/src/api/worker.ts +0 -155
  69. package/src/cfetch/index.ts +0 -102
  70. package/src/cfetch/internal.ts +0 -69
  71. package/src/cli.ts +0 -9
  72. package/src/config.ts +0 -487
  73. package/src/dev.tsx +0 -771
  74. package/src/dialogs.tsx +0 -77
  75. package/src/index.tsx +0 -1974
  76. package/src/inspect.ts +0 -524
  77. package/src/kv.tsx +0 -267
  78. package/src/module-collection.ts +0 -64
  79. package/src/pages.tsx +0 -1031
  80. package/src/proxy.ts +0 -294
  81. package/src/publish.ts +0 -358
  82. package/src/sites.tsx +0 -114
  83. package/src/tail.tsx +0 -73
  84. package/src/user.tsx +0 -1025
  85. package/static-asset-facade.js +0 -47
  86. package/vendor/@cloudflare/kv-asset-handler/CHANGELOG.md +0 -332
  87. package/vendor/@cloudflare/kv-asset-handler/LICENSE_APACHE +0 -176
  88. package/vendor/@cloudflare/kv-asset-handler/LICENSE_MIT +0 -25
  89. package/vendor/@cloudflare/kv-asset-handler/README.md +0 -245
  90. package/vendor/@cloudflare/kv-asset-handler/dist/index.d.ts +0 -32
  91. package/vendor/@cloudflare/kv-asset-handler/dist/index.js +0 -354
  92. package/vendor/@cloudflare/kv-asset-handler/dist/mocks.d.ts +0 -13
  93. package/vendor/@cloudflare/kv-asset-handler/dist/mocks.js +0 -148
  94. package/vendor/@cloudflare/kv-asset-handler/dist/test/getAssetFromKV.d.ts +0 -1
  95. package/vendor/@cloudflare/kv-asset-handler/dist/test/getAssetFromKV.js +0 -436
  96. package/vendor/@cloudflare/kv-asset-handler/dist/test/mapRequestToAsset.d.ts +0 -1
  97. package/vendor/@cloudflare/kv-asset-handler/dist/test/mapRequestToAsset.js +0 -40
  98. package/vendor/@cloudflare/kv-asset-handler/dist/test/serveSinglePageApp.d.ts +0 -1
  99. package/vendor/@cloudflare/kv-asset-handler/dist/test/serveSinglePageApp.js +0 -42
  100. package/vendor/@cloudflare/kv-asset-handler/dist/types.d.ts +0 -26
  101. package/vendor/@cloudflare/kv-asset-handler/dist/types.js +0 -31
  102. package/vendor/@cloudflare/kv-asset-handler/package.json +0 -52
  103. package/vendor/@cloudflare/kv-asset-handler/src/index.ts +0 -296
  104. package/vendor/@cloudflare/kv-asset-handler/src/mocks.ts +0 -136
  105. package/vendor/@cloudflare/kv-asset-handler/src/test/getAssetFromKV.ts +0 -464
  106. package/vendor/@cloudflare/kv-asset-handler/src/test/mapRequestToAsset.ts +0 -33
  107. package/vendor/@cloudflare/kv-asset-handler/src/test/serveSinglePageApp.ts +0 -42
  108. package/vendor/@cloudflare/kv-asset-handler/src/types.ts +0 -39
  109. package/vendor/wrangler-mime/CHANGELOG.md +0 -289
  110. package/vendor/wrangler-mime/LICENSE +0 -21
  111. package/vendor/wrangler-mime/Mime.js +0 -97
  112. package/vendor/wrangler-mime/README.md +0 -187
  113. package/vendor/wrangler-mime/cli.js +0 -46
  114. package/vendor/wrangler-mime/index.js +0 -4
  115. package/vendor/wrangler-mime/lite.js +0 -4
  116. package/vendor/wrangler-mime/package.json +0 -52
  117. package/vendor/wrangler-mime/types/other.js +0 -1
  118. package/vendor/wrangler-mime/types/standard.js +0 -1
  119. package/wrangler-dist/cli.js.map +0 -7
@@ -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
@@ -1,176 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
@@ -1,25 +0,0 @@
1
- Copyright (c) 2018 Ashley Williams <ashley666ashley@gmail.com>
2
-
3
- Permission is hereby granted, free of charge, to any
4
- person obtaining a copy of this software and associated
5
- documentation files (the "Software"), to deal in the
6
- Software without restriction, including without
7
- limitation the rights to use, copy, modify, merge,
8
- publish, distribute, sublicense, and/or sell copies of
9
- the Software, and to permit persons to whom the Software
10
- is furnished to do so, subject to the following
11
- conditions:
12
-
13
- The above copyright notice and this permission notice
14
- shall be included in all copies or substantial portions
15
- of the Software.
16
-
17
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
18
- ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
19
- TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
20
- PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
21
- SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
24
- IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25
- DEALINGS IN THE SOFTWARE.