@astrojs/cloudflare 10.4.0 → 10.4.2
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/dist/entrypoints/server.js +0 -4
- package/dist/index.js +0 -11
- package/package.json +2 -2
- package/dist/utils/env.d.ts +0 -2
- package/dist/utils/env.js +0 -11
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { App } from 'astro/app';
|
|
2
|
-
import { createGetEnv } from '../utils/env.js';
|
|
3
2
|
export function createExports(manifest) {
|
|
4
3
|
const app = new App(manifest);
|
|
5
4
|
const fetch = async (request, env, context) => {
|
|
@@ -33,9 +32,6 @@ export function createExports(manifest) {
|
|
|
33
32
|
},
|
|
34
33
|
},
|
|
35
34
|
};
|
|
36
|
-
// Won't throw if the virtual module is not available because it's not supported in
|
|
37
|
-
// the users's astro version or if astro:env is not enabled in the project
|
|
38
|
-
await import('astro/env/setup').then((mod) => mod.setGetEnv(createGetEnv(env))).catch(() => { });
|
|
39
35
|
const response = await app.render(request, { routeData, locals });
|
|
40
36
|
if (app.setCookieHeaders) {
|
|
41
37
|
for (const setCookieHeader of app.setCookieHeaders(response)) {
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,6 @@ import { walk } from 'estree-walker';
|
|
|
8
8
|
import MagicString from 'magic-string';
|
|
9
9
|
import { getPlatformProxy } from 'wrangler';
|
|
10
10
|
import { cloudflareModuleLoader, } from './utils/cloudflare-module-loader.js';
|
|
11
|
-
import { createGetEnv } from './utils/env.js';
|
|
12
11
|
import { createRoutesFile, getParts } from './utils/generate-routes-json.js';
|
|
13
12
|
import { setImageConfig } from './utils/image-config.js';
|
|
14
13
|
import { mutateDynamicPageImportsInPlace, mutatePageMapInPlace } from './utils/index.js';
|
|
@@ -108,7 +107,6 @@ export default function createIntegration(args) {
|
|
|
108
107
|
isSharpCompatible: false,
|
|
109
108
|
isSquooshCompatible: false,
|
|
110
109
|
},
|
|
111
|
-
envGetSecret: 'experimental',
|
|
112
110
|
},
|
|
113
111
|
});
|
|
114
112
|
},
|
|
@@ -119,15 +117,6 @@ export default function createIntegration(args) {
|
|
|
119
117
|
experimentalJsonConfig: args.platformProxy.experimentalJsonConfig ?? false,
|
|
120
118
|
persist: args.platformProxy.persist ?? true,
|
|
121
119
|
});
|
|
122
|
-
const getEnv = createGetEnv(platformProxy.env);
|
|
123
|
-
if (_config.experimental.env?.schema) {
|
|
124
|
-
for (const key of Object.keys(_config.experimental.env.schema)) {
|
|
125
|
-
const value = getEnv(key);
|
|
126
|
-
if (value !== undefined) {
|
|
127
|
-
process.env[key] = value;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
120
|
const clientLocalsSymbol = Symbol.for('astro.locals');
|
|
132
121
|
server.middlewares.use(async function middleware(req, res, next) {
|
|
133
122
|
Reflect.set(req, clientLocalsSymbol, {
|
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.4.
|
|
4
|
+
"version": "10.4.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"author": "withastro",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"fast-glob": "^3.3.2",
|
|
49
49
|
"rollup": "^4.14.0",
|
|
50
50
|
"strip-ansi": "^7.1.0",
|
|
51
|
-
"vite": "^5.2.
|
|
51
|
+
"vite": "^5.2.13",
|
|
52
52
|
"@astrojs/test-utils": "0.0.1",
|
|
53
53
|
"astro-scripts": "0.0.14"
|
|
54
54
|
},
|
package/dist/utils/env.d.ts
DELETED
package/dist/utils/env.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export const createGetEnv = (env) => (key) => {
|
|
2
|
-
const v = env[key];
|
|
3
|
-
if (typeof v === 'undefined' || typeof v === 'string') {
|
|
4
|
-
return v;
|
|
5
|
-
}
|
|
6
|
-
if (typeof v === 'boolean' || typeof v === 'number') {
|
|
7
|
-
// let astro:env handle the validation and transformation
|
|
8
|
-
return v.toString();
|
|
9
|
-
}
|
|
10
|
-
return undefined;
|
|
11
|
-
};
|