@omnitron-dev/lumen 0.4.11 → 0.4.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/README.md +6 -0
  2. package/dist/config/define.d.ts.map +1 -1
  3. package/dist/config/define.js +1 -0
  4. package/dist/config/define.js.map +1 -1
  5. package/dist/config/schema.d.ts +2 -0
  6. package/dist/config/schema.d.ts.map +1 -1
  7. package/dist/config/schema.js +1 -0
  8. package/dist/config/schema.js.map +1 -1
  9. package/dist/corpus/routes.d.ts +1 -0
  10. package/dist/corpus/routes.d.ts.map +1 -1
  11. package/dist/corpus/routes.js +3 -0
  12. package/dist/corpus/routes.js.map +1 -1
  13. package/dist/search/index-builder.d.ts.map +1 -1
  14. package/dist/search/index-builder.js +8 -6
  15. package/dist/search/index-builder.js.map +1 -1
  16. package/dist/ssg/default-client.js +6 -2
  17. package/dist/ssg/default-client.js.map +1 -1
  18. package/dist/ssg/ssg-engine.d.ts.map +1 -1
  19. package/dist/ssg/ssg-engine.js +32 -16
  20. package/dist/ssg/ssg-engine.js.map +1 -1
  21. package/node_modules/fdir/LICENSE +7 -0
  22. package/node_modules/fdir/README.md +91 -0
  23. package/node_modules/fdir/dist/index.cjs +588 -0
  24. package/node_modules/fdir/dist/index.d.cts +155 -0
  25. package/node_modules/fdir/dist/index.d.mts +155 -0
  26. package/node_modules/fdir/dist/index.mjs +570 -0
  27. package/node_modules/fdir/package.json +103 -0
  28. package/node_modules/nanoid/LICENSE +20 -0
  29. package/node_modules/nanoid/README.md +39 -0
  30. package/node_modules/nanoid/async/index.browser.cjs +43 -0
  31. package/node_modules/nanoid/async/index.browser.js +43 -0
  32. package/node_modules/nanoid/async/index.cjs +47 -0
  33. package/node_modules/nanoid/async/index.d.cts +56 -0
  34. package/node_modules/nanoid/async/index.d.ts +56 -0
  35. package/node_modules/nanoid/async/index.js +47 -0
  36. package/node_modules/nanoid/async/index.native.js +38 -0
  37. package/node_modules/nanoid/async/package.json +12 -0
  38. package/node_modules/nanoid/bin/nanoid.cjs +55 -0
  39. package/node_modules/nanoid/index.browser.cjs +45 -0
  40. package/node_modules/nanoid/index.browser.js +45 -0
  41. package/node_modules/nanoid/index.cjs +63 -0
  42. package/node_modules/nanoid/index.d.cts +91 -0
  43. package/node_modules/nanoid/index.d.ts +91 -0
  44. package/node_modules/nanoid/index.js +63 -0
  45. package/node_modules/nanoid/nanoid.js +1 -0
  46. package/node_modules/nanoid/non-secure/index.cjs +24 -0
  47. package/node_modules/nanoid/non-secure/index.d.ts +33 -0
  48. package/node_modules/nanoid/non-secure/index.js +24 -0
  49. package/node_modules/nanoid/non-secure/package.json +6 -0
  50. package/node_modules/nanoid/package.json +89 -0
  51. package/node_modules/nanoid/url-alphabet/index.cjs +4 -0
  52. package/node_modules/nanoid/url-alphabet/index.js +4 -0
  53. package/node_modules/nanoid/url-alphabet/package.json +6 -0
  54. package/node_modules/picocolors/LICENSE +15 -0
  55. package/node_modules/picocolors/README.md +21 -0
  56. package/node_modules/picocolors/package.json +25 -0
  57. package/node_modules/picocolors/picocolors.browser.js +4 -0
  58. package/node_modules/picocolors/picocolors.d.ts +5 -0
  59. package/node_modules/picocolors/picocolors.js +75 -0
  60. package/node_modules/picocolors/types.d.ts +51 -0
  61. package/node_modules/picomatch/LICENSE +21 -0
  62. package/node_modules/picomatch/README.md +743 -0
  63. package/node_modules/picomatch/index.js +17 -0
  64. package/node_modules/picomatch/lib/constants.js +184 -0
  65. package/node_modules/picomatch/lib/parse.js +1439 -0
  66. package/node_modules/picomatch/lib/picomatch.js +361 -0
  67. package/node_modules/picomatch/lib/scan.js +403 -0
  68. package/node_modules/picomatch/lib/utils.js +72 -0
  69. package/node_modules/picomatch/package.json +83 -0
  70. package/node_modules/picomatch/posix.js +3 -0
  71. package/node_modules/postcss/LICENSE +20 -0
  72. package/node_modules/postcss/README.md +27 -0
  73. package/node_modules/postcss/lib/at-rule.d.ts +139 -0
  74. package/node_modules/postcss/lib/at-rule.js +25 -0
  75. package/node_modules/postcss/lib/comment.d.ts +67 -0
  76. package/node_modules/postcss/lib/comment.js +13 -0
  77. package/node_modules/postcss/lib/container.d.ts +474 -0
  78. package/node_modules/postcss/lib/container.js +494 -0
  79. package/node_modules/postcss/lib/css-syntax-error.d.ts +247 -0
  80. package/node_modules/postcss/lib/css-syntax-error.js +133 -0
  81. package/node_modules/postcss/lib/declaration.d.ts +150 -0
  82. package/node_modules/postcss/lib/declaration.js +24 -0
  83. package/node_modules/postcss/lib/document.d.ts +68 -0
  84. package/node_modules/postcss/lib/document.js +33 -0
  85. package/node_modules/postcss/lib/fromJSON.d.ts +9 -0
  86. package/node_modules/postcss/lib/fromJSON.js +107 -0
  87. package/node_modules/postcss/lib/input.d.ts +226 -0
  88. package/node_modules/postcss/lib/input.js +282 -0
  89. package/node_modules/postcss/lib/lazy-result.d.ts +189 -0
  90. package/node_modules/postcss/lib/lazy-result.js +626 -0
  91. package/node_modules/postcss/lib/list.d.ts +60 -0
  92. package/node_modules/postcss/lib/list.js +79 -0
  93. package/node_modules/postcss/lib/map-generator.js +383 -0
  94. package/node_modules/postcss/lib/no-work-result.d.ts +45 -0
  95. package/node_modules/postcss/lib/no-work-result.js +137 -0
  96. package/node_modules/postcss/lib/node.d.ts +555 -0
  97. package/node_modules/postcss/lib/node.js +494 -0
  98. package/node_modules/postcss/lib/parse.d.ts +9 -0
  99. package/node_modules/postcss/lib/parse.js +42 -0
  100. package/node_modules/postcss/lib/parser.js +626 -0
  101. package/node_modules/postcss/lib/postcss.d.mts +66 -0
  102. package/node_modules/postcss/lib/postcss.d.ts +464 -0
  103. package/node_modules/postcss/lib/postcss.js +101 -0
  104. package/node_modules/postcss/lib/postcss.mjs +30 -0
  105. package/node_modules/postcss/lib/previous-map.d.ts +80 -0
  106. package/node_modules/postcss/lib/previous-map.js +176 -0
  107. package/node_modules/postcss/lib/processor.d.ts +114 -0
  108. package/node_modules/postcss/lib/processor.js +67 -0
  109. package/node_modules/postcss/lib/result.d.ts +204 -0
  110. package/node_modules/postcss/lib/result.js +42 -0
  111. package/node_modules/postcss/lib/root.d.ts +86 -0
  112. package/node_modules/postcss/lib/root.js +76 -0
  113. package/node_modules/postcss/lib/rule.d.ts +126 -0
  114. package/node_modules/postcss/lib/rule.js +27 -0
  115. package/node_modules/postcss/lib/stringifier.d.ts +45 -0
  116. package/node_modules/postcss/lib/stringifier.js +457 -0
  117. package/node_modules/postcss/lib/stringify.d.ts +9 -0
  118. package/node_modules/postcss/lib/stringify.js +93 -0
  119. package/node_modules/postcss/lib/symbols.js +5 -0
  120. package/node_modules/postcss/lib/terminal-highlight.js +70 -0
  121. package/node_modules/postcss/lib/tokenize.js +270 -0
  122. package/node_modules/postcss/lib/warn-once.js +13 -0
  123. package/node_modules/postcss/lib/warning.d.ts +146 -0
  124. package/node_modules/postcss/lib/warning.js +48 -0
  125. package/node_modules/postcss/package.json +88 -0
  126. package/node_modules/source-map-js/LICENSE +28 -0
  127. package/node_modules/source-map-js/README.md +765 -0
  128. package/node_modules/source-map-js/lib/array-set.js +121 -0
  129. package/node_modules/source-map-js/lib/base64-vlq.js +140 -0
  130. package/node_modules/source-map-js/lib/base64.js +67 -0
  131. package/node_modules/source-map-js/lib/binary-search.js +111 -0
  132. package/node_modules/source-map-js/lib/mapping-list.js +79 -0
  133. package/node_modules/source-map-js/lib/quick-sort.js +141 -0
  134. package/node_modules/source-map-js/lib/source-map-consumer.d.ts +1 -0
  135. package/node_modules/source-map-js/lib/source-map-consumer.js +1236 -0
  136. package/node_modules/source-map-js/lib/source-map-generator.d.ts +1 -0
  137. package/node_modules/source-map-js/lib/source-map-generator.js +446 -0
  138. package/node_modules/source-map-js/lib/source-node.d.ts +1 -0
  139. package/node_modules/source-map-js/lib/source-node.js +420 -0
  140. package/node_modules/source-map-js/lib/util.js +594 -0
  141. package/node_modules/source-map-js/package.json +71 -0
  142. package/node_modules/source-map-js/source-map.d.ts +104 -0
  143. package/node_modules/source-map-js/source-map.js +8 -0
  144. package/{LICENSE → node_modules/tinyglobby/LICENSE} +1 -1
  145. package/node_modules/tinyglobby/README.md +25 -0
  146. package/node_modules/tinyglobby/dist/index.cjs +335 -0
  147. package/node_modules/tinyglobby/dist/index.d.cts +148 -0
  148. package/node_modules/tinyglobby/dist/index.d.mts +148 -0
  149. package/node_modules/tinyglobby/dist/index.mjs +307 -0
  150. package/node_modules/tinyglobby/package.json +70 -0
  151. package/node_modules/vite/LICENSE.md +2084 -0
  152. package/node_modules/vite/README.md +20 -0
  153. package/node_modules/vite/bin/openChrome.js +68 -0
  154. package/node_modules/vite/bin/vite.js +90 -0
  155. package/node_modules/vite/client.d.ts +285 -0
  156. package/node_modules/vite/dist/client/bundledDevClient.mjs +1642 -0
  157. package/node_modules/vite/dist/client/client.mjs +1331 -0
  158. package/node_modules/vite/dist/client/env.mjs +18 -0
  159. package/node_modules/vite/dist/node/chunks/build.js +5833 -0
  160. package/node_modules/vite/dist/node/chunks/dist.js +7029 -0
  161. package/node_modules/vite/dist/node/chunks/lib.js +371 -0
  162. package/node_modules/vite/dist/node/chunks/moduleRunnerTransport.d.ts +95 -0
  163. package/node_modules/vite/dist/node/chunks/node.js +38364 -0
  164. package/node_modules/vite/dist/node/chunks/postcss-import.js +465 -0
  165. package/node_modules/vite/dist/node/cli.js +849 -0
  166. package/node_modules/vite/dist/node/index.d.ts +4064 -0
  167. package/node_modules/vite/dist/node/index.js +1 -0
  168. package/node_modules/vite/dist/node/internal.d.ts +2 -0
  169. package/node_modules/vite/dist/node/internal.js +1 -0
  170. package/node_modules/vite/dist/node/module-runner.d.ts +314 -0
  171. package/node_modules/vite/dist/node/module-runner.js +1296 -0
  172. package/node_modules/vite/misc/false.js +1 -0
  173. package/node_modules/vite/misc/true.js +1 -0
  174. package/node_modules/vite/package.json +195 -0
  175. package/node_modules/vite/types/customEvent.d.ts +83 -0
  176. package/node_modules/vite/types/hmrPayload.d.ts +96 -0
  177. package/node_modules/vite/types/hot.d.ts +39 -0
  178. package/node_modules/vite/types/import-meta.d.ts +5 -0
  179. package/node_modules/vite/types/importGlob.d.ts +131 -0
  180. package/node_modules/vite/types/importMeta.d.ts +30 -0
  181. package/node_modules/vite/types/internal/cssPreprocessorOptions.d.ts +44 -0
  182. package/node_modules/vite/types/internal/devtoolsOptions.d.ts +9 -0
  183. package/node_modules/vite/types/internal/esbuildOptions.d.ts +28 -0
  184. package/node_modules/vite/types/internal/lightningcssOptions.d.ts +18 -0
  185. package/node_modules/vite/types/internal/rollupTypeCompat.d.ts +24 -0
  186. package/node_modules/vite/types/internal/terserOptions.d.ts +11 -0
  187. package/node_modules/vite/types/metadata.d.ts +47 -0
  188. package/package.json +15 -7
