storybook 10.3.0-alpha.0 → 10.3.0-alpha.1
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/_node-chunks/{builder-manager-5HPOYFJR.js → builder-manager-KERY565B.js} +12 -12
- package/dist/_node-chunks/{camelcase-DZNWLILJ.js → camelcase-2M63ML3X.js} +7 -7
- package/dist/_node-chunks/{chunk-2GDFAXX5.js → chunk-36AZRL2D.js} +7 -7
- package/dist/_node-chunks/{chunk-WBSFK4AO.js → chunk-4WL6MGXA.js} +7 -7
- package/dist/_node-chunks/{chunk-3B7C4FEQ.js → chunk-74PNH6JI.js} +6 -6
- package/dist/_node-chunks/{chunk-ZE2TRJ2H.js → chunk-BOYAUA6D.js} +7 -7
- package/dist/_node-chunks/{chunk-CHJGYZHC.js → chunk-CCGS5R3P.js} +8 -8
- package/dist/_node-chunks/{chunk-M3FEZVKN.js → chunk-CR23DEWX.js} +6 -6
- package/dist/_node-chunks/{chunk-6ADIAPP2.js → chunk-DB5UH4IK.js} +12 -12
- package/dist/_node-chunks/{chunk-F4NW7OLO.js → chunk-FIDYKCZW.js} +7 -7
- package/dist/_node-chunks/{chunk-QRXP6OHU.js → chunk-GOFZ5AI4.js} +7 -7
- package/dist/_node-chunks/{chunk-UIFZBVEB.js → chunk-H7D4CVP2.js} +6 -6
- package/dist/_node-chunks/{chunk-WEV5QRLC.js → chunk-J3ELUK74.js} +10 -10
- package/dist/_node-chunks/{chunk-SXSM6HLI.js → chunk-JFSKHQG7.js} +6 -6
- package/dist/_node-chunks/{chunk-4CKOLZCE.js → chunk-MJPMP6AB.js} +6 -6
- package/dist/_node-chunks/{chunk-SXSROWK5.js → chunk-MQRFGFNQ.js} +7 -7
- package/dist/_node-chunks/{chunk-STKSD6QT.js → chunk-NFDBZKV6.js} +6 -6
- package/dist/_node-chunks/chunk-OWFCNEJA.js +61 -0
- package/dist/_node-chunks/{chunk-JC4EH5XJ.js → chunk-PHOKMPEA.js} +6 -6
- package/dist/_node-chunks/chunk-PRGD4PPZ.js +18 -0
- package/dist/_node-chunks/{chunk-YU53VQ3D.js → chunk-QQZ4ZWAS.js} +9 -9
- package/dist/_node-chunks/{chunk-7HHJF6EO.js → chunk-S2JOM27Y.js} +6 -6
- package/dist/_node-chunks/{chunk-HU47ACHM.js → chunk-TGA5YZ47.js} +8 -8
- package/dist/_node-chunks/{chunk-ECXPVHM6.js → chunk-VAWKE2WR.js} +13 -13
- package/dist/_node-chunks/{chunk-XD4YM6VU.js → chunk-VEH2EH3O.js} +7 -7
- package/dist/_node-chunks/{chunk-DPH2UCZZ.js → chunk-XDPBSRAB.js} +16 -16
- package/dist/_node-chunks/{chunk-WY5ZA2BT.js → chunk-XGCRSXNA.js} +20 -20
- package/dist/_node-chunks/{chunk-EKE4NU7S.js → chunk-Y3BQKYFK.js} +9 -9
- package/dist/_node-chunks/chunk-Y3PKDQ4M.js +23 -0
- package/dist/_node-chunks/{chunk-MGDZKZCC.js → chunk-Z2ZHJPAA.js} +7 -7
- package/dist/_node-chunks/{globby-ON4YVWHY.js → globby-GL3THFIK.js} +9 -9
- package/dist/_node-chunks/{lib-K3OUNB46.js → lib-4F2GH4RU.js} +7 -7
- package/dist/_node-chunks/{mdx-N42X6CFJ-VU7ALTQ4.js → mdx-N42X6CFJ-MQX7F3YI.js} +8 -8
- package/dist/_node-chunks/{p-limit-C5BOIT3A.js → p-limit-2QDBTWEG.js} +7 -7
- package/dist/babel/index.js +10 -10
- package/dist/bin/core.js +12 -12
- package/dist/bin/dispatcher.js +11 -11
- package/dist/bin/loader.js +9 -9
- package/dist/cli/index.js +18 -18
- package/dist/common/index.js +19 -19
- package/dist/core-server/index.js +213 -55
- package/dist/core-server/presets/common-override-preset.js +9 -9
- package/dist/core-server/presets/common-preset.js +25 -25
- package/dist/csf-tools/index.js +9 -9
- package/dist/manager/globals-runtime.js +2 -2
- package/dist/manager/runtime.js +15 -16
- package/dist/manager-api/index.js +2 -2
- package/dist/mocking-utils/index.d.ts +7 -1
- package/dist/mocking-utils/index.js +161 -29
- package/dist/mocking-utils/mocker-runtime.js +1254 -0
- package/dist/node-logger/index.js +9 -9
- package/dist/server-errors.js +11 -11
- package/dist/telemetry/index.js +23 -23
- package/package.json +3 -1
- package/assets/server/mocker-runtime.template.js +0 -89
- package/dist/_node-chunks/chunk-L7XEZ3OX.js +0 -23
- package/dist/_node-chunks/chunk-MP3TH4TQ.js +0 -18
- package/dist/_node-chunks/chunk-PMDMPQ4D.js +0 -61
package/dist/csf-tools/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_zqey0uqkkfj from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_zqey0uqkkfj from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_zqey0uqkkfj from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_zqey0uqkkfj.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_zqey0uqkkfj.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_zqey0uqkkfj.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -39,9 +39,9 @@ import {
|
|
|
39
39
|
vitestTransform,
|
|
40
40
|
writeConfig,
|
|
41
41
|
writeCsf
|
|
42
|
-
} from "../_node-chunks/chunk-
|
|
43
|
-
import "../_node-chunks/chunk-
|
|
44
|
-
import "../_node-chunks/chunk-
|
|
42
|
+
} from "../_node-chunks/chunk-CCGS5R3P.js";
|
|
43
|
+
import "../_node-chunks/chunk-4WL6MGXA.js";
|
|
44
|
+
import "../_node-chunks/chunk-JFSKHQG7.js";
|
|
45
45
|
export {
|
|
46
46
|
BadMetaError,
|
|
47
47
|
ConfigFile,
|
|
@@ -62099,7 +62099,7 @@ var parseBoolean = (value) => {
|
|
|
62099
62099
|
} = options;
|
|
62100
62100
|
if (refId && !refs[refId])
|
|
62101
62101
|
throw new Error(`Invalid refId: ${refId}`);
|
|
62102
|
-
let originAddress = scope.window.location.origin +
|
|
62102
|
+
let pathname = location4.pathname || "/", originAddress = scope.window.location.origin + pathname, networkAddress = scope.STORYBOOK_NETWORK_ADDRESS ?? originAddress, managerBase = base === "origin" ? originAddress : base === "network" ? networkAddress : pathname, previewBase = refId ? refs[refId].url + "/iframe.html" : scope.PREVIEW_URL || `${managerBase.replace(/\/[^/]*$/, "/")}iframe.html`, refParam = refId ? `&refId=${encodeURIComponent(refId)}` : "", { args = "", globals = "", ...otherParams } = queryParams, argsParam = inheritArgs ? mergeSerializedParams(customQueryParams?.args ?? "", args) : args, globalsParam = inheritGlobals ? mergeSerializedParams(customQueryParams?.globals ?? "", globals) : globals, customManagerParams = (0, import_picoquery5.stringify)(otherParams, {
|
|
62103
62103
|
nesting: !0,
|
|
62104
62104
|
nestingSyntax: "js"
|
|
62105
62105
|
}), customPreviewParams = (0, import_picoquery5.stringify)(omit(otherParams, ["id", "viewMode"]), {
|
|
@@ -62174,7 +62174,7 @@ init_dist();
|
|
|
62174
62174
|
var import_memoizerific8 = __toESM(require_memoizerific(), 1), import_semver = __toESM(require_semver2(), 1);
|
|
62175
62175
|
|
|
62176
62176
|
// src/manager-api/version.ts
|
|
62177
|
-
var version = "10.3.0-alpha.
|
|
62177
|
+
var version = "10.3.0-alpha.1";
|
|
62178
62178
|
|
|
62179
62179
|
// src/manager-api/modules/versions.ts
|
|
62180
62180
|
var { VERSIONCHECK } = scope, getVersionCheckData = (0, import_memoizerific8.default)(1)(() => {
|
package/dist/manager/runtime.js
CHANGED
|
@@ -4442,30 +4442,29 @@ function findActiveLandmarkElement() {
|
|
|
4442
4442
|
return landmarkElement;
|
|
4443
4443
|
}
|
|
4444
4444
|
function useLandmarkIndicator() {
|
|
4445
|
-
let theme = useTheme(), currentAnimationRef = useRef(null);
|
|
4445
|
+
let theme = useTheme(), reducedMotion = useMediaQuery("(prefers-reduced-motion: reduce)"), currentAnimationRef = useRef(null);
|
|
4446
4446
|
useEffect(() => {
|
|
4447
4447
|
let handleKeyDown = (e2) => {
|
|
4448
4448
|
if (e2.key !== "F6")
|
|
4449
4449
|
return;
|
|
4450
4450
|
let landmarkElement = findActiveLandmarkElement();
|
|
4451
|
-
if (
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
};
|
|
4451
|
+
if (landmarkElement && (currentAnimationRef.current && (currentAnimationRef.current.cancel(), currentAnimationRef.current = null), !reducedMotion)) {
|
|
4452
|
+
let animation = landmarkElement.animate(
|
|
4453
|
+
[{ border: `2px solid ${theme.color.primary}` }, { border: "2px solid transparent" }],
|
|
4454
|
+
{
|
|
4455
|
+
duration: 1500,
|
|
4456
|
+
pseudoElement: "::after"
|
|
4457
|
+
}
|
|
4458
|
+
);
|
|
4459
|
+
currentAnimationRef.current = animation, animation.onfinish = () => {
|
|
4460
|
+
currentAnimationRef.current = null;
|
|
4461
|
+
};
|
|
4462
|
+
}
|
|
4464
4463
|
};
|
|
4465
4464
|
return document.addEventListener("keydown", handleKeyDown, { capture: !0 }), () => {
|
|
4466
4465
|
document.removeEventListener("keydown", handleKeyDown, { capture: !0 });
|
|
4467
4466
|
};
|
|
4468
|
-
}, [theme.color.primary]);
|
|
4467
|
+
}, [reducedMotion, theme.color.primary]);
|
|
4469
4468
|
}
|
|
4470
4469
|
|
|
4471
4470
|
// src/manager/components/layout/Layout.tsx
|
|
@@ -5475,7 +5474,7 @@ var ViewportWrapper = styled.div(({ active, isDefault, theme }) => ({
|
|
|
5475
5474
|
style: {
|
|
5476
5475
|
height: `${1 / scale * 100}%`,
|
|
5477
5476
|
width: `${1 / scale * 100}%`,
|
|
5478
|
-
transform: `scale(${scale})
|
|
5477
|
+
transform: scale !== 1 ? `scale(${scale})` : "none",
|
|
5479
5478
|
transformOrigin: "top left"
|
|
5480
5479
|
}
|
|
5481
5480
|
},
|
|
@@ -2320,7 +2320,7 @@ var parseBoolean = (value) => {
|
|
|
2320
2320
|
} = options;
|
|
2321
2321
|
if (refId && !refs[refId])
|
|
2322
2322
|
throw new Error(`Invalid refId: ${refId}`);
|
|
2323
|
-
let originAddress = global7.window.location.origin +
|
|
2323
|
+
let pathname = location2.pathname || "/", originAddress = global7.window.location.origin + pathname, networkAddress = global7.STORYBOOK_NETWORK_ADDRESS ?? originAddress, managerBase = base === "origin" ? originAddress : base === "network" ? networkAddress : pathname, previewBase = refId ? refs[refId].url + "/iframe.html" : global7.PREVIEW_URL || `${managerBase.replace(/\/[^/]*$/, "/")}iframe.html`, refParam = refId ? `&refId=${encodeURIComponent(refId)}` : "", { args = "", globals = "", ...otherParams } = queryParams, argsParam = inheritArgs ? mergeSerializedParams(customQueryParams?.args ?? "", args) : args, globalsParam = inheritGlobals ? mergeSerializedParams(customQueryParams?.globals ?? "", globals) : globals, customManagerParams = (0, import_picoquery.stringify)(otherParams, {
|
|
2324
2324
|
nesting: !0,
|
|
2325
2325
|
nestingSyntax: "js"
|
|
2326
2326
|
}), customPreviewParams = (0, import_picoquery.stringify)(omit(otherParams, ["id", "viewMode"]), {
|
|
@@ -2396,7 +2396,7 @@ import { global as global8 } from "@storybook/global";
|
|
|
2396
2396
|
import semver from "semver";
|
|
2397
2397
|
|
|
2398
2398
|
// src/manager-api/version.ts
|
|
2399
|
-
var version = "10.3.0-alpha.
|
|
2399
|
+
var version = "10.3.0-alpha.1";
|
|
2400
2400
|
|
|
2401
2401
|
// src/manager-api/modules/versions.ts
|
|
2402
2402
|
var { VERSIONCHECK } = global8, getVersionCheckData = (0, import_memoizerific2.default)(1)(() => {
|
|
@@ -1121,6 +1121,12 @@ declare function isFunctionNode(node: Node$1): node is Function;
|
|
|
1121
1121
|
declare function isInDestructuringAssignment(parent: Node$1, parentStack: Node$1[]): boolean;
|
|
1122
1122
|
declare function getArbitraryModuleIdentifier(node: Identifier | Literal): string;
|
|
1123
1123
|
|
|
1124
|
+
/**
|
|
1125
|
+
* Returns the bundled mocker runtime script content. This is used by builders (webpack5, vite,
|
|
1126
|
+
* etc.) to inject the mocker runtime into the preview iframe.
|
|
1127
|
+
*/
|
|
1124
1128
|
declare function getMockerRuntime(): string;
|
|
1125
1129
|
|
|
1126
|
-
|
|
1130
|
+
declare function findMockRedirect(root: string, mockPath: string, external: string | null): string | null;
|
|
1131
|
+
|
|
1132
|
+
export { type ArrayExpression, type ArrayPattern, type ArrowFunctionExpression, type AssignmentExpression, type AssignmentOperator, type AssignmentPattern, type AssignmentProperty, type AwaitExpression, type BaseCallExpression, type BaseClass, type BaseDeclaration, type BaseExpression, type BaseForXStatement, type BaseFunction, type BaseModuleDeclaration, type BaseModuleSpecifier, type BaseNode, type BaseNodeWithoutComments, type BasePattern, type BaseStatement, type BigIntLiteral, type BinaryExpression, type BinaryOperator, type BlockStatement, type BreakStatement, type CallExpression, type CatchClause, type ChainElement, type ChainExpression, type Class, type ClassBody, type ClassDeclaration, type ClassExpression, type Comment, type ConditionalExpression, type ContinueStatement, type DebuggerStatement, type Declaration, type Directive, type DoWhileStatement, type EmptyStatement, type ExportAllDeclaration, type ExportDefaultDeclaration, type ExportNamedDeclaration, type ExportSpecifier, type Expression, type ExpressionMap, type ExpressionStatement, type ForInStatement, type ForOfStatement, type ForStatement, type Function, type FunctionDeclaration, type FunctionExpression, type Identifier, type IfStatement, type ImportAttribute, type ImportDeclaration, type ImportDefaultSpecifier, type ImportExpression, type ImportNamespaceSpecifier, type ImportSpecifier, type LabeledStatement, type Literal, type LogicalExpression, type LogicalOperator, type MaybeNamedClassDeclaration, type MaybeNamedFunctionDeclaration, type MemberExpression, type MetaProperty, type MethodDefinition, type MockCall, type ModuleDeclaration, type ModuleSpecifier, type NewExpression, type Node, type NodeMap, type ObjectExpression, type ObjectPattern, type Pattern, type Position, type Positioned, type PrivateIdentifier, type Program, type Property, type PropertyDefinition, type RegExpLiteral, type RestElement, type ReturnStatement, type SequenceExpression, type SimpleCallExpression, type SimpleLiteral, type SourceLocation, type SpreadElement, type Statement, type StaticBlock, type Super, type SwitchCase, type SwitchStatement, type TaggedTemplateExpression, type TemplateElement, type TemplateLiteral, type ThisExpression, type ThrowStatement, type TryStatement, type UnaryExpression, type UnaryOperator, type UpdateExpression, type UpdateOperator, type VariableDeclaration, type VariableDeclarator, type WhileStatement, type WithStatement, type YieldExpression, __STORYBOOK_GLOBAL_THIS_ACCESSOR__, automockModule, babelParser, esmWalker, extractMockCalls, findMockRedirect, getArbitraryModuleIdentifier, getAutomockCode, getIsExternal, getMockerRuntime, getRealPath, isExternal, isFunctionNode, isInDestructuringAssignment, isModuleDirectory, isNodeInPattern, isStaticProperty, isStaticPropertyKey, resolveExternalModule, resolveMock, resolveWithExtensions, rewriteSbMockImportCalls, setIsNodeInPattern };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_zqey0uqkkfj from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_zqey0uqkkfj from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_zqey0uqkkfj from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_zqey0uqkkfj.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_zqey0uqkkfj.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_zqey0uqkkfj.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -16,8 +16,8 @@ import {
|
|
|
16
16
|
join,
|
|
17
17
|
normalize,
|
|
18
18
|
resolve
|
|
19
|
-
} from "../_node-chunks/chunk-
|
|
20
|
-
import "../_node-chunks/chunk-
|
|
19
|
+
} from "../_node-chunks/chunk-74PNH6JI.js";
|
|
20
|
+
import "../_node-chunks/chunk-JFSKHQG7.js";
|
|
21
21
|
|
|
22
22
|
// ../../node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
|
|
23
23
|
var comma = 44, semicolon = 59, chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", intToChar = new Uint8Array(64), charToInt = new Uint8Array(128);
|
|
@@ -1031,8 +1031,8 @@ function getIsExternal(path, importer) {
|
|
|
1031
1031
|
return !1;
|
|
1032
1032
|
}
|
|
1033
1033
|
}
|
|
1034
|
-
function resolveMock(path, root, importer,
|
|
1035
|
-
let isExternal2 = getIsExternal(path, root), externalPath = isExternal2 ? path : null, absolutePath = isExternal2 ? resolveExternalModule(path, root) : require2.resolve(path, { paths: [dirname(importer)] }), normalizedAbsolutePath = resolve(absolutePath), redirectPath =
|
|
1034
|
+
function resolveMock(path, root, importer, findMockRedirect2) {
|
|
1035
|
+
let isExternal2 = getIsExternal(path, root), externalPath = isExternal2 ? path : null, absolutePath = isExternal2 ? resolveExternalModule(path, root) : require2.resolve(path, { paths: [dirname(importer)] }), normalizedAbsolutePath = resolve(absolutePath), redirectPath = findMockRedirect2(root, normalizedAbsolutePath, externalPath);
|
|
1036
1036
|
return {
|
|
1037
1037
|
absolutePath: normalizedAbsolutePath,
|
|
1038
1038
|
redirectPath
|
|
@@ -1084,7 +1084,7 @@ function rewriteSbMockImportCalls(code) {
|
|
|
1084
1084
|
}
|
|
1085
1085
|
}), generate(ast, {}, code);
|
|
1086
1086
|
}
|
|
1087
|
-
function extractMockCalls(options, parse, root,
|
|
1087
|
+
function extractMockCalls(options, parse, root, findMockRedirect2) {
|
|
1088
1088
|
try {
|
|
1089
1089
|
let hasSpyTrue2 = function(objectExpression) {
|
|
1090
1090
|
if (!objectExpression || !objectExpression.properties)
|
|
@@ -1112,7 +1112,7 @@ function extractMockCalls(options, parse, root, findMockRedirect) {
|
|
|
1112
1112
|
path,
|
|
1113
1113
|
root,
|
|
1114
1114
|
options.previewConfigPath,
|
|
1115
|
-
|
|
1115
|
+
findMockRedirect2
|
|
1116
1116
|
), pathWithoutExtension = path.replace(/\.[^/.]+$/, ""), basenameAbsolutePath = basename(absolutePath), basenamePath = basename(path), pathWithoutExtensionAndBasename = basenameAbsolutePath === basenamePath ? pathWithoutExtension : path;
|
|
1117
1117
|
mocks.push({
|
|
1118
1118
|
path: pathWithoutExtensionAndBasename,
|
|
@@ -1136,24 +1136,155 @@ function extractMockCalls(options, parse, root, findMockRedirect) {
|
|
|
1136
1136
|
}
|
|
1137
1137
|
|
|
1138
1138
|
// src/mocking-utils/runtime.ts
|
|
1139
|
-
import {
|
|
1140
|
-
import {
|
|
1141
|
-
var runtimeTemplatePath = join(
|
|
1142
|
-
resolvePackageDir("storybook"),
|
|
1143
|
-
"assets",
|
|
1144
|
-
"server",
|
|
1145
|
-
"mocker-runtime.template.js"
|
|
1146
|
-
);
|
|
1139
|
+
import { readFileSync as readFileSync3 } from "node:fs";
|
|
1140
|
+
import { fileURLToPath } from "node:url";
|
|
1147
1141
|
function getMockerRuntime() {
|
|
1148
|
-
return
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1142
|
+
return readFileSync3(
|
|
1143
|
+
fileURLToPath(import.meta.resolve("storybook/internal/mocking-utils/mocker-runtime")),
|
|
1144
|
+
"utf-8"
|
|
1145
|
+
);
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
// ../../node_modules/@vitest/mocker/dist/redirect.js
|
|
1149
|
+
import fs from "node:fs";
|
|
1150
|
+
import { builtinModules } from "node:module";
|
|
1151
|
+
|
|
1152
|
+
// ../../node_modules/@vitest/mocker/dist/chunk-pathe.M-eThtNZ.js
|
|
1153
|
+
var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
1154
|
+
function normalizeWindowsPath(input = "") {
|
|
1155
|
+
return input && input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r2) => r2.toUpperCase());
|
|
1156
|
+
}
|
|
1157
|
+
var _UNC_REGEX = /^[/\\]{2}/, _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/, _DRIVE_LETTER_RE = /^[A-Za-z]:$/, _EXTNAME_RE = /.(\.[^./]+|\.)$/, normalize2 = function(path) {
|
|
1158
|
+
if (path.length === 0)
|
|
1159
|
+
return ".";
|
|
1160
|
+
path = normalizeWindowsPath(path);
|
|
1161
|
+
let isUNCPath = path.match(_UNC_REGEX), isPathAbsolute = isAbsolute2(path), trailingSeparator = path[path.length - 1] === "/";
|
|
1162
|
+
return path = normalizeString(path, !isPathAbsolute), path.length === 0 ? isPathAbsolute ? "/" : trailingSeparator ? "./" : "." : (trailingSeparator && (path += "/"), _DRIVE_LETTER_RE.test(path) && (path += "/"), isUNCPath ? isPathAbsolute ? `//${path}` : `//./${path}` : isPathAbsolute && !isAbsolute2(path) ? `/${path}` : path);
|
|
1163
|
+
}, join2 = function(...segments) {
|
|
1164
|
+
let path = "";
|
|
1165
|
+
for (let seg of segments)
|
|
1166
|
+
if (seg)
|
|
1167
|
+
if (path.length > 0) {
|
|
1168
|
+
let pathTrailing = path[path.length - 1] === "/", segLeading = seg[0] === "/";
|
|
1169
|
+
pathTrailing && segLeading ? path += seg.slice(1) : path += pathTrailing || segLeading ? seg : `/${seg}`;
|
|
1170
|
+
} else
|
|
1171
|
+
path += seg;
|
|
1172
|
+
return normalize2(path);
|
|
1173
|
+
};
|
|
1174
|
+
function cwd() {
|
|
1175
|
+
return typeof process < "u" && typeof process.cwd == "function" ? process.cwd().replace(/\\/g, "/") : "/";
|
|
1176
|
+
}
|
|
1177
|
+
var resolve2 = function(...arguments_) {
|
|
1178
|
+
arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
|
|
1179
|
+
let resolvedPath = "", resolvedAbsolute = !1;
|
|
1180
|
+
for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
|
1181
|
+
let path = index >= 0 ? arguments_[index] : cwd();
|
|
1182
|
+
!path || path.length === 0 || (resolvedPath = `${path}/${resolvedPath}`, resolvedAbsolute = isAbsolute2(path));
|
|
1183
|
+
}
|
|
1184
|
+
return resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute), resolvedAbsolute && !isAbsolute2(resolvedPath) ? `/${resolvedPath}` : resolvedPath.length > 0 ? resolvedPath : ".";
|
|
1185
|
+
};
|
|
1186
|
+
function normalizeString(path, allowAboveRoot) {
|
|
1187
|
+
let res = "", lastSegmentLength = 0, lastSlash = -1, dots = 0, char = null;
|
|
1188
|
+
for (let index = 0; index <= path.length; ++index) {
|
|
1189
|
+
if (index < path.length)
|
|
1190
|
+
char = path[index];
|
|
1191
|
+
else {
|
|
1192
|
+
if (char === "/")
|
|
1193
|
+
break;
|
|
1194
|
+
char = "/";
|
|
1195
|
+
}
|
|
1196
|
+
if (char === "/") {
|
|
1197
|
+
if (!(lastSlash === index - 1 || dots === 1)) if (dots === 2) {
|
|
1198
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
1199
|
+
if (res.length > 2) {
|
|
1200
|
+
let lastSlashIndex = res.lastIndexOf("/");
|
|
1201
|
+
lastSlashIndex === -1 ? (res = "", lastSegmentLength = 0) : (res = res.slice(0, lastSlashIndex), lastSegmentLength = res.length - 1 - res.lastIndexOf("/")), lastSlash = index, dots = 0;
|
|
1202
|
+
continue;
|
|
1203
|
+
} else if (res.length > 0) {
|
|
1204
|
+
res = "", lastSegmentLength = 0, lastSlash = index, dots = 0;
|
|
1205
|
+
continue;
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
allowAboveRoot && (res += res.length > 0 ? "/.." : "..", lastSegmentLength = 2);
|
|
1209
|
+
} else
|
|
1210
|
+
res.length > 0 ? res += `/${path.slice(lastSlash + 1, index)}` : res = path.slice(lastSlash + 1, index), lastSegmentLength = index - lastSlash - 1;
|
|
1211
|
+
lastSlash = index, dots = 0;
|
|
1212
|
+
} else char === "." && dots !== -1 ? ++dots : dots = -1;
|
|
1213
|
+
}
|
|
1214
|
+
return res;
|
|
1215
|
+
}
|
|
1216
|
+
var isAbsolute2 = function(p) {
|
|
1217
|
+
return _IS_ABSOLUTE_RE.test(p);
|
|
1218
|
+
}, extname = function(p) {
|
|
1219
|
+
if (p === "..") return "";
|
|
1220
|
+
let match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
|
|
1221
|
+
return match && match[1] || "";
|
|
1222
|
+
}, dirname2 = function(p) {
|
|
1223
|
+
let segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
|
|
1224
|
+
return segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0]) && (segments[0] += "/"), segments.join("/") || (isAbsolute2(p) ? "/" : ".");
|
|
1225
|
+
}, basename2 = function(p, extension) {
|
|
1226
|
+
let segments = normalizeWindowsPath(p).split("/"), lastSegment = "";
|
|
1227
|
+
for (let i = segments.length - 1; i >= 0; i--) {
|
|
1228
|
+
let val = segments[i];
|
|
1229
|
+
if (val) {
|
|
1230
|
+
lastSegment = val;
|
|
1231
|
+
break;
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
|
|
1235
|
+
};
|
|
1236
|
+
|
|
1237
|
+
// ../../node_modules/@vitest/mocker/dist/redirect.js
|
|
1238
|
+
var { existsSync, readdirSync, statSync } = fs;
|
|
1239
|
+
function findMockRedirect(root, mockPath, external) {
|
|
1240
|
+
let path = external || mockPath;
|
|
1241
|
+
if (external || isNodeBuiltin(mockPath) || !existsSync(mockPath)) {
|
|
1242
|
+
let findFile = function(mockFolder2, baseOriginal2) {
|
|
1243
|
+
let files = readdirSync(mockFolder2);
|
|
1244
|
+
for (let file of files)
|
|
1245
|
+
if (basename2(file, extname(file)) === baseOriginal2) {
|
|
1246
|
+
let path2 = resolve2(mockFolder2, file);
|
|
1247
|
+
if (statSync(path2).isFile())
|
|
1248
|
+
return path2;
|
|
1249
|
+
{
|
|
1250
|
+
let indexFile = findFile(path2, "index");
|
|
1251
|
+
if (indexFile)
|
|
1252
|
+
return indexFile;
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
return null;
|
|
1256
|
+
}, mockDirname = dirname2(path), mockFolder = join2(root, "__mocks__", mockDirname);
|
|
1257
|
+
if (!existsSync(mockFolder))
|
|
1258
|
+
return null;
|
|
1259
|
+
let baseOriginal = basename2(path);
|
|
1260
|
+
return findFile(mockFolder, baseOriginal);
|
|
1261
|
+
}
|
|
1262
|
+
let dir = dirname2(path), baseId = basename2(path), fullPath = resolve2(dir, "__mocks__", baseId);
|
|
1263
|
+
return existsSync(fullPath) ? fullPath : null;
|
|
1264
|
+
}
|
|
1265
|
+
var builtins = /* @__PURE__ */ new Set([
|
|
1266
|
+
...builtinModules,
|
|
1267
|
+
"assert/strict",
|
|
1268
|
+
"diagnostics_channel",
|
|
1269
|
+
"dns/promises",
|
|
1270
|
+
"fs/promises",
|
|
1271
|
+
"path/posix",
|
|
1272
|
+
"path/win32",
|
|
1273
|
+
"readline/promises",
|
|
1274
|
+
"stream/consumers",
|
|
1275
|
+
"stream/promises",
|
|
1276
|
+
"stream/web",
|
|
1277
|
+
"timers/promises",
|
|
1278
|
+
"util/types",
|
|
1279
|
+
"wasi"
|
|
1280
|
+
]), prefixedBuiltins = /* @__PURE__ */ new Set([
|
|
1281
|
+
"node:sea",
|
|
1282
|
+
"node:sqlite",
|
|
1283
|
+
"node:test",
|
|
1284
|
+
"node:test/reporters"
|
|
1285
|
+
]), NODE_BUILTIN_NAMESPACE = "node:";
|
|
1286
|
+
function isNodeBuiltin(id) {
|
|
1287
|
+
return prefixedBuiltins.has(id) ? !0 : builtins.has(id.startsWith(NODE_BUILTIN_NAMESPACE) ? id.slice(NODE_BUILTIN_NAMESPACE.length) : id);
|
|
1157
1288
|
}
|
|
1158
1289
|
export {
|
|
1159
1290
|
__STORYBOOK_GLOBAL_THIS_ACCESSOR__,
|
|
@@ -1161,6 +1292,7 @@ export {
|
|
|
1161
1292
|
babelParser,
|
|
1162
1293
|
esmWalker,
|
|
1163
1294
|
extractMockCalls,
|
|
1295
|
+
findMockRedirect,
|
|
1164
1296
|
getArbitraryModuleIdentifier,
|
|
1165
1297
|
getAutomockCode,
|
|
1166
1298
|
getIsExternal,
|