summaryrefslogtreecommitdiff
path: root/node_modules/postcss/lib
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2024-08-30 17:21:18 +0800
committerlittleblack111 <littleblack11111@gmail.com>2024-08-30 17:21:18 +0800
commitefbc2ffe6a1ee5ec38a4396305561d6515d0943e (patch)
tree2b4c94f18f2c792dfda813050755d5c0273fae22 /node_modules/postcss/lib
parent43acceb75957c880a5ba5a31aae221394a36d5f6 (diff)
node fixes, updates
Diffstat (limited to 'node_modules/postcss/lib')
-rw-r--r--node_modules/postcss/lib/at-rule.d.ts47
-rw-r--r--node_modules/postcss/lib/comment.d.ts19
-rw-r--r--node_modules/postcss/lib/container.d.ts16
-rw-r--r--node_modules/postcss/lib/container.js14
-rw-r--r--node_modules/postcss/lib/css-syntax-error.d.ts2
-rw-r--r--node_modules/postcss/lib/declaration.d.ts37
-rw-r--r--node_modules/postcss/lib/document.d.ts6
-rw-r--r--node_modules/postcss/lib/input.d.ts3
-rw-r--r--node_modules/postcss/lib/list.d.ts1
-rw-r--r--node_modules/postcss/lib/map-generator.js2
-rw-r--r--node_modules/postcss/lib/node.d.ts10
-rw-r--r--node_modules/postcss/lib/postcss.d.mts5
-rw-r--r--node_modules/postcss/lib/postcss.d.ts19
-rw-r--r--node_modules/postcss/lib/previous-map.js12
-rw-r--r--node_modules/postcss/lib/processor.js2
-rw-r--r--node_modules/postcss/lib/result.d.ts1
-rw-r--r--node_modules/postcss/lib/root.d.ts6
-rw-r--r--node_modules/postcss/lib/rule.d.ts43
18 files changed, 137 insertions, 108 deletions
diff --git a/node_modules/postcss/lib/at-rule.d.ts b/node_modules/postcss/lib/at-rule.d.ts
index 5bdee38b..b2a0e0f4 100644
--- a/node_modules/postcss/lib/at-rule.d.ts
+++ b/node_modules/postcss/lib/at-rule.d.ts
@@ -80,16 +80,6 @@ declare namespace AtRule {
*/
declare class AtRule_ extends Container {
/**
- * The at-rule’s name immediately follows the `@`.
- *
- * ```js
- * const root = postcss.parse('@media print {}')
- * const media = root.first
- * media.name //=> 'media'
- * ```
- */
- name: string
- /**
* An array containing the layer’s children.
*
* ```js
@@ -108,6 +98,29 @@ declare class AtRule_ extends Container {
* ```
*/
nodes: Container['nodes']
+ parent: ContainerWithChildren | undefined
+
+ raws: AtRule.AtRuleRaws
+ type: 'atrule'
+ constructor(defaults?: AtRule.AtRuleProps)
+ assign(overrides: AtRule.AtRuleProps | object): this
+
+ clone(overrides?: Partial<AtRule.AtRuleProps>): this
+
+ cloneAfter(overrides?: Partial<AtRule.AtRuleProps>): this
+
+ cloneBefore(overrides?: Partial<AtRule.AtRuleProps>): this
+ /**
+ * The at-rule’s name immediately follows the `@`.
+ *
+ * ```js
+ * const root = postcss.parse('@media print {}')
+ * const media = root.first
+ * media.name //=> 'media'
+ * ```
+ */
+ get name(): string
+ set name(value: string)
/**
* The at-rule’s parameters, the values that follow the at-rule’s name
* but precede any `{}` block.
@@ -118,18 +131,8 @@ declare class AtRule_ extends Container {
* media.params //=> 'print, screen'
* ```
*/
- params: string
- parent: ContainerWithChildren | undefined
-
- raws: AtRule.AtRuleRaws
-
- type: 'atrule'
-
- constructor(defaults?: AtRule.AtRuleProps)
- assign(overrides: AtRule.AtRuleProps | object): this
- clone(overrides?: Partial<AtRule.AtRuleProps>): AtRule
- cloneAfter(overrides?: Partial<AtRule.AtRuleProps>): AtRule
- cloneBefore(overrides?: Partial<AtRule.AtRuleProps>): AtRule
+ get params(): string
+ set params(value: string)
}
declare class AtRule extends AtRule_ {}
diff --git a/node_modules/postcss/lib/comment.d.ts b/node_modules/postcss/lib/comment.d.ts
index d2445088..2b1a156d 100644
--- a/node_modules/postcss/lib/comment.d.ts
+++ b/node_modules/postcss/lib/comment.d.ts
@@ -48,18 +48,19 @@ declare namespace Comment {
declare class Comment_ extends Node {
parent: Container | undefined
raws: Comment.CommentRaws
- /**
- * The comment's text.
- */
- text: string
-
type: 'comment'
-
constructor(defaults?: Comment.CommentProps)
+
assign(overrides: Comment.CommentProps | object): this
- clone(overrides?: Partial<Comment.CommentProps>): Comment
- cloneAfter(overrides?: Partial<Comment.CommentProps>): Comment
- cloneBefore(overrides?: Partial<Comment.CommentProps>): Comment
+
+ clone(overrides?: Partial<Comment.CommentProps>): this
+ cloneAfter(overrides?: Partial<Comment.CommentProps>): this
+ cloneBefore(overrides?: Partial<Comment.CommentProps>): this
+ /**
+ * The comment's text.
+ */
+ get text(): string
+ set text(value: string)
}
declare class Comment extends Comment_ {}
diff --git a/node_modules/postcss/lib/container.d.ts b/node_modules/postcss/lib/container.d.ts
index d16b85d0..dfe55f20 100644
--- a/node_modules/postcss/lib/container.d.ts
+++ b/node_modules/postcss/lib/container.d.ts
@@ -24,7 +24,7 @@ declare namespace Container {
}
export interface ContainerProps extends NodeProps {
- nodes?: (ChildNode | ChildProps)[]
+ nodes?: (Node | ChildProps)[]
}
// eslint-disable-next-line @typescript-eslint/no-use-before-define
@@ -84,9 +84,9 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
): this
assign(overrides: Container.ContainerProps | object): this
- clone(overrides?: Partial<Container.ContainerProps>): Container<Child>
- cloneAfter(overrides?: Partial<Container.ContainerProps>): Container<Child>
- cloneBefore(overrides?: Partial<Container.ContainerProps>): Container<Child>
+ clone(overrides?: Partial<Container.ContainerProps>): this
+ cloneAfter(overrides?: Partial<Container.ContainerProps>): this
+ cloneBefore(overrides?: Partial<Container.ContainerProps>): this
/**
* Iterates through the container’s immediate children,
@@ -161,8 +161,8 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
insertAfter(
oldNode: Child | number,
newNode:
- | Child
- | Child[]
+ | Node
+ | Node[]
| ChildProps
| ChildProps[]
| string
@@ -183,8 +183,8 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
insertBefore(
oldNode: Child | number,
newNode:
- | Child
- | Child[]
+ | Node
+ | Node[]
| ChildProps
| ChildProps[]
| string
diff --git a/node_modules/postcss/lib/container.js b/node_modules/postcss/lib/container.js
index 462e3f0d..8a182071 100644
--- a/node_modules/postcss/lib/container.js
+++ b/node_modules/postcss/lib/container.js
@@ -15,11 +15,11 @@ function cleanSource(nodes) {
})
}
-function markDirtyUp(node) {
+function markTreeDirty(node) {
node[isClean] = false
if (node.proxyOf.nodes) {
for (let i of node.proxyOf.nodes) {
- markDirtyUp(i)
+ markTreeDirty(i)
}
}
}
@@ -153,7 +153,11 @@ class Container extends Node {
insertBefore(exist, add) {
let existIndex = this.index(exist)
let type = existIndex === 0 ? 'prepend' : false
- let nodes = this.normalize(add, this.proxyOf.nodes[existIndex], type).reverse()
+ let nodes = this.normalize(
+ add,
+ this.proxyOf.nodes[existIndex],
+ type
+ ).reverse()
existIndex = this.index(exist)
for (let node of nodes) this.proxyOf.nodes.splice(existIndex, 0, node)
@@ -194,7 +198,7 @@ class Container extends Node {
nodes.value = String(nodes.value)
}
nodes = [new Declaration(nodes)]
- } else if (nodes.selector) {
+ } else if (nodes.selector || nodes.selectors) {
nodes = [new Rule(nodes)]
} else if (nodes.name) {
nodes = [new AtRule(nodes)]
@@ -209,7 +213,7 @@ class Container extends Node {
if (!i[my]) Container.rebuild(i)
i = i.proxyOf
if (i.parent) i.parent.removeChild(i)
- if (i[isClean]) markDirtyUp(i)
+ if (i[isClean]) markTreeDirty(i)
if (typeof i.raws.before === 'undefined') {
if (sample && typeof sample.raws.before !== 'undefined') {
i.raws.before = sample.raws.before.replace(/\S/g, '')
diff --git a/node_modules/postcss/lib/css-syntax-error.d.ts b/node_modules/postcss/lib/css-syntax-error.d.ts
index d2d11bf9..e540d849 100644
--- a/node_modules/postcss/lib/css-syntax-error.d.ts
+++ b/node_modules/postcss/lib/css-syntax-error.d.ts
@@ -49,7 +49,7 @@ declare namespace CssSyntaxError {
* }
* ```
*/
-declare class CssSyntaxError_ {
+declare class CssSyntaxError_ extends Error {
/**
* Source column of the error.
*
diff --git a/node_modules/postcss/lib/declaration.d.ts b/node_modules/postcss/lib/declaration.d.ts
index a5db984a..e707ad67 100644
--- a/node_modules/postcss/lib/declaration.d.ts
+++ b/node_modules/postcss/lib/declaration.d.ts
@@ -63,6 +63,19 @@ declare namespace Declaration {
* ```
*/
declare class Declaration_ extends Node {
+ parent: ContainerWithChildren | undefined
+ raws: Declaration.DeclarationRaws
+
+ type: 'decl'
+
+ constructor(defaults?: Declaration.DeclarationProps)
+ assign(overrides: Declaration.DeclarationProps | object): this
+
+ clone(overrides?: Partial<Declaration.DeclarationProps>): this
+
+ cloneAfter(overrides?: Partial<Declaration.DeclarationProps>): this
+
+ cloneBefore(overrides?: Partial<Declaration.DeclarationProps>): this
/**
* It represents a specificity of the declaration.
*
@@ -77,10 +90,9 @@ declare class Declaration_ extends Node {
* root.first.last.important //=> undefined
* ```
*/
- important: boolean
-
- parent: ContainerWithChildren | undefined
+ get important(): boolean
+ set important(value: boolean)
/**
* The property name for a CSS declaration.
*
@@ -91,12 +103,9 @@ declare class Declaration_ extends Node {
* decl.prop //=> 'color'
* ```
*/
- prop: string
-
- raws: Declaration.DeclarationRaws
-
- type: 'decl'
+ get prop(): string
+ set prop(value: string)
/**
* The property value for a CSS declaration.
*
@@ -114,8 +123,8 @@ declare class Declaration_ extends Node {
* decl.value //=> 'black'
* ```
*/
- value: string
-
+ get value(): string
+ set value(value: string)
/**
* It represents a getter that returns `true` if a declaration starts with
* `--` or `$`, which are used to declare variables in CSS and SASS/SCSS.
@@ -134,13 +143,7 @@ declare class Declaration_ extends Node {
* one.variable //=> true
* ```
*/
- variable: boolean
-
- constructor(defaults?: Declaration.DeclarationProps)
- assign(overrides: Declaration.DeclarationProps | object): this
- clone(overrides?: Partial<Declaration.DeclarationProps>): Declaration
- cloneAfter(overrides?: Partial<Declaration.DeclarationProps>): Declaration
- cloneBefore(overrides?: Partial<Declaration.DeclarationProps>): Declaration
+ get variable(): boolean
}
declare class Declaration extends Declaration_ {}
diff --git a/node_modules/postcss/lib/document.d.ts b/node_modules/postcss/lib/document.d.ts
index a368f166..79f948af 100644
--- a/node_modules/postcss/lib/document.d.ts
+++ b/node_modules/postcss/lib/document.d.ts
@@ -42,9 +42,9 @@ declare class Document_ extends Container<Root> {
constructor(defaults?: Document.DocumentProps)
assign(overrides: Document.DocumentProps | object): this
- clone(overrides?: Partial<Document.DocumentProps>): Document
- cloneAfter(overrides?: Partial<Document.DocumentProps>): Document
- cloneBefore(overrides?: Partial<Document.DocumentProps>): Document
+ clone(overrides?: Partial<Document.DocumentProps>): this
+ cloneAfter(overrides?: Partial<Document.DocumentProps>): this
+ cloneBefore(overrides?: Partial<Document.DocumentProps>): this
/**
* Returns a `Result` instance representing the document’s CSS roots.
diff --git a/node_modules/postcss/lib/input.d.ts b/node_modules/postcss/lib/input.d.ts
index c718bd1d..ce8e463a 100644
--- a/node_modules/postcss/lib/input.d.ts
+++ b/node_modules/postcss/lib/input.d.ts
@@ -187,6 +187,9 @@ declare class Input_ {
* ```
*/
get from(): string
+
+ /** Converts this to a JSON-friendly object representation. */
+ toJSON(): object
}
declare class Input extends Input_ {}
diff --git a/node_modules/postcss/lib/list.d.ts b/node_modules/postcss/lib/list.d.ts
index 1a74d74c..d77e181b 100644
--- a/node_modules/postcss/lib/list.d.ts
+++ b/node_modules/postcss/lib/list.d.ts
@@ -51,7 +51,6 @@ declare namespace list {
}
}
-// eslint-disable-next-line @typescript-eslint/no-redeclare
declare const list: list.List
export = list
diff --git a/node_modules/postcss/lib/map-generator.js b/node_modules/postcss/lib/map-generator.js
index 71b21caa..fd93b060 100644
--- a/node_modules/postcss/lib/map-generator.js
+++ b/node_modules/postcss/lib/map-generator.js
@@ -75,7 +75,7 @@ class MapGenerator {
}
}
} else if (this.css) {
- this.css = this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm, '')
+ this.css = this.css.replace(/\n*\/\*#[\S\s]*?\*\/$/gm, '')
}
}
diff --git a/node_modules/postcss/lib/node.d.ts b/node_modules/postcss/lib/node.d.ts
index 59716564..8cc3cdbe 100644
--- a/node_modules/postcss/lib/node.d.ts
+++ b/node_modules/postcss/lib/node.d.ts
@@ -303,7 +303,7 @@ declare abstract class Node_ {
*
* @return Duplicate of the node instance.
*/
- clone(overrides?: object): Node
+ clone(overrides?: object): this
/**
* Shortcut to clone the node and insert the resulting cloned node
@@ -312,7 +312,7 @@ declare abstract class Node_ {
* @param overrides New properties to override in the clone.
* @return New node.
*/
- cloneAfter(overrides?: object): Node
+ cloneAfter(overrides?: object): this
/**
* Shortcut to clone the node and insert the resulting cloned node
@@ -326,7 +326,7 @@ declare abstract class Node_ {
*
* @return New node
*/
- cloneBefore(overrides?: object): Node
+ cloneBefore(overrides?: object): this
/**
* It creates an instance of the class `CssSyntaxError` and parameters passed
@@ -472,8 +472,8 @@ declare abstract class Node_ {
*/
replaceWith(
...nodes: (
- | Node.ChildNode
- | Node.ChildNode[]
+ | Node
+ | Node[]
| Node.ChildProps
| Node.ChildProps[]
)[]
diff --git a/node_modules/postcss/lib/postcss.d.mts b/node_modules/postcss/lib/postcss.d.mts
index a8ca8c7a..4cf5b492 100644
--- a/node_modules/postcss/lib/postcss.d.mts
+++ b/node_modules/postcss/lib/postcss.d.mts
@@ -9,14 +9,12 @@ export {
plugin,
parse,
list,
-
document,
comment,
atRule,
rule,
decl,
root,
-
CssSyntaxError,
Declaration,
Container,
@@ -67,6 +65,5 @@ export {
WarningOptions,
// This is a class, but it’s not re-exported. That’s why it’s exported as type-only here.
- type LazyResult,
-
+ type LazyResult
} from './postcss.js'
diff --git a/node_modules/postcss/lib/postcss.d.ts b/node_modules/postcss/lib/postcss.d.ts
index 49af61c3..603fdfdb 100644
--- a/node_modules/postcss/lib/postcss.d.ts
+++ b/node_modules/postcss/lib/postcss.d.ts
@@ -28,13 +28,22 @@ type DocumentProcessor = (
document: Document,
helper: postcss.Helpers
) => Promise<void> | void
-type RootProcessor = (root: Root, helper: postcss.Helpers) => Promise<void> | void
+type RootProcessor = (
+ root: Root,
+ helper: postcss.Helpers
+) => Promise<void> | void
type DeclarationProcessor = (
decl: Declaration,
helper: postcss.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 RuleProcessor = (
+ rule: Rule,
+ helper: postcss.Helpers
+) => Promise<void> | void
+type AtRuleProcessor = (
+ atRule: AtRule,
+ helper: postcss.Helpers
+) => Promise<void> | void
type CommentProcessor = (
comment: Comment,
helper: postcss.Helpers
@@ -176,9 +185,9 @@ declare namespace postcss {
WarningOptions
}
- export type SourceMap = SourceMapGenerator & {
+ export type SourceMap = {
toJSON(): RawSourceMap
- }
+ } & SourceMapGenerator
export type Helpers = { postcss: Postcss; result: Result } & Postcss
diff --git a/node_modules/postcss/lib/previous-map.js b/node_modules/postcss/lib/previous-map.js
index f3093dfb..8eba9ad7 100644
--- a/node_modules/postcss/lib/previous-map.js
+++ b/node_modules/postcss/lib/previous-map.js
@@ -41,12 +41,14 @@ class PreviousMap {
let charsetUri = /^data:application\/json;charset=utf-?8,/
let uri = /^data:application\/json,/
- if (charsetUri.test(text) || uri.test(text)) {
- return decodeURIComponent(text.substr(RegExp.lastMatch.length))
+ let uriMatch = text.match(charsetUri) || text.match(uri)
+ if (uriMatch) {
+ return decodeURIComponent(text.substr(uriMatch[0].length))
}
- if (baseCharsetUri.test(text) || baseUri.test(text)) {
- return fromBase64(text.substr(RegExp.lastMatch.length))
+ let baseUriMatch = text.match(baseCharsetUri) || text.match(baseUri)
+ if (baseUriMatch) {
+ return fromBase64(text.substr(baseUriMatch[0].length))
}
let encoding = text.match(/data:application\/json;([^,]+),/)[1]
@@ -67,7 +69,7 @@ class PreviousMap {
}
loadAnnotation(css) {
- let comments = css.match(/\/\*\s*# sourceMappingURL=/gm)
+ let comments = css.match(/\/\*\s*# sourceMappingURL=/g)
if (!comments) return
// sourceMappingURLs from comments, strings, etc.
diff --git a/node_modules/postcss/lib/processor.js b/node_modules/postcss/lib/processor.js
index d8a16f45..08a40955 100644
--- a/node_modules/postcss/lib/processor.js
+++ b/node_modules/postcss/lib/processor.js
@@ -7,7 +7,7 @@ let Root = require('./root')
class Processor {
constructor(plugins = []) {
- this.version = '8.4.38'
+ this.version = '8.4.41'
this.plugins = this.normalize(plugins)
}
diff --git a/node_modules/postcss/lib/result.d.ts b/node_modules/postcss/lib/result.d.ts
index c3dcbdab..40e086f7 100644
--- a/node_modules/postcss/lib/result.d.ts
+++ b/node_modules/postcss/lib/result.d.ts
@@ -39,7 +39,6 @@ declare namespace Result {
plugin?: string
}
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
export { Result_ as default }
}
diff --git a/node_modules/postcss/lib/root.d.ts b/node_modules/postcss/lib/root.d.ts
index 9046aacd..248b7042 100644
--- a/node_modules/postcss/lib/root.d.ts
+++ b/node_modules/postcss/lib/root.d.ts
@@ -62,9 +62,9 @@ declare class Root_ extends Container {
constructor(defaults?: Root.RootProps)
assign(overrides: object | Root.RootProps): this
- clone(overrides?: Partial<Root.RootProps>): Root
- cloneAfter(overrides?: Partial<Root.RootProps>): Root
- cloneBefore(overrides?: Partial<Root.RootProps>): Root
+ clone(overrides?: Partial<Root.RootProps>): this
+ cloneAfter(overrides?: Partial<Root.RootProps>): this
+ cloneBefore(overrides?: Partial<Root.RootProps>): this
/**
* Returns a `Result` instance representing the root’s CSS.
diff --git a/node_modules/postcss/lib/rule.d.ts b/node_modules/postcss/lib/rule.d.ts
index fc5dd721..5e873b4f 100644
--- a/node_modules/postcss/lib/rule.d.ts
+++ b/node_modules/postcss/lib/rule.d.ts
@@ -40,14 +40,21 @@ declare namespace Rule {
semicolon?: boolean
}
- export interface RuleProps extends ContainerProps {
+ export type RuleProps = ContainerProps & {
/** Information used to generate byte-to-byte equal node string as it was in the origin input. */
raws?: RuleRaws
- /** Selector or selectors of the rule. */
- selector?: string
- /** Selectors of the rule represented as an array of strings. */
- selectors?: string[]
- }
+ } & (
+ | {
+ /** Selector or selectors of the rule. */
+ selector: string
+ selectors?: never
+ }
+ | {
+ /** Selectors of the rule represented as an array of strings. */
+ selectors: string[]
+ selector?: never
+ }
+ )
// eslint-disable-next-line @typescript-eslint/no-use-before-define
export { Rule_ as default }
@@ -75,6 +82,15 @@ declare class Rule_ extends Container {
nodes: NonNullable<Container['nodes']>
parent: ContainerWithChildren | undefined
raws: Rule.RuleRaws
+ type: 'rule'
+ constructor(defaults?: Rule.RuleProps)
+
+ assign(overrides: object | Rule.RuleProps): this
+ clone(overrides?: Partial<Rule.RuleProps>): this
+
+ cloneAfter(overrides?: Partial<Rule.RuleProps>): this
+
+ cloneBefore(overrides?: Partial<Rule.RuleProps>): this
/**
* The rule’s full selector represented as a string.
*
@@ -84,8 +100,8 @@ declare class Rule_ extends Container {
* rule.selector //=> 'a, b'
* ```
*/
- selector: string
-
+ get selector(): string
+ set selector(value: string)
/**
* An array containing the rule’s individual selectors.
* Groups of selectors are split at commas.
@@ -101,15 +117,8 @@ declare class Rule_ extends Container {
* rule.selector //=> 'a, strong'
* ```
*/
- selectors: string[]
-
- type: 'rule'
-
- constructor(defaults?: Rule.RuleProps)
- assign(overrides: object | Rule.RuleProps): this
- clone(overrides?: Partial<Rule.RuleProps>): Rule
- cloneAfter(overrides?: Partial<Rule.RuleProps>): Rule
- cloneBefore(overrides?: Partial<Rule.RuleProps>): Rule
+ get selectors(): string[]
+ set selectors(values: string[])
}
declare class Rule extends Rule_ {}