vite-plugin-cross-origin-storage 1.4.4 → 1.4.5
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 +27 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1638,16 +1638,24 @@ function cosPlugin(options = {}) {
|
|
|
1638
1638
|
const include = options.include || ["**/*"];
|
|
1639
1639
|
const includeArray = Array.isArray(include) ? include : [include];
|
|
1640
1640
|
const require2 = createRequire(path.join(process.cwd(), "index.js"));
|
|
1641
|
-
|
|
1641
|
+
function getPackageName(item) {
|
|
1642
1642
|
if (typeof item === "string") {
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1643
|
+
return item.startsWith("vendor-") ? item.replace("vendor-", "") : item;
|
|
1644
|
+
}
|
|
1645
|
+
if (item instanceof RegExp) {
|
|
1646
|
+
const source = item.source;
|
|
1647
|
+
const match = source.match(/vendor-([a-zA-Z0-9-@/]+?)(?:[-._]|\/|$)/);
|
|
1648
|
+
return match ? match[1] : null;
|
|
1649
|
+
}
|
|
1650
|
+
return null;
|
|
1651
|
+
}
|
|
1652
|
+
for (const item of includeArray) {
|
|
1653
|
+
const pkgName = getPackageName(item);
|
|
1654
|
+
if (pkgName) {
|
|
1647
1655
|
try {
|
|
1648
1656
|
require2.resolve(pkgName);
|
|
1649
1657
|
if (!externalArray.includes(pkgName)) {
|
|
1650
|
-
console.log(`COS Plugin: [MAGIC] Externalizing package "${pkgName}"`);
|
|
1658
|
+
console.log(`COS Plugin: [MAGIC] Externalizing package "${pkgName}" (matched from ${item})`);
|
|
1651
1659
|
externalArray.push(pkgName);
|
|
1652
1660
|
}
|
|
1653
1661
|
} catch (e) {
|
|
@@ -1695,12 +1703,20 @@ function cosPlugin(options = {}) {
|
|
|
1695
1703
|
const require2 = createRequire(path.join(process.cwd(), "index.js"));
|
|
1696
1704
|
const include = options.include || ["**/*"];
|
|
1697
1705
|
const includeArray = Array.isArray(include) ? include : [include];
|
|
1698
|
-
|
|
1699
|
-
if (typeof item
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1706
|
+
function getPackageName(item) {
|
|
1707
|
+
if (typeof item === "string") {
|
|
1708
|
+
return item.startsWith("vendor-") ? item.replace("vendor-", "") : item;
|
|
1709
|
+
}
|
|
1710
|
+
if (item instanceof RegExp) {
|
|
1711
|
+
const source = item.source;
|
|
1712
|
+
const match = source.match(/vendor-([a-zA-Z0-9-@/]+?)(?:[-._]|\/|$)/);
|
|
1713
|
+
return match ? match[1] : null;
|
|
1703
1714
|
}
|
|
1715
|
+
return null;
|
|
1716
|
+
}
|
|
1717
|
+
for (const item of includeArray) {
|
|
1718
|
+
const pkgName = getPackageName(item);
|
|
1719
|
+
if (!pkgName) continue;
|
|
1704
1720
|
try {
|
|
1705
1721
|
let pkgPath = "";
|
|
1706
1722
|
try {
|