vite-plugin-cross-origin-storage 1.3.14 → 1.3.15

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
@@ -1667,7 +1667,6 @@ function cosPlugin(options = {}) {
1667
1667
  const allChunks = Object.values(bundle).filter(
1668
1668
  (c) => c.type === "chunk"
1669
1669
  );
1670
- const base = config.base.endsWith("/") ? config.base : config.base + "/";
1671
1670
  const managedChunkNames = new Set(Object.keys(managedChunks));
1672
1671
  const managedChunkInfo = {};
1673
1672
  for (const fileName in managedChunks) {
@@ -1691,7 +1690,7 @@ function cosPlugin(options = {}) {
1691
1690
  /[.*+?^${}()|[\]\\]/g,
1692
1691
  "\\$&"
1693
1692
  );
1694
- const bareSpecifier = `${base}${depFileName}`;
1693
+ const bareSpecifier = `cos-id:${depFileName}`;
1695
1694
  const staticPattern = `(import|export)\\b\\s*((?:(?!\\bimport\\b|\\bexport\\b)[\\s\\S])*?\\bfrom\\b\\s*)?['"]${escapedRelPath}['"]\\s*;?`;
1696
1695
  const staticRegex = new RegExp(staticPattern, "g");
1697
1696
  targetChunk.code = targetChunk.code.replace(
@@ -1710,6 +1709,7 @@ function cosPlugin(options = {}) {
1710
1709
  }
1711
1710
  }
1712
1711
  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
- importMap.imports[chunk.fileName] = shimUrl;
116
- importMap.imports[chunk.file] = shimUrl;
115
+ // Map the virtual bare specifier to the shim
116
+ importMap.imports[`cos-id:${chunk.fileName}`] = 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
- importMap.imports[chunk.fileName] = shimUrl;
116
- importMap.imports[chunk.file] = shimUrl;
115
+ // Map the virtual bare specifier to the shim
116
+ importMap.imports[`cos-id:${chunk.fileName}`] = 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.14",
3
+ "version": "1.3.15",
4
4
  "description": "Vite plugin to load chunks from Cross-Origin Storage",
5
5
  "keywords": [
6
6
  "vite",