@storybook/csf-plugin 9.1.0-alpha.5 → 9.1.0-alpha.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.js +1 -1
- package/dist/index.mjs +2 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var index_exports={};__export(index_exports,{esbuild:()=>esbuild,rollup:()=>rollup,unplugin:()=>unplugin,vite:()=>vite,webpack:()=>webpack});module.exports=__toCommonJS(index_exports);var import_unplugin=require("unplugin");var STORIES_REGEX=/(?<!node_modules.*)\.(story|stories)\.[tj]sx?$/;var import_promises=require("fs/promises"),import_csf_tools=require("storybook/internal/csf-tools")
|
|
1
|
+
"use strict";var __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var index_exports={};__export(index_exports,{esbuild:()=>esbuild,rollup:()=>rollup,unplugin:()=>unplugin,vite:()=>vite,webpack:()=>webpack});module.exports=__toCommonJS(index_exports);var import_unplugin=require("unplugin");var STORIES_REGEX=/(?<!node_modules.*)\.(story|stories)\.[tj]sx?$/;var import_promises=require("fs/promises"),import_csf_tools=require("storybook/internal/csf-tools"),import_node_logger=require("storybook/internal/node-logger");function rollupBasedPlugin(options){return{name:"plugin-csf",async transform(code,id){if(!STORIES_REGEX.test(id))return;let sourceCode=await(0,import_promises.readFile)(id,"utf-8");try{let makeTitle=userTitle=>userTitle||"default",csf=(0,import_csf_tools.loadCsf)(code,{makeTitle}).parse(),csfSource=(0,import_csf_tools.loadCsf)(sourceCode,{makeTitle}).parse();(0,import_csf_tools.enrichCsf)(csf,csfSource,options);let inputSourceMap=this.getCombinedSourcemap();return(0,import_csf_tools.formatCsf)(csf,{sourceMaps:!0,inputSourceMap},code)}catch(err){return err.message?.startsWith("CSF:")||import_node_logger.logger.warn(err.message),code}}}}var unplugin=(0,import_unplugin.createUnplugin)(options=>({name:"unplugin-csf",rollup:{...rollupBasedPlugin(options)},vite:{enforce:"pre",...rollupBasedPlugin(options)},webpack(compiler){compiler.options.module.rules.unshift({test:STORIES_REGEX,enforce:"post",use:{options,loader:require.resolve("@storybook/csf-plugin/dist/webpack-loader")}})},rspack(compiler){compiler.options.module.rules.unshift({test:STORIES_REGEX,enforce:"post",use:{options,loader:require.resolve("@storybook/csf-plugin/dist/webpack-loader")}})}})),{esbuild}=unplugin,{webpack}=unplugin,{rollup}=unplugin,{vite}=unplugin;0&&(module.exports={esbuild,rollup,unplugin,vite,webpack});
|
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,8 @@ import { __require } from './chunk-MXFP7CYD.mjs';
|
|
|
2
2
|
import { createUnplugin } from 'unplugin';
|
|
3
3
|
import { readFile } from 'node:fs/promises';
|
|
4
4
|
import { loadCsf, enrichCsf, formatCsf } from 'storybook/internal/csf-tools';
|
|
5
|
+
import { logger } from 'storybook/internal/node-logger';
|
|
5
6
|
|
|
6
|
-
var STORIES_REGEX=/(?<!node_modules.*)\.(story|stories)\.[tj]sx?$/;
|
|
7
|
+
var STORIES_REGEX=/(?<!node_modules.*)\.(story|stories)\.[tj]sx?$/;function rollupBasedPlugin(options){return {name:"plugin-csf",async transform(code,id){if(!STORIES_REGEX.test(id))return;let sourceCode=await readFile(id,"utf-8");try{let makeTitle=userTitle=>userTitle||"default",csf=loadCsf(code,{makeTitle}).parse(),csfSource=loadCsf(sourceCode,{makeTitle}).parse();enrichCsf(csf,csfSource,options);let inputSourceMap=this.getCombinedSourcemap();return formatCsf(csf,{sourceMaps:!0,inputSourceMap},code)}catch(err){return err.message?.startsWith("CSF:")||logger.warn(err.message),code}}}}var unplugin=createUnplugin(options=>({name:"unplugin-csf",rollup:{...rollupBasedPlugin(options)},vite:{enforce:"pre",...rollupBasedPlugin(options)},webpack(compiler){compiler.options.module.rules.unshift({test:STORIES_REGEX,enforce:"post",use:{options,loader:__require.resolve("@storybook/csf-plugin/dist/webpack-loader")}});},rspack(compiler){compiler.options.module.rules.unshift({test:STORIES_REGEX,enforce:"post",use:{options,loader:__require.resolve("@storybook/csf-plugin/dist/webpack-loader")}});}})),{esbuild}=unplugin,{webpack}=unplugin,{rollup}=unplugin,{vite}=unplugin;
|
|
7
8
|
|
|
8
9
|
export { esbuild, rollup, unplugin, vite, webpack };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/csf-plugin",
|
|
3
|
-
"version": "9.1.0-alpha.
|
|
3
|
+
"version": "9.1.0-alpha.7",
|
|
4
4
|
"description": "Enrich CSF files via static analysis",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook"
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"typescript": "^5.8.3"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"storybook": "^9.1.0-alpha.
|
|
59
|
+
"storybook": "^9.1.0-alpha.7"
|
|
60
60
|
},
|
|
61
61
|
"publishConfig": {
|
|
62
62
|
"access": "public"
|