vite-plugin-cross-origin-storage 1.4.2 → 1.4.3

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
@@ -1651,15 +1651,13 @@ function cosPlugin(options = {}) {
1651
1651
  if (chunk.isEntry) {
1652
1652
  console.log(`COS Plugin: [ENTRY] ${fileName}`);
1653
1653
  mainChunk = chunk;
1654
+ }
1655
+ const res = filter(fileName) || filter(chunk.name);
1656
+ console.log(
1657
+ `COS Plugin: [FILTER] ${fileName} (name: ${chunk.name}) -> ${res ? "INCLUDE" : "SKIP"}`
1658
+ );
1659
+ if (res) {
1654
1660
  managedChunks[fileName] = chunk;
1655
- } else {
1656
- const res = filter(fileName) || filter(chunk.name);
1657
- console.log(
1658
- `COS Plugin: [FILTER] ${fileName} (name: ${chunk.name}) -> ${res ? "INCLUDE" : "SKIP"}`
1659
- );
1660
- if (res) {
1661
- managedChunks[fileName] = chunk;
1662
- }
1663
1661
  }
1664
1662
  }
1665
1663
  if (fileName === "index.html" && chunk.type === "asset") {
@@ -1716,6 +1714,9 @@ function cosPlugin(options = {}) {
1716
1714
  const finalHash = crypto.createHash("sha256").update(chunk.code).digest("hex");
1717
1715
  manifest.chunks[fileName] = finalHash;
1718
1716
  }
1717
+ if (mainChunk && !managedChunkNames.has(mainChunk.fileName)) {
1718
+ unmanagedDependencies.add(mainChunk.fileName);
1719
+ }
1719
1720
  manifest.unmanaged = Array.from(unmanagedDependencies);
1720
1721
  if (htmlAsset) {
1721
1722
  try {
package/dist/loader.js CHANGED
@@ -55,7 +55,7 @@
55
55
  }
56
56
  }
57
57
 
58
- async function getChunkDataUrl(chunk) {
58
+ async function getChunkBlobUrl(chunk) {
59
59
  let blob = await getBlobFromCOS(chunk.hash);
60
60
  if (blob) {
61
61
  console.log(`COS Loader: ${chunk.fileName} found in COS`);
@@ -85,10 +85,10 @@
85
85
  try {
86
86
  console.log('COS Loader: Starting app...');
87
87
 
88
- // Resolve all chunks to Data URLs
88
+ // Resolve all chunks to Blob URLs
89
89
  const importMap = { imports: {} };
90
90
 
91
- // Set up unmanaged dependencies correctly so Data URLs can resolve them.
91
+ // Set up unmanaged dependencies correctly so Blob URLs can resolve them.
92
92
  for (const fileName of manifest.unmanaged || []) {
93
93
  const bareSpecifier = `coschunk-${fileName.replace(/\//g, '-')}`;
94
94
  importMap.imports[bareSpecifier] =
@@ -97,12 +97,12 @@
97
97
 
98
98
  console.log(`COS Loader: Loading ${chunksToLoad.length} chunks...`);
99
99
  const loadPromises = chunksToLoad.map(async (chunk) => {
100
- const dataUrl = await getChunkDataUrl(chunk);
101
- if (dataUrl) {
100
+ const blobUrl = await getChunkBlobUrl(chunk);
101
+ if (blobUrl) {
102
102
  // Use a hyphenated prefix and replace all slashes to ensure it's treated
103
103
  // as a truly bare specifier, bypassing hierarchical/protocol checks.
104
104
  const bareSpecifier = `coschunk-${chunk.fileName.replace(/\//g, '-')}`;
105
- importMap.imports[bareSpecifier] = dataUrl;
105
+ importMap.imports[bareSpecifier] = blobUrl;
106
106
  }
107
107
  });
108
108
 
package/loader.js CHANGED
@@ -55,7 +55,7 @@
55
55
  }
56
56
  }
57
57
 
58
- async function getChunkDataUrl(chunk) {
58
+ async function getChunkBlobUrl(chunk) {
59
59
  let blob = await getBlobFromCOS(chunk.hash);
60
60
  if (blob) {
61
61
  console.log(`COS Loader: ${chunk.fileName} found in COS`);
@@ -85,10 +85,10 @@
85
85
  try {
86
86
  console.log('COS Loader: Starting app...');
87
87
 
88
- // Resolve all chunks to Data URLs
88
+ // Resolve all chunks to Blob URLs
89
89
  const importMap = { imports: {} };
90
90
 
91
- // Set up unmanaged dependencies correctly so Data URLs can resolve them.
91
+ // Set up unmanaged dependencies correctly so Blob URLs can resolve them.
92
92
  for (const fileName of manifest.unmanaged || []) {
93
93
  const bareSpecifier = `coschunk-${fileName.replace(/\//g, '-')}`;
94
94
  importMap.imports[bareSpecifier] =
@@ -97,12 +97,12 @@
97
97
 
98
98
  console.log(`COS Loader: Loading ${chunksToLoad.length} chunks...`);
99
99
  const loadPromises = chunksToLoad.map(async (chunk) => {
100
- const dataUrl = await getChunkDataUrl(chunk);
101
- if (dataUrl) {
100
+ const blobUrl = await getChunkBlobUrl(chunk);
101
+ if (blobUrl) {
102
102
  // Use a hyphenated prefix and replace all slashes to ensure it's treated
103
103
  // as a truly bare specifier, bypassing hierarchical/protocol checks.
104
104
  const bareSpecifier = `coschunk-${chunk.fileName.replace(/\//g, '-')}`;
105
- importMap.imports[bareSpecifier] = dataUrl;
105
+ importMap.imports[bareSpecifier] = blobUrl;
106
106
  }
107
107
  });
108
108
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-cross-origin-storage",
3
- "version": "1.4.2",
3
+ "version": "1.4.3",
4
4
  "description": "Vite plugin to load chunks from Cross-Origin Storage",
5
5
  "keywords": [
6
6
  "vite",