@master/css-compiler
Compile Master CSS stylesheet directives
Public entrypoints
Compile stylesheet directives, load project manifests and compose generated CSS with authored styles. Choose the entrypoint that matches the work and execution environment.
Declarations show the public surface of each import path. Referenced type names may be local to the package; import only names listed as exports here. Private implementation is omitted, while constructor restrictions remain visible.
@master/css-compiler
Asynchronous compiler sessions and in-memory directive compilation.
Exports · 20
compileCSS
export declare function compileCSS( source: string, options?: MasterCSSCompileOptions): Promise<MasterCSSCompileResult>;compileManifest
export declare function compileManifest( source: string, options: MasterCSSCompileManifestOptions): Promise<MasterCSSCompileManifestResult>;createCompiler
export declare function createCompiler( options?: MasterCSSCompilerOptions): Promise<MasterCSSCompiler>;inspectCSS
export declare function inspectCSS( source: string): Promise<MasterCSSCompilerInspection>;MasterCSSCompileManifestOptions
export interface MasterCSSCompileManifestOptions extends MasterCSSCompileOptions { readonly baseManifest: MasterCSSManifest;}MasterCSSCompileManifestResult
export interface MasterCSSCompileManifestResult extends MasterCSSCompileResult { readonly manifest: MasterCSSManifest; readonly directives: MasterCSSCompileResult;}MasterCSSCompileOptions
export interface MasterCSSCompileOptions { readonly classes?: readonly string[]; readonly from?: string; readonly preserveNativeCSS?: boolean; /** Opt in to pruning native rules in project-owned files. */ readonly pruneNativeCSS?: boolean; /** Keep untouched native source for host transforms; incompatible with class pruning. */ readonly preserveNativeSource?: boolean; /** Report CSS value errors by default; error rejects the complete output. */ readonly validation?: 'report' | 'error'; readonly onDiagnostic?: (diagnostic: MasterCSSDiagnostic) => void;}MasterCSSCompiler
export declare class MasterCSSCompiler implements Disposable { private constructor(); get binding(): import("~/packages/binding/dist").MasterCSSResolvedBinding; inspectCSS(source: string): MasterCSSCompilerInspection; compileCSS( source: string, options?: MasterCSSCompileOptions ): MasterCSSCompileResult; compileManifest( source: string, options: MasterCSSCompileManifestOptions ): MasterCSSCompileManifestResult; dispose(): void; prepareStylesheetBundle( request: MasterCSSPrepareStylesheetBundleRequest ): MasterCSSStylesheetBundle; renderStylesheetBundle( request: MasterCSSRenderStylesheetBundleRequest ): readonly MasterCSSStylesheetAsset[]; compileStylesheets( request: MasterCSSCompileStylesheetsRequest, options?: MasterCSSCompileOptions ): MasterCSSCompileStylesheetsResult; [Symbol.dispose](): void;}MasterCSSCompileResult
export interface MasterCSSCompileResult { readonly compositions?: readonly import('@master/css-schema/css-directives').CSSCompositionTrace[]; /** Serialized map v3 for css when produced by a stylesheet host. */ readonly sourceMap?: string; readonly css: string; readonly nativeCSS: string; readonly generatedCSS: string; readonly classNames: readonly string[]; readonly nativeClassNames: readonly string[]; readonly dependencies: readonly string[]; readonly diagnostics: readonly MasterCSSDiagnostic[]; readonly directiveSummary: Readonly<{ readonly manifestInput: Readonly<{ readonly keys: readonly string[]; readonly counts: Readonly<Record<string, number>>; }>; readonly styleDefinitions: number; readonly extractionPolicy: Readonly<{ readonly include: readonly string[]; readonly exclude: readonly string[]; readonly safelist: readonly string[]; readonly blocklist: readonly (string | RegExp)[]; readonly preserveNative: boolean; readonly pruneNative: boolean; }>; }>;}MasterCSSCompilerInspection
export interface MasterCSSCompilerInspection { readonly hasMasterEntryDirective: boolean; readonly hasMasterCSSImport: boolean; readonly hasMasterEntry: boolean; readonly directives: readonly { readonly name: string; readonly range: { readonly start: number; readonly end: number; }; readonly preludeRange: { readonly start: number; readonly end: number; }; readonly hasBlock: boolean; readonly quotedStrings: number; }[];}MasterCSSCompilerOptions
export interface MasterCSSCompilerOptions { readonly binding?: MasterCSSBinding; readonly wasm?: MasterCSSWasmBindingLoadOptions;}MasterCSSCompileStylesheetsRequest
Prepared files/edges and delivery URLs for boundary-preserving compilation. Resolve @reference inputs into resolutionManifest before calling this API. Supply resourceURLs to relocate parsed url()/image-set() resources before definition merging. Without that map, delivery URLs must retain the original resource bases.
export type MasterCSSCompileStylesheetsRequest = import('@master/css-binding/compiler').MasterCSSCompileStylesheetGraphRequest;MasterCSSCompileStylesheetsResult
export interface MasterCSSCompileStylesheetsResult extends MasterCSSCompileManifestResult { readonly entry: string; /** Every stylesheet must be delivered at its href, including the entry. */ readonly stylesheets: readonly Readonly<import('@master/css-binding/compiler').MasterCSSCompiledStylesheet>[];}MasterCSSPrepareStylesheetBundleRequest
Prepare source boundaries before the host assigns final asset URLs.
export type MasterCSSPrepareStylesheetBundleRequest = import('@master/css-binding/compiler').MasterCSSPrepareStylesheetBundleRequest;MasterCSSRCMigrationRequest
export type MasterCSSRCMigrationRequest = Parameters<import('./session').BindingCompilerSession['migrateRC']>[0];MasterCSSRCMigrationResult
export type MasterCSSRCMigrationResult = ReturnType<import('./session').BindingCompilerSession['migrateRC']>;MasterCSSRenderStylesheetBundleRequest
Render all assets; relative ordinary resources/imports require explicit URL mappings.
export type MasterCSSRenderStylesheetBundleRequest = import('@master/css-binding/compiler').MasterCSSRenderStylesheetBundleRequest;MasterCSSStylesheetAsset
export type MasterCSSStylesheetAsset = import('@master/css-binding/compiler').MasterCSSStylesheetAsset;MasterCSSStylesheetBundle
export type MasterCSSStylesheetBundle = import('@master/css-binding/compiler').MasterCSSStylesheetBundle;migrateRC
export declare function migrateRC( request: MasterCSSRCMigrationRequest): Promise<MasterCSSRCMigrationResult>;@master/css-compiler/node
Synchronous native compilation and filesystem resolution.
Exports · 29
collectStylesheetDependenciesSync
export declare function collectStylesheetDependenciesSync( id: string, source?: string, options?: MasterCSSStylesheetDependencyOptions): readonly string[];compileCSSSync
export declare function compileCSSSync( source: string, options?: import('./index').MasterCSSCompileOptions): import("./index").MasterCSSCompileResult;compileManifestFileSync
export declare function compileManifestFileSync( file: string, options: MasterCSSCompileManifestFileDeliveryOptions): MasterCSSCompileManifestFileResult;export declare function compileManifestFileSync( file: string, options: MasterCSSCompileManifestFileOptions): MasterCSSCompileManifestResult;compileManifestSync
export declare function compileManifestSync( source: string, options: import('./index').MasterCSSCompileManifestOptions): MasterCSSCompileManifestResult;composeStylesheetHostSync
export declare function composeStylesheetHostSync( source: string, options?: MasterCSSStylesheetHostOptions): string;createCompilerSync
export declare function createCompilerSync(): MasterCSSCompiler;inspectCSSSync
export declare function inspectCSSSync( source: string): import("./index").MasterCSSCompilerInspection;MasterCSSCompileManifestFileDeliveryOptions
export interface MasterCSSCompileManifestFileDeliveryOptions extends MasterCSSCompileManifestFileOptions { readonly delivery: StylesheetDeliveryOptions;}MasterCSSCompileManifestFileOptions
export interface MasterCSSCompileManifestFileOptions extends MasterCSSCompileManifestOptions { readonly root?: string;}MasterCSSCompileManifestFileResult
export interface MasterCSSCompileManifestFileResult extends MasterCSSCompileStylesheetsResult { /** Copy these files to their hrefs before publishing the entry stylesheet. */ readonly resources: readonly Readonly<StylesheetResourceAsset>[];}MasterCSSCompileManifestOptions
export interface MasterCSSCompileManifestOptions extends MasterCSSCompileOptions { readonly baseManifest: MasterCSSManifest;}MasterCSSCompileManifestResult
export interface MasterCSSCompileManifestResult extends MasterCSSCompileResult { readonly manifest: MasterCSSManifest; readonly directives: MasterCSSCompileResult;}MasterCSSCompileOptions
export interface MasterCSSCompileOptions { readonly classes?: readonly string[]; readonly from?: string; readonly preserveNativeCSS?: boolean; /** Opt in to pruning native rules in project-owned files. */ readonly pruneNativeCSS?: boolean; /** Keep untouched native source for host transforms; incompatible with class pruning. */ readonly preserveNativeSource?: boolean; /** Report CSS value errors by default; error rejects the complete output. */ readonly validation?: 'report' | 'error'; readonly onDiagnostic?: (diagnostic: MasterCSSDiagnostic) => void;}MasterCSSCompileResult
export interface MasterCSSCompileResult { readonly compositions?: readonly import('@master/css-schema/css-directives').CSSCompositionTrace[]; /** Serialized map v3 for css when produced by a stylesheet host. */ readonly sourceMap?: string; readonly css: string; readonly nativeCSS: string; readonly generatedCSS: string; readonly classNames: readonly string[]; readonly nativeClassNames: readonly string[]; readonly dependencies: readonly string[]; readonly diagnostics: readonly MasterCSSDiagnostic[]; readonly directiveSummary: Readonly<{ readonly manifestInput: Readonly<{ readonly keys: readonly string[]; readonly counts: Readonly<Record<string, number>>; }>; readonly styleDefinitions: number; readonly extractionPolicy: Readonly<{ readonly include: readonly string[]; readonly exclude: readonly string[]; readonly safelist: readonly string[]; readonly blocklist: readonly (string | RegExp)[]; readonly preserveNative: boolean; readonly pruneNative: boolean; }>; }>;}MasterCSSCompilerInspection
export interface MasterCSSCompilerInspection { readonly hasMasterEntryDirective: boolean; readonly hasMasterCSSImport: boolean; readonly hasMasterEntry: boolean; readonly directives: readonly { readonly name: string; readonly range: { readonly start: number; readonly end: number; }; readonly preludeRange: { readonly start: number; readonly end: number; }; readonly hasBlock: boolean; readonly quotedStrings: number; }[];}MasterCSSCompileStylesheetsRequest
Prepared files/edges and delivery URLs for boundary-preserving compilation. Resolve @reference inputs into resolutionManifest before calling this API. Supply resourceURLs to relocate parsed url()/image-set() resources before definition merging. Without that map, delivery URLs must retain the original resource bases.
export type MasterCSSCompileStylesheetsRequest = import('@master/css-binding/compiler').MasterCSSCompileStylesheetGraphRequest;MasterCSSCompileStylesheetsResult
export interface MasterCSSCompileStylesheetsResult extends MasterCSSCompileManifestResult { readonly entry: string; /** Every stylesheet must be delivered at its href, including the entry. */ readonly stylesheets: readonly Readonly<import('@master/css-binding/compiler').MasterCSSCompiledStylesheet>[];}MasterCSSPrepareStylesheetBundleRequest
Prepare source boundaries before the host assigns final asset URLs.
export type MasterCSSPrepareStylesheetBundleRequest = import('@master/css-binding/compiler').MasterCSSPrepareStylesheetBundleRequest;MasterCSSRenderStylesheetBundleRequest
Render all assets; relative ordinary resources/imports require explicit URL mappings.
export type MasterCSSRenderStylesheetBundleRequest = import('@master/css-binding/compiler').MasterCSSRenderStylesheetBundleRequest;MasterCSSStylesheetAsset
export type MasterCSSStylesheetAsset = import('@master/css-binding/compiler').MasterCSSStylesheetAsset;MasterCSSStylesheetBundle
export type MasterCSSStylesheetBundle = import('@master/css-binding/compiler').MasterCSSStylesheetBundle;MasterCSSStylesheetDependencies
export interface MasterCSSStylesheetDependencies { /** References are resolved while lowering; this import inventory cannot prove their context unchanged. */ readonly hasReferences: boolean; readonly dependencies: readonly string[]; readonly edges: readonly Readonly<{ from: string; specifier: string; resolved: string; }>[];}MasterCSSStylesheetDependencyOptions
export interface MasterCSSStylesheetDependencyOptions { readonly projectDir?: string; readonly signal?: AbortSignal;}MasterCSSStylesheetHostOptions
export interface MasterCSSStylesheetHostOptions { readonly masterImport?: string; readonly masterSource?: string; readonly signal?: AbortSignal;}MasterCSSStylesheetResolution
export interface MasterCSSStylesheetResolution { readonly id: string; readonly kind: MasterCSSStylesheetKind; readonly source: string; readonly compilationSource: string; readonly outputSource: string; readonly dependencies: readonly string[];}MasterCSSStylesheetResolutionOptions
export interface MasterCSSStylesheetResolutionOptions extends StylesheetSourceContext { readonly projectDir?: string; /** Classify a prepared graph without flattening its CSS for delivery hosts. */ readonly preserveImports?: boolean; readonly signal?: AbortSignal;}migrateRCSync
export declare function migrateRCSync( request: import('./index').MasterCSSRCMigrationRequest): import('./index').MasterCSSRCMigrationResult;resolveStylesheetDependenciesSync
Resolve the complete delivery graph, including package CSS, without lowering or flattening. Unlike classification-only dependency collection, resolution failures propagate.
export declare function resolveStylesheetDependenciesSync( id: string, source: string, options?: MasterCSSStylesheetDependencyOptions): MasterCSSStylesheetDependencies;resolveStylesheetSync
export declare function resolveStylesheetSync( id: string, source: string, options?: MasterCSSStylesheetResolutionOptions): MasterCSSStylesheetResolution | undefined;@master/css-compiler/project
Asynchronous project entry discovery and manifest loading.
compileProjectManifest
export declare function compileProjectManifest( options: MasterCSSProjectCompileOptions): Promise<MasterCSSProjectResult>;discoverManifestEntries
export declare function discoverManifestEntries( options?: MasterCSSProjectDiscoveryOptions): Promise<readonly string[]>;loadProjectManifest
export declare function loadProjectManifest( options: MasterCSSProjectLoadOptions): Promise<MasterCSSProjectResult>;MasterCSSProjectCompileOptions
export interface MasterCSSProjectCompileOptions extends MasterCSSProjectLoadOptions { readonly entries: readonly string[];}MasterCSSProjectDiscoveryOptions
export interface MasterCSSProjectDiscoveryOptions { readonly root?: string; readonly signal?: AbortSignal;}MasterCSSProjectLoadOptions
export interface MasterCSSProjectLoadOptions extends MasterCSSProjectDiscoveryOptions { readonly baseManifest: MasterCSSManifest; readonly entries?: readonly string[]; readonly onDiagnostic?: (diagnostic: MasterCSSDiagnostic) => void; /** Reports each project CSS file before reading it, including missing imports/references. */ readonly onDependency?: (file: string) => void;}MasterCSSProjectResult
export interface MasterCSSProjectResult { /** Decoded native class registrations from the resolved CSS graph. */ readonly nativeClassNames: readonly string[]; readonly manifest: MasterCSSManifest; readonly entries: readonly string[]; readonly dependencies: readonly string[]; readonly diagnostics: readonly MasterCSSDiagnostic[];}@master/css-compiler/project/sync
Synchronous project entry discovery and manifest loading.
compileProjectManifestSync
export declare function compileProjectManifestSync( options: Omit<MasterCSSProjectCompileOptions, 'signal'>): MasterCSSProjectResult;discoverManifestEntriesSync
export declare function discoverManifestEntriesSync( options?: Omit<MasterCSSProjectDiscoveryOptions, 'signal'>): readonly string[];loadProjectManifestSync
export declare function loadProjectManifestSync( options: Omit<MasterCSSProjectLoadOptions, 'signal'>): MasterCSSProjectResult;MasterCSSProjectCompileOptions
export interface MasterCSSProjectCompileOptions extends MasterCSSProjectLoadOptions { readonly entries: readonly string[];}MasterCSSProjectDiscoveryOptions
export interface MasterCSSProjectDiscoveryOptions { readonly root?: string; readonly signal?: AbortSignal;}MasterCSSProjectLoadOptions
export interface MasterCSSProjectLoadOptions extends MasterCSSProjectDiscoveryOptions { readonly baseManifest: MasterCSSManifest; readonly entries?: readonly string[]; readonly onDiagnostic?: (diagnostic: MasterCSSDiagnostic) => void; /** Reports each project CSS file before reading it, including missing imports/references. */ readonly onDependency?: (file: string) => void;}MasterCSSProjectResult
export interface MasterCSSProjectResult { /** Decoded native class registrations from the resolved CSS graph. */ readonly nativeClassNames: readonly string[]; readonly manifest: MasterCSSManifest; readonly entries: readonly string[]; readonly dependencies: readonly string[]; readonly diagnostics: readonly MasterCSSDiagnostic[];}@master/css-compiler/stylesheet
Node.js stylesheet resolution, composition and delivery assets.
Exports · 32
collectStylesheetDependencies
export declare function collectStylesheetDependencies( id: string, source?: string, options?: MasterCSSStylesheetDependencyOptions): Promise<readonly string[]>;collectStylesheetEmittedGlobals
export declare function collectStylesheetEmittedGlobals( entries: readonly string[], options: MasterCSSStylesheetCompileOptions): Promise<Readonly<{ emittedGlobals: Required<MasterCSSEmittedGlobals>; dependencies: readonly string[];}>>;compileRenderedStylesheet
export declare function compileRenderedStylesheet( id: string, source: string, options: MasterCSSRenderedStylesheetCompileOptions): Promise<MasterCSSCompiledStylesheet>;compileStylesheet
export declare function compileStylesheet( id: string, source: string, options: MasterCSSStylesheetCompileOptions): Promise<MasterCSSCompileResult>;composeStylesheetHost
export declare function composeStylesheetHost( source: string, options?: MasterCSSStylesheetHostOptions): Promise<string>;createStylesheetCollection
export declare function createStylesheetCollection(): MasterCSSStylesheetCollection;MasterCSSCompiledStylesheet
export interface MasterCSSCompiledStylesheet extends MasterCSSCompileResult { readonly entry?: string; /** Delivery assets, including the entry. Each map describes its final CSS. */ readonly stylesheets?: readonly { readonly id: string; readonly href: string; readonly css: string; readonly sourceMap: string; }[]; readonly resources?: readonly StylesheetResourceAsset[]; readonly manifest: MasterCSSManifest; readonly emittedGlobals: Required<MasterCSSEmittedGlobals>;}MasterCSSPreparedStylesheet
export interface PreparedStylesheetSource { readonly id: string; readonly baseFile: string; readonly source: string; readonly dependencies: readonly string[]; /** Serialized Sass source map v3, including original source contents. */ readonly sourceMap?: string;}export { PreparedStylesheetSource as MasterCSSPreparedStylesheet };MasterCSSRenderedStylesheetCompileOptions
export interface MasterCSSRenderedStylesheetCompileOptions extends MasterCSSStylesheetCompileOptions { /** Globals already present outside this render; emit only additional resources. */ readonly emittedGlobals?: MasterCSSEmittedGlobals;}MasterCSSSassCompiler
export interface SassModule { compileStringAsync(source: string, options: { url: URL; style: 'expanded'; syntax: 'scss' | 'indented'; sourceMap?: boolean; sourceMapIncludeSources?: boolean; }): Promise<{ css: string; loadedUrls?: readonly URL[]; sourceMap?: object; }>;}export { SassModule as MasterCSSSassCompiler };MasterCSSStylesheetAsyncResolutionOptions
export interface MasterCSSStylesheetAsyncResolutionOptions extends MasterCSSStylesheetResolutionOptions { readonly baseFile?: string; readonly resolveImport?: CSSImportFileResolver; readonly onDependency?: (file: string) => void;}MasterCSSStylesheetCollection
export declare class MasterCSSStylesheetCollection implements Disposable { private constructor(); get size(): number; register( scanner: MasterCSSScanner, id: string, source: string, options: MasterCSSStylesheetCompileOptions ): Promise<MasterCSSCompileResult>; delete(id: string): boolean; clear(): void; compose( options: MasterCSSStylesheetCompositionOptions ): Promise<MasterCSSStylesheetComposition>; snapshot(): MasterCSSStylesheetCollectionSnapshot; dispose(): void; [Symbol.dispose](): void;}MasterCSSStylesheetCollectionSnapshot
export interface MasterCSSStylesheetCollectionSnapshot { readonly size: number; readonly sourceIds: readonly string[]; readonly dependencies: readonly string[]; readonly sources: readonly MasterCSSStylesheetSourceSnapshot[];}MasterCSSStylesheetCompileOptions
export interface MasterCSSStylesheetCompileOptions extends MasterCSSCompileOptions, StylesheetSourceContext { /** Absolute definition files applied before authored @reference and local definitions. Does not load their native CSS or scanning policy. */ readonly referenceFiles?: readonly string[]; readonly delivery?: StylesheetDeliveryOptions; readonly baseManifest: MasterCSSManifest; readonly projectDir?: string; readonly loadSass?: (projectDir?: string) => MasterCSSSassCompiler; readonly signal?: AbortSignal;}MasterCSSStylesheetComposition
export interface MasterCSSStylesheetComposition { readonly diagnostics: readonly import('@master/css-schema').MasterCSSDiagnostic[]; readonly stylesheets?: readonly { readonly id: string; readonly href: string; readonly css: string; }[]; readonly resources?: readonly StylesheetResourceAsset[]; readonly dependencies?: readonly string[]; readonly css: string; readonly emittedGlobals: Required<MasterCSSEmittedGlobals>;}MasterCSSStylesheetCompositionOptions
export interface MasterCSSStylesheetCompositionOptions extends MasterCSSStylesheetCompileOptions { /** Compose only these registered source IDs; omitted selects all and an empty list selects none. */ readonly sourceIds?: readonly string[]; readonly scanner: MasterCSSScanner; readonly manifest?: MasterCSSManifest; readonly classes?: readonly string[]; readonly includeGeneratedCSS?: boolean; readonly includeNativeCSS?: boolean; readonly includeMasterBaseCSS?: boolean;}MasterCSSStylesheetDeliveryOptions
export interface StylesheetDeliveryOptions { /** Filesystem owner of a supplied virtual entry source. */ readonly baseFile?: string; /** Serialized source map v3 for original reference origins in the supplied entry. */ readonly sourceMap?: string; /** Final URL of the emitted entry stylesheet. */ readonly entryURL: string; /** Reports attempted filesystem dependencies, including files that are missing. */ readonly onDependency?: (file: string) => void; readonly stylesheetURL: (file: string, variant?: string) => string; readonly resourceURL: (file: string) => string; /** Standalone sibling assets only; the resulting manifest is not for inline CSS. */ readonly relativeResourceURLs?: boolean; /** Resolve CSS package exports with the Node host and preserve their native rules. */ readonly resolveNodePackageImports?: boolean; /** Async registration only: resolve imports with a build host before Node fallback. */ readonly resolveImport?: CSSImportFileResolver;}export { StylesheetDeliveryOptions as MasterCSSStylesheetDeliveryOptions };MasterCSSStylesheetDependencyOptions
export interface MasterCSSStylesheetDependencyOptions { readonly projectDir?: string; readonly signal?: AbortSignal;}MasterCSSStylesheetHostOptions
export interface MasterCSSStylesheetHostOptions { readonly masterImport?: string; readonly masterSource?: string; readonly signal?: AbortSignal;}MasterCSSStylesheetImportResolver
undefined uses Node fallback; null preserves an external import verbatim.
export type CSSImportFileResolver = ( specifier: string, importer: string) => string | CSSImportSource | null | undefined | Promise<string | CSSImportSource | null | undefined>;export { CSSImportFileResolver as MasterCSSStylesheetImportResolver };MasterCSSStylesheetImportSource
Source supplied by a host loader; virtual IDs retain their null prefix.
export interface CSSImportSource { readonly id: string; readonly source: string; /** Real source owner for relative imports, references, resource URLs and source patterns, if any. */ readonly baseFile?: string; /** Serialized source map v3 for original reference origins in prepared CSS. */ readonly sourceMap?: string;}export { CSSImportSource as MasterCSSStylesheetImportSource };MasterCSSStylesheetKind
export type MasterCSSStylesheetKind = 'entry' | 'local' | 'master-package' | 'master-package-entry' | 'plain';MasterCSSStylesheetPreparationOptions
export interface StylesheetPreparationOptions { readonly projectDir?: string; readonly baseFile?: string; readonly loadSass?: (projectDir?: string) => SassModule; readonly onDependency?: (file: string) => void; readonly signal?: AbortSignal;}export { StylesheetPreparationOptions as MasterCSSStylesheetPreparationOptions };MasterCSSStylesheetResolution
export interface MasterCSSStylesheetResolution { readonly id: string; readonly kind: MasterCSSStylesheetKind; readonly source: string; readonly compilationSource: string; readonly outputSource: string; readonly dependencies: readonly string[];}MasterCSSStylesheetResolutionOptions
export interface MasterCSSStylesheetResolutionOptions extends StylesheetSourceContext { readonly projectDir?: string; /** Classify a prepared graph without flattening its CSS for delivery hosts. */ readonly preserveImports?: boolean; readonly signal?: AbortSignal;}MasterCSSStylesheetResourceAsset
export interface StylesheetResourceAsset { readonly file: string; readonly href: string;}export { StylesheetResourceAsset as MasterCSSStylesheetResourceAsset };MasterCSSStylesheetSourceSnapshot
export interface MasterCSSStylesheetSourceSnapshot { readonly id: string; readonly source: string; readonly dependencies: readonly string[]; readonly sourceDependencies: readonly string[]; readonly isMasterCSS: boolean; readonly prunesNativeCSS: boolean;}MasterCSSStylesheetTransformOptions
export interface MasterCSSStylesheetTransformOptions extends MasterCSSStylesheetCompileOptions { /** Defaults to inline; separate returns globals outside code for scoped hosts. */ readonly generatedGlobals?: 'inline' | 'separate'; /** Also resolve resource usage in native CSS using the supplied context. */ readonly transformNativeStylesheets?: boolean; readonly emittedGlobals?: MasterCSSEmittedGlobals;}MasterCSSStylesheetTransformResult
export interface MasterCSSStylesheetTransformResult { /** Generated resources retain their original global selectors and conditions. */ readonly globalStylesheet?: Readonly<{ css: string; sourceMap?: string; }>; readonly diagnostics: readonly import('@master/css-schema').MasterCSSDiagnostic[]; readonly sourceMap?: string; /** Retained child stylesheets; delivery hosts must publish every returned asset. */ readonly stylesheets?: readonly { readonly id: string; readonly href: string; readonly css: string; }[]; readonly resources?: readonly StylesheetResourceAsset[]; readonly code: string; readonly dependencies: readonly string[]; readonly transformed: boolean; readonly compilation?: MasterCSSCompileResult;}prepareStylesheet
export declare function prepareStylesheetSource( id: string, source: string, options?: StylesheetPreparationOptions): Promise<import("./types").PreparedStylesheetSource>;export { prepareStylesheetSource as prepareStylesheet };resolveStylesheet
export declare function resolveStylesheet( id: string, source: string, options?: MasterCSSStylesheetAsyncResolutionOptions): Promise<MasterCSSStylesheetResolution | undefined>;transformStylesheet
export declare function transformStylesheet( id: string, source: string, options: MasterCSSStylesheetTransformOptions): Promise<MasterCSSStylesheetTransformResult>;@master/css-compiler/stylesheet/browser
Browser compilation from supplied source and a base manifest.
compileBrowserStylesheet
export declare function compileBrowserStylesheet( source: string, options: MasterCSSBrowserStylesheetCompileOptions): Promise<MasterCSSBrowserStylesheetCompileResult>;MasterCSSBrowserStylesheetCompileOptions
export interface MasterCSSBrowserStylesheetCompileOptions { readonly baseManifest: MasterCSSManifest; readonly classNames?: readonly string[]; readonly from?: string; readonly preserveNativeCSS?: boolean; readonly pruneNativeCSS?: boolean; readonly validation?: 'report' | 'error'; /** Keep untouched native source for host transforms; incompatible with class pruning. */ readonly preserveNativeSource?: boolean; /** Globals already present outside this render; emit only additional resources. */ readonly emittedGlobals?: MasterCSSEmittedGlobals; readonly binding?: Readonly<{ input?: RequestInfo | URL | Response | BufferSource | WebAssembly.Module; }>; readonly signal?: AbortSignal; readonly onDiagnostic?: (diagnostic: import('@master/css-schema').MasterCSSDiagnostic) => void;}MasterCSSBrowserStylesheetCompileResult
export interface MasterCSSBrowserStylesheetCompileResult { readonly css: string; readonly nativeCSS: string; readonly generatedCSS: string; readonly manifest: MasterCSSManifest; readonly diagnostics: readonly MasterCSSDiagnostic[]; readonly emittedGlobals: Required<MasterCSSEmittedGlobals>; readonly result: MasterCSSCompileManifestResult;}MasterCSSCompileManifestResult
export interface MasterCSSCompileManifestResult extends MasterCSSCompileResult { readonly manifest: MasterCSSManifest; readonly directives: MasterCSSCompileResult;}@master/css-compiler/diagnostics
Project inspection reports with classes, files and diagnostics.
Exports · 15
createMasterCSSInspectionReport
export declare function createMasterCSSInspectionReport( options: CreateMasterCSSInspectionReportOptions): Promise<MasterCSSInspectionReport>;CreateMasterCSSInspectionReportOptions
export interface CreateMasterCSSInspectionReportOptions { manifest: MasterCSSManifest; cwd?: string; patterns?: readonly string[]; classes?: readonly string[] | string; includeCss?: boolean; ignore?: readonly string[]; resolveExistingFile?: (filePath: string) => string | Promise<string>; validatePatterns?: (patterns: readonly string[]) => void;}MASTER_CSS_INSPECTION_REPORT_VERSION
declare const MASTER_CSS_INSPECTION_REPORT_VERSION: 3;MasterCSSDiscoveredClasses
export interface MasterCSSDiscoveredClasses { readonly latent: readonly string[]; readonly valid: readonly string[]; readonly invalid: readonly string[]; readonly usedNative: readonly string[];}MasterCSSInspectionDiagnostic
export interface MasterCSSInspectionDiagnostic { readonly code: MasterCSSInspectionDiagnosticCode; readonly phase: MasterCSSDiagnostic['phase']; readonly range?: MasterCSSDiagnostic['range']; readonly notes?: readonly string[]; readonly severity: MasterCSSInspectionDiagnosticSeverity; readonly message: string; readonly source: 'Master CSS'; readonly sourceKind: MasterCSSInspectionDiagnosticSourceKind; readonly filePath?: string; readonly data?: Readonly<{ cwd: string; } | { className: string; } | MasterCSSMissingCSSResult>;}MasterCSSInspectionDiagnosticCode
export type MasterCSSInspectionDiagnosticCode = 'invalid-scanner-class' | 'missing-css' | 'stylesheet-error' | 'stylesheet-warning' | 'scanner-error' | MasterCSSDiagnostic['code'];MasterCSSInspectionDiagnosticSeverity
export type MasterCSSInspectionDiagnosticSeverity = 'error' | 'warning' | 'info';MasterCSSInspectionDiagnosticSourceKind
export type MasterCSSInspectionDiagnosticSourceKind = 'scanner' | 'stylesheet' | 'missing-css';MasterCSSInspectionReport
Complete declaration · 62 lines
export interface MasterCSSInspectionReport { readonly version: 3; readonly cwd: string; readonly inputs: Readonly<{ patterns: readonly string[]; files: readonly string[]; classes: readonly string[]; }>; readonly scanner: Readonly<{ counts: Readonly<{ latent: number; valid: number; invalid: number; native: number; usedNative: number; safelist: number; blocklist: number; }>; classes: Readonly<{ latent: readonly string[]; valid: readonly string[]; invalid: readonly string[]; native: readonly string[]; usedNative: readonly string[]; safelist: readonly string[]; blocklist: readonly string[]; }>; resetDependencies: readonly string[]; }>; readonly stylesheets: Readonly<{ entries: readonly MasterCSSStylesheetInspection[]; dependencies: readonly string[]; warnings: readonly string[]; errors: readonly MasterCSSStylesheetError[]; }>; readonly css: Readonly<{ bytes: number; included: boolean; text?: string; emittedGlobals: Readonly<{ variables: number; animations: number; }>; }>; readonly missingCSS: Readonly<{ checked: readonly string[]; present: readonly MasterCSSMissingCSSResult[]; missing: readonly MasterCSSMissingCSSResult[]; }>; readonly files: readonly MasterCSSSourceInspection[]; readonly inspections: readonly MasterCSSClassValidation[]; readonly diagnostics: readonly MasterCSSInspectionDiagnostic[]; readonly summary: Readonly<{ files: number; stylesheets: number; diagnostics: number; errors: number; warnings: number; missingCSS: number; invalidClasses: number; }>;}MasterCSSMissingCSSReason
export type MasterCSSMissingCSSReason = 'generated' | 'native-css' | 'safelist' | 'invalid' | 'blocklisted' | 'not-detected';MasterCSSMissingCSSResult
export interface MasterCSSMissingCSSResult { readonly className: string; readonly status: MasterCSSMissingCSSStatus; readonly reason: MasterCSSMissingCSSReason;}MasterCSSMissingCSSStatus
export type MasterCSSMissingCSSStatus = 'present' | 'missing';MasterCSSSourceInspection
export interface MasterCSSSourceInspection { readonly filePath: string; readonly source: string; readonly scanned: boolean; readonly changed: boolean; readonly discovered: MasterCSSDiscoveredClasses;}MasterCSSStylesheetError
export interface MasterCSSStylesheetError { readonly filePath: string; readonly message: string;}MasterCSSStylesheetInspection
export interface MasterCSSStylesheetInspection { compositions?: import('@master/css-schema/css-directives').CSSCompositionTrace[]; readonly filePath: string; readonly masterCSS: boolean; readonly pruneNativeCSS: boolean; readonly dependencies: readonly string[]; readonly sourceDependencies: readonly string[]; readonly warnings: readonly string[]; readonly errors: readonly string[];}Using this contract
Supply the base manifest explicitly when an API requires it. Inspect returned diagnostics before using the result. A delivery result is an asset set: publish every stylesheet and resource at its assigned URL. See Stylesheet entrypoints for resolution and delivery boundaries.