@astrojs/cloudflare 3.1.1 → 4.0.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/.turbo/turbo-build.log +5 -5
- package/CHANGELOG.md +21 -0
- package/README.md +3 -3
- package/dist/server.advanced.js +1 -1
- package/dist/server.directory.js +1 -1
- package/package.json +10 -4
- package/runtime.d.ts +3 -0
- package/src/server.advanced.ts +1 -1
- package/src/server.directory.ts +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
[
|
|
2
|
-
[
|
|
3
|
-
[
|
|
4
|
-
[
|
|
5
|
-
[
|
|
1
|
+
[34m@astrojs/cloudflare:build: [0mcache hit, replaying output [2m90a638f6bf8ef71a[0m
|
|
2
|
+
[34m@astrojs/cloudflare:build: [0m
|
|
3
|
+
[34m@astrojs/cloudflare:build: [0m> @astrojs/cloudflare@4.0.0 build /home/runner/work/astro/astro/packages/integrations/cloudflare
|
|
4
|
+
[34m@astrojs/cloudflare:build: [0m> astro-scripts build "src/**/*.ts" && tsc
|
|
5
|
+
[34m@astrojs/cloudflare:build: [0m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @astrojs/cloudflare
|
|
2
2
|
|
|
3
|
+
## 4.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#5290](https://github.com/withastro/astro/pull/5290) [`b2b291d29`](https://github.com/withastro/astro/commit/b2b291d29143703cece0d12c8e74b2e1151d2061) Thanks [@matthewp](https://github.com/matthewp)! - Handle base configuration in adapters
|
|
8
|
+
|
|
9
|
+
This allows adapters to correctly handle `base` configuration. Internally Astro now matches routes when the URL includes the `base`.
|
|
10
|
+
|
|
11
|
+
Adapters now also have access to the `removeBase` method which will remove the `base` from a pathname. This is useful to look up files for static assets.
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [[`b2b291d29`](https://github.com/withastro/astro/commit/b2b291d29143703cece0d12c8e74b2e1151d2061), [`97e2b6ad7`](https://github.com/withastro/astro/commit/97e2b6ad7a6fa23e82be28b2f57cdf3f85fab112), [`4af4d8fa0`](https://github.com/withastro/astro/commit/4af4d8fa0035130fbf31c82d72777c3679bc1ca5), [`f6add3924`](https://github.com/withastro/astro/commit/f6add3924d5cd59925a6ea4bf7f2f731709bc893), [`247eb7411`](https://github.com/withastro/astro/commit/247eb7411f429317e5cd7d401a6660ee73641313)]:
|
|
16
|
+
- astro@1.6.4
|
|
17
|
+
|
|
18
|
+
## 3.1.2
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- [#5230](https://github.com/withastro/astro/pull/5230) [`69a532ab6`](https://github.com/withastro/astro/commit/69a532ab60a85d30c2395969593c4d38f9a2fbbe) Thanks [@matthewp](https://github.com/matthewp)! - Exports new runtime entrypoint's types
|
|
23
|
+
|
|
3
24
|
## 3.1.1
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -46,9 +46,9 @@ default `"advanced"`
|
|
|
46
46
|
|
|
47
47
|
Cloudflare Pages has 2 different modes for deploying functions, `advanced` mode which picks up the `_worker.js` in `dist`, or a directory mode where pages will compile the worker out of a functions folder in the project root.
|
|
48
48
|
|
|
49
|
-
For most projects the adaptor default of `advanced` will be
|
|
49
|
+
For most projects the adaptor default of `advanced` will be sufficient; the `dist` folder will contain your compiled project. Switching to directory mode allows you to use [pages plugins](https://developers.cloudflare.com/pages/platform/functions/plugins/) such as [Sentry](https://developers.cloudflare.com/pages/platform/functions/plugins/sentry/) or write custom code to enable logging.
|
|
50
50
|
|
|
51
|
-
In directory mode the adaptor will compile the client side part of you app the same way, but
|
|
51
|
+
In directory mode the adaptor will compile the client side part of you app the same way, but moves the worker script into a `functions` folder in the project root. The adaptor will only ever place a `[[path]].js` in that folder, allowing you to add additional plugins and pages middleware which can be checked into version control. Cloudflare documentation contains more information about [writing custom functions](https://developers.cloudflare.com/pages/platform/functions/).
|
|
52
52
|
|
|
53
53
|
```ts
|
|
54
54
|
// directory mode
|
|
@@ -72,7 +72,7 @@ It's then possible to update the preview script in your `package.json` to `"prev
|
|
|
72
72
|
|
|
73
73
|
You can access all the Cloudflare bindings and environment variables from Astro components and API routes through the adapter API.
|
|
74
74
|
|
|
75
|
-
```
|
|
75
|
+
```js
|
|
76
76
|
import { getRuntime } from "@astrojs/cloudflare/runtime";
|
|
77
77
|
|
|
78
78
|
getRuntime(Astro.request);
|
package/dist/server.advanced.js
CHANGED
|
@@ -5,7 +5,7 @@ function createExports(manifest) {
|
|
|
5
5
|
const fetch = async (request, env, context) => {
|
|
6
6
|
const { origin, pathname } = new URL(request.url);
|
|
7
7
|
if (manifest.assets.has(pathname)) {
|
|
8
|
-
const assetRequest = new Request(`${origin}/static
|
|
8
|
+
const assetRequest = new Request(`${origin}/static/${app.removeBase(pathname)}`, request);
|
|
9
9
|
return env.ASSETS.fetch(assetRequest);
|
|
10
10
|
}
|
|
11
11
|
let routeData = app.match(request, { matchNotFound: true });
|
package/dist/server.directory.js
CHANGED
|
@@ -9,7 +9,7 @@ function createExports(manifest) {
|
|
|
9
9
|
}) => {
|
|
10
10
|
const { origin, pathname } = new URL(request.url);
|
|
11
11
|
if (manifest.assets.has(pathname)) {
|
|
12
|
-
const assetRequest = new Request(`${origin}/static
|
|
12
|
+
const assetRequest = new Request(`${origin}/static/${app.removeBase(pathname)}`, request);
|
|
13
13
|
return next(assetRequest);
|
|
14
14
|
}
|
|
15
15
|
let routeData = app.match(request, { matchNotFound: true });
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrojs/cloudflare",
|
|
3
3
|
"description": "Deploy your site to cloudflare workers or cloudflare pages",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "4.0.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"author": "withastro",
|
|
@@ -19,7 +19,10 @@
|
|
|
19
19
|
"homepage": "https://docs.astro.build/en/guides/integrations-guide/cloudflare/",
|
|
20
20
|
"exports": {
|
|
21
21
|
".": "./dist/index.js",
|
|
22
|
-
"./runtime":
|
|
22
|
+
"./runtime": {
|
|
23
|
+
"types": "./runtime.d.ts",
|
|
24
|
+
"default": "./dist/runtime.js"
|
|
25
|
+
},
|
|
23
26
|
"./server.advanced.js": "./dist/server.advanced.js",
|
|
24
27
|
"./server.directory.js": "./dist/server.directory.js",
|
|
25
28
|
"./package.json": "./package.json"
|
|
@@ -27,9 +30,12 @@
|
|
|
27
30
|
"dependencies": {
|
|
28
31
|
"esbuild": "^0.14.42"
|
|
29
32
|
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"astro": "^1.6.4"
|
|
35
|
+
},
|
|
30
36
|
"devDependencies": {
|
|
31
|
-
"astro": "1.6.
|
|
32
|
-
"astro-scripts": "0.0.
|
|
37
|
+
"astro": "1.6.4",
|
|
38
|
+
"astro-scripts": "0.0.9",
|
|
33
39
|
"chai": "^4.3.6",
|
|
34
40
|
"cheerio": "^1.0.0-rc.11",
|
|
35
41
|
"mocha": "^9.2.2",
|
package/runtime.d.ts
ADDED
package/src/server.advanced.ts
CHANGED
|
@@ -16,7 +16,7 @@ export function createExports(manifest: SSRManifest) {
|
|
|
16
16
|
|
|
17
17
|
// static assets
|
|
18
18
|
if (manifest.assets.has(pathname)) {
|
|
19
|
-
const assetRequest = new Request(`${origin}/static
|
|
19
|
+
const assetRequest = new Request(`${origin}/static/${app.removeBase(pathname)}`, request);
|
|
20
20
|
return env.ASSETS.fetch(assetRequest);
|
|
21
21
|
}
|
|
22
22
|
|
package/src/server.directory.ts
CHANGED
|
@@ -17,7 +17,7 @@ export function createExports(manifest: SSRManifest) {
|
|
|
17
17
|
const { origin, pathname } = new URL(request.url);
|
|
18
18
|
// static assets
|
|
19
19
|
if (manifest.assets.has(pathname)) {
|
|
20
|
-
const assetRequest = new Request(`${origin}/static
|
|
20
|
+
const assetRequest = new Request(`${origin}/static/${app.removeBase(pathname)}`, request);
|
|
21
21
|
return next(assetRequest);
|
|
22
22
|
}
|
|
23
23
|
|