Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@master/css-compiler

Package Overview
Dependencies
Maintainers
2
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@master/css-compiler - npm Package Compare versions

Comparing version 2.0.0-beta.18 to 2.0.0-beta.97

dist/extract.d.ts

22

dist/compiler.d.ts

@@ -1,12 +0,18 @@

import { CompilerOptions, CompilerSource } from './options';
import { Options } from './options';
import MasterCSS from '@master/css';
export default class MasterCSSCompiler {
options?: CompilerOptions;
constructor(options?: CompilerOptions);
initializing: Promise<any>;
import type { Config } from '@master/css';
import Techor from 'techor';
export default class MasterCSSCompiler extends Techor<Options, Config> {
constructor(options?: Options);
css: MasterCSS;
extractions: Set<string>;
extract({ name, content }: CompilerSource): string[];
insert(extractions: any): void;
log(name: any, content: any): void;
get resolvedModuleId(): string;
get moduleHMREvent(): string;
init(): this;
compile(): this;
extract(name: string, content: string): string[];
insert(name: string, content: string): boolean;
get sources(): string[];
checkSourcePath(name: string): boolean;
get config(): Config;
}

@@ -1,3 +0,3 @@

export { default as MasterCSSCompiler } from './compiler';
export { default as MasterCSSWebpackPlugin } from './webpack';
export { default as MasterCSSVitePlugin } from './vite';
export { default } from './compiler';
export { default as options } from './options';
export type { Options, Source } from './options';

@@ -1,17 +0,17 @@

import MasterCSS from '@master/css';
declare const options: CompilerOptions;
export declare type CompilerSource = {
import { Config } from '@master/css';
import type { Pattern as FastGlobPattern } from 'fast-glob';
import type { Options as TechorOptions } from 'techor';
declare const options: Options;
export declare type Source = {
name: string;
content: string;
};
export interface CompilerOptions {
output?: {
name: string;
dir: string;
};
accept?: (source: CompilerSource) => boolean;
extract?: (source: CompilerSource, css: MasterCSS) => string[];
config?: string;
debug?: string[] | boolean;
export interface Options extends TechorOptions<Config> {
module?: string;
sources?: FastGlobPattern[];
include?: FastGlobPattern[];
exclude?: FastGlobPattern[];
fixedClasses?: string[];
ignoredClasses?: string[] | RegExp[];
}
export default options;

@@ -1,147 +0,1 @@

{
"name": "@master/css-compiler",
"license": "MIT",
"description": "Compile Master CSS ahead of time with zero-configuration integration with build tools",
"author": "Aoyue Design LLC.",
"funding": "https://docs.master.co/css/donate",
"homepage": "https://css.master.co",
"repository": {
"type": "git",
"url": "https://github.com/master-co/css-compiler.git"
},
"keywords": [
"webpack",
"plugin",
"integration",
"vite",
"parcel",
"build tools",
"css",
"mastercss",
"vite-plugin"
],
"sideEffects": false,
"scripts": {
"build:cjs": "esbuild src/index.ts --bundle --outfile=dist/index.cjs --format=cjs --platform=node --external:@master/css --external:chalk",
"build:esm": "esbuild src/index.ts --bundle --outfile=dist/index.mjs --format=esm --platform=node --external:@master/css --external:chalk",
"dev:cjs": "npm run build:cjs -- --watch",
"dev:esm": "npm run build:esm -- --watch",
"prod": "rm -rf dist && npm run build:cjs -- --minify --sourcemap && npm run build:esm -- --minify --sourcemap && tsc --emitDeclarationOnly",
"test": "jest",
"lint": "eslint ./src"
},
"main": "./dist/index.cjs",
"jsnext:main": "./dist/index.mjs",
"browser": "./dist/index.browser.js",
"esnext": "./dist/index.mjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
".": {
"require": "./dist/index.cjs",
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts"
}
},
"jest": {
"testEnvironment": "node",
"transform": {
"^.+\\.(t|j)sx?$": "@swc/jest"
},
"testMatch": [
"<rootDir>/tests/*.ts",
"<rootDir>/src/**/*.test.ts"
]
},
"private": false,
"publishConfig": {
"access": "public"
},
"engines": {
"node": ">=14"
},
"release": {
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "angular",
"releaseRules": [
{
"type": "docs",
"scope": "README",
"release": "patch"
},
{
"type": "refactor",
"release": "patch"
},
{
"type": "style",
"release": "patch"
}
],
"parserOpts": {
"noteKeywords": [
"BREAKING CHANGE",
"BREAKING CHANGES"
]
}
}
],
"@semantic-release/release-notes-generator",
[
"@semantic-release/exec",
{
"prepareCmd": "npm run prod"
}
],
[
"@semantic-release/github"
],
[
"@semantic-release/npm"
]
],
"branches": [
"+([0-9])?(.{+([0-9]),x}).x",
"main",
"next",
"next-major",
{
"name": "beta",
"prerelease": true
},
{
"name": "alpha",
"prerelease": true
}
]
},
"files": [
"dist"
],
"devDependencies": {
"@semantic-release/exec": "^6.0.3",
"@swc/core": "^1.3.9",
"@swc/jest": "^0.2.23",
"@types/jest": "^29.2.0",
"@types/node": "^18.11.0",
"@types/webpack": "^5.28.0",
"@typescript-eslint/eslint-plugin": "^5.40.1",
"@typescript-eslint/parser": "^5.40.1",
"esbuild": "^0.15.10",
"eslint": "^8.25.0",
"jest": "^29.2.2",
"semantic-release": "^19.0.5",
"typescript": "^4.8.4",
"vite": "^3.1.8"
},
"peerDependencies": {
"@master/css": "^2.0.0-beta.37"
},
"dependencies": {
"chalk": "^4.0.0"
},
"version": "2.0.0-beta.18"
}
{"name":"@master/css-compiler","scripts":{"build":"aron pack --platform=node","dev":"npm run build -- --watch","lint":"eslint ./src","test":"jest"},"license":"MIT","description":"The ahead-of-time compiler of Master CSS","author":"Aoyue Design LLC.","funding":"https://docs.master.co/css/donate","homepage":"https://css.master.co","bugs":{"url":"https://github.com/master-co/css/issues"},"repository":{"type":"git","url":"https://github.com/master-co/css.git","directory":"packages/compiler"},"keywords":["webpack","plugin","integration","vite","parcel","build tools","css","mastercss","vite-plugin"],"sideEffects":false,"main":"./dist/index.cjs","jsnext:main":"./dist/index.mjs","esnext":"./dist/index.mjs","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"require":"./dist/index.cjs","import":"./dist/index.mjs","types":"./dist/index.d.ts"}},"files":["dist"],"dependencies":{"@master/css":"^2.0.0-beta.97","fast-glob":"^3.2.12","minimatch":"^5.1.1","techor":"^1.0.5","upath":"^2.0.1"},"version":"2.0.0-beta.97"}

@@ -1,80 +0,156 @@

<br><br>
<br>
<div align="center">
<p align="center">
<img src="https://raw.githubusercontent.com/master-co/package/document/images/logo-and-text.svg" alt="logo" width="142">
<a href="https://css.master.co">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/33840671/201701649-3bb7d698-abec-4d5f-ac30-ccc4d7bafcd4.svg">
<source media="(prefers-color-scheme: light)" srcset="https://user-images.githubusercontent.com/33840671/201703010-77bf2373-9899-40cc-98f5-30cf9b546941.svg">
<img alt="Master CSS" src="https://user-images.githubusercontent.com/33840671/201703010-77bf2373-9899-40cc-98f5-30cf9b546941.svg" width="100%">
</picture>
</a>
</p>
<p align="center">The ahead-of-time compiler of Master CSS</p>
<p align="center">
<b><!-- name -->CSS Compiler<!----></b>
<a aria-label="overview" href="https://github.com/master-co/css/tree/beta">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/badge/%E2%AC%85%20back-%20?color=212022&style=for-the-badge">
<source media="(prefers-color-scheme: light)" srcset="https://img.shields.io/badge/%E2%AC%85%20back-%20?color=f6f7f8&style=for-the-badge">
<img alt="NPM Version" src="https://img.shields.io/badge/%E2%AC%85%20back-%20?color=f6f7f8&style=for-the-badge">
</picture>
</a>
<a aria-label="GitHub release (latest by date including pre-releases)" href="https://github.com/master-co/css/releases">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/github/v/release/master-co/css?include_prereleases&color=212022&label=&style=for-the-badge&logo=github&logoColor=fff">
<source media="(prefers-color-scheme: light)" srcset="https://img.shields.io/github/v/release/master-co/css?include_prereleases&color=f6f7f8&label=&style=for-the-badge&logo=github&logoColor=%23000">
<img alt="NPM Version" src="https://img.shields.io/github/v/release/master-co/css?include_prereleases&color=f6f7f8&label=&style=for-the-badge&logo=github">
</picture>
</a>
<a aria-label="NPM Package" href="https://www.npmjs.com/package/@master/css-compiler">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/npm/dm/@master/css-compiler?color=212022&label=%20&logo=npm&style=for-the-badge">
<source media="(prefers-color-scheme: light)" srcset="https://img.shields.io/npm/dm/@master/css-compiler?color=f6f7f8&label=%20&logo=npm&style=for-the-badge">
<img alt="NPM package ( download / month )" src="https://img.shields.io/npm/dm/@master/css-compiler?color=f6f7f8&label=%20&logo=npm&style=for-the-badge">
</picture>
</a>
<a aria-label="Discord Community" href="https://discord.gg/sZNKpAAAw6">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/discord/917780624314613760?color=212022&label=%20&logo=discord&style=for-the-badge">
<source media="(prefers-color-scheme: light)" srcset="https://img.shields.io/discord/917780624314613760?color=f6f7f8&label=%20&logo=discord&style=for-the-badge">
<img alt="Discord online" src="https://img.shields.io/discord/917780624314613760?color=f6f7f8&label=%20&logo=discord&style=for-the-badge">
</picture>
</a>
<a aria-label="Follow @mastercorg" href="https://twitter.com/mastercorg">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/static/v1?label=%20&message=twitter&color=212022&logo=twitter&style=for-the-badge">
<source media="(prefers-color-scheme: light)" srcset="https://img.shields.io/static/v1?label=%20&message=twitter&color=f6f7f8&logo=twitter&style=for-the-badge">
<img alt="Follow @mastercorg" src="https://img.shields.io/static/v1?label=%20&message=twitter&color=f6f7f8&logo=twitter&style=for-the-badge">
</picture>
</a>
<a aria-label="Github Actions" href="https://github.com/1aron/repo/actions/workflows/release.yml">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/github/actions/workflow/status/master-co/css/release.yml?branch=beta&label=%20&message=twitter&color=212022&logo=githubactions&style=for-the-badge">
<source media="(prefers-color-scheme: light)" srcset="https://img.shields.io/github/actions/workflow/status/master-co/css/release.yml?branch=beta&label=%20&message=twitter&color=f6f7f8&logo=githubactions&style=for-the-badge&logoColor=%23000">
<img alt="Github release actions" src="https://img.shields.io/github/actions/workflow/status/master-co/css/release.yml?branch=beta&label=%20&message=twitter&color=f6f7f8&logo=githubactions&style=for-the-badge&logoColor=%23000">
</picture>
</a>
</p>
<p align="center"><!-- package.description -->Compile Master CSS ahead of time with zero-configuration integration with build tools<!----></p>
[![MIT License](https://flat.badgen.net/github/license/master-co/css?color=yellow)](https://github.com/master-co/css-compiler/blob/main/LICENSE)
[![Latest Release](https://flat.badgen.net/npm/v/@master/css-compiler?icon=npm&label&color=yellow)](https://www.npmjs.com/package/@master/css-compiler)
[![Documentation](https://flat.badgen.net/badge/icon/Documentation?icon=awesome&label&color=yellow)](https://css.master.co)
[![Github](https://flat.badgen.net/badge/icon/master-co%2Fcss-compiler?icon=github&label&color=yellow)](https://github.com/master-co/css)
[![Discord](https://flat.badgen.net/badge/icon/discord?icon=discord&label&color=yellow)](https://discord.gg/sZNKpAAAw6)
[![CI](https://flat.badgen.net/github/status/master-co/css-compiler/main/ci/circleci?icon=circleci)](https://circleci.com/gh/master-co/workflows/css-compiler/tree/main)
</div>
##### On this page
## Usage
```bash
npm install @master/css-compiler
```
- [Usage](#usage)
- [`webpack.config.js`](#webpackconfigjs)
- [`vite.config.js`](#viteconfigjs)
- [`next.config.js`](#nextconfigjs)
- [Related](#related)
```ts
const compiler = new MasterCSSCompiler()
```
---
## Options
```ts
{
// specify virtual CSS module id (e.g. virtual:master.css)
module: 'master.css',
// specify config file path or set `Config`
config: 'master.css.{ts,js,mjs,cjs}',
// forcibly specify sources for scanning, not excluded by `options.exclude`
sources: [],
// specify sources for scanning
include: ['**/*.{html,js,jsx,ts,tsx,svelte,astro,vue,md,mdx,pug,php}'],
// specify sources to exclude
exclude: [
'**/node_modules/**',
'**/*.d.ts',
'**/*.test.*',
'node_modules',
'master.css.{js,ts,mjs,cjs}',
'dist',
'out',
'README.md'
],
// whitelist of class names for unpredictable dynamics
fixedClasses: [],
// blacklist of class names to exclude accidentally captured
ignoredClasses: [], // or RegExp[]
cwd: process.cwd()
}
```
# Usage
## Methods
## `webpack.config.js`
```js
const { MasterCSSWebpackPlugin } = require('@master/css-compiler')
```ts
// Initialize the compiler and MasterCSS
init(): this
```
module.exports = {
plugins: [
new MasterCSSWebpackPlugin()
]
};
```ts
// Scan sources, extract class names, and generate CSS rules
compile()
```
## `vite.config.js`
```js
import { MasterCSSVitePlugin } from '@master/css-compiler'
```ts
// Extract potential class names from the given file content
extract(name: string, content: string): string[]
```
export default defineConfig({
plugins: [
MasterCSSVitePlugin()
]
})
```ts
// `extract(name, content)`, insert extractions, and generate CSS rules
insert(name: string, content: string): boolean
```
## `next.config.js`
```js
const { MasterCSSWebpackPlugin } = require('@master/css-compiler')
```ts
// Read file source paths by `options.include` and `options.exclude`
get sources(): string[]
```
const nextConfig = {
...,
webpack: (config) => {
config.plugins.push(
new MasterCSSWebpackPlugin({
output: {
path: 'static/css'
}
})
)
return config
}
}
```ts
// Check source file path by `options.include` and `options.exclude`
checkSourcePath(name: string): boolean
```
module.exports = nextConfig
```ts
// Read user config file by `options.config`
readConfig(): Config
```
---
```ts
// Get user config path
get configPath(): string
```
# Related
- [@master/css](https://github.com/master-co/css) - A Virtual CSS language with enhanced syntax. ( ~13KB )
- [@master/css.react](https://github.com/master-co/css.react) - React hooks for Master CSS
```ts
// Get resolved user config path
get resolvedConfigPath(): string
```
## Properties
```ts
export default class MasterCSSCompiler {
css: MasterCSS
extractions = new Set<string>()
...
}
```

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc