@astrojs/cloudflare 13.5.2 → 13.5.3
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.
|
@@ -88,7 +88,7 @@ function serverStart({
|
|
|
88
88
|
host,
|
|
89
89
|
base
|
|
90
90
|
}) {
|
|
91
|
-
const version = "13.5.
|
|
91
|
+
const version = "13.5.3";
|
|
92
92
|
const localPrefix = `${colors.dim("\u2503")} Local `;
|
|
93
93
|
const networkPrefix = `${colors.dim("\u2503")} Network `;
|
|
94
94
|
const emptyPrefix = " ".repeat(11);
|
|
@@ -4,12 +4,6 @@ type ESBuildPlugin = NonNullable<NonNullable<DepOptimizationConfig['esbuildOptio
|
|
|
4
4
|
* An esbuild plugin that extracts frontmatter from .astro files during
|
|
5
5
|
* dependency optimization scanning. This allows Vite to discover imports
|
|
6
6
|
* in the server-side frontmatter code.
|
|
7
|
-
*
|
|
8
|
-
* This plugin uses an `onResolve` handler to intercept `.astro` files before
|
|
9
|
-
* Vite's built-in `vite:dep-scan` plugin routes them to the `html` namespace.
|
|
10
|
-
* Without this, Vite's scanner only extracts `<script>` tags from `.astro`
|
|
11
|
-
* files, completely missing frontmatter imports (which is where SSR-side
|
|
12
|
-
* dependencies like `zod`, `nanostores`, `astro:transitions`, etc. live).
|
|
13
7
|
*/
|
|
14
8
|
export declare function astroFrontmatterScanPlugin(): ESBuildPlugin;
|
|
15
9
|
export {};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
|
-
import { dirname, isAbsolute, resolve } from "node:path";
|
|
3
2
|
const FRONTMATTER_RE = /^---\r?\n([\s\S]*?)\r?\n---/;
|
|
4
3
|
const RETURN_REPLACE_RE = /(\/\/[^\n]*|\/\*[\s\S]*?\*\/|`(?:[^`\\]|\\.)*`|"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')|(?<!\.)\breturn(\s*;|\b)/g;
|
|
5
4
|
function replaceTopLevelReturns(code) {
|
|
@@ -8,19 +7,11 @@ function replaceTopLevelReturns(code) {
|
|
|
8
7
|
return tail.trim() === ";" ? "throw 0;" : "throw ";
|
|
9
8
|
});
|
|
10
9
|
}
|
|
11
|
-
const ASTRO_FRONTMATTER_NAMESPACE = "astro-frontmatter";
|
|
12
10
|
function astroFrontmatterScanPlugin() {
|
|
13
11
|
return {
|
|
14
12
|
name: "astro-frontmatter-scan",
|
|
15
13
|
setup(build) {
|
|
16
|
-
build.
|
|
17
|
-
if (args.namespace !== "file" && args.namespace !== "" && args.namespace !== void 0) {
|
|
18
|
-
return void 0;
|
|
19
|
-
}
|
|
20
|
-
const resolvedPath = isAbsolute(args.path) ? args.path : resolve(args.resolveDir, args.path);
|
|
21
|
-
return { path: resolvedPath, namespace: ASTRO_FRONTMATTER_NAMESPACE };
|
|
22
|
-
});
|
|
23
|
-
build.onLoad({ filter: /\.astro$/, namespace: ASTRO_FRONTMATTER_NAMESPACE }, async (args) => {
|
|
14
|
+
build.onLoad({ filter: /\.astro$/, namespace: "file" }, async (args) => {
|
|
24
15
|
try {
|
|
25
16
|
const code = await readFile(args.path, "utf-8");
|
|
26
17
|
const frontmatterMatch = FRONTMATTER_RE.exec(code);
|
|
@@ -28,16 +19,14 @@ function astroFrontmatterScanPlugin() {
|
|
|
28
19
|
const contents = replaceTopLevelReturns(frontmatterMatch[1]);
|
|
29
20
|
return {
|
|
30
21
|
contents: contents + "\nexport default {}",
|
|
31
|
-
loader: "ts"
|
|
32
|
-
resolveDir: dirname(args.path)
|
|
22
|
+
loader: "ts"
|
|
33
23
|
};
|
|
34
24
|
}
|
|
35
25
|
} catch {
|
|
36
26
|
}
|
|
37
27
|
return {
|
|
38
28
|
contents: "export default {}",
|
|
39
|
-
loader: "ts"
|
|
40
|
-
resolveDir: dirname(args.path)
|
|
29
|
+
loader: "ts"
|
|
41
30
|
};
|
|
42
31
|
});
|
|
43
32
|
}
|
package/dist/index.js
CHANGED
|
@@ -195,11 +195,6 @@ function createIntegration({
|
|
|
195
195
|
"astro/jsx-runtime",
|
|
196
196
|
"astro/app/entrypoint/dev",
|
|
197
197
|
"astro/virtual-modules/middleware.js",
|
|
198
|
-
"astro/virtual-modules/transitions.js",
|
|
199
|
-
"astro/virtual-modules/transitions-router.js",
|
|
200
|
-
"astro/virtual-modules/transitions-types.js",
|
|
201
|
-
"astro/virtual-modules/transitions-events.js",
|
|
202
|
-
"astro/virtual-modules/transitions-swap-functions.js",
|
|
203
198
|
...isAstroPrismPackageInstalled ? prismFiles : []
|
|
204
199
|
],
|
|
205
200
|
exclude: [
|
|
@@ -210,7 +205,6 @@ function createIntegration({
|
|
|
210
205
|
"virtual:@astrojs/*",
|
|
211
206
|
"@astrojs/starlight"
|
|
212
207
|
],
|
|
213
|
-
ignoreOutdatedRequests: true,
|
|
214
208
|
esbuildOptions: {
|
|
215
209
|
// Suppress Vite's `createRequire(import.meta.url)` banner to work around
|
|
216
210
|
// https://github.com/vitejs/vite/issues/22004 — Vite's SSR transform
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrojs/cloudflare",
|
|
3
3
|
"description": "Deploy your site to Cloudflare Workers",
|
|
4
|
-
"version": "13.5.
|
|
4
|
+
"version": "13.5.3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"author": "withastro",
|
|
@@ -48,12 +48,12 @@
|
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@cloudflare/workers-types": "^4.20260228.0",
|
|
51
|
-
"@types/node": "^
|
|
51
|
+
"@types/node": "^22.10.6",
|
|
52
52
|
"@types/prismjs": "1.26.6",
|
|
53
53
|
"cheerio": "1.2.0",
|
|
54
54
|
"devalue": "^5.6.3",
|
|
55
55
|
"prismjs": "^1.30.0",
|
|
56
|
-
"astro": "6.3.
|
|
56
|
+
"astro": "6.3.6",
|
|
57
57
|
"astro-scripts": "0.0.14"
|
|
58
58
|
},
|
|
59
59
|
"publishConfig": {
|