@astrojs/cloudflare 3.1.2 → 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.
@@ -1,5 +1,5 @@
1
- @astrojs/cloudflare:build: cache hit, replaying output 8f63fdc483fc35de
2
- @astrojs/cloudflare:build: 
3
- @astrojs/cloudflare:build: > @astrojs/cloudflare@3.1.2 build /home/runner/work/astro/astro/packages/integrations/cloudflare
4
- @astrojs/cloudflare:build: > astro-scripts build "src/**/*.ts" && tsc
5
- @astrojs/cloudflare:build: 
1
+ @astrojs/cloudflare:build: cache hit, replaying output 90a638f6bf8ef71a
2
+ @astrojs/cloudflare:build: 
3
+ @astrojs/cloudflare:build: > @astrojs/cloudflare@4.0.0 build /home/runner/work/astro/astro/packages/integrations/cloudflare
4
+ @astrojs/cloudflare:build: > astro-scripts build "src/**/*.ts" && tsc
5
+ @astrojs/cloudflare:build: 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
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
+
3
18
  ## 3.1.2
4
19
 
5
20
  ### 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 sufficiant, when in this mode the `dist` folder will contain your compiled project. However if you'd like to use [pages plugins](https://developers.cloudflare.com/pages/platform/functions/plugins/) such as [Sentry](https://developers.cloudflare.com/pages/platform/functions/plugins/sentry/) for example to enable logging, you'll need to use directory mode.
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 it will move 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.
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
@@ -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${pathname}`, request);
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 });
@@ -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${pathname}`, request);
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": "3.1.2",
4
+ "version": "4.0.0",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",
7
7
  "author": "withastro",
@@ -30,9 +30,12 @@
30
30
  "dependencies": {
31
31
  "esbuild": "^0.14.42"
32
32
  },
33
+ "peerDependencies": {
34
+ "astro": "^1.6.4"
35
+ },
33
36
  "devDependencies": {
34
- "astro": "1.6.1",
35
- "astro-scripts": "0.0.8",
37
+ "astro": "1.6.4",
38
+ "astro-scripts": "0.0.9",
36
39
  "chai": "^4.3.6",
37
40
  "cheerio": "^1.0.0-rc.11",
38
41
  "mocha": "^9.2.2",
@@ -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${pathname}`, request);
19
+ const assetRequest = new Request(`${origin}/static/${app.removeBase(pathname)}`, request);
20
20
  return env.ASSETS.fetch(assetRequest);
21
21
  }
22
22
 
@@ -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${pathname}`, request);
20
+ const assetRequest = new Request(`${origin}/static/${app.removeBase(pathname)}`, request);
21
21
  return next(assetRequest);
22
22
  }
23
23