vite-plugin-cross-origin-storage 1.3.17 → 1.3.18

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.js CHANGED
@@ -1668,6 +1668,7 @@ function cosPlugin(options = {}) {
1668
1668
  (c) => c.type === "chunk"
1669
1669
  );
1670
1670
  const managedChunkNames = new Set(Object.keys(managedChunks));
1671
+ const base = config.base.endsWith("/") ? config.base : config.base + "/";
1671
1672
  const managedChunkInfo = {};
1672
1673
  for (const fileName in managedChunks) {
1673
1674
  const nameHash = crypto.createHash("sha256").update(fileName).digest("hex").substring(0, 8);
@@ -1690,7 +1691,7 @@ function cosPlugin(options = {}) {
1690
1691
  /[.*+?^${}()|[\]\\]/g,
1691
1692
  "\\$&"
1692
1693
  );
1693
- const bareSpecifier = `cos-id_${depFileName}`;
1694
+ const bareSpecifier = `http://localhost:5001${base}${depFileName}`;
1694
1695
  const staticPattern = `(import|export)\\b\\s*((?:(?!\\bimport\\b|\\bexport\\b)[\\s\\S])*?\\bfrom\\b\\s*)?['"]${escapedRelPath}['"]\\s*;?`;
1695
1696
  const staticRegex = new RegExp(staticPattern, "g");
1696
1697
  targetChunk.code = targetChunk.code.replace(
@@ -1709,7 +1710,6 @@ function cosPlugin(options = {}) {
1709
1710
  }
1710
1711
  }
1711
1712
  const manifest = {};
1712
- const base = config.base.endsWith("/") ? config.base : config.base + "/";
1713
1713
  for (const fileName in managedChunkInfo) {
1714
1714
  const { chunk, globalVar } = managedChunkInfo[fileName];
1715
1715
  const finalHash = crypto.createHash("sha256").update(chunk.code).digest("hex");
package/dist/loader.js CHANGED
@@ -112,8 +112,8 @@
112
112
  const shim = `export * from "${url}";${chunk.hasDefault ? `export { default } from "${url}";` : ''}`;
113
113
  const shimUrl = `data:text/javascript;base64,${btoa(shim)}`;
114
114
 
115
- // Map the virtual bare specifier to the shim
116
- importMap.imports[`cos-id_${chunk.fileName}`] = shimUrl;
115
+ // Map the hardcoded absolute URL to the shim
116
+ importMap.imports[`http://localhost:5001${chunk.file}`] = shimUrl;
117
117
 
118
118
  // Also set global if anyone still needs it (legacy)
119
119
  if (chunk.globalVar) {
package/loader.js CHANGED
@@ -112,8 +112,8 @@
112
112
  const shim = `export * from "${url}";${chunk.hasDefault ? `export { default } from "${url}";` : ''}`;
113
113
  const shimUrl = `data:text/javascript;base64,${btoa(shim)}`;
114
114
 
115
- // Map the virtual bare specifier to the shim
116
- importMap.imports[`cos-id_${chunk.fileName}`] = shimUrl;
115
+ // Map the hardcoded absolute URL to the shim
116
+ importMap.imports[`http://localhost:5001${chunk.file}`] = shimUrl;
117
117
 
118
118
  // Also set global if anyone still needs it (legacy)
119
119
  if (chunk.globalVar) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-cross-origin-storage",
3
- "version": "1.3.17",
3
+ "version": "1.3.18",
4
4
  "description": "Vite plugin to load chunks from Cross-Origin Storage",
5
5
  "keywords": [
6
6
  "vite",