@everymatrix/general-footer-template 1.22.0 → 1.22.2
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.
- package/dist/cjs/custom-content-section.cjs.entry.js +1549 -1519
- package/dist/components/custom-content-section.js +1549 -1519
- package/dist/esm/custom-content-section.entry.js +1549 -1519
- package/dist/general-footer-template/general-footer-template.esm.js +1 -1
- package/dist/general-footer-template/{p-7998a5ba.entry.js → p-b8c9a43b.entry.js} +2 -2
- package/package.json +1 -1
- /package/dist/types/Users/{catalin.poclid/Documents/work → adrian.pripon/Documents/Work}/widgets-stencil/packages/general-footer-template/.stencil/packages/general-footer-template/stencil.config.d.ts +0 -0
|
@@ -4621,7 +4621,7 @@ class CssSyntaxError extends Error {
|
|
|
4621
4621
|
|
|
4622
4622
|
let mark, aside;
|
|
4623
4623
|
if (color) {
|
|
4624
|
-
let { bold,
|
|
4624
|
+
let { bold, gray, red } = picocolors_browser.createColors(true);
|
|
4625
4625
|
mark = text => bold(red(text));
|
|
4626
4626
|
aside = text => gray(text);
|
|
4627
4627
|
} else {
|
|
@@ -4666,17 +4666,17 @@ var symbols = {
|
|
|
4666
4666
|
};
|
|
4667
4667
|
|
|
4668
4668
|
const DEFAULT_RAW = {
|
|
4669
|
-
|
|
4670
|
-
indent: ' ',
|
|
4671
|
-
beforeDecl: '\n',
|
|
4672
|
-
beforeRule: '\n',
|
|
4673
|
-
beforeOpen: ' ',
|
|
4669
|
+
after: '\n',
|
|
4674
4670
|
beforeClose: '\n',
|
|
4675
4671
|
beforeComment: '\n',
|
|
4676
|
-
|
|
4677
|
-
|
|
4672
|
+
beforeDecl: '\n',
|
|
4673
|
+
beforeOpen: ' ',
|
|
4674
|
+
beforeRule: '\n',
|
|
4675
|
+
colon: ': ',
|
|
4678
4676
|
commentLeft: ' ',
|
|
4679
4677
|
commentRight: ' ',
|
|
4678
|
+
emptyBody: '',
|
|
4679
|
+
indent: ' ',
|
|
4680
4680
|
semicolon: false
|
|
4681
4681
|
};
|
|
4682
4682
|
|
|
@@ -4689,54 +4689,6 @@ class Stringifier {
|
|
|
4689
4689
|
this.builder = builder;
|
|
4690
4690
|
}
|
|
4691
4691
|
|
|
4692
|
-
stringify(node, semicolon) {
|
|
4693
|
-
/* c8 ignore start */
|
|
4694
|
-
if (!this[node.type]) {
|
|
4695
|
-
throw new Error(
|
|
4696
|
-
'Unknown AST node type ' +
|
|
4697
|
-
node.type +
|
|
4698
|
-
'. ' +
|
|
4699
|
-
'Maybe you need to change PostCSS stringifier.'
|
|
4700
|
-
)
|
|
4701
|
-
}
|
|
4702
|
-
/* c8 ignore stop */
|
|
4703
|
-
this[node.type](node, semicolon);
|
|
4704
|
-
}
|
|
4705
|
-
|
|
4706
|
-
document(node) {
|
|
4707
|
-
this.body(node);
|
|
4708
|
-
}
|
|
4709
|
-
|
|
4710
|
-
root(node) {
|
|
4711
|
-
this.body(node);
|
|
4712
|
-
if (node.raws.after) this.builder(node.raws.after);
|
|
4713
|
-
}
|
|
4714
|
-
|
|
4715
|
-
comment(node) {
|
|
4716
|
-
let left = this.raw(node, 'left', 'commentLeft');
|
|
4717
|
-
let right = this.raw(node, 'right', 'commentRight');
|
|
4718
|
-
this.builder('/*' + left + node.text + right + '*/', node);
|
|
4719
|
-
}
|
|
4720
|
-
|
|
4721
|
-
decl(node, semicolon) {
|
|
4722
|
-
let between = this.raw(node, 'between', 'colon');
|
|
4723
|
-
let string = node.prop + between + this.rawValue(node, 'value');
|
|
4724
|
-
|
|
4725
|
-
if (node.important) {
|
|
4726
|
-
string += node.raws.important || ' !important';
|
|
4727
|
-
}
|
|
4728
|
-
|
|
4729
|
-
if (semicolon) string += ';';
|
|
4730
|
-
this.builder(string, node);
|
|
4731
|
-
}
|
|
4732
|
-
|
|
4733
|
-
rule(node) {
|
|
4734
|
-
this.block(node, this.rawValue(node, 'selector'));
|
|
4735
|
-
if (node.raws.ownSemicolon) {
|
|
4736
|
-
this.builder(node.raws.ownSemicolon, node, 'end');
|
|
4737
|
-
}
|
|
4738
|
-
}
|
|
4739
|
-
|
|
4740
4692
|
atrule(node, semicolon) {
|
|
4741
4693
|
let name = '@' + node.name;
|
|
4742
4694
|
let params = node.params ? this.rawValue(node, 'params') : '';
|
|
@@ -4755,20 +4707,33 @@ class Stringifier {
|
|
|
4755
4707
|
}
|
|
4756
4708
|
}
|
|
4757
4709
|
|
|
4758
|
-
|
|
4759
|
-
let
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
|
|
4710
|
+
beforeAfter(node, detect) {
|
|
4711
|
+
let value;
|
|
4712
|
+
if (node.type === 'decl') {
|
|
4713
|
+
value = this.raw(node, null, 'beforeDecl');
|
|
4714
|
+
} else if (node.type === 'comment') {
|
|
4715
|
+
value = this.raw(node, null, 'beforeComment');
|
|
4716
|
+
} else if (detect === 'before') {
|
|
4717
|
+
value = this.raw(node, null, 'beforeRule');
|
|
4718
|
+
} else {
|
|
4719
|
+
value = this.raw(node, null, 'beforeClose');
|
|
4763
4720
|
}
|
|
4764
4721
|
|
|
4765
|
-
let
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
this.stringify(child, last !== i || semicolon);
|
|
4722
|
+
let buf = node.parent;
|
|
4723
|
+
let depth = 0;
|
|
4724
|
+
while (buf && buf.type !== 'root') {
|
|
4725
|
+
depth += 1;
|
|
4726
|
+
buf = buf.parent;
|
|
4771
4727
|
}
|
|
4728
|
+
|
|
4729
|
+
if (value.includes('\n')) {
|
|
4730
|
+
let indent = this.raw(node, null, 'indent');
|
|
4731
|
+
if (indent.length) {
|
|
4732
|
+
for (let step = 0; step < depth; step++) value += indent;
|
|
4733
|
+
}
|
|
4734
|
+
}
|
|
4735
|
+
|
|
4736
|
+
return value
|
|
4772
4737
|
}
|
|
4773
4738
|
|
|
4774
4739
|
block(node, start) {
|
|
@@ -4787,6 +4752,44 @@ class Stringifier {
|
|
|
4787
4752
|
this.builder('}', node, 'end');
|
|
4788
4753
|
}
|
|
4789
4754
|
|
|
4755
|
+
body(node) {
|
|
4756
|
+
let last = node.nodes.length - 1;
|
|
4757
|
+
while (last > 0) {
|
|
4758
|
+
if (node.nodes[last].type !== 'comment') break
|
|
4759
|
+
last -= 1;
|
|
4760
|
+
}
|
|
4761
|
+
|
|
4762
|
+
let semicolon = this.raw(node, 'semicolon');
|
|
4763
|
+
for (let i = 0; i < node.nodes.length; i++) {
|
|
4764
|
+
let child = node.nodes[i];
|
|
4765
|
+
let before = this.raw(child, 'before');
|
|
4766
|
+
if (before) this.builder(before);
|
|
4767
|
+
this.stringify(child, last !== i || semicolon);
|
|
4768
|
+
}
|
|
4769
|
+
}
|
|
4770
|
+
|
|
4771
|
+
comment(node) {
|
|
4772
|
+
let left = this.raw(node, 'left', 'commentLeft');
|
|
4773
|
+
let right = this.raw(node, 'right', 'commentRight');
|
|
4774
|
+
this.builder('/*' + left + node.text + right + '*/', node);
|
|
4775
|
+
}
|
|
4776
|
+
|
|
4777
|
+
decl(node, semicolon) {
|
|
4778
|
+
let between = this.raw(node, 'between', 'colon');
|
|
4779
|
+
let string = node.prop + between + this.rawValue(node, 'value');
|
|
4780
|
+
|
|
4781
|
+
if (node.important) {
|
|
4782
|
+
string += node.raws.important || ' !important';
|
|
4783
|
+
}
|
|
4784
|
+
|
|
4785
|
+
if (semicolon) string += ';';
|
|
4786
|
+
this.builder(string, node);
|
|
4787
|
+
}
|
|
4788
|
+
|
|
4789
|
+
document(node) {
|
|
4790
|
+
this.body(node);
|
|
4791
|
+
}
|
|
4792
|
+
|
|
4790
4793
|
raw(node, own, detect) {
|
|
4791
4794
|
let value;
|
|
4792
4795
|
if (!detect) detect = own;
|
|
@@ -4841,42 +4844,20 @@ class Stringifier {
|
|
|
4841
4844
|
return value
|
|
4842
4845
|
}
|
|
4843
4846
|
|
|
4844
|
-
|
|
4845
|
-
let value;
|
|
4846
|
-
root.walk(i => {
|
|
4847
|
-
if (i.nodes && i.nodes.length && i.last.type === 'decl') {
|
|
4848
|
-
value = i.raws.semicolon;
|
|
4849
|
-
if (typeof value !== 'undefined') return false
|
|
4850
|
-
}
|
|
4851
|
-
});
|
|
4852
|
-
return value
|
|
4853
|
-
}
|
|
4854
|
-
|
|
4855
|
-
rawEmptyBody(root) {
|
|
4856
|
-
let value;
|
|
4857
|
-
root.walk(i => {
|
|
4858
|
-
if (i.nodes && i.nodes.length === 0) {
|
|
4859
|
-
value = i.raws.after;
|
|
4860
|
-
if (typeof value !== 'undefined') return false
|
|
4861
|
-
}
|
|
4862
|
-
});
|
|
4863
|
-
return value
|
|
4864
|
-
}
|
|
4865
|
-
|
|
4866
|
-
rawIndent(root) {
|
|
4867
|
-
if (root.raws.indent) return root.raws.indent
|
|
4847
|
+
rawBeforeClose(root) {
|
|
4868
4848
|
let value;
|
|
4869
4849
|
root.walk(i => {
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4850
|
+
if (i.nodes && i.nodes.length > 0) {
|
|
4851
|
+
if (typeof i.raws.after !== 'undefined') {
|
|
4852
|
+
value = i.raws.after;
|
|
4853
|
+
if (value.includes('\n')) {
|
|
4854
|
+
value = value.replace(/[^\n]+$/, '');
|
|
4855
|
+
}
|
|
4876
4856
|
return false
|
|
4877
4857
|
}
|
|
4878
4858
|
}
|
|
4879
4859
|
});
|
|
4860
|
+
if (value) value = value.replace(/\S/g, '');
|
|
4880
4861
|
return value
|
|
4881
4862
|
}
|
|
4882
4863
|
|
|
@@ -4918,6 +4899,17 @@ class Stringifier {
|
|
|
4918
4899
|
return value
|
|
4919
4900
|
}
|
|
4920
4901
|
|
|
4902
|
+
rawBeforeOpen(root) {
|
|
4903
|
+
let value;
|
|
4904
|
+
root.walk(i => {
|
|
4905
|
+
if (i.type !== 'decl') {
|
|
4906
|
+
value = i.raws.between;
|
|
4907
|
+
if (typeof value !== 'undefined') return false
|
|
4908
|
+
}
|
|
4909
|
+
});
|
|
4910
|
+
return value
|
|
4911
|
+
}
|
|
4912
|
+
|
|
4921
4913
|
rawBeforeRule(root) {
|
|
4922
4914
|
let value;
|
|
4923
4915
|
root.walk(i => {
|
|
@@ -4935,71 +4927,53 @@ class Stringifier {
|
|
|
4935
4927
|
return value
|
|
4936
4928
|
}
|
|
4937
4929
|
|
|
4938
|
-
|
|
4930
|
+
rawColon(root) {
|
|
4939
4931
|
let value;
|
|
4940
|
-
root.
|
|
4941
|
-
if (
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
if (value.includes('\n')) {
|
|
4945
|
-
value = value.replace(/[^\n]+$/, '');
|
|
4946
|
-
}
|
|
4947
|
-
return false
|
|
4948
|
-
}
|
|
4932
|
+
root.walkDecls(i => {
|
|
4933
|
+
if (typeof i.raws.between !== 'undefined') {
|
|
4934
|
+
value = i.raws.between.replace(/[^\s:]/g, '');
|
|
4935
|
+
return false
|
|
4949
4936
|
}
|
|
4950
4937
|
});
|
|
4951
|
-
if (value) value = value.replace(/\S/g, '');
|
|
4952
4938
|
return value
|
|
4953
4939
|
}
|
|
4954
4940
|
|
|
4955
|
-
|
|
4941
|
+
rawEmptyBody(root) {
|
|
4956
4942
|
let value;
|
|
4957
4943
|
root.walk(i => {
|
|
4958
|
-
if (i.
|
|
4959
|
-
value = i.raws.
|
|
4944
|
+
if (i.nodes && i.nodes.length === 0) {
|
|
4945
|
+
value = i.raws.after;
|
|
4960
4946
|
if (typeof value !== 'undefined') return false
|
|
4961
4947
|
}
|
|
4962
4948
|
});
|
|
4963
4949
|
return value
|
|
4964
4950
|
}
|
|
4965
4951
|
|
|
4966
|
-
|
|
4952
|
+
rawIndent(root) {
|
|
4953
|
+
if (root.raws.indent) return root.raws.indent
|
|
4967
4954
|
let value;
|
|
4968
|
-
root.
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4955
|
+
root.walk(i => {
|
|
4956
|
+
let p = i.parent;
|
|
4957
|
+
if (p && p !== root && p.parent && p.parent === root) {
|
|
4958
|
+
if (typeof i.raws.before !== 'undefined') {
|
|
4959
|
+
let parts = i.raws.before.split('\n');
|
|
4960
|
+
value = parts[parts.length - 1];
|
|
4961
|
+
value = value.replace(/\S/g, '');
|
|
4962
|
+
return false
|
|
4963
|
+
}
|
|
4972
4964
|
}
|
|
4973
4965
|
});
|
|
4974
4966
|
return value
|
|
4975
4967
|
}
|
|
4976
4968
|
|
|
4977
|
-
|
|
4969
|
+
rawSemicolon(root) {
|
|
4978
4970
|
let value;
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
} else if (detect === 'before') {
|
|
4984
|
-
value = this.raw(node, null, 'beforeRule');
|
|
4985
|
-
} else {
|
|
4986
|
-
value = this.raw(node, null, 'beforeClose');
|
|
4987
|
-
}
|
|
4988
|
-
|
|
4989
|
-
let buf = node.parent;
|
|
4990
|
-
let depth = 0;
|
|
4991
|
-
while (buf && buf.type !== 'root') {
|
|
4992
|
-
depth += 1;
|
|
4993
|
-
buf = buf.parent;
|
|
4994
|
-
}
|
|
4995
|
-
|
|
4996
|
-
if (value.includes('\n')) {
|
|
4997
|
-
let indent = this.raw(node, null, 'indent');
|
|
4998
|
-
if (indent.length) {
|
|
4999
|
-
for (let step = 0; step < depth; step++) value += indent;
|
|
4971
|
+
root.walk(i => {
|
|
4972
|
+
if (i.nodes && i.nodes.length && i.last.type === 'decl') {
|
|
4973
|
+
value = i.raws.semicolon;
|
|
4974
|
+
if (typeof value !== 'undefined') return false
|
|
5000
4975
|
}
|
|
5001
|
-
}
|
|
5002
|
-
|
|
4976
|
+
});
|
|
5003
4977
|
return value
|
|
5004
4978
|
}
|
|
5005
4979
|
|
|
@@ -5012,10 +4986,36 @@ class Stringifier {
|
|
|
5012
4986
|
|
|
5013
4987
|
return value
|
|
5014
4988
|
}
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
4989
|
+
|
|
4990
|
+
root(node) {
|
|
4991
|
+
this.body(node);
|
|
4992
|
+
if (node.raws.after) this.builder(node.raws.after);
|
|
4993
|
+
}
|
|
4994
|
+
|
|
4995
|
+
rule(node) {
|
|
4996
|
+
this.block(node, this.rawValue(node, 'selector'));
|
|
4997
|
+
if (node.raws.ownSemicolon) {
|
|
4998
|
+
this.builder(node.raws.ownSemicolon, node, 'end');
|
|
4999
|
+
}
|
|
5000
|
+
}
|
|
5001
|
+
|
|
5002
|
+
stringify(node, semicolon) {
|
|
5003
|
+
/* c8 ignore start */
|
|
5004
|
+
if (!this[node.type]) {
|
|
5005
|
+
throw new Error(
|
|
5006
|
+
'Unknown AST node type ' +
|
|
5007
|
+
node.type +
|
|
5008
|
+
'. ' +
|
|
5009
|
+
'Maybe you need to change PostCSS stringifier.'
|
|
5010
|
+
)
|
|
5011
|
+
}
|
|
5012
|
+
/* c8 ignore stop */
|
|
5013
|
+
this[node.type](node, semicolon);
|
|
5014
|
+
}
|
|
5015
|
+
}
|
|
5016
|
+
|
|
5017
|
+
var stringifier = Stringifier;
|
|
5018
|
+
Stringifier.default = Stringifier;
|
|
5019
5019
|
|
|
5020
5020
|
function stringify(node, builder) {
|
|
5021
5021
|
let str = new stringifier(builder);
|
|
@@ -5079,42 +5079,23 @@ class Node {
|
|
|
5079
5079
|
}
|
|
5080
5080
|
}
|
|
5081
5081
|
|
|
5082
|
-
error
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
{
|
|
5088
|
-
{
|
|
5089
|
-
|
|
5090
|
-
)
|
|
5082
|
+
addToError(error) {
|
|
5083
|
+
error.postcssNode = this;
|
|
5084
|
+
if (error.stack && this.source && /\n\s{4}at /.test(error.stack)) {
|
|
5085
|
+
let s = this.source;
|
|
5086
|
+
error.stack = error.stack.replace(
|
|
5087
|
+
/\n\s{4}at /,
|
|
5088
|
+
`$&${s.input.from}:${s.start.line}:${s.start.column}$&`
|
|
5089
|
+
);
|
|
5091
5090
|
}
|
|
5092
|
-
return
|
|
5093
|
-
}
|
|
5094
|
-
|
|
5095
|
-
warn(result, text, opts) {
|
|
5096
|
-
let data = { node: this };
|
|
5097
|
-
for (let i in opts) data[i] = opts[i];
|
|
5098
|
-
return result.warn(text, data)
|
|
5091
|
+
return error
|
|
5099
5092
|
}
|
|
5100
5093
|
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
this.parent.removeChild(this);
|
|
5104
|
-
}
|
|
5105
|
-
this.parent = undefined;
|
|
5094
|
+
after(add) {
|
|
5095
|
+
this.parent.insertAfter(this, add);
|
|
5106
5096
|
return this
|
|
5107
5097
|
}
|
|
5108
5098
|
|
|
5109
|
-
toString(stringifier = stringify_1) {
|
|
5110
|
-
if (stringifier.stringify) stringifier = stringifier.stringify;
|
|
5111
|
-
let result = '';
|
|
5112
|
-
stringifier(this, i => {
|
|
5113
|
-
result += i;
|
|
5114
|
-
});
|
|
5115
|
-
return result
|
|
5116
|
-
}
|
|
5117
|
-
|
|
5118
5099
|
assign(overrides = {}) {
|
|
5119
5100
|
for (let name in overrides) {
|
|
5120
5101
|
this[name] = overrides[name];
|
|
@@ -5122,6 +5103,17 @@ class Node {
|
|
|
5122
5103
|
return this
|
|
5123
5104
|
}
|
|
5124
5105
|
|
|
5106
|
+
before(add) {
|
|
5107
|
+
this.parent.insertBefore(this, add);
|
|
5108
|
+
return this
|
|
5109
|
+
}
|
|
5110
|
+
|
|
5111
|
+
cleanRaws(keepBetween) {
|
|
5112
|
+
delete this.raws.before;
|
|
5113
|
+
delete this.raws.after;
|
|
5114
|
+
if (!keepBetween) delete this.raws.between;
|
|
5115
|
+
}
|
|
5116
|
+
|
|
5125
5117
|
clone(overrides = {}) {
|
|
5126
5118
|
let cloned = cloneNode(this);
|
|
5127
5119
|
for (let name in overrides) {
|
|
@@ -5130,39 +5122,70 @@ class Node {
|
|
|
5130
5122
|
return cloned
|
|
5131
5123
|
}
|
|
5132
5124
|
|
|
5133
|
-
|
|
5125
|
+
cloneAfter(overrides = {}) {
|
|
5134
5126
|
let cloned = this.clone(overrides);
|
|
5135
|
-
this.parent.
|
|
5127
|
+
this.parent.insertAfter(this, cloned);
|
|
5136
5128
|
return cloned
|
|
5137
5129
|
}
|
|
5138
5130
|
|
|
5139
|
-
|
|
5131
|
+
cloneBefore(overrides = {}) {
|
|
5140
5132
|
let cloned = this.clone(overrides);
|
|
5141
|
-
this.parent.
|
|
5133
|
+
this.parent.insertBefore(this, cloned);
|
|
5142
5134
|
return cloned
|
|
5143
5135
|
}
|
|
5144
5136
|
|
|
5145
|
-
|
|
5146
|
-
if (this.
|
|
5147
|
-
let
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5137
|
+
error(message, opts = {}) {
|
|
5138
|
+
if (this.source) {
|
|
5139
|
+
let { end, start } = this.rangeBy(opts);
|
|
5140
|
+
return this.source.input.error(
|
|
5141
|
+
message,
|
|
5142
|
+
{ column: start.column, line: start.line },
|
|
5143
|
+
{ column: end.column, line: end.line },
|
|
5144
|
+
opts
|
|
5145
|
+
)
|
|
5146
|
+
}
|
|
5147
|
+
return new cssSyntaxError(message)
|
|
5148
|
+
}
|
|
5149
|
+
|
|
5150
|
+
getProxyProcessor() {
|
|
5151
|
+
return {
|
|
5152
|
+
get(node, prop) {
|
|
5153
|
+
if (prop === 'proxyOf') {
|
|
5154
|
+
return node
|
|
5155
|
+
} else if (prop === 'root') {
|
|
5156
|
+
return () => node.root().toProxy()
|
|
5155
5157
|
} else {
|
|
5156
|
-
|
|
5158
|
+
return node[prop]
|
|
5157
5159
|
}
|
|
5158
|
-
}
|
|
5160
|
+
},
|
|
5159
5161
|
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
+
set(node, prop, value) {
|
|
5163
|
+
if (node[prop] === value) return true
|
|
5164
|
+
node[prop] = value;
|
|
5165
|
+
if (
|
|
5166
|
+
prop === 'prop' ||
|
|
5167
|
+
prop === 'value' ||
|
|
5168
|
+
prop === 'name' ||
|
|
5169
|
+
prop === 'params' ||
|
|
5170
|
+
prop === 'important' ||
|
|
5171
|
+
/* c8 ignore next */
|
|
5172
|
+
prop === 'text'
|
|
5173
|
+
) {
|
|
5174
|
+
node.markDirty();
|
|
5175
|
+
}
|
|
5176
|
+
return true
|
|
5162
5177
|
}
|
|
5163
5178
|
}
|
|
5179
|
+
}
|
|
5164
5180
|
|
|
5165
|
-
|
|
5181
|
+
markDirty() {
|
|
5182
|
+
if (this[isClean$2]) {
|
|
5183
|
+
this[isClean$2] = false;
|
|
5184
|
+
let next = this;
|
|
5185
|
+
while ((next = next.parent)) {
|
|
5186
|
+
next[isClean$2] = false;
|
|
5187
|
+
}
|
|
5188
|
+
}
|
|
5166
5189
|
}
|
|
5167
5190
|
|
|
5168
5191
|
next() {
|
|
@@ -5171,19 +5194,128 @@ class Node {
|
|
|
5171
5194
|
return this.parent.nodes[index + 1]
|
|
5172
5195
|
}
|
|
5173
5196
|
|
|
5197
|
+
positionBy(opts, stringRepresentation) {
|
|
5198
|
+
let pos = this.source.start;
|
|
5199
|
+
if (opts.index) {
|
|
5200
|
+
pos = this.positionInside(opts.index, stringRepresentation);
|
|
5201
|
+
} else if (opts.word) {
|
|
5202
|
+
stringRepresentation = this.toString();
|
|
5203
|
+
let index = stringRepresentation.indexOf(opts.word);
|
|
5204
|
+
if (index !== -1) pos = this.positionInside(index, stringRepresentation);
|
|
5205
|
+
}
|
|
5206
|
+
return pos
|
|
5207
|
+
}
|
|
5208
|
+
|
|
5209
|
+
positionInside(index, stringRepresentation) {
|
|
5210
|
+
let string = stringRepresentation || this.toString();
|
|
5211
|
+
let column = this.source.start.column;
|
|
5212
|
+
let line = this.source.start.line;
|
|
5213
|
+
|
|
5214
|
+
for (let i = 0; i < index; i++) {
|
|
5215
|
+
if (string[i] === '\n') {
|
|
5216
|
+
column = 1;
|
|
5217
|
+
line += 1;
|
|
5218
|
+
} else {
|
|
5219
|
+
column += 1;
|
|
5220
|
+
}
|
|
5221
|
+
}
|
|
5222
|
+
|
|
5223
|
+
return { column, line }
|
|
5224
|
+
}
|
|
5225
|
+
|
|
5174
5226
|
prev() {
|
|
5175
5227
|
if (!this.parent) return undefined
|
|
5176
5228
|
let index = this.parent.index(this);
|
|
5177
5229
|
return this.parent.nodes[index - 1]
|
|
5178
5230
|
}
|
|
5179
5231
|
|
|
5180
|
-
|
|
5181
|
-
|
|
5232
|
+
rangeBy(opts) {
|
|
5233
|
+
let start = {
|
|
5234
|
+
column: this.source.start.column,
|
|
5235
|
+
line: this.source.start.line
|
|
5236
|
+
};
|
|
5237
|
+
let end = this.source.end
|
|
5238
|
+
? {
|
|
5239
|
+
column: this.source.end.column + 1,
|
|
5240
|
+
line: this.source.end.line
|
|
5241
|
+
}
|
|
5242
|
+
: {
|
|
5243
|
+
column: start.column + 1,
|
|
5244
|
+
line: start.line
|
|
5245
|
+
};
|
|
5246
|
+
|
|
5247
|
+
if (opts.word) {
|
|
5248
|
+
let stringRepresentation = this.toString();
|
|
5249
|
+
let index = stringRepresentation.indexOf(opts.word);
|
|
5250
|
+
if (index !== -1) {
|
|
5251
|
+
start = this.positionInside(index, stringRepresentation);
|
|
5252
|
+
end = this.positionInside(index + opts.word.length, stringRepresentation);
|
|
5253
|
+
}
|
|
5254
|
+
} else {
|
|
5255
|
+
if (opts.start) {
|
|
5256
|
+
start = {
|
|
5257
|
+
column: opts.start.column,
|
|
5258
|
+
line: opts.start.line
|
|
5259
|
+
};
|
|
5260
|
+
} else if (opts.index) {
|
|
5261
|
+
start = this.positionInside(opts.index);
|
|
5262
|
+
}
|
|
5263
|
+
|
|
5264
|
+
if (opts.end) {
|
|
5265
|
+
end = {
|
|
5266
|
+
column: opts.end.column,
|
|
5267
|
+
line: opts.end.line
|
|
5268
|
+
};
|
|
5269
|
+
} else if (opts.endIndex) {
|
|
5270
|
+
end = this.positionInside(opts.endIndex);
|
|
5271
|
+
} else if (opts.index) {
|
|
5272
|
+
end = this.positionInside(opts.index + 1);
|
|
5273
|
+
}
|
|
5274
|
+
}
|
|
5275
|
+
|
|
5276
|
+
if (
|
|
5277
|
+
end.line < start.line ||
|
|
5278
|
+
(end.line === start.line && end.column <= start.column)
|
|
5279
|
+
) {
|
|
5280
|
+
end = { column: start.column + 1, line: start.line };
|
|
5281
|
+
}
|
|
5282
|
+
|
|
5283
|
+
return { end, start }
|
|
5284
|
+
}
|
|
5285
|
+
|
|
5286
|
+
raw(prop, defaultType) {
|
|
5287
|
+
let str = new stringifier();
|
|
5288
|
+
return str.raw(this, prop, defaultType)
|
|
5289
|
+
}
|
|
5290
|
+
|
|
5291
|
+
remove() {
|
|
5292
|
+
if (this.parent) {
|
|
5293
|
+
this.parent.removeChild(this);
|
|
5294
|
+
}
|
|
5295
|
+
this.parent = undefined;
|
|
5182
5296
|
return this
|
|
5183
5297
|
}
|
|
5184
5298
|
|
|
5185
|
-
|
|
5186
|
-
this.parent
|
|
5299
|
+
replaceWith(...nodes) {
|
|
5300
|
+
if (this.parent) {
|
|
5301
|
+
let bookmark = this;
|
|
5302
|
+
let foundSelf = false;
|
|
5303
|
+
for (let node of nodes) {
|
|
5304
|
+
if (node === this) {
|
|
5305
|
+
foundSelf = true;
|
|
5306
|
+
} else if (foundSelf) {
|
|
5307
|
+
this.parent.insertAfter(bookmark, node);
|
|
5308
|
+
bookmark = node;
|
|
5309
|
+
} else {
|
|
5310
|
+
this.parent.insertBefore(bookmark, node);
|
|
5311
|
+
}
|
|
5312
|
+
}
|
|
5313
|
+
|
|
5314
|
+
if (!foundSelf) {
|
|
5315
|
+
this.remove();
|
|
5316
|
+
}
|
|
5317
|
+
}
|
|
5318
|
+
|
|
5187
5319
|
return this
|
|
5188
5320
|
}
|
|
5189
5321
|
|
|
@@ -5195,17 +5327,6 @@ class Node {
|
|
|
5195
5327
|
return result
|
|
5196
5328
|
}
|
|
5197
5329
|
|
|
5198
|
-
raw(prop, defaultType) {
|
|
5199
|
-
let str = new stringifier();
|
|
5200
|
-
return str.raw(this, prop, defaultType)
|
|
5201
|
-
}
|
|
5202
|
-
|
|
5203
|
-
cleanRaws(keepBetween) {
|
|
5204
|
-
delete this.raws.before;
|
|
5205
|
-
delete this.raws.after;
|
|
5206
|
-
if (!keepBetween) delete this.raws.between;
|
|
5207
|
-
}
|
|
5208
|
-
|
|
5209
5330
|
toJSON(_, inputs) {
|
|
5210
5331
|
let fixed = {};
|
|
5211
5332
|
let emitInputs = inputs == null;
|
|
@@ -5238,9 +5359,9 @@ class Node {
|
|
|
5238
5359
|
inputsNextIndex++;
|
|
5239
5360
|
}
|
|
5240
5361
|
fixed[name] = {
|
|
5362
|
+
end: value.end,
|
|
5241
5363
|
inputId,
|
|
5242
|
-
start: value.start
|
|
5243
|
-
end: value.end
|
|
5364
|
+
start: value.start
|
|
5244
5365
|
};
|
|
5245
5366
|
} else {
|
|
5246
5367
|
fixed[name] = value;
|
|
@@ -5254,145 +5375,26 @@ class Node {
|
|
|
5254
5375
|
return fixed
|
|
5255
5376
|
}
|
|
5256
5377
|
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
|
|
5378
|
+
toProxy() {
|
|
5379
|
+
if (!this.proxyCache) {
|
|
5380
|
+
this.proxyCache = new Proxy(this, this.getProxyProcessor());
|
|
5381
|
+
}
|
|
5382
|
+
return this.proxyCache
|
|
5383
|
+
}
|
|
5261
5384
|
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
|
|
5266
|
-
|
|
5267
|
-
|
|
5268
|
-
|
|
5269
|
-
}
|
|
5270
|
-
|
|
5271
|
-
return { line, column }
|
|
5272
|
-
}
|
|
5273
|
-
|
|
5274
|
-
positionBy(opts) {
|
|
5275
|
-
let pos = this.source.start;
|
|
5276
|
-
if (opts.index) {
|
|
5277
|
-
pos = this.positionInside(opts.index);
|
|
5278
|
-
} else if (opts.word) {
|
|
5279
|
-
let index = this.toString().indexOf(opts.word);
|
|
5280
|
-
if (index !== -1) pos = this.positionInside(index);
|
|
5281
|
-
}
|
|
5282
|
-
return pos
|
|
5283
|
-
}
|
|
5284
|
-
|
|
5285
|
-
rangeBy(opts) {
|
|
5286
|
-
let start = {
|
|
5287
|
-
line: this.source.start.line,
|
|
5288
|
-
column: this.source.start.column
|
|
5289
|
-
};
|
|
5290
|
-
let end = this.source.end
|
|
5291
|
-
? {
|
|
5292
|
-
line: this.source.end.line,
|
|
5293
|
-
column: this.source.end.column + 1
|
|
5294
|
-
}
|
|
5295
|
-
: {
|
|
5296
|
-
line: start.line,
|
|
5297
|
-
column: start.column + 1
|
|
5298
|
-
};
|
|
5299
|
-
|
|
5300
|
-
if (opts.word) {
|
|
5301
|
-
let index = this.toString().indexOf(opts.word);
|
|
5302
|
-
if (index !== -1) {
|
|
5303
|
-
start = this.positionInside(index);
|
|
5304
|
-
end = this.positionInside(index + opts.word.length);
|
|
5305
|
-
}
|
|
5306
|
-
} else {
|
|
5307
|
-
if (opts.start) {
|
|
5308
|
-
start = {
|
|
5309
|
-
line: opts.start.line,
|
|
5310
|
-
column: opts.start.column
|
|
5311
|
-
};
|
|
5312
|
-
} else if (opts.index) {
|
|
5313
|
-
start = this.positionInside(opts.index);
|
|
5314
|
-
}
|
|
5315
|
-
|
|
5316
|
-
if (opts.end) {
|
|
5317
|
-
end = {
|
|
5318
|
-
line: opts.end.line,
|
|
5319
|
-
column: opts.end.column
|
|
5320
|
-
};
|
|
5321
|
-
} else if (opts.endIndex) {
|
|
5322
|
-
end = this.positionInside(opts.endIndex);
|
|
5323
|
-
} else if (opts.index) {
|
|
5324
|
-
end = this.positionInside(opts.index + 1);
|
|
5325
|
-
}
|
|
5326
|
-
}
|
|
5327
|
-
|
|
5328
|
-
if (
|
|
5329
|
-
end.line < start.line ||
|
|
5330
|
-
(end.line === start.line && end.column <= start.column)
|
|
5331
|
-
) {
|
|
5332
|
-
end = { line: start.line, column: start.column + 1 };
|
|
5333
|
-
}
|
|
5334
|
-
|
|
5335
|
-
return { start, end }
|
|
5336
|
-
}
|
|
5337
|
-
|
|
5338
|
-
getProxyProcessor() {
|
|
5339
|
-
return {
|
|
5340
|
-
set(node, prop, value) {
|
|
5341
|
-
if (node[prop] === value) return true
|
|
5342
|
-
node[prop] = value;
|
|
5343
|
-
if (
|
|
5344
|
-
prop === 'prop' ||
|
|
5345
|
-
prop === 'value' ||
|
|
5346
|
-
prop === 'name' ||
|
|
5347
|
-
prop === 'params' ||
|
|
5348
|
-
prop === 'important' ||
|
|
5349
|
-
/* c8 ignore next */
|
|
5350
|
-
prop === 'text'
|
|
5351
|
-
) {
|
|
5352
|
-
node.markDirty();
|
|
5353
|
-
}
|
|
5354
|
-
return true
|
|
5355
|
-
},
|
|
5356
|
-
|
|
5357
|
-
get(node, prop) {
|
|
5358
|
-
if (prop === 'proxyOf') {
|
|
5359
|
-
return node
|
|
5360
|
-
} else if (prop === 'root') {
|
|
5361
|
-
return () => node.root().toProxy()
|
|
5362
|
-
} else {
|
|
5363
|
-
return node[prop]
|
|
5364
|
-
}
|
|
5365
|
-
}
|
|
5366
|
-
}
|
|
5367
|
-
}
|
|
5368
|
-
|
|
5369
|
-
toProxy() {
|
|
5370
|
-
if (!this.proxyCache) {
|
|
5371
|
-
this.proxyCache = new Proxy(this, this.getProxyProcessor());
|
|
5372
|
-
}
|
|
5373
|
-
return this.proxyCache
|
|
5374
|
-
}
|
|
5375
|
-
|
|
5376
|
-
addToError(error) {
|
|
5377
|
-
error.postcssNode = this;
|
|
5378
|
-
if (error.stack && this.source && /\n\s{4}at /.test(error.stack)) {
|
|
5379
|
-
let s = this.source;
|
|
5380
|
-
error.stack = error.stack.replace(
|
|
5381
|
-
/\n\s{4}at /,
|
|
5382
|
-
`$&${s.input.from}:${s.start.line}:${s.start.column}$&`
|
|
5383
|
-
);
|
|
5384
|
-
}
|
|
5385
|
-
return error
|
|
5385
|
+
toString(stringifier = stringify_1) {
|
|
5386
|
+
if (stringifier.stringify) stringifier = stringifier.stringify;
|
|
5387
|
+
let result = '';
|
|
5388
|
+
stringifier(this, i => {
|
|
5389
|
+
result += i;
|
|
5390
|
+
});
|
|
5391
|
+
return result
|
|
5386
5392
|
}
|
|
5387
5393
|
|
|
5388
|
-
|
|
5389
|
-
|
|
5390
|
-
|
|
5391
|
-
|
|
5392
|
-
while ((next = next.parent)) {
|
|
5393
|
-
next[isClean$2] = false;
|
|
5394
|
-
}
|
|
5395
|
-
}
|
|
5394
|
+
warn(result, text, opts) {
|
|
5395
|
+
let data = { node: this };
|
|
5396
|
+
for (let i in opts) data[i] = opts[i];
|
|
5397
|
+
return result.warn(text, data)
|
|
5396
5398
|
}
|
|
5397
5399
|
|
|
5398
5400
|
get proxyOf() {
|
|
@@ -5486,22 +5488,37 @@ class PreviousMap {
|
|
|
5486
5488
|
return this.consumerCache
|
|
5487
5489
|
}
|
|
5488
5490
|
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
}
|
|
5491
|
+
decodeInline(text) {
|
|
5492
|
+
let baseCharsetUri = /^data:application\/json;charset=utf-?8;base64,/;
|
|
5493
|
+
let baseUri = /^data:application\/json;base64,/;
|
|
5494
|
+
let charsetUri = /^data:application\/json;charset=utf-?8,/;
|
|
5495
|
+
let uri = /^data:application\/json,/;
|
|
5495
5496
|
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5497
|
+
if (charsetUri.test(text) || uri.test(text)) {
|
|
5498
|
+
return decodeURIComponent(text.substr(RegExp.lastMatch.length))
|
|
5499
|
+
}
|
|
5500
|
+
|
|
5501
|
+
if (baseCharsetUri.test(text) || baseUri.test(text)) {
|
|
5502
|
+
return fromBase64(text.substr(RegExp.lastMatch.length))
|
|
5503
|
+
}
|
|
5504
|
+
|
|
5505
|
+
let encoding = text.match(/data:application\/json;([^,]+),/)[1];
|
|
5506
|
+
throw new Error('Unsupported source map encoding ' + encoding)
|
|
5499
5507
|
}
|
|
5500
5508
|
|
|
5501
5509
|
getAnnotationURL(sourceMapString) {
|
|
5502
5510
|
return sourceMapString.replace(/^\/\*\s*# sourceMappingURL=/, '').trim()
|
|
5503
5511
|
}
|
|
5504
5512
|
|
|
5513
|
+
isMap(map) {
|
|
5514
|
+
if (typeof map !== 'object') return false
|
|
5515
|
+
return (
|
|
5516
|
+
typeof map.mappings === 'string' ||
|
|
5517
|
+
typeof map._mappings === 'string' ||
|
|
5518
|
+
Array.isArray(map.sections)
|
|
5519
|
+
)
|
|
5520
|
+
}
|
|
5521
|
+
|
|
5505
5522
|
loadAnnotation(css) {
|
|
5506
5523
|
let comments = css.match(/\/\*\s*# sourceMappingURL=/gm);
|
|
5507
5524
|
if (!comments) return
|
|
@@ -5516,24 +5533,6 @@ class PreviousMap {
|
|
|
5516
5533
|
}
|
|
5517
5534
|
}
|
|
5518
5535
|
|
|
5519
|
-
decodeInline(text) {
|
|
5520
|
-
let baseCharsetUri = /^data:application\/json;charset=utf-?8;base64,/;
|
|
5521
|
-
let baseUri = /^data:application\/json;base64,/;
|
|
5522
|
-
let charsetUri = /^data:application\/json;charset=utf-?8,/;
|
|
5523
|
-
let uri = /^data:application\/json,/;
|
|
5524
|
-
|
|
5525
|
-
if (charsetUri.test(text) || uri.test(text)) {
|
|
5526
|
-
return decodeURIComponent(text.substr(RegExp.lastMatch.length))
|
|
5527
|
-
}
|
|
5528
|
-
|
|
5529
|
-
if (baseCharsetUri.test(text) || baseUri.test(text)) {
|
|
5530
|
-
return fromBase64(text.substr(RegExp.lastMatch.length))
|
|
5531
|
-
}
|
|
5532
|
-
|
|
5533
|
-
let encoding = text.match(/data:application\/json;([^,]+),/)[1];
|
|
5534
|
-
throw new Error('Unsupported source map encoding ' + encoding)
|
|
5535
|
-
}
|
|
5536
|
-
|
|
5537
5536
|
loadFile(path) {
|
|
5538
5537
|
this.root = dirname$1(path);
|
|
5539
5538
|
if (existsSync(path)) {
|
|
@@ -5579,12 +5578,15 @@ class PreviousMap {
|
|
|
5579
5578
|
}
|
|
5580
5579
|
}
|
|
5581
5580
|
|
|
5582
|
-
|
|
5583
|
-
if (
|
|
5584
|
-
return (
|
|
5585
|
-
|
|
5586
|
-
|
|
5587
|
-
|
|
5581
|
+
startWith(string, start) {
|
|
5582
|
+
if (!string) return false
|
|
5583
|
+
return string.substr(0, start.length) === start
|
|
5584
|
+
}
|
|
5585
|
+
|
|
5586
|
+
withContent() {
|
|
5587
|
+
return !!(
|
|
5588
|
+
this.consumer().sourcesContent &&
|
|
5589
|
+
this.consumer().sourcesContent.length > 0
|
|
5588
5590
|
)
|
|
5589
5591
|
}
|
|
5590
5592
|
}
|
|
@@ -5596,7 +5598,7 @@ const require$$3 = /*@__PURE__*/getAugmentedNamespace(nonSecure);
|
|
|
5596
5598
|
|
|
5597
5599
|
let { SourceMapConsumer: SourceMapConsumer$1, SourceMapGenerator: SourceMapGenerator$1 } = require$$2;
|
|
5598
5600
|
let { fileURLToPath, pathToFileURL: pathToFileURL$1 } = require$$2;
|
|
5599
|
-
let { resolve: resolve$1
|
|
5601
|
+
let { isAbsolute, resolve: resolve$1 } = require$$2;
|
|
5600
5602
|
let { nanoid } = require$$3;
|
|
5601
5603
|
|
|
5602
5604
|
|
|
@@ -5654,48 +5656,6 @@ class Input {
|
|
|
5654
5656
|
if (this.map) this.map.file = this.from;
|
|
5655
5657
|
}
|
|
5656
5658
|
|
|
5657
|
-
fromOffset(offset) {
|
|
5658
|
-
let lastLine, lineToIndex;
|
|
5659
|
-
if (!this[fromOffsetCache]) {
|
|
5660
|
-
let lines = this.css.split('\n');
|
|
5661
|
-
lineToIndex = new Array(lines.length);
|
|
5662
|
-
let prevIndex = 0;
|
|
5663
|
-
|
|
5664
|
-
for (let i = 0, l = lines.length; i < l; i++) {
|
|
5665
|
-
lineToIndex[i] = prevIndex;
|
|
5666
|
-
prevIndex += lines[i].length + 1;
|
|
5667
|
-
}
|
|
5668
|
-
|
|
5669
|
-
this[fromOffsetCache] = lineToIndex;
|
|
5670
|
-
} else {
|
|
5671
|
-
lineToIndex = this[fromOffsetCache];
|
|
5672
|
-
}
|
|
5673
|
-
lastLine = lineToIndex[lineToIndex.length - 1];
|
|
5674
|
-
|
|
5675
|
-
let min = 0;
|
|
5676
|
-
if (offset >= lastLine) {
|
|
5677
|
-
min = lineToIndex.length - 1;
|
|
5678
|
-
} else {
|
|
5679
|
-
let max = lineToIndex.length - 2;
|
|
5680
|
-
let mid;
|
|
5681
|
-
while (min < max) {
|
|
5682
|
-
mid = min + ((max - min) >> 1);
|
|
5683
|
-
if (offset < lineToIndex[mid]) {
|
|
5684
|
-
max = mid - 1;
|
|
5685
|
-
} else if (offset >= lineToIndex[mid + 1]) {
|
|
5686
|
-
min = mid + 1;
|
|
5687
|
-
} else {
|
|
5688
|
-
min = mid;
|
|
5689
|
-
break
|
|
5690
|
-
}
|
|
5691
|
-
}
|
|
5692
|
-
}
|
|
5693
|
-
return {
|
|
5694
|
-
line: min + 1,
|
|
5695
|
-
col: offset - lineToIndex[min] + 1
|
|
5696
|
-
}
|
|
5697
|
-
}
|
|
5698
|
-
|
|
5699
5659
|
error(message, line, column, opts = {}) {
|
|
5700
5660
|
let result, endLine, endColumn;
|
|
5701
5661
|
|
|
@@ -5730,10 +5690,10 @@ class Input {
|
|
|
5730
5690
|
message,
|
|
5731
5691
|
origin.endLine === undefined
|
|
5732
5692
|
? origin.line
|
|
5733
|
-
: {
|
|
5693
|
+
: { column: origin.column, line: origin.line },
|
|
5734
5694
|
origin.endLine === undefined
|
|
5735
5695
|
? origin.column
|
|
5736
|
-
: {
|
|
5696
|
+
: { column: origin.endColumn, line: origin.endLine },
|
|
5737
5697
|
origin.source,
|
|
5738
5698
|
origin.file,
|
|
5739
5699
|
opts.plugin
|
|
@@ -5741,15 +5701,15 @@ class Input {
|
|
|
5741
5701
|
} else {
|
|
5742
5702
|
result = new cssSyntaxError(
|
|
5743
5703
|
message,
|
|
5744
|
-
endLine === undefined ? line : {
|
|
5745
|
-
endLine === undefined ? column : {
|
|
5704
|
+
endLine === undefined ? line : { column, line },
|
|
5705
|
+
endLine === undefined ? column : { column: endColumn, line: endLine },
|
|
5746
5706
|
this.css,
|
|
5747
5707
|
this.file,
|
|
5748
5708
|
opts.plugin
|
|
5749
5709
|
);
|
|
5750
5710
|
}
|
|
5751
5711
|
|
|
5752
|
-
result.input = {
|
|
5712
|
+
result.input = { column, endColumn, endLine, line, source: this.css };
|
|
5753
5713
|
if (this.file) {
|
|
5754
5714
|
if (pathToFileURL$1) {
|
|
5755
5715
|
result.input.url = pathToFileURL$1(this.file).toString();
|
|
@@ -5760,22 +5720,71 @@ class Input {
|
|
|
5760
5720
|
return result
|
|
5761
5721
|
}
|
|
5762
5722
|
|
|
5763
|
-
|
|
5764
|
-
|
|
5765
|
-
|
|
5723
|
+
fromOffset(offset) {
|
|
5724
|
+
let lastLine, lineToIndex;
|
|
5725
|
+
if (!this[fromOffsetCache]) {
|
|
5726
|
+
let lines = this.css.split('\n');
|
|
5727
|
+
lineToIndex = new Array(lines.length);
|
|
5728
|
+
let prevIndex = 0;
|
|
5766
5729
|
|
|
5767
|
-
|
|
5768
|
-
|
|
5730
|
+
for (let i = 0, l = lines.length; i < l; i++) {
|
|
5731
|
+
lineToIndex[i] = prevIndex;
|
|
5732
|
+
prevIndex += lines[i].length + 1;
|
|
5733
|
+
}
|
|
5769
5734
|
|
|
5770
|
-
|
|
5771
|
-
|
|
5772
|
-
|
|
5735
|
+
this[fromOffsetCache] = lineToIndex;
|
|
5736
|
+
} else {
|
|
5737
|
+
lineToIndex = this[fromOffsetCache];
|
|
5773
5738
|
}
|
|
5739
|
+
lastLine = lineToIndex[lineToIndex.length - 1];
|
|
5774
5740
|
|
|
5775
|
-
let
|
|
5776
|
-
|
|
5777
|
-
|
|
5778
|
-
|
|
5741
|
+
let min = 0;
|
|
5742
|
+
if (offset >= lastLine) {
|
|
5743
|
+
min = lineToIndex.length - 1;
|
|
5744
|
+
} else {
|
|
5745
|
+
let max = lineToIndex.length - 2;
|
|
5746
|
+
let mid;
|
|
5747
|
+
while (min < max) {
|
|
5748
|
+
mid = min + ((max - min) >> 1);
|
|
5749
|
+
if (offset < lineToIndex[mid]) {
|
|
5750
|
+
max = mid - 1;
|
|
5751
|
+
} else if (offset >= lineToIndex[mid + 1]) {
|
|
5752
|
+
min = mid + 1;
|
|
5753
|
+
} else {
|
|
5754
|
+
min = mid;
|
|
5755
|
+
break
|
|
5756
|
+
}
|
|
5757
|
+
}
|
|
5758
|
+
}
|
|
5759
|
+
return {
|
|
5760
|
+
col: offset - lineToIndex[min] + 1,
|
|
5761
|
+
line: min + 1
|
|
5762
|
+
}
|
|
5763
|
+
}
|
|
5764
|
+
|
|
5765
|
+
mapResolve(file) {
|
|
5766
|
+
if (/^\w+:\/\//.test(file)) {
|
|
5767
|
+
return file
|
|
5768
|
+
}
|
|
5769
|
+
return resolve$1(this.map.consumer().sourceRoot || this.map.root || '.', file)
|
|
5770
|
+
}
|
|
5771
|
+
|
|
5772
|
+
origin(line, column, endLine, endColumn) {
|
|
5773
|
+
if (!this.map) return false
|
|
5774
|
+
let consumer = this.map.consumer();
|
|
5775
|
+
|
|
5776
|
+
let from = consumer.originalPositionFor({ column, line });
|
|
5777
|
+
if (!from.source) return false
|
|
5778
|
+
|
|
5779
|
+
let to;
|
|
5780
|
+
if (typeof endLine === 'number') {
|
|
5781
|
+
to = consumer.originalPositionFor({ column: endColumn, line: endLine });
|
|
5782
|
+
}
|
|
5783
|
+
|
|
5784
|
+
let fromUrl;
|
|
5785
|
+
|
|
5786
|
+
if (isAbsolute(from.source)) {
|
|
5787
|
+
fromUrl = pathToFileURL$1(from.source);
|
|
5779
5788
|
} else {
|
|
5780
5789
|
fromUrl = new URL(
|
|
5781
5790
|
from.source,
|
|
@@ -5784,11 +5793,11 @@ class Input {
|
|
|
5784
5793
|
}
|
|
5785
5794
|
|
|
5786
5795
|
let result = {
|
|
5787
|
-
url: fromUrl.toString(),
|
|
5788
|
-
line: from.line,
|
|
5789
5796
|
column: from.column,
|
|
5797
|
+
endColumn: to && to.column,
|
|
5790
5798
|
endLine: to && to.line,
|
|
5791
|
-
|
|
5799
|
+
line: from.line,
|
|
5800
|
+
url: fromUrl.toString()
|
|
5792
5801
|
};
|
|
5793
5802
|
|
|
5794
5803
|
if (fromUrl.protocol === 'file:') {
|
|
@@ -5806,17 +5815,6 @@ class Input {
|
|
|
5806
5815
|
return result
|
|
5807
5816
|
}
|
|
5808
5817
|
|
|
5809
|
-
mapResolve(file) {
|
|
5810
|
-
if (/^\w+:\/\//.test(file)) {
|
|
5811
|
-
return file
|
|
5812
|
-
}
|
|
5813
|
-
return resolve$1(this.map.consumer().sourceRoot || this.map.root || '.', file)
|
|
5814
|
-
}
|
|
5815
|
-
|
|
5816
|
-
get from() {
|
|
5817
|
-
return this.file || this.id
|
|
5818
|
-
}
|
|
5819
|
-
|
|
5820
5818
|
toJSON() {
|
|
5821
5819
|
let json = {};
|
|
5822
5820
|
for (let name of ['hasBOM', 'css', 'file', 'id']) {
|
|
@@ -5832,6 +5830,10 @@ class Input {
|
|
|
5832
5830
|
}
|
|
5833
5831
|
return json
|
|
5834
5832
|
}
|
|
5833
|
+
|
|
5834
|
+
get from() {
|
|
5835
|
+
return this.file || this.id
|
|
5836
|
+
}
|
|
5835
5837
|
}
|
|
5836
5838
|
|
|
5837
5839
|
var input = Input;
|
|
@@ -5842,7 +5844,7 @@ if (require$$2 && require$$2.registerInput) {
|
|
|
5842
5844
|
}
|
|
5843
5845
|
|
|
5844
5846
|
let { SourceMapConsumer, SourceMapGenerator } = require$$2;
|
|
5845
|
-
let { dirname,
|
|
5847
|
+
let { dirname, relative, resolve, sep } = require$$2;
|
|
5846
5848
|
let { pathToFileURL } = require$$2;
|
|
5847
5849
|
|
|
5848
5850
|
|
|
@@ -5858,100 +5860,29 @@ class MapGenerator {
|
|
|
5858
5860
|
this.opts = opts;
|
|
5859
5861
|
this.css = cssString;
|
|
5860
5862
|
this.usesFileUrls = !this.mapOpts.from && this.mapOpts.absolute;
|
|
5861
|
-
}
|
|
5862
|
-
|
|
5863
|
-
isMap() {
|
|
5864
|
-
if (typeof this.opts.map !== 'undefined') {
|
|
5865
|
-
return !!this.opts.map
|
|
5866
|
-
}
|
|
5867
|
-
return this.previous().length > 0
|
|
5868
|
-
}
|
|
5869
|
-
|
|
5870
|
-
previous() {
|
|
5871
|
-
if (!this.previousMaps) {
|
|
5872
|
-
this.previousMaps = [];
|
|
5873
|
-
if (this.root) {
|
|
5874
|
-
this.root.walk(node => {
|
|
5875
|
-
if (node.source && node.source.input.map) {
|
|
5876
|
-
let map = node.source.input.map;
|
|
5877
|
-
if (!this.previousMaps.includes(map)) {
|
|
5878
|
-
this.previousMaps.push(map);
|
|
5879
|
-
}
|
|
5880
|
-
}
|
|
5881
|
-
});
|
|
5882
|
-
} else {
|
|
5883
|
-
let input$1 = new input(this.css, this.opts);
|
|
5884
|
-
if (input$1.map) this.previousMaps.push(input$1.map);
|
|
5885
|
-
}
|
|
5886
|
-
}
|
|
5887
|
-
|
|
5888
|
-
return this.previousMaps
|
|
5889
|
-
}
|
|
5890
|
-
|
|
5891
|
-
isInline() {
|
|
5892
|
-
if (typeof this.mapOpts.inline !== 'undefined') {
|
|
5893
|
-
return this.mapOpts.inline
|
|
5894
|
-
}
|
|
5895
|
-
|
|
5896
|
-
let annotation = this.mapOpts.annotation;
|
|
5897
|
-
if (typeof annotation !== 'undefined' && annotation !== true) {
|
|
5898
|
-
return false
|
|
5899
|
-
}
|
|
5900
5863
|
|
|
5901
|
-
|
|
5902
|
-
|
|
5903
|
-
|
|
5904
|
-
return true
|
|
5905
|
-
}
|
|
5906
|
-
|
|
5907
|
-
isSourcesContent() {
|
|
5908
|
-
if (typeof this.mapOpts.sourcesContent !== 'undefined') {
|
|
5909
|
-
return this.mapOpts.sourcesContent
|
|
5910
|
-
}
|
|
5911
|
-
if (this.previous().length) {
|
|
5912
|
-
return this.previous().some(i => i.withContent())
|
|
5913
|
-
}
|
|
5914
|
-
return true
|
|
5864
|
+
this.memoizedFileURLs = new Map();
|
|
5865
|
+
this.memoizedPaths = new Map();
|
|
5866
|
+
this.memoizedURLs = new Map();
|
|
5915
5867
|
}
|
|
5916
5868
|
|
|
5917
|
-
|
|
5918
|
-
|
|
5869
|
+
addAnnotation() {
|
|
5870
|
+
let content;
|
|
5919
5871
|
|
|
5920
|
-
if (this.
|
|
5921
|
-
|
|
5922
|
-
|
|
5923
|
-
|
|
5924
|
-
|
|
5925
|
-
|
|
5926
|
-
|
|
5927
|
-
|
|
5928
|
-
|
|
5929
|
-
} else if (this.css) {
|
|
5930
|
-
this.css = this.css.replace(/(\n)?\/\*#[\S\s]*?\*\/$/gm, '');
|
|
5872
|
+
if (this.isInline()) {
|
|
5873
|
+
content =
|
|
5874
|
+
'data:application/json;base64,' + this.toBase64(this.map.toString());
|
|
5875
|
+
} else if (typeof this.mapOpts.annotation === 'string') {
|
|
5876
|
+
content = this.mapOpts.annotation;
|
|
5877
|
+
} else if (typeof this.mapOpts.annotation === 'function') {
|
|
5878
|
+
content = this.mapOpts.annotation(this.opts.to, this.root);
|
|
5879
|
+
} else {
|
|
5880
|
+
content = this.outputFile() + '.map';
|
|
5931
5881
|
}
|
|
5932
|
-
|
|
5882
|
+
let eol = '\n';
|
|
5883
|
+
if (this.css.includes('\r\n')) eol = '\r\n';
|
|
5933
5884
|
|
|
5934
|
-
|
|
5935
|
-
let already = {};
|
|
5936
|
-
if (this.root) {
|
|
5937
|
-
this.root.walk(node => {
|
|
5938
|
-
if (node.source) {
|
|
5939
|
-
let from = node.source.input.from;
|
|
5940
|
-
if (from && !already[from]) {
|
|
5941
|
-
already[from] = true;
|
|
5942
|
-
let fromUrl = this.usesFileUrls
|
|
5943
|
-
? this.toFileUrl(from)
|
|
5944
|
-
: this.toUrl(this.path(from));
|
|
5945
|
-
this.map.setSourceContent(fromUrl, node.source.input.css);
|
|
5946
|
-
}
|
|
5947
|
-
}
|
|
5948
|
-
});
|
|
5949
|
-
} else if (this.css) {
|
|
5950
|
-
let from = this.opts.from
|
|
5951
|
-
? this.toUrl(this.path(this.opts.from))
|
|
5952
|
-
: '<no source>';
|
|
5953
|
-
this.map.setSourceContent(from, this.css);
|
|
5954
|
-
}
|
|
5885
|
+
this.css += eol + '/*# sourceMappingURL=' + content + ' */';
|
|
5955
5886
|
}
|
|
5956
5887
|
|
|
5957
5888
|
applyPrevMaps() {
|
|
@@ -5973,53 +5904,33 @@ class MapGenerator {
|
|
|
5973
5904
|
}
|
|
5974
5905
|
}
|
|
5975
5906
|
|
|
5976
|
-
|
|
5977
|
-
if (this.
|
|
5978
|
-
return true
|
|
5979
|
-
}
|
|
5980
|
-
if (typeof this.mapOpts.annotation !== 'undefined') {
|
|
5981
|
-
return this.mapOpts.annotation
|
|
5982
|
-
}
|
|
5983
|
-
if (this.previous().length) {
|
|
5984
|
-
return this.previous().some(i => i.annotation)
|
|
5985
|
-
}
|
|
5986
|
-
return true
|
|
5987
|
-
}
|
|
5988
|
-
|
|
5989
|
-
toBase64(str) {
|
|
5990
|
-
if (Buffer) {
|
|
5991
|
-
return Buffer.from(str).toString('base64')
|
|
5992
|
-
} else {
|
|
5993
|
-
return window.btoa(unescape(encodeURIComponent(str)))
|
|
5994
|
-
}
|
|
5995
|
-
}
|
|
5996
|
-
|
|
5997
|
-
addAnnotation() {
|
|
5998
|
-
let content;
|
|
5907
|
+
clearAnnotation() {
|
|
5908
|
+
if (this.mapOpts.annotation === false) return
|
|
5999
5909
|
|
|
6000
|
-
if (this.
|
|
6001
|
-
|
|
6002
|
-
|
|
6003
|
-
|
|
6004
|
-
|
|
6005
|
-
|
|
6006
|
-
|
|
6007
|
-
|
|
6008
|
-
|
|
5910
|
+
if (this.root) {
|
|
5911
|
+
let node;
|
|
5912
|
+
for (let i = this.root.nodes.length - 1; i >= 0; i--) {
|
|
5913
|
+
node = this.root.nodes[i];
|
|
5914
|
+
if (node.type !== 'comment') continue
|
|
5915
|
+
if (node.text.indexOf('# sourceMappingURL=') === 0) {
|
|
5916
|
+
this.root.removeChild(i);
|
|
5917
|
+
}
|
|
5918
|
+
}
|
|
5919
|
+
} else if (this.css) {
|
|
5920
|
+
this.css = this.css.replace(/(\n)?\/\*#[\S\s]*?\*\/$/gm, '');
|
|
6009
5921
|
}
|
|
6010
|
-
let eol = '\n';
|
|
6011
|
-
if (this.css.includes('\r\n')) eol = '\r\n';
|
|
6012
|
-
|
|
6013
|
-
this.css += eol + '/*# sourceMappingURL=' + content + ' */';
|
|
6014
5922
|
}
|
|
6015
5923
|
|
|
6016
|
-
|
|
6017
|
-
|
|
6018
|
-
|
|
6019
|
-
|
|
6020
|
-
return this.path(this.opts.from)
|
|
5924
|
+
generate() {
|
|
5925
|
+
this.clearAnnotation();
|
|
5926
|
+
if (pathAvailable && sourceMapAvailable && this.isMap()) {
|
|
5927
|
+
return this.generateMap()
|
|
6021
5928
|
} else {
|
|
6022
|
-
|
|
5929
|
+
let result = '';
|
|
5930
|
+
this.stringify(this.root, i => {
|
|
5931
|
+
result += i;
|
|
5932
|
+
});
|
|
5933
|
+
return [result]
|
|
6023
5934
|
}
|
|
6024
5935
|
}
|
|
6025
5936
|
|
|
@@ -6033,11 +5944,11 @@ class MapGenerator {
|
|
|
6033
5944
|
} else {
|
|
6034
5945
|
this.map = new SourceMapGenerator({ file: this.outputFile() });
|
|
6035
5946
|
this.map.addMapping({
|
|
5947
|
+
generated: { column: 0, line: 1 },
|
|
5948
|
+
original: { column: 0, line: 1 },
|
|
6036
5949
|
source: this.opts.from
|
|
6037
5950
|
? this.toUrl(this.path(this.opts.from))
|
|
6038
|
-
: '<no source>'
|
|
6039
|
-
generated: { line: 1, column: 0 },
|
|
6040
|
-
original: { line: 1, column: 0 }
|
|
5951
|
+
: '<no source>'
|
|
6041
5952
|
});
|
|
6042
5953
|
}
|
|
6043
5954
|
|
|
@@ -6052,65 +5963,23 @@ class MapGenerator {
|
|
|
6052
5963
|
}
|
|
6053
5964
|
}
|
|
6054
5965
|
|
|
6055
|
-
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
if (this.mapOpts.absolute) return file
|
|
6059
|
-
|
|
6060
|
-
let from = this.opts.to ? dirname(this.opts.to) : '.';
|
|
5966
|
+
generateString() {
|
|
5967
|
+
this.css = '';
|
|
5968
|
+
this.map = new SourceMapGenerator({ file: this.outputFile() });
|
|
6061
5969
|
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
}
|
|
5970
|
+
let line = 1;
|
|
5971
|
+
let column = 1;
|
|
6065
5972
|
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
|
|
5973
|
+
let noSource = '<no source>';
|
|
5974
|
+
let mapping = {
|
|
5975
|
+
generated: { column: 0, line: 0 },
|
|
5976
|
+
original: { column: 0, line: 0 },
|
|
5977
|
+
source: ''
|
|
5978
|
+
};
|
|
6069
5979
|
|
|
6070
|
-
|
|
6071
|
-
|
|
6072
|
-
|
|
6073
|
-
}
|
|
6074
|
-
return encodeURI(path).replace(/[#?]/g, encodeURIComponent)
|
|
6075
|
-
}
|
|
6076
|
-
|
|
6077
|
-
toFileUrl(path) {
|
|
6078
|
-
if (pathToFileURL) {
|
|
6079
|
-
return pathToFileURL(path).toString()
|
|
6080
|
-
} else {
|
|
6081
|
-
throw new Error(
|
|
6082
|
-
'`map.absolute` option is not available in this PostCSS build'
|
|
6083
|
-
)
|
|
6084
|
-
}
|
|
6085
|
-
}
|
|
6086
|
-
|
|
6087
|
-
sourcePath(node) {
|
|
6088
|
-
if (this.mapOpts.from) {
|
|
6089
|
-
return this.toUrl(this.mapOpts.from)
|
|
6090
|
-
} else if (this.usesFileUrls) {
|
|
6091
|
-
return this.toFileUrl(node.source.input.from)
|
|
6092
|
-
} else {
|
|
6093
|
-
return this.toUrl(this.path(node.source.input.from))
|
|
6094
|
-
}
|
|
6095
|
-
}
|
|
6096
|
-
|
|
6097
|
-
generateString() {
|
|
6098
|
-
this.css = '';
|
|
6099
|
-
this.map = new SourceMapGenerator({ file: this.outputFile() });
|
|
6100
|
-
|
|
6101
|
-
let line = 1;
|
|
6102
|
-
let column = 1;
|
|
6103
|
-
|
|
6104
|
-
let noSource = '<no source>';
|
|
6105
|
-
let mapping = {
|
|
6106
|
-
source: '',
|
|
6107
|
-
generated: { line: 0, column: 0 },
|
|
6108
|
-
original: { line: 0, column: 0 }
|
|
6109
|
-
};
|
|
6110
|
-
|
|
6111
|
-
let lines, last;
|
|
6112
|
-
this.stringify(this.root, (str, node, type) => {
|
|
6113
|
-
this.css += str;
|
|
5980
|
+
let lines, last;
|
|
5981
|
+
this.stringify(this.root, (str, node, type) => {
|
|
5982
|
+
this.css += str;
|
|
6114
5983
|
|
|
6115
5984
|
if (node && type !== 'end') {
|
|
6116
5985
|
mapping.generated.line = line;
|
|
@@ -6162,18 +6031,172 @@ class MapGenerator {
|
|
|
6162
6031
|
});
|
|
6163
6032
|
}
|
|
6164
6033
|
|
|
6165
|
-
|
|
6166
|
-
this.
|
|
6167
|
-
|
|
6168
|
-
|
|
6034
|
+
isAnnotation() {
|
|
6035
|
+
if (this.isInline()) {
|
|
6036
|
+
return true
|
|
6037
|
+
}
|
|
6038
|
+
if (typeof this.mapOpts.annotation !== 'undefined') {
|
|
6039
|
+
return this.mapOpts.annotation
|
|
6040
|
+
}
|
|
6041
|
+
if (this.previous().length) {
|
|
6042
|
+
return this.previous().some(i => i.annotation)
|
|
6043
|
+
}
|
|
6044
|
+
return true
|
|
6045
|
+
}
|
|
6046
|
+
|
|
6047
|
+
isInline() {
|
|
6048
|
+
if (typeof this.mapOpts.inline !== 'undefined') {
|
|
6049
|
+
return this.mapOpts.inline
|
|
6050
|
+
}
|
|
6051
|
+
|
|
6052
|
+
let annotation = this.mapOpts.annotation;
|
|
6053
|
+
if (typeof annotation !== 'undefined' && annotation !== true) {
|
|
6054
|
+
return false
|
|
6055
|
+
}
|
|
6056
|
+
|
|
6057
|
+
if (this.previous().length) {
|
|
6058
|
+
return this.previous().some(i => i.inline)
|
|
6059
|
+
}
|
|
6060
|
+
return true
|
|
6061
|
+
}
|
|
6062
|
+
|
|
6063
|
+
isMap() {
|
|
6064
|
+
if (typeof this.opts.map !== 'undefined') {
|
|
6065
|
+
return !!this.opts.map
|
|
6066
|
+
}
|
|
6067
|
+
return this.previous().length > 0
|
|
6068
|
+
}
|
|
6069
|
+
|
|
6070
|
+
isSourcesContent() {
|
|
6071
|
+
if (typeof this.mapOpts.sourcesContent !== 'undefined') {
|
|
6072
|
+
return this.mapOpts.sourcesContent
|
|
6073
|
+
}
|
|
6074
|
+
if (this.previous().length) {
|
|
6075
|
+
return this.previous().some(i => i.withContent())
|
|
6076
|
+
}
|
|
6077
|
+
return true
|
|
6078
|
+
}
|
|
6079
|
+
|
|
6080
|
+
outputFile() {
|
|
6081
|
+
if (this.opts.to) {
|
|
6082
|
+
return this.path(this.opts.to)
|
|
6083
|
+
} else if (this.opts.from) {
|
|
6084
|
+
return this.path(this.opts.from)
|
|
6169
6085
|
} else {
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
|
|
6086
|
+
return 'to.css'
|
|
6087
|
+
}
|
|
6088
|
+
}
|
|
6089
|
+
|
|
6090
|
+
path(file) {
|
|
6091
|
+
if (this.mapOpts.absolute) return file
|
|
6092
|
+
if (file.charCodeAt(0) === 60 /* `<` */) return file
|
|
6093
|
+
if (/^\w+:\/\//.test(file)) return file
|
|
6094
|
+
let cached = this.memoizedPaths.get(file);
|
|
6095
|
+
if (cached) return cached
|
|
6096
|
+
|
|
6097
|
+
let from = this.opts.to ? dirname(this.opts.to) : '.';
|
|
6098
|
+
|
|
6099
|
+
if (typeof this.mapOpts.annotation === 'string') {
|
|
6100
|
+
from = dirname(resolve(from, this.mapOpts.annotation));
|
|
6101
|
+
}
|
|
6102
|
+
|
|
6103
|
+
let path = relative(from, file);
|
|
6104
|
+
this.memoizedPaths.set(file, path);
|
|
6105
|
+
|
|
6106
|
+
return path
|
|
6107
|
+
}
|
|
6108
|
+
|
|
6109
|
+
previous() {
|
|
6110
|
+
if (!this.previousMaps) {
|
|
6111
|
+
this.previousMaps = [];
|
|
6112
|
+
if (this.root) {
|
|
6113
|
+
this.root.walk(node => {
|
|
6114
|
+
if (node.source && node.source.input.map) {
|
|
6115
|
+
let map = node.source.input.map;
|
|
6116
|
+
if (!this.previousMaps.includes(map)) {
|
|
6117
|
+
this.previousMaps.push(map);
|
|
6118
|
+
}
|
|
6119
|
+
}
|
|
6120
|
+
});
|
|
6121
|
+
} else {
|
|
6122
|
+
let input$1 = new input(this.css, this.opts);
|
|
6123
|
+
if (input$1.map) this.previousMaps.push(input$1.map);
|
|
6124
|
+
}
|
|
6125
|
+
}
|
|
6126
|
+
|
|
6127
|
+
return this.previousMaps
|
|
6128
|
+
}
|
|
6129
|
+
|
|
6130
|
+
setSourcesContent() {
|
|
6131
|
+
let already = {};
|
|
6132
|
+
if (this.root) {
|
|
6133
|
+
this.root.walk(node => {
|
|
6134
|
+
if (node.source) {
|
|
6135
|
+
let from = node.source.input.from;
|
|
6136
|
+
if (from && !already[from]) {
|
|
6137
|
+
already[from] = true;
|
|
6138
|
+
let fromUrl = this.usesFileUrls
|
|
6139
|
+
? this.toFileUrl(from)
|
|
6140
|
+
: this.toUrl(this.path(from));
|
|
6141
|
+
this.map.setSourceContent(fromUrl, node.source.input.css);
|
|
6142
|
+
}
|
|
6143
|
+
}
|
|
6173
6144
|
});
|
|
6174
|
-
|
|
6145
|
+
} else if (this.css) {
|
|
6146
|
+
let from = this.opts.from
|
|
6147
|
+
? this.toUrl(this.path(this.opts.from))
|
|
6148
|
+
: '<no source>';
|
|
6149
|
+
this.map.setSourceContent(from, this.css);
|
|
6150
|
+
}
|
|
6151
|
+
}
|
|
6152
|
+
|
|
6153
|
+
sourcePath(node) {
|
|
6154
|
+
if (this.mapOpts.from) {
|
|
6155
|
+
return this.toUrl(this.mapOpts.from)
|
|
6156
|
+
} else if (this.usesFileUrls) {
|
|
6157
|
+
return this.toFileUrl(node.source.input.from)
|
|
6158
|
+
} else {
|
|
6159
|
+
return this.toUrl(this.path(node.source.input.from))
|
|
6160
|
+
}
|
|
6161
|
+
}
|
|
6162
|
+
|
|
6163
|
+
toBase64(str) {
|
|
6164
|
+
if (Buffer) {
|
|
6165
|
+
return Buffer.from(str).toString('base64')
|
|
6166
|
+
} else {
|
|
6167
|
+
return window.btoa(unescape(encodeURIComponent(str)))
|
|
6175
6168
|
}
|
|
6176
6169
|
}
|
|
6170
|
+
|
|
6171
|
+
toFileUrl(path) {
|
|
6172
|
+
let cached = this.memoizedFileURLs.get(path);
|
|
6173
|
+
if (cached) return cached
|
|
6174
|
+
|
|
6175
|
+
if (pathToFileURL) {
|
|
6176
|
+
let fileURL = pathToFileURL(path).toString();
|
|
6177
|
+
this.memoizedFileURLs.set(path, fileURL);
|
|
6178
|
+
|
|
6179
|
+
return fileURL
|
|
6180
|
+
} else {
|
|
6181
|
+
throw new Error(
|
|
6182
|
+
'`map.absolute` option is not available in this PostCSS build'
|
|
6183
|
+
)
|
|
6184
|
+
}
|
|
6185
|
+
}
|
|
6186
|
+
|
|
6187
|
+
toUrl(path) {
|
|
6188
|
+
let cached = this.memoizedURLs.get(path);
|
|
6189
|
+
if (cached) return cached
|
|
6190
|
+
|
|
6191
|
+
if (sep === '\\') {
|
|
6192
|
+
path = path.replace(/\\/g, '/');
|
|
6193
|
+
}
|
|
6194
|
+
|
|
6195
|
+
let url = encodeURI(path).replace(/[#?]/g, encodeURIComponent);
|
|
6196
|
+
this.memoizedURLs.set(path, url);
|
|
6197
|
+
|
|
6198
|
+
return url
|
|
6199
|
+
}
|
|
6177
6200
|
}
|
|
6178
6201
|
|
|
6179
6202
|
var mapGenerator = MapGenerator;
|
|
@@ -6213,12 +6236,24 @@ function markDirtyUp(node) {
|
|
|
6213
6236
|
}
|
|
6214
6237
|
|
|
6215
6238
|
class Container extends node_1 {
|
|
6216
|
-
|
|
6217
|
-
child
|
|
6218
|
-
|
|
6239
|
+
append(...children) {
|
|
6240
|
+
for (let child of children) {
|
|
6241
|
+
let nodes = this.normalize(child, this.last);
|
|
6242
|
+
for (let node of nodes) this.proxyOf.nodes.push(node);
|
|
6243
|
+
}
|
|
6244
|
+
|
|
6245
|
+
this.markDirty();
|
|
6246
|
+
|
|
6219
6247
|
return this
|
|
6220
6248
|
}
|
|
6221
6249
|
|
|
6250
|
+
cleanRaws(keepBetween) {
|
|
6251
|
+
super.cleanRaws(keepBetween);
|
|
6252
|
+
if (this.nodes) {
|
|
6253
|
+
for (let node of this.nodes) node.cleanRaws(keepBetween);
|
|
6254
|
+
}
|
|
6255
|
+
}
|
|
6256
|
+
|
|
6222
6257
|
each(callback) {
|
|
6223
6258
|
if (!this.proxyOf.nodes) return undefined
|
|
6224
6259
|
let iterator = this.getIterator();
|
|
@@ -6236,151 +6271,75 @@ class Container extends node_1 {
|
|
|
6236
6271
|
return result
|
|
6237
6272
|
}
|
|
6238
6273
|
|
|
6239
|
-
|
|
6240
|
-
return this.
|
|
6241
|
-
let result;
|
|
6242
|
-
try {
|
|
6243
|
-
result = callback(child, i);
|
|
6244
|
-
} catch (e) {
|
|
6245
|
-
throw child.addToError(e)
|
|
6246
|
-
}
|
|
6247
|
-
if (result !== false && child.walk) {
|
|
6248
|
-
result = child.walk(callback);
|
|
6249
|
-
}
|
|
6250
|
-
|
|
6251
|
-
return result
|
|
6252
|
-
})
|
|
6274
|
+
every(condition) {
|
|
6275
|
+
return this.nodes.every(condition)
|
|
6253
6276
|
}
|
|
6254
6277
|
|
|
6255
|
-
|
|
6256
|
-
if (!
|
|
6257
|
-
|
|
6258
|
-
return this.walk((child, i) => {
|
|
6259
|
-
if (child.type === 'decl') {
|
|
6260
|
-
return callback(child, i)
|
|
6261
|
-
}
|
|
6262
|
-
})
|
|
6263
|
-
}
|
|
6264
|
-
if (prop instanceof RegExp) {
|
|
6265
|
-
return this.walk((child, i) => {
|
|
6266
|
-
if (child.type === 'decl' && prop.test(child.prop)) {
|
|
6267
|
-
return callback(child, i)
|
|
6268
|
-
}
|
|
6269
|
-
})
|
|
6270
|
-
}
|
|
6271
|
-
return this.walk((child, i) => {
|
|
6272
|
-
if (child.type === 'decl' && child.prop === prop) {
|
|
6273
|
-
return callback(child, i)
|
|
6274
|
-
}
|
|
6275
|
-
})
|
|
6276
|
-
}
|
|
6278
|
+
getIterator() {
|
|
6279
|
+
if (!this.lastEach) this.lastEach = 0;
|
|
6280
|
+
if (!this.indexes) this.indexes = {};
|
|
6277
6281
|
|
|
6278
|
-
|
|
6279
|
-
|
|
6280
|
-
|
|
6282
|
+
this.lastEach += 1;
|
|
6283
|
+
let iterator = this.lastEach;
|
|
6284
|
+
this.indexes[iterator] = 0;
|
|
6281
6285
|
|
|
6282
|
-
|
|
6283
|
-
if (child.type === 'rule') {
|
|
6284
|
-
return callback(child, i)
|
|
6285
|
-
}
|
|
6286
|
-
})
|
|
6287
|
-
}
|
|
6288
|
-
if (selector instanceof RegExp) {
|
|
6289
|
-
return this.walk((child, i) => {
|
|
6290
|
-
if (child.type === 'rule' && selector.test(child.selector)) {
|
|
6291
|
-
return callback(child, i)
|
|
6292
|
-
}
|
|
6293
|
-
})
|
|
6294
|
-
}
|
|
6295
|
-
return this.walk((child, i) => {
|
|
6296
|
-
if (child.type === 'rule' && child.selector === selector) {
|
|
6297
|
-
return callback(child, i)
|
|
6298
|
-
}
|
|
6299
|
-
})
|
|
6286
|
+
return iterator
|
|
6300
6287
|
}
|
|
6301
6288
|
|
|
6302
|
-
|
|
6303
|
-
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
|
|
6307
|
-
|
|
6308
|
-
|
|
6309
|
-
|
|
6310
|
-
|
|
6311
|
-
|
|
6312
|
-
|
|
6313
|
-
|
|
6314
|
-
|
|
6289
|
+
getProxyProcessor() {
|
|
6290
|
+
return {
|
|
6291
|
+
get(node, prop) {
|
|
6292
|
+
if (prop === 'proxyOf') {
|
|
6293
|
+
return node
|
|
6294
|
+
} else if (!node[prop]) {
|
|
6295
|
+
return node[prop]
|
|
6296
|
+
} else if (
|
|
6297
|
+
prop === 'each' ||
|
|
6298
|
+
(typeof prop === 'string' && prop.startsWith('walk'))
|
|
6299
|
+
) {
|
|
6300
|
+
return (...args) => {
|
|
6301
|
+
return node[prop](
|
|
6302
|
+
...args.map(i => {
|
|
6303
|
+
if (typeof i === 'function') {
|
|
6304
|
+
return (child, index) => i(child.toProxy(), index)
|
|
6305
|
+
} else {
|
|
6306
|
+
return i
|
|
6307
|
+
}
|
|
6308
|
+
})
|
|
6309
|
+
)
|
|
6310
|
+
}
|
|
6311
|
+
} else if (prop === 'every' || prop === 'some') {
|
|
6312
|
+
return cb => {
|
|
6313
|
+
return node[prop]((child, ...other) =>
|
|
6314
|
+
cb(child.toProxy(), ...other)
|
|
6315
|
+
)
|
|
6316
|
+
}
|
|
6317
|
+
} else if (prop === 'root') {
|
|
6318
|
+
return () => node.root().toProxy()
|
|
6319
|
+
} else if (prop === 'nodes') {
|
|
6320
|
+
return node.nodes.map(i => i.toProxy())
|
|
6321
|
+
} else if (prop === 'first' || prop === 'last') {
|
|
6322
|
+
return node[prop].toProxy()
|
|
6323
|
+
} else {
|
|
6324
|
+
return node[prop]
|
|
6315
6325
|
}
|
|
6316
|
-
}
|
|
6317
|
-
}
|
|
6318
|
-
return this.walk((child, i) => {
|
|
6319
|
-
if (child.type === 'atrule' && child.name === name) {
|
|
6320
|
-
return callback(child, i)
|
|
6321
|
-
}
|
|
6322
|
-
})
|
|
6323
|
-
}
|
|
6324
|
-
|
|
6325
|
-
walkComments(callback) {
|
|
6326
|
-
return this.walk((child, i) => {
|
|
6327
|
-
if (child.type === 'comment') {
|
|
6328
|
-
return callback(child, i)
|
|
6329
|
-
}
|
|
6330
|
-
})
|
|
6331
|
-
}
|
|
6332
|
-
|
|
6333
|
-
append(...children) {
|
|
6334
|
-
for (let child of children) {
|
|
6335
|
-
let nodes = this.normalize(child, this.last);
|
|
6336
|
-
for (let node of nodes) this.proxyOf.nodes.push(node);
|
|
6337
|
-
}
|
|
6338
|
-
|
|
6339
|
-
this.markDirty();
|
|
6340
|
-
|
|
6341
|
-
return this
|
|
6342
|
-
}
|
|
6326
|
+
},
|
|
6343
6327
|
|
|
6344
|
-
|
|
6345
|
-
|
|
6346
|
-
|
|
6347
|
-
|
|
6348
|
-
|
|
6349
|
-
|
|
6350
|
-
|
|
6328
|
+
set(node, prop, value) {
|
|
6329
|
+
if (node[prop] === value) return true
|
|
6330
|
+
node[prop] = value;
|
|
6331
|
+
if (prop === 'name' || prop === 'params' || prop === 'selector') {
|
|
6332
|
+
node.markDirty();
|
|
6333
|
+
}
|
|
6334
|
+
return true
|
|
6351
6335
|
}
|
|
6352
6336
|
}
|
|
6353
|
-
|
|
6354
|
-
this.markDirty();
|
|
6355
|
-
|
|
6356
|
-
return this
|
|
6357
|
-
}
|
|
6358
|
-
|
|
6359
|
-
cleanRaws(keepBetween) {
|
|
6360
|
-
super.cleanRaws(keepBetween);
|
|
6361
|
-
if (this.nodes) {
|
|
6362
|
-
for (let node of this.nodes) node.cleanRaws(keepBetween);
|
|
6363
|
-
}
|
|
6364
6337
|
}
|
|
6365
6338
|
|
|
6366
|
-
|
|
6367
|
-
|
|
6368
|
-
|
|
6369
|
-
|
|
6370
|
-
existIndex = this.index(exist);
|
|
6371
|
-
for (let node of nodes) this.proxyOf.nodes.splice(existIndex, 0, node);
|
|
6372
|
-
|
|
6373
|
-
let index;
|
|
6374
|
-
for (let id in this.indexes) {
|
|
6375
|
-
index = this.indexes[id];
|
|
6376
|
-
if (existIndex <= index) {
|
|
6377
|
-
this.indexes[id] = index + nodes.length;
|
|
6378
|
-
}
|
|
6379
|
-
}
|
|
6380
|
-
|
|
6381
|
-
this.markDirty();
|
|
6382
|
-
|
|
6383
|
-
return this
|
|
6339
|
+
index(child) {
|
|
6340
|
+
if (typeof child === 'number') return child
|
|
6341
|
+
if (child.proxyOf) child = child.proxyOf;
|
|
6342
|
+
return this.proxyOf.nodes.indexOf(child)
|
|
6384
6343
|
}
|
|
6385
6344
|
|
|
6386
6345
|
insertAfter(exist, add) {
|
|
@@ -6402,16 +6361,18 @@ class Container extends node_1 {
|
|
|
6402
6361
|
return this
|
|
6403
6362
|
}
|
|
6404
6363
|
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
|
|
6408
|
-
this.proxyOf.nodes
|
|
6364
|
+
insertBefore(exist, add) {
|
|
6365
|
+
let existIndex = this.index(exist);
|
|
6366
|
+
let type = existIndex === 0 ? 'prepend' : false;
|
|
6367
|
+
let nodes = this.normalize(add, this.proxyOf.nodes[existIndex], type).reverse();
|
|
6368
|
+
existIndex = this.index(exist);
|
|
6369
|
+
for (let node of nodes) this.proxyOf.nodes.splice(existIndex, 0, node);
|
|
6409
6370
|
|
|
6410
6371
|
let index;
|
|
6411
6372
|
for (let id in this.indexes) {
|
|
6412
6373
|
index = this.indexes[id];
|
|
6413
|
-
if (
|
|
6414
|
-
this.indexes[id] = index
|
|
6374
|
+
if (existIndex <= index) {
|
|
6375
|
+
this.indexes[id] = index + nodes.length;
|
|
6415
6376
|
}
|
|
6416
6377
|
}
|
|
6417
6378
|
|
|
@@ -6420,57 +6381,6 @@ class Container extends node_1 {
|
|
|
6420
6381
|
return this
|
|
6421
6382
|
}
|
|
6422
6383
|
|
|
6423
|
-
removeAll() {
|
|
6424
|
-
for (let node of this.proxyOf.nodes) node.parent = undefined;
|
|
6425
|
-
this.proxyOf.nodes = [];
|
|
6426
|
-
|
|
6427
|
-
this.markDirty();
|
|
6428
|
-
|
|
6429
|
-
return this
|
|
6430
|
-
}
|
|
6431
|
-
|
|
6432
|
-
replaceValues(pattern, opts, callback) {
|
|
6433
|
-
if (!callback) {
|
|
6434
|
-
callback = opts;
|
|
6435
|
-
opts = {};
|
|
6436
|
-
}
|
|
6437
|
-
|
|
6438
|
-
this.walkDecls(decl => {
|
|
6439
|
-
if (opts.props && !opts.props.includes(decl.prop)) return
|
|
6440
|
-
if (opts.fast && !decl.value.includes(opts.fast)) return
|
|
6441
|
-
|
|
6442
|
-
decl.value = decl.value.replace(pattern, callback);
|
|
6443
|
-
});
|
|
6444
|
-
|
|
6445
|
-
this.markDirty();
|
|
6446
|
-
|
|
6447
|
-
return this
|
|
6448
|
-
}
|
|
6449
|
-
|
|
6450
|
-
every(condition) {
|
|
6451
|
-
return this.nodes.every(condition)
|
|
6452
|
-
}
|
|
6453
|
-
|
|
6454
|
-
some(condition) {
|
|
6455
|
-
return this.nodes.some(condition)
|
|
6456
|
-
}
|
|
6457
|
-
|
|
6458
|
-
index(child) {
|
|
6459
|
-
if (typeof child === 'number') return child
|
|
6460
|
-
if (child.proxyOf) child = child.proxyOf;
|
|
6461
|
-
return this.proxyOf.nodes.indexOf(child)
|
|
6462
|
-
}
|
|
6463
|
-
|
|
6464
|
-
get first() {
|
|
6465
|
-
if (!this.proxyOf.nodes) return undefined
|
|
6466
|
-
return this.proxyOf.nodes[0]
|
|
6467
|
-
}
|
|
6468
|
-
|
|
6469
|
-
get last() {
|
|
6470
|
-
if (!this.proxyOf.nodes) return undefined
|
|
6471
|
-
return this.proxyOf.nodes[this.proxyOf.nodes.length - 1]
|
|
6472
|
-
}
|
|
6473
|
-
|
|
6474
6384
|
normalize(nodes, sample) {
|
|
6475
6385
|
if (typeof nodes === 'string') {
|
|
6476
6386
|
nodes = cleanSource(parse$1(nodes).nodes);
|
|
@@ -6521,65 +6431,178 @@ class Container extends node_1 {
|
|
|
6521
6431
|
return processed
|
|
6522
6432
|
}
|
|
6523
6433
|
|
|
6524
|
-
|
|
6525
|
-
|
|
6526
|
-
|
|
6527
|
-
|
|
6528
|
-
|
|
6529
|
-
|
|
6530
|
-
|
|
6531
|
-
}
|
|
6532
|
-
return true
|
|
6533
|
-
},
|
|
6534
|
-
|
|
6535
|
-
get(node, prop) {
|
|
6536
|
-
if (prop === 'proxyOf') {
|
|
6537
|
-
return node
|
|
6538
|
-
} else if (!node[prop]) {
|
|
6539
|
-
return node[prop]
|
|
6540
|
-
} else if (
|
|
6541
|
-
prop === 'each' ||
|
|
6542
|
-
(typeof prop === 'string' && prop.startsWith('walk'))
|
|
6543
|
-
) {
|
|
6544
|
-
return (...args) => {
|
|
6545
|
-
return node[prop](
|
|
6546
|
-
...args.map(i => {
|
|
6547
|
-
if (typeof i === 'function') {
|
|
6548
|
-
return (child, index) => i(child.toProxy(), index)
|
|
6549
|
-
} else {
|
|
6550
|
-
return i
|
|
6551
|
-
}
|
|
6552
|
-
})
|
|
6553
|
-
)
|
|
6554
|
-
}
|
|
6555
|
-
} else if (prop === 'every' || prop === 'some') {
|
|
6556
|
-
return cb => {
|
|
6557
|
-
return node[prop]((child, ...other) =>
|
|
6558
|
-
cb(child.toProxy(), ...other)
|
|
6559
|
-
)
|
|
6560
|
-
}
|
|
6561
|
-
} else if (prop === 'root') {
|
|
6562
|
-
return () => node.root().toProxy()
|
|
6563
|
-
} else if (prop === 'nodes') {
|
|
6564
|
-
return node.nodes.map(i => i.toProxy())
|
|
6565
|
-
} else if (prop === 'first' || prop === 'last') {
|
|
6566
|
-
return node[prop].toProxy()
|
|
6567
|
-
} else {
|
|
6568
|
-
return node[prop]
|
|
6569
|
-
}
|
|
6434
|
+
prepend(...children) {
|
|
6435
|
+
children = children.reverse();
|
|
6436
|
+
for (let child of children) {
|
|
6437
|
+
let nodes = this.normalize(child, this.first, 'prepend').reverse();
|
|
6438
|
+
for (let node of nodes) this.proxyOf.nodes.unshift(node);
|
|
6439
|
+
for (let id in this.indexes) {
|
|
6440
|
+
this.indexes[id] = this.indexes[id] + nodes.length;
|
|
6570
6441
|
}
|
|
6571
6442
|
}
|
|
6572
|
-
}
|
|
6573
6443
|
|
|
6574
|
-
|
|
6575
|
-
if (!this.lastEach) this.lastEach = 0;
|
|
6576
|
-
if (!this.indexes) this.indexes = {};
|
|
6444
|
+
this.markDirty();
|
|
6577
6445
|
|
|
6578
|
-
this
|
|
6579
|
-
|
|
6580
|
-
this.indexes[iterator] = 0;
|
|
6446
|
+
return this
|
|
6447
|
+
}
|
|
6581
6448
|
|
|
6582
|
-
|
|
6449
|
+
push(child) {
|
|
6450
|
+
child.parent = this;
|
|
6451
|
+
this.proxyOf.nodes.push(child);
|
|
6452
|
+
return this
|
|
6453
|
+
}
|
|
6454
|
+
|
|
6455
|
+
removeAll() {
|
|
6456
|
+
for (let node of this.proxyOf.nodes) node.parent = undefined;
|
|
6457
|
+
this.proxyOf.nodes = [];
|
|
6458
|
+
|
|
6459
|
+
this.markDirty();
|
|
6460
|
+
|
|
6461
|
+
return this
|
|
6462
|
+
}
|
|
6463
|
+
|
|
6464
|
+
removeChild(child) {
|
|
6465
|
+
child = this.index(child);
|
|
6466
|
+
this.proxyOf.nodes[child].parent = undefined;
|
|
6467
|
+
this.proxyOf.nodes.splice(child, 1);
|
|
6468
|
+
|
|
6469
|
+
let index;
|
|
6470
|
+
for (let id in this.indexes) {
|
|
6471
|
+
index = this.indexes[id];
|
|
6472
|
+
if (index >= child) {
|
|
6473
|
+
this.indexes[id] = index - 1;
|
|
6474
|
+
}
|
|
6475
|
+
}
|
|
6476
|
+
|
|
6477
|
+
this.markDirty();
|
|
6478
|
+
|
|
6479
|
+
return this
|
|
6480
|
+
}
|
|
6481
|
+
|
|
6482
|
+
replaceValues(pattern, opts, callback) {
|
|
6483
|
+
if (!callback) {
|
|
6484
|
+
callback = opts;
|
|
6485
|
+
opts = {};
|
|
6486
|
+
}
|
|
6487
|
+
|
|
6488
|
+
this.walkDecls(decl => {
|
|
6489
|
+
if (opts.props && !opts.props.includes(decl.prop)) return
|
|
6490
|
+
if (opts.fast && !decl.value.includes(opts.fast)) return
|
|
6491
|
+
|
|
6492
|
+
decl.value = decl.value.replace(pattern, callback);
|
|
6493
|
+
});
|
|
6494
|
+
|
|
6495
|
+
this.markDirty();
|
|
6496
|
+
|
|
6497
|
+
return this
|
|
6498
|
+
}
|
|
6499
|
+
|
|
6500
|
+
some(condition) {
|
|
6501
|
+
return this.nodes.some(condition)
|
|
6502
|
+
}
|
|
6503
|
+
|
|
6504
|
+
walk(callback) {
|
|
6505
|
+
return this.each((child, i) => {
|
|
6506
|
+
let result;
|
|
6507
|
+
try {
|
|
6508
|
+
result = callback(child, i);
|
|
6509
|
+
} catch (e) {
|
|
6510
|
+
throw child.addToError(e)
|
|
6511
|
+
}
|
|
6512
|
+
if (result !== false && child.walk) {
|
|
6513
|
+
result = child.walk(callback);
|
|
6514
|
+
}
|
|
6515
|
+
|
|
6516
|
+
return result
|
|
6517
|
+
})
|
|
6518
|
+
}
|
|
6519
|
+
|
|
6520
|
+
walkAtRules(name, callback) {
|
|
6521
|
+
if (!callback) {
|
|
6522
|
+
callback = name;
|
|
6523
|
+
return this.walk((child, i) => {
|
|
6524
|
+
if (child.type === 'atrule') {
|
|
6525
|
+
return callback(child, i)
|
|
6526
|
+
}
|
|
6527
|
+
})
|
|
6528
|
+
}
|
|
6529
|
+
if (name instanceof RegExp) {
|
|
6530
|
+
return this.walk((child, i) => {
|
|
6531
|
+
if (child.type === 'atrule' && name.test(child.name)) {
|
|
6532
|
+
return callback(child, i)
|
|
6533
|
+
}
|
|
6534
|
+
})
|
|
6535
|
+
}
|
|
6536
|
+
return this.walk((child, i) => {
|
|
6537
|
+
if (child.type === 'atrule' && child.name === name) {
|
|
6538
|
+
return callback(child, i)
|
|
6539
|
+
}
|
|
6540
|
+
})
|
|
6541
|
+
}
|
|
6542
|
+
|
|
6543
|
+
walkComments(callback) {
|
|
6544
|
+
return this.walk((child, i) => {
|
|
6545
|
+
if (child.type === 'comment') {
|
|
6546
|
+
return callback(child, i)
|
|
6547
|
+
}
|
|
6548
|
+
})
|
|
6549
|
+
}
|
|
6550
|
+
|
|
6551
|
+
walkDecls(prop, callback) {
|
|
6552
|
+
if (!callback) {
|
|
6553
|
+
callback = prop;
|
|
6554
|
+
return this.walk((child, i) => {
|
|
6555
|
+
if (child.type === 'decl') {
|
|
6556
|
+
return callback(child, i)
|
|
6557
|
+
}
|
|
6558
|
+
})
|
|
6559
|
+
}
|
|
6560
|
+
if (prop instanceof RegExp) {
|
|
6561
|
+
return this.walk((child, i) => {
|
|
6562
|
+
if (child.type === 'decl' && prop.test(child.prop)) {
|
|
6563
|
+
return callback(child, i)
|
|
6564
|
+
}
|
|
6565
|
+
})
|
|
6566
|
+
}
|
|
6567
|
+
return this.walk((child, i) => {
|
|
6568
|
+
if (child.type === 'decl' && child.prop === prop) {
|
|
6569
|
+
return callback(child, i)
|
|
6570
|
+
}
|
|
6571
|
+
})
|
|
6572
|
+
}
|
|
6573
|
+
|
|
6574
|
+
walkRules(selector, callback) {
|
|
6575
|
+
if (!callback) {
|
|
6576
|
+
callback = selector;
|
|
6577
|
+
|
|
6578
|
+
return this.walk((child, i) => {
|
|
6579
|
+
if (child.type === 'rule') {
|
|
6580
|
+
return callback(child, i)
|
|
6581
|
+
}
|
|
6582
|
+
})
|
|
6583
|
+
}
|
|
6584
|
+
if (selector instanceof RegExp) {
|
|
6585
|
+
return this.walk((child, i) => {
|
|
6586
|
+
if (child.type === 'rule' && selector.test(child.selector)) {
|
|
6587
|
+
return callback(child, i)
|
|
6588
|
+
}
|
|
6589
|
+
})
|
|
6590
|
+
}
|
|
6591
|
+
return this.walk((child, i) => {
|
|
6592
|
+
if (child.type === 'rule' && child.selector === selector) {
|
|
6593
|
+
return callback(child, i)
|
|
6594
|
+
}
|
|
6595
|
+
})
|
|
6596
|
+
}
|
|
6597
|
+
|
|
6598
|
+
get first() {
|
|
6599
|
+
if (!this.proxyOf.nodes) return undefined
|
|
6600
|
+
return this.proxyOf.nodes[0]
|
|
6601
|
+
}
|
|
6602
|
+
|
|
6603
|
+
get last() {
|
|
6604
|
+
if (!this.proxyOf.nodes) return undefined
|
|
6605
|
+
return this.proxyOf.nodes[this.proxyOf.nodes.length - 1]
|
|
6583
6606
|
}
|
|
6584
6607
|
}
|
|
6585
6608
|
|
|
@@ -6674,8 +6697,8 @@ class Warning {
|
|
|
6674
6697
|
toString() {
|
|
6675
6698
|
if (this.node) {
|
|
6676
6699
|
return this.node.error(this.text, {
|
|
6677
|
-
plugin: this.plugin,
|
|
6678
6700
|
index: this.index,
|
|
6701
|
+
plugin: this.plugin,
|
|
6679
6702
|
word: this.word
|
|
6680
6703
|
}).message
|
|
6681
6704
|
}
|
|
@@ -6752,7 +6775,7 @@ const AT = '@'.charCodeAt(0);
|
|
|
6752
6775
|
|
|
6753
6776
|
const RE_AT_END = /[\t\n\f\r "#'()/;[\\\]{}]/g;
|
|
6754
6777
|
const RE_WORD_END = /[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g;
|
|
6755
|
-
const RE_BAD_BRACKET = /.[\n"'(/\\]/;
|
|
6778
|
+
const RE_BAD_BRACKET = /.[\r\n"'(/\\]/;
|
|
6756
6779
|
const RE_HEX_ESCAPE = /[\da-f]/i;
|
|
6757
6780
|
|
|
6758
6781
|
var tokenize = function tokenizer(input, options = {}) {
|
|
@@ -6989,8 +7012,8 @@ var tokenize = function tokenizer(input, options = {}) {
|
|
|
6989
7012
|
|
|
6990
7013
|
return {
|
|
6991
7014
|
back,
|
|
6992
|
-
nextToken,
|
|
6993
7015
|
endOfFile,
|
|
7016
|
+
nextToken,
|
|
6994
7017
|
position
|
|
6995
7018
|
}
|
|
6996
7019
|
};
|
|
@@ -7026,16 +7049,6 @@ class Root extends container {
|
|
|
7026
7049
|
if (!this.nodes) this.nodes = [];
|
|
7027
7050
|
}
|
|
7028
7051
|
|
|
7029
|
-
removeChild(child, ignore) {
|
|
7030
|
-
let index = this.index(child);
|
|
7031
|
-
|
|
7032
|
-
if (!ignore && index === 0 && this.nodes.length > 1) {
|
|
7033
|
-
this.nodes[1].raws.before = this.nodes[index].raws.before;
|
|
7034
|
-
}
|
|
7035
|
-
|
|
7036
|
-
return super.removeChild(child)
|
|
7037
|
-
}
|
|
7038
|
-
|
|
7039
7052
|
normalize(child, sample, type) {
|
|
7040
7053
|
let nodes = super.normalize(child);
|
|
7041
7054
|
|
|
@@ -7056,6 +7069,16 @@ class Root extends container {
|
|
|
7056
7069
|
return nodes
|
|
7057
7070
|
}
|
|
7058
7071
|
|
|
7072
|
+
removeChild(child, ignore) {
|
|
7073
|
+
let index = this.index(child);
|
|
7074
|
+
|
|
7075
|
+
if (!ignore && index === 0 && this.nodes.length > 1) {
|
|
7076
|
+
this.nodes[1].raws.before = this.nodes[index].raws.before;
|
|
7077
|
+
}
|
|
7078
|
+
|
|
7079
|
+
return super.removeChild(child)
|
|
7080
|
+
}
|
|
7081
|
+
|
|
7059
7082
|
toResult(opts = {}) {
|
|
7060
7083
|
let lazy = new LazyResult$1(new Processor$1(), this, opts);
|
|
7061
7084
|
return lazy.stringify()
|
|
@@ -7076,6 +7099,15 @@ Root.default = Root;
|
|
|
7076
7099
|
container.registerRoot(Root);
|
|
7077
7100
|
|
|
7078
7101
|
let list = {
|
|
7102
|
+
comma(string) {
|
|
7103
|
+
return list.split(string, [','], true)
|
|
7104
|
+
},
|
|
7105
|
+
|
|
7106
|
+
space(string) {
|
|
7107
|
+
let spaces = [' ', '\n', '\t'];
|
|
7108
|
+
return list.split(string, spaces)
|
|
7109
|
+
},
|
|
7110
|
+
|
|
7079
7111
|
split(string, separators, last) {
|
|
7080
7112
|
let array = [];
|
|
7081
7113
|
let current = '';
|
|
@@ -7117,15 +7149,6 @@ let list = {
|
|
|
7117
7149
|
|
|
7118
7150
|
if (last || current !== '') array.push(current.trim());
|
|
7119
7151
|
return array
|
|
7120
|
-
},
|
|
7121
|
-
|
|
7122
|
-
space(string) {
|
|
7123
|
-
let spaces = [' ', '\n', '\t'];
|
|
7124
|
-
return list.split(string, spaces)
|
|
7125
|
-
},
|
|
7126
|
-
|
|
7127
|
-
comma(string) {
|
|
7128
|
-
return list.split(string, [','], true)
|
|
7129
7152
|
}
|
|
7130
7153
|
};
|
|
7131
7154
|
|
|
@@ -7179,55 +7202,150 @@ class Parser {
|
|
|
7179
7202
|
this.customProperty = false;
|
|
7180
7203
|
|
|
7181
7204
|
this.createTokenizer();
|
|
7182
|
-
this.root.source = { input, start: {
|
|
7205
|
+
this.root.source = { input, start: { column: 1, line: 1, offset: 0 } };
|
|
7183
7206
|
}
|
|
7184
7207
|
|
|
7185
|
-
|
|
7186
|
-
|
|
7187
|
-
|
|
7208
|
+
atrule(token) {
|
|
7209
|
+
let node = new atRule();
|
|
7210
|
+
node.name = token[1].slice(1);
|
|
7211
|
+
if (node.name === '') {
|
|
7212
|
+
this.unnamedAtrule(node, token);
|
|
7213
|
+
}
|
|
7214
|
+
this.init(node, token[2]);
|
|
7215
|
+
|
|
7216
|
+
let type;
|
|
7217
|
+
let prev;
|
|
7218
|
+
let shift;
|
|
7219
|
+
let last = false;
|
|
7220
|
+
let open = false;
|
|
7221
|
+
let params = [];
|
|
7222
|
+
let brackets = [];
|
|
7188
7223
|
|
|
7189
|
-
parse() {
|
|
7190
|
-
let token;
|
|
7191
7224
|
while (!this.tokenizer.endOfFile()) {
|
|
7192
7225
|
token = this.tokenizer.nextToken();
|
|
7226
|
+
type = token[0];
|
|
7193
7227
|
|
|
7194
|
-
|
|
7195
|
-
|
|
7196
|
-
|
|
7197
|
-
|
|
7198
|
-
|
|
7199
|
-
|
|
7200
|
-
|
|
7201
|
-
break
|
|
7202
|
-
|
|
7203
|
-
case '}':
|
|
7204
|
-
this.end(token);
|
|
7205
|
-
break
|
|
7228
|
+
if (type === '(' || type === '[') {
|
|
7229
|
+
brackets.push(type === '(' ? ')' : ']');
|
|
7230
|
+
} else if (type === '{' && brackets.length > 0) {
|
|
7231
|
+
brackets.push('}');
|
|
7232
|
+
} else if (type === brackets[brackets.length - 1]) {
|
|
7233
|
+
brackets.pop();
|
|
7234
|
+
}
|
|
7206
7235
|
|
|
7207
|
-
|
|
7208
|
-
|
|
7236
|
+
if (brackets.length === 0) {
|
|
7237
|
+
if (type === ';') {
|
|
7238
|
+
node.source.end = this.getPosition(token[2]);
|
|
7239
|
+
node.source.end.offset++;
|
|
7240
|
+
this.semicolon = true;
|
|
7209
7241
|
break
|
|
7210
|
-
|
|
7211
|
-
|
|
7212
|
-
this.atrule(token);
|
|
7242
|
+
} else if (type === '{') {
|
|
7243
|
+
open = true;
|
|
7213
7244
|
break
|
|
7214
|
-
|
|
7215
|
-
|
|
7216
|
-
|
|
7245
|
+
} else if (type === '}') {
|
|
7246
|
+
if (params.length > 0) {
|
|
7247
|
+
shift = params.length - 1;
|
|
7248
|
+
prev = params[shift];
|
|
7249
|
+
while (prev && prev[0] === 'space') {
|
|
7250
|
+
prev = params[--shift];
|
|
7251
|
+
}
|
|
7252
|
+
if (prev) {
|
|
7253
|
+
node.source.end = this.getPosition(prev[3] || prev[2]);
|
|
7254
|
+
node.source.end.offset++;
|
|
7255
|
+
}
|
|
7256
|
+
}
|
|
7257
|
+
this.end(token);
|
|
7217
7258
|
break
|
|
7259
|
+
} else {
|
|
7260
|
+
params.push(token);
|
|
7261
|
+
}
|
|
7262
|
+
} else {
|
|
7263
|
+
params.push(token);
|
|
7264
|
+
}
|
|
7218
7265
|
|
|
7219
|
-
|
|
7220
|
-
|
|
7221
|
-
|
|
7266
|
+
if (this.tokenizer.endOfFile()) {
|
|
7267
|
+
last = true;
|
|
7268
|
+
break
|
|
7222
7269
|
}
|
|
7223
7270
|
}
|
|
7224
|
-
|
|
7271
|
+
|
|
7272
|
+
node.raws.between = this.spacesAndCommentsFromEnd(params);
|
|
7273
|
+
if (params.length) {
|
|
7274
|
+
node.raws.afterName = this.spacesAndCommentsFromStart(params);
|
|
7275
|
+
this.raw(node, 'params', params);
|
|
7276
|
+
if (last) {
|
|
7277
|
+
token = params[params.length - 1];
|
|
7278
|
+
node.source.end = this.getPosition(token[3] || token[2]);
|
|
7279
|
+
node.source.end.offset++;
|
|
7280
|
+
this.spaces = node.raws.between;
|
|
7281
|
+
node.raws.between = '';
|
|
7282
|
+
}
|
|
7283
|
+
} else {
|
|
7284
|
+
node.raws.afterName = '';
|
|
7285
|
+
node.params = '';
|
|
7286
|
+
}
|
|
7287
|
+
|
|
7288
|
+
if (open) {
|
|
7289
|
+
node.nodes = [];
|
|
7290
|
+
this.current = node;
|
|
7291
|
+
}
|
|
7292
|
+
}
|
|
7293
|
+
|
|
7294
|
+
checkMissedSemicolon(tokens) {
|
|
7295
|
+
let colon = this.colon(tokens);
|
|
7296
|
+
if (colon === false) return
|
|
7297
|
+
|
|
7298
|
+
let founded = 0;
|
|
7299
|
+
let token;
|
|
7300
|
+
for (let j = colon - 1; j >= 0; j--) {
|
|
7301
|
+
token = tokens[j];
|
|
7302
|
+
if (token[0] !== 'space') {
|
|
7303
|
+
founded += 1;
|
|
7304
|
+
if (founded === 2) break
|
|
7305
|
+
}
|
|
7306
|
+
}
|
|
7307
|
+
// If the token is a word, e.g. `!important`, `red` or any other valid property's value.
|
|
7308
|
+
// Then we need to return the colon after that word token. [3] is the "end" colon of that word.
|
|
7309
|
+
// And because we need it after that one we do +1 to get the next one.
|
|
7310
|
+
throw this.input.error(
|
|
7311
|
+
'Missed semicolon',
|
|
7312
|
+
token[0] === 'word' ? token[3] + 1 : token[2]
|
|
7313
|
+
)
|
|
7314
|
+
}
|
|
7315
|
+
|
|
7316
|
+
colon(tokens) {
|
|
7317
|
+
let brackets = 0;
|
|
7318
|
+
let token, type, prev;
|
|
7319
|
+
for (let [i, element] of tokens.entries()) {
|
|
7320
|
+
token = element;
|
|
7321
|
+
type = token[0];
|
|
7322
|
+
|
|
7323
|
+
if (type === '(') {
|
|
7324
|
+
brackets += 1;
|
|
7325
|
+
}
|
|
7326
|
+
if (type === ')') {
|
|
7327
|
+
brackets -= 1;
|
|
7328
|
+
}
|
|
7329
|
+
if (brackets === 0 && type === ':') {
|
|
7330
|
+
if (!prev) {
|
|
7331
|
+
this.doubleColon(token);
|
|
7332
|
+
} else if (prev[0] === 'word' && prev[1] === 'progid') {
|
|
7333
|
+
continue
|
|
7334
|
+
} else {
|
|
7335
|
+
return i
|
|
7336
|
+
}
|
|
7337
|
+
}
|
|
7338
|
+
|
|
7339
|
+
prev = token;
|
|
7340
|
+
}
|
|
7341
|
+
return false
|
|
7225
7342
|
}
|
|
7226
7343
|
|
|
7227
7344
|
comment(token) {
|
|
7228
7345
|
let node = new comment();
|
|
7229
7346
|
this.init(node, token[2]);
|
|
7230
7347
|
node.source.end = this.getPosition(token[3] || token[2]);
|
|
7348
|
+
node.source.end.offset++;
|
|
7231
7349
|
|
|
7232
7350
|
let text = token[1].slice(2, -2);
|
|
7233
7351
|
if (/^\s*$/.test(text)) {
|
|
@@ -7242,86 +7360,8 @@ class Parser {
|
|
|
7242
7360
|
}
|
|
7243
7361
|
}
|
|
7244
7362
|
|
|
7245
|
-
|
|
7246
|
-
|
|
7247
|
-
this.init(node, token[2]);
|
|
7248
|
-
node.selector = '';
|
|
7249
|
-
node.raws.between = '';
|
|
7250
|
-
this.current = node;
|
|
7251
|
-
}
|
|
7252
|
-
|
|
7253
|
-
other(start) {
|
|
7254
|
-
let end = false;
|
|
7255
|
-
let type = null;
|
|
7256
|
-
let colon = false;
|
|
7257
|
-
let bracket = null;
|
|
7258
|
-
let brackets = [];
|
|
7259
|
-
let customProperty = start[1].startsWith('--');
|
|
7260
|
-
|
|
7261
|
-
let tokens = [];
|
|
7262
|
-
let token = start;
|
|
7263
|
-
while (token) {
|
|
7264
|
-
type = token[0];
|
|
7265
|
-
tokens.push(token);
|
|
7266
|
-
|
|
7267
|
-
if (type === '(' || type === '[') {
|
|
7268
|
-
if (!bracket) bracket = token;
|
|
7269
|
-
brackets.push(type === '(' ? ')' : ']');
|
|
7270
|
-
} else if (customProperty && colon && type === '{') {
|
|
7271
|
-
if (!bracket) bracket = token;
|
|
7272
|
-
brackets.push('}');
|
|
7273
|
-
} else if (brackets.length === 0) {
|
|
7274
|
-
if (type === ';') {
|
|
7275
|
-
if (colon) {
|
|
7276
|
-
this.decl(tokens, customProperty);
|
|
7277
|
-
return
|
|
7278
|
-
} else {
|
|
7279
|
-
break
|
|
7280
|
-
}
|
|
7281
|
-
} else if (type === '{') {
|
|
7282
|
-
this.rule(tokens);
|
|
7283
|
-
return
|
|
7284
|
-
} else if (type === '}') {
|
|
7285
|
-
this.tokenizer.back(tokens.pop());
|
|
7286
|
-
end = true;
|
|
7287
|
-
break
|
|
7288
|
-
} else if (type === ':') {
|
|
7289
|
-
colon = true;
|
|
7290
|
-
}
|
|
7291
|
-
} else if (type === brackets[brackets.length - 1]) {
|
|
7292
|
-
brackets.pop();
|
|
7293
|
-
if (brackets.length === 0) bracket = null;
|
|
7294
|
-
}
|
|
7295
|
-
|
|
7296
|
-
token = this.tokenizer.nextToken();
|
|
7297
|
-
}
|
|
7298
|
-
|
|
7299
|
-
if (this.tokenizer.endOfFile()) end = true;
|
|
7300
|
-
if (brackets.length > 0) this.unclosedBracket(bracket);
|
|
7301
|
-
|
|
7302
|
-
if (end && colon) {
|
|
7303
|
-
if (!customProperty) {
|
|
7304
|
-
while (tokens.length) {
|
|
7305
|
-
token = tokens[tokens.length - 1][0];
|
|
7306
|
-
if (token !== 'space' && token !== 'comment') break
|
|
7307
|
-
this.tokenizer.back(tokens.pop());
|
|
7308
|
-
}
|
|
7309
|
-
}
|
|
7310
|
-
this.decl(tokens, customProperty);
|
|
7311
|
-
} else {
|
|
7312
|
-
this.unknownWord(tokens);
|
|
7313
|
-
}
|
|
7314
|
-
}
|
|
7315
|
-
|
|
7316
|
-
rule(tokens) {
|
|
7317
|
-
tokens.pop();
|
|
7318
|
-
|
|
7319
|
-
let node = new rule();
|
|
7320
|
-
this.init(node, tokens[0][2]);
|
|
7321
|
-
|
|
7322
|
-
node.raws.between = this.spacesAndCommentsFromEnd(tokens);
|
|
7323
|
-
this.raw(node, 'selector', tokens);
|
|
7324
|
-
this.current = node;
|
|
7363
|
+
createTokenizer() {
|
|
7364
|
+
this.tokenizer = tokenize(this.input);
|
|
7325
7365
|
}
|
|
7326
7366
|
|
|
7327
7367
|
decl(tokens, customProperty) {
|
|
@@ -7337,6 +7377,7 @@ class Parser {
|
|
|
7337
7377
|
node.source.end = this.getPosition(
|
|
7338
7378
|
last[3] || last[2] || findLastWithPosition(tokens)
|
|
7339
7379
|
);
|
|
7380
|
+
node.source.end.offset++;
|
|
7340
7381
|
|
|
7341
7382
|
while (tokens[0][0] !== 'word') {
|
|
7342
7383
|
if (tokens.length === 1) this.unknownWord(tokens);
|
|
@@ -7428,145 +7469,185 @@ class Parser {
|
|
|
7428
7469
|
}
|
|
7429
7470
|
}
|
|
7430
7471
|
|
|
7431
|
-
|
|
7432
|
-
|
|
7433
|
-
|
|
7434
|
-
|
|
7435
|
-
|
|
7436
|
-
|
|
7472
|
+
doubleColon(token) {
|
|
7473
|
+
throw this.input.error(
|
|
7474
|
+
'Double colon',
|
|
7475
|
+
{ offset: token[2] },
|
|
7476
|
+
{ offset: token[2] + token[1].length }
|
|
7477
|
+
)
|
|
7478
|
+
}
|
|
7479
|
+
|
|
7480
|
+
emptyRule(token) {
|
|
7481
|
+
let node = new rule();
|
|
7437
7482
|
this.init(node, token[2]);
|
|
7483
|
+
node.selector = '';
|
|
7484
|
+
node.raws.between = '';
|
|
7485
|
+
this.current = node;
|
|
7486
|
+
}
|
|
7438
7487
|
|
|
7439
|
-
|
|
7440
|
-
|
|
7441
|
-
|
|
7442
|
-
|
|
7443
|
-
|
|
7444
|
-
let params = [];
|
|
7445
|
-
let brackets = [];
|
|
7488
|
+
end(token) {
|
|
7489
|
+
if (this.current.nodes && this.current.nodes.length) {
|
|
7490
|
+
this.current.raws.semicolon = this.semicolon;
|
|
7491
|
+
}
|
|
7492
|
+
this.semicolon = false;
|
|
7446
7493
|
|
|
7447
|
-
|
|
7448
|
-
|
|
7449
|
-
type = token[0];
|
|
7494
|
+
this.current.raws.after = (this.current.raws.after || '') + this.spaces;
|
|
7495
|
+
this.spaces = '';
|
|
7450
7496
|
|
|
7451
|
-
|
|
7452
|
-
|
|
7453
|
-
|
|
7454
|
-
|
|
7455
|
-
|
|
7456
|
-
|
|
7497
|
+
if (this.current.parent) {
|
|
7498
|
+
this.current.source.end = this.getPosition(token[2]);
|
|
7499
|
+
this.current.source.end.offset++;
|
|
7500
|
+
this.current = this.current.parent;
|
|
7501
|
+
} else {
|
|
7502
|
+
this.unexpectedClose(token);
|
|
7503
|
+
}
|
|
7504
|
+
}
|
|
7505
|
+
|
|
7506
|
+
endFile() {
|
|
7507
|
+
if (this.current.parent) this.unclosedBlock();
|
|
7508
|
+
if (this.current.nodes && this.current.nodes.length) {
|
|
7509
|
+
this.current.raws.semicolon = this.semicolon;
|
|
7510
|
+
}
|
|
7511
|
+
this.current.raws.after = (this.current.raws.after || '') + this.spaces;
|
|
7512
|
+
this.root.source.end = this.getPosition(this.tokenizer.position());
|
|
7513
|
+
}
|
|
7514
|
+
|
|
7515
|
+
freeSemicolon(token) {
|
|
7516
|
+
this.spaces += token[1];
|
|
7517
|
+
if (this.current.nodes) {
|
|
7518
|
+
let prev = this.current.nodes[this.current.nodes.length - 1];
|
|
7519
|
+
if (prev && prev.type === 'rule' && !prev.raws.ownSemicolon) {
|
|
7520
|
+
prev.raws.ownSemicolon = this.spaces;
|
|
7521
|
+
this.spaces = '';
|
|
7457
7522
|
}
|
|
7523
|
+
}
|
|
7524
|
+
}
|
|
7458
7525
|
|
|
7459
|
-
|
|
7460
|
-
|
|
7461
|
-
|
|
7462
|
-
|
|
7463
|
-
|
|
7464
|
-
|
|
7465
|
-
|
|
7466
|
-
|
|
7467
|
-
|
|
7468
|
-
|
|
7469
|
-
|
|
7470
|
-
|
|
7471
|
-
|
|
7472
|
-
|
|
7473
|
-
|
|
7474
|
-
|
|
7475
|
-
|
|
7476
|
-
|
|
7526
|
+
// Helpers
|
|
7527
|
+
|
|
7528
|
+
getPosition(offset) {
|
|
7529
|
+
let pos = this.input.fromOffset(offset);
|
|
7530
|
+
return {
|
|
7531
|
+
column: pos.col,
|
|
7532
|
+
line: pos.line,
|
|
7533
|
+
offset
|
|
7534
|
+
}
|
|
7535
|
+
}
|
|
7536
|
+
|
|
7537
|
+
init(node, offset) {
|
|
7538
|
+
this.current.push(node);
|
|
7539
|
+
node.source = {
|
|
7540
|
+
input: this.input,
|
|
7541
|
+
start: this.getPosition(offset)
|
|
7542
|
+
};
|
|
7543
|
+
node.raws.before = this.spaces;
|
|
7544
|
+
this.spaces = '';
|
|
7545
|
+
if (node.type !== 'comment') this.semicolon = false;
|
|
7546
|
+
}
|
|
7547
|
+
|
|
7548
|
+
other(start) {
|
|
7549
|
+
let end = false;
|
|
7550
|
+
let type = null;
|
|
7551
|
+
let colon = false;
|
|
7552
|
+
let bracket = null;
|
|
7553
|
+
let brackets = [];
|
|
7554
|
+
let customProperty = start[1].startsWith('--');
|
|
7555
|
+
|
|
7556
|
+
let tokens = [];
|
|
7557
|
+
let token = start;
|
|
7558
|
+
while (token) {
|
|
7559
|
+
type = token[0];
|
|
7560
|
+
tokens.push(token);
|
|
7561
|
+
|
|
7562
|
+
if (type === '(' || type === '[') {
|
|
7563
|
+
if (!bracket) bracket = token;
|
|
7564
|
+
brackets.push(type === '(' ? ')' : ']');
|
|
7565
|
+
} else if (customProperty && colon && type === '{') {
|
|
7566
|
+
if (!bracket) bracket = token;
|
|
7567
|
+
brackets.push('}');
|
|
7568
|
+
} else if (brackets.length === 0) {
|
|
7569
|
+
if (type === ';') {
|
|
7570
|
+
if (colon) {
|
|
7571
|
+
this.decl(tokens, customProperty);
|
|
7572
|
+
return
|
|
7573
|
+
} else {
|
|
7574
|
+
break
|
|
7477
7575
|
}
|
|
7478
|
-
|
|
7576
|
+
} else if (type === '{') {
|
|
7577
|
+
this.rule(tokens);
|
|
7578
|
+
return
|
|
7579
|
+
} else if (type === '}') {
|
|
7580
|
+
this.tokenizer.back(tokens.pop());
|
|
7581
|
+
end = true;
|
|
7479
7582
|
break
|
|
7480
|
-
} else {
|
|
7481
|
-
|
|
7583
|
+
} else if (type === ':') {
|
|
7584
|
+
colon = true;
|
|
7482
7585
|
}
|
|
7483
|
-
} else {
|
|
7484
|
-
|
|
7586
|
+
} else if (type === brackets[brackets.length - 1]) {
|
|
7587
|
+
brackets.pop();
|
|
7588
|
+
if (brackets.length === 0) bracket = null;
|
|
7485
7589
|
}
|
|
7486
7590
|
|
|
7487
|
-
|
|
7488
|
-
last = true;
|
|
7489
|
-
break
|
|
7490
|
-
}
|
|
7591
|
+
token = this.tokenizer.nextToken();
|
|
7491
7592
|
}
|
|
7492
7593
|
|
|
7493
|
-
|
|
7494
|
-
if (
|
|
7495
|
-
|
|
7496
|
-
|
|
7497
|
-
if (
|
|
7498
|
-
|
|
7499
|
-
|
|
7500
|
-
|
|
7501
|
-
|
|
7594
|
+
if (this.tokenizer.endOfFile()) end = true;
|
|
7595
|
+
if (brackets.length > 0) this.unclosedBracket(bracket);
|
|
7596
|
+
|
|
7597
|
+
if (end && colon) {
|
|
7598
|
+
if (!customProperty) {
|
|
7599
|
+
while (tokens.length) {
|
|
7600
|
+
token = tokens[tokens.length - 1][0];
|
|
7601
|
+
if (token !== 'space' && token !== 'comment') break
|
|
7602
|
+
this.tokenizer.back(tokens.pop());
|
|
7603
|
+
}
|
|
7502
7604
|
}
|
|
7605
|
+
this.decl(tokens, customProperty);
|
|
7503
7606
|
} else {
|
|
7504
|
-
|
|
7505
|
-
node.params = '';
|
|
7506
|
-
}
|
|
7507
|
-
|
|
7508
|
-
if (open) {
|
|
7509
|
-
node.nodes = [];
|
|
7510
|
-
this.current = node;
|
|
7607
|
+
this.unknownWord(tokens);
|
|
7511
7608
|
}
|
|
7512
7609
|
}
|
|
7513
7610
|
|
|
7514
|
-
|
|
7515
|
-
|
|
7516
|
-
|
|
7517
|
-
|
|
7518
|
-
this.semicolon = false;
|
|
7611
|
+
parse() {
|
|
7612
|
+
let token;
|
|
7613
|
+
while (!this.tokenizer.endOfFile()) {
|
|
7614
|
+
token = this.tokenizer.nextToken();
|
|
7519
7615
|
|
|
7520
|
-
|
|
7521
|
-
|
|
7616
|
+
switch (token[0]) {
|
|
7617
|
+
case 'space':
|
|
7618
|
+
this.spaces += token[1];
|
|
7619
|
+
break
|
|
7522
7620
|
|
|
7523
|
-
|
|
7524
|
-
|
|
7525
|
-
|
|
7526
|
-
} else {
|
|
7527
|
-
this.unexpectedClose(token);
|
|
7528
|
-
}
|
|
7529
|
-
}
|
|
7621
|
+
case ';':
|
|
7622
|
+
this.freeSemicolon(token);
|
|
7623
|
+
break
|
|
7530
7624
|
|
|
7531
|
-
|
|
7532
|
-
|
|
7533
|
-
|
|
7534
|
-
this.current.raws.semicolon = this.semicolon;
|
|
7535
|
-
}
|
|
7536
|
-
this.current.raws.after = (this.current.raws.after || '') + this.spaces;
|
|
7537
|
-
}
|
|
7625
|
+
case '}':
|
|
7626
|
+
this.end(token);
|
|
7627
|
+
break
|
|
7538
7628
|
|
|
7539
|
-
|
|
7540
|
-
|
|
7541
|
-
|
|
7542
|
-
let prev = this.current.nodes[this.current.nodes.length - 1];
|
|
7543
|
-
if (prev && prev.type === 'rule' && !prev.raws.ownSemicolon) {
|
|
7544
|
-
prev.raws.ownSemicolon = this.spaces;
|
|
7545
|
-
this.spaces = '';
|
|
7546
|
-
}
|
|
7547
|
-
}
|
|
7548
|
-
}
|
|
7629
|
+
case 'comment':
|
|
7630
|
+
this.comment(token);
|
|
7631
|
+
break
|
|
7549
7632
|
|
|
7550
|
-
|
|
7633
|
+
case 'at-word':
|
|
7634
|
+
this.atrule(token);
|
|
7635
|
+
break
|
|
7551
7636
|
|
|
7552
|
-
|
|
7553
|
-
|
|
7554
|
-
|
|
7555
|
-
|
|
7556
|
-
|
|
7557
|
-
|
|
7637
|
+
case '{':
|
|
7638
|
+
this.emptyRule(token);
|
|
7639
|
+
break
|
|
7640
|
+
|
|
7641
|
+
default:
|
|
7642
|
+
this.other(token);
|
|
7643
|
+
break
|
|
7644
|
+
}
|
|
7558
7645
|
}
|
|
7646
|
+
this.endFile();
|
|
7559
7647
|
}
|
|
7560
7648
|
|
|
7561
|
-
|
|
7562
|
-
|
|
7563
|
-
node.source = {
|
|
7564
|
-
start: this.getPosition(offset),
|
|
7565
|
-
input: this.input
|
|
7566
|
-
};
|
|
7567
|
-
node.raws.before = this.spaces;
|
|
7568
|
-
this.spaces = '';
|
|
7569
|
-
if (node.type !== 'comment') this.semicolon = false;
|
|
7649
|
+
precheckMissedSemicolon(/* tokens */) {
|
|
7650
|
+
// Hook for Safe Parser
|
|
7570
7651
|
}
|
|
7571
7652
|
|
|
7572
7653
|
raw(node, prop, tokens, customProperty) {
|
|
@@ -7599,11 +7680,22 @@ class Parser {
|
|
|
7599
7680
|
}
|
|
7600
7681
|
if (!clean) {
|
|
7601
7682
|
let raw = tokens.reduce((all, i) => all + i[1], '');
|
|
7602
|
-
node.raws[prop] = {
|
|
7683
|
+
node.raws[prop] = { raw, value };
|
|
7603
7684
|
}
|
|
7604
7685
|
node[prop] = value;
|
|
7605
7686
|
}
|
|
7606
7687
|
|
|
7688
|
+
rule(tokens) {
|
|
7689
|
+
tokens.pop();
|
|
7690
|
+
|
|
7691
|
+
let node = new rule();
|
|
7692
|
+
this.init(node, tokens[0][2]);
|
|
7693
|
+
|
|
7694
|
+
node.raws.between = this.spacesAndCommentsFromEnd(tokens);
|
|
7695
|
+
this.raw(node, 'selector', tokens);
|
|
7696
|
+
this.current = node;
|
|
7697
|
+
}
|
|
7698
|
+
|
|
7607
7699
|
spacesAndCommentsFromEnd(tokens) {
|
|
7608
7700
|
let lastTokenType;
|
|
7609
7701
|
let spaces = '';
|
|
@@ -7615,6 +7707,8 @@ class Parser {
|
|
|
7615
7707
|
return spaces
|
|
7616
7708
|
}
|
|
7617
7709
|
|
|
7710
|
+
// Errors
|
|
7711
|
+
|
|
7618
7712
|
spacesAndCommentsFromStart(tokens) {
|
|
7619
7713
|
let next;
|
|
7620
7714
|
let spaces = '';
|
|
@@ -7646,36 +7740,11 @@ class Parser {
|
|
|
7646
7740
|
return result
|
|
7647
7741
|
}
|
|
7648
7742
|
|
|
7649
|
-
|
|
7650
|
-
let
|
|
7651
|
-
|
|
7652
|
-
for (let [i, element] of tokens.entries()) {
|
|
7653
|
-
token = element;
|
|
7654
|
-
type = token[0];
|
|
7655
|
-
|
|
7656
|
-
if (type === '(') {
|
|
7657
|
-
brackets += 1;
|
|
7658
|
-
}
|
|
7659
|
-
if (type === ')') {
|
|
7660
|
-
brackets -= 1;
|
|
7661
|
-
}
|
|
7662
|
-
if (brackets === 0 && type === ':') {
|
|
7663
|
-
if (!prev) {
|
|
7664
|
-
this.doubleColon(token);
|
|
7665
|
-
} else if (prev[0] === 'word' && prev[1] === 'progid') {
|
|
7666
|
-
continue
|
|
7667
|
-
} else {
|
|
7668
|
-
return i
|
|
7669
|
-
}
|
|
7670
|
-
}
|
|
7671
|
-
|
|
7672
|
-
prev = token;
|
|
7673
|
-
}
|
|
7674
|
-
return false
|
|
7743
|
+
unclosedBlock() {
|
|
7744
|
+
let pos = this.current.source.start;
|
|
7745
|
+
throw this.input.error('Unclosed block', pos.line, pos.column)
|
|
7675
7746
|
}
|
|
7676
7747
|
|
|
7677
|
-
// Errors
|
|
7678
|
-
|
|
7679
7748
|
unclosedBracket(bracket) {
|
|
7680
7749
|
throw this.input.error(
|
|
7681
7750
|
'Unclosed bracket',
|
|
@@ -7684,14 +7753,6 @@ class Parser {
|
|
|
7684
7753
|
)
|
|
7685
7754
|
}
|
|
7686
7755
|
|
|
7687
|
-
unknownWord(tokens) {
|
|
7688
|
-
throw this.input.error(
|
|
7689
|
-
'Unknown word',
|
|
7690
|
-
{ offset: tokens[0][2] },
|
|
7691
|
-
{ offset: tokens[0][2] + tokens[0][1].length }
|
|
7692
|
-
)
|
|
7693
|
-
}
|
|
7694
|
-
|
|
7695
7756
|
unexpectedClose(token) {
|
|
7696
7757
|
throw this.input.error(
|
|
7697
7758
|
'Unexpected }',
|
|
@@ -7700,16 +7761,11 @@ class Parser {
|
|
|
7700
7761
|
)
|
|
7701
7762
|
}
|
|
7702
7763
|
|
|
7703
|
-
|
|
7704
|
-
let pos = this.current.source.start;
|
|
7705
|
-
throw this.input.error('Unclosed block', pos.line, pos.column)
|
|
7706
|
-
}
|
|
7707
|
-
|
|
7708
|
-
doubleColon(token) {
|
|
7764
|
+
unknownWord(tokens) {
|
|
7709
7765
|
throw this.input.error(
|
|
7710
|
-
'
|
|
7711
|
-
{ offset:
|
|
7712
|
-
{ offset:
|
|
7766
|
+
'Unknown word',
|
|
7767
|
+
{ offset: tokens[0][2] },
|
|
7768
|
+
{ offset: tokens[0][2] + tokens[0][1].length }
|
|
7713
7769
|
)
|
|
7714
7770
|
}
|
|
7715
7771
|
|
|
@@ -7720,43 +7776,17 @@ class Parser {
|
|
|
7720
7776
|
{ offset: token[2] + token[1].length }
|
|
7721
7777
|
)
|
|
7722
7778
|
}
|
|
7779
|
+
}
|
|
7723
7780
|
|
|
7724
|
-
|
|
7725
|
-
|
|
7726
|
-
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
|
|
7730
|
-
|
|
7731
|
-
|
|
7732
|
-
|
|
7733
|
-
let token;
|
|
7734
|
-
for (let j = colon - 1; j >= 0; j--) {
|
|
7735
|
-
token = tokens[j];
|
|
7736
|
-
if (token[0] !== 'space') {
|
|
7737
|
-
founded += 1;
|
|
7738
|
-
if (founded === 2) break
|
|
7739
|
-
}
|
|
7740
|
-
}
|
|
7741
|
-
// If the token is a word, e.g. `!important`, `red` or any other valid property's value.
|
|
7742
|
-
// Then we need to return the colon after that word token. [3] is the "end" colon of that word.
|
|
7743
|
-
// And because we need it after that one we do +1 to get the next one.
|
|
7744
|
-
throw this.input.error(
|
|
7745
|
-
'Missed semicolon',
|
|
7746
|
-
token[0] === 'word' ? token[3] + 1 : token[2]
|
|
7747
|
-
)
|
|
7748
|
-
}
|
|
7749
|
-
}
|
|
7750
|
-
|
|
7751
|
-
var parser = Parser;
|
|
7752
|
-
|
|
7753
|
-
function parse(css, opts) {
|
|
7754
|
-
let input$1 = new input(css, opts);
|
|
7755
|
-
let parser$1 = new parser(input$1);
|
|
7756
|
-
try {
|
|
7757
|
-
parser$1.parse();
|
|
7758
|
-
} catch (e) {
|
|
7759
|
-
throw e
|
|
7781
|
+
var parser = Parser;
|
|
7782
|
+
|
|
7783
|
+
function parse(css, opts) {
|
|
7784
|
+
let input$1 = new input(css, opts);
|
|
7785
|
+
let parser$1 = new parser(input$1);
|
|
7786
|
+
try {
|
|
7787
|
+
parser$1.parse();
|
|
7788
|
+
} catch (e) {
|
|
7789
|
+
throw e
|
|
7760
7790
|
}
|
|
7761
7791
|
|
|
7762
7792
|
return parser$1.root
|
|
@@ -7778,37 +7808,37 @@ let { isClean, my } = symbols;
|
|
|
7778
7808
|
|
|
7779
7809
|
|
|
7780
7810
|
const TYPE_TO_CLASS_NAME = {
|
|
7781
|
-
document: 'Document',
|
|
7782
|
-
root: 'Root',
|
|
7783
7811
|
atrule: 'AtRule',
|
|
7784
|
-
|
|
7812
|
+
comment: 'Comment',
|
|
7785
7813
|
decl: 'Declaration',
|
|
7786
|
-
|
|
7814
|
+
document: 'Document',
|
|
7815
|
+
root: 'Root',
|
|
7816
|
+
rule: 'Rule'
|
|
7787
7817
|
};
|
|
7788
7818
|
|
|
7789
7819
|
const PLUGIN_PROPS = {
|
|
7790
|
-
postcssPlugin: true,
|
|
7791
|
-
prepare: true,
|
|
7792
|
-
Once: true,
|
|
7793
|
-
Document: true,
|
|
7794
|
-
Root: true,
|
|
7795
|
-
Declaration: true,
|
|
7796
|
-
Rule: true,
|
|
7797
7820
|
AtRule: true,
|
|
7798
|
-
Comment: true,
|
|
7799
|
-
DeclarationExit: true,
|
|
7800
|
-
RuleExit: true,
|
|
7801
7821
|
AtRuleExit: true,
|
|
7822
|
+
Comment: true,
|
|
7802
7823
|
CommentExit: true,
|
|
7803
|
-
|
|
7824
|
+
Declaration: true,
|
|
7825
|
+
DeclarationExit: true,
|
|
7826
|
+
Document: true,
|
|
7804
7827
|
DocumentExit: true,
|
|
7805
|
-
|
|
7828
|
+
Once: true,
|
|
7829
|
+
OnceExit: true,
|
|
7830
|
+
postcssPlugin: true,
|
|
7831
|
+
prepare: true,
|
|
7832
|
+
Root: true,
|
|
7833
|
+
RootExit: true,
|
|
7834
|
+
Rule: true,
|
|
7835
|
+
RuleExit: true
|
|
7806
7836
|
};
|
|
7807
7837
|
|
|
7808
7838
|
const NOT_VISITORS = {
|
|
7839
|
+
Once: true,
|
|
7809
7840
|
postcssPlugin: true,
|
|
7810
|
-
prepare: true
|
|
7811
|
-
Once: true
|
|
7841
|
+
prepare: true
|
|
7812
7842
|
};
|
|
7813
7843
|
|
|
7814
7844
|
const CHILDREN = 0;
|
|
@@ -7854,12 +7884,12 @@ function toStack(node) {
|
|
|
7854
7884
|
}
|
|
7855
7885
|
|
|
7856
7886
|
return {
|
|
7857
|
-
node,
|
|
7858
|
-
events,
|
|
7859
7887
|
eventIndex: 0,
|
|
7860
|
-
|
|
7888
|
+
events,
|
|
7889
|
+
iterator: 0,
|
|
7890
|
+
node,
|
|
7861
7891
|
visitorIndex: 0,
|
|
7862
|
-
|
|
7892
|
+
visitors: []
|
|
7863
7893
|
}
|
|
7864
7894
|
}
|
|
7865
7895
|
|
|
@@ -7910,7 +7940,7 @@ class LazyResult {
|
|
|
7910
7940
|
}
|
|
7911
7941
|
|
|
7912
7942
|
this.result = new result(processor, root, opts);
|
|
7913
|
-
this.helpers = { ...postcss$1, result: this.result
|
|
7943
|
+
this.helpers = { ...postcss$1, postcss: postcss$1, result: this.result };
|
|
7914
7944
|
this.plugins = this.processor.plugins.map(plugin => {
|
|
7915
7945
|
if (typeof plugin === 'object' && plugin.prepare) {
|
|
7916
7946
|
return { ...plugin, ...plugin.prepare(this.result) }
|
|
@@ -7920,48 +7950,13 @@ class LazyResult {
|
|
|
7920
7950
|
});
|
|
7921
7951
|
}
|
|
7922
7952
|
|
|
7923
|
-
|
|
7924
|
-
return
|
|
7925
|
-
|
|
7926
|
-
|
|
7927
|
-
|
|
7928
|
-
|
|
7929
|
-
|
|
7930
|
-
|
|
7931
|
-
get opts() {
|
|
7932
|
-
return this.result.opts
|
|
7933
|
-
}
|
|
7934
|
-
|
|
7935
|
-
get css() {
|
|
7936
|
-
return this.stringify().css
|
|
7937
|
-
}
|
|
7938
|
-
|
|
7939
|
-
get content() {
|
|
7940
|
-
return this.stringify().content
|
|
7941
|
-
}
|
|
7942
|
-
|
|
7943
|
-
get map() {
|
|
7944
|
-
return this.stringify().map
|
|
7945
|
-
}
|
|
7946
|
-
|
|
7947
|
-
get root() {
|
|
7948
|
-
return this.sync().root
|
|
7949
|
-
}
|
|
7950
|
-
|
|
7951
|
-
get messages() {
|
|
7952
|
-
return this.sync().messages
|
|
7953
|
-
}
|
|
7954
|
-
|
|
7955
|
-
warnings() {
|
|
7956
|
-
return this.sync().warnings()
|
|
7957
|
-
}
|
|
7958
|
-
|
|
7959
|
-
toString() {
|
|
7960
|
-
return this.css
|
|
7961
|
-
}
|
|
7962
|
-
|
|
7963
|
-
then(onFulfilled, onRejected) {
|
|
7964
|
-
return this.async().then(onFulfilled, onRejected)
|
|
7953
|
+
async() {
|
|
7954
|
+
if (this.error) return Promise.reject(this.error)
|
|
7955
|
+
if (this.processed) return Promise.resolve(this.result)
|
|
7956
|
+
if (!this.processing) {
|
|
7957
|
+
this.processing = this.runAsync();
|
|
7958
|
+
}
|
|
7959
|
+
return this.processing
|
|
7965
7960
|
}
|
|
7966
7961
|
|
|
7967
7962
|
catch(onRejected) {
|
|
@@ -7972,28 +7967,76 @@ class LazyResult {
|
|
|
7972
7967
|
return this.async().then(onFinally, onFinally)
|
|
7973
7968
|
}
|
|
7974
7969
|
|
|
7975
|
-
|
|
7976
|
-
|
|
7977
|
-
if (this.processed) return Promise.resolve(this.result)
|
|
7978
|
-
if (!this.processing) {
|
|
7979
|
-
this.processing = this.runAsync();
|
|
7980
|
-
}
|
|
7981
|
-
return this.processing
|
|
7970
|
+
getAsyncError() {
|
|
7971
|
+
throw new Error('Use process(css).then(cb) to work with async plugins')
|
|
7982
7972
|
}
|
|
7983
7973
|
|
|
7984
|
-
|
|
7985
|
-
|
|
7986
|
-
|
|
7987
|
-
|
|
7988
|
-
|
|
7989
|
-
|
|
7990
|
-
|
|
7974
|
+
handleError(error, node) {
|
|
7975
|
+
let plugin = this.result.lastPlugin;
|
|
7976
|
+
try {
|
|
7977
|
+
if (node) node.addToError(error);
|
|
7978
|
+
this.error = error;
|
|
7979
|
+
if (error.name === 'CssSyntaxError' && !error.plugin) {
|
|
7980
|
+
error.plugin = plugin.postcssPlugin;
|
|
7981
|
+
error.setMessage();
|
|
7982
|
+
}
|
|
7983
|
+
} catch (err) {
|
|
7984
|
+
/* c8 ignore next 3 */
|
|
7985
|
+
// eslint-disable-next-line no-console
|
|
7986
|
+
if (console && console.error) console.error(err);
|
|
7991
7987
|
}
|
|
7988
|
+
return error
|
|
7989
|
+
}
|
|
7992
7990
|
|
|
7991
|
+
prepareVisitors() {
|
|
7992
|
+
this.listeners = {};
|
|
7993
|
+
let add = (plugin, type, cb) => {
|
|
7994
|
+
if (!this.listeners[type]) this.listeners[type] = [];
|
|
7995
|
+
this.listeners[type].push([plugin, cb]);
|
|
7996
|
+
};
|
|
7993
7997
|
for (let plugin of this.plugins) {
|
|
7998
|
+
if (typeof plugin === 'object') {
|
|
7999
|
+
for (let event in plugin) {
|
|
8000
|
+
if (!PLUGIN_PROPS[event] && /^[A-Z]/.test(event)) {
|
|
8001
|
+
throw new Error(
|
|
8002
|
+
`Unknown event ${event} in ${plugin.postcssPlugin}. ` +
|
|
8003
|
+
`Try to update PostCSS (${this.processor.version} now).`
|
|
8004
|
+
)
|
|
8005
|
+
}
|
|
8006
|
+
if (!NOT_VISITORS[event]) {
|
|
8007
|
+
if (typeof plugin[event] === 'object') {
|
|
8008
|
+
for (let filter in plugin[event]) {
|
|
8009
|
+
if (filter === '*') {
|
|
8010
|
+
add(plugin, event, plugin[event][filter]);
|
|
8011
|
+
} else {
|
|
8012
|
+
add(
|
|
8013
|
+
plugin,
|
|
8014
|
+
event + '-' + filter.toLowerCase(),
|
|
8015
|
+
plugin[event][filter]
|
|
8016
|
+
);
|
|
8017
|
+
}
|
|
8018
|
+
}
|
|
8019
|
+
} else if (typeof plugin[event] === 'function') {
|
|
8020
|
+
add(plugin, event, plugin[event]);
|
|
8021
|
+
}
|
|
8022
|
+
}
|
|
8023
|
+
}
|
|
8024
|
+
}
|
|
8025
|
+
}
|
|
8026
|
+
this.hasListener = Object.keys(this.listeners).length > 0;
|
|
8027
|
+
}
|
|
8028
|
+
|
|
8029
|
+
async runAsync() {
|
|
8030
|
+
this.plugin = 0;
|
|
8031
|
+
for (let i = 0; i < this.plugins.length; i++) {
|
|
8032
|
+
let plugin = this.plugins[i];
|
|
7994
8033
|
let promise = this.runOnRoot(plugin);
|
|
7995
8034
|
if (isPromise(promise)) {
|
|
7996
|
-
|
|
8035
|
+
try {
|
|
8036
|
+
await promise;
|
|
8037
|
+
} catch (error) {
|
|
8038
|
+
throw this.handleError(error)
|
|
8039
|
+
}
|
|
7997
8040
|
}
|
|
7998
8041
|
}
|
|
7999
8042
|
|
|
@@ -8002,78 +8045,42 @@ class LazyResult {
|
|
|
8002
8045
|
let root = this.result.root;
|
|
8003
8046
|
while (!root[isClean]) {
|
|
8004
8047
|
root[isClean] = true;
|
|
8005
|
-
|
|
8006
|
-
|
|
8007
|
-
|
|
8008
|
-
|
|
8009
|
-
|
|
8010
|
-
|
|
8048
|
+
let stack = [toStack(root)];
|
|
8049
|
+
while (stack.length > 0) {
|
|
8050
|
+
let promise = this.visitTick(stack);
|
|
8051
|
+
if (isPromise(promise)) {
|
|
8052
|
+
try {
|
|
8053
|
+
await promise;
|
|
8054
|
+
} catch (e) {
|
|
8055
|
+
let node = stack[stack.length - 1].node;
|
|
8056
|
+
throw this.handleError(e, node)
|
|
8057
|
+
}
|
|
8011
8058
|
}
|
|
8012
|
-
} else {
|
|
8013
|
-
this.visitSync(this.listeners.OnceExit, root);
|
|
8014
8059
|
}
|
|
8015
8060
|
}
|
|
8016
|
-
}
|
|
8017
|
-
|
|
8018
|
-
return this.result
|
|
8019
|
-
}
|
|
8020
|
-
|
|
8021
|
-
stringify() {
|
|
8022
|
-
if (this.error) throw this.error
|
|
8023
|
-
if (this.stringified) return this.result
|
|
8024
|
-
this.stringified = true;
|
|
8025
|
-
|
|
8026
|
-
this.sync();
|
|
8027
8061
|
|
|
8028
|
-
|
|
8029
|
-
|
|
8030
|
-
|
|
8031
|
-
|
|
8032
|
-
|
|
8033
|
-
|
|
8034
|
-
|
|
8035
|
-
|
|
8036
|
-
this.result.css = data[0];
|
|
8037
|
-
this.result.map = data[1];
|
|
8038
|
-
|
|
8039
|
-
return this.result
|
|
8040
|
-
}
|
|
8062
|
+
if (this.listeners.OnceExit) {
|
|
8063
|
+
for (let [plugin, visitor] of this.listeners.OnceExit) {
|
|
8064
|
+
this.result.lastPlugin = plugin;
|
|
8065
|
+
try {
|
|
8066
|
+
if (root.type === 'document') {
|
|
8067
|
+
let roots = root.nodes.map(subRoot =>
|
|
8068
|
+
visitor(subRoot, this.helpers)
|
|
8069
|
+
);
|
|
8041
8070
|
|
|
8042
|
-
|
|
8043
|
-
|
|
8044
|
-
|
|
8045
|
-
|
|
8046
|
-
|
|
8047
|
-
|
|
8048
|
-
|
|
8049
|
-
if (!child[isClean]) this.walkSync(child);
|
|
8050
|
-
});
|
|
8051
|
-
}
|
|
8052
|
-
} else {
|
|
8053
|
-
let visitors = this.listeners[event];
|
|
8054
|
-
if (visitors) {
|
|
8055
|
-
if (this.visitSync(visitors, node.toProxy())) return
|
|
8071
|
+
await Promise.all(roots);
|
|
8072
|
+
} else {
|
|
8073
|
+
await visitor(root, this.helpers);
|
|
8074
|
+
}
|
|
8075
|
+
} catch (e) {
|
|
8076
|
+
throw this.handleError(e)
|
|
8077
|
+
}
|
|
8056
8078
|
}
|
|
8057
8079
|
}
|
|
8058
8080
|
}
|
|
8059
|
-
}
|
|
8060
8081
|
|
|
8061
|
-
|
|
8062
|
-
|
|
8063
|
-
this.result.lastPlugin = plugin;
|
|
8064
|
-
let promise;
|
|
8065
|
-
try {
|
|
8066
|
-
promise = visitor(node, this.helpers);
|
|
8067
|
-
} catch (e) {
|
|
8068
|
-
throw this.handleError(e, node.proxyOf)
|
|
8069
|
-
}
|
|
8070
|
-
if (node.type !== 'root' && node.type !== 'document' && !node.parent) {
|
|
8071
|
-
return true
|
|
8072
|
-
}
|
|
8073
|
-
if (isPromise(promise)) {
|
|
8074
|
-
throw this.getAsyncError()
|
|
8075
|
-
}
|
|
8076
|
-
}
|
|
8082
|
+
this.processed = true;
|
|
8083
|
+
return this.stringify()
|
|
8077
8084
|
}
|
|
8078
8085
|
|
|
8079
8086
|
runOnRoot(plugin) {
|
|
@@ -8101,120 +8108,88 @@ class LazyResult {
|
|
|
8101
8108
|
}
|
|
8102
8109
|
}
|
|
8103
8110
|
|
|
8104
|
-
|
|
8105
|
-
|
|
8111
|
+
stringify() {
|
|
8112
|
+
if (this.error) throw this.error
|
|
8113
|
+
if (this.stringified) return this.result
|
|
8114
|
+
this.stringified = true;
|
|
8115
|
+
|
|
8116
|
+
this.sync();
|
|
8117
|
+
|
|
8118
|
+
let opts = this.result.opts;
|
|
8119
|
+
let str = stringify_1;
|
|
8120
|
+
if (opts.syntax) str = opts.syntax.stringify;
|
|
8121
|
+
if (opts.stringifier) str = opts.stringifier;
|
|
8122
|
+
if (str.stringify) str = str.stringify;
|
|
8123
|
+
|
|
8124
|
+
let map = new mapGenerator(str, this.result.root, this.result.opts);
|
|
8125
|
+
let data = map.generate();
|
|
8126
|
+
this.result.css = data[0];
|
|
8127
|
+
this.result.map = data[1];
|
|
8128
|
+
|
|
8129
|
+
return this.result
|
|
8106
8130
|
}
|
|
8107
8131
|
|
|
8108
|
-
|
|
8109
|
-
|
|
8110
|
-
|
|
8111
|
-
|
|
8112
|
-
|
|
8113
|
-
|
|
8114
|
-
|
|
8115
|
-
error.setMessage();
|
|
8116
|
-
}
|
|
8117
|
-
} catch (err) {
|
|
8118
|
-
/* c8 ignore next 3 */
|
|
8119
|
-
// eslint-disable-next-line no-console
|
|
8120
|
-
if (console && console.error) console.error(err);
|
|
8132
|
+
sync() {
|
|
8133
|
+
if (this.error) throw this.error
|
|
8134
|
+
if (this.processed) return this.result
|
|
8135
|
+
this.processed = true;
|
|
8136
|
+
|
|
8137
|
+
if (this.processing) {
|
|
8138
|
+
throw this.getAsyncError()
|
|
8121
8139
|
}
|
|
8122
|
-
return error
|
|
8123
|
-
}
|
|
8124
8140
|
|
|
8125
|
-
|
|
8126
|
-
this.plugin = 0;
|
|
8127
|
-
for (let i = 0; i < this.plugins.length; i++) {
|
|
8128
|
-
let plugin = this.plugins[i];
|
|
8141
|
+
for (let plugin of this.plugins) {
|
|
8129
8142
|
let promise = this.runOnRoot(plugin);
|
|
8130
8143
|
if (isPromise(promise)) {
|
|
8131
|
-
|
|
8132
|
-
await promise;
|
|
8133
|
-
} catch (error) {
|
|
8134
|
-
throw this.handleError(error)
|
|
8135
|
-
}
|
|
8144
|
+
throw this.getAsyncError()
|
|
8136
8145
|
}
|
|
8137
8146
|
}
|
|
8138
8147
|
|
|
8139
8148
|
this.prepareVisitors();
|
|
8140
8149
|
if (this.hasListener) {
|
|
8141
|
-
let root = this.result.root;
|
|
8142
|
-
while (!root[isClean]) {
|
|
8143
|
-
root[isClean] = true;
|
|
8144
|
-
|
|
8145
|
-
while (stack.length > 0) {
|
|
8146
|
-
let promise = this.visitTick(stack);
|
|
8147
|
-
if (isPromise(promise)) {
|
|
8148
|
-
try {
|
|
8149
|
-
await promise;
|
|
8150
|
-
} catch (e) {
|
|
8151
|
-
let node = stack[stack.length - 1].node;
|
|
8152
|
-
throw this.handleError(e, node)
|
|
8153
|
-
}
|
|
8154
|
-
}
|
|
8155
|
-
}
|
|
8150
|
+
let root = this.result.root;
|
|
8151
|
+
while (!root[isClean]) {
|
|
8152
|
+
root[isClean] = true;
|
|
8153
|
+
this.walkSync(root);
|
|
8156
8154
|
}
|
|
8157
|
-
|
|
8158
8155
|
if (this.listeners.OnceExit) {
|
|
8159
|
-
|
|
8160
|
-
|
|
8161
|
-
|
|
8162
|
-
if (root.type === 'document') {
|
|
8163
|
-
let roots = root.nodes.map(subRoot =>
|
|
8164
|
-
visitor(subRoot, this.helpers)
|
|
8165
|
-
);
|
|
8166
|
-
|
|
8167
|
-
await Promise.all(roots);
|
|
8168
|
-
} else {
|
|
8169
|
-
await visitor(root, this.helpers);
|
|
8170
|
-
}
|
|
8171
|
-
} catch (e) {
|
|
8172
|
-
throw this.handleError(e)
|
|
8156
|
+
if (root.type === 'document') {
|
|
8157
|
+
for (let subRoot of root.nodes) {
|
|
8158
|
+
this.visitSync(this.listeners.OnceExit, subRoot);
|
|
8173
8159
|
}
|
|
8160
|
+
} else {
|
|
8161
|
+
this.visitSync(this.listeners.OnceExit, root);
|
|
8174
8162
|
}
|
|
8175
8163
|
}
|
|
8176
8164
|
}
|
|
8177
8165
|
|
|
8178
|
-
this.
|
|
8179
|
-
return this.stringify()
|
|
8166
|
+
return this.result
|
|
8180
8167
|
}
|
|
8181
8168
|
|
|
8182
|
-
|
|
8183
|
-
this.
|
|
8184
|
-
|
|
8185
|
-
|
|
8186
|
-
|
|
8187
|
-
|
|
8188
|
-
|
|
8189
|
-
|
|
8190
|
-
|
|
8191
|
-
|
|
8192
|
-
|
|
8193
|
-
|
|
8194
|
-
|
|
8195
|
-
|
|
8196
|
-
|
|
8197
|
-
|
|
8198
|
-
|
|
8199
|
-
|
|
8200
|
-
|
|
8201
|
-
|
|
8202
|
-
|
|
8203
|
-
|
|
8204
|
-
plugin,
|
|
8205
|
-
event + '-' + filter.toLowerCase(),
|
|
8206
|
-
plugin[event][filter]
|
|
8207
|
-
);
|
|
8208
|
-
}
|
|
8209
|
-
}
|
|
8210
|
-
} else if (typeof plugin[event] === 'function') {
|
|
8211
|
-
add(plugin, event, plugin[event]);
|
|
8212
|
-
}
|
|
8213
|
-
}
|
|
8214
|
-
}
|
|
8169
|
+
then(onFulfilled, onRejected) {
|
|
8170
|
+
return this.async().then(onFulfilled, onRejected)
|
|
8171
|
+
}
|
|
8172
|
+
|
|
8173
|
+
toString() {
|
|
8174
|
+
return this.css
|
|
8175
|
+
}
|
|
8176
|
+
|
|
8177
|
+
visitSync(visitors, node) {
|
|
8178
|
+
for (let [plugin, visitor] of visitors) {
|
|
8179
|
+
this.result.lastPlugin = plugin;
|
|
8180
|
+
let promise;
|
|
8181
|
+
try {
|
|
8182
|
+
promise = visitor(node, this.helpers);
|
|
8183
|
+
} catch (e) {
|
|
8184
|
+
throw this.handleError(e, node.proxyOf)
|
|
8185
|
+
}
|
|
8186
|
+
if (node.type !== 'root' && node.type !== 'document' && !node.parent) {
|
|
8187
|
+
return true
|
|
8188
|
+
}
|
|
8189
|
+
if (isPromise(promise)) {
|
|
8190
|
+
throw this.getAsyncError()
|
|
8215
8191
|
}
|
|
8216
8192
|
}
|
|
8217
|
-
this.hasListener = Object.keys(this.listeners).length > 0;
|
|
8218
8193
|
}
|
|
8219
8194
|
|
|
8220
8195
|
visitTick(stack) {
|
|
@@ -8273,6 +8248,61 @@ class LazyResult {
|
|
|
8273
8248
|
}
|
|
8274
8249
|
stack.pop();
|
|
8275
8250
|
}
|
|
8251
|
+
|
|
8252
|
+
walkSync(node) {
|
|
8253
|
+
node[isClean] = true;
|
|
8254
|
+
let events = getEvents(node);
|
|
8255
|
+
for (let event of events) {
|
|
8256
|
+
if (event === CHILDREN) {
|
|
8257
|
+
if (node.nodes) {
|
|
8258
|
+
node.each(child => {
|
|
8259
|
+
if (!child[isClean]) this.walkSync(child);
|
|
8260
|
+
});
|
|
8261
|
+
}
|
|
8262
|
+
} else {
|
|
8263
|
+
let visitors = this.listeners[event];
|
|
8264
|
+
if (visitors) {
|
|
8265
|
+
if (this.visitSync(visitors, node.toProxy())) return
|
|
8266
|
+
}
|
|
8267
|
+
}
|
|
8268
|
+
}
|
|
8269
|
+
}
|
|
8270
|
+
|
|
8271
|
+
warnings() {
|
|
8272
|
+
return this.sync().warnings()
|
|
8273
|
+
}
|
|
8274
|
+
|
|
8275
|
+
get content() {
|
|
8276
|
+
return this.stringify().content
|
|
8277
|
+
}
|
|
8278
|
+
|
|
8279
|
+
get css() {
|
|
8280
|
+
return this.stringify().css
|
|
8281
|
+
}
|
|
8282
|
+
|
|
8283
|
+
get map() {
|
|
8284
|
+
return this.stringify().map
|
|
8285
|
+
}
|
|
8286
|
+
|
|
8287
|
+
get messages() {
|
|
8288
|
+
return this.sync().messages
|
|
8289
|
+
}
|
|
8290
|
+
|
|
8291
|
+
get opts() {
|
|
8292
|
+
return this.result.opts
|
|
8293
|
+
}
|
|
8294
|
+
|
|
8295
|
+
get processor() {
|
|
8296
|
+
return this.result.processor
|
|
8297
|
+
}
|
|
8298
|
+
|
|
8299
|
+
get root() {
|
|
8300
|
+
return this.sync().root
|
|
8301
|
+
}
|
|
8302
|
+
|
|
8303
|
+
get [Symbol.toStringTag]() {
|
|
8304
|
+
return 'LazyResult'
|
|
8305
|
+
}
|
|
8276
8306
|
}
|
|
8277
8307
|
|
|
8278
8308
|
LazyResult.registerPostcss = dependant => {
|
|
@@ -8319,30 +8349,61 @@ class NoWorkResult {
|
|
|
8319
8349
|
}
|
|
8320
8350
|
}
|
|
8321
8351
|
|
|
8322
|
-
|
|
8323
|
-
return
|
|
8352
|
+
async() {
|
|
8353
|
+
if (this.error) return Promise.reject(this.error)
|
|
8354
|
+
return Promise.resolve(this.result)
|
|
8324
8355
|
}
|
|
8325
8356
|
|
|
8326
|
-
|
|
8327
|
-
return this.
|
|
8357
|
+
catch(onRejected) {
|
|
8358
|
+
return this.async().catch(onRejected)
|
|
8328
8359
|
}
|
|
8329
8360
|
|
|
8330
|
-
|
|
8331
|
-
return this.
|
|
8361
|
+
finally(onFinally) {
|
|
8362
|
+
return this.async().then(onFinally, onFinally)
|
|
8332
8363
|
}
|
|
8333
8364
|
|
|
8334
|
-
|
|
8335
|
-
|
|
8365
|
+
sync() {
|
|
8366
|
+
if (this.error) throw this.error
|
|
8367
|
+
return this.result
|
|
8368
|
+
}
|
|
8369
|
+
|
|
8370
|
+
then(onFulfilled, onRejected) {
|
|
8371
|
+
|
|
8372
|
+
return this.async().then(onFulfilled, onRejected)
|
|
8373
|
+
}
|
|
8374
|
+
|
|
8375
|
+
toString() {
|
|
8376
|
+
return this._css
|
|
8377
|
+
}
|
|
8378
|
+
|
|
8379
|
+
warnings() {
|
|
8380
|
+
return []
|
|
8336
8381
|
}
|
|
8337
8382
|
|
|
8338
8383
|
get content() {
|
|
8339
8384
|
return this.result.css
|
|
8340
8385
|
}
|
|
8341
8386
|
|
|
8387
|
+
get css() {
|
|
8388
|
+
return this.result.css
|
|
8389
|
+
}
|
|
8390
|
+
|
|
8342
8391
|
get map() {
|
|
8343
8392
|
return this.result.map
|
|
8344
8393
|
}
|
|
8345
8394
|
|
|
8395
|
+
get messages() {
|
|
8396
|
+
return []
|
|
8397
|
+
}
|
|
8398
|
+
|
|
8399
|
+
get opts() {
|
|
8400
|
+
return this.result.opts
|
|
8401
|
+
}
|
|
8402
|
+
|
|
8403
|
+
get processor() {
|
|
8404
|
+
return this.result.processor
|
|
8405
|
+
}
|
|
8406
|
+
|
|
8346
8407
|
get root() {
|
|
8347
8408
|
if (this._root) {
|
|
8348
8409
|
return this._root
|
|
@@ -8365,39 +8426,8 @@ class NoWorkResult {
|
|
|
8365
8426
|
}
|
|
8366
8427
|
}
|
|
8367
8428
|
|
|
8368
|
-
get
|
|
8369
|
-
return
|
|
8370
|
-
}
|
|
8371
|
-
|
|
8372
|
-
warnings() {
|
|
8373
|
-
return []
|
|
8374
|
-
}
|
|
8375
|
-
|
|
8376
|
-
toString() {
|
|
8377
|
-
return this._css
|
|
8378
|
-
}
|
|
8379
|
-
|
|
8380
|
-
then(onFulfilled, onRejected) {
|
|
8381
|
-
|
|
8382
|
-
return this.async().then(onFulfilled, onRejected)
|
|
8383
|
-
}
|
|
8384
|
-
|
|
8385
|
-
catch(onRejected) {
|
|
8386
|
-
return this.async().catch(onRejected)
|
|
8387
|
-
}
|
|
8388
|
-
|
|
8389
|
-
finally(onFinally) {
|
|
8390
|
-
return this.async().then(onFinally, onFinally)
|
|
8391
|
-
}
|
|
8392
|
-
|
|
8393
|
-
async() {
|
|
8394
|
-
if (this.error) return Promise.reject(this.error)
|
|
8395
|
-
return Promise.resolve(this.result)
|
|
8396
|
-
}
|
|
8397
|
-
|
|
8398
|
-
sync() {
|
|
8399
|
-
if (this.error) throw this.error
|
|
8400
|
-
return this.result
|
|
8429
|
+
get [Symbol.toStringTag]() {
|
|
8430
|
+
return 'NoWorkResult'
|
|
8401
8431
|
}
|
|
8402
8432
|
}
|
|
8403
8433
|
|
|
@@ -8406,28 +8436,10 @@ NoWorkResult.default = NoWorkResult;
|
|
|
8406
8436
|
|
|
8407
8437
|
class Processor {
|
|
8408
8438
|
constructor(plugins = []) {
|
|
8409
|
-
this.version = '8.4.
|
|
8439
|
+
this.version = '8.4.31';
|
|
8410
8440
|
this.plugins = this.normalize(plugins);
|
|
8411
8441
|
}
|
|
8412
8442
|
|
|
8413
|
-
use(plugin) {
|
|
8414
|
-
this.plugins = this.plugins.concat(this.normalize([plugin]));
|
|
8415
|
-
return this
|
|
8416
|
-
}
|
|
8417
|
-
|
|
8418
|
-
process(css, opts = {}) {
|
|
8419
|
-
if (
|
|
8420
|
-
this.plugins.length === 0 &&
|
|
8421
|
-
typeof opts.parser === 'undefined' &&
|
|
8422
|
-
typeof opts.stringifier === 'undefined' &&
|
|
8423
|
-
typeof opts.syntax === 'undefined'
|
|
8424
|
-
) {
|
|
8425
|
-
return new noWorkResult(this, css, opts)
|
|
8426
|
-
} else {
|
|
8427
|
-
return new lazyResult(this, css, opts)
|
|
8428
|
-
}
|
|
8429
|
-
}
|
|
8430
|
-
|
|
8431
8443
|
normalize(plugins) {
|
|
8432
8444
|
let normalized = [];
|
|
8433
8445
|
for (let i of plugins) {
|
|
@@ -8449,6 +8461,24 @@ class Processor {
|
|
|
8449
8461
|
}
|
|
8450
8462
|
return normalized
|
|
8451
8463
|
}
|
|
8464
|
+
|
|
8465
|
+
process(css, opts = {}) {
|
|
8466
|
+
if (
|
|
8467
|
+
this.plugins.length === 0 &&
|
|
8468
|
+
typeof opts.parser === 'undefined' &&
|
|
8469
|
+
typeof opts.stringifier === 'undefined' &&
|
|
8470
|
+
typeof opts.syntax === 'undefined'
|
|
8471
|
+
) {
|
|
8472
|
+
return new noWorkResult(this, css, opts)
|
|
8473
|
+
} else {
|
|
8474
|
+
return new lazyResult(this, css, opts)
|
|
8475
|
+
}
|
|
8476
|
+
}
|
|
8477
|
+
|
|
8478
|
+
use(plugin) {
|
|
8479
|
+
this.plugins = this.plugins.concat(this.normalize([plugin]));
|
|
8480
|
+
return this
|
|
8481
|
+
}
|
|
8452
8482
|
}
|
|
8453
8483
|
|
|
8454
8484
|
var processor = Processor;
|