@astrojs/cloudflare 10.0.0 → 10.0.1

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.
Files changed (2) hide show
  1. package/dist/index.js +23 -9
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -88,14 +88,6 @@ export default function createIntegration(args) {
88
88
  find: 'react-dom/server',
89
89
  replacement: 'react-dom/server.browser',
90
90
  },
91
- {
92
- find: 'solid-js/web',
93
- replacement: 'solid-js/web/dist/server',
94
- },
95
- {
96
- find: 'solid-js',
97
- replacement: 'solid-js/dist/server',
98
- },
99
91
  ];
100
92
  if (Array.isArray(vite.resolve.alias)) {
101
93
  vite.resolve.alias = [...vite.resolve.alias, ...aliases];
@@ -105,10 +97,23 @@ export default function createIntegration(args) {
105
97
  vite.resolve.alias[alias.find] = alias.replacement;
106
98
  }
107
99
  }
100
+ vite.resolve.conditions ||= [];
101
+ // We need those conditions, previous these conditions where applied at the esbuild step which we removed
102
+ // https://github.com/withastro/astro/pull/7092
103
+ vite.resolve.conditions.push('workerd', 'worker');
108
104
  vite.ssr ||= {};
109
105
  vite.ssr.target = 'webworker';
110
106
  vite.ssr.noExternal = true;
111
- vite.ssr.external = _config.vite.ssr?.external ?? [];
107
+ if (typeof _config.vite.ssr?.external === 'undefined')
108
+ vite.ssr.external = [];
109
+ if (typeof _config.vite.ssr?.external === 'boolean')
110
+ vite.ssr.external = _config.vite.ssr?.external;
111
+ if (Array.isArray(_config.vite.ssr?.external))
112
+ // `@astrojs/vue` sets `@vue/server-renderer` to external
113
+ // https://github.com/withastro/astro/blob/e648c5575a8774af739231cfa9fc27a32086aa5f/packages/integrations/vue/src/index.ts#L119
114
+ // the cloudflare adapter needs to get all dependencies inlined, we use `noExternal` for that, but any `external` config overrides that
115
+ // therefore we need to remove `@vue/server-renderer` from the external config again
116
+ vite.ssr.external = _config.vite.ssr?.external.filter((entry) => entry !== '@vue/server-renderer');
112
117
  vite.build ||= {};
113
118
  vite.build.rollupOptions ||= {};
114
119
  vite.build.rollupOptions.output ||= {};
@@ -123,6 +128,15 @@ export default function createIntegration(args) {
123
128
  ...vite.define,
124
129
  };
125
130
  }
131
+ // we thought that vite config inside `if (target === 'server')` would not apply for client
132
+ // but it seems like the same `vite` reference is used for both
133
+ // so we need to reset the previous conflicting setting
134
+ // in the future we should look into a more robust solution
135
+ if (target === 'client') {
136
+ vite.resolve ||= {};
137
+ vite.resolve.conditions ||= [];
138
+ vite.resolve.conditions = vite.resolve.conditions.filter((c) => c !== 'workerd' && c !== 'worker');
139
+ }
126
140
  },
127
141
  'astro:build:done': async ({ pages, routes, dir, logger }) => {
128
142
  const PLATFORM_FILES = ['_headers', '_redirects', '_routes.json'];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@astrojs/cloudflare",
3
3
  "description": "Deploy your site to Cloudflare Workers/Pages",
4
- "version": "10.0.0",
4
+ "version": "10.0.1",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",
7
7
  "author": "withastro",
@@ -35,7 +35,7 @@
35
35
  "miniflare": "^3.20240320.0",
36
36
  "esbuild": "^0.19.5",
37
37
  "tiny-glob": "^0.2.9",
38
- "wrangler": "^3.36.0"
38
+ "wrangler": "^3.39.0"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "astro": "^4.2.0"
@@ -46,8 +46,8 @@
46
46
  "strip-ansi": "^7.1.0",
47
47
  "astro": "^4.5.8",
48
48
  "cheerio": "1.0.0-rc.12",
49
- "@astrojs/test-utils": "0.0.1",
50
- "astro-scripts": "0.0.14"
49
+ "astro-scripts": "0.0.14",
50
+ "@astrojs/test-utils": "0.0.1"
51
51
  },
52
52
  "publishConfig": {
53
53
  "provenance": true