vite-plugin-cross-origin-storage 2.0.1 → 2.0.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/index.mjs +2 -7
- package/dist/loader.mjs +3 -0
- package/package.json +3 -2
package/dist/index.mjs
CHANGED
|
@@ -192,16 +192,11 @@ function cosPlugin(options) {
|
|
|
192
192
|
file: `${hash}.js`,
|
|
193
193
|
hash
|
|
194
194
|
};
|
|
195
|
-
|
|
195
|
+
this.emitFile({
|
|
196
196
|
type: "asset",
|
|
197
197
|
fileName,
|
|
198
|
-
name: hash,
|
|
199
|
-
names: [hash],
|
|
200
|
-
originalFileName: null,
|
|
201
|
-
originalFileNames: [],
|
|
202
|
-
needsCodeReference: false,
|
|
203
198
|
source: resolved
|
|
204
|
-
};
|
|
199
|
+
});
|
|
205
200
|
return hash;
|
|
206
201
|
};
|
|
207
202
|
for (const id of raw.keys()) visit(id, []);
|
package/dist/loader.mjs
CHANGED
|
@@ -16,6 +16,9 @@ async function runCosLoader(manifest) {
|
|
|
16
16
|
if (error?.name !== "NotFoundError") console.error("[cos] lookup failed", error);
|
|
17
17
|
}
|
|
18
18
|
const response = await fetch(file);
|
|
19
|
+
if (!response.ok) throw new Error(`[cos] failed to fetch chunk ${file}: ${response.status} ${response.statusText}`);
|
|
20
|
+
const contentType = response.headers.get("content-type") ?? "";
|
|
21
|
+
if (contentType && !/javascript|ecmascript/i.test(contentType)) throw new Error(`[cos] chunk ${file} served as ${contentType}, expected JavaScript`);
|
|
19
22
|
const blob = new Blob([await response.blob()], { type: "text/javascript" });
|
|
20
23
|
if (cos) try {
|
|
21
24
|
const [handle] = await cos.requestFileHandles([{
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-cross-origin-storage",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.2",
|
|
5
5
|
"description": "Vite plugin to extract shared dependencies into content-addressed chunks loaded from Cross-Origin Storage",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Daniel Roe",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"node": ">=20.19.0"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0"
|
|
46
|
+
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"magic-string": "^0.30.21",
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
"typescript": "~6.0.3",
|
|
59
59
|
"unhead": "^2.1.0",
|
|
60
60
|
"vite": "^7.3.5",
|
|
61
|
+
"vite8": "npm:vite@8.1.0",
|
|
61
62
|
"vitest": "^4.1.8",
|
|
62
63
|
"vue": "3.5.39"
|
|
63
64
|
},
|