Socket
Socket
Sign inDemoInstall

postcss

Package Overview
Dependencies
3
Maintainers
1
Versions
252
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 8.4.21 to 8.4.22

lib/postcss.d.mts

95

lib/at-rule.d.ts
import Container, { ContainerProps } from './container.js'
interface AtRuleRaws extends Record<string, unknown> {
/**
* The space symbols before the node. It also stores `*`
* and `_` symbols before the declaration (IE hack).
*/
before?: string
declare namespace AtRule {
export interface AtRuleRaws extends Record<string, unknown> {
/**
* The space symbols before the node. It also stores `*`
* and `_` symbols before the declaration (IE hack).
*/
before?: string
/**
* The space symbols after the last child of the node to the end of the node.
*/
after?: string
/**
* The space symbols after the last child of the node to the end of the node.
*/
after?: string
/**
* The space between the at-rule name and its parameters.
*/
afterName?: string
/**
* The space between the at-rule name and its parameters.
*/
afterName?: string
/**
* The symbols between the last parameter and `{` for rules.
*/
between?: string
/**
* The symbols between the last parameter and `{` for rules.
*/
between?: string
/**
* Contains `true` if the last child has an (optional) semicolon.
*/
semicolon?: boolean
/**
* Contains `true` if the last child has an (optional) semicolon.
*/
semicolon?: boolean
/**
* The rule’s selector with comments.
*/
params?: {
value: string
raw: string
/**
* The rule’s selector with comments.
*/
params?: {
value: string
raw: string
}
}
}
export interface AtRuleProps extends ContainerProps {
/** Name of the at-rule. */
name: string
/** Parameters following the name of the at-rule. */
params?: string | number
/** Information used to generate byte-to-byte equal node string as it was in the origin input. */
raws?: AtRuleRaws
export interface AtRuleProps extends ContainerProps {
/** Name of the at-rule. */
name: string
/** Parameters following the name of the at-rule. */
params?: string | number
/** Information used to generate byte-to-byte equal node string as it was in the origin input. */
raws?: AtRuleRaws
}
// eslint-disable-next-line @typescript-eslint/no-use-before-define
export { AtRule_ as default }
}

@@ -73,6 +78,6 @@

*/
export default class AtRule extends Container {
declare class AtRule_ extends Container {
type: 'atrule'
parent: Container | undefined
raws: AtRuleRaws
raws: AtRule.AtRuleRaws

@@ -102,7 +107,11 @@ /**

constructor(defaults?: AtRuleProps)
assign(overrides: object | AtRuleProps): this
clone(overrides?: Partial<AtRuleProps>): this
cloneBefore(overrides?: Partial<AtRuleProps>): this
cloneAfter(overrides?: Partial<AtRuleProps>): this
constructor(defaults?: AtRule.AtRuleProps)
assign(overrides: object | AtRule.AtRuleProps): this
clone(overrides?: Partial<AtRule.AtRuleProps>): this
cloneBefore(overrides?: Partial<AtRule.AtRuleProps>): this
cloneAfter(overrides?: Partial<AtRule.AtRuleProps>): this
}
declare class AtRule extends AtRule_ {}
export = AtRule
import Container from './container.js'
import Node, { NodeProps } from './node.js'
interface CommentRaws extends Record<string, unknown> {
/**
* The space symbols before the node.
*/
before?: string
declare namespace Comment {
export interface CommentRaws extends Record<string, unknown> {
/**
* The space symbols before the node.
*/
before?: string
/**
* The space symbols between `/*` and the comment’s text.
*/
left?: string
/**
* The space symbols between `/*` and the comment’s text.
*/
left?: string
/**
* The space symbols between the comment’s text.
*/
right?: string
}
/**
* The space symbols between the comment’s text.
*/
right?: string
}
export interface CommentProps extends NodeProps {
/** Content of the comment. */
text: string
/** Information used to generate byte-to-byte equal node string as it was in the origin input. */
raws?: CommentRaws
export interface CommentProps extends NodeProps {
/** Content of the comment. */
text: string
/** Information used to generate byte-to-byte equal node string as it was in the origin input. */
raws?: CommentRaws
}
// eslint-disable-next-line @typescript-eslint/no-use-before-define
export { Comment_ as default }
}

@@ -41,6 +46,6 @@

*/
export default class Comment extends Node {
declare class Comment_ extends Node {
type: 'comment'
parent: Container | undefined
raws: CommentRaws
raws: Comment.CommentRaws

@@ -52,7 +57,11 @@ /**

constructor(defaults?: CommentProps)
assign(overrides: object | CommentProps): this
clone(overrides?: Partial<CommentProps>): this
cloneBefore(overrides?: Partial<CommentProps>): this
cloneAfter(overrides?: Partial<CommentProps>): this
constructor(defaults?: Comment.CommentProps)
assign(overrides: object | Comment.CommentProps): this
clone(overrides?: Partial<Comment.CommentProps>): this
cloneBefore(overrides?: Partial<Comment.CommentProps>): this
cloneAfter(overrides?: Partial<Comment.CommentProps>): this
}
declare class Comment extends Comment_ {}
export = Comment

@@ -7,16 +7,21 @@ import Node, { ChildNode, NodeProps, ChildProps } from './node.js'

interface ValueOptions {
/**
* An array of property names.
*/
props?: string[]
declare namespace Container {
export interface ValueOptions {
/**
* An array of property names.
*/
props?: string[]
/**
* String that’s used to narrow down values and speed up the regexp search.
*/
fast?: string
}
/**
* String that’s used to narrow down values and speed up the regexp search.
*/
fast?: string
}
export interface ContainerProps extends NodeProps {
nodes?: (ChildNode | ChildProps)[]
export interface ContainerProps extends NodeProps {
nodes?: (ChildNode | ChildProps)[]
}
// eslint-disable-next-line @typescript-eslint/no-use-before-define
export { Container_ as default }
}

@@ -31,3 +36,3 @@

*/
export default abstract class Container<
declare abstract class Container_<
Child extends Node = ChildNode

@@ -395,3 +400,3 @@ > extends Node {

pattern: string | RegExp,
options: ValueOptions,
options: Container.ValueOptions,
replaced: string | { (substring: string, ...args: any[]): string }

@@ -446,1 +451,5 @@ ): this

}
declare class Container<Child extends Node = ChildNode> extends Container_<Child> {}
export = Container
import { FilePosition } from './input.js'
/**
* A position that is part of a range.
*/
export interface RangePosition {
declare namespace CssSyntaxError {
/**
* The line number in the input.
* A position that is part of a range.
*/
line: number
export interface RangePosition {
/**
* The line number in the input.
*/
line: number
/**
* The column number in the input.
*/
column: number
/**
* The column number in the input.
*/
column: number
}
// eslint-disable-next-line @typescript-eslint/no-use-before-define
export { CssSyntaxError_ as default }
}

@@ -47,3 +52,3 @@

*/
export default class CssSyntaxError {
declare class CssSyntaxError_ {
/**

@@ -63,4 +68,4 @@ * Instantiates a CSS syntax error. Can be instantiated for a single position

message: string,
lineOrStartPos?: number | RangePosition,
columnOrEndPos?: number | RangePosition,
lineOrStartPos?: number | CssSyntaxError.RangePosition,
columnOrEndPos?: number | CssSyntaxError.RangePosition,
source?: string,

@@ -242,1 +247,5 @@ file?: string,

}
declare class CssSyntaxError extends CssSyntaxError_ {}
export = CssSyntaxError
import Container from './container.js'
import Node from './node.js'
interface DeclarationRaws extends Record<string, unknown> {
/**
* The space symbols before the node. It also stores `*`
* and `_` symbols before the declaration (IE hack).
*/
before?: string
declare namespace Declaration {
export interface DeclarationRaws extends Record<string, unknown> {
/**
* The space symbols before the node. It also stores `*`
* and `_` symbols before the declaration (IE hack).
*/
before?: string
/**
* The symbols between the property and value for declarations.
*/
between?: string
/**
* The symbols between the property and value for declarations.
*/
between?: string
/**
* The content of the important statement, if it is not just `!important`.
*/
important?: string
/**
* The content of the important statement, if it is not just `!important`.
*/
important?: string
/**
* Declaration value with comments.
*/
value?: {
/**
* Declaration value with comments.
*/
value?: {
value: string
raw: string
}
}
export interface DeclarationProps {
/** Name of the declaration. */
prop: string
/** Value of the declaration. */
value: string
raw: string
/** Whether the declaration has an `!important` annotation. */
important?: boolean
/** Information used to generate byte-to-byte equal node string as it was in the origin input. */
raws?: DeclarationRaws
}
}
export interface DeclarationProps {
/** Name of the declaration. */
prop: string
/** Value of the declaration. */
value: string
/** Whether the declaration has an `!important` annotation. */
important?: boolean
/** Information used to generate byte-to-byte equal node string as it was in the origin input. */
raws?: DeclarationRaws
// eslint-disable-next-line @typescript-eslint/no-use-before-define
export { Declaration_ as default }
}

@@ -58,6 +63,6 @@

*/
export default class Declaration extends Node {
declare class Declaration_ extends Node {
type: 'decl'
parent: Container | undefined
raws: DeclarationRaws
raws: Declaration.DeclarationRaws

@@ -120,7 +125,11 @@ /**

constructor(defaults?: DeclarationProps)
assign(overrides: object | DeclarationProps): this
clone(overrides?: Partial<DeclarationProps>): this
cloneBefore(overrides?: Partial<DeclarationProps>): this
cloneAfter(overrides?: Partial<DeclarationProps>): this
constructor(defaults?: Declaration.DeclarationProps)
assign(overrides: object | Declaration.DeclarationProps): this
clone(overrides?: Partial<Declaration.DeclarationProps>): this
cloneBefore(overrides?: Partial<Declaration.DeclarationProps>): this
cloneAfter(overrides?: Partial<Declaration.DeclarationProps>): this
}
declare class Declaration extends Declaration_ {}
export = Declaration
import Container, { ContainerProps } from './container.js'
import { ProcessOptions } from './postcss.js'
import Result from './result.js'
import Root, { RootProps } from './root.js'
import Root from './root.js'
export interface DocumentProps extends ContainerProps {
nodes?: Root[]
declare namespace Document {
export interface DocumentProps extends ContainerProps {
nodes?: Root[]
/**
* Information to generate byte-to-byte equal node string as it was
* in the origin input.
*
* Every parser saves its own properties.
*/
raws?: Record<string, any>
/**
* Information to generate byte-to-byte equal node string as it was
* in the origin input.
*
* Every parser saves its own properties.
*/
raws?: Record<string, any>
}
// eslint-disable-next-line @typescript-eslint/no-use-before-define
export { Document_ as default }
}
type ChildNode = Root
type ChildProps = RootProps
/**

@@ -35,7 +37,7 @@ * Represents a file and contains all its parsed nodes.

*/
export default class Document extends Container<Root> {
declare class Document_ extends Container<Root> {
type: 'document'
parent: undefined
constructor(defaults?: DocumentProps)
constructor(defaults?: Document.DocumentProps)

@@ -59,1 +61,5 @@ /**

}
declare class Document extends Document_ {}
export = Document
import { JSONHydrator } from './postcss.js'
declare const fromJSON: JSONHydrator
interface FromJSON extends JSONHydrator {
default: FromJSON
}
export default fromJSON
declare const fromJSON: FromJSON
export = fromJSON
import { CssSyntaxError, ProcessOptions } from './postcss.js'
import PreviousMap from './previous-map.js'
export interface FilePosition {
/**
* URL for the source file.
*/
url: string
declare namespace Input {
export interface FilePosition {
/**
* URL for the source file.
*/
url: string
/**
* Absolute path to the source file.
*/
file?: string
/**
* Absolute path to the source file.
*/
file?: string
/**
* Line of inclusive start position in source file.
*/
line: number
/**
* Line of inclusive start position in source file.
*/
line: number
/**
* Column of inclusive start position in source file.
*/
column: number
/**
* Column of inclusive start position in source file.
*/
column: number
/**
* Line of exclusive end position in source file.
*/
endLine?: number
/**
* Line of exclusive end position in source file.
*/
endLine?: number
/**
* Column of exclusive end position in source file.
*/
endColumn?: number
/**
* Column of exclusive end position in source file.
*/
endColumn?: number
/**
* Source code.
*/
source?: string
/**
* Source code.
*/
source?: string
}
// eslint-disable-next-line @typescript-eslint/no-use-before-define
export { Input_ as default }
}

@@ -49,3 +54,3 @@

*/
export default class Input {
declare class Input_ {
/**

@@ -143,3 +148,3 @@ * Input CSS source.

endColumn?: number
): FilePosition | false
): Input.FilePosition | false

@@ -188,1 +193,5 @@ /**

}
declare class Input extends Input_ {}
export = Input

@@ -7,2 +7,7 @@ import Result, { Message, ResultOptions } from './result.js'

declare namespace LazyResult {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
export { LazyResult_ as default }
}
/**

@@ -17,3 +22,3 @@ * A Promise proxy for the result of PostCSS transformations.

*/
export default class LazyResult implements PromiseLike<Result> {
declare class LazyResult_ implements PromiseLike<Result> {
/**

@@ -179,1 +184,5 @@ * Processes input CSS through synchronous and asynchronous plugins

}
declare class LazyResult extends LazyResult_ {}
export = LazyResult

@@ -1,51 +0,57 @@

export type List = {
/**
* Safely splits values.
*
* ```js
* Once (root, { list }) {
* list.split('1px calc(10% + 1px)', [' ', '\n', '\t']) //=> ['1px', 'calc(10% + 1px)']
* }
* ```
*
* @param string separated values.
* @param separators array of separators.
* @param last boolean indicator.
* @return Split values.
*/
split(string: string, separators: string[], last: boolean): string[]
/**
* Safely splits space-separated values (such as those for `background`,
* `border-radius`, and other shorthand properties).
*
* ```js
* Once (root, { list }) {
* list.space('1px calc(10% + 1px)') //=> ['1px', 'calc(10% + 1px)']
* }
* ```
*
* @param str Space-separated values.
* @return Split values.
*/
space(str: string): string[]
declare namespace list {
type List = {
default: List
/**
* Safely splits comma-separated values (such as those for `transition-*`
* and `background` properties).
*
* ```js
* Once (root, { list }) {
* list.comma('black, linear-gradient(white, black)')
* //=> ['black', 'linear-gradient(white, black)']
* }
* ```
*
* @param str Comma-separated values.
* @return Split values.
*/
comma(str: string): string[]
/**
* Safely splits values.
*
* ```js
* Once (root, { list }) {
* list.split('1px calc(10% + 1px)', [' ', '\n', '\t']) //=> ['1px', 'calc(10% + 1px)']
* }
* ```
*
* @param string separated values.
* @param separators array of separators.
* @param last boolean indicator.
* @return Split values.
*/
split(string: string, separators: string[], last: boolean): string[]
/**
* Safely splits space-separated values (such as those for `background`,
* `border-radius`, and other shorthand properties).
*
* ```js
* Once (root, { list }) {
* list.space('1px calc(10% + 1px)') //=> ['1px', 'calc(10% + 1px)']
* }
* ```
*
* @param str Space-separated values.
* @return Split values.
*/
space(str: string): string[]
/**
* Safely splits comma-separated values (such as those for `transition-*`
* and `background` properties).
*
* ```js
* Once (root, { list }) {
* list.comma('black, linear-gradient(white, black)')
* //=> ['black', 'linear-gradient(white, black)']
* }
* ```
*
* @param str Comma-separated values.
* @return Split values.
*/
comma(str: string): string[]
}
}
declare const list: List
// eslint-disable-next-line @typescript-eslint/no-redeclare
declare const list: list.List
export default list
export = list

@@ -8,2 +8,7 @@ import Result, { Message, ResultOptions } from './result.js'

declare namespace NoWorkResult {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
export { NoWorkResult_ as default }
}
/**

@@ -21,3 +26,3 @@ * A Promise proxy for the result of PostCSS transformations.

*/
export default class NoWorkResult implements LazyResult {
declare class NoWorkResult_ implements LazyResult {
then: Promise<Result>['then']

@@ -40,1 +45,5 @@ catch: Promise<Result>['catch']

}
declare class NoWorkResult extends NoWorkResult_ {}
export = NoWorkResult
import Declaration, { DeclarationProps } from './declaration.js'
import Comment, { CommentProps } from './comment.js'
import { Stringifier, Syntax } from './postcss.js'
import AtRule, { AtRuleProps } from './at-rule.js'
import AtRule = require('./at-rule.js')
import { AtRuleProps } from './at-rule.js'
import Rule, { RuleProps } from './rule.js'

@@ -14,80 +15,86 @@ import Warning, { WarningOptions } from './warning.js'

export type ChildNode = AtRule | Rule | Declaration | Comment
declare namespace Node {
export type ChildNode = AtRule.default | Rule | Declaration | Comment
export type AnyNode = AtRule | Rule | Declaration | Comment | Root | Document
export type AnyNode = AtRule.default | Rule | Declaration | Comment | Root | Document
export type ChildProps =
| AtRuleProps
| RuleProps
| DeclarationProps
| CommentProps
export type ChildProps =
| AtRuleProps
| RuleProps
| DeclarationProps
| CommentProps
export interface Position {
/**
* Source offset in file. It starts from 0.
*/
offset: number
export interface Position {
/**
* Source offset in file. It starts from 0.
*/
offset: number
/**
* Source line in file. In contrast to `offset` it starts from 1.
*/
column: number
/**
* Source line in file. In contrast to `offset` it starts from 1.
*/
column: number
/**
* Source column in file.
*/
line: number
}
/**
* Source column in file.
*/
line: number
}
export interface Range {
/**
* Start position, inclusive.
*/
start: Position
export interface Range {
/**
* Start position, inclusive.
*/
start: Position
/**
* End position, exclusive.
*/
end: Position
}
/**
* End position, exclusive.
*/
end: Position
}
export interface Source {
/**
* The file source of the node.
*/
input: Input
/**
* The inclusive starting position of the node’s source.
*/
start?: Position
/**
* The inclusive ending position of the node's source.
*/
end?: Position
}
export interface Source {
/**
* The file source of the node.
*/
input: Input
/**
* The inclusive starting position of the node’s source.
*/
start?: Position
/**
* The inclusive ending position of the node's source.
*/
end?: Position
}
export interface NodeProps {
source?: Source
}
export interface NodeProps {
source?: Source
}
interface NodeErrorOptions {
/**
* Plugin name that created this error. PostCSS will set it automatically.
*/
plugin?: string
/**
* A word inside a node's string, that should be highlighted as source
* of error.
*/
word?: string
/**
* An index inside a node's string that should be highlighted as source
* of error.
*/
index?: number
/**
* An ending index inside a node's string that should be highlighted as
* source of error.
*/
endIndex?: number
export interface NodeErrorOptions {
/**
* Plugin name that created this error. PostCSS will set it automatically.
*/
plugin?: string
/**
* A word inside a node's string, that should be highlighted as source
* of error.
*/
word?: string
/**
* An index inside a node's string that should be highlighted as source
* of error.
*/
index?: number
/**
* An ending index inside a node's string that should be highlighted as
* source of error.
*/
endIndex?: number
}
// eslint-disable-next-line @typescript-eslint/no-shadow
class Node extends Node_ {}
export { Node as default }
}

@@ -101,3 +108,3 @@

*/
export default abstract class Node {
declare abstract class Node_ {
/**

@@ -158,3 +165,3 @@ * tring representing the node’s type. Possible values are `root`, `atrule`,

*/
source?: Source
source?: Node.Source

@@ -228,3 +235,3 @@ /**

*/
error(message: string, options?: NodeErrorOptions): CssSyntaxError
error(message: string, options?: Node.NodeErrorOptions): CssSyntaxError

@@ -344,3 +351,3 @@ /**

replaceWith(
...nodes: (ChildNode | ChildProps | ChildNode[] | ChildProps[])[]
...nodes: (Node.ChildNode | Node.ChildProps | Node.ChildNode[] | Node.ChildProps[])[]
): this

@@ -363,3 +370,3 @@

*/
next(): ChildNode | undefined
next(): Node.ChildNode | undefined

@@ -379,3 +386,3 @@ /**

*/
prev(): ChildNode | undefined
prev(): Node.ChildNode | undefined

@@ -394,3 +401,3 @@ /**

*/
before(newNode: Node | ChildProps | string | Node[]): this
before(newNode: Node | Node.ChildProps | string | Node[]): this

@@ -409,3 +416,3 @@ /**

*/
after(newNode: Node | ChildProps | string | Node[]): this
after(newNode: Node | Node.ChildProps | string | Node[]): this

@@ -469,3 +476,3 @@ /**

*/
positionInside(index: number): Position
positionInside(index: number): Node.Position

@@ -478,3 +485,3 @@ /**

*/
positionBy(opts?: Pick<WarningOptions, 'word' | 'index'>): Position
positionBy(opts?: Pick<WarningOptions, 'word' | 'index'>): Node.Position

@@ -488,3 +495,7 @@ /**

*/
rangeBy(opts?: Pick<WarningOptions, 'word' | 'index' | 'endIndex'>): Range
rangeBy(opts?: Pick<WarningOptions, 'word' | 'index' | 'endIndex'>): Node.Range
}
declare class Node extends Node_ {}
export = Node
import { Parser } from './postcss.js'
declare const parse: Parser
interface Parse extends Parser {
default: Parse
}
export default parse
declare const parse: Parse
export = parse

@@ -23,61 +23,20 @@ import { SourceMapGenerator, RawSourceMap } from 'source-map-js'

import CssSyntaxError from './css-syntax-error.js'
import list, { List } from './list.js'
import list from './list.js'
import LazyResult from './lazy-result.js'
import Processor from './processor.js'
export {
NodeErrorOptions,
DeclarationProps,
CssSyntaxError,
ContainerProps,
WarningOptions,
DocumentProps,
FilePosition,
CommentProps,
AtRuleProps,
Declaration,
ChildProps,
LazyResult,
ChildNode,
NodeProps,
Processor,
RuleProps,
RootProps,
Container,
Position,
Document,
AnyNode,
Warning,
Message,
Comment,
Source,
AtRule,
Result,
Input,
Node,
list,
Rule,
Root
}
export type SourceMap = SourceMapGenerator & {
toJSON(): RawSourceMap
}
export type Helpers = { result: Result; postcss: Postcss } & Postcss
type DocumentProcessor = (
document: Document,
helper: Helpers
helper: postcss.Helpers
) => Promise<void> | void
type RootProcessor = (root: Root, helper: Helpers) => Promise<void> | void
type RootProcessor = (root: Root, helper: postcss.Helpers) => Promise<void> | void
type DeclarationProcessor = (
decl: Declaration,
helper: Helpers
helper: postcss.Helpers
) => Promise<void> | void
type RuleProcessor = (rule: Rule, helper: Helpers) => Promise<void> | void
type AtRuleProcessor = (atRule: AtRule, helper: Helpers) => Promise<void> | void
type RuleProcessor = (rule: Rule, helper: postcss.Helpers) => Promise<void> | void
type AtRuleProcessor = (atRule: AtRule, helper: postcss.Helpers) => Promise<void> | void
type CommentProcessor = (
comment: Comment,
helper: Helpers
helper: postcss.Helpers
) => Promise<void> | void

@@ -192,181 +151,206 @@

export interface Plugin extends Processors {
postcssPlugin: string
prepare?: (result: Result) => Processors
}
declare namespace postcss {
export {
NodeErrorOptions,
DeclarationProps,
CssSyntaxError,
ContainerProps,
WarningOptions,
DocumentProps,
FilePosition,
CommentProps,
AtRuleProps,
Declaration,
ChildProps,
LazyResult,
ChildNode,
NodeProps,
Processor,
RuleProps,
RootProps,
Container,
Position,
Document,
AnyNode,
Warning,
Message,
Comment,
Source,
AtRule,
Result,
Input,
Node,
list,
Rule,
Root
}
export interface PluginCreator<PluginOptions> {
(opts?: PluginOptions): Plugin | Processor
postcss: true
}
export type SourceMap = SourceMapGenerator & {
toJSON(): RawSourceMap
}
export interface Transformer extends TransformCallback {
postcssPlugin: string
postcssVersion: string
}
export type Helpers = { result: Result; postcss: Postcss } & Postcss
export interface TransformCallback {
(root: Root, result: Result): Promise<void> | void
}
export interface Plugin extends Processors {
postcssPlugin: string
prepare?: (result: Result) => Processors
}
export interface OldPlugin<T> extends Transformer {
(opts?: T): Transformer
postcss: Transformer
}
export interface PluginCreator<PluginOptions> {
(opts?: PluginOptions): Plugin | Processor
postcss: true
}
export type AcceptedPlugin =
| Plugin
| PluginCreator<any>
| OldPlugin<any>
| TransformCallback
| {
postcss: TransformCallback | Processor
}
| Processor
export interface Transformer extends TransformCallback {
postcssPlugin: string
postcssVersion: string
}
export interface Parser<RootNode = Root | Document> {
(
css: string | { toString(): string },
opts?: Pick<ProcessOptions, 'map' | 'from'>
): RootNode
}
export interface TransformCallback {
(root: Root, result: Result): Promise<void> | void
}
export interface Builder {
(part: string, node?: AnyNode, type?: 'start' | 'end'): void
}
export interface OldPlugin<T> extends Transformer {
(opts?: T): Transformer
postcss: Transformer
}
export interface Stringifier {
(node: AnyNode, builder: Builder): void
}
export type AcceptedPlugin =
| Plugin
| PluginCreator<any>
| OldPlugin<any>
| TransformCallback
| {
postcss: TransformCallback | Processor
}
| Processor
export interface JSONHydrator {
(data: object[]): Node[]
(data: object): Node
}
export interface Parser<RootNode = Root | Document> {
(
css: string | { toString(): string },
opts?: Pick<ProcessOptions, 'map' | 'from'>
): RootNode
}
export interface Syntax {
/**
* Function to generate AST by string.
*/
parse?: Parser
export interface Builder {
(part: string, node?: AnyNode, type?: 'start' | 'end'): void
}
/**
* Class to generate string by AST.
*/
stringify?: Stringifier
}
export interface Stringifier {
(node: AnyNode, builder: Builder): void
}
export interface SourceMapOptions {
/**
* Indicates that the source map should be embedded in the output CSS
* as a Base64-encoded comment. By default, it is `true`.
* But if all previous maps are external, not inline, PostCSS will not embed
* the map even if you do not set this option.
*
* If you have an inline source map, the result.map property will be empty,
* as the source map will be contained within the text of `result.css`.
*/
inline?: boolean
export interface JSONHydrator {
(data: object[]): Node[]
(data: object): Node
}
/**
* Source map content from a previous processing step (e.g., Sass).
*
* PostCSS will try to read the previous source map
* automatically (based on comments within the source CSS), but you can use
* this option to identify it manually.
*
* If desired, you can omit the previous map with prev: `false`.
*/
prev?: string | boolean | object | ((file: string) => string)
export interface Syntax {
/**
* Function to generate AST by string.
*/
parse?: Parser
/**
* Indicates that PostCSS should set the origin content (e.g., Sass source)
* of the source map. By default, it is true. But if all previous maps do not
* contain sources content, PostCSS will also leave it out even if you
* do not set this option.
*/
sourcesContent?: boolean
/**
* Class to generate string by AST.
*/
stringify?: Stringifier
}
/**
* Indicates that PostCSS should add annotation comments to the CSS.
* By default, PostCSS will always add a comment with a path
* to the source map. PostCSS will not add annotations to CSS files
* that do not contain any comments.
*
* By default, PostCSS presumes that you want to save the source map as
* `opts.to + '.map'` and will use this path in the annotation comment.
* A different path can be set by providing a string value for annotation.
*
* If you have set `inline: true`, annotation cannot be disabled.
*/
annotation?: string | boolean | ((file: string, root: Root) => string)
export interface SourceMapOptions {
/**
* Indicates that the source map should be embedded in the output CSS
* as a Base64-encoded comment. By default, it is `true`.
* But if all previous maps are external, not inline, PostCSS will not embed
* the map even if you do not set this option.
*
* If you have an inline source map, the result.map property will be empty,
* as the source map will be contained within the text of `result.css`.
*/
inline?: boolean
/**
* Override `from` in map’s sources.
*/
from?: string
/**
* Source map content from a previous processing step (e.g., Sass).
*
* PostCSS will try to read the previous source map
* automatically (based on comments within the source CSS), but you can use
* this option to identify it manually.
*
* If desired, you can omit the previous map with prev: `false`.
*/
prev?: string | boolean | object | ((file: string) => string)
/**
* Use absolute path in generated source map.
*/
absolute?: boolean
}
/**
* Indicates that PostCSS should set the origin content (e.g., Sass source)
* of the source map. By default, it is true. But if all previous maps do not
* contain sources content, PostCSS will also leave it out even if you
* do not set this option.
*/
sourcesContent?: boolean
export interface ProcessOptions {
/**
* The path of the CSS source file. You should always set `from`,
* because it is used in source map generation and syntax error messages.
*/
from?: string
/**
* Indicates that PostCSS should add annotation comments to the CSS.
* By default, PostCSS will always add a comment with a path
* to the source map. PostCSS will not add annotations to CSS files
* that do not contain any comments.
*
* By default, PostCSS presumes that you want to save the source map as
* `opts.to + '.map'` and will use this path in the annotation comment.
* A different path can be set by providing a string value for annotation.
*
* If you have set `inline: true`, annotation cannot be disabled.
*/
annotation?: string | boolean | ((file: string, root: Root) => string)
/**
* The path where you'll put the output CSS file. You should always set `to`
* to generate correct source maps.
*/
to?: string
/**
* Override `from` in map’s sources.
*/
from?: string
/**
* Function to generate AST by string.
*/
parser?: Syntax | Parser
/**
* Use absolute path in generated source map.
*/
absolute?: boolean
}
/**
* Class to generate string by AST.
*/
stringifier?: Syntax | Stringifier
export interface ProcessOptions {
/**
* The path of the CSS source file. You should always set `from`,
* because it is used in source map generation and syntax error messages.
*/
from?: string
/**
* Object with parse and stringify.
*/
syntax?: Syntax
/**
* The path where you'll put the output CSS file. You should always set `to`
* to generate correct source maps.
*/
to?: string
/**
* Source map options
*/
map?: SourceMapOptions | boolean
}
/**
* Function to generate AST by string.
*/
parser?: Syntax | Parser
export interface Postcss {
/**
* Create a new `Processor` instance that will apply `plugins`
* as CSS processors.
*
* ```js
* let postcss = require('postcss')
*
* postcss(plugins).process(css, { from, to }).then(result => {
* console.log(result.css)
* })
* ```
*
* @param plugins PostCSS plugins.
* @return Processor to process multiple CSS.
*/
(plugins?: AcceptedPlugin[]): Processor
(...plugins: AcceptedPlugin[]): Processor
/**
* Class to generate string by AST.
*/
stringifier?: Syntax | Stringifier
/**
* Object with parse and stringify.
*/
syntax?: Syntax
/**
* Source map options
*/
map?: SourceMapOptions | boolean
}
export type Postcss = typeof postcss
/**
* Default function to convert a node tree into a CSS string.
*/
stringify: Stringifier
export let stringify: Stringifier

@@ -384,3 +368,3 @@ /**

*/
parse: Parser<Root>
export let parse: Parser<Root>

@@ -396,10 +380,5 @@ /**

*/
fromJSON: JSONHydrator
export let fromJSON: JSONHydrator
/**
* Contains the `list` module.
*/
list: List
/**
* Creates a new `Comment` node.

@@ -410,3 +389,3 @@ *

*/
comment(defaults?: CommentProps): Comment
export function comment(defaults?: CommentProps): Comment

@@ -419,3 +398,3 @@ /**

*/
atRule(defaults?: AtRuleProps): AtRule
export function atRule(defaults?: AtRuleProps): AtRule

@@ -428,3 +407,3 @@ /**

*/
decl(defaults?: DeclarationProps): Declaration
export function decl(defaults?: DeclarationProps): Declaration

@@ -437,3 +416,3 @@ /**

*/
rule(defaults?: RuleProps): Rule
export function rule(defaults?: RuleProps): Rule

@@ -446,3 +425,3 @@ /**

*/
root(defaults?: RootProps): Root
export function root(defaults?: RootProps): Root

@@ -455,29 +434,25 @@ /**

*/
document(defaults?: DocumentProps): Document
export function document(defaults?: DocumentProps): Document
CssSyntaxError: typeof CssSyntaxError
Declaration: typeof Declaration
Container: typeof Container
Comment: typeof Comment
Warning: typeof Warning
AtRule: typeof AtRule
Result: typeof Result
Input: typeof Input
Rule: typeof Rule
Root: typeof Root
Node: typeof Node
export { postcss as default }
}
export const stringify: Stringifier
export const parse: Parser<Root>
export const fromJSON: JSONHydrator
/**
* Create a new `Processor` instance that will apply `plugins`
* as CSS processors.
*
* ```js
* let postcss = require('postcss')
*
* postcss(plugins).process(css, { from, to }).then(result => {
* console.log(result.css)
* })
* ```
*
* @param plugins PostCSS plugins.
* @return Processor to process multiple CSS.
*/
declare function postcss(plugins?: postcss.AcceptedPlugin[]): Processor
declare function postcss(...plugins: postcss.AcceptedPlugin[]): Processor
export const comment: Postcss['comment']
export const atRule: Postcss['atRule']
export const decl: Postcss['decl']
export const rule: Postcss['rule']
export const root: Postcss['root']
declare const postcss: Postcss
export default postcss
export = postcss

@@ -5,2 +5,7 @@ import { SourceMapConsumer } from 'source-map-js'

declare namespace PreviousMap {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
export { PreviousMap_ as default }
}
/**

@@ -18,3 +23,3 @@ * Source map information from input CSS.

*/
export default class PreviousMap {
declare class PreviousMap_ {
/**

@@ -75,1 +80,5 @@ * Was source map inlined by data-uri to input CSS.

}
declare class PreviousMap extends PreviousMap_ {}
export = PreviousMap

@@ -13,2 +13,7 @@ import {

declare namespace Processor {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
export { Processor_ as default }
}
/**

@@ -24,3 +29,3 @@ * Contains plugins to process CSS. Create one `Processor` instance,

*/
export default class Processor {
declare class Processor_ {
/**

@@ -105,1 +110,5 @@ * Current PostCSS version.

}
declare class Processor extends Processor_ {}
export = Processor

@@ -10,3 +10,3 @@ 'use strict'

constructor(plugins = []) {
this.version = '8.4.21'
this.version = '8.4.22'
this.plugins = this.normalize(plugins)

@@ -13,0 +13,0 @@ }

@@ -14,27 +14,33 @@ import {

export interface Message {
/**
* Message type.
*/
type: string
declare namespace Result {
export interface Message {
/**
* Message type.
*/
type: string
/**
* Source PostCSS plugin name.
*/
plugin?: string
/**
* Source PostCSS plugin name.
*/
plugin?: string
[others: string]: any
}
[others: string]: any
}
export interface ResultOptions extends ProcessOptions {
/**
* The CSS node that was the source of the warning.
*/
node?: Node
export interface ResultOptions extends ProcessOptions {
/**
* The CSS node that was the source of the warning.
*/
node?: Node
/**
* Name of plugin that created this warning. `Result#warn` will fill it
* automatically with `Plugin#postcssPlugin` value.
*/
plugin?: string
/**
* Name of plugin that created this warning. `Result#warn` will fill it
* automatically with `Plugin#postcssPlugin` value.
*/
plugin?: string
}
// eslint-disable-next-line @typescript-eslint/no-use-before-define
export { Result_ as default }
}

@@ -58,3 +64,3 @@

*/
export default class Result {
declare class Result_ {
/**

@@ -91,3 +97,3 @@ * The Processor instance used for this transformation.

*/
messages: Message[]
messages: Result.Message[]

@@ -111,3 +117,3 @@ /**

*/
opts: ResultOptions
opts: Result.ResultOptions

@@ -149,3 +155,3 @@ /**

*/
constructor(processor: Processor, root: Root | Document, opts: ResultOptions)
constructor(processor: Processor, root: Root | Document, opts: Result.ResultOptions)

@@ -202,1 +208,5 @@ /**

}
declare class Result extends Result_ {}
export = Result

@@ -6,36 +6,41 @@ import Container, { ContainerProps } from './container.js'

interface RootRaws extends Record<string, any> {
/**
* The space symbols after the last child to the end of file.
*/
after?: string
declare namespace Root {
export interface RootRaws extends Record<string, any> {
/**
* The space symbols after the last child to the end of file.
*/
after?: string
/**
* Non-CSS code before `Root`, when `Root` is inside `Document`.
*
* **Experimental:** some aspects of this node could change within minor
* or patch version releases.
*/
codeBefore?: string
/**
* Non-CSS code before `Root`, when `Root` is inside `Document`.
*
* **Experimental:** some aspects of this node could change within minor
* or patch version releases.
*/
codeBefore?: string
/**
* Non-CSS code after `Root`, when `Root` is inside `Document`.
*
* **Experimental:** some aspects of this node could change within minor
* or patch version releases.
*/
codeAfter?: string
/**
* Non-CSS code after `Root`, when `Root` is inside `Document`.
*
* **Experimental:** some aspects of this node could change within minor
* or patch version releases.
*/
codeAfter?: string
/**
* Is the last child has an (optional) semicolon.
*/
semicolon?: boolean
}
/**
* Is the last child has an (optional) semicolon.
*/
semicolon?: boolean
}
export interface RootProps extends ContainerProps {
/**
* Information used to generate byte-to-byte equal node string
* as it was in the origin input.
* */
raws?: RootRaws
export interface RootProps extends ContainerProps {
/**
* Information used to generate byte-to-byte equal node string
* as it was in the origin input.
* */
raws?: RootRaws
}
// eslint-disable-next-line @typescript-eslint/no-use-before-define
export { Root_ as default }
}

@@ -52,6 +57,6 @@

*/
export default class Root extends Container {
declare class Root_ extends Container {
type: 'root'
parent: Document | undefined
raws: RootRaws
raws: Root.RootRaws

@@ -71,6 +76,10 @@ /**

*/
toResult(options?: ProcessOptions): Result
toResult(options?: ProcessOptions): Result
constructor(defaults?: RootProps)
assign(overrides: object | RootProps): this
constructor(defaults?: Root.RootProps)
assign(overrides: object | Root.RootProps): this
}
declare class Root extends Root_ {}
export = Root
import Container, { ContainerProps } from './container.js'
interface RuleRaws extends Record<string, unknown> {
/**
* The space symbols before the node. It also stores `*`
* and `_` symbols before the declaration (IE hack).
*/
before?: string
declare namespace Rule {
export interface RuleRaws extends Record<string, unknown> {
/**
* The space symbols before the node. It also stores `*`
* and `_` symbols before the declaration (IE hack).
*/
before?: string
/**
* The space symbols after the last child of the node to the end of the node.
*/
after?: string
/**
* The space symbols after the last child of the node to the end of the node.
*/
after?: string
/**
* The symbols between the selector and `{` for rules.
*/
between?: string
/**
* The symbols between the selector and `{` for rules.
*/
between?: string
/**
* Contains `true` if the last child has an (optional) semicolon.
*/
semicolon?: boolean
/**
* Contains `true` if the last child has an (optional) semicolon.
*/
semicolon?: boolean
/**
* Contains `true` if there is semicolon after rule.
*/
ownSemicolon?: string
/**
* Contains `true` if there is semicolon after rule.
*/
ownSemicolon?: string
/**
* The rule’s selector with comments.
*/
selector?: {
value: string
raw: string
/**
* The rule’s selector with comments.
*/
selector?: {
value: string
raw: string
}
}
}
export interface RuleProps extends ContainerProps {
/** Selector or selectors of the rule. */
selector?: string
/** Selectors of the rule represented as an array of strings. */
selectors?: string[]
/** Information used to generate byte-to-byte equal node string as it was in the origin input. */
raws?: RuleRaws
export interface RuleProps extends ContainerProps {
/** Selector or selectors of the rule. */
selector?: string
/** Selectors of the rule represented as an array of strings. */
selectors?: string[]
/** Information used to generate byte-to-byte equal node string as it was in the origin input. */
raws?: RuleRaws
}
// eslint-disable-next-line @typescript-eslint/no-use-before-define
export { Rule_ as default }
}

@@ -66,6 +71,6 @@

*/
export default class Rule extends Container {
declare class Rule_ extends Container {
type: 'rule'
parent: Container | undefined
raws: RuleRaws
raws: Rule.RuleRaws

@@ -100,7 +105,11 @@ /**

constructor(defaults?: RuleProps)
assign(overrides: object | RuleProps): this
clone(overrides?: Partial<RuleProps>): this
cloneBefore(overrides?: Partial<RuleProps>): this
cloneAfter(overrides?: Partial<RuleProps>): this
constructor(defaults?: Rule.RuleProps)
assign(overrides: object | Rule.RuleProps): this
clone(overrides?: Partial<Rule.RuleProps>): this
cloneBefore(overrides?: Partial<Rule.RuleProps>): this
cloneAfter(overrides?: Partial<Rule.RuleProps>): this
}
declare class Rule extends Rule_ {}
export = Rule

@@ -13,3 +13,8 @@ import {

export default class Stringifier {
declare namespace Stringifier {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
export { Stringifier_ as default }
}
declare class Stringifier_ {
builder: Builder

@@ -39,1 +44,5 @@ constructor(builder: Builder)

}
declare class Stringifier extends Stringifier_ {}
export = Stringifier
import { Stringifier } from './postcss.js'
declare const stringify: Stringifier
interface Stringify extends Stringifier {
default: Stringify
}
export default stringify
declare const stringify: Stringify
export = stringify
import { RangePosition } from './css-syntax-error.js'
import Node from './node.js'
export interface WarningOptions {
/**
* CSS node that caused the warning.
*/
node?: Node
declare namespace Warning {
export interface WarningOptions {
/**
* CSS node that caused the warning.
*/
node?: Node
/**
* Word in CSS source that caused the warning.
*/
word?: string
/**
* Word in CSS source that caused the warning.
*/
word?: string
/**
* Start index, inclusive, in CSS node string that caused the warning.
*/
index?: number
/**
* Start index, inclusive, in CSS node string that caused the warning.
*/
index?: number
/**
* End index, exclusive, in CSS node string that caused the warning.
*/
endIndex?: number
/**
* End index, exclusive, in CSS node string that caused the warning.
*/
endIndex?: number
/**
* Start position, inclusive, in CSS node string that caused the warning.
*/
start?: RangePosition
/**
* Start position, inclusive, in CSS node string that caused the warning.
*/
start?: RangePosition
/**
* End position, exclusive, in CSS node string that caused the warning.
*/
end?: RangePosition
/**
* End position, exclusive, in CSS node string that caused the warning.
*/
end?: RangePosition
/**
* Name of the plugin that created this warning. `Result#warn` fills
* this property automatically.
*/
plugin?: string
/**
* Name of the plugin that created this warning. `Result#warn` fills
* this property automatically.
*/
plugin?: string
}
// eslint-disable-next-line @typescript-eslint/no-use-before-define
export { Warning_ as default }
}

@@ -51,3 +56,3 @@

*/
export default class Warning {
declare class Warning_ {
/**

@@ -127,3 +132,3 @@ * Type to filter warnings from `Result#messages`.

*/
constructor(text: string, opts?: WarningOptions)
constructor(text: string, opts?: Warning.WarningOptions)

@@ -141,1 +146,5 @@ /**

}
declare class Warning extends Warning_ {}
export = Warning
{
"name": "postcss",
"version": "8.4.21",
"version": "8.4.22",
"description": "Tool for transforming styles with JS plugins",

@@ -11,4 +11,3 @@ "engines": {

"require": "./lib/postcss.js",
"import": "./lib/postcss.mjs",
"types": "./lib/postcss.d.ts"
"import": "./lib/postcss.mjs"
},

@@ -65,2 +64,6 @@ "./lib/at-rule": "./lib/at-rule.js",

"url": "https://tidelift.com/funding/github/npm/postcss"
},
{
"type": "github",
"url": "https://github.com/sponsors/ai"
}

@@ -76,3 +79,3 @@ ],

"dependencies": {
"nanoid": "^3.3.4",
"nanoid": "^3.3.6",
"picocolors": "^1.0.0",

@@ -79,0 +82,0 @@ "source-map-js": "^1.0.2"

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc