@storybook/csf-plugin
Advanced tools
Comparing version 0.0.0-pr-28585-sha-af48f0d6 to 0.0.0-pr-28607-sha-54ec63fe
@@ -1,1 +0,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 src_exports={};__export(src_exports,{esbuild:()=>esbuild,rollup:()=>rollup,unplugin:()=>unplugin,vite:()=>vite,webpack:()=>webpack});module.exports=__toCommonJS(src_exports);var import_unplugin=require("unplugin");var import_csf_tools=require("storybook/internal/csf-tools"),import_promises=__toESM(require("fs/promises"));var STORIES_REGEX=/(?<!node_modules.*)\.(story|stories)\.[tj]sx?$/;var logger=console;function rollupBasedPlugin(options){return{name:"plugin-csf",async transform(code,id){if(!STORIES_REGEX.test(id))return;let sourceCode=await import_promises.default.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:")||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}); | ||
"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 src_exports={};__export(src_exports,{esbuild:()=>esbuild,rollup:()=>rollup,unplugin:()=>unplugin,vite:()=>vite,webpack:()=>webpack});module.exports=__toCommonJS(src_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");var logger=console;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:")||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}); |
@@ -1,1 +0,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 webpack_loader_exports={};__export(webpack_loader_exports,{default:()=>webpack_loader_default});module.exports=__toCommonJS(webpack_loader_exports);var import_promises=__toESM(require("fs/promises")),import_csf_tools=require("storybook/internal/csf-tools");async function loader(content,map){let callback=this.async(),options=this.getOptions(),id=this.resourcePath,sourceCode=await import_promises.default.readFile(id,"utf-8");try{let makeTitle=userTitle=>userTitle||"default",csf=(0,import_csf_tools.loadCsf)(content,{makeTitle}).parse(),csfSource=(0,import_csf_tools.loadCsf)(sourceCode,{makeTitle}).parse();(0,import_csf_tools.enrichCsf)(csf,csfSource,options);let formattedCsf=(0,import_csf_tools.formatCsf)(csf,{sourceMaps:!0,inputSourceMap:map,sourceFileName:id},content);if(typeof formattedCsf=="string")return callback(null,formattedCsf,map);callback(null,formattedCsf.code,formattedCsf.map)}catch(err){err.message?.startsWith("CSF:")||console.warn(err.message),callback(null,content,map)}}var webpack_loader_default=loader; | ||
"use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __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 __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var webpack_loader_exports={};__export(webpack_loader_exports,{default:()=>webpack_loader_default});module.exports=__toCommonJS(webpack_loader_exports);var import_promises=require("fs/promises"),import_csf_tools=require("storybook/internal/csf-tools");async function loader(content,map){let callback=this.async(),options=this.getOptions(),id=this.resourcePath,sourceCode=await(0,import_promises.readFile)(id,"utf-8");try{let makeTitle=userTitle=>userTitle||"default",csf=(0,import_csf_tools.loadCsf)(content,{makeTitle}).parse(),csfSource=(0,import_csf_tools.loadCsf)(sourceCode,{makeTitle}).parse();(0,import_csf_tools.enrichCsf)(csf,csfSource,options);let formattedCsf=(0,import_csf_tools.formatCsf)(csf,{sourceMaps:!0,inputSourceMap:map,sourceFileName:id},content);if(typeof formattedCsf=="string")return callback(null,formattedCsf,map);callback(null,formattedCsf.code,formattedCsf.map)}catch(err){err.message?.startsWith("CSF:")||console.warn(err.message),callback(null,content,map)}}var webpack_loader_default=loader; |
{ | ||
"name": "@storybook/csf-plugin", | ||
"version": "0.0.0-pr-28585-sha-af48f0d6", | ||
"version": "0.0.0-pr-28607-sha-54ec63fe", | ||
"description": "Enrich CSF files via static analysis", | ||
@@ -49,4 +49,4 @@ "keywords": [ | ||
"scripts": { | ||
"check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts", | ||
"prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts" | ||
"check": "jiti ../../../scripts/prepare/check.ts", | ||
"prep": "jiti ../../../scripts/prepare/bundle.ts" | ||
}, | ||
@@ -60,3 +60,3 @@ "dependencies": { | ||
"peerDependencies": { | ||
"storybook": "^0.0.0-pr-28585-sha-af48f0d6" | ||
"storybook": "^0.0.0-pr-28607-sha-54ec63fe" | ||
}, | ||
@@ -63,0 +63,0 @@ "publishConfig": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
5
10484
58