Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
@storybook/core
Advanced tools
The @storybook/core package is a part of Storybook, which is an open-source tool for developing UI components in isolation for React, Vue, Angular, and many other frameworks. It allows developers to create component libraries, interactive examples, and UI documentation. The core package is responsible for the fundamental functionalities of Storybook, including the server, UI, and the management of stories.
Custom Storybook Configuration
This code snippet demonstrates how to customize Storybook's configuration, including specifying where to find stories, which addons to use, the framework (e.g., React), and the builder (e.g., Webpack 5).
module.exports = {
stories: ['../src/**/*.stories.js'],
addons: ['@storybook/addon-links', '@storybook/addon-essentials'],
framework: '@storybook/react',
core: {
builder: 'webpack5'
}
};
Adding Decorators
Decorators are a way to wrap stories with extra markup or styling. This code sample shows how to add a decorator globally in `.storybook/preview.js` that adds margin around each story.
export const decorators = [(Story) => <div style={{ margin: '3em' }}><Story/></div>];
Custom Webpack Configuration
This demonstrates how to extend Storybook's default Webpack configuration to support additional file types or loaders, in this case, adding support for SCSS files.
const path = require('path');
module.exports = {
webpackFinal: async (config) => {
config.module.rules.push({
test: /\.scss$/,
use: ['style-loader', 'css-loader', 'sass-loader'],
include: path.resolve(__dirname, '../'),
});
return config;
},
};
Docz is a documentation tool that uses MDX to help you write documentation and build component libraries. It's similar to Storybook in that it focuses on components but differs in its approach by leveraging Markdown and providing a more documentation-oriented experience.
The @storybook/core
package is the core of Storybook. It is responsible for the following:
This package is not intended to be used by anyone but storybook internally.
Even though this is where all of the code is located, it is NOT to be the entry point when using functionality within!
Consumers of the code should import like so:
import { addons } from 'storybook/internal/manager-api';
Importing from @storybook/core
is explicitly NOT supported; it WILL break in a future version of storybook, very likely in a non-major version bump.
@storybook/core
In the following packages you should import from @storybook/core
(and ONLY from @storybook/core
):
@storybook/core
@storybook/codemod
To prevent cyclical dependencies, these packages cannot depend on the storybook
package.
storybook/internal
In every other package you should import from storybook/internal
(and ONLY from storybook/internal
).
The heuristic is simple:
If you see a peerDependency on
storybook
in thepackage.json
of the package you are working on, you should import fromstorybook/internal
.
storybook
package itselfThe sole exception is the storybook
package itself.
Obviously, the storybook
package cannot depend on itself, so it must import from @storybook/core
.
FAQs
Storybook framework-agnostic API
The npm package @storybook/core receives a total of 2,030,556 weekly downloads. As such, @storybook/core popularity was classified as popular.
We found that @storybook/core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 12 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.