vite-plugin-cross-origin-storage 1.3.20 → 1.3.21

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
@@ -1691,7 +1691,7 @@ function cosPlugin(options = {}) {
1691
1691
  /[.*+?^${}()|[\]\\]/g,
1692
1692
  "\\$&"
1693
1693
  );
1694
- const bareSpecifier = `./${depFileName}`;
1694
+ const bareSpecifier = `${base}${depFileName}`;
1695
1695
  const staticPattern = `(import|export)\\b\\s*((?:(?!\\bimport\\b|\\bexport\\b)[\\s\\S])*?\\bfrom\\b\\s*)?['"]${escapedRelPath}['"]\\s*;?`;
1696
1696
  const staticRegex = new RegExp(staticPattern, "g");
1697
1697
  targetChunk.code = targetChunk.code.replace(
package/dist/loader.js CHANGED
@@ -81,8 +81,8 @@
81
81
  const loadPromises = chunksToLoad.map(async (chunk) => {
82
82
  const dataUrl = await getChunkDataUrl(chunk);
83
83
  if (dataUrl) {
84
- // Map the relative path (as used in the plugin's bare specifier rewrite) to the data URL
85
- importMap.imports[`./${chunk.fileName}`] = dataUrl;
84
+ // Map the absolute path (chunk.file) to the data URL
85
+ importMap.imports[chunk.file] = dataUrl;
86
86
  }
87
87
  });
88
88
 
@@ -97,9 +97,9 @@
97
97
  console.log('COS Loader: Import Map injected');
98
98
 
99
99
  // Import the main entry.
100
- // The main entry itself is also managed and rewritten to use bare specifiers.
101
- const entryFileName = mainEntry.fileName;
102
- await import(`./${entryFileName}`);
100
+ // We use the absolute path (mainEntry.file) to ensure it's resolved correctly.
101
+ const entryUrl = mainEntry.file;
102
+ await import(entryUrl);
103
103
 
104
104
  } catch (err) {
105
105
  console.error('COS Loader: Failed to start app', err);
package/loader.js CHANGED
@@ -81,8 +81,8 @@
81
81
  const loadPromises = chunksToLoad.map(async (chunk) => {
82
82
  const dataUrl = await getChunkDataUrl(chunk);
83
83
  if (dataUrl) {
84
- // Map the relative path (as used in the plugin's bare specifier rewrite) to the data URL
85
- importMap.imports[`./${chunk.fileName}`] = dataUrl;
84
+ // Map the absolute path (chunk.file) to the data URL
85
+ importMap.imports[chunk.file] = dataUrl;
86
86
  }
87
87
  });
88
88
 
@@ -97,9 +97,9 @@
97
97
  console.log('COS Loader: Import Map injected');
98
98
 
99
99
  // Import the main entry.
100
- // The main entry itself is also managed and rewritten to use bare specifiers.
101
- const entryFileName = mainEntry.fileName;
102
- await import(`./${entryFileName}`);
100
+ // We use the absolute path (mainEntry.file) to ensure it's resolved correctly.
101
+ const entryUrl = mainEntry.file;
102
+ await import(entryUrl);
103
103
 
104
104
  } catch (err) {
105
105
  console.error('COS Loader: Failed to start app', err);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-cross-origin-storage",
3
- "version": "1.3.20",
3
+ "version": "1.3.21",
4
4
  "description": "Vite plugin to load chunks from Cross-Origin Storage",
5
5
  "keywords": [
6
6
  "vite",