Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
@cosmic-design/style
Advanced tools
/** package.json */
{
"exports": {
"./*": "./dist/*", /** compiled css **/
"./common": "./src/common" /** souce code css **/
},
}
.
├── dist
│ ├── utilities.css # Tool CSS
│ ├── button.module.css # Component CSS, including default & prefab style
│ ├── global.css # Global CSS = Tool CSS + CSS Variables
├── src
│ ├── common
│ │ ├── theme.css # CSS Variables
以下内容为组件代码库引用 @cosmic-design/style 的方式
import style "@cosmic-design/style/button.module.css";
;import style from '@cosmic-design/style/button.modules.css';
const ButtonTemplate = `<div class="${style.button} cos-sm"></div>`
以下内容为组件/业务代码库,如何使用工具样式/组件样式
<!-- 使用组件的变体修饰 -->
<button class="cos-lg" >大号按钮</button>
<!-- 使用组件的变体修饰 -->
<button class="cos-rounded" >放行按钮</button>
<!-- 使用组件的预制修饰 -->
<button class="cos-dashed" >描边按钮</button>
衍生外观的实现位于 component/Button/button-dashed.module.less 中,编译时打包到 dist/button.module.css 中。
目前在 vite.config.js 中对 CSS Module 编译进行了基本配置
{
modules: {
scopeBehaviour: 'local', // 默认配置, 全局样式需要加 :global() 来避免className编译
localsConvention: 'camelCase', // js的产出中增加驼峰变量名,以便于 style.buttonPrefix 方式引用
generateScopedName: "cos-[local]" // className 编译规则, 目前cos-前缀在这里统一添加
}
}
FAQs
## Exports
We found that @cosmic-design/style demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 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.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.