@astrojs/cloudflare 12.5.0 → 12.5.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/utils/assets.d.ts +1 -7
- package/dist/utils/assets.js +1 -10
- package/dist/utils/cloudflare-module-loader.d.ts +0 -1
- package/dist/utils/image-config.d.ts +2 -2
- package/package.json +4 -9
- package/dist/utils/non-server-chunk-detector.d.ts +0 -14
- package/dist/utils/non-server-chunk-detector.js +0 -52
package/dist/utils/assets.d.ts
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import type { AstroConfig, ImageMetadata
|
|
1
|
+
import type { AstroConfig, ImageMetadata } from 'astro';
|
|
2
2
|
export declare function isESMImportedImage(src: ImageMetadata | string): src is ImageMetadata;
|
|
3
|
-
export declare function matchHostname(url: URL, hostname?: string, allowWildcard?: boolean): boolean;
|
|
4
|
-
export declare function matchPort(url: URL, port?: string): boolean;
|
|
5
|
-
export declare function matchProtocol(url: URL, protocol?: string): boolean;
|
|
6
|
-
export declare function matchPathname(url: URL, pathname?: string, allowWildcard?: boolean): boolean;
|
|
7
|
-
export declare function matchPattern(url: URL, remotePattern: RemotePattern): boolean;
|
|
8
3
|
export declare function isRemoteAllowed(src: string, { domains, remotePatterns, }: Partial<Pick<AstroConfig['image'], 'domains' | 'remotePatterns'>>): boolean;
|
|
9
|
-
export declare function isString(path: unknown): path is string;
|
package/dist/utils/assets.js
CHANGED
|
@@ -55,16 +55,7 @@ function isRemoteAllowed(src, {
|
|
|
55
55
|
const url = new URL(src);
|
|
56
56
|
return domains.some((domain) => matchHostname(url, domain)) || remotePatterns.some((remotePattern) => matchPattern(url, remotePattern));
|
|
57
57
|
}
|
|
58
|
-
function isString(path) {
|
|
59
|
-
return typeof path === "string" || path instanceof String;
|
|
60
|
-
}
|
|
61
58
|
export {
|
|
62
59
|
isESMImportedImage,
|
|
63
|
-
isRemoteAllowed
|
|
64
|
-
isString,
|
|
65
|
-
matchHostname,
|
|
66
|
-
matchPathname,
|
|
67
|
-
matchPattern,
|
|
68
|
-
matchPort,
|
|
69
|
-
matchProtocol
|
|
60
|
+
isRemoteAllowed
|
|
70
61
|
};
|
|
@@ -3,7 +3,6 @@ import type { PluginOption } from 'vite';
|
|
|
3
3
|
export interface CloudflareModulePluginExtra {
|
|
4
4
|
afterBuildCompleted(config: AstroConfig): Promise<void>;
|
|
5
5
|
}
|
|
6
|
-
export type ModuleType = 'CompiledWasm' | 'Text' | 'Data';
|
|
7
6
|
/**
|
|
8
7
|
* Enables support for various non-standard extensions in module imports that cloudflare workers supports.
|
|
9
8
|
*
|
|
@@ -12,7 +12,7 @@ export declare function setImageConfig(service: string, config: AstroConfig['ima
|
|
|
12
12
|
hostname?: string | undefined;
|
|
13
13
|
pathname?: string | undefined;
|
|
14
14
|
}[];
|
|
15
|
-
experimentalLayout?: "
|
|
15
|
+
experimentalLayout?: "none" | "fixed" | "constrained" | "full-width" | undefined;
|
|
16
16
|
experimentalObjectFit?: string | undefined;
|
|
17
17
|
experimentalObjectPosition?: string | undefined;
|
|
18
18
|
experimentalBreakpoints?: number[] | undefined;
|
|
@@ -28,7 +28,7 @@ export declare function setImageConfig(service: string, config: AstroConfig['ima
|
|
|
28
28
|
hostname?: string | undefined;
|
|
29
29
|
pathname?: string | undefined;
|
|
30
30
|
}[];
|
|
31
|
-
experimentalLayout?: "
|
|
31
|
+
experimentalLayout?: "none" | "fixed" | "constrained" | "full-width" | undefined;
|
|
32
32
|
experimentalObjectFit?: string | undefined;
|
|
33
33
|
experimentalObjectPosition?: string | undefined;
|
|
34
34
|
experimentalBreakpoints?: number[] | undefined;
|
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": "12.5.
|
|
4
|
+
"version": "12.5.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"author": "withastro",
|
|
@@ -30,15 +30,11 @@
|
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@cloudflare/workers-types": "^4.20250327.0",
|
|
33
|
-
"esbuild": "^0.25.0",
|
|
34
|
-
"estree-walker": "^3.0.3",
|
|
35
|
-
"magic-string": "^0.30.17",
|
|
36
|
-
"miniflare": "^4.20250321.1",
|
|
37
33
|
"tinyglobby": "^0.2.12",
|
|
38
|
-
"vite": "^6.
|
|
34
|
+
"vite": "^6.3.4",
|
|
39
35
|
"wrangler": "^4.5.1",
|
|
40
36
|
"@astrojs/internal-helpers": "0.6.1",
|
|
41
|
-
"@astrojs/underscore-redirects": "0.6.
|
|
37
|
+
"@astrojs/underscore-redirects": "0.6.1"
|
|
42
38
|
},
|
|
43
39
|
"peerDependencies": {
|
|
44
40
|
"astro": "^5.0.0"
|
|
@@ -48,8 +44,7 @@
|
|
|
48
44
|
"devalue": "^5.1.1",
|
|
49
45
|
"execa": "^8.0.1",
|
|
50
46
|
"rollup": "^4.35.0",
|
|
51
|
-
"
|
|
52
|
-
"astro": "5.7.0",
|
|
47
|
+
"astro": "5.7.10",
|
|
53
48
|
"astro-scripts": "0.0.14"
|
|
54
49
|
},
|
|
55
50
|
"publishConfig": {
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { PluginOption } from 'vite';
|
|
2
|
-
/**
|
|
3
|
-
* A Vite bundle analyzer that identifies chunks that are not used for server rendering.
|
|
4
|
-
*
|
|
5
|
-
* The chunks injected by Astro for prerendering are flagged as non-server chunks.
|
|
6
|
-
* Any chunks that is only used by a non-server chunk are also flagged as non-server chunks.
|
|
7
|
-
* This continues transitively until all non-server chunks are found.
|
|
8
|
-
*/
|
|
9
|
-
export declare class NonServerChunkDetector {
|
|
10
|
-
private nonServerChunks?;
|
|
11
|
-
getPlugin(): PluginOption;
|
|
12
|
-
private processBundle;
|
|
13
|
-
getNonServerChunks(): string[];
|
|
14
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
class NonServerChunkDetector {
|
|
2
|
-
nonServerChunks;
|
|
3
|
-
getPlugin() {
|
|
4
|
-
return {
|
|
5
|
-
name: "non-server-chunk-detector",
|
|
6
|
-
generateBundle: (_, bundle) => {
|
|
7
|
-
if (!bundle["index.js"]) return;
|
|
8
|
-
this.processBundle(bundle);
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
processBundle(bundle) {
|
|
13
|
-
const chunkNamesToFiles = /* @__PURE__ */ new Map();
|
|
14
|
-
const entryChunks = [];
|
|
15
|
-
const chunkToDependencies = /* @__PURE__ */ new Map();
|
|
16
|
-
for (const chunk of Object.values(bundle)) {
|
|
17
|
-
if (chunk.type !== "chunk") continue;
|
|
18
|
-
chunkNamesToFiles.set(chunk.name, chunk.fileName);
|
|
19
|
-
chunkToDependencies.set(chunk.fileName, [...chunk.imports, ...chunk.dynamicImports]);
|
|
20
|
-
if (chunk.isEntry) {
|
|
21
|
-
entryChunks.push(chunk.fileName);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
const chunkDecisions = /* @__PURE__ */ new Map();
|
|
25
|
-
for (const entry of entryChunks) {
|
|
26
|
-
chunkDecisions.set(entry, true);
|
|
27
|
-
}
|
|
28
|
-
for (const chunk of ["prerender", "prerender@_@astro"]) {
|
|
29
|
-
const fileName = chunkNamesToFiles.get(chunk);
|
|
30
|
-
if (fileName) {
|
|
31
|
-
chunkDecisions.set(fileName, false);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
const chunksToWalk = [...entryChunks];
|
|
35
|
-
for (let chunk = chunksToWalk.pop(); chunk; chunk = chunksToWalk.pop()) {
|
|
36
|
-
for (const dep of chunkToDependencies.get(chunk) ?? []) {
|
|
37
|
-
if (chunkDecisions.has(dep)) continue;
|
|
38
|
-
chunkDecisions.set(dep, true);
|
|
39
|
-
chunksToWalk.push(dep);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
this.nonServerChunks = Array.from(chunkToDependencies.keys()).filter(
|
|
43
|
-
(chunk) => !chunkDecisions.get(chunk)
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
getNonServerChunks() {
|
|
47
|
-
return this.nonServerChunks ?? [];
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
export {
|
|
51
|
-
NonServerChunkDetector
|
|
52
|
-
};
|