vite-plugin-storybook-nextjs 2.0.3--canary.45.35325be.0 → 2.0.3--canary.45.70d675a.0

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.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var path3 = require('path');
3
+ var path2 = require('path');
4
4
  var module$1 = require('module');
5
5
  var tsconfigPaths = require('vite-tsconfig-paths');
6
6
  var fs3 = require('fs');
@@ -47,7 +47,7 @@ function _interopNamespace(e) {
47
47
  return Object.freeze(n);
48
48
  }
49
49
 
50
- var path3__default = /*#__PURE__*/_interopDefault(path3);
50
+ var path2__default = /*#__PURE__*/_interopDefault(path2);
51
51
  var tsconfigPaths__default = /*#__PURE__*/_interopDefault(tsconfigPaths);
52
52
  var fs3__default = /*#__PURE__*/_interopDefault(fs3);
53
53
  var nextEnv__namespace = /*#__PURE__*/_interopNamespace(nextEnv);
@@ -1973,7 +1973,7 @@ async function loadClosestPackageJson(dir, attempts = 1) {
1973
1973
  const mainPath = attempts === 1 ? ["."] : new Array(attempts).fill("..");
1974
1974
  try {
1975
1975
  const file = await fs3__default.default.promises.readFile(
1976
- path3.join(dir, ...mainPath, "package.json"),
1976
+ path2.join(dir, ...mainPath, "package.json"),
1977
1977
  "utf8"
1978
1978
  );
1979
1979
  return JSON.parse(file);
@@ -1986,8 +1986,8 @@ function findNextDirectories(dir) {
1986
1986
  return findPagesDir_js.findPagesDir(dir);
1987
1987
  } catch (e) {
1988
1988
  return {
1989
- appDir: path3__default.default.join(dir, "app"),
1990
- pagesDir: path3__default.default.join(dir, "pages")
1989
+ appDir: path2__default.default.join(dir, "app"),
1990
+ pagesDir: path2__default.default.join(dir, "pages")
1991
1991
  };
1992
1992
  }
1993
1993
  }
@@ -1996,7 +1996,7 @@ function findNextDirectories(dir) {
1996
1996
  function vitePluginNextEnv(rootDir, nextConfigResolver) {
1997
1997
  let envConfig;
1998
1998
  let isDev;
1999
- const resolvedDir = path3.resolve(rootDir);
1999
+ const resolvedDir = path2.resolve(rootDir);
2000
2000
  let getDefineEnv;
2001
2001
  let isNext1540 = false;
2002
2002
  try {
@@ -2020,7 +2020,6 @@ function vitePluginNextEnv(rootDir, nextConfigResolver) {
2020
2020
  const finalConfig = {
2021
2021
  ...config.define,
2022
2022
  ...publicNextEnvMap,
2023
- // @ts-expect-error
2024
2023
  ...getDefineEnv({
2025
2024
  isTurbopack: false,
2026
2025
  config: nextConfig,
@@ -2259,7 +2258,7 @@ function vitePluginNextFont() {
2259
2258
  return null;
2260
2259
  }
2261
2260
  let fontFaceDeclaration;
2262
- const pathSep = path3__default.default.sep;
2261
+ const pathSep = path2__default.default.sep;
2263
2262
  if (sourceWithoutQuery.endsWith(
2264
2263
  ["next", "font", "google", "target.css"].join(pathSep)
2265
2264
  )) {
@@ -2268,17 +2267,17 @@ function vitePluginNextFont() {
2268
2267
  if (sourceWithoutQuery.endsWith(
2269
2268
  ["next", "font", "local", "target.css"].join(pathSep)
2270
2269
  )) {
2271
- const importerDirPath = path3__default.default.dirname(fontOptions.filename);
2270
+ const importerDirPath = path2__default.default.dirname(fontOptions.filename);
2272
2271
  const emitFont = async (importerRelativeFontPath) => {
2273
- const fontExtension = path3__default.default.extname(importerRelativeFontPath);
2274
- const fontBaseName = path3__default.default.basename(
2272
+ const fontExtension = path2__default.default.extname(importerRelativeFontPath);
2273
+ const fontBaseName = path2__default.default.basename(
2275
2274
  importerRelativeFontPath,
2276
2275
  fontExtension
2277
2276
  );
2278
- const fontPath = path3__default.default.join(importerDirPath, importerRelativeFontPath);
2277
+ const fontPath = path2__default.default.join(importerDirPath, importerRelativeFontPath);
2279
2278
  if (devMode) {
2280
2279
  return {
2281
- fontPath: path3__default.default.join(cwd, fontPath),
2280
+ fontPath: path2__default.default.join(cwd, fontPath),
2282
2281
  fontReferenceId: void 0
2283
2282
  };
2284
2283
  }
@@ -2525,7 +2524,7 @@ var getVitestSWCTransformConfig = ({
2525
2524
  swcPlugins: nextConfig.experimental.swcPlugins,
2526
2525
  compiler: nextConfig?.compiler,
2527
2526
  esm: isEsmProject,
2528
- swcCacheDir: path3__default.default.join(
2527
+ swcCacheDir: path2__default.default.join(
2529
2528
  rootDir,
2530
2529
  nextConfig.distDir ?? ".next",
2531
2530
  "cache",
@@ -2538,7 +2537,7 @@ var getVitestSWCTransformConfig = ({
2538
2537
  ...baseOptions,
2539
2538
  fontLoaders: {
2540
2539
  fontLoaders: ["next/font/local", "next/font/google"],
2541
- relativeFilePathFromRoot: path3__default.default.relative(rootDir, filename)
2540
+ relativeFilePathFromRoot: path2__default.default.relative(rootDir, filename)
2542
2541
  },
2543
2542
  cjsRequireOptimizer: {
2544
2543
  packages: {
@@ -2598,7 +2597,7 @@ function vitePluginNextSwc(rootDir, nextConfigResolver) {
2598
2597
  let isDev;
2599
2598
  let isEsmProject;
2600
2599
  const filter = vite.createFilter(included, excluded);
2601
- const resolvedDir = path3.resolve(rootDir);
2600
+ const resolvedDir = path2.resolve(rootDir);
2602
2601
  return {
2603
2602
  name: "vite-plugin-storybook-nextjs-swc",
2604
2603
  enforce: "pre",
@@ -2730,8 +2729,8 @@ function vitePluginNextImage(nextConfigResolver) {
2730
2729
  return null;
2731
2730
  }
2732
2731
  if (includePattern2.test(source) && !excludeImporterPattern.test(importer ?? "") && !importer?.startsWith(virtualImage)) {
2733
- const isAbsolute = path3__default.default.isAbsolute(id);
2734
- const imagePath = importer ? isAbsolute ? source : path3__default.default.join(path3__default.default.dirname(importer), source) : source;
2732
+ const isAbsolute = path2__default.default.isAbsolute(id);
2733
+ const imagePath = importer ? isAbsolute ? source : path2__default.default.join(path2__default.default.dirname(importer), source) : source;
2735
2734
  return `${virtualImage}?imagePath=${imagePath}`;
2736
2735
  }
2737
2736
  if (id === "next/image" && importer !== virtualNextImage) {
@@ -2795,11 +2794,11 @@ var getNextjsVersion = () => require5(scopedResolve("next/package.json")).versio
2795
2794
  var scopedResolve = (id) => {
2796
2795
  let scopedModulePath;
2797
2796
  try {
2798
- scopedModulePath = require5.resolve(id, { paths: [path3.resolve()] });
2797
+ scopedModulePath = require5.resolve(id, { paths: [path2.resolve()] });
2799
2798
  } catch (e) {
2800
2799
  scopedModulePath = require5.resolve(id);
2801
2800
  }
2802
- const idWithNativePathSep = id.replace(/\//g, path3.sep);
2801
+ const idWithNativePathSep = id.replace(/\//g, path2.sep);
2803
2802
  if (scopedModulePath.endsWith(idWithNativePathSep)) {
2804
2803
  return scopedModulePath;
2805
2804
  }
@@ -2890,7 +2889,7 @@ var loadConfig = (
2890
2889
  function VitePlugin({
2891
2890
  dir = process.cwd()
2892
2891
  } = {}) {
2893
- const resolvedDir = path3.resolve(dir);
2892
+ const resolvedDir = path2.resolve(dir);
2894
2893
  const nextConfigResolver = Promise.withResolvers();
2895
2894
  return [
2896
2895
  tsconfigPaths__default.default({ root: resolvedDir }),
@@ -2964,6 +2963,7 @@ function VitePlugin({
2964
2963
  "next/config",
2965
2964
  "next/dist/shared/lib/segment",
2966
2965
  "styled-jsx",
2966
+ "styled-jsx/style",
2967
2967
  "sb-original/image-context",
2968
2968
  "sb-original/default-loader",
2969
2969
  "@mdx-js/react",
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import path3, { resolve, join, sep } from 'path';
1
+ import path2, { resolve, join, sep } from 'path';
2
2
  import { createRequire } from 'module';
3
3
  import tsconfigPaths from 'vite-tsconfig-paths';
4
4
  import fs3 from 'fs';
@@ -1952,8 +1952,8 @@ function findNextDirectories(dir) {
1952
1952
  return findPagesDir(dir);
1953
1953
  } catch (e) {
1954
1954
  return {
1955
- appDir: path3.join(dir, "app"),
1956
- pagesDir: path3.join(dir, "pages")
1955
+ appDir: path2.join(dir, "app"),
1956
+ pagesDir: path2.join(dir, "pages")
1957
1957
  };
1958
1958
  }
1959
1959
  }
@@ -1986,7 +1986,6 @@ function vitePluginNextEnv(rootDir, nextConfigResolver) {
1986
1986
  const finalConfig = {
1987
1987
  ...config.define,
1988
1988
  ...publicNextEnvMap,
1989
- // @ts-expect-error
1990
1989
  ...getDefineEnv({
1991
1990
  isTurbopack: false,
1992
1991
  config: nextConfig,
@@ -2225,7 +2224,7 @@ function vitePluginNextFont() {
2225
2224
  return null;
2226
2225
  }
2227
2226
  let fontFaceDeclaration;
2228
- const pathSep = path3.sep;
2227
+ const pathSep = path2.sep;
2229
2228
  if (sourceWithoutQuery.endsWith(
2230
2229
  ["next", "font", "google", "target.css"].join(pathSep)
2231
2230
  )) {
@@ -2234,17 +2233,17 @@ function vitePluginNextFont() {
2234
2233
  if (sourceWithoutQuery.endsWith(
2235
2234
  ["next", "font", "local", "target.css"].join(pathSep)
2236
2235
  )) {
2237
- const importerDirPath = path3.dirname(fontOptions.filename);
2236
+ const importerDirPath = path2.dirname(fontOptions.filename);
2238
2237
  const emitFont = async (importerRelativeFontPath) => {
2239
- const fontExtension = path3.extname(importerRelativeFontPath);
2240
- const fontBaseName = path3.basename(
2238
+ const fontExtension = path2.extname(importerRelativeFontPath);
2239
+ const fontBaseName = path2.basename(
2241
2240
  importerRelativeFontPath,
2242
2241
  fontExtension
2243
2242
  );
2244
- const fontPath = path3.join(importerDirPath, importerRelativeFontPath);
2243
+ const fontPath = path2.join(importerDirPath, importerRelativeFontPath);
2245
2244
  if (devMode) {
2246
2245
  return {
2247
- fontPath: path3.join(cwd, fontPath),
2246
+ fontPath: path2.join(cwd, fontPath),
2248
2247
  fontReferenceId: void 0
2249
2248
  };
2250
2249
  }
@@ -2491,7 +2490,7 @@ var getVitestSWCTransformConfig = ({
2491
2490
  swcPlugins: nextConfig.experimental.swcPlugins,
2492
2491
  compiler: nextConfig?.compiler,
2493
2492
  esm: isEsmProject,
2494
- swcCacheDir: path3.join(
2493
+ swcCacheDir: path2.join(
2495
2494
  rootDir,
2496
2495
  nextConfig.distDir ?? ".next",
2497
2496
  "cache",
@@ -2504,7 +2503,7 @@ var getVitestSWCTransformConfig = ({
2504
2503
  ...baseOptions,
2505
2504
  fontLoaders: {
2506
2505
  fontLoaders: ["next/font/local", "next/font/google"],
2507
- relativeFilePathFromRoot: path3.relative(rootDir, filename)
2506
+ relativeFilePathFromRoot: path2.relative(rootDir, filename)
2508
2507
  },
2509
2508
  cjsRequireOptimizer: {
2510
2509
  packages: {
@@ -2696,8 +2695,8 @@ function vitePluginNextImage(nextConfigResolver) {
2696
2695
  return null;
2697
2696
  }
2698
2697
  if (includePattern2.test(source) && !excludeImporterPattern.test(importer ?? "") && !importer?.startsWith(virtualImage)) {
2699
- const isAbsolute = path3.isAbsolute(id);
2700
- const imagePath = importer ? isAbsolute ? source : path3.join(path3.dirname(importer), source) : source;
2698
+ const isAbsolute = path2.isAbsolute(id);
2699
+ const imagePath = importer ? isAbsolute ? source : path2.join(path2.dirname(importer), source) : source;
2701
2700
  return `${virtualImage}?imagePath=${imagePath}`;
2702
2701
  }
2703
2702
  if (id === "next/image" && importer !== virtualNextImage) {
@@ -2930,6 +2929,7 @@ function VitePlugin({
2930
2929
  "next/config",
2931
2930
  "next/dist/shared/lib/segment",
2932
2931
  "styled-jsx",
2932
+ "styled-jsx/style",
2933
2933
  "sb-original/image-context",
2934
2934
  "sb-original/default-loader",
2935
2935
  "@mdx-js/react",
@@ -2,7 +2,7 @@ import * as next_dist_shared_lib_get_img_props from 'next/dist/shared/lib/get-im
2
2
  import * as _NextImage from 'next/image';
3
3
  import React__default from 'next/dist/compiled/react';
4
4
 
5
- declare const MockedNextImage: React__default.ForwardRefExoticComponent<Omit<React__default.DetailedHTMLProps<React__default.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "height" | "width" | "loading" | "ref" | "alt" | "src" | "srcSet"> & {
5
+ declare const MockedNextImage: React__default.ForwardRefExoticComponent<Omit<React__default.DetailedHTMLProps<React__default.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "src" | "srcSet" | "ref" | "alt" | "width" | "height" | "loading"> & {
6
6
  src: string | next_dist_shared_lib_get_img_props.StaticImport;
7
7
  alt: string;
8
8
  width?: number | `${number}`;
@@ -2,7 +2,7 @@ import * as next_dist_shared_lib_get_img_props from 'next/dist/shared/lib/get-im
2
2
  import * as _NextImage from 'next/image';
3
3
  import React__default from 'next/dist/compiled/react';
4
4
 
5
- declare const MockedNextImage: React__default.ForwardRefExoticComponent<Omit<React__default.DetailedHTMLProps<React__default.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "height" | "width" | "loading" | "ref" | "alt" | "src" | "srcSet"> & {
5
+ declare const MockedNextImage: React__default.ForwardRefExoticComponent<Omit<React__default.DetailedHTMLProps<React__default.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "src" | "srcSet" | "ref" | "alt" | "width" | "height" | "loading"> & {
6
6
  src: string | next_dist_shared_lib_get_img_props.StaticImport;
7
7
  alt: string;
8
8
  width?: number | `${number}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-storybook-nextjs",
3
- "version": "2.0.3--canary.45.35325be.0",
3
+ "version": "2.0.3--canary.45.70d675a.0",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "vite-plugin",