vite-plugin-cross-origin-storage 1.3.20 → 1.3.22
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 +1 -1
- package/dist/loader.js +7 -5
- package/loader.js +7 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1691,7 +1691,7 @@ function cosPlugin(options = {}) {
|
|
|
1691
1691
|
/[.*+?^${}()|[\]\\]/g,
|
|
1692
1692
|
"\\$&"
|
|
1693
1693
|
);
|
|
1694
|
-
const bareSpecifier =
|
|
1694
|
+
const bareSpecifier = `cos-chunk:${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
|
-
//
|
|
85
|
-
importMap.imports[
|
|
84
|
+
// Use a bare specifier prefix to avoid hierarchical resolution issues
|
|
85
|
+
importMap.imports[`cos-chunk:${chunk.fileName}`] = dataUrl;
|
|
86
86
|
}
|
|
87
87
|
});
|
|
88
88
|
|
|
@@ -97,9 +97,11 @@
|
|
|
97
97
|
console.log('COS Loader: Import Map injected');
|
|
98
98
|
|
|
99
99
|
// Import the main entry.
|
|
100
|
-
//
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
// If the entry itself were managed, we would use cos-chunk: prefix here too.
|
|
101
|
+
// For now, it's loaded via its absolute path from the server,
|
|
102
|
+
// and its internal imports (rewritten by the plugin) will use cos-chunk:
|
|
103
|
+
const entryUrl = mainEntry.file;
|
|
104
|
+
await import(entryUrl);
|
|
103
105
|
|
|
104
106
|
} catch (err) {
|
|
105
107
|
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
|
-
//
|
|
85
|
-
importMap.imports[
|
|
84
|
+
// Use a bare specifier prefix to avoid hierarchical resolution issues
|
|
85
|
+
importMap.imports[`cos-chunk:${chunk.fileName}`] = dataUrl;
|
|
86
86
|
}
|
|
87
87
|
});
|
|
88
88
|
|
|
@@ -97,9 +97,11 @@
|
|
|
97
97
|
console.log('COS Loader: Import Map injected');
|
|
98
98
|
|
|
99
99
|
// Import the main entry.
|
|
100
|
-
//
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
// If the entry itself were managed, we would use cos-chunk: prefix here too.
|
|
101
|
+
// For now, it's loaded via its absolute path from the server,
|
|
102
|
+
// and its internal imports (rewritten by the plugin) will use cos-chunk:
|
|
103
|
+
const entryUrl = mainEntry.file;
|
|
104
|
+
await import(entryUrl);
|
|
103
105
|
|
|
104
106
|
} catch (err) {
|
|
105
107
|
console.error('COS Loader: Failed to start app', err);
|