vite-plugin-cross-origin-storage 1.4.5 → 1.5.0

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.
Files changed (2) hide show
  1. package/dist/index.js +25 -5
  2. package/package.json +6 -3
package/dist/index.js CHANGED
@@ -1654,9 +1654,14 @@ function cosPlugin(options = {}) {
1654
1654
  if (pkgName) {
1655
1655
  try {
1656
1656
  require2.resolve(pkgName);
1657
- if (!externalArray.includes(pkgName)) {
1658
- console.log(`COS Plugin: [MAGIC] Externalizing package "${pkgName}" (matched from ${item})`);
1659
- externalArray.push(pkgName);
1657
+ const externalPatterns = [pkgName, `${pkgName}/*`];
1658
+ for (const pattern of externalPatterns) {
1659
+ if (!externalArray.includes(pattern)) {
1660
+ console.log(
1661
+ `COS Plugin: [MAGIC] Externalizing pattern "${pattern}" (matched from ${item})`
1662
+ );
1663
+ externalArray.push(pattern);
1664
+ }
1660
1665
  }
1661
1666
  } catch (e) {
1662
1667
  }
@@ -1748,8 +1753,23 @@ function cosPlugin(options = {}) {
1748
1753
  } catch (e) {
1749
1754
  pkgPath = require2.resolve(pkgName);
1750
1755
  }
1751
- console.log(`COS Plugin: [MAGIC] Resolved ${pkgName} to ${pkgPath}`);
1752
- const content = fs.readFileSync(pkgPath);
1756
+ const esbuildRequire = createRequire(import.meta.url);
1757
+ const esbuild = esbuildRequire("esbuild");
1758
+ const buildResult = await esbuild.build({
1759
+ entryPoints: [pkgPath],
1760
+ bundle: true,
1761
+ format: "esm",
1762
+ minify: true,
1763
+ platform: "browser",
1764
+ write: false,
1765
+ // Don't write to disk
1766
+ target: "esnext",
1767
+ // Neutralize environment
1768
+ define: {
1769
+ "process.env.NODE_ENV": '"production"'
1770
+ }
1771
+ });
1772
+ const content = buildResult.outputFiles[0].contents;
1753
1773
  const hash = crypto.createHash("sha256").update(content).digest("hex");
1754
1774
  const ext = path.extname(pkgPath);
1755
1775
  const fileName = path.join(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-cross-origin-storage",
3
- "version": "1.4.5",
3
+ "version": "1.5.0",
4
4
  "description": "Vite plugin to load chunks from Cross-Origin Storage",
5
5
  "keywords": [
6
6
  "vite",
@@ -48,9 +48,12 @@
48
48
  "@rollup/pluginutils": "^5.3.0",
49
49
  "@types/node": "^25.2.3",
50
50
  "rollup": "^4.57.1",
51
+ "three": "^0.183.0",
51
52
  "tsup": "^8.5.1",
52
53
  "typescript": "^5.9.3",
53
- "vite": "^7.3.1",
54
- "three": "^0.183.0"
54
+ "vite": "^7.3.1"
55
+ },
56
+ "dependencies": {
57
+ "esbuild": "^0.27.3"
55
58
  }
56
59
  }