@storybook/preset-server-webpack
Advanced tools
Comparing version
@@ -1,44 +0,1 @@ | ||
import CJS_COMPAT_NODE_URL_qqg2rv63yv9 from 'node:url'; | ||
import CJS_COMPAT_NODE_PATH_qqg2rv63yv9 from 'node:path'; | ||
import CJS_COMPAT_NODE_MODULE_qqg2rv63yv9 from "node:module"; | ||
var __filename = CJS_COMPAT_NODE_URL_qqg2rv63yv9.fileURLToPath(import.meta.url); | ||
var __dirname = CJS_COMPAT_NODE_PATH_qqg2rv63yv9.dirname(__filename); | ||
var require = CJS_COMPAT_NODE_MODULE_qqg2rv63yv9.createRequire(import.meta.url); | ||
// ------------------------------------------------------------ | ||
// end of CJS compatibility banner, injected by Storybook's esbuild configuration | ||
// ------------------------------------------------------------ | ||
import { | ||
__name | ||
} from "./_node-chunks/chunk-DSZH3A7S.js"; | ||
// src/index.ts | ||
import { fileURLToPath } from "node:url"; | ||
var webpack = /* @__PURE__ */ __name((config) => { | ||
const rules = [ | ||
...config.module?.rules || [], | ||
{ | ||
type: "javascript/auto", | ||
test: /\.stories\.json$/, | ||
use: fileURLToPath(import.meta.resolve("@storybook/preset-server-webpack/webpack-loader")) | ||
}, | ||
{ | ||
type: "javascript/auto", | ||
test: /\.stories\.ya?ml/, | ||
use: [ | ||
fileURLToPath(import.meta.resolve("@storybook/preset-server-webpack/webpack-loader")), | ||
{ | ||
loader: fileURLToPath(import.meta.resolve("yaml-loader")), | ||
options: { asJSON: true } | ||
} | ||
] | ||
} | ||
]; | ||
config.module = config.module || {}; | ||
config.module.rules = rules; | ||
return config; | ||
}, "webpack"); | ||
export { | ||
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 index_exports={};__export(index_exports,{webpack:()=>webpack});module.exports=__toCommonJS(index_exports);var webpack=config=>{let rules=[...config.module?.rules||[],{type:"javascript/auto",test:/\.stories\.json$/,use:require.resolve("@storybook/preset-server-webpack/dist/loader")},{type:"javascript/auto",test:/\.stories\.ya?ml/,use:[require.resolve("@storybook/preset-server-webpack/dist/loader"),{loader:require.resolve("yaml-loader"),options:{asJSON:!0}}]}];return config.module=config.module||{},config.module.rules=rules,config};0&&(module.exports={webpack}); |
@@ -1,77 +0,12 @@ | ||
import CJS_COMPAT_NODE_URL_qqg2rv63yv9 from 'node:url'; | ||
import CJS_COMPAT_NODE_PATH_qqg2rv63yv9 from 'node:path'; | ||
import CJS_COMPAT_NODE_MODULE_qqg2rv63yv9 from "node:module"; | ||
var __filename = CJS_COMPAT_NODE_URL_qqg2rv63yv9.fileURLToPath(import.meta.url); | ||
var __dirname = CJS_COMPAT_NODE_PATH_qqg2rv63yv9.dirname(__filename); | ||
var require = CJS_COMPAT_NODE_MODULE_qqg2rv63yv9.createRequire(import.meta.url); | ||
// ------------------------------------------------------------ | ||
// end of CJS compatibility banner, injected by Storybook's esbuild configuration | ||
// ------------------------------------------------------------ | ||
import { | ||
__name | ||
} from "./_node-chunks/chunk-DSZH3A7S.js"; | ||
// src/lib/compiler/stringifier.ts | ||
import { identifier } from "safe-identifier"; | ||
import { dedent } from "ts-dedent"; | ||
function stringifyObject(object, level = 0, excludeOuterParams = false) { | ||
if (typeof object === "string") { | ||
return JSON.stringify(object); | ||
} | ||
const indent = " ".repeat(level); | ||
if (Array.isArray(object)) { | ||
const arrayStrings = object.map((item) => stringifyObject(item, level + 1)); | ||
const arrayString = arrayStrings.join(`, | ||
${indent} `); | ||
if (excludeOuterParams) { | ||
return arrayString; | ||
} | ||
return `[ | ||
"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 loader_exports={};__export(loader_exports,{default:()=>loader_default});module.exports=__toCommonJS(loader_exports);var import_ts_dedent=require("ts-dedent"),{identifier}=require("safe-identifier");function stringifyObject(object,level=0,excludeOuterParams=!1){if(typeof object=="string")return JSON.stringify(object);let indent=" ".repeat(level);if(Array.isArray(object)){let arrayString=object.map(item=>stringifyObject(item,level+1)).join(`, | ||
${indent} `);return excludeOuterParams?arrayString:`[ | ||
${indent} ${arrayString} | ||
${indent}]`; | ||
} | ||
if (typeof object === "object") { | ||
let objectString = ""; | ||
if (Object.keys(object).length > 0) { | ||
const objectStrings = Object.keys(object).map((key) => { | ||
const value = stringifyObject(object[key], level + 1); | ||
return ` | ||
${indent} ${key}: ${value}`; | ||
}); | ||
objectString = objectStrings.join(","); | ||
} | ||
if (excludeOuterParams) { | ||
return objectString; | ||
} | ||
if (objectString.length === 0) { | ||
return "{}"; | ||
} | ||
return `{${objectString} | ||
${indent}}`; | ||
} | ||
return object; | ||
} | ||
__name(stringifyObject, "stringifyObject"); | ||
function stringifyImports(imports) { | ||
if (Object.keys(imports).length === 0) { | ||
return ""; | ||
} | ||
return Object.entries(imports).map(([module, names]) => `import { ${names.sort().join(", ")} } from '${module}'; | ||
`).join(""); | ||
} | ||
__name(stringifyImports, "stringifyImports"); | ||
function stringifyDecorators(decorators) { | ||
return decorators && decorators.length > 0 ? ` | ||
${indent}]`}if(typeof object=="object"){let objectString="";return Object.keys(object).length>0&&(objectString=Object.keys(object).map(key=>{let value=stringifyObject(object[key],level+1);return` | ||
${indent} ${key}: ${value}`}).join(",")),excludeOuterParams?objectString:objectString.length===0?"{}":`{${objectString} | ||
${indent}}`}return object}function stringifyImports(imports){return Object.keys(imports).length===0?"":Object.entries(imports).map(([module2,names])=>`import { ${names.sort().join(", ")} } from '${module2}'; | ||
`).join("")}function stringifyDecorators(decorators){return decorators&&decorators.length>0?` | ||
decorators: [ | ||
${decorators.join(",\n ")} | ||
],` : ""; | ||
} | ||
__name(stringifyDecorators, "stringifyDecorators"); | ||
function stringifyDefault(section) { | ||
const { title, imports, decorators, stories, ...options } = section; | ||
const decoratorsString = stringifyDecorators(decorators); | ||
const optionsString = stringifyObject(options, 0, true); | ||
return dedent` | ||
${decorators.join(`, | ||
`)} | ||
],`:""}function stringifyDefault(section){let{title,imports,decorators,stories,...options}=section,decoratorsString=stringifyDecorators(decorators),optionsString=stringifyObject(options,0,!0);return import_ts_dedent.dedent` | ||
export default { | ||
@@ -81,49 +16,4 @@ title: ${JSON.stringify(title)},${decoratorsString}${optionsString} | ||
`; | ||
} | ||
__name(stringifyDefault, "stringifyDefault"); | ||
function stringifyStory(story) { | ||
const { name, ...options } = story; | ||
const storyId = identifier(name); | ||
const exportedStory = { name, ...options }; | ||
const storyStrings = [`export const ${storyId} = ${stringifyObject(exportedStory)};`, ""]; | ||
return storyStrings.join("\n"); | ||
} | ||
__name(stringifyStory, "stringifyStory"); | ||
function stringifySection(section) { | ||
const sectionString = [ | ||
stringifyImports(section.imports), | ||
stringifyDefault(section), | ||
...section.stories.map((story) => stringifyStory(story)) | ||
].join("\n"); | ||
return sectionString; | ||
} | ||
__name(stringifySection, "stringifySection"); | ||
// src/lib/compiler/index.ts | ||
function createSection(args) { | ||
return { | ||
imports: {}, | ||
decorators: [], | ||
...args | ||
}; | ||
} | ||
__name(createSection, "createSection"); | ||
function compileCsfModule(args) { | ||
return stringifySection(createSection(args)); | ||
} | ||
__name(compileCsfModule, "compileCsfModule"); | ||
// src/loader.ts | ||
var loader_default = /* @__PURE__ */ __name((content) => { | ||
try { | ||
const after = compileCsfModule(JSON.parse(content)); | ||
return after; | ||
} catch (e) { | ||
console.log(content, e); | ||
} | ||
return content; | ||
}, "default"); | ||
export { | ||
loader_default as default | ||
}; | ||
`}function stringifyStory(story){let{name,...options}=story,storyId=identifier(name),exportedStory={name,...options};return[`export const ${storyId} = ${stringifyObject(exportedStory)};`,""].join(` | ||
`)}function stringifySection(section){return[stringifyImports(section.imports),stringifyDefault(section),...section.stories.map(story=>stringifyStory(story))].join(` | ||
`)}function createSection(args){return{imports:{},decorators:[],...args}}function compileCsfModule(args){return stringifySection(createSection(args))}var loader_default=content=>{try{return compileCsfModule(JSON.parse(content))}catch(e){console.log(content,e)}return content}; |
{ | ||
"name": "@storybook/preset-server-webpack", | ||
"version": "0.0.0-pr-32386-sha-09a230ff", | ||
"version": "0.0.0-pr-32391-sha-f5e829d5", | ||
"description": "Storybook for Server: View HTML snippets from a server in isolation with Hot Reloading.", | ||
@@ -22,11 +22,25 @@ "keywords": [ | ||
"license": "MIT", | ||
"type": "module", | ||
"exports": { | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"default": "./dist/index.js" | ||
"node": "./dist/index.js", | ||
"import": "./dist/index.mjs", | ||
"require": "./dist/index.js" | ||
}, | ||
"./loader": "./dist/loader.js", | ||
"./preset": { | ||
"types": "./dist/index.d.ts", | ||
"node": "./dist/index.js", | ||
"import": "./dist/index.mjs", | ||
"require": "./dist/index.js" | ||
}, | ||
"./dist/loader": { | ||
"types": "./dist/loader.d.ts", | ||
"import": "./dist/loader.mjs", | ||
"require": "./dist/loader.js" | ||
}, | ||
"./package.json": "./package.json" | ||
}, | ||
"main": "dist/index.js", | ||
"module": "dist/index.mjs", | ||
"types": "dist/index.d.ts", | ||
"files": [ | ||
@@ -40,10 +54,10 @@ "dist/**/*", | ||
"scripts": { | ||
"check": "jiti ../../../scripts/check/check-package.ts", | ||
"prep": "jiti ../../../scripts/build/build-package.ts" | ||
"check": "jiti ../../../scripts/prepare/check.ts", | ||
"prep": "jiti ../../../scripts/prepare/bundle.ts" | ||
}, | ||
"dependencies": { | ||
"@storybook/core-webpack": "0.0.0-pr-32386-sha-09a230ff", | ||
"safe-identifier": "^0.4.2", | ||
"@storybook/core-webpack": "0.0.0-pr-32391-sha-f5e829d5", | ||
"safe-identifier": "^0.4.1", | ||
"ts-dedent": "^2.0.0", | ||
"yaml-loader": "^0.8.1" | ||
"yaml-loader": "^0.8.0" | ||
}, | ||
@@ -53,11 +67,21 @@ "devDependencies": { | ||
"typescript": "^5.8.3", | ||
"yaml": "^2.8.0" | ||
"yaml": "^2.3.1" | ||
}, | ||
"peerDependencies": { | ||
"storybook": "^0.0.0-pr-32386-sha-09a230ff" | ||
"storybook": "^0.0.0-pr-32391-sha-f5e829d5" | ||
}, | ||
"engines": { | ||
"node": ">=20.0.0" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"gitHead": "a8e7fd8a655c69780bc20b9749d2699e45beae16" | ||
"bundler": { | ||
"entries": [ | ||
"./src/index.ts", | ||
"./src/loader.ts" | ||
], | ||
"platform": "node" | ||
}, | ||
"gitHead": "ce6a1e4a8d5ad69c699021a0b183df89cfc7b684" | ||
} |
@@ -1,1 +0,1 @@ | ||
export * from './src/index.js'; | ||
module.exports = require('./dist/index'); |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 2 instances in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
10205
20.48%10
42.86%63
-65.38%3
200%3
Infinity%No
NaN+ Added
- Removed
Updated
Updated