Skip to content

Commit 0719206

Browse files
committed
chore: fix 30 of 31 security advisories in devDependencies
- Upgrade Storybook v7 → v10 (resolves critical Handlebars injection, clears lodash/tar/minimatch chains from the webpack5 builder) - Upgrade rollup v1 → v4 + migrate to @rollup/plugin-* (resolves DOM clobbering and path traversal advisories) - Upgrade rimraf v3 → v5 (drops old glob → minimatch chain) - Add yarn resolutions to force patched versions of: handlebars, lodash, flatted, yaml, serialize-javascript, picomatch - Exclude src/stories from main tsconfig; add tsconfig.storybook.json with moduleResolution:bundler for Storybook v10 type compat Audit: 213 paths (31 advisories) → 1 path (1 low advisory). Published package is unaffected — zero runtime dependencies.
1 parent e6d8fda commit 0719206

7 files changed

Lines changed: 1006 additions & 3779 deletions

File tree

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ module.exports = {
1818
'plugin:@typescript-eslint/recommended',
1919
'plugin:@typescript-eslint/recommended-requiring-type-checking',
2020
'prettier',
21+
'plugin:storybook/recommended',
2122
],
2223
settings: {
2324
react: {

.storybook/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const config: StorybookConfig = {
55
'../src/**/*.stories.@(js|jsx|ts|tsx)',
66
'../src/stories/stories.tsx',
77
],
8-
addons: ['@storybook/addon-essentials'],
8+
addons: ['@storybook/addon-docs'],
99
framework: {
1010
name: '@storybook/react-webpack5',
1111
options: {},

package.json

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,8 @@
5353
"@babel/preset-react": "^7.28.5",
5454
"@babel/preset-typescript": "^7.28.5",
5555
"@size-limit/preset-small-lib": "^12.0.1",
56-
"@storybook/addon-essentials": "^7.6.0",
57-
"@storybook/react": "^7.6.0",
58-
"@storybook/react-webpack5": "^7.6.0",
56+
"@storybook/react": "^10.3.5",
57+
"@storybook/react-webpack5": "^10.3.5",
5958
"@testing-library/react": "^12.1.5",
6059
"@types/jest": "^29.5.14",
6160
"@types/react": "^17.0.0",
@@ -74,14 +73,16 @@
7473
"prettier": "^2.8.0",
7574
"react": "^17.0.2",
7675
"react-dom": "^17.0.2",
77-
"rimraf": "^3.0.0",
78-
"rollup": "^1.26.3",
79-
"rollup-plugin-node-resolve": "^5.2.0",
80-
"rollup-plugin-typescript2": "^0.25.2",
76+
"@rollup/plugin-node-resolve": "^15.0.0",
77+
"@rollup/plugin-typescript": "^11.0.0",
78+
"rimraf": "^5.0.0",
79+
"rollup": "^4.0.0",
8180
"size-limit": "^12.0.1",
82-
"storybook": "^7.6.0",
81+
"storybook": "^10.3.5",
8382
"ts-jest": "^29.4.6",
84-
"typescript": "^4.9.0"
83+
"typescript": "^4.9.0",
84+
"eslint-plugin-storybook": "10.3.5",
85+
"@storybook/addon-docs": "^10.3.5"
8586
},
8687
"dependencies": {
8788
"throttle-debounce": "^2.1.0"
@@ -96,6 +97,14 @@
9697
"limit": "6 kB"
9798
}
9899
],
100+
"resolutions": {
101+
"picomatch": ">=2.3.2",
102+
"handlebars": ">=4.7.9",
103+
"lodash": ">=4.17.23",
104+
"flatted": ">=3.4.2",
105+
"yaml": ">=2.8.3",
106+
"serialize-javascript": ">=7.0.5"
107+
},
99108
"lint-staged": {
100109
"*.{js,css,json,md}": [
101110
"prettier --write"

rollup.config.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import resolve from 'rollup-plugin-node-resolve';
2-
import typescript from 'rollup-plugin-typescript2';
3-
import pkg from './package.json';
1+
import resolve from '@rollup/plugin-node-resolve';
2+
import typescript from '@rollup/plugin-typescript';
3+
import { readFileSync } from 'fs';
4+
const pkg = JSON.parse(readFileSync('./package.json', 'utf-8'));
45
export default {
56
input: './src/index.tsx',
67
output: [
@@ -22,5 +23,5 @@ export default {
2223
},
2324
],
2425
external: [...Object.keys(pkg.peerDependencies || {}), 'react/jsx-runtime'],
25-
plugins: [resolve(), typescript({ useTsconfigDeclarationDir: true })],
26+
plugins: [resolve(), typescript()],
2627
};

tsconfig.json

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,23 @@
66
"lib": [
77
"ES2019",
88
"DOM"
9-
], /* Specify library files to be included in the compilation. */
9+
] /* Specify library files to be included in the compilation. */,
1010
// "allowJs": true, /* Allow javascript files to be compiled. */
1111
// "checkJs": true, /* Report errors in .js files. */
1212
"jsx": "react-jsx" /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */,
1313
"declaration": true /* Generates corresponding '.d.ts' file. */,
1414
"declarationDir": "./dist",
15-
"declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
16-
"sourceMap": true, /* Generates corresponding '.map' file. */
15+
"declarationMap": true /* Generates a sourcemap for each corresponding '.d.ts' file. */,
16+
"sourceMap": true /* Generates corresponding '.map' file. */,
1717
// "outFile": "./", /* Concatenate and emit output to single file. */
18-
"outDir": "./dist", /* Redirect output structure to the directory. */
18+
"outDir": "./dist" /* Redirect output structure to the directory. */,
1919
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
2020
// "composite": true, /* Enable project compilation */
2121
// "removeComments": true, /* Do not emit comments to output. */
2222
// "noEmit": true, /* Do not emit outputs. */
2323
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
2424
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
25-
"isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
25+
"isolatedModules": true /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */,
2626
/* Strict Type-Checking Options */
2727
"strict": true /* Enable all strict type-checking options. */,
2828
"noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */,
@@ -47,7 +47,7 @@
4747
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
4848
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
4949
"skipLibCheck": true,
50-
"forceConsistentCasingInFileNames": true,
50+
"forceConsistentCasingInFileNames": true
5151
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
5252
/* Source Map Options */
5353
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
@@ -64,8 +64,5 @@
6464
"jest.config.js",
6565
"rollup.config.js"
6666
],
67-
"exclude": [
68-
"node_modules",
69-
"dist"
70-
]
71-
}
67+
"exclude": ["node_modules", "dist", "src/stories"]
68+
}

tsconfig.storybook.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"moduleResolution": "bundler",
5+
"noEmit": true
6+
},
7+
"include": ["src/stories/**/*", ".storybook/**/*"]
8+
}

0 commit comments

Comments
 (0)