vite-plugin-storybook-nextjs 3.1.7 → 3.1.8--canary.82.dd5dbde.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 +26 -28
- package/dist/index.js +26 -28
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4069,16 +4069,14 @@ async function getFontFaceDeclarations2(options) {
|
|
|
4069
4069
|
if ("fontReferenceId" in localFontSrc) {
|
|
4070
4070
|
return tsDedent.dedent`@font-face {
|
|
4071
4071
|
font-family: ${id};
|
|
4072
|
-
src: url(${localFontSrc.fontReferenceId ? getPlaceholderFontUrl(localFontSrc.fontReferenceId) : `/@fs
|
|
4073
|
-
${weight ? `font-weight: ${weight};` : ""}
|
|
4074
|
-
${style ? `font-style: ${style};` : ""}
|
|
4072
|
+
src: url(${localFontSrc.fontReferenceId ? getPlaceholderFontUrl(localFontSrc.fontReferenceId) : `/@fs${localFontSrc.fontPath}`})
|
|
4075
4073
|
${fontDeclarations}
|
|
4076
4074
|
}`;
|
|
4077
4075
|
}
|
|
4078
4076
|
return localFontSrc.map((font) => {
|
|
4079
4077
|
return tsDedent.dedent`@font-face {
|
|
4080
4078
|
font-family: ${id};
|
|
4081
|
-
src: url(${font.path.fontReferenceId ? getPlaceholderFontUrl(font.path.fontReferenceId) : `/@fs
|
|
4079
|
+
src: url(${font.path.fontReferenceId ? getPlaceholderFontUrl(font.path.fontReferenceId) : `/@fs${font.path.fontPath}`});
|
|
4082
4080
|
${font.weight ? `font-weight: ${font.weight};` : ""}
|
|
4083
4081
|
${font.style ? `font-style: ${font.style};` : ""}
|
|
4084
4082
|
${fontDeclarations}
|
|
@@ -4106,7 +4104,7 @@ function getCSSMeta(options) {
|
|
|
4106
4104
|
.${className} {
|
|
4107
4105
|
font-family: ${options.fontFamily};
|
|
4108
4106
|
${isNextCSSPropertyValid(options.styles) ? `font-style: ${options.styles[0]};` : ""}
|
|
4109
|
-
${isNextCSSPropertyValid(options.weights)
|
|
4107
|
+
${isNextCSSPropertyValid(options.weights) ? `font-weight: ${options.weights[0]};` : ""}
|
|
4110
4108
|
}
|
|
4111
4109
|
|
|
4112
4110
|
${options.variable ? `.${variableClassName} { ${options.variable}: '${options.fontFamily}'; }` : ""}
|
|
@@ -4123,7 +4121,7 @@ function getCSSMeta(options) {
|
|
|
4123
4121
|
function getClassName({ styles, weights, fontFamily }) {
|
|
4124
4122
|
const font = fontFamily.replaceAll(" ", "-").toLowerCase();
|
|
4125
4123
|
const style = isNextCSSPropertyValid(styles) ? styles[0] : null;
|
|
4126
|
-
const weight = isNextCSSPropertyValid(weights) ? weights[0]
|
|
4124
|
+
const weight = isNextCSSPropertyValid(weights) ? weights[0] : null;
|
|
4127
4125
|
return `${font}${style ? `-${style}` : ""}${weight ? `-${weight}` : ""}`;
|
|
4128
4126
|
}
|
|
4129
4127
|
function getStylesObj({ styles, weights, fontFamily }) {
|
|
@@ -4299,21 +4297,6 @@ function vitePluginNextFont() {
|
|
|
4299
4297
|
}
|
|
4300
4298
|
};
|
|
4301
4299
|
}
|
|
4302
|
-
var require2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
|
|
4303
|
-
var VITEST_PLUGIN_NAME = "vite-plugin-storybook-nextjs";
|
|
4304
|
-
var isVitestEnv = process.env.VITEST === "true";
|
|
4305
|
-
function getExecutionEnvironment(config) {
|
|
4306
|
-
return isVitestEnv && config.test?.browser?.enabled !== true ? "node" : "browser";
|
|
4307
|
-
}
|
|
4308
|
-
var getNextjsVersion = () => require2("next/package.json").version;
|
|
4309
|
-
var getNextjsMajorVersion = () => {
|
|
4310
|
-
try {
|
|
4311
|
-
const version = getNextjsVersion();
|
|
4312
|
-
return Number.parseInt(version.split(".")[0], 10);
|
|
4313
|
-
} catch (error) {
|
|
4314
|
-
return 16;
|
|
4315
|
-
}
|
|
4316
|
-
};
|
|
4317
4300
|
|
|
4318
4301
|
// src/utils/swc/styles.ts
|
|
4319
4302
|
function getStyledComponentsOptions(styledComponentsConfig, development) {
|
|
@@ -4356,8 +4339,8 @@ function getEmotionOptions(emotionConfig, development) {
|
|
|
4356
4339
|
}
|
|
4357
4340
|
|
|
4358
4341
|
// src/utils/swc/options.ts
|
|
4359
|
-
var
|
|
4360
|
-
var regeneratorRuntimePath =
|
|
4342
|
+
var require2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
|
|
4343
|
+
var regeneratorRuntimePath = require2.resolve(
|
|
4361
4344
|
"next/dist/compiled/regenerator-runtime"
|
|
4362
4345
|
);
|
|
4363
4346
|
function getBaseSWCOptions({
|
|
@@ -4384,7 +4367,7 @@ function getBaseSWCOptions({
|
|
|
4384
4367
|
const useDefineForClassFields = Boolean(
|
|
4385
4368
|
jsConfig?.compilerOptions?.useDefineForClassFields
|
|
4386
4369
|
);
|
|
4387
|
-
const plugins = (swcPlugins ?? []).filter(Array.isArray).map(([name, options]) => [
|
|
4370
|
+
const plugins = (swcPlugins ?? []).filter(Array.isArray).map(([name, options]) => [require2.resolve(name), options]);
|
|
4388
4371
|
return {
|
|
4389
4372
|
jsc: {
|
|
4390
4373
|
...resolvedBaseUrl && paths ? {
|
|
@@ -4523,7 +4506,8 @@ var getVitestSWCTransformConfig = ({
|
|
|
4523
4506
|
}
|
|
4524
4507
|
} : {
|
|
4525
4508
|
env: {
|
|
4526
|
-
targets: utils_js.getSupportedBrowsers(rootDir, isDev)
|
|
4509
|
+
targets: utils_js.getSupportedBrowsers(rootDir, isDev),
|
|
4510
|
+
bugfixes: true
|
|
4527
4511
|
}
|
|
4528
4512
|
},
|
|
4529
4513
|
module: {
|
|
@@ -4572,9 +4556,8 @@ function vitePluginNextSwc(rootDir, nextConfigResolver) {
|
|
|
4572
4556
|
await loadSWCBindingsEagerly(nextConfig);
|
|
4573
4557
|
const serverWatchIgnored = config.server?.watch?.ignored;
|
|
4574
4558
|
const isServerWatchIgnoredArray = Array.isArray(serverWatchIgnored);
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
isServerEnvironment = config.test?.environment === "node" || config.test?.environment === "edge-runtime" || config.test?.browser?.enabled !== true;
|
|
4559
|
+
if (config.test?.environment === "node" || config.test?.environment === "edge-runtime" || config.test?.browser?.enabled !== false) {
|
|
4560
|
+
isServerEnvironment = true;
|
|
4578
4561
|
}
|
|
4579
4562
|
return {
|
|
4580
4563
|
// esbuild: {
|
|
@@ -4713,6 +4696,21 @@ var reservedWords = "break case class catch const continue debugger default dele
|
|
|
4713
4696
|
var builtins = "arguments Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl";
|
|
4714
4697
|
var forbiddenIdentifiers = new Set(`${reservedWords} ${builtins}`.split(" "));
|
|
4715
4698
|
forbiddenIdentifiers.add("");
|
|
4699
|
+
var require3 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
|
|
4700
|
+
var VITEST_PLUGIN_NAME = "vite-plugin-storybook-nextjs";
|
|
4701
|
+
var isVitestEnv = process.env.VITEST === "true";
|
|
4702
|
+
function getExecutionEnvironment(config) {
|
|
4703
|
+
return isVitestEnv && config.test?.browser?.enabled !== true ? "node" : "browser";
|
|
4704
|
+
}
|
|
4705
|
+
var getNextjsVersion = () => require3("next/package.json").version;
|
|
4706
|
+
var getNextjsMajorVersion = () => {
|
|
4707
|
+
try {
|
|
4708
|
+
const version = getNextjsVersion();
|
|
4709
|
+
return Number.parseInt(version.split(".")[0], 10);
|
|
4710
|
+
} catch (error) {
|
|
4711
|
+
return 16;
|
|
4712
|
+
}
|
|
4713
|
+
};
|
|
4716
4714
|
var require4 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
|
|
4717
4715
|
var getEntryPoint = (subPath, env) => require4.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
|
|
4718
4716
|
var getAlias = (env) => ({
|
package/dist/index.js
CHANGED
|
@@ -4036,16 +4036,14 @@ async function getFontFaceDeclarations2(options) {
|
|
|
4036
4036
|
if ("fontReferenceId" in localFontSrc) {
|
|
4037
4037
|
return dedent`@font-face {
|
|
4038
4038
|
font-family: ${id};
|
|
4039
|
-
src: url(${localFontSrc.fontReferenceId ? getPlaceholderFontUrl(localFontSrc.fontReferenceId) : `/@fs
|
|
4040
|
-
${weight ? `font-weight: ${weight};` : ""}
|
|
4041
|
-
${style ? `font-style: ${style};` : ""}
|
|
4039
|
+
src: url(${localFontSrc.fontReferenceId ? getPlaceholderFontUrl(localFontSrc.fontReferenceId) : `/@fs${localFontSrc.fontPath}`})
|
|
4042
4040
|
${fontDeclarations}
|
|
4043
4041
|
}`;
|
|
4044
4042
|
}
|
|
4045
4043
|
return localFontSrc.map((font) => {
|
|
4046
4044
|
return dedent`@font-face {
|
|
4047
4045
|
font-family: ${id};
|
|
4048
|
-
src: url(${font.path.fontReferenceId ? getPlaceholderFontUrl(font.path.fontReferenceId) : `/@fs
|
|
4046
|
+
src: url(${font.path.fontReferenceId ? getPlaceholderFontUrl(font.path.fontReferenceId) : `/@fs${font.path.fontPath}`});
|
|
4049
4047
|
${font.weight ? `font-weight: ${font.weight};` : ""}
|
|
4050
4048
|
${font.style ? `font-style: ${font.style};` : ""}
|
|
4051
4049
|
${fontDeclarations}
|
|
@@ -4073,7 +4071,7 @@ function getCSSMeta(options) {
|
|
|
4073
4071
|
.${className} {
|
|
4074
4072
|
font-family: ${options.fontFamily};
|
|
4075
4073
|
${isNextCSSPropertyValid(options.styles) ? `font-style: ${options.styles[0]};` : ""}
|
|
4076
|
-
${isNextCSSPropertyValid(options.weights)
|
|
4074
|
+
${isNextCSSPropertyValid(options.weights) ? `font-weight: ${options.weights[0]};` : ""}
|
|
4077
4075
|
}
|
|
4078
4076
|
|
|
4079
4077
|
${options.variable ? `.${variableClassName} { ${options.variable}: '${options.fontFamily}'; }` : ""}
|
|
@@ -4090,7 +4088,7 @@ function getCSSMeta(options) {
|
|
|
4090
4088
|
function getClassName({ styles, weights, fontFamily }) {
|
|
4091
4089
|
const font = fontFamily.replaceAll(" ", "-").toLowerCase();
|
|
4092
4090
|
const style = isNextCSSPropertyValid(styles) ? styles[0] : null;
|
|
4093
|
-
const weight = isNextCSSPropertyValid(weights) ? weights[0]
|
|
4091
|
+
const weight = isNextCSSPropertyValid(weights) ? weights[0] : null;
|
|
4094
4092
|
return `${font}${style ? `-${style}` : ""}${weight ? `-${weight}` : ""}`;
|
|
4095
4093
|
}
|
|
4096
4094
|
function getStylesObj({ styles, weights, fontFamily }) {
|
|
@@ -4266,21 +4264,6 @@ function vitePluginNextFont() {
|
|
|
4266
4264
|
}
|
|
4267
4265
|
};
|
|
4268
4266
|
}
|
|
4269
|
-
var require2 = createRequire(import.meta.url);
|
|
4270
|
-
var VITEST_PLUGIN_NAME = "vite-plugin-storybook-nextjs";
|
|
4271
|
-
var isVitestEnv = process.env.VITEST === "true";
|
|
4272
|
-
function getExecutionEnvironment(config) {
|
|
4273
|
-
return isVitestEnv && config.test?.browser?.enabled !== true ? "node" : "browser";
|
|
4274
|
-
}
|
|
4275
|
-
var getNextjsVersion = () => require2("next/package.json").version;
|
|
4276
|
-
var getNextjsMajorVersion = () => {
|
|
4277
|
-
try {
|
|
4278
|
-
const version = getNextjsVersion();
|
|
4279
|
-
return Number.parseInt(version.split(".")[0], 10);
|
|
4280
|
-
} catch (error) {
|
|
4281
|
-
return 16;
|
|
4282
|
-
}
|
|
4283
|
-
};
|
|
4284
4267
|
|
|
4285
4268
|
// src/utils/swc/styles.ts
|
|
4286
4269
|
function getStyledComponentsOptions(styledComponentsConfig, development) {
|
|
@@ -4323,8 +4306,8 @@ function getEmotionOptions(emotionConfig, development) {
|
|
|
4323
4306
|
}
|
|
4324
4307
|
|
|
4325
4308
|
// src/utils/swc/options.ts
|
|
4326
|
-
var
|
|
4327
|
-
var regeneratorRuntimePath =
|
|
4309
|
+
var require2 = createRequire(import.meta.url);
|
|
4310
|
+
var regeneratorRuntimePath = require2.resolve(
|
|
4328
4311
|
"next/dist/compiled/regenerator-runtime"
|
|
4329
4312
|
);
|
|
4330
4313
|
function getBaseSWCOptions({
|
|
@@ -4351,7 +4334,7 @@ function getBaseSWCOptions({
|
|
|
4351
4334
|
const useDefineForClassFields = Boolean(
|
|
4352
4335
|
jsConfig?.compilerOptions?.useDefineForClassFields
|
|
4353
4336
|
);
|
|
4354
|
-
const plugins = (swcPlugins ?? []).filter(Array.isArray).map(([name, options]) => [
|
|
4337
|
+
const plugins = (swcPlugins ?? []).filter(Array.isArray).map(([name, options]) => [require2.resolve(name), options]);
|
|
4355
4338
|
return {
|
|
4356
4339
|
jsc: {
|
|
4357
4340
|
...resolvedBaseUrl && paths ? {
|
|
@@ -4490,7 +4473,8 @@ var getVitestSWCTransformConfig = ({
|
|
|
4490
4473
|
}
|
|
4491
4474
|
} : {
|
|
4492
4475
|
env: {
|
|
4493
|
-
targets: getSupportedBrowsers(rootDir, isDev)
|
|
4476
|
+
targets: getSupportedBrowsers(rootDir, isDev),
|
|
4477
|
+
bugfixes: true
|
|
4494
4478
|
}
|
|
4495
4479
|
},
|
|
4496
4480
|
module: {
|
|
@@ -4539,9 +4523,8 @@ function vitePluginNextSwc(rootDir, nextConfigResolver) {
|
|
|
4539
4523
|
await loadSWCBindingsEagerly(nextConfig);
|
|
4540
4524
|
const serverWatchIgnored = config.server?.watch?.ignored;
|
|
4541
4525
|
const isServerWatchIgnoredArray = Array.isArray(serverWatchIgnored);
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
isServerEnvironment = config.test?.environment === "node" || config.test?.environment === "edge-runtime" || config.test?.browser?.enabled !== true;
|
|
4526
|
+
if (config.test?.environment === "node" || config.test?.environment === "edge-runtime" || config.test?.browser?.enabled !== false) {
|
|
4527
|
+
isServerEnvironment = true;
|
|
4545
4528
|
}
|
|
4546
4529
|
return {
|
|
4547
4530
|
// esbuild: {
|
|
@@ -4680,6 +4663,21 @@ var reservedWords = "break case class catch const continue debugger default dele
|
|
|
4680
4663
|
var builtins = "arguments Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl";
|
|
4681
4664
|
var forbiddenIdentifiers = new Set(`${reservedWords} ${builtins}`.split(" "));
|
|
4682
4665
|
forbiddenIdentifiers.add("");
|
|
4666
|
+
var require3 = createRequire(import.meta.url);
|
|
4667
|
+
var VITEST_PLUGIN_NAME = "vite-plugin-storybook-nextjs";
|
|
4668
|
+
var isVitestEnv = process.env.VITEST === "true";
|
|
4669
|
+
function getExecutionEnvironment(config) {
|
|
4670
|
+
return isVitestEnv && config.test?.browser?.enabled !== true ? "node" : "browser";
|
|
4671
|
+
}
|
|
4672
|
+
var getNextjsVersion = () => require3("next/package.json").version;
|
|
4673
|
+
var getNextjsMajorVersion = () => {
|
|
4674
|
+
try {
|
|
4675
|
+
const version = getNextjsVersion();
|
|
4676
|
+
return Number.parseInt(version.split(".")[0], 10);
|
|
4677
|
+
} catch (error) {
|
|
4678
|
+
return 16;
|
|
4679
|
+
}
|
|
4680
|
+
};
|
|
4683
4681
|
var require4 = createRequire(import.meta.url);
|
|
4684
4682
|
var getEntryPoint = (subPath, env) => require4.resolve(`${VITEST_PLUGIN_NAME}/${env}/mocks/${subPath}`);
|
|
4685
4683
|
var getAlias = (env) => ({
|