vite-plugin-storybook-nextjs 1.0.6 → 1.0.7

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
@@ -4,7 +4,7 @@ var path = require('path');
4
4
  var module$1 = require('module');
5
5
  var defineEnvPlugin_js = require('next/dist/build/webpack/plugins/define-env-plugin.js');
6
6
  var fs3 = require('fs');
7
- var env = require('@next/env');
7
+ var nextEnv = require('@next/env');
8
8
  var Log = require('next/dist/build/output/log.js');
9
9
  var index_js = require('next/dist/build/swc/index.js');
10
10
  var fs2 = require('fs/promises');
@@ -15,12 +15,12 @@ var validateGoogleFontFunctionCall_js = require('next/dist/compiled/@next/font/d
15
15
  var loaderUtils = require('next/dist/compiled/loader-utils3/index.js');
16
16
  var validateLocalFontFunctionCall_js = require('next/dist/compiled/@next/font/dist/local/validate-local-font-function-call.js');
17
17
  var tsDedent = require('ts-dedent');
18
- var loadJsConfig = require('next/dist/build/load-jsconfig.js');
18
+ var nextLoadJsConfig = require('next/dist/build/load-jsconfig.js');
19
19
  var findPagesDir_js = require('next/dist/lib/find-pages-dir.js');
20
20
  var vite = require('vite');
21
21
  var utils_js = require('next/dist/build/utils.js');
22
22
  var options_js = require('next/dist/build/swc/options.js');
23
- var loadConfig = require('next/dist/server/config.js');
23
+ var nextServerConfig = require('next/dist/server/config.js');
24
24
  var constants_js = require('next/dist/shared/lib/constants.js');
25
25
  var MagicString = require('magic-string');
26
26
  var os = require('os');
@@ -30,20 +30,40 @@ var imageSizeOf = require('image-size');
30
30
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
31
31
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
32
32
 
33
+ function _interopNamespace(e) {
34
+ if (e && e.__esModule) return e;
35
+ var n = Object.create(null);
36
+ if (e) {
37
+ Object.keys(e).forEach(function (k) {
38
+ if (k !== 'default') {
39
+ var d = Object.getOwnPropertyDescriptor(e, k);
40
+ Object.defineProperty(n, k, d.get ? d : {
41
+ enumerable: true,
42
+ get: function () { return e[k]; }
43
+ });
44
+ }
45
+ });
46
+ }
47
+ n.default = e;
48
+ return Object.freeze(n);
49
+ }
50
+
33
51
  var path__default = /*#__PURE__*/_interopDefault(path);
34
52
  var fs3__default = /*#__PURE__*/_interopDefault(fs3);
53
+ var nextEnv__namespace = /*#__PURE__*/_interopNamespace(nextEnv);
35
54
  var Log__default = /*#__PURE__*/_interopDefault(Log);
36
55
  var fs2__default = /*#__PURE__*/_interopDefault(fs2);
37
56
  var loaderUtils__default = /*#__PURE__*/_interopDefault(loaderUtils);
38
- var loadJsConfig__default = /*#__PURE__*/_interopDefault(loadJsConfig);
39
- var loadConfig__default = /*#__PURE__*/_interopDefault(loadConfig);
57
+ var nextLoadJsConfig__default = /*#__PURE__*/_interopDefault(nextLoadJsConfig);
58
+ var nextServerConfig__default = /*#__PURE__*/_interopDefault(nextServerConfig);
40
59
  var MagicString__default = /*#__PURE__*/_interopDefault(MagicString);
41
60
  var imageSizeOf__default = /*#__PURE__*/_interopDefault(imageSizeOf);
42
61
 
43
62
  // src/index.ts
44
63
  var nextDistPath = /(next[\\/]dist[\\/]shared[\\/]lib)|(next[\\/]dist[\\/]client)|(next[\\/]dist[\\/]pages)/;
64
+ var { loadEnvConfig } = nextEnv__namespace.default || nextEnv__namespace;
45
65
  async function loadEnvironmentConfig(dir, dev) {
46
- return env.loadEnvConfig(dir, dev, Log__default.default);
66
+ return loadEnvConfig(dir, dev, Log__default.default);
47
67
  }
48
68
  async function loadSWCBindingsEagerly(nextConfig) {
49
69
  await index_js.loadBindings(nextConfig?.experimental?.useWasmBinary);
@@ -652,6 +672,10 @@ var isDefined = (value) => value !== void 0;
652
672
  // src/plugins/next-swc/plugin.ts
653
673
  var excluded = /[\\/]((cache[\\/][^\\/]+\.zip[\\/])|virtual:)[\\/]/;
654
674
  var included = /\.((c|m)?(j|t)sx?)$/;
675
+ var loadJsConfig = (
676
+ // biome-ignore lint/suspicious/noExplicitAny: CJS support
677
+ nextLoadJsConfig__default.default.default || nextLoadJsConfig__default.default
678
+ );
655
679
  function vitePluginNextSwc(rootDir, nextConfigResolver) {
656
680
  let loadedJSConfig;
657
681
  let nextDirectories;
@@ -666,7 +690,7 @@ function vitePluginNextSwc(rootDir, nextConfigResolver) {
666
690
  async config(config, env) {
667
691
  const nextConfig = await nextConfigResolver.promise;
668
692
  nextDirectories = findPagesDir_js.findPagesDir(resolvedDir);
669
- loadedJSConfig = await loadJsConfig__default.default(resolvedDir, nextConfig);
693
+ loadedJSConfig = await loadJsConfig(resolvedDir, nextConfig);
670
694
  isDev = env.mode !== "production";
671
695
  await loadClosestPackageJson(resolvedDir);
672
696
  isEsmProject = true;
@@ -920,6 +944,10 @@ var vitePluginNextMocks = () => ({
920
944
 
921
945
  // src/index.ts
922
946
  var require6 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('out.js', document.baseURI).href)));
947
+ var loadConfig = (
948
+ // biome-ignore lint/suspicious/noExplicitAny: CJS support
949
+ nextServerConfig__default.default.default || nextServerConfig__default.default
950
+ );
923
951
  function VitePlugin({ dir = process.cwd() } = {}) {
924
952
  const resolvedDir = path.resolve(dir);
925
953
  const nextConfigResolver = Promise.withResolvers();
@@ -929,7 +957,7 @@ function VitePlugin({ dir = process.cwd() } = {}) {
929
957
  enforce: "pre",
930
958
  async config(config, env) {
931
959
  const phase = env.mode === "development" ? constants_js.PHASE_DEVELOPMENT_SERVER : env.mode === "test" ? constants_js.PHASE_TEST : constants_js.PHASE_PRODUCTION_BUILD;
932
- nextConfigResolver.resolve(await loadConfig__default.default(phase, resolvedDir));
960
+ nextConfigResolver.resolve(await loadConfig(phase, resolvedDir));
933
961
  const executionEnvironment = getExecutionEnvironment(config);
934
962
  return {
935
963
  ...!isVitestEnv && {
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import path, { resolve, join } from 'node:path';
2
2
  import { createRequire } from 'node:module';
3
3
  import { getDefineEnv } from 'next/dist/build/webpack/plugins/define-env-plugin.js';
4
4
  import fs3 from 'node:fs';
5
- import { loadEnvConfig } from '@next/env';
5
+ import * as nextEnv from '@next/env';
6
6
  import Log from 'next/dist/build/output/log.js';
7
7
  import { transform, loadBindings, lockfilePatchPromise } from 'next/dist/build/swc/index.js';
8
8
  import fs2 from 'node:fs/promises';
@@ -13,12 +13,12 @@ import { validateGoogleFontFunctionCall } from 'next/dist/compiled/@next/font/di
13
13
  import loaderUtils from 'next/dist/compiled/loader-utils3/index.js';
14
14
  import { validateLocalFontFunctionCall } from 'next/dist/compiled/@next/font/dist/local/validate-local-font-function-call.js';
15
15
  import { dedent } from 'ts-dedent';
16
- import loadJsConfig from 'next/dist/build/load-jsconfig.js';
16
+ import nextLoadJsConfig from 'next/dist/build/load-jsconfig.js';
17
17
  import { findPagesDir } from 'next/dist/lib/find-pages-dir.js';
18
18
  import { createFilter } from 'vite';
19
19
  import { getSupportedBrowsers } from 'next/dist/build/utils.js';
20
20
  import { getParserOptions } from 'next/dist/build/swc/options.js';
21
- import loadConfig from 'next/dist/server/config.js';
21
+ import nextServerConfig from 'next/dist/server/config.js';
22
22
  import { PHASE_DEVELOPMENT_SERVER, PHASE_TEST, PHASE_PRODUCTION_BUILD } from 'next/dist/shared/lib/constants.js';
23
23
  import MagicString from 'magic-string';
24
24
  import { cpus } from 'node:os';
@@ -27,6 +27,7 @@ import imageSizeOf from 'image-size';
27
27
 
28
28
  // src/index.ts
29
29
  var nextDistPath = /(next[\\/]dist[\\/]shared[\\/]lib)|(next[\\/]dist[\\/]client)|(next[\\/]dist[\\/]pages)/;
30
+ var { loadEnvConfig } = nextEnv.default || nextEnv;
30
31
  async function loadEnvironmentConfig(dir, dev) {
31
32
  return loadEnvConfig(dir, dev, Log);
32
33
  }
@@ -637,6 +638,10 @@ var isDefined = (value) => value !== void 0;
637
638
  // src/plugins/next-swc/plugin.ts
638
639
  var excluded = /[\\/]((cache[\\/][^\\/]+\.zip[\\/])|virtual:)[\\/]/;
639
640
  var included = /\.((c|m)?(j|t)sx?)$/;
641
+ var loadJsConfig = (
642
+ // biome-ignore lint/suspicious/noExplicitAny: CJS support
643
+ nextLoadJsConfig.default || nextLoadJsConfig
644
+ );
640
645
  function vitePluginNextSwc(rootDir, nextConfigResolver) {
641
646
  let loadedJSConfig;
642
647
  let nextDirectories;
@@ -905,6 +910,10 @@ var vitePluginNextMocks = () => ({
905
910
 
906
911
  // src/index.ts
907
912
  var require6 = createRequire(import.meta.url);
913
+ var loadConfig = (
914
+ // biome-ignore lint/suspicious/noExplicitAny: CJS support
915
+ nextServerConfig.default || nextServerConfig
916
+ );
908
917
  function VitePlugin({ dir = process.cwd() } = {}) {
909
918
  const resolvedDir = resolve(dir);
910
919
  const nextConfigResolver = Promise.withResolvers();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-storybook-nextjs",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "vite-plugin",
@@ -20,8 +20,8 @@
20
20
  "exports": {
21
21
  ".": {
22
22
  "types": "./dist/index.d.ts",
23
- "browser": "./dist/index.js",
24
- "node": "./dist/index.cjs"
23
+ "import": "./dist/index.js",
24
+ "require": "./dist/index.cjs"
25
25
  },
26
26
  "./browser/mocks/cache": "./dist/plugins/next-mocks/alias/cache/index.js",
27
27
  "./browser/mocks/navigation": "./dist/plugins/next-mocks/alias/navigation/index.js",