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.2.8 to 8.2.9

8

lib/at-rule.d.ts

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

constructor (defaults?: AtRuleProps)
clone (overrides?: Partial<AtRuleProps>): this
cloneBefore (overrides?: Partial<AtRuleProps>): this
cloneAfter (overrides?: Partial<AtRuleProps>): this
constructor(defaults?: AtRuleProps)
clone(overrides?: Partial<AtRuleProps>): this
cloneBefore(overrides?: Partial<AtRuleProps>): this
cloneAfter(overrides?: Partial<AtRuleProps>): this
}

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

class AtRule extends Container {
constructor (defaults) {
constructor(defaults) {
super(defaults)

@@ -12,3 +12,3 @@ this.type = 'atrule'

append (...children) {
append(...children) {
if (!this.proxyOf.nodes) this.nodes = []

@@ -18,3 +18,3 @@ return super.append(...children)

prepend (...children) {
prepend(...children) {
if (!this.proxyOf.nodes) this.nodes = []

@@ -21,0 +21,0 @@ return super.prepend(...children)

@@ -47,6 +47,6 @@ import Node, { NodeProps } from './node.js'

constructor (defaults?: CommentProps)
clone (overrides?: Partial<CommentProps>): this
cloneBefore (overrides?: Partial<CommentProps>): this
cloneAfter (overrides?: Partial<CommentProps>): this
constructor(defaults?: CommentProps)
clone(overrides?: Partial<CommentProps>): this
cloneBefore(overrides?: Partial<CommentProps>): this
cloneAfter(overrides?: Partial<CommentProps>): this
}

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

class Comment extends Node {
constructor (defaults) {
constructor(defaults) {
super(defaults)

@@ -9,0 +9,0 @@ this.type = 'comment'

@@ -50,3 +50,3 @@ import Node, { ChildNode, NodeProps, ChildProps } from './node.js'

*/
get first (): ChildNode | undefined
get first(): ChildNode | undefined

@@ -60,3 +60,3 @@ /**

*/
get last (): ChildNode | undefined
get last(): ChildNode | undefined

@@ -96,3 +96,3 @@ /**

*/
each (
each(
callback: (node: ChildNode, index: number) => false | void

@@ -120,3 +120,3 @@ ): false | undefined

*/
walk (
walk(
callback: (node: ChildNode, index: number) => false | void

@@ -154,7 +154,7 @@ ): false | undefined

*/
walkDecls (
walkDecls(
propFilter: string | RegExp,
callback: (decl: Declaration, index: number) => false | void
): false | undefined
walkDecls (
walkDecls(
callback: (decl: Declaration, index: number) => false | void

@@ -185,7 +185,7 @@ ): false | undefined

*/
walkRules (
walkRules(
selectorFilter: string | RegExp,
callback: (atRule: Rule, index: number) => false | void
): false | undefined
walkRules (
walkRules(
callback: (atRule: Rule, index: number) => false | void

@@ -223,7 +223,7 @@ ): false | undefined

*/
walkAtRules (
walkAtRules(
nameFilter: string | RegExp,
callback: (atRule: AtRule, index: number) => false | void
): false | undefined
walkAtRules (
walkAtRules(
callback: (atRule: AtRule, index: number) => false | void

@@ -249,6 +249,6 @@ ): false | undefined

walkComments (
walkComments(
callback: (comment: Comment, indexed: number) => false | void
): false | undefined
walkComments (
walkComments(
callback: (comment: Comment, indexed: number) => false | void

@@ -277,3 +277,3 @@ ): false | undefined

*/
append (
append(
...nodes: (Node | Node[] | ChildProps | ChildProps[] | string | string[])[]

@@ -302,3 +302,3 @@ ): this

*/
prepend (
prepend(
...nodes: (Node | Node[] | ChildProps | ChildProps[] | string | string[])[]

@@ -317,3 +317,3 @@ ): this

*/
push (child: ChildNode): this
push(child: ChildNode): this

@@ -331,3 +331,3 @@ /**

*/
insertBefore (
insertBefore(
oldNode: ChildNode | number,

@@ -350,3 +350,3 @@ newNode:

*/
insertAfter (
insertAfter(
oldNode: ChildNode | number,

@@ -376,3 +376,3 @@ newNode:

*/
removeChild (child: ChildNode | number): this
removeChild(child: ChildNode | number): this

@@ -390,3 +390,3 @@ /**

*/
removeAll (): this
removeAll(): this

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

*/
replaceValues (
replaceValues(
pattern: string | RegExp,

@@ -422,3 +422,3 @@ options: ValueOptions,

): this
replaceValues (
replaceValues(
pattern: string | RegExp,

@@ -439,3 +439,3 @@ replaced: string | { (substring: string, ...args: any[]): string }

*/
every (
every(
condition: (node: ChildNode, index: number, nodes: ChildNode[]) => boolean

@@ -455,3 +455,3 @@ ): boolean

*/
some (
some(
condition: (node: ChildNode, index: number, nodes: ChildNode[]) => boolean

@@ -470,3 +470,3 @@ ): boolean

*/
index (child: ChildNode | number): number
index(child: ChildNode | number): number
}

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

function cleanSource (nodes) {
function cleanSource(nodes) {
return nodes.map(i => {

@@ -19,3 +19,3 @@ if (i.nodes) i.nodes = cleanSource(i.nodes)

function markDirtyUp (node) {
function markDirtyUp(node) {
node[isClean] = false

@@ -30,3 +30,3 @@ if (node.proxyOf.nodes) {

// istanbul ignore next
function rebuild (node) {
function rebuild(node) {
if (node.type === 'atrule') {

@@ -50,3 +50,3 @@ Object.setPrototypeOf(node, AtRule.prototype)

class Container extends Node {
push (child) {
push(child) {
child.parent = this

@@ -57,3 +57,3 @@ this.proxyOf.nodes.push(child)

each (callback) {
each(callback) {
if (!this.proxyOf.nodes) return undefined

@@ -75,3 +75,3 @@ let iterator = this.getIterator()

walk (callback) {
walk(callback) {
return this.each((child, i) => {

@@ -92,3 +92,3 @@ let result

walkDecls (prop, callback) {
walkDecls(prop, callback) {
if (!callback) {

@@ -116,3 +116,3 @@ callback = prop

walkRules (selector, callback) {
walkRules(selector, callback) {
if (!callback) {

@@ -141,3 +141,3 @@ callback = selector

walkAtRules (name, callback) {
walkAtRules(name, callback) {
if (!callback) {

@@ -165,3 +165,3 @@ callback = name

walkComments (callback) {
walkComments(callback) {
return this.walk((child, i) => {

@@ -174,3 +174,3 @@ if (child.type === 'comment') {

append (...children) {
append(...children) {
for (let child of children) {

@@ -186,3 +186,3 @@ let nodes = this.normalize(child, this.last)

prepend (...children) {
prepend(...children) {
children = children.reverse()

@@ -202,3 +202,3 @@ for (let child of children) {

cleanRaws (keepBetween) {
cleanRaws(keepBetween) {
super.cleanRaws(keepBetween)

@@ -210,3 +210,3 @@ if (this.nodes) {

insertBefore (exist, add) {
insertBefore(exist, add) {
exist = this.index(exist)

@@ -231,3 +231,3 @@

insertAfter (exist, add) {
insertAfter(exist, add) {
exist = this.index(exist)

@@ -251,3 +251,3 @@

removeChild (child) {
removeChild(child) {
child = this.index(child)

@@ -270,3 +270,3 @@ this.proxyOf.nodes[child].parent = undefined

removeAll () {
removeAll() {
for (let node of this.proxyOf.nodes) node.parent = undefined

@@ -280,3 +280,3 @@ this.proxyOf.nodes = []

replaceValues (pattern, opts, callback) {
replaceValues(pattern, opts, callback) {
if (!callback) {

@@ -299,11 +299,11 @@ callback = opts

every (condition) {
every(condition) {
return this.nodes.every(condition)
}
some (condition) {
some(condition) {
return this.nodes.some(condition)
}
index (child) {
index(child) {
if (typeof child === 'number') return child

@@ -314,3 +314,3 @@ if (child.proxyOf) child = child.proxyOf

get first () {
get first() {
if (!this.proxyOf.nodes) return undefined

@@ -320,3 +320,3 @@ return this.proxyOf.nodes[0]

get last () {
get last() {
if (!this.proxyOf.nodes) return undefined

@@ -326,3 +326,3 @@ return this.proxyOf.nodes[this.proxyOf.nodes.length - 1]

normalize (nodes, sample) {
normalize(nodes, sample) {
if (typeof nodes === 'string') {

@@ -377,5 +377,5 @@ nodes = cleanSource(parse(nodes).nodes)

getProxyProcessor () {
getProxyProcessor() {
return {
set (node, prop, value) {
set(node, prop, value) {
if (node[prop] === value) return true

@@ -389,3 +389,3 @@ node[prop] = value

get (node, prop) {
get(node, prop) {
if (prop === 'proxyOf') {

@@ -429,3 +429,3 @@ return node

getIterator () {
getIterator() {
if (!this.lastEach) this.lastEach = 0

@@ -432,0 +432,0 @@ if (!this.indexes) this.indexes = {}

@@ -41,3 +41,3 @@ import { FilePosition } from './input.js'

*/
constructor (
constructor(
message: string,

@@ -169,3 +169,3 @@ line?: number,

*/
toString (): string
toString(): string

@@ -193,3 +193,3 @@ /**

*/
showSourceCode (color?: boolean): string
showSourceCode(color?: boolean): string
}

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

class CssSyntaxError extends Error {
constructor (message, line, column, source, file, plugin) {
constructor(message, line, column, source, file, plugin) {
super(message)

@@ -35,3 +35,3 @@ this.name = 'CssSyntaxError'

setMessage () {
setMessage() {
this.message = this.plugin ? this.plugin + ': ' : ''

@@ -45,3 +45,3 @@ this.message += this.file ? this.file : '<css input>'

showSourceCode (color) {
showSourceCode(color) {
if (!this.source) return ''

@@ -85,3 +85,3 @@

toString () {
toString() {
let code = this.showSourceCode()

@@ -88,0 +88,0 @@ if (code) {

@@ -112,6 +112,6 @@ import Node from './node.js'

constructor (defaults?: DeclarationProps)
clone (overrides?: Partial<DeclarationProps>): this
cloneBefore (overrides?: Partial<DeclarationProps>): this
cloneAfter (overrides?: Partial<DeclarationProps>): this
constructor(defaults?: DeclarationProps)
clone(overrides?: Partial<DeclarationProps>): this
cloneBefore(overrides?: Partial<DeclarationProps>): this
cloneAfter(overrides?: Partial<DeclarationProps>): this
}

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

class Declaration extends Node {
constructor (defaults) {
constructor(defaults) {
if (

@@ -19,3 +19,3 @@ defaults &&

get variable () {
get variable() {
return this.prop.startsWith('--') || this.prop[0] === '$'

@@ -22,0 +22,0 @@ }

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

function fromJSON (json, inputs) {
function fromJSON(json, inputs) {
if (Array.isArray(json)) return json.map(n => fromJSON(n))

@@ -14,0 +14,0 @@

@@ -92,3 +92,3 @@ import { ProcessOptions } from './postcss.js'

*/
constructor (css: string, opts?: ProcessOptions)
constructor(css: string, opts?: ProcessOptions)

@@ -107,3 +107,3 @@ /**

*/
get from (): string
get from(): string

@@ -124,3 +124,3 @@ /**

*/
origin (line: number, column: number): FilePosition | false
origin(line: number, column: number): FilePosition | false

@@ -132,3 +132,3 @@ /**

*/
fromOffset (offset: number): { line: number; col: number } | null
fromOffset(offset: number): { line: number; col: number } | null
}

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

class Input {
constructor (css, opts = {}) {
constructor(css, opts = {}) {
if (

@@ -62,3 +62,3 @@ css === null ||

fromOffset (offset) {
fromOffset(offset) {
let lastLine, lineToIndex

@@ -105,3 +105,3 @@ if (!this[fromOffsetCache]) {

error (message, line, column, opts = {}) {
error(message, line, column, opts = {}) {
let result

@@ -143,3 +143,3 @@ if (!column) {

origin (line, column) {
origin(line, column) {
if (!this.map) return false

@@ -178,3 +178,3 @@ let consumer = this.map.consumer()

mapResolve (file) {
mapResolve(file) {
if (/^\w+:\/\//.test(file)) {

@@ -186,7 +186,7 @@ return file

get from () {
get from() {
return this.file || this.id
}
toJSON () {
toJSON() {
let json = {}

@@ -193,0 +193,0 @@ for (let name of ['hasBOM', 'css', 'file', 'id']) {

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

*/
constructor (processor: Processor, css: string, opts: ResultOptions)
constructor(processor: Processor, css: string, opts: ResultOptions)

@@ -74,3 +74,3 @@ /**

*/
get [Symbol.toStringTag] (): string
get [Symbol.toStringTag](): string

@@ -81,3 +81,3 @@ /**

*/
get processor (): Processor
get processor(): Processor

@@ -87,3 +87,3 @@ /**

*/
get opts (): ResultOptions
get opts(): ResultOptions

@@ -99,3 +99,3 @@ /**

*/
get css (): string
get css(): string

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

*/
get content (): string
get content(): string

@@ -123,3 +123,3 @@ /**

*/
get map (): SourceMap
get map(): SourceMap

@@ -136,3 +136,3 @@ /**

*/
get root (): Root
get root(): Root

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

*/
get messages (): Message[]
get messages(): Message[]

@@ -158,3 +158,3 @@ /**

*/
warnings (): Warning[]
warnings(): Warning[]

@@ -170,3 +170,3 @@ /**

*/
toString (): string
toString(): string

@@ -178,3 +178,3 @@ /**

*/
sync (): Result
sync(): Result

@@ -186,3 +186,3 @@ /**

*/
async (): Promise<Result>
async(): Promise<Result>
}

@@ -44,7 +44,7 @@ 'use strict'

function isPromise (obj) {
function isPromise(obj) {
return typeof obj === 'object' && typeof obj.then === 'function'
}
function getEvents (node) {
function getEvents(node) {
let key = false

@@ -75,3 +75,3 @@ let type = TYPE_TO_CLASS_NAME[node.type]

function toStack (node) {
function toStack(node) {
let events

@@ -94,3 +94,3 @@ if (node.type === 'root') {

function cleanMarks (node) {
function cleanMarks(node) {
node[isClean] = false

@@ -104,3 +104,3 @@ if (node.nodes) node.nodes.forEach(i => cleanMarks(i))

class LazyResult {
constructor (processor, css, opts) {
constructor(processor, css, opts) {
this.stringified = false

@@ -144,43 +144,43 @@ this.processed = false

get [Symbol.toStringTag] () {
get [Symbol.toStringTag]() {
return 'LazyResult'
}
get processor () {
get processor() {
return this.result.processor
}
get opts () {
get opts() {
return this.result.opts
}
get css () {
get css() {
return this.stringify().css
}
get content () {
get content() {
return this.stringify().content
}
get map () {
get map() {
return this.stringify().map
}
get root () {
get root() {
return this.sync().root
}
get messages () {
get messages() {
return this.sync().messages
}
warnings () {
warnings() {
return this.sync().warnings()
}
toString () {
toString() {
return this.css
}
then (onFulfilled, onRejected) {
then(onFulfilled, onRejected) {
if (process.env.NODE_ENV !== 'production') {

@@ -198,11 +198,11 @@ if (!('from' in this.opts)) {

catch (onRejected) {
catch(onRejected) {
return this.async().catch(onRejected)
}
finally (onFinally) {
finally(onFinally) {
return this.async().then(onFinally, onFinally)
}
async () {
async() {
if (this.error) return Promise.reject(this.error)

@@ -216,3 +216,3 @@ if (this.processed) return Promise.resolve(this.result)

sync () {
sync() {
if (this.error) throw this.error

@@ -248,3 +248,3 @@ if (this.processed) return this.result

stringify () {
stringify() {
if (this.error) throw this.error

@@ -270,3 +270,3 @@ if (this.stringified) return this.result

walkSync (node) {
walkSync(node) {
node[isClean] = true

@@ -290,3 +290,3 @@ let events = getEvents(node)

visitSync (visitors, node) {
visitSync(visitors, node) {
for (let [plugin, visitor] of visitors) {

@@ -307,3 +307,3 @@ this.result.lastPlugin = plugin

runOnRoot (plugin) {
runOnRoot(plugin) {
this.result.lastPlugin = plugin

@@ -321,7 +321,7 @@ try {

getAsyncError () {
getAsyncError() {
throw new Error('Use process(css).then(cb) to work with async plugins')
}
handleError (error, node) {
handleError(error, node) {
let plugin = this.result.lastPlugin

@@ -363,3 +363,3 @@ try {

async runAsync () {
async runAsync() {
this.plugin = 0

@@ -413,3 +413,3 @@ for (let i = 0; i < this.plugins.length; i++) {

prepareVisitors () {
prepareVisitors() {
this.listeners = {}

@@ -452,3 +452,3 @@ let add = (plugin, type, cb) => {

visitTick (stack) {
visitTick(stack) {
let visit = stack[stack.length - 1]

@@ -455,0 +455,0 @@ let { node, visitors } = visit

'use strict'
let list = {
split (string, separators, last) {
split(string, separators, last) {
let array = []

@@ -45,3 +45,3 @@ let current = ''

space (string) {
space(string) {
let spaces = [' ', '\n', '\t']

@@ -51,3 +51,3 @@ return list.split(string, spaces)

comma (string) {
comma(string) {
return list.split(string, [','], true)

@@ -54,0 +54,0 @@ }

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

class MapGenerator {
constructor (stringify, root, opts) {
constructor(stringify, root, opts) {
this.stringify = stringify

@@ -18,3 +18,3 @@ this.mapOpts = opts.map || {}

isMap () {
isMap() {
if (typeof this.opts.map !== 'undefined') {

@@ -26,3 +26,3 @@ return !!this.opts.map

previous () {
previous() {
if (!this.previousMaps) {

@@ -43,3 +43,3 @@ this.previousMaps = []

isInline () {
isInline() {
if (typeof this.mapOpts.inline !== 'undefined') {

@@ -60,3 +60,3 @@ return this.mapOpts.inline

isSourcesContent () {
isSourcesContent() {
if (typeof this.mapOpts.sourcesContent !== 'undefined') {

@@ -71,3 +71,3 @@ return this.mapOpts.sourcesContent

clearAnnotation () {
clearAnnotation() {
if (this.mapOpts.annotation === false) return

@@ -85,3 +85,3 @@

setSourcesContent () {
setSourcesContent() {
let already = {}

@@ -102,3 +102,3 @@ this.root.walk(node => {

applyPrevMaps () {
applyPrevMaps() {
for (let prev of this.previous()) {

@@ -122,3 +122,3 @@ let from = this.toUrl(this.path(prev.file))

isAnnotation () {
isAnnotation() {
if (this.isInline()) {

@@ -136,3 +136,3 @@ return true

toBase64 (str) {
toBase64(str) {
if (Buffer) {

@@ -146,3 +146,3 @@ return Buffer.from(str).toString('base64')

addAnnotation () {
addAnnotation() {
let content

@@ -167,3 +167,3 @@

outputFile () {
outputFile() {
if (this.opts.to) {

@@ -178,3 +178,3 @@ return this.path(this.opts.to)

generateMap () {
generateMap() {
this.generateString()

@@ -191,3 +191,3 @@ if (this.isSourcesContent()) this.setSourcesContent()

path (file) {
path(file) {
if (file.indexOf('<') === 0) return file

@@ -207,3 +207,3 @@ if (/^\w+:\/\//.test(file)) return file

toUrl (path) {
toUrl(path) {
if (sep === '\\') {

@@ -216,3 +216,3 @@ // istanbul ignore next

sourcePath (node) {
sourcePath(node) {
if (this.mapOpts.from) {

@@ -227,3 +227,3 @@ return this.toUrl(this.mapOpts.from)

generateString () {
generateString() {
this.css = ''

@@ -294,3 +294,3 @@ this.map = new mozilla.SourceMapGenerator({ file: this.outputFile() })

generate () {
generate() {
this.clearAnnotation()

@@ -297,0 +297,0 @@

@@ -178,3 +178,3 @@ import Declaration, { DeclarationProps } from './declaration.js'

*/
constructor (defaults?: object)
constructor(defaults?: object)

@@ -208,3 +208,3 @@ /**

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

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

*/
warn (result: Result, text: string, opts?: WarningOptions): void
warn(result: Result, text: string, opts?: WarningOptions): void

@@ -243,3 +243,3 @@ /**

*/
remove (): this
remove(): this

@@ -256,3 +256,3 @@ /**

*/
toString (stringifier?: Stringifier | Syntax): string
toString(stringifier?: Stringifier | Syntax): string

@@ -275,3 +275,3 @@ /**

*/
clone (overrides?: object): this
clone(overrides?: object): this

@@ -290,3 +290,3 @@ /**

*/
cloneBefore (overrides?: object): this
cloneBefore(overrides?: object): this

@@ -300,3 +300,3 @@ /**

*/
cloneAfter (overrides?: object): this
cloneAfter(overrides?: object): this

@@ -317,3 +317,3 @@ /**

*/
replaceWith (
replaceWith(
...nodes: (ChildNode | ChildProps | ChildNode[] | ChildProps[])[]

@@ -337,3 +337,3 @@ ): this

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

@@ -353,3 +353,3 @@ /**

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

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

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

@@ -383,3 +383,3 @@ /**

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

@@ -395,3 +395,3 @@ /**

*/
root (): Root
root(): Root

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

*/
raw (prop: string, defaultType?: string): string
raw(prop: string, defaultType?: string): string

@@ -430,3 +430,3 @@ /**

*/
cleanRaws (keepBetween?: boolean): void
cleanRaws(keepBetween?: boolean): void

@@ -438,3 +438,3 @@ /**

*/
toJSON (): object
toJSON(): object

@@ -447,3 +447,3 @@ /**

*/
positionInside (index: number): Position
positionInside(index: number): Position
}

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

function cloneNode (obj, parent) {
function cloneNode(obj, parent) {
let cloned = new obj.constructor()

@@ -37,3 +37,3 @@

class Node {
constructor (defaults = {}) {
constructor(defaults = {}) {
this.raws = {}

@@ -58,3 +58,3 @@ this[isClean] = false

error (message, opts = {}) {
error(message, opts = {}) {
if (this.source) {

@@ -67,3 +67,3 @@ let pos = this.positionBy(opts)

warn (result, text, opts) {
warn(result, text, opts) {
let data = { node: this }

@@ -74,3 +74,3 @@ for (let i in opts) data[i] = opts[i]

remove () {
remove() {
if (this.parent) {

@@ -83,3 +83,3 @@ this.parent.removeChild(this)

toString (stringifier = stringify) {
toString(stringifier = stringify) {
if (stringifier.stringify) stringifier = stringifier.stringify

@@ -93,3 +93,3 @@ let result = ''

clone (overrides = {}) {
clone(overrides = {}) {
let cloned = cloneNode(this)

@@ -102,3 +102,3 @@ for (let name in overrides) {

cloneBefore (overrides = {}) {
cloneBefore(overrides = {}) {
let cloned = this.clone(overrides)

@@ -109,3 +109,3 @@ this.parent.insertBefore(this, cloned)

cloneAfter (overrides = {}) {
cloneAfter(overrides = {}) {
let cloned = this.clone(overrides)

@@ -116,3 +116,3 @@ this.parent.insertAfter(this, cloned)

replaceWith (...nodes) {
replaceWith(...nodes) {
if (this.parent) {

@@ -140,3 +140,3 @@ let bookmark = this

next () {
next() {
if (!this.parent) return undefined

@@ -147,3 +147,3 @@ let index = this.parent.index(this)

prev () {
prev() {
if (!this.parent) return undefined

@@ -154,3 +154,3 @@ let index = this.parent.index(this)

before (add) {
before(add) {
this.parent.insertBefore(this, add)

@@ -160,3 +160,3 @@ return this

after (add) {
after(add) {
this.parent.insertAfter(this, add)

@@ -166,3 +166,3 @@ return this

root () {
root() {
let result = this

@@ -173,3 +173,3 @@ while (result.parent) result = result.parent

raw (prop, defaultType) {
raw(prop, defaultType) {
let str = new Stringifier()

@@ -179,3 +179,3 @@ return str.raw(this, prop, defaultType)

cleanRaws (keepBetween) {
cleanRaws(keepBetween) {
delete this.raws.before

@@ -186,3 +186,3 @@ delete this.raws.after

toJSON (_, inputs) {
toJSON(_, inputs) {
let fixed = {}

@@ -235,3 +235,3 @@ let emitInputs = inputs == null

positionInside (index) {
positionInside(index) {
let string = this.toString()

@@ -253,3 +253,3 @@ let column = this.source.start.column

positionBy (opts) {
positionBy(opts) {
let pos = this.source.start

@@ -265,5 +265,5 @@ if (opts.index) {

getProxyProcessor () {
getProxyProcessor() {
return {
set (node, prop, value) {
set(node, prop, value) {
if (node[prop] === value) return true

@@ -284,3 +284,3 @@ node[prop] = value

get (node, prop) {
get(node, prop) {
if (prop === 'proxyOf') {

@@ -297,3 +297,3 @@ return node

toProxy () {
toProxy() {
if (!this.proxyCache) {

@@ -305,3 +305,3 @@ this.proxyCache = new Proxy(this, this.getProxyProcessor())

addToError (error) {
addToError(error) {
error.postcssNode = this

@@ -318,3 +318,3 @@ if (error.stack && this.source && /\n\s{4}at /.test(error.stack)) {

markDirty () {
markDirty() {
if (this[isClean]) {

@@ -329,3 +329,3 @@ this[isClean] = false

get proxyOf () {
get proxyOf() {
return this

@@ -332,0 +332,0 @@ }

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

function parse (css, opts) {
function parse(css, opts) {
let input = new Input(css, opts)

@@ -10,0 +10,0 @@ let parser = new Parser(input)

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

class Parser {
constructor (input) {
constructor(input) {
this.input = input

@@ -25,7 +25,7 @@

createTokenizer () {
createTokenizer() {
this.tokenizer = tokenizer(this.input)
}
parse () {
parse() {
let token

@@ -68,3 +68,3 @@ while (!this.tokenizer.endOfFile()) {

comment (token) {
comment(token) {
let node = new Comment()

@@ -87,3 +87,3 @@ this.init(node, token[2])

emptyRule (token) {
emptyRule(token) {
let node = new Rule()

@@ -96,3 +96,3 @@ this.init(node, token[2])

other (start) {
other(start) {
let end = false

@@ -158,3 +158,3 @@ let type = null

rule (tokens) {
rule(tokens) {
tokens.pop()

@@ -170,3 +170,3 @@

decl (tokens, customProperty) {
decl(tokens, customProperty) {
let node = new Declaration()

@@ -264,3 +264,3 @@ this.init(node, tokens[0][2])

atrule (token) {
atrule(token) {
let node = new AtRule()

@@ -348,3 +348,3 @@ node.name = token[1].slice(1)

end (token) {
end(token) {
if (this.current.nodes && this.current.nodes.length) {

@@ -366,3 +366,3 @@ this.current.raws.semicolon = this.semicolon

endFile () {
endFile() {
if (this.current.parent) this.unclosedBlock()

@@ -375,3 +375,3 @@ if (this.current.nodes && this.current.nodes.length) {

freeSemicolon (token) {
freeSemicolon(token) {
this.spaces += token[1]

@@ -389,3 +389,3 @@ if (this.current.nodes) {

getPosition (offset) {
getPosition(offset) {
let pos = this.input.fromOffset(offset)

@@ -399,3 +399,3 @@ return {

init (node, offset) {
init(node, offset) {
this.current.push(node)

@@ -411,3 +411,3 @@ node.source = {

raw (node, prop, tokens) {
raw(node, prop, tokens) {
let token, type

@@ -455,3 +455,3 @@ let length = tokens.length

spacesAndCommentsFromEnd (tokens) {
spacesAndCommentsFromEnd(tokens) {
let lastTokenType

@@ -467,3 +467,3 @@ let spaces = ''

spacesAndCommentsFromStart (tokens) {
spacesAndCommentsFromStart(tokens) {
let next

@@ -479,3 +479,3 @@ let spaces = ''

spacesFromEnd (tokens) {
spacesFromEnd(tokens) {
let lastTokenType

@@ -491,3 +491,3 @@ let spaces = ''

stringFrom (tokens, from) {
stringFrom(tokens, from) {
let result = ''

@@ -501,3 +501,3 @@ for (let i = from; i < tokens.length; i++) {

colon (tokens) {
colon(tokens) {
let brackets = 0

@@ -532,15 +532,15 @@ let token, type, prev

unclosedBracket (bracket) {
unclosedBracket(bracket) {
throw this.input.error('Unclosed bracket', bracket[2])
}
unknownWord (tokens) {
unknownWord(tokens) {
throw this.input.error('Unknown word', tokens[0][2])
}
unexpectedClose (token) {
unexpectedClose(token) {
throw this.input.error('Unexpected }', token[2])
}
unclosedBlock () {
unclosedBlock() {
let pos = this.current.source.start

@@ -550,15 +550,15 @@ throw this.input.error('Unclosed block', pos.line, pos.column)

doubleColon (token) {
doubleColon(token) {
throw this.input.error('Double colon', token[2])
}
unnamedAtrule (node, token) {
unnamedAtrule(node, token) {
throw this.input.error('At-rule without name', token[2])
}
precheckMissedSemicolon (/* tokens */) {
precheckMissedSemicolon(/* tokens */) {
// Hook for Safe Parser
}
checkMissedSemicolon (tokens) {
checkMissedSemicolon(tokens) {
let colon = this.colon(tokens)

@@ -565,0 +565,0 @@ if (colon === false) return

@@ -7,2 +7,3 @@ import { SourceMapGenerator, RawSourceMap } from 'source-map'

ChildNode,
NodeErrorOptions,
NodeProps,

@@ -34,2 +35,3 @@ ChildProps,

Message,
NodeErrorOptions,
NodeProps,

@@ -36,0 +38,0 @@ DeclarationProps,

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

function postcss (...plugins) {
function postcss(...plugins) {
if (plugins.length === 1 && Array.isArray(plugins[0])) {

@@ -29,3 +29,3 @@ plugins = plugins[0]

postcss.plugin = function plugin (name, initializer) {
postcss.plugin = function plugin(name, initializer) {
if (console && console.warn) {

@@ -46,3 +46,3 @@ console.warn(

}
function creator (...args) {
function creator(...args) {
let transformer = initializer(...args)

@@ -56,3 +56,3 @@ transformer.postcssPlugin = name

Object.defineProperty(creator, 'postcss', {
get () {
get() {
if (!cache) cache = creator()

@@ -59,0 +59,0 @@ return cache

@@ -53,3 +53,3 @@ import { SourceMapConsumer } from 'source-map'

*/
constructor (css: string, opts?: ProcessOptions)
constructor(css: string, opts?: ProcessOptions)

@@ -65,3 +65,3 @@ /**

*/
consumer (): SourceMapConsumer
consumer(): SourceMapConsumer

@@ -73,3 +73,3 @@ /**

*/
withContent (): boolean
withContent(): boolean
}

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

function fromBase64 (str) {
function fromBase64(str) {
if (Buffer) {

@@ -18,3 +18,3 @@ return Buffer.from(str, 'base64').toString()

class PreviousMap {
constructor (css, opts) {
constructor(css, opts) {
if (opts.map === false) return

@@ -33,3 +33,3 @@ this.loadAnnotation(css)

consumer () {
consumer() {
if (!this.consumerCache) {

@@ -41,3 +41,3 @@ this.consumerCache = new mozilla.SourceMapConsumer(this.text)

withContent () {
withContent() {
return !!(

@@ -49,3 +49,3 @@ this.consumer().sourcesContent &&

startWith (string, start) {
startWith(string, start) {
if (!string) return false

@@ -55,3 +55,3 @@ return string.substr(0, start.length) === start

getAnnotationURL (sourceMapString) {
getAnnotationURL(sourceMapString) {
return sourceMapString

@@ -62,3 +62,3 @@ .match(/\/\*\s*# sourceMappingURL=(.*)\s*\*\//)[1]

loadAnnotation (css) {
loadAnnotation(css) {
let annotations = css.match(/\/\*\s*# sourceMappingURL=.*\s*\*\//gm)

@@ -76,3 +76,3 @@

decodeInline (text) {
decodeInline(text) {
let baseCharsetUri = /^data:application\/json;charset=utf-?8;base64,/

@@ -95,3 +95,3 @@ let baseUri = /^data:application\/json;base64,/

loadFile (path) {
loadFile(path) {
this.root = dirname(path)

@@ -104,3 +104,3 @@ if (existsSync(path)) {

loadMap (file, prev) {
loadMap(file, prev) {
if (prev === false) return false

@@ -142,3 +142,3 @@

isMap (map) {
isMap(map) {
if (typeof map !== 'object') return false

@@ -145,0 +145,0 @@ return (

@@ -47,3 +47,3 @@ import {

*/
constructor (plugins?: AcceptedPlugin[])
constructor(plugins?: AcceptedPlugin[])

@@ -77,3 +77,3 @@ /**

*/
use (plugin: AcceptedPlugin): this
use(plugin: AcceptedPlugin): this

@@ -99,3 +99,3 @@ /**

*/
process (
process(
css: string | { toString(): string } | Result | LazyResult | Root,

@@ -102,0 +102,0 @@ options?: ProcessOptions

@@ -7,8 +7,8 @@ 'use strict'

class Processor {
constructor (plugins = []) {
this.version = '8.2.8'
constructor(plugins = []) {
this.version = '8.2.9'
this.plugins = this.normalize(plugins)
}
use (plugin) {
use(plugin) {
this.plugins = this.plugins.concat(this.normalize([plugin]))

@@ -18,3 +18,3 @@ return this

process (css, opts = {}) {
process(css, opts = {}) {
if (

@@ -38,3 +38,3 @@ this.plugins.length === 0 &&

normalize (plugins) {
normalize(plugins) {
let normalized = []

@@ -41,0 +41,0 @@ for (let i of plugins) {

@@ -144,3 +144,3 @@ import {

*/
constructor (processor: Processor, root: Root, opts: ResultOptions)
constructor(processor: Processor, root: Root, opts: ResultOptions)

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

*/
get content (): string
get content(): string

@@ -167,3 +167,3 @@ /**

*/
toString (): string
toString(): string

@@ -183,3 +183,3 @@ /**

*/
warn (message: string, options?: WarningOptions): Warning
warn(message: string, options?: WarningOptions): Warning

@@ -198,3 +198,3 @@ /**

*/
warnings (): Warning[]
warnings(): Warning[]
}

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

class Result {
constructor (processor, root, opts) {
constructor(processor, root, opts) {
this.processor = processor

@@ -16,7 +16,7 @@ this.messages = []

toString () {
toString() {
return this.css
}
warn (text, opts = {}) {
warn(text, opts = {}) {
if (!opts.plugin) {

@@ -34,7 +34,7 @@ if (this.lastPlugin && this.lastPlugin.postcssPlugin) {

warnings () {
warnings() {
return this.messages.filter(i => i.type === 'warning')
}
get content () {
get content() {
return this.css

@@ -41,0 +41,0 @@ }

@@ -35,3 +35,3 @@ import Container, { ContainerProps } from './container.js'

constructor (defaults?: RootProps)
constructor(defaults?: RootProps)

@@ -51,3 +51,3 @@ /**

*/
toResult (options?: ProcessOptions): Result
toResult(options?: ProcessOptions): Result
}

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

class Root extends Container {
constructor (defaults) {
constructor(defaults) {
super(defaults)

@@ -15,3 +15,3 @@ this.type = 'root'

removeChild (child, ignore) {
removeChild(child, ignore) {
let index = this.index(child)

@@ -26,3 +26,3 @@

normalize (child, sample, type) {
normalize(child, sample, type) {
let nodes = super.normalize(child)

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

toResult (opts = {}) {
toResult(opts = {}) {
let lazy = new LazyResult(new Processor(), this, opts)

@@ -50,0 +50,0 @@ return lazy.stringify()

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

constructor (defaults?: RuleProps)
clone (overrides?: Partial<RuleProps>): this
cloneBefore (overrides?: Partial<RuleProps>): this
cloneAfter (overrides?: Partial<RuleProps>): this
constructor(defaults?: RuleProps)
clone(overrides?: Partial<RuleProps>): this
cloneBefore(overrides?: Partial<RuleProps>): this
cloneAfter(overrides?: Partial<RuleProps>): this
}

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

class Rule extends Container {
constructor (defaults) {
constructor(defaults) {
super(defaults)

@@ -14,7 +14,7 @@ this.type = 'rule'

get selectors () {
get selectors() {
return list.comma(this.selector)
}
set selectors (values) {
set selectors(values) {
let match = this.selector ? this.selector.match(/,\s*/) : null

@@ -21,0 +21,0 @@ let sep = match ? match[0] : ',' + this.raw('between', 'beforeOpen')

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

function capitalize (str) {
function capitalize(str) {
return str[0].toUpperCase() + str.slice(1)

@@ -24,7 +24,7 @@ }

class Stringifier {
constructor (builder) {
constructor(builder) {
this.builder = builder
}
stringify (node, semicolon) {
stringify(node, semicolon) {
/* istanbul ignore if */

@@ -42,3 +42,3 @@ if (!this[node.type]) {

root (node) {
root(node) {
this.body(node)

@@ -48,3 +48,3 @@ if (node.raws.after) this.builder(node.raws.after)

comment (node) {
comment(node) {
let left = this.raw(node, 'left', 'commentLeft')

@@ -55,3 +55,3 @@ let right = this.raw(node, 'right', 'commentRight')

decl (node, semicolon) {
decl(node, semicolon) {
let between = this.raw(node, 'between', 'colon')

@@ -68,3 +68,3 @@ let string = node.prop + between + this.rawValue(node, 'value')

rule (node) {
rule(node) {
this.block(node, this.rawValue(node, 'selector'))

@@ -76,3 +76,3 @@ if (node.raws.ownSemicolon) {

atrule (node, semicolon) {
atrule(node, semicolon) {
let name = '@' + node.name

@@ -95,3 +95,3 @@ let params = node.params ? this.rawValue(node, 'params') : ''

body (node) {
body(node) {
let last = node.nodes.length - 1

@@ -112,3 +112,3 @@ while (last > 0) {

block (node, start) {
block(node, start) {
let between = this.raw(node, 'between', 'beforeOpen')

@@ -129,3 +129,3 @@ this.builder(start + between + '{', node, 'start')

raw (node, own, detect) {
raw(node, own, detect) {
let value

@@ -179,3 +179,3 @@ if (!detect) detect = own

rawSemicolon (root) {
rawSemicolon(root) {
let value

@@ -191,3 +191,3 @@ root.walk(i => {

rawEmptyBody (root) {
rawEmptyBody(root) {
let value

@@ -203,3 +203,3 @@ root.walk(i => {

rawIndent (root) {
rawIndent(root) {
if (root.raws.indent) return root.raws.indent

@@ -221,3 +221,3 @@ let value

rawBeforeComment (root, node) {
rawBeforeComment(root, node) {
let value

@@ -241,3 +241,3 @@ root.walkComments(i => {

rawBeforeDecl (root, node) {
rawBeforeDecl(root, node) {
let value

@@ -261,3 +261,3 @@ root.walkDecls(i => {

rawBeforeRule (root) {
rawBeforeRule(root) {
let value

@@ -279,3 +279,3 @@ root.walk(i => {

rawBeforeClose (root) {
rawBeforeClose(root) {
let value

@@ -297,3 +297,3 @@ root.walk(i => {

rawBeforeOpen (root) {
rawBeforeOpen(root) {
let value

@@ -309,3 +309,3 @@ root.walk(i => {

rawColon (root) {
rawColon(root) {
let value

@@ -321,3 +321,3 @@ root.walkDecls(i => {

beforeAfter (node, detect) {
beforeAfter(node, detect) {
let value

@@ -351,3 +351,3 @@ if (node.type === 'decl') {

rawValue (node, prop) {
rawValue(node, prop) {
let value = node[prop]

@@ -354,0 +354,0 @@ let raw = node.raws[prop]

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

function stringify (node, builder) {
function stringify(node, builder) {
let str = new Stringifier(builder)

@@ -8,0 +8,0 @@ str.stringify(node)

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

function registerInput (dependant) {
function registerInput(dependant) {
Input = dependant

@@ -32,3 +32,3 @@ }

function getTokenType ([type, value], processor) {
function getTokenType([type, value], processor) {
if (type === 'word') {

@@ -52,3 +52,3 @@ if (value[0] === '.') {

function terminalHighlight (css) {
function terminalHighlight(css) {
let processor = tokenizer(new Input(css), { ignoreErrors: true })

@@ -55,0 +55,0 @@ let result = ''

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

module.exports = function tokenizer (input, options = {}) {
module.exports = function tokenizer(input, options = {}) {
let css = input.css.valueOf()

@@ -41,15 +41,15 @@ let ignore = options.ignoreErrors

function position () {
function position() {
return pos
}
function unclosed (what) {
function unclosed(what) {
throw input.error('Unclosed ' + what, pos)
}
function endOfFile () {
function endOfFile() {
return returned.length === 0 && pos >= length
}
function nextToken (opts) {
function nextToken(opts) {
if (returned.length) return returned.pop()

@@ -258,3 +258,3 @@ if (pos >= length) return

function back (token) {
function back(token) {
returned.push(token)

@@ -261,0 +261,0 @@ }

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

module.exports = function warnOnce (message) {
module.exports = function warnOnce(message) {
if (printed[message]) return

@@ -8,0 +8,0 @@ printed[message] = true

@@ -92,3 +92,3 @@ import Node from './node.js'

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

@@ -104,3 +104,3 @@ /**

*/
toString (): string
toString(): string
}
'use strict'
class Warning {
constructor (text, opts = {}) {
constructor(text, opts = {}) {
this.type = 'warning'

@@ -17,3 +17,3 @@ this.text = text

toString () {
toString() {
if (this.node) {

@@ -20,0 +20,0 @@ return this.node.error(this.text, {

{
"name": "postcss",
"version": "8.2.8",
"version": "8.2.9",
"description": "Tool for transforming styles with JS plugins",

@@ -39,3 +39,3 @@ "engines": {

"colorette": "^1.2.2",
"nanoid": "^3.1.20",
"nanoid": "^3.1.22",
"source-map": "^0.6.1"

@@ -42,0 +42,0 @@ },

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