storybook 9.0.0-rc.2 → 9.0.0-rc.3

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.
@@ -9120,11 +9120,13 @@ t, "unwrap"), va = /* @__PURE__ */ n((t, e) => {
9120
9120
  * @param fromImport - The module to import from
9121
9121
  */
9122
9122
  setRequireImport(e, r) {
9123
- let i = this._ast.program.body.find(
9124
- (a) => d.types.isVariableDeclaration(a) && a.declarations.length === 1 && d.types.isVariableDeclarator(a.declarations[0]) && d.types.isCallExpression(
9125
- a.declarations[0].init) && d.types.isIdentifier(a.declarations[0].init.callee) && a.declarations[0].init.callee.name === "require" && d.types.
9126
- isStringLiteral(a.declarations[0].init.arguments[0]) && a.declarations[0].init.arguments[0].value === r
9127
- ), s = /* @__PURE__ */ n((a) => d.types.isObjectPattern(i?.declarations[0].id) && i?.declarations[0].id.properties.find(
9123
+ let i = this._ast.program.body.find((a) => {
9124
+ let l = d.types.isVariableDeclaration(a) && a.declarations.length === 1 && d.types.isVariableDeclarator(a.declarations[0]) && d.types.
9125
+ isCallExpression(a.declarations[0].init) && d.types.isIdentifier(a.declarations[0].init.callee) && a.declarations[0].init.callee.name ===
9126
+ "require" && d.types.isStringLiteral(a.declarations[0].init.arguments[0]) && (a.declarations[0].init.arguments[0].value === r || a.declarations[0].
9127
+ init.arguments[0].value === r.split("node:")[1]);
9128
+ return l && (r = a.declarations[0].init.arguments[0].value), l;
9129
+ }), s = /* @__PURE__ */ n((a) => d.types.isObjectPattern(i?.declarations[0].id) && i?.declarations[0].id.properties.find(
9128
9130
  (l) => d.types.isObjectProperty(l) && d.types.isIdentifier(l.key) && l.key.name === a
9129
9131
  ), "hasRequireSpecifier"), o = /* @__PURE__ */ n((a, l) => a.declarations.length === 1 && d.types.isVariableDeclarator(a.declarations[0]) &&
9130
9132
  d.types.isIdentifier(a.declarations[0].id) && a.declarations[0].id.name === l, "hasDefaultRequireSpecifier");
@@ -9183,32 +9185,33 @@ t, "unwrap"), va = /* @__PURE__ */ n((t, e) => {
9183
9185
  * @param fromImport - The module to import from
9184
9186
  */
9185
9187
  setImport(e, r) {
9186
- let i = /* @__PURE__ */ n((u) => d.types.importSpecifier(d.types.identifier(u), d.types.identifier(u)), "getNewImportSpecifier"), s = /* @__PURE__ */ n(
9188
+ let i = this._ast.program.body.find((u) => {
9189
+ let c = d.types.isImportDeclaration(u) && (u.source.value === r || u.source.value === r.split("node:")[1]);
9190
+ return c && (r = u.source.value), c;
9191
+ }), s = /* @__PURE__ */ n((u) => d.types.importSpecifier(d.types.identifier(u), d.types.identifier(u)), "getNewImportSpecifier"), o = /* @__PURE__ */ n(
9187
9192
  (u, c) => u.specifiers.find(
9188
9193
  (h) => d.types.isImportSpecifier(h) && d.types.isIdentifier(h.imported) && h.imported.name === c
9189
- ), "hasImportSpecifier"), o = /* @__PURE__ */ n((u, c) => u.specifiers.find(
9194
+ ), "hasImportSpecifier"), a = /* @__PURE__ */ n((u, c) => u.specifiers.find(
9190
9195
  (h) => d.types.isImportNamespaceSpecifier(h) && d.types.isIdentifier(h.local) && h.local.name === c
9191
- ), "hasNamespaceImportSpecifier"), a = /* @__PURE__ */ n((u, c) => u.specifiers.find(
9196
+ ), "hasNamespaceImportSpecifier");
9197
+ e === null ? i || this._ast.program.body.unshift(d.types.importDeclaration([], d.types.stringLiteral(r))) : typeof e == "string" ? i ? (/* @__PURE__ */ n(
9198
+ (u, c) => u.specifiers.find(
9192
9199
  (h) => d.types.isImportDefaultSpecifier(h) && d.types.isIdentifier(h.local) && h.local.name === c
9193
- ), "hasDefaultImportSpecifier"), l = this._ast.program.body.find(
9194
- (u) => d.types.isImportDeclaration(u) && u.source.value === r
9195
- );
9196
- e === null ? l || this._ast.program.body.unshift(d.types.importDeclaration([], d.types.stringLiteral(r))) : typeof e == "string" ? l ? a(
9197
- l, e) || l.specifiers.push(
9200
+ ), "hasDefaultImportSpecifier"))(i, e) || i.specifiers.push(
9198
9201
  d.types.importDefaultSpecifier(d.types.identifier(e))
9199
9202
  ) : this._ast.program.body.unshift(
9200
9203
  d.types.importDeclaration(
9201
9204
  [d.types.importDefaultSpecifier(d.types.identifier(e))],
9202
9205
  d.types.stringLiteral(r)
9203
9206
  )
9204
- ) : Array.isArray(e) ? l ? e.forEach((u) => {
9205
- s(l, u) || l.specifiers.push(i(u));
9207
+ ) : Array.isArray(e) ? i ? e.forEach((u) => {
9208
+ o(i, u) || i.specifiers.push(s(u));
9206
9209
  }) : this._ast.program.body.unshift(
9207
9210
  d.types.importDeclaration(
9208
- e.map(i),
9211
+ e.map(s),
9209
9212
  d.types.stringLiteral(r)
9210
9213
  )
9211
- ) : e.namespace && (l ? o(l, e.namespace) || l.specifiers.push(
9214
+ ) : e.namespace && (i ? a(i, e.namespace) || i.specifiers.push(
9212
9215
  d.types.importNamespaceSpecifier(d.types.identifier(e.namespace))
9213
9216
  ) : this._ast.program.body.unshift(
9214
9217
  d.types.importDeclaration(
@@ -9152,11 +9152,13 @@ null, "propKey"), lr = /* @__PURE__ */ n((t) => f.isTSAsExpression(t) || f.isTSS
9152
9152
  * @param fromImport - The module to import from
9153
9153
  */
9154
9154
  setRequireImport(e, r) {
9155
- let i = this._ast.program.body.find(
9156
- (a) => f.isVariableDeclaration(a) && a.declarations.length === 1 && f.isVariableDeclarator(a.declarations[0]) && f.isCallExpression(a.
9155
+ let i = this._ast.program.body.find((a) => {
9156
+ let l = f.isVariableDeclaration(a) && a.declarations.length === 1 && f.isVariableDeclarator(a.declarations[0]) && f.isCallExpression(a.
9157
9157
  declarations[0].init) && f.isIdentifier(a.declarations[0].init.callee) && a.declarations[0].init.callee.name === "require" && f.isStringLiteral(
9158
- a.declarations[0].init.arguments[0]) && a.declarations[0].init.arguments[0].value === r
9159
- ), s = /* @__PURE__ */ n((a) => f.isObjectPattern(i?.declarations[0].id) && i?.declarations[0].id.properties.find(
9158
+ a.declarations[0].init.arguments[0]) && (a.declarations[0].init.arguments[0].value === r || a.declarations[0].init.arguments[0].value ===
9159
+ r.split("node:")[1]);
9160
+ return l && (r = a.declarations[0].init.arguments[0].value), l;
9161
+ }), s = /* @__PURE__ */ n((a) => f.isObjectPattern(i?.declarations[0].id) && i?.declarations[0].id.properties.find(
9160
9162
  (l) => f.isObjectProperty(l) && f.isIdentifier(l.key) && l.key.name === a
9161
9163
  ), "hasRequireSpecifier"), o = /* @__PURE__ */ n((a, l) => a.declarations.length === 1 && f.isVariableDeclarator(a.declarations[0]) && f.
9162
9164
  isIdentifier(a.declarations[0].id) && a.declarations[0].id.name === l, "hasDefaultRequireSpecifier");
@@ -9215,32 +9217,33 @@ null, "propKey"), lr = /* @__PURE__ */ n((t) => f.isTSAsExpression(t) || f.isTSS
9215
9217
  * @param fromImport - The module to import from
9216
9218
  */
9217
9219
  setImport(e, r) {
9218
- let i = /* @__PURE__ */ n((c) => f.importSpecifier(f.identifier(c), f.identifier(c)), "getNewImportSpecifier"), s = /* @__PURE__ */ n((c, u) => c.
9220
+ let i = this._ast.program.body.find((c) => {
9221
+ let u = f.isImportDeclaration(c) && (c.source.value === r || c.source.value === r.split("node:")[1]);
9222
+ return u && (r = c.source.value), u;
9223
+ }), s = /* @__PURE__ */ n((c) => f.importSpecifier(f.identifier(c), f.identifier(c)), "getNewImportSpecifier"), o = /* @__PURE__ */ n((c, u) => c.
9219
9224
  specifiers.find(
9220
9225
  (h) => f.isImportSpecifier(h) && f.isIdentifier(h.imported) && h.imported.name === u
9221
- ), "hasImportSpecifier"), o = /* @__PURE__ */ n((c, u) => c.specifiers.find(
9226
+ ), "hasImportSpecifier"), a = /* @__PURE__ */ n((c, u) => c.specifiers.find(
9222
9227
  (h) => f.isImportNamespaceSpecifier(h) && f.isIdentifier(h.local) && h.local.name === u
9223
- ), "hasNamespaceImportSpecifier"), a = /* @__PURE__ */ n((c, u) => c.specifiers.find(
9228
+ ), "hasNamespaceImportSpecifier");
9229
+ e === null ? i || this._ast.program.body.unshift(f.importDeclaration([], f.stringLiteral(r))) : typeof e == "string" ? i ? (/* @__PURE__ */ n(
9230
+ (c, u) => c.specifiers.find(
9224
9231
  (h) => f.isImportDefaultSpecifier(h) && f.isIdentifier(h.local) && h.local.name === u
9225
- ), "hasDefaultImportSpecifier"), l = this._ast.program.body.find(
9226
- (c) => f.isImportDeclaration(c) && c.source.value === r
9227
- );
9228
- e === null ? l || this._ast.program.body.unshift(f.importDeclaration([], f.stringLiteral(r))) : typeof e == "string" ? l ? a(l, e) || l.
9229
- specifiers.push(
9232
+ ), "hasDefaultImportSpecifier"))(i, e) || i.specifiers.push(
9230
9233
  f.importDefaultSpecifier(f.identifier(e))
9231
9234
  ) : this._ast.program.body.unshift(
9232
9235
  f.importDeclaration(
9233
9236
  [f.importDefaultSpecifier(f.identifier(e))],
9234
9237
  f.stringLiteral(r)
9235
9238
  )
9236
- ) : Array.isArray(e) ? l ? e.forEach((c) => {
9237
- s(l, c) || l.specifiers.push(i(c));
9239
+ ) : Array.isArray(e) ? i ? e.forEach((c) => {
9240
+ o(i, c) || i.specifiers.push(s(c));
9238
9241
  }) : this._ast.program.body.unshift(
9239
9242
  f.importDeclaration(
9240
- e.map(i),
9243
+ e.map(s),
9241
9244
  f.stringLiteral(r)
9242
9245
  )
9243
- ) : e.namespace && (l ? o(l, e.namespace) || l.specifiers.push(
9246
+ ) : e.namespace && (i ? a(i, e.namespace) || i.specifiers.push(
9244
9247
  f.importNamespaceSpecifier(f.identifier(e.namespace))
9245
9248
  ) : this._ast.program.body.unshift(
9246
9249
  f.importDeclaration(