@storybook/csf-plugin 8.2.0-alpha.9 → 8.2.0-beta.1
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.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +2 -2
- package/dist/webpack-loader.d.ts +1 -1
- package/dist/webpack-loader.js +1 -1
- package/dist/webpack-loader.mjs +1 -1
- package/package.json +4 -2
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import * as _rollup from 'rollup';
|
|
|
3
3
|
import * as _webpack from 'webpack';
|
|
4
4
|
import * as _esbuild from 'esbuild';
|
|
5
5
|
import * as _unplugin from 'unplugin';
|
|
6
|
-
import { EnrichCsfOptions } from '
|
|
6
|
+
import { EnrichCsfOptions } from 'storybook/internal/csf-tools';
|
|
7
7
|
|
|
8
8
|
type CsfPluginOptions = EnrichCsfOptions;
|
|
9
9
|
declare const unplugin: _unplugin.UnpluginInstance<EnrichCsfOptions, boolean>;
|
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 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("
|
|
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});
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { __require } from './chunk-MXFP7CYD.mjs';
|
|
2
2
|
import { createUnplugin } from 'unplugin';
|
|
3
|
-
import { loadCsf, enrichCsf, formatCsf } from '
|
|
3
|
+
import { loadCsf, enrichCsf, formatCsf } from 'storybook/internal/csf-tools';
|
|
4
4
|
import fs from 'fs/promises';
|
|
5
5
|
|
|
6
|
-
var STORIES_REGEX
|
|
6
|
+
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 fs.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
7
|
|
|
8
8
|
export { esbuild, rollup, unplugin, vite, webpack };
|
package/dist/webpack-loader.d.ts
CHANGED
package/dist/webpack-loader.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 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("
|
|
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},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;
|
package/dist/webpack-loader.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './chunk-MXFP7CYD.mjs';
|
|
2
2
|
import fs from 'fs/promises';
|
|
3
|
-
import { loadCsf, enrichCsf, formatCsf } from '
|
|
3
|
+
import { loadCsf, enrichCsf, formatCsf } from 'storybook/internal/csf-tools';
|
|
4
4
|
|
|
5
5
|
async function loader(content,map){let callback=this.async(),options=this.getOptions(),id=this.resourcePath,sourceCode=await fs.readFile(id,"utf-8");try{let makeTitle=userTitle=>userTitle||"default",csf=loadCsf(content,{makeTitle}).parse(),csfSource=loadCsf(sourceCode,{makeTitle}).parse();enrichCsf(csf,csfSource,options);let formattedCsf=formatCsf(csf,{sourceMaps:!0,inputSourceMap:map},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;
|
|
6
6
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/csf-plugin",
|
|
3
|
-
"version": "8.2.0-
|
|
3
|
+
"version": "8.2.0-beta.1",
|
|
4
4
|
"description": "Enrich CSF files via static analysis",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook"
|
|
@@ -50,12 +50,14 @@
|
|
|
50
50
|
"prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@storybook/csf-tools": "8.2.0-alpha.9",
|
|
54
53
|
"unplugin": "^1.3.1"
|
|
55
54
|
},
|
|
56
55
|
"devDependencies": {
|
|
57
56
|
"typescript": "^5.3.2"
|
|
58
57
|
},
|
|
58
|
+
"peerDependencies": {
|
|
59
|
+
"storybook": "^8.2.0-beta.1"
|
|
60
|
+
},
|
|
59
61
|
"publishConfig": {
|
|
60
62
|
"access": "public"
|
|
61
63
|
},
|