Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@storybook/core

Package Overview
Dependencies
Maintainers
12
Versions
1338
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@storybook/core - npm Package Compare versions

Comparing version 0.0.0-pr-29643-sha-32a95d9e to 0.0.0-pr-29643-sha-82899600

20

dist/core-events/index.d.ts

@@ -96,17 +96,7 @@ import { ArgTypes } from '@storybook/csf';

type TestProviders = Record<TestProviderId, TestProviderConfig & TestProviderState>;
type TestingModuleRunRequestStory = {
id: string;
name: string;
};
type TestingModuleRunRequestPayload = {
providerId: TestProviderId;
payload: {
importPath: string;
stories?: TestingModuleRunRequestStory[];
componentPath?: string;
}[];
indexUrl: string;
storyIds?: string[];
};
type TestingModuleRunAllRequestPayload = {
providerId: TestProviderId;
};
type TestingModuleProgressReportPayload = {

@@ -181,3 +171,3 @@ providerId: TestProviderId;

id: string;
version: number;
version?: number;
result: T;

@@ -253,3 +243,2 @@ status: 'failed' | 'passed' | 'warning';

TESTING_MODULE_RUN_REQUEST = "testingModuleRunRequest",
TESTING_MODULE_RUN_ALL_REQUEST = "testingModuleRunAllRequest",
TESTING_MODULE_CANCEL_TEST_RUN_REQUEST = "testingModuleCancelTestRunRequest",

@@ -319,3 +308,2 @@ TESTING_MODULE_CANCEL_TEST_RUN_RESPONSE = "testingModuleCancelTestRunResponse",

declare const TESTING_MODULE_RUN_REQUEST: events;
declare const TESTING_MODULE_RUN_ALL_REQUEST: events;
declare const TESTING_MODULE_CANCEL_TEST_RUN_REQUEST: events;

@@ -325,2 +313,2 @@ declare const TESTING_MODULE_CANCEL_TEST_RUN_RESPONSE: events;

export { ARGTYPES_INFO_REQUEST, ARGTYPES_INFO_RESPONSE, type ArgTypesRequestPayload, type ArgTypesResponsePayload, CHANNEL_CREATED, CHANNEL_WS_DISCONNECT, CONFIG_ERROR, CREATE_NEW_STORYFILE_REQUEST, CREATE_NEW_STORYFILE_RESPONSE, CURRENT_STORY_WAS_SET, type CreateNewStoryErrorPayload, type CreateNewStoryRequestPayload, type CreateNewStoryResponsePayload, DOCS_PREPARED, DOCS_RENDERED, FILE_COMPONENT_SEARCH_REQUEST, FILE_COMPONENT_SEARCH_RESPONSE, FORCE_REMOUNT, FORCE_RE_RENDER, type FileComponentSearchRequestPayload, type FileComponentSearchResponsePayload, GLOBALS_UPDATED, NAVIGATE_URL, PLAY_FUNCTION_THREW_EXCEPTION, PRELOAD_ENTRIES, PREVIEW_BUILDER_PROGRESS, PREVIEW_KEYDOWN, REGISTER_SUBSCRIPTION, REQUEST_WHATS_NEW_DATA, RESET_STORY_ARGS, RESULT_WHATS_NEW_DATA, type RequestData, type ResponseData, SAVE_STORY_REQUEST, SAVE_STORY_RESPONSE, SELECT_STORY, SET_CONFIG, SET_CURRENT_STORY, SET_FILTER, SET_GLOBALS, SET_INDEX, SET_STORIES, SET_WHATS_NEW_CACHE, SHARED_STATE_CHANGED, SHARED_STATE_SET, STORIES_COLLAPSE_ALL, STORIES_EXPAND_ALL, STORY_ARGS_UPDATED, STORY_CHANGED, STORY_ERRORED, STORY_FINISHED, STORY_INDEX_INVALIDATED, STORY_MISSING, STORY_PREPARED, STORY_RENDERED, STORY_RENDER_PHASE_CHANGED, STORY_SPECIFIED, STORY_THREW_EXCEPTION, STORY_UNCHANGED, type SaveStoryRequestPayload, type SaveStoryResponsePayload, type Status, type StoryFinishedPayload, TELEMETRY_ERROR, TESTING_MODULE_CANCEL_TEST_RUN_REQUEST, TESTING_MODULE_CANCEL_TEST_RUN_RESPONSE, TESTING_MODULE_CRASH_REPORT, TESTING_MODULE_PROGRESS_REPORT, TESTING_MODULE_RUN_ALL_REQUEST, TESTING_MODULE_RUN_REQUEST, TESTING_MODULE_WATCH_MODE_REQUEST, TOGGLE_WHATS_NEW_NOTIFICATIONS, type TestProviderConfig, type TestProviderId, type TestProviderState, type TestProviders, type TestingModuleCancelTestRunRequestPayload, type TestingModuleCancelTestRunResponsePayload, type TestingModuleCrashReportPayload, type TestingModuleProgressReportPayload, type TestingModuleProgressReportProgress, type TestingModuleRunAllRequestPayload, type TestingModuleRunRequestPayload, type TestingModuleRunRequestStory, type TestingModuleWatchModeRequestPayload, UNHANDLED_ERRORS_WHILE_PLAYING, UPDATE_GLOBALS, UPDATE_QUERY_PARAMS, UPDATE_STORY_ARGS, type WhatsNewCache, type WhatsNewData, events as default };
export { ARGTYPES_INFO_REQUEST, ARGTYPES_INFO_RESPONSE, type ArgTypesRequestPayload, type ArgTypesResponsePayload, CHANNEL_CREATED, CHANNEL_WS_DISCONNECT, CONFIG_ERROR, CREATE_NEW_STORYFILE_REQUEST, CREATE_NEW_STORYFILE_RESPONSE, CURRENT_STORY_WAS_SET, type CreateNewStoryErrorPayload, type CreateNewStoryRequestPayload, type CreateNewStoryResponsePayload, DOCS_PREPARED, DOCS_RENDERED, FILE_COMPONENT_SEARCH_REQUEST, FILE_COMPONENT_SEARCH_RESPONSE, FORCE_REMOUNT, FORCE_RE_RENDER, type FileComponentSearchRequestPayload, type FileComponentSearchResponsePayload, GLOBALS_UPDATED, NAVIGATE_URL, PLAY_FUNCTION_THREW_EXCEPTION, PRELOAD_ENTRIES, PREVIEW_BUILDER_PROGRESS, PREVIEW_KEYDOWN, REGISTER_SUBSCRIPTION, REQUEST_WHATS_NEW_DATA, RESET_STORY_ARGS, RESULT_WHATS_NEW_DATA, type RequestData, type ResponseData, SAVE_STORY_REQUEST, SAVE_STORY_RESPONSE, SELECT_STORY, SET_CONFIG, SET_CURRENT_STORY, SET_FILTER, SET_GLOBALS, SET_INDEX, SET_STORIES, SET_WHATS_NEW_CACHE, SHARED_STATE_CHANGED, SHARED_STATE_SET, STORIES_COLLAPSE_ALL, STORIES_EXPAND_ALL, STORY_ARGS_UPDATED, STORY_CHANGED, STORY_ERRORED, STORY_FINISHED, STORY_INDEX_INVALIDATED, STORY_MISSING, STORY_PREPARED, STORY_RENDERED, STORY_RENDER_PHASE_CHANGED, STORY_SPECIFIED, STORY_THREW_EXCEPTION, STORY_UNCHANGED, type SaveStoryRequestPayload, type SaveStoryResponsePayload, type Status, type StoryFinishedPayload, TELEMETRY_ERROR, TESTING_MODULE_CANCEL_TEST_RUN_REQUEST, TESTING_MODULE_CANCEL_TEST_RUN_RESPONSE, TESTING_MODULE_CRASH_REPORT, TESTING_MODULE_PROGRESS_REPORT, TESTING_MODULE_RUN_REQUEST, TESTING_MODULE_WATCH_MODE_REQUEST, TOGGLE_WHATS_NEW_NOTIFICATIONS, type TestProviderConfig, type TestProviderId, type TestProviderState, type TestProviders, type TestingModuleCancelTestRunRequestPayload, type TestingModuleCancelTestRunResponsePayload, type TestingModuleCrashReportPayload, type TestingModuleProgressReportPayload, type TestingModuleProgressReportProgress, type TestingModuleRunRequestPayload, type TestingModuleWatchModeRequestPayload, UNHANDLED_ERRORS_WHILE_PLAYING, UPDATE_GLOBALS, UPDATE_QUERY_PARAMS, UPDATE_STORY_ARGS, type WhatsNewCache, type WhatsNewData, events as default };

96

dist/core-events/index.js

@@ -19,9 +19,9 @@ // src/core-events/index.ts

"createNewStoryfileRequest", E.CREATE_NEW_STORYFILE_RESPONSE = "createNewStoryfileResponse", E.TESTING_MODULE_CRASH_REPORT = "testingModuleC\
rashReport", E.TESTING_MODULE_PROGRESS_REPORT = "testingModuleProgressReport", E.TESTING_MODULE_RUN_REQUEST = "testingModuleRunRequest", E.TESTING_MODULE_RUN_ALL_REQUEST =
"testingModuleRunAllRequest", E.TESTING_MODULE_CANCEL_TEST_RUN_REQUEST = "testingModuleCancelTestRunRequest", E.TESTING_MODULE_CANCEL_TEST_RUN_RESPONSE =
"testingModuleCancelTestRunResponse", E.TESTING_MODULE_WATCH_MODE_REQUEST = "testingModuleWatchModeRequest", E))(_ || {}), R = _, {
rashReport", E.TESTING_MODULE_PROGRESS_REPORT = "testingModuleProgressReport", E.TESTING_MODULE_RUN_REQUEST = "testingModuleRunRequest", E.TESTING_MODULE_CANCEL_TEST_RUN_REQUEST =
"testingModuleCancelTestRunRequest", E.TESTING_MODULE_CANCEL_TEST_RUN_RESPONSE = "testingModuleCancelTestRunResponse", E.TESTING_MODULE_WATCH_MODE_REQUEST =
"testingModuleWatchModeRequest", E))(_ || {}), R = _, {
CHANNEL_WS_DISCONNECT: S,
CHANNEL_CREATED: T,
CONFIG_ERROR: N,
CREATE_NEW_STORYFILE_REQUEST: O,
CONFIG_ERROR: O,
CREATE_NEW_STORYFILE_REQUEST: N,
CREATE_NEW_STORYFILE_RESPONSE: A,

@@ -36,16 +36,16 @@ CURRENT_STORY_WAS_SET: r,

GLOBALS_UPDATED: U,
NAVIGATE_URL: G,
PLAY_FUNCTION_THREW_EXCEPTION: a,
NAVIGATE_URL: a,
PLAY_FUNCTION_THREW_EXCEPTION: G,
UNHANDLED_ERRORS_WHILE_PLAYING: Y,
PRELOAD_ENTRIES: t,
PREVIEW_BUILDER_PROGRESS: e,
PREVIEW_KEYDOWN: d,
REGISTER_SUBSCRIPTION: H,
RESET_STORY_ARGS: W,
SELECT_STORY: l,
SET_CONFIG: i,
PREVIEW_BUILDER_PROGRESS: H,
PREVIEW_KEYDOWN: W,
REGISTER_SUBSCRIPTION: d,
RESET_STORY_ARGS: e,
SELECT_STORY: i,
SET_CONFIG: l,
SET_CURRENT_STORY: p,
SET_FILTER: M,
SET_GLOBALS: u,
SET_INDEX: F,
SET_GLOBALS: F,
SET_INDEX: u,
SET_STORIES: s,

@@ -69,7 +69,7 @@ SHARED_STATE_CHANGED: y,

UPDATE_GLOBALS: k,
UPDATE_QUERY_PARAMS: n,
UPDATE_STORY_ARGS: z,
REQUEST_WHATS_NEW_DATA: J,
RESULT_WHATS_NEW_DATA: Z,
SET_WHATS_NEW_CACHE: $,
UPDATE_QUERY_PARAMS: z,
UPDATE_STORY_ARGS: J,
REQUEST_WHATS_NEW_DATA: Z,
RESULT_WHATS_NEW_DATA: $,
SET_WHATS_NEW_CACHE: n,
TOGGLE_WHATS_NEW_NOTIFICATIONS: v,

@@ -81,9 +81,8 @@ TELEMETRY_ERROR: EE,

ARGTYPES_INFO_RESPONSE: TE,
TESTING_MODULE_CRASH_REPORT: NE,
TESTING_MODULE_PROGRESS_REPORT: OE,
TESTING_MODULE_CRASH_REPORT: OE,
TESTING_MODULE_PROGRESS_REPORT: NE,
TESTING_MODULE_RUN_REQUEST: AE,
TESTING_MODULE_RUN_ALL_REQUEST: rE,
TESTING_MODULE_CANCEL_TEST_RUN_REQUEST: DE,
TESTING_MODULE_CANCEL_TEST_RUN_RESPONSE: IE,
TESTING_MODULE_WATCH_MODE_REQUEST: oE
TESTING_MODULE_CANCEL_TEST_RUN_REQUEST: rE,
TESTING_MODULE_CANCEL_TEST_RUN_RESPONSE: DE,
TESTING_MODULE_WATCH_MODE_REQUEST: IE
} = _;

