@master/css.compiler
Advanced tools
Comparing version 2.0.0-beta.84 to 2.0.0-beta.85
@@ -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"} |
104
README.md
@@ -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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
20410
90
0
141
5
+ Addedfast-glob@^3.2.12
+ Addedminimatch@^5.1.1
+ Added@nodelib/fs.scandir@2.1.5(transitive)
+ Added@nodelib/fs.stat@2.0.5(transitive)
+ Added@nodelib/fs.walk@1.2.8(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@2.0.1(transitive)
+ Addedbraces@3.0.3(transitive)
+ Addedfast-glob@3.3.3(transitive)
+ Addedfastq@1.18.0(transitive)
+ Addedfill-range@7.1.1(transitive)
+ Addedglob-parent@5.1.2(transitive)
+ Addedis-extglob@2.1.1(transitive)
+ Addedis-glob@4.0.3(transitive)
+ Addedis-number@7.0.0(transitive)
+ Addedmerge2@1.4.1(transitive)
+ Addedmicromatch@4.0.8(transitive)
+ Addedminimatch@5.1.6(transitive)
+ Addedpicomatch@2.3.1(transitive)
+ Addedqueue-microtask@1.2.3(transitive)
+ Addedreusify@1.0.4(transitive)
+ Addedrun-parallel@1.2.0(transitive)
+ Addedto-regex-range@5.0.1(transitive)
Updated@master/css@^2.0.0-beta.85