@astrojs/cloudflare 1.0.2 → 2.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 d70be9427369f04f
2
- @astrojs/cloudflare:build: 
3
- @astrojs/cloudflare:build: > @astrojs/cloudflare@1.0.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 77d2b45b1cd7ea2d
2
+ @astrojs/cloudflare:build: 
3
+ @astrojs/cloudflare:build: > @astrojs/cloudflare@2.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,11 @@
1
1
  # @astrojs/cloudflare
2
2
 
3
+ ## 2.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [#4815](https://github.com/withastro/astro/pull/4815) [`ce0b92ba7`](https://github.com/withastro/astro/commit/ce0b92ba73072c0f0143829a53f870155ad4c7ff) Thanks [@AirBorne04](https://github.com/AirBorne04)! - adjusted esbuild config to work with worker environment (fixing solid js ssr)
8
+
3
9
  ## 1.0.2
4
10
 
5
11
  ### Patch Changes
package/README.md CHANGED
@@ -2,9 +2,25 @@
2
2
 
3
3
  An SSR adapter for use with Cloudflare Pages Functions targets. Write your code in Astro/Javascript and deploy to Cloudflare Pages.
4
4
 
5
- In your `astro.config.mjs` use:
5
+ ## Install
6
6
 
7
- ```js
7
+ Add the Cloudflare adapter to enable SSR in your Astro project with the following `astro add` command. This will install the adapter and make the appropriate changes to your `astro.config.mjs` file in one step.
8
+
9
+ ```bash
10
+ npx astro add cloudflare
11
+ ```
12
+
13
+ If you prefer to install the adapter manually instead, complete the following two steps:
14
+
15
+ 1. Add the Cloudflare adapter to your project's dependencies using your preferred package manager. If you’re using npm or aren’t sure, run this in the terminal:
16
+
17
+ ```bash
18
+ npm install @astrojs/cloudflare
19
+ ```
20
+
21
+ 2. Add the following to your `astro.config.mjs` file:
22
+
23
+ ```js title="astro.config.mjs" ins={2, 5-6}
8
24
  import { defineConfig } from 'astro/config';
9
25
  import cloudflare from '@astrojs/cloudflare';
10
26
 
package/dist/index.js CHANGED
@@ -52,8 +52,8 @@ function createIntegration(args) {
52
52
  }
53
53
  }
54
54
  vite.ssr = {
55
- target: "webworker",
56
- noExternal: true
55
+ ...vite.ssr,
56
+ target: "webworker"
57
57
  };
58
58
  }
59
59
  },
@@ -62,7 +62,9 @@ function createIntegration(args) {
62
62
  const pkg = fileURLToPath(entryUrl);
63
63
  await esbuild.build({
64
64
  target: "es2020",
65
- platform: "browser",
65
+ platform: "neutral",
66
+ mainFields: ["main", "module"],
67
+ conditions: ["worker", "node"],
66
68
  entryPoints: [pkg],
67
69
  outfile: pkg,
68
70
  allowOverwrite: true,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@astrojs/cloudflare",
3
3
  "description": "Deploy your site to cloudflare pages functions",
4
- "version": "1.0.2",
4
+ "version": "2.0.0",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",
7
7
  "author": "withastro",
@@ -27,7 +27,7 @@
27
27
  "esbuild": "^0.14.42"
28
28
  },
29
29
  "devDependencies": {
30
- "astro": "1.1.3",
30
+ "astro": "1.2.8",
31
31
  "astro-scripts": "0.0.7",
32
32
  "wrangler": "^2.0.23"
33
33
  },
package/src/index.ts CHANGED
@@ -67,8 +67,8 @@ export default function createIntegration(args?: Options): AstroIntegration {
67
67
  }
68
68
 
69
69
  vite.ssr = {
70
+ ...vite.ssr,
70
71
  target: 'webworker',
71
- noExternal: true,
72
72
  };
73
73
  }
74
74
  },
@@ -77,7 +77,9 @@ export default function createIntegration(args?: Options): AstroIntegration {
77
77
  const pkg = fileURLToPath(entryUrl);
78
78
  await esbuild.build({
79
79
  target: 'es2020',
80
- platform: 'browser',
80
+ platform: 'neutral',
81
+ mainFields: ['main', 'module'],
82
+ conditions: ['worker', 'node'],
81
83
  entryPoints: [pkg],
82
84
  outfile: pkg,
83
85
  allowOverwrite: true,