@@ -95,4 +94,4 @@ export {

S as CHANNEL_WS_DISCONNECT,
N as CONFIG_ERROR,
O as CREATE_NEW_STORYFILE_REQUEST,
O as CONFIG_ERROR,
N as CREATE_NEW_STORYFILE_REQUEST,
A as CREATE_NEW_STORYFILE_RESPONSE,

@@ -107,21 +106,21 @@ r as CURRENT_STORY_WAS_SET,

U as GLOBALS_UPDATED,
G as NAVIGATE_URL,
a as PLAY_FUNCTION_THREW_EXCEPTION,
a as NAVIGATE_URL,
G as PLAY_FUNCTION_THREW_EXCEPTION,
t as PRELOAD_ENTRIES,
e as PREVIEW_BUILDER_PROGRESS,
d as PREVIEW_KEYDOWN,
H as REGISTER_SUBSCRIPTION,
J as REQUEST_WHATS_NEW_DATA,
W as RESET_STORY_ARGS,
Z as RESULT_WHATS_NEW_DATA,
H as PREVIEW_BUILDER_PROGRESS,
W as PREVIEW_KEYDOWN,
d as REGISTER_SUBSCRIPTION,
Z as REQUEST_WHATS_NEW_DATA,
e as RESET_STORY_ARGS,
$ as RESULT_WHATS_NEW_DATA,
_E as SAVE_STORY_REQUEST,
RE as SAVE_STORY_RESPONSE,
l as SELECT_STORY,
i as SET_CONFIG,
i as SELECT_STORY,
l as SET_CONFIG,
p as SET_CURRENT_STORY,
M as SET_FILTER,
u as SET_GLOBALS,
F as SET_INDEX,
F as SET_GLOBALS,
u as SET_INDEX,
s as SET_STORIES,
$ as SET_WHATS_NEW_CACHE,
n as SET_WHATS_NEW_CACHE,
y as SHARED_STATE_CHANGED,

@@ -144,15 +143,14 @@ c as SHARED_STATE_SET,

EE as TELEMETRY_ERROR,
DE as TESTING_MODULE_CANCEL_TEST_RUN_REQUEST,
IE as TESTING_MODULE_CANCEL_TEST_RUN_RESPONSE,
NE as TESTING_MODULE_CRASH_REPORT,
OE as TESTING_MODULE_PROGRESS_REPORT,
rE as TESTING_MODULE_RUN_ALL_REQUEST,
rE as TESTING_MODULE_CANCEL_TEST_RUN_REQUEST,
DE as TESTING_MODULE_CANCEL_TEST_RUN_RESPONSE,
OE as TESTING_MODULE_CRASH_REPORT,
NE as TESTING_MODULE_PROGRESS_REPORT,
AE as TESTING_MODULE_RUN_REQUEST,
oE as TESTING_MODULE_WATCH_MODE_REQUEST,
IE as TESTING_MODULE_WATCH_MODE_REQUEST,
v as TOGGLE_WHATS_NEW_NOTIFICATIONS,
Y as UNHANDLED_ERRORS_WHILE_PLAYING,
k as UPDATE_GLOBALS,
n as UPDATE_QUERY_PARAMS,
z as UPDATE_STORY_ARGS,
z as UPDATE_QUERY_PARAMS,
J as UPDATE_STORY_ARGS,
R as default
};

