@storybook/builder-vite 10.0.0-beta.6 → 10.0.0-beta.8
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 +315 -8
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_82fjqw2ty2 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_82fjqw2ty2 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_82fjqw2ty2 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_82fjqw2ty2.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_82fjqw2ty2.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_82fjqw2ty2.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -1566,6 +1566,314 @@ import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
|
1566
1566
|
// ../../core/src/shared/utils/module.ts
|
|
1567
1567
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
1568
1568
|
|
|
1569
|
+
// ../../node_modules/exsolve/dist/index.mjs
|
|
1570
|
+
import assert from "node:assert";
|
|
1571
|
+
import v8 from "node:v8";
|
|
1572
|
+
import { format, inspect } from "node:util";
|
|
1573
|
+
var own$1 = {}.hasOwnProperty;
|
|
1574
|
+
var classRegExp = /^([A-Z][a-z\d]*)+$/;
|
|
1575
|
+
var kTypes = /* @__PURE__ */ new Set([
|
|
1576
|
+
"string",
|
|
1577
|
+
"function",
|
|
1578
|
+
"number",
|
|
1579
|
+
"object",
|
|
1580
|
+
// Accept 'Function' and 'Object' as alternative to the lower cased version.
|
|
1581
|
+
"Function",
|
|
1582
|
+
"Object",
|
|
1583
|
+
"boolean",
|
|
1584
|
+
"bigint",
|
|
1585
|
+
"symbol"
|
|
1586
|
+
]);
|
|
1587
|
+
var messages = /* @__PURE__ */ new Map();
|
|
1588
|
+
var nodeInternalPrefix = "__node_internal_";
|
|
1589
|
+
var userStackTraceLimit;
|
|
1590
|
+
function formatList(array, type = "and") {
|
|
1591
|
+
return array.length < 3 ? array.join(` ${type} `) : `${array.slice(0, -1).join(", ")}, ${type} ${array.at(-1)}`;
|
|
1592
|
+
}
|
|
1593
|
+
__name(formatList, "formatList");
|
|
1594
|
+
function createError(sym, value, constructor) {
|
|
1595
|
+
messages.set(sym, value);
|
|
1596
|
+
return makeNodeErrorWithCode(constructor, sym);
|
|
1597
|
+
}
|
|
1598
|
+
__name(createError, "createError");
|
|
1599
|
+
function makeNodeErrorWithCode(Base, key) {
|
|
1600
|
+
return /* @__PURE__ */ __name(function NodeError(...parameters) {
|
|
1601
|
+
const limit = Error.stackTraceLimit;
|
|
1602
|
+
if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = 0;
|
|
1603
|
+
const error = new Base();
|
|
1604
|
+
if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = limit;
|
|
1605
|
+
const message = getMessage(key, parameters, error);
|
|
1606
|
+
Object.defineProperties(error, {
|
|
1607
|
+
// Note: no need to implement `kIsNodeError` symbol, would be hard,
|
|
1608
|
+
// probably.
|
|
1609
|
+
message: {
|
|
1610
|
+
value: message,
|
|
1611
|
+
enumerable: false,
|
|
1612
|
+
writable: true,
|
|
1613
|
+
configurable: true
|
|
1614
|
+
},
|
|
1615
|
+
toString: {
|
|
1616
|
+
/** @this {Error} */
|
|
1617
|
+
value() {
|
|
1618
|
+
return `${this.name} [${key}]: ${this.message}`;
|
|
1619
|
+
},
|
|
1620
|
+
enumerable: false,
|
|
1621
|
+
writable: true,
|
|
1622
|
+
configurable: true
|
|
1623
|
+
}
|
|
1624
|
+
});
|
|
1625
|
+
captureLargerStackTrace(error);
|
|
1626
|
+
error.code = key;
|
|
1627
|
+
return error;
|
|
1628
|
+
}, "NodeError");
|
|
1629
|
+
}
|
|
1630
|
+
__name(makeNodeErrorWithCode, "makeNodeErrorWithCode");
|
|
1631
|
+
function isErrorStackTraceLimitWritable() {
|
|
1632
|
+
try {
|
|
1633
|
+
if (v8.startupSnapshot.isBuildingSnapshot()) {
|
|
1634
|
+
return false;
|
|
1635
|
+
}
|
|
1636
|
+
} catch {
|
|
1637
|
+
}
|
|
1638
|
+
const desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit");
|
|
1639
|
+
if (desc === void 0) {
|
|
1640
|
+
return Object.isExtensible(Error);
|
|
1641
|
+
}
|
|
1642
|
+
return own$1.call(desc, "writable") && desc.writable !== void 0 ? desc.writable : desc.set !== void 0;
|
|
1643
|
+
}
|
|
1644
|
+
__name(isErrorStackTraceLimitWritable, "isErrorStackTraceLimitWritable");
|
|
1645
|
+
function hideStackFrames(wrappedFunction) {
|
|
1646
|
+
const hidden = nodeInternalPrefix + wrappedFunction.name;
|
|
1647
|
+
Object.defineProperty(wrappedFunction, "name", { value: hidden });
|
|
1648
|
+
return wrappedFunction;
|
|
1649
|
+
}
|
|
1650
|
+
__name(hideStackFrames, "hideStackFrames");
|
|
1651
|
+
var captureLargerStackTrace = hideStackFrames(function(error) {
|
|
1652
|
+
const stackTraceLimitIsWritable = isErrorStackTraceLimitWritable();
|
|
1653
|
+
if (stackTraceLimitIsWritable) {
|
|
1654
|
+
userStackTraceLimit = Error.stackTraceLimit;
|
|
1655
|
+
Error.stackTraceLimit = Number.POSITIVE_INFINITY;
|
|
1656
|
+
}
|
|
1657
|
+
Error.captureStackTrace(error);
|
|
1658
|
+
if (stackTraceLimitIsWritable) Error.stackTraceLimit = userStackTraceLimit;
|
|
1659
|
+
return error;
|
|
1660
|
+
});
|
|
1661
|
+
function getMessage(key, parameters, self) {
|
|
1662
|
+
const message = messages.get(key);
|
|
1663
|
+
assert(message !== void 0, "expected `message` to be found");
|
|
1664
|
+
if (typeof message === "function") {
|
|
1665
|
+
assert(
|
|
1666
|
+
message.length <= parameters.length,
|
|
1667
|
+
// Default options do not count.
|
|
1668
|
+
`Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${message.length}).`
|
|
1669
|
+
);
|
|
1670
|
+
return Reflect.apply(message, self, parameters);
|
|
1671
|
+
}
|
|
1672
|
+
const regex = /%[dfijoOs]/g;
|
|
1673
|
+
let expectedLength = 0;
|
|
1674
|
+
while (regex.exec(message) !== null) expectedLength++;
|
|
1675
|
+
assert(
|
|
1676
|
+
expectedLength === parameters.length,
|
|
1677
|
+
`Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${expectedLength}).`
|
|
1678
|
+
);
|
|
1679
|
+
if (parameters.length === 0) return message;
|
|
1680
|
+
parameters.unshift(message);
|
|
1681
|
+
return Reflect.apply(format, null, parameters);
|
|
1682
|
+
}
|
|
1683
|
+
__name(getMessage, "getMessage");
|
|
1684
|
+
function determineSpecificType(value) {
|
|
1685
|
+
if (value === null || value === void 0) {
|
|
1686
|
+
return String(value);
|
|
1687
|
+
}
|
|
1688
|
+
if (typeof value === "function" && value.name) {
|
|
1689
|
+
return `function ${value.name}`;
|
|
1690
|
+
}
|
|
1691
|
+
if (typeof value === "object") {
|
|
1692
|
+
if (value.constructor && value.constructor.name) {
|
|
1693
|
+
return `an instance of ${value.constructor.name}`;
|
|
1694
|
+
}
|
|
1695
|
+
return `${inspect(value, { depth: -1 })}`;
|
|
1696
|
+
}
|
|
1697
|
+
let inspected = inspect(value, { colors: false });
|
|
1698
|
+
if (inspected.length > 28) {
|
|
1699
|
+
inspected = `${inspected.slice(0, 25)}...`;
|
|
1700
|
+
}
|
|
1701
|
+
return `type ${typeof value} (${inspected})`;
|
|
1702
|
+
}
|
|
1703
|
+
__name(determineSpecificType, "determineSpecificType");
|
|
1704
|
+
createError(
|
|
1705
|
+
"ERR_INVALID_ARG_TYPE",
|
|
1706
|
+
(name, expected, actual) => {
|
|
1707
|
+
assert(typeof name === "string", "'name' must be a string");
|
|
1708
|
+
if (!Array.isArray(expected)) {
|
|
1709
|
+
expected = [expected];
|
|
1710
|
+
}
|
|
1711
|
+
let message = "The ";
|
|
1712
|
+
if (name.endsWith(" argument")) {
|
|
1713
|
+
message += `${name} `;
|
|
1714
|
+
} else {
|
|
1715
|
+
const type = name.includes(".") ? "property" : "argument";
|
|
1716
|
+
message += `"${name}" ${type} `;
|
|
1717
|
+
}
|
|
1718
|
+
message += "must be ";
|
|
1719
|
+
const types2 = [];
|
|
1720
|
+
const instances = [];
|
|
1721
|
+
const other = [];
|
|
1722
|
+
for (const value of expected) {
|
|
1723
|
+
assert(
|
|
1724
|
+
typeof value === "string",
|
|
1725
|
+
"All expected entries have to be of type string"
|
|
1726
|
+
);
|
|
1727
|
+
if (kTypes.has(value)) {
|
|
1728
|
+
types2.push(value.toLowerCase());
|
|
1729
|
+
} else if (classRegExp.exec(value) === null) {
|
|
1730
|
+
assert(
|
|
1731
|
+
value !== "object",
|
|
1732
|
+
'The value "object" should be written as "Object"'
|
|
1733
|
+
);
|
|
1734
|
+
other.push(value);
|
|
1735
|
+
} else {
|
|
1736
|
+
instances.push(value);
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1739
|
+
if (instances.length > 0) {
|
|
1740
|
+
const pos = types2.indexOf("object");
|
|
1741
|
+
if (pos !== -1) {
|
|
1742
|
+
types2.slice(pos, 1);
|
|
1743
|
+
instances.push("Object");
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1746
|
+
if (types2.length > 0) {
|
|
1747
|
+
message += `${types2.length > 1 ? "one of type" : "of type"} ${formatList(
|
|
1748
|
+
types2,
|
|
1749
|
+
"or"
|
|
1750
|
+
)}`;
|
|
1751
|
+
if (instances.length > 0 || other.length > 0) message += " or ";
|
|
1752
|
+
}
|
|
1753
|
+
if (instances.length > 0) {
|
|
1754
|
+
message += `an instance of ${formatList(instances, "or")}`;
|
|
1755
|
+
if (other.length > 0) message += " or ";
|
|
1756
|
+
}
|
|
1757
|
+
if (other.length > 0) {
|
|
1758
|
+
if (other.length > 1) {
|
|
1759
|
+
message += `one of ${formatList(other, "or")}`;
|
|
1760
|
+
} else {
|
|
1761
|
+
if (other[0]?.toLowerCase() !== other[0]) message += "an ";
|
|
1762
|
+
message += `${other[0]}`;
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
message += `. Received ${determineSpecificType(actual)}`;
|
|
1766
|
+
return message;
|
|
1767
|
+
},
|
|
1768
|
+
TypeError
|
|
1769
|
+
);
|
|
1770
|
+
var ERR_INVALID_MODULE_SPECIFIER = createError(
|
|
1771
|
+
"ERR_INVALID_MODULE_SPECIFIER",
|
|
1772
|
+
/**
|
|
1773
|
+
* @param {string} request
|
|
1774
|
+
* @param {string} reason
|
|
1775
|
+
* @param {string} [base]
|
|
1776
|
+
*/
|
|
1777
|
+
(request, reason, base) => {
|
|
1778
|
+
return `Invalid module "${request}" ${reason}${base ? ` imported from ${base}` : ""}`;
|
|
1779
|
+
},
|
|
1780
|
+
TypeError
|
|
1781
|
+
);
|
|
1782
|
+
var ERR_INVALID_PACKAGE_CONFIG = createError(
|
|
1783
|
+
"ERR_INVALID_PACKAGE_CONFIG",
|
|
1784
|
+
(path3, base, message) => {
|
|
1785
|
+
return `Invalid package config ${path3}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
|
|
1786
|
+
},
|
|
1787
|
+
Error
|
|
1788
|
+
);
|
|
1789
|
+
var ERR_INVALID_PACKAGE_TARGET = createError(
|
|
1790
|
+
"ERR_INVALID_PACKAGE_TARGET",
|
|
1791
|
+
(packagePath, key, target, isImport = false, base) => {
|
|
1792
|
+
const relatedError = typeof target === "string" && !isImport && target.length > 0 && !target.startsWith("./");
|
|
1793
|
+
if (key === ".") {
|
|
1794
|
+
assert(isImport === false);
|
|
1795
|
+
return `Invalid "exports" main target ${JSON.stringify(target)} defined in the package config ${packagePath}package.json${base ? ` imported from ${base}` : ""}${relatedError ? '; targets must start with "./"' : ""}`;
|
|
1796
|
+
}
|
|
1797
|
+
return `Invalid "${isImport ? "imports" : "exports"}" target ${JSON.stringify(
|
|
1798
|
+
target
|
|
1799
|
+
)} defined for '${key}' in the package config ${packagePath}package.json${base ? ` imported from ${base}` : ""}${relatedError ? '; targets must start with "./"' : ""}`;
|
|
1800
|
+
},
|
|
1801
|
+
Error
|
|
1802
|
+
);
|
|
1803
|
+
var ERR_MODULE_NOT_FOUND = createError(
|
|
1804
|
+
"ERR_MODULE_NOT_FOUND",
|
|
1805
|
+
(path3, base, exactUrl = false) => {
|
|
1806
|
+
return `Cannot find ${exactUrl ? "module" : "package"} '${path3}' imported from ${base}`;
|
|
1807
|
+
},
|
|
1808
|
+
Error
|
|
1809
|
+
);
|
|
1810
|
+
createError(
|
|
1811
|
+
"ERR_NETWORK_IMPORT_DISALLOWED",
|
|
1812
|
+
"import of '%s' by %s is not supported: %s",
|
|
1813
|
+
Error
|
|
1814
|
+
);
|
|
1815
|
+
var ERR_PACKAGE_IMPORT_NOT_DEFINED = createError(
|
|
1816
|
+
"ERR_PACKAGE_IMPORT_NOT_DEFINED",
|
|
1817
|
+
(specifier, packagePath, base) => {
|
|
1818
|
+
return `Package import specifier "${specifier}" is not defined${packagePath ? ` in package ${packagePath || ""}package.json` : ""} imported from ${base}`;
|
|
1819
|
+
},
|
|
1820
|
+
TypeError
|
|
1821
|
+
);
|
|
1822
|
+
var ERR_PACKAGE_PATH_NOT_EXPORTED = createError(
|
|
1823
|
+
"ERR_PACKAGE_PATH_NOT_EXPORTED",
|
|
1824
|
+
/**
|
|
1825
|
+
* @param {string} packagePath
|
|
1826
|
+
* @param {string} subpath
|
|
1827
|
+
* @param {string} [base]
|
|
1828
|
+
*/
|
|
1829
|
+
(packagePath, subpath, base) => {
|
|
1830
|
+
if (subpath === ".")
|
|
1831
|
+
return `No "exports" main defined in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`;
|
|
1832
|
+
return `Package subpath '${subpath}' is not defined by "exports" in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`;
|
|
1833
|
+
},
|
|
1834
|
+
Error
|
|
1835
|
+
);
|
|
1836
|
+
var ERR_UNSUPPORTED_DIR_IMPORT = createError(
|
|
1837
|
+
"ERR_UNSUPPORTED_DIR_IMPORT",
|
|
1838
|
+
"Directory import '%s' is not supported resolving ES modules imported from %s",
|
|
1839
|
+
Error
|
|
1840
|
+
);
|
|
1841
|
+
var ERR_UNSUPPORTED_RESOLVE_REQUEST = createError(
|
|
1842
|
+
"ERR_UNSUPPORTED_RESOLVE_REQUEST",
|
|
1843
|
+
'Failed to resolve module specifier "%s" from "%s": Invalid relative URL or base scheme is not hierarchical.',
|
|
1844
|
+
TypeError
|
|
1845
|
+
);
|
|
1846
|
+
var ERR_UNKNOWN_FILE_EXTENSION = createError(
|
|
1847
|
+
"ERR_UNKNOWN_FILE_EXTENSION",
|
|
1848
|
+
(extension, path3) => {
|
|
1849
|
+
return `Unknown file extension "${extension}" for ${path3}`;
|
|
1850
|
+
},
|
|
1851
|
+
TypeError
|
|
1852
|
+
);
|
|
1853
|
+
createError(
|
|
1854
|
+
"ERR_INVALID_ARG_VALUE",
|
|
1855
|
+
(name, value, reason = "is invalid") => {
|
|
1856
|
+
let inspected = inspect(value);
|
|
1857
|
+
if (inspected.length > 128) {
|
|
1858
|
+
inspected = `${inspected.slice(0, 128)}...`;
|
|
1859
|
+
}
|
|
1860
|
+
const type = name.includes(".") ? "property" : "argument";
|
|
1861
|
+
return `The ${type} '${name}' ${reason}. Received ${inspected}`;
|
|
1862
|
+
},
|
|
1863
|
+
TypeError
|
|
1864
|
+
// Note: extra classes have been shaken out.
|
|
1865
|
+
// , RangeError
|
|
1866
|
+
);
|
|
1867
|
+
var hasOwnProperty$1 = {}.hasOwnProperty;
|
|
1868
|
+
var hasOwnProperty = {}.hasOwnProperty;
|
|
1869
|
+
var RegExpPrototypeSymbolReplace = RegExp.prototype[Symbol.replace];
|
|
1870
|
+
var own = {}.hasOwnProperty;
|
|
1871
|
+
var isWindows = (() => process.platform === "win32")();
|
|
1872
|
+
var globalCache = (() => (
|
|
1873
|
+
// eslint-disable-next-line unicorn/no-unreadable-iife
|
|
1874
|
+
globalThis["__EXSOLVE_CACHE__"] ||= /* @__PURE__ */ new Map()
|
|
1875
|
+
))();
|
|
1876
|
+
|
|
1569
1877
|
// ../../node_modules/pathe/dist/shared/pathe.ff20891b.mjs
|
|
1570
1878
|
var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
1571
1879
|
function normalizeWindowsPath(input = "") {
|
|
@@ -8888,7 +9196,7 @@ async function externalGlobalsPlugin(externals) {
|
|
|
8888
9196
|
return void 0;
|
|
8889
9197
|
}
|
|
8890
9198
|
const newAlias = mergeAlias([], config.resolve?.alias);
|
|
8891
|
-
const cachePath = cache("sb-vite-plugin-externals", { create: true });
|
|
9199
|
+
const cachePath = cache("sb-vite-plugin-externals", { create: true }) ?? join6(process.cwd(), "node_modules", ".cache", "sb-vite-plugin-externals");
|
|
8892
9200
|
await Promise.all(
|
|
8893
9201
|
Object.keys(externals).map(async (externalKey) => {
|
|
8894
9202
|
const externalCachePath = join6(cachePath, `${externalKey}.js`);
|
|
@@ -9263,7 +9571,6 @@ var INCLUDE_CANDIDATES = [
|
|
|
9263
9571
|
"storybook/actions/decorator",
|
|
9264
9572
|
"storybook/internal/core-events",
|
|
9265
9573
|
"storybook/internal/csf",
|
|
9266
|
-
"storybook/internal/preview-api",
|
|
9267
9574
|
"storybook/internal/preview/runtime",
|
|
9268
9575
|
"storybook/preview-api",
|
|
9269
9576
|
"storybook/viewport",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/builder-vite",
|
|
3
|
-
"version": "10.0.0-beta.
|
|
3
|
+
"version": "10.0.0-beta.8",
|
|
4
4
|
"description": "A Storybook builder to dev and build with Vite",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"prep": "jiti ../../../scripts/build/build-package.ts"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@storybook/csf-plugin": "10.0.0-beta.
|
|
51
|
+
"@storybook/csf-plugin": "10.0.0-beta.8",
|
|
52
52
|
"ts-dedent": "^2.0.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"vite": "^7.0.4"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
|
-
"storybook": "^10.0.0-beta.
|
|
66
|
+
"storybook": "^10.0.0-beta.8",
|
|
67
67
|
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0"
|
|
68
68
|
},
|
|
69
69
|
"publishConfig": {
|