@@ -0,0 +1,139 @@
1
+ import Container, {
2
+ ContainerProps,
3
+ ContainerWithChildren
4
+ } from './container.js'
5
+
6
+ declare namespace AtRule {
7
+ export interface AtRuleRaws extends Record<string, unknown> {
8
+ /**
9
+ * The space symbols after the last child of the node to the end of the node.
10
+ */
11
+ after?: string
12
+
13
+ /**
14
+ * The space between the at-rule name and its parameters.
15
+ */
16
+ afterName?: string
17
+
18
+ /**
19
+ * The space symbols before the node. It also stores `*`
20
+ * and `_` symbols before the declaration (IE hack).
21
+ */
22
+ before?: string
23
+
24
+ /**
25
+ * The symbols between the last parameter and `{` for rules.
26
+ */
27
+ between?: string
28
+
29
+ /**
30
+ * The rule’s selector with comments.
31
+ */
32
+ params?: {
33
+ raw: string
34
+ value: string
35
+ }
36
+
37
+ /**
38
+ * Contains `true` if the last child has an (optional) semicolon.
39
+ */
40
+ semicolon?: boolean
41
+ }
42
+
43
+ export interface AtRuleProps extends ContainerProps {
44
+ /** Name of the at-rule. */
45
+ name: string
46
+ /** Parameters following the name of the at-rule. */
47
+ params?: number | string
48
+ /** Information used to generate byte-to-byte equal node string as it was in the origin input. */
49
+ raws?: AtRuleRaws
50
+ }
51
+
52
+ export { AtRule_ as default }
53
+ }
54
+
55
+ /**
56
+ * Represents an at-rule.
57
+ *
58
+ * ```js
59
+ * Once (root, { AtRule }) {
60
+ * let media = new AtRule({ name: 'media', params: 'print' })
61
+ * media.append(…)
62
+ * root.append(media)
63
+ * }
64
+ * ```
65
+ *
66
+ * If it’s followed in the CSS by a `{}` block, this node will have
67
+ * a nodes property representing its children.
68
+ *
69
+ * ```js
70
+ * const root = postcss.parse('@charset "UTF-8"; @media print {}')
71
+ *
72
+ * const charset = root.first
73
+ * charset.type //=> 'atrule'
74
+ * charset.nodes //=> undefined
75
+ *
76
+ * const media = root.last
77
+ * media.nodes //=> []
78
+ * ```
79
+ */
80
+ declare class AtRule_ extends Container {
81
+ /**
82
+ * An array containing the layer’s children.
83
+ *
84
+ * ```js
85
+ * const root = postcss.parse('@layer example { a { color: black } }')
86
+ * const layer = root.first
87
+ * layer.nodes.length //=> 1
88
+ * layer.nodes[0].selector //=> 'a'
89
+ * ```
90
+ *
91
+ * Can be `undefinded` if the at-rule has no body.
92
+ *
93
+ * ```js
94
+ * const root = postcss.parse('@layer a, b, c;')
95
+ * const layer = root.first
96
+ * layer.nodes //=> undefined
97
+ * ```
98
+ */
99
+ nodes: Container['nodes'] | undefined
100
+ parent: ContainerWithChildren | undefined
101
+
102
+ raws: AtRule.AtRuleRaws
103
+ type: 'atrule'
104
+ /**
105
+ * The at-rule’s name immediately follows the `@`.
106
+ *
107
+ * ```js
108
+ * const root = postcss.parse('@media print {}')
109
+ * const media = root.first
110
+ * media.name //=> 'media'
111
+ * ```
112
+ */
113
+ get name(): string
114
+ set name(value: string)
115
+
116
+ /**
117
+ * The at-rule’s parameters, the values that follow the at-rule’s name
118
+ * but precede any `{}` block.
119
+ *
120
+ * ```js
121
+ * const root = postcss.parse('@media print, screen {}')
122
+ * const media = root.first
123
+ * media.params //=> 'print, screen'
124
+ * ```
125
+ */
126
+ get params(): string
127
+
128
+ set params(value: string)
129
+
130
+ constructor(defaults?: AtRule.AtRuleProps)
131
+ assign(overrides: AtRule.AtRuleProps | object): this
132
+ clone(overrides?: Partial<AtRule.AtRuleProps>): this
133
+ cloneAfter(overrides?: Partial<AtRule.AtRuleProps>): this
134
+ cloneBefore(overrides?: Partial<AtRule.AtRuleProps>): this
135
+ }
136
+
137
+ declare class AtRule extends AtRule_ {}
138
+
139
+ export = AtRule
@@ -0,0 +1,25 @@
1
+ 'use strict'
2
+
3
+ let Container = require('./container')
4
+
5
+ class AtRule extends Container {
6
+ constructor(defaults) {
7
+ super(defaults)
8
+ this.type = 'atrule'
9
+ }
10
+
11
+ append(...children) {
12
+ if (!this.proxyOf.nodes) this.nodes = []
13
+ return super.append(...children)
14
+ }
15
+
16
+ prepend(...children) {
17
+ if (!this.proxyOf.nodes) this.nodes = []
18
+ return super.prepend(...children)
19
+ }
20
+ }
21
+
22
+ module.exports = AtRule
23
+ AtRule.default = AtRule
24
+
25
+ Container.registerAtRule(AtRule)
@@ -0,0 +1,67 @@
1
+ import Container from './container.js'
2
+ import Node, { NodeProps } from './node.js'
3
+
4
+ declare namespace Comment {
5
+ export interface CommentRaws extends Record<string, unknown> {
6
+ /**
7
+ * The space symbols before the node.
8
+ */
9
+ before?: string
10
+
11
+ /**
12
+ * The space symbols between `/*` and the comment’s text.
13
+ */
14
+ left?: string
15
+
16
+ /**
17
+ * The space symbols between the comment’s text.
18
+ */
19
+ right?: string
20
+ }
21
+
22
+ export interface CommentProps extends NodeProps {
23
+ /** Information used to generate byte-to-byte equal node string as it was in the origin input. */
24
+ raws?: CommentRaws
25
+ /** Content of the comment. */
26
+ text: string
27
+ }
28
+
29
+ export { Comment_ as default }
30
+ }
31
+
32
+ /**
33
+ * It represents a class that handles
34
+ * [CSS comments](https://developer.mozilla.org/en-US/docs/Web/CSS/Comments)
35
+ *
36
+ * ```js
37
+ * Once (root, { Comment }) {
38
+ * const note = new Comment({ text: 'Note: …' })
39
+ * root.append(note)
40
+ * }
41
+ * ```
42
+ *
43
+ * Remember that CSS comments inside selectors, at-rule parameters,
44
+ * or declaration values will be stored in the `raws` properties
45
+ * explained above.
46
+ */
47
+ declare class Comment_ extends Node {
48
+ parent: Container | undefined
49
+ raws: Comment.CommentRaws
50
+ type: 'comment'
51
+ /**
52
+ * The comment's text.
53
+ */
54
+ get text(): string
55
+
56
+ set text(value: string)
57
+
58
+ constructor(defaults?: Comment.CommentProps)
59
+ assign(overrides: Comment.CommentProps | object): this
60
+ clone(overrides?: Partial<Comment.CommentProps>): this
61
+ cloneAfter(overrides?: Partial<Comment.CommentProps>): this
62
+ cloneBefore(overrides?: Partial<Comment.CommentProps>): this
63
+ }
64
+
65
+ declare class Comment extends Comment_ {}
66
+
67
+ export = Comment
@@ -0,0 +1,13 @@
1
+ 'use strict'
2
+
3
+ let Node = require('./node')
4
+
5
+ class Comment extends Node {
6
+ constructor(defaults) {
7
+ super(defaults)
8
+ this.type = 'comment'
9
+ }
10
+ }
11
+
12
+ module.exports = Comment
13
+ Comment.default = Comment
@@ -0,0 +1,474 @@
1
+ import AtRule from './at-rule.js'
2
+ import Comment from './comment.js'
3
+ import Declaration from './declaration.js'
4
+ import Node, { ChildNode, ChildProps, NodeProps } from './node.js'
5
+ import { Root } from './postcss.js'
6
+ import Rule from './rule.js'
7
+
8
+ declare namespace Container {
9
+ export type ContainerWithChildren<Child extends Node = ChildNode> = {
10
+ nodes: Child[]
11
+ } & (AtRule | Root | Rule)
12
+
13
+ export interface ValueOptions {
14
+ /**
15
+ * String that’s used to narrow down values and speed up the regexp search.
16
+ */
17
+ fast?: string
18
+
19
+ /**
20
+ * An array of property names.
21
+ */
22
+ props?: readonly string[]
23
+ }
24
+
25
+ export interface ContainerProps extends NodeProps {
26
+ nodes?: readonly (ChildProps | Node)[]
27
+ }
28
+
29
+ /**
30
+ * All types that can be passed into container methods to create or add a new
31
+ * child node.
32
+ */
33
+ export type NewChild =
34
+ | ChildProps
35
+ | Node
36
+ | readonly ChildProps[]
37
+ | readonly Node[]
38
+ | readonly string[]
39
+ | string
40
+ | undefined
41
+
42
+ export { Container_ as default }
43
+ }
44
+
45
+ /**
46
+ * The `Root`, `AtRule`, and `Rule` container nodes
47
+ * inherit some common methods to help work with their children.
48
+ *
49
+ * Note that all containers can store any content. If you write a rule inside
50
+ * a rule, PostCSS will parse it.
51
+ */
52
+ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
53
+ /**
54
+ * An array containing the container’s children.
55
+ *
56
+ * ```js
57
+ * const root = postcss.parse('a { color: black }')
58
+ * root.nodes.length //=> 1
59
+ * root.nodes[0].selector //=> 'a'
60
+ * root.nodes[0].nodes[0].prop //=> 'color'
61
+ * ```
62
+ */
63
+ nodes: Child[] | undefined
64
+
65
+ /**
66
+ * The container’s first child.
67
+ *
68
+ * ```js
69
+ * rule.first === rules.nodes[0]
70
+ * ```
71
+ */
72
+ get first(): Child | undefined
73
+
74
+ /**
75
+ * The container’s last child.
76
+ *
77
+ * ```js
78
+ * rule.last === rule.nodes[rule.nodes.length - 1]
79
+ * ```
80
+ */
81
+ get last(): Child | undefined
82
+ /**
83
+ * Inserts new nodes to the end of the container.
84
+ *
85
+ * ```js
86
+ * const decl1 = new Declaration({ prop: 'color', value: 'black' })
87
+ * const decl2 = new Declaration({ prop: 'background-color', value: 'white' })
88
+ * rule.append(decl1, decl2)
89
+ *
90
+ * root.append({ name: 'charset', params: '"UTF-8"' }) // at-rule
91
+ * root.append({ selector: 'a' }) // rule
92
+ * rule.append({ prop: 'color', value: 'black' }) // declaration
93
+ * rule.append({ text: 'Comment' }) // comment
94
+ *
95
+ * root.append('a {}')
96
+ * root.first.append('color: black; z-index: 1')
97
+ * ```
98
+ *
99
+ * @param nodes New nodes.
100
+ * @return This node for methods chain.
101
+ */
102
+ append(...nodes: Container.NewChild[]): this
103
+ assign(overrides: Container.ContainerProps | object): this
104
+ clone(overrides?: Partial<Container.ContainerProps>): this
105
+
106
+ cloneAfter(overrides?: Partial<Container.ContainerProps>): this
107
+
108
+ cloneBefore(overrides?: Partial<Container.ContainerProps>): this
109
+ /**
110
+ * Iterates through the container’s immediate children,
111
+ * calling `callback` for each child.
112
+ *
113
+ * Returning `false` in the callback will break iteration.
114
+ *
115
+ * This method only iterates through the container’s immediate children.
116
+ * If you need to recursively iterate through all the container’s descendant
117
+ * nodes, use `Container#walk`.
118
+ *
119
+ * Unlike the for `{}`-cycle or `Array#forEach` this iterator is safe
120
+ * if you are mutating the array of child nodes during iteration.
121
+ * PostCSS will adjust the current index to match the mutations.
122
+ *
123
+ * ```js
124
+ * const root = postcss.parse('a { color: black; z-index: 1 }')
125
+ * const rule = root.first
126
+ *
127
+ * for (const decl of rule.nodes) {
128
+ * decl.cloneBefore({ prop: '-webkit-' + decl.prop })
129
+ * // Cycle will be infinite, because cloneBefore moves the current node
130
+ * // to the next index
131
+ * }
132
+ *
133
+ * rule.each(decl => {
134
+ * decl.cloneBefore({ prop: '-webkit-' + decl.prop })
135
+ * // Will be executed only for color and z-index
136
+ * })
137
+ * ```
138
+ *
139
+ * @param callback Iterator receives each node and index.
140
+ * @return Returns `false` if iteration was broke.
141
+ */
142
+ each(
143
+ callback: (node: Child, index: number) => false | void
144
+ ): false | undefined
145
+
146
+ /**
147
+ * Returns `true` if callback returns `true`
148
+ * for all of the container’s children.
149
+ *
150
+ * ```js
151
+ * const noPrefixes = rule.every(i => i.prop[0] !== '-')
152
+ * ```
153
+ *
154
+ * @param condition Iterator returns true or false.
155
+ * @return Is every child pass condition.
156
+ */
157
+ every(
158
+ condition: (node: Child, index: number, nodes: Child[]) => boolean
159
+ ): boolean
160
+ /**
161
+ * Returns a `child`’s index within the `Container#nodes` array.
162
+ *
163
+ * ```js
164
+ * rule.index( rule.nodes[2] ) //=> 2
165
+ * ```
166
+ *
167
+ * @param child Child of the current container.
168
+ * @return Child index.
169
+ */
170
+ index(child: Child | number): number
171
+
172
+ /**
173
+ * Insert new node after old node within the container.
174
+ *
175
+ * @param oldNode Child or child’s index.
176
+ * @param newNode New node.
177
+ * @return This node for methods chain.
178
+ */
179
+ insertAfter(oldNode: Child | number, newNode: Container.NewChild): this
180
+
181
+ /**
182
+ * Insert new node before old node within the container.
183
+ *
184
+ * ```js
185
+ * rule.insertBefore(decl, decl.clone({ prop: '-webkit-' + decl.prop }))
186
+ * ```
187
+ *
188
+ * @param oldNode Child or child’s index.
189
+ * @param newNode New node.
190
+ * @return This node for methods chain.
191
+ */
192
+ insertBefore(oldNode: Child | number, newNode: Container.NewChild): this
193
+ /**
194
+ * Inserts new nodes to the start of the container.
195
+ *
196
+ * ```js
197
+ * const decl1 = new Declaration({ prop: 'color', value: 'black' })
198
+ * const decl2 = new Declaration({ prop: 'background-color', value: 'white' })
199
+ * rule.prepend(decl1, decl2)
200
+ *
201
+ * root.append({ name: 'charset', params: '"UTF-8"' }) // at-rule
202
+ * root.append({ selector: 'a' }) // rule
203
+ * rule.append({ prop: 'color', value: 'black' }) // declaration
204
+ * rule.append({ text: 'Comment' }) // comment
205
+ *
206
+ * root.append('a {}')
207
+ * root.first.append('color: black; z-index: 1')
208
+ * ```
209
+ *
210
+ * @param nodes New nodes.
211
+ * @return This node for methods chain.
212
+ */
213
+ prepend(...nodes: Container.NewChild[]): this
214
+
215
+ /**
216
+ * Add child to the end of the node.
217
+ *
218
+ * ```js
219
+ * rule.push(new Declaration({ prop: 'color', value: 'black' }))
220
+ * ```
221
+ *
222
+ * @param child New node.
223
+ * @return This node for methods chain.
224
+ */
225
+ push(child: Child): this
226
+
227
+ /**
228
+ * Removes all children from the container
229
+ * and cleans their parent properties.
230
+ *
231
+ * ```js
232
+ * rule.removeAll()
233
+ * rule.nodes.length //=> 0
234
+ * ```
235
+ *
236
+ * @return This node for methods chain.
237
+ */
238
+ removeAll(): this
239
+
240
+ /**
241
+ * Removes node from the container and cleans the parent properties
242
+ * from the node and its children.
243
+ *
244
+ * ```js
245
+ * rule.nodes.length //=> 5
246
+ * rule.removeChild(decl)
247
+ * rule.nodes.length //=> 4
248
+ * decl.parent //=> undefined
249
+ * ```
250
+ *
251
+ * @param child Child or child’s index.
252
+ * @return This node for methods chain.
253
+ */
254
+ removeChild(child: Child | number): this
255
+
256
+ replaceValues(
257
+ pattern: RegExp | string,
258
+ replaced: { (substring: string, ...args: any[]): string } | string
259
+ ): this
260
+ /**
261
+ * Passes all declaration values within the container that match pattern
262
+ * through callback, replacing those values with the returned result
263
+ * of callback.
264
+ *
265
+ * This method is useful if you are using a custom unit or function
266
+ * and need to iterate through all values.
267
+ *
268
+ * ```js
269
+ * root.replaceValues(/\d+rem/, { fast: 'rem' }, string => {
270
+ * return 15 * parseInt(string) + 'px'
271
+ * })
272
+ * ```
273
+ *
274
+ * @param pattern Replace pattern.
275
+ * @param {object} options Options to speed up the search.
276
+ * @param replaced String to replace pattern or callback
277
+ * that returns a new value. The callback
278
+ * will receive the same arguments
279
+ * as those passed to a function parameter
280
+ * of `String#replace`.
281
+ * @return This node for methods chain.
282
+ */
283
+ replaceValues(
284
+ pattern: RegExp | string,
285
+ options: Container.ValueOptions,
286
+ replaced: { (substring: string, ...args: any[]): string } | string
287
+ ): this
288
+
289
+ /**
290
+ * Returns `true` if callback returns `true` for (at least) one
291
+ * of the container’s children.
292
+ *
293
+ * ```js
294
+ * const hasPrefix = rule.some(i => i.prop[0] === '-')
295
+ * ```
296
+ *
297
+ * @param condition Iterator returns true or false.
298
+ * @return Is some child pass condition.
299
+ */
300
+ some(
301
+ condition: (node: Child, index: number, nodes: Child[]) => boolean
302
+ ): boolean
303
+
304
+ /**
305
+ * Traverses the container’s descendant nodes, calling callback
306
+ * for each node.
307
+ *
308
+ * Like container.each(), this method is safe to use
309
+ * if you are mutating arrays during iteration.
310
+ *
311
+ * If you only need to iterate through the container’s immediate children,
312
+ * use `Container#each`.
313
+ *
314
+ * ```js
315
+ * root.walk(node => {
316
+ * // Traverses all descendant nodes.
317
+ * })
318
+ * ```
319
+ *
320
+ * @param callback Iterator receives each node and index.
321
+ * @return Returns `false` if iteration was broke.
322
+ */
323
+ walk(
324
+ callback: (node: ChildNode, index: number) => false | void
325
+ ): false | undefined
326
+
327
+ /**
328
+ * Traverses the container’s descendant nodes, calling callback
329
+ * for each at-rule node.
330
+ *
331
+ * If you pass a filter, iteration will only happen over at-rules
332
+ * that have matching names.
333
+ *
334
+ * Like `Container#each`, this method is safe
335
+ * to use if you are mutating arrays during iteration.
336
+ *
337
+ * ```js
338
+ * root.walkAtRules(rule => {
339
+ * if (isOld(rule.name)) rule.remove()
340
+ * })
341
+ *
342
+ * let first = false
343
+ * root.walkAtRules('charset', rule => {
344
+ * if (!first) {
345
+ * first = true
346
+ * } else {
347
+ * rule.remove()
348
+ * }
349
+ * })
350
+ * ```
351
+ *
352
+ * @param name String or regular expression to filter at-rules by name.
353
+ * @param callback Iterator receives each node and index.
354
+ * @return Returns `false` if iteration was broke.
355
+ */
356
+ walkAtRules(
357
+ nameFilter: RegExp | string,
358
+ callback: (atRule: AtRule, index: number) => false | void
359
+ ): false | undefined
360
+ walkAtRules(
361
+ callback: (atRule: AtRule, index: number) => false | void
362
+ ): false | undefined
363
+
364
+ /**
365
+ * Traverses the container’s descendant nodes, calling callback
366
+ * for each comment node.
367
+ *
368
+ * Like `Container#each`, this method is safe
369
+ * to use if you are mutating arrays during iteration.
370
+ *
371
+ * ```js
372
+ * root.walkComments(comment => {
373
+ * comment.remove()
374
+ * })
375
+ * ```
376
+ *
377
+ * @param callback Iterator receives each node and index.
378
+ * @return Returns `false` if iteration was broke.
379
+ */
380
+ walkComments(
381
+ callback: (comment: Comment, indexed: number) => false | void
382
+ ): false | undefined
383
+
384
+ /**
385
+ * Traverses the container’s descendant nodes, calling callback
386
+ * for each declaration node.
387
+ *
388
+ * If you pass a filter, iteration will only happen over declarations
389
+ * with matching properties.
390
+ *
391
+ * ```js
392
+ * root.walkDecls(decl => {
393
+ * checkPropertySupport(decl.prop)
394
+ * })
395
+ *
396
+ * root.walkDecls('border-radius', decl => {
397
+ * decl.remove()
398
+ * })
399
+ *
400
+ * root.walkDecls(/^background/, decl => {
401
+ * decl.value = takeFirstColorFromGradient(decl.value)
402
+ * })
403
+ * ```
404
+ *
405
+ * Like `Container#each`, this method is safe
406
+ * to use if you are mutating arrays during iteration.
407
+ *
408
+ * @param prop String or regular expression to filter declarations
409
+ * by property name.
410
+ * @param callback Iterator receives each node and index.
411
+ * @return Returns `false` if iteration was broke.
412
+ */
413
+ walkDecls(
414
+ propFilter: RegExp | string,
415
+ callback: (decl: Declaration, index: number) => false | void
416
+ ): false | undefined
417
+ walkDecls(
418
+ callback: (decl: Declaration, index: number) => false | void
419
+ ): false | undefined
420
+ /**
421
+ * Traverses the container’s descendant nodes, calling callback
422
+ * for each rule node.
423
+ *
424
+ * If you pass a filter, iteration will only happen over rules
425
+ * with matching selectors.
426
+ *
427
+ * Like `Container#each`, this method is safe
428
+ * to use if you are mutating arrays during iteration.
429
+ *
430
+ * ```js
431
+ * const selectors = []
432
+ * root.walkRules(rule => {
433
+ * selectors.push(rule.selector)
434
+ * })
435
+ * console.log(`Your CSS uses ${ selectors.length } selectors`)
436
+ * ```
437
+ *
438
+ * @param selector String or regular expression to filter rules by selector.
439
+ * @param callback Iterator receives each node and index.
440
+ * @return Returns `false` if iteration was broke.
441
+ */
442
+ walkRules(
443
+ selectorFilter: RegExp | string,
444
+ callback: (rule: Rule, index: number) => false | void
445
+ ): false | undefined
446
+ walkRules(
447
+ callback: (rule: Rule, index: number) => false | void
448
+ ): false | undefined
449
+ /**
450
+ * An internal method that converts a {@link NewChild} into a list of actual
451
+ * child nodes that can then be added to this container.
452
+ *
453
+ * This ensures that the nodes' parent is set to this container, that they use
454
+ * the correct prototype chain, and that they're marked as dirty.
455
+ *
456
+ * @param mnodes The new node or nodes to add.
457
+ * @param sample A node from whose raws the new node's `before` raw should be
458
+ * taken.
459
+ * @param type This should be set to `'prepend'` if the new nodes will be
460
+ * inserted at the beginning of the container.
461
+ * @hidden
462
+ */
463
+ protected normalize(
464
+ nodes: Container.NewChild,
465
+ sample: Node | undefined,
466
+ type?: 'prepend' | false
467
+ ): Child[]
468
+ }
469
+
470
+ declare class Container<
471
+ Child extends Node = ChildNode
472
+ > extends Container_<Child> {}
473
+
474
+ export = Container