@@ -14,9 +14,9 @@ import ESM_COMPAT_Module from "node:module";

var Ve = (s, e) => () => (e || s((e = { exports: {} }).exports, e), e.exports);
var Ae = (s, e, i, t) => {
var Ae = (s, e, r, t) => {
if (e && typeof e == "object" || typeof e == "function")
for (let r of Ce(e))
!ke.call(s, r) && r !== i && U(s, r, { get: () => e[r], enumerable: !(t = Fe(e, r)) || t.enumerable });
for (let i of Ce(e))
!ke.call(s, i) && i !== r && U(s, i, { get: () => e[i], enumerable: !(t = Fe(e, i)) || t.enumerable });
return s;
};
var L = (s, e, i) => (i = s != null ? we(Te(s)) : {}, Ae(
var L = (s, e, r) => (r = s != null ? we(Te(s)) : {}, Ae(
// If the importer is in node compatibility mode or this is not an ESM

@@ -26,3 +26,3 @@ // file that has been converted to a CommonJS file using a Babel-

// "default" to the CommonJS "module.exports" for node compatibility.
e || !s || !s.__esModule ? U(i, "default", { value: s, enumerable: !0 }) : i,
e || !s || !s.__esModule ? U(r, "default", { value: s, enumerable: !0 }) : r,
s

@@ -37,7 +37,7 @@ ));

function ee(s) {
for (var e = [], i = 1; i < arguments.length; i++)
e[i - 1] = arguments[i];
for (var e = [], r = 1; r < arguments.length; r++)
e[r - 1] = arguments[r];
var t = Array.from(typeof s == "string" ? [s] : s);
t[t.length - 1] = t[t.length - 1].replace(/\r?\n([\t ]*)$/, "");
var r = t.reduce(function(l, u) {
var i = t.reduce(function(l, u) {
var f = u.match(/\n([\t ]+|(?!\s).)/g);

@@ -49,5 +49,5 @@ return f ? l.concat(f.map(function(x) {

}, []);
if (r.length) {
if (i.length) {
var a = new RegExp(`
[ ]{` + Math.min.apply(Math, r) + "}", "g");
[ ]{` + Math.min.apply(Math, i) + "}", "g");
t = t.map(function(l) {

@@ -91,6 +91,6 @@ return l.replace(a, `

var O = /* @__PURE__ */ p((s, e) => {
let i = null, t = null;
return e.body.find((r) => (C.isVariableDeclaration(r) ? t = r.declarations : C.isExportNamedDeclaration(r) && C.isVariableDeclaration(r.declaration) &&
(t = r.declaration.declarations), t && t.find((a) => C.isVariableDeclarator(a) && C.isIdentifier(a.id) && a.id.name === s ? (i = a.init, !0) :
!1))), i;
let r = null, t = null;
return e.body.find((i) => (C.isVariableDeclaration(i) ? t = i.declarations : C.isExportNamedDeclaration(i) && C.isVariableDeclaration(i.declaration) &&
(t = i.declaration.declarations), t && t.find((a) => C.isVariableDeclarator(a) && C.isIdentifier(a.id) && a.id.name === s ? (r = a.init, !0) :
!1))), r;
}, "findVarInitialization");

@@ -125,12 +125,12 @@

var q = /* @__PURE__ */ p((s, e) => {
let { line: i, column: t } = s.loc?.start || {};
return `${e || ""} (line ${i}, col ${t})`.trim();
}, "formatLocation"), We = /* @__PURE__ */ p((s) => Je.test(s), "isModuleMock"), ne = /* @__PURE__ */ p((s, e, i) => {
let { line: r, column: t } = s.loc?.start || {};
return `${e || ""} (line ${r}, col ${t})`.trim();
}, "formatLocation"), We = /* @__PURE__ */ p((s) => Je.test(s), "isModuleMock"), ne = /* @__PURE__ */ p((s, e, r) => {
let t = s;
if (c.isCallExpression(s)) {
let { callee: r, arguments: a } = s;
if (c.isProgram(e) && c.isMemberExpression(r) && c.isIdentifier(r.object) && c.isIdentifier(r.property) && r.property.name === "bind" &&
let { callee: i, arguments: a } = s;
if (c.isProgram(e) && c.isMemberExpression(i) && c.isIdentifier(i.object) && c.isIdentifier(i.property) && i.property.name === "bind" &&
(a.length === 0 || a.length === 1 && c.isObjectExpression(a[0]) && a[0].properties.length === 0)) {
let n = r.object.name, l = O(n, e);
l && (i._templates[n] = l, t = l);
let n = i.object.name, l = O(n, e);
l && (r._templates[n] = l, t = l);
}

@@ -148,5 +148,5 @@ }

}, "parseExportsOrder"), oe = /* @__PURE__ */ p((s, e) => e.reduce(
(i, t) => {
let r = s[t];
return r && (i[t] = r), i;
(r, t) => {
let i = s[t];
return i && (r[t] = i), r;
},

@@ -158,5 +158,5 @@ {}

if (e.length >= 1) {
let [i] = e;
if (c.isObjectPattern(i))
return !!i.properties.find((t) => {
let [r] = e;
if (c.isObjectPattern(r))
return !!r.properties.find((t) => {
if (c.isObjectProperty(t) && c.isIdentifier(t.key))

@@ -172,5 +172,5 @@ return t.key.name === "mount";

}
constructor(e, i, t) {
constructor(e, r, t) {
super(T.dedent`
CSF: ${e} ${q(i, t)}
CSF: ${e} ${q(r, t)}

@@ -181,3 +181,3 @@ More info: https://storybook.js.org/docs/writing-stories#default-export

}, B = class {
constructor(e, i, t) {
constructor(e, r, t) {
this._stories = {};

@@ -189,3 +189,3 @@ this._metaAnnotations = {};

this._templates = {};
this._ast = e, this._file = t, this._options = i, this.imports = [];
this._ast = e, this._file = t, this._options = r, this.imports = [];
}

@@ -204,9 +204,9 @@ static {

_parseTitle(e) {
let i = c.isIdentifier(e) ? O(e.name, this._ast.program) : e;
if (c.isStringLiteral(i))
return i.value;
if (c.isTSSatisfiesExpression(i) && c.isStringLiteral(i.expression))
return i.expression.value;
let r = c.isIdentifier(e) ? O(e.name, this._ast.program) : e;
if (c.isStringLiteral(r))
return r.value;
if (c.isTSSatisfiesExpression(r) && c.isStringLiteral(r.expression))
return r.expression.value;
throw new Error(T.dedent`
CSF: unexpected dynamic title ${q(i, this._options.fileName)}
CSF: unexpected dynamic title ${q(r, this._options.fileName)}

@@ -216,14 +216,14 @@ More info: https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#string-literal-titles

}
_parseMeta(e, i) {
_parseMeta(e, r) {
let t = {};
e.properties.forEach((r) => {
if (c.isIdentifier(r.key)) {
if (this._metaAnnotations[r.key.name] = r.value, r.key.name === "title")
t.title = this._parseTitle(r.value);
else if (["includeStories", "excludeStories"].includes(r.key.name))
t[r.key.name] = Be(r.value);
else if (r.key.name === "component") {
let a = r.value;
e.properties.forEach((i) => {
if (c.isIdentifier(i.key)) {
if (this._metaAnnotations[i.key.name] = i.value, i.key.name === "title")
t.title = this._parseTitle(i.value);
else if (["includeStories", "excludeStories"].includes(i.key.name))
t[i.key.name] = Be(i.value);
else if (i.key.name === "component") {
let a = i.value;
if (c.isIdentifier(a)) {
let l = a.name, u = i.body.find(
let l = a.name, u = r.body.find(
(f) => c.isImportDeclaration(f) && f.specifiers.find((x) => x.local.name === l)

@@ -236,12 +236,12 @@ );

}
let { code: n } = le.print(r.value, {});
let { code: n } = le.print(i.value, {});
t.component = n;
} else if (r.key.name === "tags") {
let a = r.value;
} else if (i.key.name === "tags") {
let a = i.value;
c.isIdentifier(a) && (a = O(a.name, this._ast.program)), t.tags = se(a);
} else if (r.key.name === "id")
if (c.isStringLiteral(r.value))
t.id = r.value.value;
} else if (i.key.name === "id")
if (c.isStringLiteral(i.value))
t.id = i.value.value;
else
throw new Error(`Unexpected component id: ${r.value}`);
throw new Error(`Unexpected component id: ${i.value}`);
}

@@ -251,12 +251,12 @@ }), this._meta = t;

getStoryExport(e) {
let i = this._storyExports[e];
if (i = c.isVariableDeclarator(i) ? i.init : i, c.isCallExpression(i)) {
let { callee: t, arguments: r } = i;
if (c.isMemberExpression(t) && c.isIdentifier(t.object) && c.isIdentifier(t.property) && t.property.name === "bind" && (r.length === 0 ||
r.length === 1 && c.isObjectExpression(r[0]) && r[0].properties.length === 0)) {
let r = this._storyExports[e];
if (r = c.isVariableDeclarator(r) ? r.init : r, c.isCallExpression(r)) {
let { callee: t, arguments: i } = r;
if (c.isMemberExpression(t) && c.isIdentifier(t.object) && c.isIdentifier(t.property) && t.property.name === "bind" && (i.length === 0 ||
i.length === 1 && c.isObjectExpression(i[0]) && i[0].properties.length === 0)) {
let { name: a } = t.object;
i = this._templates[a];
r = this._templates[a];
}
}
return i;
return r;
}

@@ -268,8 +268,8 @@ parse() {

enter(t) {
let { node: r, parent: a } = t, n = c.isIdentifier(r.declaration) && c.isProgram(a);
if (e._options.transformInlineMeta && !n && c.isExpression(r.declaration)) {
let { node: i, parent: a } = t, n = c.isIdentifier(i.declaration) && c.isProgram(a);
if (e._options.transformInlineMeta && !n && c.isExpression(i.declaration)) {
let f = t.scope.generateUidIdentifier("meta");
e._metaVariableName = f.name;
let x = [
c.variableDeclaration("const", [c.variableDeclarator(f, r.declaration)]),
c.variableDeclaration("const", [c.variableDeclarator(f, i.declaration)]),
c.exportDefaultDeclaration(f)

@@ -281,3 +281,3 @@ ];

if (n) {
let f = r.declaration.name;
let f = i.declaration.name;
e._metaVariableName = f;

@@ -291,3 +291,3 @@ let x = /* @__PURE__ */ p((g) => c.isIdentifier(g.id) && g.id.name === f, "isVariableDeclarator");

} else
e._metaStatement = r, u = r.declaration;
e._metaStatement = i, u = i.declaration;
if (c.isObjectExpression(u) ? l = u : (

@@ -305,3 +305,3 @@ // export default { ... } as Meta<...>

ExportNamedDeclaration: {
enter({ node: t, parent: r }) {
enter({ node: t, parent: i }) {
let a;

@@ -330,3 +330,3 @@ c.isVariableDeclaration(t.declaration) ? a = t.declaration.declarations.filter((n) => c.isVariableDeclarator(n)) : c.isFunctionDeclaration(

g.value,
r,
i,
e

@@ -348,3 +348,3 @@ );

}
})) : x.__isArgsStory = ne(f, r, e), e._stories[l] = {
})) : x.__isArgsStory = ne(f, i, e), e._stories[l] = {
id: "FIXME",

@@ -358,3 +358,3 @@ name: u,

if (c.isExportSpecifier(n) && c.isIdentifier(n.exported)) {
let { name: l } = n.exported, { name: u } = n.local, f = c.isProgram(r) ? O(n.local.name, r) : n.local;
let { name: l } = n.exported, { name: u } = n.local, f = c.isProgram(i) ? O(n.local.name, i) : n.local;
if (l === "default") {

@@ -365,3 +365,3 @@ let x;

c.isTSAsExpression(f) && c.isObjectExpression(f.expression) && (x = f.expression)
), !e._meta && x && c.isProgram(r) && e._parseMeta(x, r);
), !e._meta && x && c.isProgram(i) && e._parseMeta(x, i);
} else

@@ -380,5 +380,5 @@ e._storyAnnotations[l] = {}, e._storyStatements[l] = f, e._stories[l] = {

ExpressionStatement: {
enter({ node: t, parent: r }) {
enter({ node: t, parent: i }) {
let { expression: a } = t;
if (c.isProgram(r) && c.isAssignmentExpression(a) && c.isMemberExpression(a.left) && c.isIdentifier(a.left.object) && c.isIdentifier(
if (c.isProgram(i) && c.isAssignmentExpression(a) && c.isMemberExpression(a.left) && c.isIdentifier(a.left.object) && c.isIdentifier(
a.left.property)) {

@@ -399,4 +399,4 @@ let n = a.left.object.name, l = a.left.property.name, u = a.right;

enter({ node: t }) {
let { callee: r } = t;
if (c.isIdentifier(r) && r.name === "storiesOf")
let { callee: i } = t;
if (c.isIdentifier(i) && i.name === "storiesOf")
throw new Error(T.dedent`

@@ -411,5 +411,5 @@ Unexpected \`storiesOf\` usage: ${q(t, e._options.fileName)}.

enter({ node: t }) {
let { source: r } = t;
if (c.isStringLiteral(r))
e.imports.push(r.value);
let { source: i } = t;
if (c.isStringLiteral(i))
e.imports.push(i.value);
else

@@ -421,22 +421,22 @@ throw new Error("CSF: unexpected import source");

throw new M("missing default export", e._ast, e._options.fileName);
let i = Object.entries(e._stories);
let r = Object.entries(e._stories);
if (e._meta.title = this._options.makeTitle(e._meta?.title), e._metaAnnotations.play && (e._meta.tags = [...e._meta.tags || [], "play-fn"]),
e._stories = i.reduce(
(t, [r, a]) => {
if (!te(r, e._meta))
e._stories = r.reduce(
(t, [i, a]) => {
if (!te(i, e._meta))
return t;
let n = a.parameters?.__id ?? qe(e._meta?.id || e._meta?.title, re(r)), l = { ...a.parameters, __id: n }, { includeStories: u } = e.
let n = a.parameters?.__id ?? qe(e._meta?.id || e._meta?.title, re(i)), l = { ...a.parameters, __id: n }, { includeStories: u } = e.
_meta || {};
r === "__page" && (i.length === 1 || Array.isArray(u) && u.length === 1) && (l.docsOnly = !0), t[r] = { ...a, id: n, parameters: l };
let f = e._storyAnnotations[r], { tags: x, play: g } = f;
i === "__page" && (r.length === 1 || Array.isArray(u) && u.length === 1) && (l.docsOnly = !0), t[i] = { ...a, id: n, parameters: l };
let f = e._storyAnnotations[i], { tags: x, play: g } = f;
if (x) {
let S = c.isIdentifier(x) ? O(x.name, this._ast.program) : x;
t[r].tags = se(S);
t[i].tags = se(S);
}
g && (t[r].tags = [...t[r].tags || [], "play-fn"]);
let b = t[r].__stats;
g && (t[i].tags = [...t[i].tags || [], "play-fn"]);
let b = t[i].__stats;
["play", "render", "loaders", "beforeEach", "globals"].forEach((S) => {
b[S] = !!f[S] || !!e._metaAnnotations[S];
});
let _ = e.getStoryExport(r);
let _ = e.getStoryExport(i);
return b.storyFn = !!(c.isArrowFunctionExpression(_) || c.isFunctionDeclaration(_)), b.mount = Ge(f.play ?? e._metaAnnotations.play),

@@ -451,7 +451,7 @@ b.moduleMock = !!e.imports.find((S) => We(S)), t;

e._storyExports = oe(e._storyExports, e._namedExportsOrder), e._stories = oe(e._stories, e._namedExportsOrder);
let r = Object.keys(e._storyExports);
if (t.length !== r.length)
let i = Object.keys(e._storyExports);
if (t.length !== i.length)
throw new Error(
`Missing exports after sort: ${t.filter(
(a) => !r.includes(a)
(a) => !i.includes(a)
)}`

@@ -475,4 +475,4 @@ );

);
return Object.entries(this._stories).map(([i, t]) => {
let r = [...this._meta?.tags ?? [], ...t.tags ?? []];
return Object.entries(this._stories).map(([r, t]) => {
let i = [...this._meta?.tags ?? [], ...t.tags ?? []];
return {

@@ -482,7 +482,7 @@ type: "story",

rawComponentPath: this._rawComponentPath,
exportName: i,
exportName: r,
name: t.name,
title: this.meta?.title,
metaId: this.meta?.id,
tags: r,
tags: i,
__id: t.id,

@@ -496,12 +496,12 @@ __stats: t.__stats

filename: e = "",
ast: i
}) => new Me({ filename: e }, { code: s, ast: i ?? ae(s) }), "babelParseFile"), W = /* @__PURE__ */ p((s, e) => {
let i = ae(s), t = Ke({ code: s, filename: e.fileName, ast: i });
return new B(i, e, t);
}, "loadCsf"), ce = /* @__PURE__ */ p((s, e = { sourceMaps: !1 }, i) => {
let t = $e(s._ast, e, i);
ast: r
}) => new Me({ filename: e }, { code: s, ast: r ?? ae(s) }), "babelParseFile"), W = /* @__PURE__ */ p((s, e) => {
let r = ae(s), t = Ke({ code: s, filename: e.fileName, ast: r });
return new B(r, e, t);
}, "loadCsf"), ce = /* @__PURE__ */ p((s, e = { sourceMaps: !1 }, r) => {
let t = $e(s._ast, e, r);
return e.sourceMaps ? t : t.code;
}, "formatCsf"), Xe = /* @__PURE__ */ p((s, e = {}) => le.print(s._ast, e), "printCsf"), Dt = /* @__PURE__ */ p(async (s, e) => {
let i = (await Re(s, "utf-8")).toString();
return W(i, { ...e, fileName: s });
let r = (await Re(s, "utf-8")).toString();
return W(r, { ...e, fileName: s });
}, "readCsf"), vt = /* @__PURE__ */ p(async (s, e) => {

@@ -526,12 +526,12 @@ if (!(e || s._options.fileName))

foundType: e,
node: i
node: r
}) => {
let t = "";
if (i)
if (r)
try {
t = JSON.stringify(i);
t = JSON.stringify(r);
} catch {
}
return ue.dedent`
CSF Parsing error: Expected '${s}' but found '${e}' instead in '${i?.type}'.
CSF Parsing error: Expected '${s}' but found '${e}' instead in '${r?.type}'.
${t}

@@ -545,5 +545,5 @@ `;

if (o.isObjectExpression(e)) {
let [i, ...t] = s, r = e.properties.find((a) => k(a) === i);
if (r)
return me(t, r.value);
let [r, ...t] = s, i = e.properties.find((a) => k(a) === r);
if (i)
return me(t, i.value);
}

@@ -557,25 +557,25 @@ }, "_getPath"), ge = /* @__PURE__ */ p((s, e) => {

if (o.isObjectExpression(e)) {
let [i, ...t] = s, r = e.properties.find((a) => k(a) === i);
if (r)
return t.length === 0 ? e.properties : ge(t, r.value);
let [r, ...t] = s, i = e.properties.find((a) => k(a) === r);
if (i)
return t.length === 0 ? e.properties : ge(t, i.value);
}
}, "_getPathProperties"), xe = /* @__PURE__ */ p((s, e) => {
let i = null, t = null;
return e.body.find((r) => (o.isVariableDeclaration(r) ? t = r.declarations : o.isExportNamedDeclaration(r) && o.isVariableDeclaration(r.declaration) &&
(t = r.declaration.declarations), t && t.find((a) => o.isVariableDeclarator(a) && o.isIdentifier(a.id) && a.id.name === s ? (i = a, !0) : !1))),
i;
let r = null, t = null;
return e.body.find((i) => (o.isVariableDeclaration(i) ? t = i.declarations : o.isExportNamedDeclaration(i) && o.isVariableDeclaration(i.declaration) &&
(t = i.declaration.declarations), t && t.find((a) => o.isVariableDeclarator(a) && o.isIdentifier(a.id) && a.id.name === s ? (r = a, !0) : !1))),
r;
}, "_findVarDeclarator"), D = /* @__PURE__ */ p((s, e) => xe(s, e)?.init, "_findVarInitialization"), V = /* @__PURE__ */ p((s, e) => {
if (s.length === 0)
return e;
let [i, ...t] = s, r = V(t, e);
return o.objectExpression([o.objectProperty(o.identifier(i), r)]);
}, "_makeObjectExpression"), J = /* @__PURE__ */ p((s, e, i) => {
let [t, ...r] = s, a = i.properties.find(
let [r, ...t] = s, i = V(t, e);
return o.objectExpression([o.objectProperty(o.identifier(r), i)]);
}, "_makeObjectExpression"), J = /* @__PURE__ */ p((s, e, r) => {
let [t, ...i] = s, a = r.properties.find(
(n) => k(n) === t
);
a ? o.isObjectExpression(a.value) && r.length > 0 ? J(r, e, a.value) : a.value = V(r, e) : i.properties.push(
o.objectProperty(o.identifier(t), V(r, e))
a ? o.isObjectExpression(a.value) && i.length > 0 ? J(i, e, a.value) : a.value = V(i, e) : r.properties.push(
o.objectProperty(o.identifier(t), V(i, e))
);
}, "_updateExportNode"), K = class {
constructor(e, i, t) {
constructor(e, r, t) {
this._exports = {};

@@ -587,3 +587,3 @@ // FIXME: this is a hack. this is only used in the case where the user is

this.hasDefaultExport = !1;
this._ast = e, this._code = i, this.fileName = t;
this._ast = e, this._code = r, this.fileName = t;
}

@@ -597,6 +597,6 @@ static {

ExportDefaultDeclaration: {
enter({ node: i, parent: t }) {
enter({ node: r, parent: t }) {
e.hasDefaultExport = !0;
let r = o.isIdentifier(i.declaration) && o.isProgram(t) ? D(i.declaration.name, t) : i.declaration;
r = $(r), o.isObjectExpression(r) ? (e._exportsObject = r, r.properties.forEach((a) => {
let i = o.isIdentifier(r.declaration) && o.isProgram(t) ? D(r.declaration.name, t) : r.declaration;
i = $(i), o.isObjectExpression(i) ? (e._exportsObject = i, i.properties.forEach((a) => {
let n = k(a);

@@ -610,4 +610,4 @@ if (n) {

expectedType: "ObjectExpression",
foundType: r?.type,
node: r || i.declaration
foundType: i?.type,
node: i || r.declaration
})

@@ -618,11 +618,11 @@ );

ExportNamedDeclaration: {
enter({ node: i, parent: t }) {
o.isVariableDeclaration(i.declaration) ? i.declaration.declarations.forEach((r) => {
if (o.isVariableDeclarator(r) && o.isIdentifier(r.id)) {
let { name: a } = r.id, n = r.init;
o.isIdentifier(n) && (n = D(n.name, t)), e._exports[a] = n, e._exportDecls[a] = r;
enter({ node: r, parent: t }) {
o.isVariableDeclaration(r.declaration) ? r.declaration.declarations.forEach((i) => {
if (o.isVariableDeclarator(i) && o.isIdentifier(i.id)) {
let { name: a } = i.id, n = i.init;
o.isIdentifier(n) && (n = D(n.name, t)), e._exports[a] = n, e._exportDecls[a] = i;
}
}) : i.specifiers ? i.specifiers.forEach((r) => {
if (o.isExportSpecifier(r) && o.isIdentifier(r.local) && o.isIdentifier(r.exported)) {
let { name: a } = r.local, { name: n } = r.exported, l = xe(a, t);
}) : r.specifiers ? r.specifiers.forEach((i) => {
if (o.isExportSpecifier(i) && o.isIdentifier(i.local) && o.isIdentifier(i.exported)) {
let { name: a } = i.local, { name: n } = i.exported, l = xe(a, t);
l && (e._exports[n] = l.init, e._exportDecls[n] = l);

@@ -633,4 +633,4 @@ }

expectedType: "VariableDeclaration",
foundType: i.declaration?.type,
node: i.declaration
foundType: r.declaration?.type,
node: r.declaration
})

@@ -641,6 +641,6 @@ );

ExpressionStatement: {
enter({ node: i, parent: t }) {
if (o.isAssignmentExpression(i.expression) && i.expression.operator === "=") {
let { left: r, right: a } = i.expression;
if (o.isMemberExpression(r) && o.isIdentifier(r.object) && r.object.name === "module" && o.isIdentifier(r.property) && r.property.
enter({ node: r, parent: t }) {
if (o.isAssignmentExpression(r.expression) && r.expression.operator === "=") {
let { left: i, right: a } = r.expression;
if (o.isMemberExpression(i) && o.isIdentifier(i.object) && i.object.name === "module" && o.isIdentifier(i.property) && i.property.
name === "exports") {

@@ -671,15 +671,15 @@ let n = a;

getFieldNode(e) {
let [i, ...t] = e, r = this._exports[i];
if (r)
return me(t, r);
let [r, ...t] = e, i = this._exports[r];
if (i)
return me(t, i);
}
getFieldProperties(e) {
let [i, ...t] = e, r = this._exports[i];
if (r)
return ge(t, r);
let [r, ...t] = e, i = this._exports[r];
if (i)
return ge(t, i);
}
getFieldValue(e) {
let i = this.getFieldNode(e);
if (i) {
let { code: t } = pe(i, {});
let r = this.getFieldNode(e);
if (r) {
let { code: t } = pe(r, {});
return (0, eval)(`(() => (${t}))()`);

@@ -694,11 +694,11 @@ }

}
setFieldNode(e, i) {
let [t, ...r] = e, a = this._exports[t];
setFieldNode(e, r) {
let [t, ...i] = e, a = this._exports[t];
if (this._exportsObject)
J(e, i, this._exportsObject), this._exports[e[0]] = i;
else if (a && o.isObjectExpression(a) && r.length > 0)
J(r, i, a);
else if (a && r.length === 0 && this._exportDecls[e[0]]) {
J(e, r, this._exportsObject), this._exports[e[0]] = r;
else if (a && o.isObjectExpression(a) && i.length > 0)
J(i, r, a);
else if (a && i.length === 0 && this._exportDecls[e[0]]) {
let n = this._exportDecls[e[0]];
n.init = V([], i);
n.init = V([], r);
} else {

@@ -712,3 +712,3 @@ if (this.hasDefaultExport)

{
let n = V(r, i), l = o.exportNamedDeclaration(
let n = V(i, r), l = o.exportNamedDeclaration(
o.variableDeclaration("const", [o.variableDeclarator(o.identifier(t), n)])

@@ -732,5 +732,5 @@ );

getNameFromPath(e) {
let i = this.getFieldNode(e);
if (i)
return this._getPresetValue(i, "name");
let r = this.getFieldNode(e);
if (r)
return this._getPresetValue(r, "name");
}

@@ -751,8 +751,8 @@ /**

getNamesFromPath(e) {
let i = this.getFieldNode(e);
if (!i)
let r = this.getFieldNode(e);
if (!r)
return;
let t = [];
return o.isArrayExpression(i) && i.elements.forEach((r) => {
t.push(this._getPresetValue(r, "name"));
return o.isArrayExpression(r) && r.elements.forEach((i) => {
t.push(this._getPresetValue(i, "name"));
}), t;

@@ -762,5 +762,5 @@ }

if (o.isCallExpression(e)) {
let i = e.arguments[0];
if (o.isStringLiteral(i))
return i.value;
let r = e.arguments[0];
if (o.isStringLiteral(r))
return r.value;
}

@@ -774,10 +774,10 @@ }

*/
_getPresetValue(e, i) {
_getPresetValue(e, r) {
let t;
if (o.isStringLiteral(e) ? t = e.value : o.isObjectExpression(e) && e.properties.forEach((r) => {
o.isObjectProperty(r) && o.isIdentifier(r.key) && r.key.name === i && (o.isStringLiteral(r.value) ? t = r.value.value : t = this._getPnpWrappedValue(
r.value)), o.isObjectProperty(r) && o.isStringLiteral(r.key) && r.key.value === "name" && o.isStringLiteral(r.value) && (t = r.value.value);
if (o.isStringLiteral(e) ? t = e.value : o.isObjectExpression(e) && e.properties.forEach((i) => {
o.isObjectProperty(i) && o.isIdentifier(i.key) && i.key.name === r && (o.isStringLiteral(i.value) ? t = i.value.value : t = this._getPnpWrappedValue(
i.value)), o.isObjectProperty(i) && o.isStringLiteral(i.key) && i.key.value === "name" && o.isStringLiteral(i.value) && (t = i.value.value);
}), !t)
throw new Error(
`The given node must be a string literal or an object expression with a "${i}" property that is a string literal.`
`The given node must be a string literal or an object expression with a "${r}" property that is a string literal.`
);

@@ -787,14 +787,14 @@ return t;

removeField(e) {
let i = /* @__PURE__ */ p((r, a) => {
let n = r.findIndex(
let r = /* @__PURE__ */ p((i, a) => {
let n = i.findIndex(
(l) => o.isIdentifier(l.key) && l.key.name === a || o.isStringLiteral(l.key) && l.key.value === a
);
n >= 0 && r.splice(n, 1);
n >= 0 && i.splice(n, 1);
}, "removeProperty");
if (e.length === 1) {
let r = !1;
let i = !1;
if (this._ast.program.body.forEach((a) => {
if (o.isExportNamedDeclaration(a) && o.isVariableDeclaration(a.declaration)) {
let n = a.declaration.declarations[0];
o.isIdentifier(n.id) && n.id.name === e[0] && (this._ast.program.body.splice(this._ast.program.body.indexOf(a), 1), r = !0);
o.isIdentifier(n.id) && n.id.name === e[0] && (this._ast.program.body.splice(this._ast.program.body.indexOf(a), 1), i = !0);
}

@@ -805,3 +805,3 @@ if (o.isExportDefaultDeclaration(a)) {

let l = n.properties;
i(l, e[0]), r = !0;
r(l, e[0]), i = !0;
}

@@ -813,5 +813,5 @@ }

let n = a.expression.right.properties;
i(n, e[0]), r = !0;
r(n, e[0]), i = !0;
}
}), r)
}), i)
return;

@@ -821,16 +821,16 @@ }

if (t) {
let r = e.at(-1);
i(t, r);
let i = e.at(-1);
r(t, i);
}
}
appendValueToArray(e, i) {
let t = this.valueToNode(i);
appendValueToArray(e, r) {
let t = this.valueToNode(r);
t && this.appendNodeToArray(e, t);
}
appendNodeToArray(e, i) {
appendNodeToArray(e, r) {
let t = this.getFieldNode(e);
if (!t)
this.setFieldNode(e, o.arrayExpression([i]));
this.setFieldNode(e, o.arrayExpression([r]));
else if (o.isArrayExpression(t))
t.elements.push(i);
t.elements.push(r);
else

@@ -843,12 +843,12 @@ throw new Error(`Expected array at '${e.join(".")}', got '${t.type}'`);

*/
removeEntryFromArray(e, i) {
removeEntryFromArray(e, r) {
let t = this.getFieldNode(e);
if (t)
if (o.isArrayExpression(t)) {
let r = t.elements.findIndex((a) => o.isStringLiteral(a) ? a.value === i : o.isObjectExpression(a) ? this._getPresetValue(a, "name") ===
i : this._getPnpWrappedValue(a) === i);
if (r >= 0)
t.elements.splice(r, 1);
let i = t.elements.findIndex((a) => o.isStringLiteral(a) ? a.value === r : o.isObjectExpression(a) ? this._getPresetValue(a, "name") ===
r : this._getPnpWrappedValue(a) === r);
if (i >= 0)
t.elements.splice(i, 1);
else
throw new Error(`Could not find '${i}' in array at '${e.join(".")}'`);
throw new Error(`Could not find '${r}' in array at '${e.join(".")}'`);
} else

@@ -860,3 +860,3 @@ throw new Error(`Expected array at '${e.join(".")}', got '${t.type}'`);

let e = (this._ast.tokens || []).slice(0, 500).reduce(
(i, t) => (t.type.label === "string" && (i[this._code[t.start]] += 1), i),
(r, t) => (t.type.label === "string" && (r[this._code[t.start]] += 1), r),
{ "'": 0, '"': 0 }

@@ -869,5 +869,5 @@ );

valueToNode(e) {
let i = this._inferQuotes(), t;
if (i === "single") {
let { code: r } = pe(o.valueToNode(e), { jsescOption: { quotes: i } }), a = de(`const __x = ${r}`);
let r = this._inferQuotes(), t;
if (r === "single") {
let { code: i } = pe(o.valueToNode(e), { jsescOption: { quotes: r } }), a = de(`const __x = ${i}`);
fe(a, {

@@ -885,6 +885,6 @@ VariableDeclaration: {

}
setFieldValue(e, i) {
let t = this.valueToNode(i);
setFieldValue(e, r) {
let t = this.valueToNode(r);
if (!t)
throw new Error(`Unexpected value ${JSON.stringify(i)}`);
throw new Error(`Unexpected value ${JSON.stringify(r)}`);
this.setFieldNode(e, t);

@@ -915,8 +915,8 @@ }

*/
setRequireImport(e, i) {
setRequireImport(e, r) {
let t = this._ast.program.body.find(
(n) => o.isVariableDeclaration(n) && n.declarations.length === 1 && o.isVariableDeclarator(n.declarations[0]) && o.isCallExpression(n.
declarations[0].init) && o.isIdentifier(n.declarations[0].init.callee) && n.declarations[0].init.callee.name === "require" && o.isStringLiteral(
n.declarations[0].init.arguments[0]) && n.declarations[0].init.arguments[0].value === i
), r = /* @__PURE__ */ p((n) => o.isObjectPattern(t?.declarations[0].id) && t?.declarations[0].id.properties.find(
n.declarations[0].init.arguments[0]) && n.declarations[0].init.arguments[0].value === r
), i = /* @__PURE__ */ p((n) => o.isObjectPattern(t?.declarations[0].id) && t?.declarations[0].id.properties.find(
(l) => o.isObjectProperty(l) && o.isIdentifier(l.key) && l.key.name === n

@@ -931,3 +931,3 @@ ), "hasRequireSpecifier"), a = /* @__PURE__ */ p((n, l) => n.declarations.length === 1 && o.isVariableDeclarator(n.declarations[0]) && o.

o.identifier(e),
o.callExpression(o.identifier("require"), [o.stringLiteral(i)])
o.callExpression(o.identifier("require"), [o.stringLiteral(r)])
)

@@ -939,3 +939,3 @@ ])

} else t ? e.forEach((n) => {
r(n) || t.declarations[0].id.properties.push(
i(n) || t.declarations[0].id.properties.push(
o.objectProperty(o.identifier(n), o.identifier(n), void 0, !0)

@@ -951,3 +951,3 @@ );

),
o.callExpression(o.identifier("require"), [o.stringLiteral(i)])
o.callExpression(o.identifier("require"), [o.stringLiteral(r)])
)

@@ -976,4 +976,4 @@ ])

*/
setImport(e, i) {
let t = /* @__PURE__ */ p((l) => o.importSpecifier(o.identifier(l), o.identifier(l)), "getNewImportSpecifier"), r = /* @__PURE__ */ p((l, u) => l.
setImport(e, r) {
let t = /* @__PURE__ */ p((l) => o.importSpecifier(o.identifier(l), o.identifier(l)), "getNewImportSpecifier"), i = /* @__PURE__ */ p((l, u) => l.
specifiers.find(

@@ -983,3 +983,3 @@ (f) => o.isImportSpecifier(f) && o.isIdentifier(f.imported) && f.imported.name === u

ifier"), n = this._ast.program.body.find(
(l) => o.isImportDeclaration(l) && l.source.value === i
(l) => o.isImportDeclaration(l) && l.source.value === r
);

@@ -991,6 +991,6 @@ typeof e == "string" ? n ? a(n, e) || n.specifiers.push(

[o.importDefaultSpecifier(o.identifier(e))],
o.stringLiteral(i)
o.stringLiteral(r)
)
) : n ? e.forEach((l) => {
r(n, l) || n.specifiers.push(t(l));
i(n, l) || n.specifiers.push(t(l));
}) : this._ast.program.body.unshift(

@@ -1001,3 +1001,3 @@ o.importDeclaration(

),
o.stringLiteral(i)
o.stringLiteral(r)
)

@@ -1007,4 +1007,4 @@ );

}, Ze = /* @__PURE__ */ p((s, e) => {
let i = de(s);
return new K(i, s, e);
let r = de(s);
return new K(r, s, e);
}, "loadConfig"), et = /* @__PURE__ */ p((s) => tt(s).code, "formatConfig"), tt = /* @__PURE__ */ p((s, e = {}) => Ye.print(s._ast, e), "pri\

@@ -1015,6 +1015,6 @@ ntConfig"), Ct = /* @__PURE__ */ p(async (s) => {

}, "readConfig"), Tt = /* @__PURE__ */ p(async (s, e) => {
let i = e || s.fileName;
if (!i)
let r = e || s.fileName;
if (!r)
throw new Error("Please specify a fileName for writeConfig");
await He(i, et(s));
await He(r, et(s));
}, "writeConfig");

@@ -1026,12 +1026,12 @@

var st = console, X = /* @__PURE__ */ p((s, e) => {
let i;
let r;
return s.properties.forEach((t) => {
y.isIdentifier(t.key) && t.key.name === e && (i = t.value);
}), i;
y.isIdentifier(t.key) && t.key.name === e && (r = t.value);
}), r;
}, "getValue"), Q = /* @__PURE__ */ p((s) => {
let e = A(s);
if (y.isArrayExpression(e))
return e.elements.map((i) => Q(i));
return e.elements.map((r) => Q(r));
if (y.isObjectExpression(e))
return e.properties.reduce((i, t) => (y.isIdentifier(t.key) && (i[t.key.name] = Q(t.value)), i), {});
return e.properties.reduce((r, t) => (y.isIdentifier(t.key) && (r[t.key.name] = Q(t.value)), r), {});
if (y.isLiteral(e))

@@ -1043,3 +1043,3 @@ return e.value;

}, "parseValue"), v = /* @__PURE__ */ p((s, e) => {
let i = be.dedent`
let r = be.dedent`
Unexpected '${s}'. Parameter 'options.storySort' should be defined inline e.g.:

@@ -1056,4 +1056,4 @@

if (e)
throw new Error(i);
st.info(i);
throw new Error(r);
st.info(r);
}, "unsupported"), A = /* @__PURE__ */ p((s) => y.isTSAsExpression(s) || y.isTSSatisfiesExpression(s) ? s.expression : s, "stripTSModifiers"),

@@ -1063,6 +1063,6 @@ Ee = /* @__PURE__ */ p((s) => {

if (y.isObjectExpression(e)) {
let i = X(e, "options");
if (i) {
if (y.isObjectExpression(i))
return X(i, "storySort");
let r = X(e, "options");
if (r) {
if (y.isObjectExpression(r))
return X(r, "storySort");
v("options", !0);

@@ -1072,5 +1072,5 @@ }

}, "parseParameters"), nt = /* @__PURE__ */ p((s, e) => {
let i = A(s);
if (y.isObjectExpression(i)) {
let t = X(i, "parameters");
let r = A(s);
if (y.isObjectExpression(r)) {
let t = X(r, "parameters");
if (y.isIdentifier(t) && (t = O(t.name, e)), t)

@@ -1083,16 +1083,16 @@ return Ee(t);

return;
let e, i = rt(s);
if (it(i, {
let e, r = rt(s);
if (it(r, {
ExportNamedDeclaration: {
enter({ node: t }) {
y.isVariableDeclaration(t.declaration) ? t.declaration.declarations.forEach((r) => {
if (y.isVariableDeclarator(r) && y.isIdentifier(r.id)) {
let { name: a } = r.id;
if (a === "parameters" && r.init) {
let n = A(r.init);
y.isVariableDeclaration(t.declaration) ? t.declaration.declarations.forEach((i) => {
if (y.isVariableDeclarator(i) && y.isIdentifier(i.id)) {
let { name: a } = i.id;
if (a === "parameters" && i.init) {
let n = A(i.init);
e = Ee(n);
}
}
}) : t.specifiers.forEach((r) => {
y.isIdentifier(r.exported) && r.exported.name === "parameters" && v("parameters", !1);
}) : t.specifiers.forEach((i) => {
y.isIdentifier(i.exported) && i.exported.name === "parameters" && v("parameters", !1);
});

@@ -1103,4 +1103,4 @@ }

enter({ node: t }) {
let r = t.declaration;
y.isIdentifier(r) && (r = O(r.name, i.program)), r = A(r), y.isObjectExpression(r) ? e = nt(r, i.program) : v("default", !1);
let i = t.declaration;
y.isIdentifier(i) && (i = O(i.name, r.program)), i = A(i), y.isObjectExpression(i) ? e = nt(i, r.program) : v("default", !1);
}

@@ -1114,5 +1114,5 @@ }

if (y.isFunctionExpression(e)) {
let { code: t } = ye(e, {}), r = e.id?.name, a = `(a, b) => {
let { code: t } = ye(e, {}), i = e.id?.name, a = `(a, b) => {
${t};
return ${r}(a, b)
return ${i}(a, b)
}`;

@@ -1127,5 +1127,5 @@ return (0, eval)(a);

import { generate as ot, types as m } from "@storybook/core/babel";
var at = /* @__PURE__ */ p((s, e, i, t) => {
let r = e.getStoryExport(i), a = !t?.disableSource && ct(r), n = !t?.disableDescription && _e(e._storyStatements[i]), l = [], u = m.memberExpression(
m.identifier(i), m.identifier("parameters"));
var at = /* @__PURE__ */ p((s, e, r, t) => {
let i = e.getStoryExport(r), a = !t?.disableSource && ct(i), n = !t?.disableDescription && _e(e._storyStatements[r]), l = [], u = m.memberExpression(
m.identifier(r), m.identifier("parameters"));
l.push(m.spreadElement(u));

@@ -1184,19 +1184,19 @@ let f = m.optionalMemberExpression(

}
}, "enrichCsfStory"), he = /* @__PURE__ */ p((s, e, i) => {
}, "enrichCsfStory"), he = /* @__PURE__ */ p((s, e, r) => {
if (!e.length) {
s.properties.find(
(u) => m.isObjectProperty(u) && m.isIdentifier(u.key) && u.key.name === "component"
) || s.properties.unshift(i);
) || s.properties.unshift(r);
return;
}
let [t, ...r] = e, a = s.properties.find(
let [t, ...i] = e, a = s.properties.find(
(l) => m.isObjectProperty(l) && m.isIdentifier(l.key) && l.key.name === t && m.isObjectExpression(l.value)
), n;
a ? n = a.value : (n = m.objectExpression([]), s.properties.push(m.objectProperty(m.identifier(t), n))), he(n, r, i);
}, "addComponentDescription"), lt = /* @__PURE__ */ p((s, e, i) => {
let t = !i?.disableDescription && _e(e._metaStatement);
a ? n = a.value : (n = m.objectExpression([]), s.properties.push(m.objectProperty(m.identifier(t), n))), he(n, i, r);
}, "addComponentDescription"), lt = /* @__PURE__ */ p((s, e, r) => {
let t = !r?.disableDescription && _e(e._metaStatement);
if (t) {
let r = s._metaNode;
r && m.isObjectExpression(r) && he(
r,
let i = s._metaNode;
i && m.isObjectExpression(i) && he(
i,
["parameters", "docs", "description"],

@@ -1206,11 +1206,11 @@ m.objectProperty(m.identifier("component"), m.stringLiteral(t))

}
}, "enrichCsfMeta"), qt = /* @__PURE__ */ p((s, e, i) => {
lt(s, e, i), Object.keys(s._storyExports).forEach((t) => {
at(s, e, t, i);
}, "enrichCsfMeta"), qt = /* @__PURE__ */ p((s, e, r) => {
lt(s, e, r), Object.keys(s._storyExports).forEach((t) => {
at(s, e, t, r);
});
}, "enrichCsf"), ct = /* @__PURE__ */ p((s) => {
let e = m.isVariableDeclarator(s) ? s.init : s, { code: i } = ot(e, {});
return i;
}, "extractSource"), _e = /* @__PURE__ */ p((s) => s?.leadingComments ? s.leadingComments.map((i) => i.type === "CommentLine" || !i.value.startsWith(
"*") ? null : i.value.split(`
let e = m.isVariableDeclarator(s) ? s.init : s, { code: r } = ot(e, {});
return r;
}, "extractSource"), _e = /* @__PURE__ */ p((s) => s?.leadingComments ? s.leadingComments.map((r) => r.type === "CommentLine" || !r.value.startsWith(
"*") ? null : r.value.split(`
`).map((t) => t.replace(/^(\s+)?(\*+)?(\s)?/, "")).join(`

@@ -1228,12 +1228,10 @@ `).trim()).filter(Boolean).join(`

import { combineTags as ft } from "@storybook/csf";
var Se = console, dt = /* @__PURE__ */ p((s, e) => {
let i = e?.include.length === 0 || e?.include.some((r) => s.includes(r)), t = e?.exclude.every((r) => !s.includes(r));
return i && t;
}, "isValidTest");
var Se = console, dt = /* @__PURE__ */ p((s, e) => !(e.include.length && !e.include.some((r) => s?.includes(r)) || e.exclude.some((r) => s?.
includes(r))), "isValidTest");
async function ut({
code: s,
fileName: e,
configDir: i,
configDir: r,
stories: t,
tagsFilter: r,
tagsFilter: i,
previewLevelTags: a = []

@@ -1249,3 +1247,3 @@ }) {

storyFilePath: e,
configDir: i,
configDir: r,
stories: t,

@@ -1257,3 +1255,3 @@ userTitle: E

[Storybook]: Could not calculate story title for "${e}".
Please make sure that this file matches the globs included in the "stories" field in your Storybook configuration at "${i}".
Please make sure that this file matches the globs included in the "stories" field in your Storybook configuration at "${r}".
`

@@ -1281,3 +1279,3 @@ ), j;

);
dt(j, r) && (_[E] = l._storyStatements[E]);
dt(j, i) && (_[E] = l._storyStatements[E]);
});

@@ -1333,3 +1331,3 @@ let S = l._file.path.scope.generateUidIdentifier("test"), Y = l._file.path.scope.generateUidIdentifier("describe");

let E = l._file.path.scope.generateUidIdentifier("expect"), j = l._file.path.scope.generateUidIdentifier("testStory"), je = d.identifier(
JSON.stringify(r.skip)), { isRunningFromThisFileDeclaration: Oe, isRunningFromThisFileId: Pe } = Z();
JSON.stringify(i.skip)), { isRunningFromThisFileDeclaration: Oe, isRunningFromThisFileId: Pe } = Z();
u.program.body.push(Oe);

@@ -1336,0 +1334,0 @@ let De = /* @__PURE__ */ p(({

@@ -819,3 +819,2 @@ import ESM_COMPAT_Module from "node:module";

"TESTING_MODULE_PROGRESS_REPORT",
"TESTING_MODULE_RUN_ALL_REQUEST",
"TESTING_MODULE_RUN_REQUEST",

@@ -885,3 +884,2 @@ "TESTING_MODULE_WATCH_MODE_REQUEST",

"TESTING_MODULE_PROGRESS_REPORT",
"TESTING_MODULE_RUN_ALL_REQUEST",
"TESTING_MODULE_RUN_REQUEST",

@@ -951,3 +949,2 @@ "TESTING_MODULE_WATCH_MODE_REQUEST",

"TESTING_MODULE_PROGRESS_REPORT",
"TESTING_MODULE_RUN_ALL_REQUEST",
"TESTING_MODULE_RUN_REQUEST",

@@ -954,0 +951,0 @@ "TESTING_MODULE_WATCH_MODE_REQUEST",

@@ -413,3 +413,3 @@ import { Channel } from '@storybook/core/channels';

id: string;
version: number;
version?: number;
result: T;

@@ -416,0 +416,0 @@ status: 'failed' | 'passed' | 'warning';

{
"name": "@storybook/core",
"version": "0.0.0-pr-29643-sha-32a95d9e",
"version": "0.0.0-pr-29643-sha-82899600",
"description": "Storybook framework-agnostic API",

@@ -280,3 +280,3 @@ "keywords": [

"dependencies": {
"@storybook/csf": "0.1.12--canary.110.7611f0c.0",
"@storybook/csf": "0.1.12--canary.110.100825f.0",
"better-opn": "^3.0.2",

@@ -283,0 +283,0 @@ "browser-assert": "^1.2.1",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc