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
58
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.84 to 2.0.0-beta.85

23

dist/compiler.d.ts

@@ -1,16 +0,21 @@

import { CompilerOptions, CompilerSource } from './options';
import { CompilerOptions } from './options';
import MasterCSS from '@master/css';
import type { Config } from '@master/css';
export default class MasterCSSCompiler {
options?: CompilerOptions;
constructor(options?: CompilerOptions);
userConfigPath: string;
outputPath: string;
outputHref: string;
initializing: Promise<any>;
css: MasterCSS;
extractions: Set<string>;
reload(): Promise<void>;
extract({ name, content }: CompilerSource): string[];
insert(extractions: any): void;
log(name: any, content: any): void;
readonly moduleId = "master.css";
readonly resolvedModuleId: string;
readonly moduleHMREvent: string;
init(): Promise<this>;
compile(): this;
extract(name: string, content: string): string[];
insert(name: string, content: string): boolean;
readSourcePaths(): string[];
readConfig(): Promise<Config>;
checkSourcePath(name: string): boolean;
get hasConfig(): boolean;
get configPath(): string;
}
import MasterCSS from '@master/css';
import type { Pattern as FastGlobPattern } from 'fast-glob';
declare const options: CompilerOptions;

@@ -8,11 +9,11 @@ export declare type CompilerSource = {

export interface CompilerOptions {
output?: {
name?: string;
dir?: string;
};
accept?: (source: CompilerSource) => boolean;
extract?: (source: CompilerSource, css: MasterCSS) => string[];
include?: FastGlobPattern[];
exclude?: FastGlobPattern[];
fixedClasses?: string[];
ignoredClasses?: string[] | RegExp[];
config?: string;
debug?: string[] | boolean;
debug?: boolean;
cwd?: string;
}
export default options;

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

{"name":"@master/css.compiler","scripts":{"build":"aron pack --platform=node","dev":"npm run build -- --watch","lint":"eslint ./src"},"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.84","aronlog":"^1.0.0-beta.32","normalize-path":"^3.0.0"},"version":"2.0.0-beta.84"}
{"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.85","aronlog":"^1.0.0-beta.32","fast-glob":"^3.2.12","minimatch":"^5.1.1","normalize-path":"^3.0.0"},"version":"2.0.0-beta.85"}

@@ -30,16 +30,9 @@ <br>

</a>
<a aria-label="NPM Package" href="https://www.npmjs.com/package/@master/css">
<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?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?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?color=f6f7f8&label=%20&logo=npm&style=for-the-badge">
<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="JSDelivr" href="https://www.jsdelivr.com/package/npm/@master/css">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/jsdelivr/npm/hm/@master/css?color=212022&label=%20&logo=jsdelivr&style=for-the-badge">
<source media="(prefers-color-scheme: light)" srcset="https://img.shields.io/jsdelivr/npm/hm/@master/css?color=f6f7f8&label=%20&logo=jsdelivr&style=for-the-badge">
<img alt="JSDelivr hits (npm scoped)" src="https://img.shields.io/jsdelivr/npm/hm/@master/css?color=f6f7f8&label=%20&logo=jsdelivr&style=for-the-badge">
</picture>
</a>
<a aria-label="Discord Community" href="https://discord.gg/sZNKpAAAw6">

@@ -61,5 +54,5 @@ <picture>

<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/github/workflow/status/master-co/css/Release?label=%20&message=twitter&color=212022&logo=githubactions&style=for-the-badge">
<source media="(prefers-color-scheme: light)" srcset="https://img.shields.io/github/workflow/status/master-co/css/Release?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/workflow/status/master-co/css/Release?label=%20&message=twitter&color=f6f7f8&logo=githubactions&style=for-the-badge&logoColor=%23000">
<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>

@@ -71,4 +64,81 @@ </a>

This is used for the common core compiler written for the Master CSS build tools, the following should be what you are looking for:
- [Vite Plugin](https://github.com/master-co/css/tree/beta/packages/vite) - A vite plugin for integrating Master CSS AOT compilation
- [Webpack Plugin](https://github.com/master-co/css/tree/beta/packages/webpack) - A webpack plugin for integrating Master CSS AOT compilation
## Usage
```ts
const compiler = await new MasterCSSCompiler().init()
```
## Options
```ts
{
cwd: process.cwd(),
config: 'master.css.{js,mjs,cjs}',
include: ['**/*.{html,js,jsx,ts,tsx,svelte,astro,vue,md,mdx,pug,php}'],
exclude: [
'**/node_modules/**',
'**/*.d.ts',
'**/*.test.*',
'node_modules',
'master.css.{js,ts,mjs,cjs}',
'dist',
'out',
'README.md'
]
}
```
## Methods
```ts
// Initialize the compiler and MasterCSS
async init(): Promise<this>
```
```ts
// Scan sources, extract class names, and generate CSS rules
compile()
```
```ts
// Extract potential class names from the given file content
extract(name: string, content: string): string[]
```
```ts
// `extract(name, content)`, insert extractions, and generate CSS rules
insert(name: string, content: string): boolean
```
```ts
// Read file source paths by `options.include` and `options.exclude`
readSourcePaths(): string[]
```
```ts
// Check source file path by `options.include` and `options.exclude`
checkSourcePath(name: string): boolean
```
```ts
// Read user config file by `options.config`
async readConfig(): Promise<Config>
```
```ts
// Check if the custom config exists
get hasConfig(): boolean
```
```ts
// Get custom config path
get configPath(): 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