@everymatrix/general-footer-template 1.28.7 → 1.28.8
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 +1487 -1517
- package/dist/components/custom-content-section.js +1487 -1517
- package/dist/esm/custom-content-section.entry.js +1487 -1517
- package/dist/general-footer-template/general-footer-template.esm.js +1 -1
- package/dist/general-footer-template/{p-7f87f2a4.entry.js → p-d7ef8062.entry.js} +2 -2
- package/package.json +1 -1
- /package/dist/types/Users/{adrian.pripon/Documents/Work → sebastian.strulea/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, red, gray } = 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
|
-
|
|
4671
|
-
beforeComment: '\n',
|
|
4669
|
+
colon: ': ',
|
|
4670
|
+
indent: ' ',
|
|
4672
4671
|
beforeDecl: '\n',
|
|
4673
|
-
beforeOpen: ' ',
|
|
4674
4672
|
beforeRule: '\n',
|
|
4675
|
-
|
|
4673
|
+
beforeOpen: ' ',
|
|
4674
|
+
beforeClose: '\n',
|
|
4675
|
+
beforeComment: '\n',
|
|
4676
|
+
after: '\n',
|
|
4677
|
+
emptyBody: '',
|
|
4676
4678
|
commentLeft: ' ',
|
|
4677
4679
|
commentRight: ' ',
|
|
4678
|
-
emptyBody: '',
|
|
4679
|
-
indent: ' ',
|
|
4680
4680
|
semicolon: false
|
|
4681
4681
|
};
|
|
4682
4682
|
|
|
@@ -4689,6 +4689,54 @@ 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
|
+
|
|
4692
4740
|
atrule(node, semicolon) {
|
|
4693
4741
|
let name = '@' + node.name;
|
|
4694
4742
|
let params = node.params ? this.rawValue(node, 'params') : '';
|
|
@@ -4707,51 +4755,6 @@ class Stringifier {
|
|
|
4707
4755
|
}
|
|
4708
4756
|
}
|
|
4709
4757
|
|
|
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');
|
|
4720
|
-
}
|
|
4721
|
-
|
|
4722
|
-
let buf = node.parent;
|
|
4723
|
-
let depth = 0;
|
|
4724
|
-
while (buf && buf.type !== 'root') {
|
|
4725
|
-
depth += 1;
|
|
4726
|
-
buf = buf.parent;
|
|
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
|
|
4737
|
-
}
|
|
4738
|
-
|
|
4739
|
-
block(node, start) {
|
|
4740
|
-
let between = this.raw(node, 'between', 'beforeOpen');
|
|
4741
|
-
this.builder(start + between + '{', node, 'start');
|
|
4742
|
-
|
|
4743
|
-
let after;
|
|
4744
|
-
if (node.nodes && node.nodes.length) {
|
|
4745
|
-
this.body(node);
|
|
4746
|
-
after = this.raw(node, 'after');
|
|
4747
|
-
} else {
|
|
4748
|
-
after = this.raw(node, 'after', 'emptyBody');
|
|
4749
|
-
}
|
|
4750
|
-
|
|
4751
|
-
if (after) this.builder(after);
|
|
4752
|
-
this.builder('}', node, 'end');
|
|
4753
|
-
}
|
|
4754
|
-
|
|
4755
4758
|
body(node) {
|
|
4756
4759
|
let last = node.nodes.length - 1;
|
|
4757
4760
|
while (last > 0) {
|
|
@@ -4768,26 +4771,20 @@ class Stringifier {
|
|
|
4768
4771
|
}
|
|
4769
4772
|
}
|
|
4770
4773
|
|
|
4771
|
-
|
|
4772
|
-
let
|
|
4773
|
-
|
|
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');
|
|
4774
|
+
block(node, start) {
|
|
4775
|
+
let between = this.raw(node, 'between', 'beforeOpen');
|
|
4776
|
+
this.builder(start + between + '{', node, 'start');
|
|
4780
4777
|
|
|
4781
|
-
|
|
4782
|
-
|
|
4778
|
+
let after;
|
|
4779
|
+
if (node.nodes && node.nodes.length) {
|
|
4780
|
+
this.body(node);
|
|
4781
|
+
after = this.raw(node, 'after');
|
|
4782
|
+
} else {
|
|
4783
|
+
after = this.raw(node, 'after', 'emptyBody');
|
|
4783
4784
|
}
|
|
4784
4785
|
|
|
4785
|
-
if (
|
|
4786
|
-
this.builder(
|
|
4787
|
-
}
|
|
4788
|
-
|
|
4789
|
-
document(node) {
|
|
4790
|
-
this.body(node);
|
|
4786
|
+
if (after) this.builder(after);
|
|
4787
|
+
this.builder('}', node, 'end');
|
|
4791
4788
|
}
|
|
4792
4789
|
|
|
4793
4790
|
raw(node, own, detect) {
|
|
@@ -4844,20 +4841,42 @@ class Stringifier {
|
|
|
4844
4841
|
return value
|
|
4845
4842
|
}
|
|
4846
4843
|
|
|
4847
|
-
|
|
4844
|
+
rawSemicolon(root) {
|
|
4848
4845
|
let value;
|
|
4849
4846
|
root.walk(i => {
|
|
4850
|
-
if (i.nodes && i.nodes.length
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
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
|
|
4868
|
+
let value;
|
|
4869
|
+
root.walk(i => {
|
|
4870
|
+
let p = i.parent;
|
|
4871
|
+
if (p && p !== root && p.parent && p.parent === root) {
|
|
4872
|
+
if (typeof i.raws.before !== 'undefined') {
|
|
4873
|
+
let parts = i.raws.before.split('\n');
|
|
4874
|
+
value = parts[parts.length - 1];
|
|
4875
|
+
value = value.replace(/\S/g, '');
|
|
4856
4876
|
return false
|
|
4857
4877
|
}
|
|
4858
4878
|
}
|
|
4859
4879
|
});
|
|
4860
|
-
if (value) value = value.replace(/\S/g, '');
|
|
4861
4880
|
return value
|
|
4862
4881
|
}
|
|
4863
4882
|
|
|
@@ -4899,17 +4918,6 @@ class Stringifier {
|
|
|
4899
4918
|
return value
|
|
4900
4919
|
}
|
|
4901
4920
|
|
|
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
|
-
|
|
4913
4921
|
rawBeforeRule(root) {
|
|
4914
4922
|
let value;
|
|
4915
4923
|
root.walk(i => {
|
|
@@ -4927,53 +4935,71 @@ class Stringifier {
|
|
|
4927
4935
|
return value
|
|
4928
4936
|
}
|
|
4929
4937
|
|
|
4930
|
-
|
|
4938
|
+
rawBeforeClose(root) {
|
|
4931
4939
|
let value;
|
|
4932
|
-
root.
|
|
4933
|
-
if (
|
|
4934
|
-
|
|
4935
|
-
|
|
4940
|
+
root.walk(i => {
|
|
4941
|
+
if (i.nodes && i.nodes.length > 0) {
|
|
4942
|
+
if (typeof i.raws.after !== 'undefined') {
|
|
4943
|
+
value = i.raws.after;
|
|
4944
|
+
if (value.includes('\n')) {
|
|
4945
|
+
value = value.replace(/[^\n]+$/, '');
|
|
4946
|
+
}
|
|
4947
|
+
return false
|
|
4948
|
+
}
|
|
4936
4949
|
}
|
|
4937
4950
|
});
|
|
4951
|
+
if (value) value = value.replace(/\S/g, '');
|
|
4938
4952
|
return value
|
|
4939
4953
|
}
|
|
4940
4954
|
|
|
4941
|
-
|
|
4955
|
+
rawBeforeOpen(root) {
|
|
4942
4956
|
let value;
|
|
4943
4957
|
root.walk(i => {
|
|
4944
|
-
if (i.
|
|
4945
|
-
value = i.raws.
|
|
4958
|
+
if (i.type !== 'decl') {
|
|
4959
|
+
value = i.raws.between;
|
|
4946
4960
|
if (typeof value !== 'undefined') return false
|
|
4947
4961
|
}
|
|
4948
4962
|
});
|
|
4949
4963
|
return value
|
|
4950
4964
|
}
|
|
4951
4965
|
|
|
4952
|
-
|
|
4953
|
-
if (root.raws.indent) return root.raws.indent
|
|
4966
|
+
rawColon(root) {
|
|
4954
4967
|
let value;
|
|
4955
|
-
root.
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
let parts = i.raws.before.split('\n');
|
|
4960
|
-
value = parts[parts.length - 1];
|
|
4961
|
-
value = value.replace(/\S/g, '');
|
|
4962
|
-
return false
|
|
4963
|
-
}
|
|
4968
|
+
root.walkDecls(i => {
|
|
4969
|
+
if (typeof i.raws.between !== 'undefined') {
|
|
4970
|
+
value = i.raws.between.replace(/[^\s:]/g, '');
|
|
4971
|
+
return false
|
|
4964
4972
|
}
|
|
4965
4973
|
});
|
|
4966
4974
|
return value
|
|
4967
4975
|
}
|
|
4968
4976
|
|
|
4969
|
-
|
|
4977
|
+
beforeAfter(node, detect) {
|
|
4970
4978
|
let value;
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4979
|
+
if (node.type === 'decl') {
|
|
4980
|
+
value = this.raw(node, null, 'beforeDecl');
|
|
4981
|
+
} else if (node.type === 'comment') {
|
|
4982
|
+
value = this.raw(node, null, 'beforeComment');
|
|
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;
|
|
4975
5000
|
}
|
|
4976
|
-
}
|
|
5001
|
+
}
|
|
5002
|
+
|
|
4977
5003
|
return value
|
|
4978
5004
|
}
|
|
4979
5005
|
|
|
@@ -4986,33 +5012,7 @@ class Stringifier {
|
|
|
4986
5012
|
|
|
4987
5013
|
return value
|
|
4988
5014
|
}
|
|
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
|
-
}
|
|
5015
|
+
}
|
|
5016
5016
|
|
|
5017
5017
|
var stringifier = Stringifier;
|
|
5018
5018
|
Stringifier.default = Stringifier;
|
|
@@ -5079,39 +5079,47 @@ class Node {
|
|
|
5079
5079
|
}
|
|
5080
5080
|
}
|
|
5081
5081
|
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5082
|
+
error(message, opts = {}) {
|
|
5083
|
+
if (this.source) {
|
|
5084
|
+
let { start, end } = this.rangeBy(opts);
|
|
5085
|
+
return this.source.input.error(
|
|
5086
|
+
message,
|
|
5087
|
+
{ line: start.line, column: start.column },
|
|
5088
|
+
{ line: end.line, column: end.column },
|
|
5089
|
+
opts
|
|
5090
|
+
)
|
|
5090
5091
|
}
|
|
5091
|
-
return
|
|
5092
|
+
return new cssSyntaxError(message)
|
|
5092
5093
|
}
|
|
5093
5094
|
|
|
5094
|
-
|
|
5095
|
-
this
|
|
5096
|
-
|
|
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)
|
|
5097
5099
|
}
|
|
5098
5100
|
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
this
|
|
5101
|
+
remove() {
|
|
5102
|
+
if (this.parent) {
|
|
5103
|
+
this.parent.removeChild(this);
|
|
5102
5104
|
}
|
|
5105
|
+
this.parent = undefined;
|
|
5103
5106
|
return this
|
|
5104
5107
|
}
|
|
5105
5108
|
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
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
|
|
5109
5116
|
}
|
|
5110
5117
|
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5118
|
+
assign(overrides = {}) {
|
|
5119
|
+
for (let name in overrides) {
|
|
5120
|
+
this[name] = overrides[name];
|
|
5121
|
+
}
|
|
5122
|
+
return this
|
|
5115
5123
|
}
|
|
5116
5124
|
|
|
5117
5125
|
clone(overrides = {}) {
|
|
@@ -5122,70 +5130,39 @@ class Node {
|
|
|
5122
5130
|
return cloned
|
|
5123
5131
|
}
|
|
5124
5132
|
|
|
5125
|
-
cloneAfter(overrides = {}) {
|
|
5126
|
-
let cloned = this.clone(overrides);
|
|
5127
|
-
this.parent.insertAfter(this, cloned);
|
|
5128
|
-
return cloned
|
|
5129
|
-
}
|
|
5130
|
-
|
|
5131
5133
|
cloneBefore(overrides = {}) {
|
|
5132
5134
|
let cloned = this.clone(overrides);
|
|
5133
5135
|
this.parent.insertBefore(this, cloned);
|
|
5134
5136
|
return cloned
|
|
5135
5137
|
}
|
|
5136
5138
|
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
|
|
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)
|
|
5139
|
+
cloneAfter(overrides = {}) {
|
|
5140
|
+
let cloned = this.clone(overrides);
|
|
5141
|
+
this.parent.insertAfter(this, cloned);
|
|
5142
|
+
return cloned
|
|
5148
5143
|
}
|
|
5149
5144
|
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
|
|
5156
|
-
|
|
5145
|
+
replaceWith(...nodes) {
|
|
5146
|
+
if (this.parent) {
|
|
5147
|
+
let bookmark = this;
|
|
5148
|
+
let foundSelf = false;
|
|
5149
|
+
for (let node of nodes) {
|
|
5150
|
+
if (node === this) {
|
|
5151
|
+
foundSelf = true;
|
|
5152
|
+
} else if (foundSelf) {
|
|
5153
|
+
this.parent.insertAfter(bookmark, node);
|
|
5154
|
+
bookmark = node;
|
|
5157
5155
|
} else {
|
|
5158
|
-
|
|
5159
|
-
}
|
|
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();
|
|
5156
|
+
this.parent.insertBefore(bookmark, node);
|
|
5175
5157
|
}
|
|
5176
|
-
return true
|
|
5177
5158
|
}
|
|
5178
|
-
}
|
|
5179
|
-
}
|
|
5180
5159
|
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
this[isClean$2] = false;
|
|
5184
|
-
let next = this;
|
|
5185
|
-
while ((next = next.parent)) {
|
|
5186
|
-
next[isClean$2] = false;
|
|
5160
|
+
if (!foundSelf) {
|
|
5161
|
+
this.remove();
|
|
5187
5162
|
}
|
|
5188
5163
|
}
|
|
5164
|
+
|
|
5165
|
+
return this
|
|
5189
5166
|
}
|
|
5190
5167
|
|
|
5191
5168
|
next() {
|
|
@@ -5194,128 +5171,19 @@ class Node {
|
|
|
5194
5171
|
return this.parent.nodes[index + 1]
|
|
5195
5172
|
}
|
|
5196
5173
|
|
|
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
|
-
|
|
5226
5174
|
prev() {
|
|
5227
5175
|
if (!this.parent) return undefined
|
|
5228
5176
|
let index = this.parent.index(this);
|
|
5229
5177
|
return this.parent.nodes[index - 1]
|
|
5230
5178
|
}
|
|
5231
5179
|
|
|
5232
|
-
|
|
5233
|
-
|
|
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;
|
|
5180
|
+
before(add) {
|
|
5181
|
+
this.parent.insertBefore(this, add);
|
|
5296
5182
|
return this
|
|
5297
5183
|
}
|
|
5298
5184
|
|
|
5299
|
-
|
|
5300
|
-
|
|
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
|
-
|
|
5185
|
+
after(add) {
|
|
5186
|
+
this.parent.insertAfter(this, add);
|
|
5319
5187
|
return this
|
|
5320
5188
|
}
|
|
5321
5189
|
|
|
@@ -5327,6 +5195,17 @@ class Node {
|
|
|
5327
5195
|
return result
|
|
5328
5196
|
}
|
|
5329
5197
|
|
|
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
|
+
|
|
5330
5209
|
toJSON(_, inputs) {
|
|
5331
5210
|
let fixed = {};
|
|
5332
5211
|
let emitInputs = inputs == null;
|
|
@@ -5359,9 +5238,9 @@ class Node {
|
|
|
5359
5238
|
inputsNextIndex++;
|
|
5360
5239
|
}
|
|
5361
5240
|
fixed[name] = {
|
|
5362
|
-
end: value.end,
|
|
5363
5241
|
inputId,
|
|
5364
|
-
start: value.start
|
|
5242
|
+
start: value.start,
|
|
5243
|
+
end: value.end
|
|
5365
5244
|
};
|
|
5366
5245
|
} else {
|
|
5367
5246
|
fixed[name] = value;
|
|
@@ -5375,26 +5254,145 @@ class Node {
|
|
|
5375
5254
|
return fixed
|
|
5376
5255
|
}
|
|
5377
5256
|
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
return this.proxyCache
|
|
5383
|
-
}
|
|
5257
|
+
positionInside(index) {
|
|
5258
|
+
let string = this.toString();
|
|
5259
|
+
let column = this.source.start.column;
|
|
5260
|
+
let line = this.source.start.line;
|
|
5384
5261
|
|
|
5385
|
-
|
|
5386
|
-
|
|
5387
|
-
|
|
5388
|
-
|
|
5389
|
-
|
|
5390
|
-
|
|
5391
|
-
|
|
5262
|
+
for (let i = 0; i < index; i++) {
|
|
5263
|
+
if (string[i] === '\n') {
|
|
5264
|
+
column = 1;
|
|
5265
|
+
line += 1;
|
|
5266
|
+
} else {
|
|
5267
|
+
column += 1;
|
|
5268
|
+
}
|
|
5269
|
+
}
|
|
5270
|
+
|
|
5271
|
+
return { line, column }
|
|
5392
5272
|
}
|
|
5393
5273
|
|
|
5394
|
-
|
|
5395
|
-
let
|
|
5396
|
-
|
|
5397
|
-
|
|
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
|
|
5386
|
+
}
|
|
5387
|
+
|
|
5388
|
+
markDirty() {
|
|
5389
|
+
if (this[isClean$2]) {
|
|
5390
|
+
this[isClean$2] = false;
|
|
5391
|
+
let next = this;
|
|
5392
|
+
while ((next = next.parent)) {
|
|
5393
|
+
next[isClean$2] = false;
|
|
5394
|
+
}
|
|
5395
|
+
}
|
|
5398
5396
|
}
|
|
5399
5397
|
|
|
5400
5398
|
get proxyOf() {
|
|
@@ -5488,37 +5486,22 @@ class PreviousMap {
|
|
|
5488
5486
|
return this.consumerCache
|
|
5489
5487
|
}
|
|
5490
5488
|
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
|
|
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
|
-
}
|
|
5489
|
+
withContent() {
|
|
5490
|
+
return !!(
|
|
5491
|
+
this.consumer().sourcesContent &&
|
|
5492
|
+
this.consumer().sourcesContent.length > 0
|
|
5493
|
+
)
|
|
5494
|
+
}
|
|
5504
5495
|
|
|
5505
|
-
|
|
5506
|
-
|
|
5496
|
+
startWith(string, start) {
|
|
5497
|
+
if (!string) return false
|
|
5498
|
+
return string.substr(0, start.length) === start
|
|
5507
5499
|
}
|
|
5508
5500
|
|
|
5509
5501
|
getAnnotationURL(sourceMapString) {
|
|
5510
5502
|
return sourceMapString.replace(/^\/\*\s*# sourceMappingURL=/, '').trim()
|
|
5511
5503
|
}
|
|
5512
5504
|
|
|
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
|
-
|
|
5522
5505
|
loadAnnotation(css) {
|
|
5523
5506
|
let comments = css.match(/\/\*\s*# sourceMappingURL=/gm);
|
|
5524
5507
|
if (!comments) return
|
|
@@ -5533,6 +5516,24 @@ class PreviousMap {
|
|
|
5533
5516
|
}
|
|
5534
5517
|
}
|
|
5535
5518
|
|
|
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
|
+
|
|
5536
5537
|
loadFile(path) {
|
|
5537
5538
|
this.root = dirname$1(path);
|
|
5538
5539
|
if (existsSync(path)) {
|
|
@@ -5578,15 +5579,12 @@ class PreviousMap {
|
|
|
5578
5579
|
}
|
|
5579
5580
|
}
|
|
5580
5581
|
|
|
5581
|
-
|
|
5582
|
-
if (
|
|
5583
|
-
return
|
|
5584
|
-
|
|
5585
|
-
|
|
5586
|
-
|
|
5587
|
-
return !!(
|
|
5588
|
-
this.consumer().sourcesContent &&
|
|
5589
|
-
this.consumer().sourcesContent.length > 0
|
|
5582
|
+
isMap(map) {
|
|
5583
|
+
if (typeof map !== 'object') return false
|
|
5584
|
+
return (
|
|
5585
|
+
typeof map.mappings === 'string' ||
|
|
5586
|
+
typeof map._mappings === 'string' ||
|
|
5587
|
+
Array.isArray(map.sections)
|
|
5590
5588
|
)
|
|
5591
5589
|
}
|
|
5592
5590
|
}
|
|
@@ -5598,7 +5596,7 @@ const require$$3 = /*@__PURE__*/getAugmentedNamespace(nonSecure);
|
|
|
5598
5596
|
|
|
5599
5597
|
let { SourceMapConsumer: SourceMapConsumer$1, SourceMapGenerator: SourceMapGenerator$1 } = require$$2;
|
|
5600
5598
|
let { fileURLToPath, pathToFileURL: pathToFileURL$1 } = require$$2;
|
|
5601
|
-
let {
|
|
5599
|
+
let { resolve: resolve$1, isAbsolute } = require$$2;
|
|
5602
5600
|
let { nanoid } = require$$3;
|
|
5603
5601
|
|
|
5604
5602
|
|
|
@@ -5656,6 +5654,48 @@ class Input {
|
|
|
5656
5654
|
if (this.map) this.map.file = this.from;
|
|
5657
5655
|
}
|
|
5658
5656
|
|
|
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
|
+
|
|
5659
5699
|
error(message, line, column, opts = {}) {
|
|
5660
5700
|
let result, endLine, endColumn;
|
|
5661
5701
|
|
|
@@ -5690,10 +5730,10 @@ class Input {
|
|
|
5690
5730
|
message,
|
|
5691
5731
|
origin.endLine === undefined
|
|
5692
5732
|
? origin.line
|
|
5693
|
-
: {
|
|
5733
|
+
: { line: origin.line, column: origin.column },
|
|
5694
5734
|
origin.endLine === undefined
|
|
5695
5735
|
? origin.column
|
|
5696
|
-
: {
|
|
5736
|
+
: { line: origin.endLine, column: origin.endColumn },
|
|
5697
5737
|
origin.source,
|
|
5698
5738
|
origin.file,
|
|
5699
5739
|
opts.plugin
|
|
@@ -5701,15 +5741,15 @@ class Input {
|
|
|
5701
5741
|
} else {
|
|
5702
5742
|
result = new cssSyntaxError(
|
|
5703
5743
|
message,
|
|
5704
|
-
endLine === undefined ? line : {
|
|
5705
|
-
endLine === undefined ? column : {
|
|
5744
|
+
endLine === undefined ? line : { line, column },
|
|
5745
|
+
endLine === undefined ? column : { line: endLine, column: endColumn },
|
|
5706
5746
|
this.css,
|
|
5707
5747
|
this.file,
|
|
5708
5748
|
opts.plugin
|
|
5709
5749
|
);
|
|
5710
5750
|
}
|
|
5711
5751
|
|
|
5712
|
-
result.input = {
|
|
5752
|
+
result.input = { line, column, endLine, endColumn, source: this.css };
|
|
5713
5753
|
if (this.file) {
|
|
5714
5754
|
if (pathToFileURL$1) {
|
|
5715
5755
|
result.input.url = pathToFileURL$1(this.file).toString();
|
|
@@ -5720,71 +5760,22 @@ class Input {
|
|
|
5720
5760
|
return result
|
|
5721
5761
|
}
|
|
5722
5762
|
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
let lines = this.css.split('\n');
|
|
5727
|
-
lineToIndex = new Array(lines.length);
|
|
5728
|
-
let prevIndex = 0;
|
|
5763
|
+
origin(line, column, endLine, endColumn) {
|
|
5764
|
+
if (!this.map) return false
|
|
5765
|
+
let consumer = this.map.consumer();
|
|
5729
5766
|
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
prevIndex += lines[i].length + 1;
|
|
5733
|
-
}
|
|
5767
|
+
let from = consumer.originalPositionFor({ line, column });
|
|
5768
|
+
if (!from.source) return false
|
|
5734
5769
|
|
|
5735
|
-
|
|
5736
|
-
|
|
5737
|
-
|
|
5770
|
+
let to;
|
|
5771
|
+
if (typeof endLine === 'number') {
|
|
5772
|
+
to = consumer.originalPositionFor({ line: endLine, column: endColumn });
|
|
5738
5773
|
}
|
|
5739
|
-
lastLine = lineToIndex[lineToIndex.length - 1];
|
|
5740
5774
|
|
|
5741
|
-
let
|
|
5742
|
-
|
|
5743
|
-
|
|
5744
|
-
|
|
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);
|
|
5775
|
+
let fromUrl;
|
|
5776
|
+
|
|
5777
|
+
if (isAbsolute(from.source)) {
|
|
5778
|
+
fromUrl = pathToFileURL$1(from.source);
|
|
5788
5779
|
} else {
|
|
5789
5780
|
fromUrl = new URL(
|
|
5790
5781
|
from.source,
|
|
@@ -5793,11 +5784,11 @@ class Input {
|
|
|
5793
5784
|
}
|
|
5794
5785
|
|
|
5795
5786
|
let result = {
|
|
5787
|
+
url: fromUrl.toString(),
|
|
5788
|
+
line: from.line,
|
|
5796
5789
|
column: from.column,
|
|
5797
|
-
endColumn: to && to.column,
|
|
5798
5790
|
endLine: to && to.line,
|
|
5799
|
-
|
|
5800
|
-
url: fromUrl.toString()
|
|
5791
|
+
endColumn: to && to.column
|
|
5801
5792
|
};
|
|
5802
5793
|
|
|
5803
5794
|
if (fromUrl.protocol === 'file:') {
|
|
@@ -5815,6 +5806,17 @@ class Input {
|
|
|
5815
5806
|
return result
|
|
5816
5807
|
}
|
|
5817
5808
|
|
|
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
|
+
|
|
5818
5820
|
toJSON() {
|
|
5819
5821
|
let json = {};
|
|
5820
5822
|
for (let name of ['hasBOM', 'css', 'file', 'id']) {
|
|
@@ -5830,10 +5832,6 @@ class Input {
|
|
|
5830
5832
|
}
|
|
5831
5833
|
return json
|
|
5832
5834
|
}
|
|
5833
|
-
|
|
5834
|
-
get from() {
|
|
5835
|
-
return this.file || this.id
|
|
5836
|
-
}
|
|
5837
5835
|
}
|
|
5838
5836
|
|
|
5839
5837
|
var input = Input;
|
|
@@ -5844,7 +5842,7 @@ if (require$$2 && require$$2.registerInput) {
|
|
|
5844
5842
|
}
|
|
5845
5843
|
|
|
5846
5844
|
let { SourceMapConsumer, SourceMapGenerator } = require$$2;
|
|
5847
|
-
let { dirname,
|
|
5845
|
+
let { dirname, resolve, relative, sep } = require$$2;
|
|
5848
5846
|
let { pathToFileURL } = require$$2;
|
|
5849
5847
|
|
|
5850
5848
|
|
|
@@ -5860,29 +5858,100 @@ class MapGenerator {
|
|
|
5860
5858
|
this.opts = opts;
|
|
5861
5859
|
this.css = cssString;
|
|
5862
5860
|
this.usesFileUrls = !this.mapOpts.from && this.mapOpts.absolute;
|
|
5861
|
+
}
|
|
5863
5862
|
|
|
5864
|
-
|
|
5865
|
-
this.
|
|
5866
|
-
|
|
5863
|
+
isMap() {
|
|
5864
|
+
if (typeof this.opts.map !== 'undefined') {
|
|
5865
|
+
return !!this.opts.map
|
|
5866
|
+
}
|
|
5867
|
+
return this.previous().length > 0
|
|
5867
5868
|
}
|
|
5868
5869
|
|
|
5869
|
-
|
|
5870
|
-
|
|
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
|
+
}
|
|
5871
5887
|
|
|
5872
|
-
|
|
5873
|
-
|
|
5874
|
-
|
|
5875
|
-
|
|
5876
|
-
|
|
5877
|
-
|
|
5878
|
-
content = this.mapOpts.annotation(this.opts.to, this.root);
|
|
5879
|
-
} else {
|
|
5880
|
-
content = this.outputFile() + '.map';
|
|
5888
|
+
return this.previousMaps
|
|
5889
|
+
}
|
|
5890
|
+
|
|
5891
|
+
isInline() {
|
|
5892
|
+
if (typeof this.mapOpts.inline !== 'undefined') {
|
|
5893
|
+
return this.mapOpts.inline
|
|
5881
5894
|
}
|
|
5882
|
-
let eol = '\n';
|
|
5883
|
-
if (this.css.includes('\r\n')) eol = '\r\n';
|
|
5884
5895
|
|
|
5885
|
-
|
|
5896
|
+
let annotation = this.mapOpts.annotation;
|
|
5897
|
+
if (typeof annotation !== 'undefined' && annotation !== true) {
|
|
5898
|
+
return false
|
|
5899
|
+
}
|
|
5900
|
+
|
|
5901
|
+
if (this.previous().length) {
|
|
5902
|
+
return this.previous().some(i => i.inline)
|
|
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
|
|
5915
|
+
}
|
|
5916
|
+
|
|
5917
|
+
clearAnnotation() {
|
|
5918
|
+
if (this.mapOpts.annotation === false) return
|
|
5919
|
+
|
|
5920
|
+
if (this.root) {
|
|
5921
|
+
let node;
|
|
5922
|
+
for (let i = this.root.nodes.length - 1; i >= 0; i--) {
|
|
5923
|
+
node = this.root.nodes[i];
|
|
5924
|
+
if (node.type !== 'comment') continue
|
|
5925
|
+
if (node.text.indexOf('# sourceMappingURL=') === 0) {
|
|
5926
|
+
this.root.removeChild(i);
|
|
5927
|
+
}
|
|
5928
|
+
}
|
|
5929
|
+
} else if (this.css) {
|
|
5930
|
+
this.css = this.css.replace(/(\n)?\/\*#[\S\s]*?\*\/$/gm, '');
|
|
5931
|
+
}
|
|
5932
|
+
}
|
|
5933
|
+
|
|
5934
|
+
setSourcesContent() {
|
|
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
|
+
}
|
|
5886
5955
|
}
|
|
5887
5956
|
|
|
5888
5957
|
applyPrevMaps() {
|
|
@@ -5904,33 +5973,53 @@ class MapGenerator {
|
|
|
5904
5973
|
}
|
|
5905
5974
|
}
|
|
5906
5975
|
|
|
5907
|
-
|
|
5908
|
-
if (this.
|
|
5976
|
+
isAnnotation() {
|
|
5977
|
+
if (this.isInline()) {
|
|
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
|
+
}
|
|
5909
5988
|
|
|
5910
|
-
|
|
5911
|
-
|
|
5912
|
-
|
|
5913
|
-
|
|
5914
|
-
|
|
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, '');
|
|
5989
|
+
toBase64(str) {
|
|
5990
|
+
if (Buffer) {
|
|
5991
|
+
return Buffer.from(str).toString('base64')
|
|
5992
|
+
} else {
|
|
5993
|
+
return window.btoa(unescape(encodeURIComponent(str)))
|
|
5921
5994
|
}
|
|
5922
5995
|
}
|
|
5923
5996
|
|
|
5924
|
-
|
|
5925
|
-
|
|
5926
|
-
|
|
5927
|
-
|
|
5997
|
+
addAnnotation() {
|
|
5998
|
+
let content;
|
|
5999
|
+
|
|
6000
|
+
if (this.isInline()) {
|
|
6001
|
+
content =
|
|
6002
|
+
'data:application/json;base64,' + this.toBase64(this.map.toString());
|
|
6003
|
+
} else if (typeof this.mapOpts.annotation === 'string') {
|
|
6004
|
+
content = this.mapOpts.annotation;
|
|
6005
|
+
} else if (typeof this.mapOpts.annotation === 'function') {
|
|
6006
|
+
content = this.mapOpts.annotation(this.opts.to, this.root);
|
|
5928
6007
|
} else {
|
|
5929
|
-
|
|
5930
|
-
|
|
5931
|
-
|
|
5932
|
-
|
|
5933
|
-
|
|
6008
|
+
content = this.outputFile() + '.map';
|
|
6009
|
+
}
|
|
6010
|
+
let eol = '\n';
|
|
6011
|
+
if (this.css.includes('\r\n')) eol = '\r\n';
|
|
6012
|
+
|
|
6013
|
+
this.css += eol + '/*# sourceMappingURL=' + content + ' */';
|
|
6014
|
+
}
|
|
6015
|
+
|
|
6016
|
+
outputFile() {
|
|
6017
|
+
if (this.opts.to) {
|
|
6018
|
+
return this.path(this.opts.to)
|
|
6019
|
+
} else if (this.opts.from) {
|
|
6020
|
+
return this.path(this.opts.from)
|
|
6021
|
+
} else {
|
|
6022
|
+
return 'to.css'
|
|
5934
6023
|
}
|
|
5935
6024
|
}
|
|
5936
6025
|
|
|
@@ -5944,11 +6033,11 @@ class MapGenerator {
|
|
|
5944
6033
|
} else {
|
|
5945
6034
|
this.map = new SourceMapGenerator({ file: this.outputFile() });
|
|
5946
6035
|
this.map.addMapping({
|
|
5947
|
-
generated: { column: 0, line: 1 },
|
|
5948
|
-
original: { column: 0, line: 1 },
|
|
5949
6036
|
source: this.opts.from
|
|
5950
6037
|
? this.toUrl(this.path(this.opts.from))
|
|
5951
|
-
: '<no source>'
|
|
6038
|
+
: '<no source>',
|
|
6039
|
+
generated: { line: 1, column: 0 },
|
|
6040
|
+
original: { line: 1, column: 0 }
|
|
5952
6041
|
});
|
|
5953
6042
|
}
|
|
5954
6043
|
|
|
@@ -5963,6 +6052,48 @@ class MapGenerator {
|
|
|
5963
6052
|
}
|
|
5964
6053
|
}
|
|
5965
6054
|
|
|
6055
|
+
path(file) {
|
|
6056
|
+
if (file.indexOf('<') === 0) return file
|
|
6057
|
+
if (/^\w+:\/\//.test(file)) return file
|
|
6058
|
+
if (this.mapOpts.absolute) return file
|
|
6059
|
+
|
|
6060
|
+
let from = this.opts.to ? dirname(this.opts.to) : '.';
|
|
6061
|
+
|
|
6062
|
+
if (typeof this.mapOpts.annotation === 'string') {
|
|
6063
|
+
from = dirname(resolve(from, this.mapOpts.annotation));
|
|
6064
|
+
}
|
|
6065
|
+
|
|
6066
|
+
file = relative(from, file);
|
|
6067
|
+
return file
|
|
6068
|
+
}
|
|
6069
|
+
|
|
6070
|
+
toUrl(path) {
|
|
6071
|
+
if (sep === '\\') {
|
|
6072
|
+
path = path.replace(/\\/g, '/');
|
|
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
|
+
|
|
5966
6097
|
generateString() {
|
|
5967
6098
|
this.css = '';
|
|
5968
6099
|
this.map = new SourceMapGenerator({ file: this.outputFile() });
|
|
@@ -5972,9 +6103,9 @@ class MapGenerator {
|
|
|
5972
6103
|
|
|
5973
6104
|
let noSource = '<no source>';
|
|
5974
6105
|
let mapping = {
|
|
5975
|
-
|
|
5976
|
-
|
|
5977
|
-
|
|
6106
|
+
source: '',
|
|
6107
|
+
generated: { line: 0, column: 0 },
|
|
6108
|
+
original: { line: 0, column: 0 }
|
|
5978
6109
|
};
|
|
5979
6110
|
|
|
5980
6111
|
let lines, last;
|
|
@@ -6031,171 +6162,17 @@ class MapGenerator {
|
|
|
6031
6162
|
});
|
|
6032
6163
|
}
|
|
6033
6164
|
|
|
6034
|
-
|
|
6035
|
-
|
|
6036
|
-
|
|
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)
|
|
6165
|
+
generate() {
|
|
6166
|
+
this.clearAnnotation();
|
|
6167
|
+
if (pathAvailable && sourceMapAvailable && this.isMap()) {
|
|
6168
|
+
return this.generateMap()
|
|
6085
6169
|
} else {
|
|
6086
|
-
|
|
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
|
-
}
|
|
6170
|
+
let result = '';
|
|
6171
|
+
this.stringify(this.root, i => {
|
|
6172
|
+
result += i;
|
|
6144
6173
|
});
|
|
6145
|
-
|
|
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)))
|
|
6168
|
-
}
|
|
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, '/');
|
|
6174
|
+
return [result]
|
|
6193
6175
|
}
|
|
6194
|
-
|
|
6195
|
-
let url = encodeURI(path).replace(/[#?]/g, encodeURIComponent);
|
|
6196
|
-
this.memoizedURLs.set(path, url);
|
|
6197
|
-
|
|
6198
|
-
return url
|
|
6199
6176
|
}
|
|
6200
6177
|
}
|
|
6201
6178
|
|
|
@@ -6236,24 +6213,12 @@ function markDirtyUp(node) {
|
|
|
6236
6213
|
}
|
|
6237
6214
|
|
|
6238
6215
|
class Container extends node_1 {
|
|
6239
|
-
|
|
6240
|
-
|
|
6241
|
-
|
|
6242
|
-
for (let node of nodes) this.proxyOf.nodes.push(node);
|
|
6243
|
-
}
|
|
6244
|
-
|
|
6245
|
-
this.markDirty();
|
|
6246
|
-
|
|
6216
|
+
push(child) {
|
|
6217
|
+
child.parent = this;
|
|
6218
|
+
this.proxyOf.nodes.push(child);
|
|
6247
6219
|
return this
|
|
6248
6220
|
}
|
|
6249
6221
|
|
|
6250
|
-
cleanRaws(keepBetween) {
|
|
6251
|
-
super.cleanRaws(keepBetween);
|
|
6252
|
-
if (this.nodes) {
|
|
6253
|
-
for (let node of this.nodes) node.cleanRaws(keepBetween);
|
|
6254
|
-
}
|
|
6255
|
-
}
|
|
6256
|
-
|
|
6257
6222
|
each(callback) {
|
|
6258
6223
|
if (!this.proxyOf.nodes) return undefined
|
|
6259
6224
|
let iterator = this.getIterator();
|
|
@@ -6271,88 +6236,118 @@ class Container extends node_1 {
|
|
|
6271
6236
|
return result
|
|
6272
6237
|
}
|
|
6273
6238
|
|
|
6274
|
-
|
|
6275
|
-
return this.
|
|
6276
|
-
|
|
6277
|
-
|
|
6278
|
-
|
|
6279
|
-
|
|
6280
|
-
|
|
6239
|
+
walk(callback) {
|
|
6240
|
+
return this.each((child, i) => {
|
|
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
|
+
}
|
|
6281
6250
|
|
|
6282
|
-
|
|
6283
|
-
|
|
6284
|
-
|
|
6251
|
+
return result
|
|
6252
|
+
})
|
|
6253
|
+
}
|
|
6285
6254
|
|
|
6286
|
-
|
|
6255
|
+
walkDecls(prop, callback) {
|
|
6256
|
+
if (!callback) {
|
|
6257
|
+
callback = prop;
|
|
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
|
+
})
|
|
6287
6276
|
}
|
|
6288
6277
|
|
|
6289
|
-
|
|
6290
|
-
|
|
6291
|
-
|
|
6292
|
-
|
|
6293
|
-
|
|
6294
|
-
|
|
6295
|
-
return
|
|
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]
|
|
6278
|
+
walkRules(selector, callback) {
|
|
6279
|
+
if (!callback) {
|
|
6280
|
+
callback = selector;
|
|
6281
|
+
|
|
6282
|
+
return this.walk((child, i) => {
|
|
6283
|
+
if (child.type === 'rule') {
|
|
6284
|
+
return callback(child, i)
|
|
6325
6285
|
}
|
|
6326
|
-
}
|
|
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
|
+
})
|
|
6300
|
+
}
|
|
6327
6301
|
|
|
6328
|
-
|
|
6329
|
-
|
|
6330
|
-
|
|
6331
|
-
|
|
6332
|
-
|
|
6302
|
+
walkAtRules(name, callback) {
|
|
6303
|
+
if (!callback) {
|
|
6304
|
+
callback = name;
|
|
6305
|
+
return this.walk((child, i) => {
|
|
6306
|
+
if (child.type === 'atrule') {
|
|
6307
|
+
return callback(child, i)
|
|
6333
6308
|
}
|
|
6334
|
-
|
|
6335
|
-
|
|
6309
|
+
})
|
|
6310
|
+
}
|
|
6311
|
+
if (name instanceof RegExp) {
|
|
6312
|
+
return this.walk((child, i) => {
|
|
6313
|
+
if (child.type === 'atrule' && name.test(child.name)) {
|
|
6314
|
+
return callback(child, i)
|
|
6315
|
+
}
|
|
6316
|
+
})
|
|
6336
6317
|
}
|
|
6318
|
+
return this.walk((child, i) => {
|
|
6319
|
+
if (child.type === 'atrule' && child.name === name) {
|
|
6320
|
+
return callback(child, i)
|
|
6321
|
+
}
|
|
6322
|
+
})
|
|
6337
6323
|
}
|
|
6338
6324
|
|
|
6339
|
-
|
|
6340
|
-
|
|
6341
|
-
|
|
6342
|
-
|
|
6325
|
+
walkComments(callback) {
|
|
6326
|
+
return this.walk((child, i) => {
|
|
6327
|
+
if (child.type === 'comment') {
|
|
6328
|
+
return callback(child, i)
|
|
6329
|
+
}
|
|
6330
|
+
})
|
|
6343
6331
|
}
|
|
6344
6332
|
|
|
6345
|
-
|
|
6346
|
-
let
|
|
6347
|
-
|
|
6348
|
-
|
|
6349
|
-
|
|
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
|
+
}
|
|
6350
6338
|
|
|
6351
|
-
|
|
6352
|
-
|
|
6353
|
-
|
|
6354
|
-
|
|
6355
|
-
|
|
6339
|
+
this.markDirty();
|
|
6340
|
+
|
|
6341
|
+
return this
|
|
6342
|
+
}
|
|
6343
|
+
|
|
6344
|
+
prepend(...children) {
|
|
6345
|
+
children = children.reverse();
|
|
6346
|
+
for (let child of children) {
|
|
6347
|
+
let nodes = this.normalize(child, this.first, 'prepend').reverse();
|
|
6348
|
+
for (let node of nodes) this.proxyOf.nodes.unshift(node);
|
|
6349
|
+
for (let id in this.indexes) {
|
|
6350
|
+
this.indexes[id] = this.indexes[id] + nodes.length;
|
|
6356
6351
|
}
|
|
6357
6352
|
}
|
|
6358
6353
|
|
|
@@ -6361,6 +6356,13 @@ class Container extends node_1 {
|
|
|
6361
6356
|
return this
|
|
6362
6357
|
}
|
|
6363
6358
|
|
|
6359
|
+
cleanRaws(keepBetween) {
|
|
6360
|
+
super.cleanRaws(keepBetween);
|
|
6361
|
+
if (this.nodes) {
|
|
6362
|
+
for (let node of this.nodes) node.cleanRaws(keepBetween);
|
|
6363
|
+
}
|
|
6364
|
+
}
|
|
6365
|
+
|
|
6364
6366
|
insertBefore(exist, add) {
|
|
6365
6367
|
let existIndex = this.index(exist);
|
|
6366
6368
|
let type = existIndex === 0 ? 'prepend' : false;
|
|
@@ -6381,63 +6383,17 @@ class Container extends node_1 {
|
|
|
6381
6383
|
return this
|
|
6382
6384
|
}
|
|
6383
6385
|
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
|
|
6387
|
-
|
|
6388
|
-
|
|
6389
|
-
for (let i of nodes) {
|
|
6390
|
-
if (i.parent) i.parent.removeChild(i, 'ignore');
|
|
6391
|
-
}
|
|
6392
|
-
} else if (nodes.type === 'root' && this.type !== 'document') {
|
|
6393
|
-
nodes = nodes.nodes.slice(0);
|
|
6394
|
-
for (let i of nodes) {
|
|
6395
|
-
if (i.parent) i.parent.removeChild(i, 'ignore');
|
|
6396
|
-
}
|
|
6397
|
-
} else if (nodes.type) {
|
|
6398
|
-
nodes = [nodes];
|
|
6399
|
-
} else if (nodes.prop) {
|
|
6400
|
-
if (typeof nodes.value === 'undefined') {
|
|
6401
|
-
throw new Error('Value field is missed in node creation')
|
|
6402
|
-
} else if (typeof nodes.value !== 'string') {
|
|
6403
|
-
nodes.value = String(nodes.value);
|
|
6404
|
-
}
|
|
6405
|
-
nodes = [new declaration(nodes)];
|
|
6406
|
-
} else if (nodes.selector) {
|
|
6407
|
-
nodes = [new Rule$1(nodes)];
|
|
6408
|
-
} else if (nodes.name) {
|
|
6409
|
-
nodes = [new AtRule$1(nodes)];
|
|
6410
|
-
} else if (nodes.text) {
|
|
6411
|
-
nodes = [new comment(nodes)];
|
|
6412
|
-
} else {
|
|
6413
|
-
throw new Error('Unknown node type in node creation')
|
|
6414
|
-
}
|
|
6415
|
-
|
|
6416
|
-
let processed = nodes.map(i => {
|
|
6417
|
-
/* c8 ignore next */
|
|
6418
|
-
if (!i[my$1]) Container.rebuild(i);
|
|
6419
|
-
i = i.proxyOf;
|
|
6420
|
-
if (i.parent) i.parent.removeChild(i);
|
|
6421
|
-
if (i[isClean$1]) markDirtyUp(i);
|
|
6422
|
-
if (typeof i.raws.before === 'undefined') {
|
|
6423
|
-
if (sample && typeof sample.raws.before !== 'undefined') {
|
|
6424
|
-
i.raws.before = sample.raws.before.replace(/\S/g, '');
|
|
6425
|
-
}
|
|
6426
|
-
}
|
|
6427
|
-
i.parent = this.proxyOf;
|
|
6428
|
-
return i
|
|
6429
|
-
});
|
|
6430
|
-
|
|
6431
|
-
return processed
|
|
6432
|
-
}
|
|
6386
|
+
insertAfter(exist, add) {
|
|
6387
|
+
let existIndex = this.index(exist);
|
|
6388
|
+
let nodes = this.normalize(add, this.proxyOf.nodes[existIndex]).reverse();
|
|
6389
|
+
existIndex = this.index(exist);
|
|
6390
|
+
for (let node of nodes) this.proxyOf.nodes.splice(existIndex + 1, 0, node);
|
|
6433
6391
|
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
for (let id in this.indexes) {
|
|
6440
|
-
this.indexes[id] = this.indexes[id] + nodes.length;
|
|
6392
|
+
let index;
|
|
6393
|
+
for (let id in this.indexes) {
|
|
6394
|
+
index = this.indexes[id];
|
|
6395
|
+
if (existIndex < index) {
|
|
6396
|
+
this.indexes[id] = index + nodes.length;
|
|
6441
6397
|
}
|
|
6442
6398
|
}
|
|
6443
6399
|
|
|
@@ -6446,21 +6402,6 @@ class Container extends node_1 {
|
|
|
6446
6402
|
return this
|
|
6447
6403
|
}
|
|
6448
6404
|
|
|
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
6405
|
removeChild(child) {
|
|
6465
6406
|
child = this.index(child);
|
|
6466
6407
|
this.proxyOf.nodes[child].parent = undefined;
|
|
@@ -6479,6 +6420,15 @@ class Container extends node_1 {
|
|
|
6479
6420
|
return this
|
|
6480
6421
|
}
|
|
6481
6422
|
|
|
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
|
+
|
|
6482
6432
|
replaceValues(pattern, opts, callback) {
|
|
6483
6433
|
if (!callback) {
|
|
6484
6434
|
callback = opts;
|
|
@@ -6497,112 +6447,139 @@ class Container extends node_1 {
|
|
|
6497
6447
|
return this
|
|
6498
6448
|
}
|
|
6499
6449
|
|
|
6450
|
+
every(condition) {
|
|
6451
|
+
return this.nodes.every(condition)
|
|
6452
|
+
}
|
|
6453
|
+
|
|
6500
6454
|
some(condition) {
|
|
6501
6455
|
return this.nodes.some(condition)
|
|
6502
6456
|
}
|
|
6503
6457
|
|
|
6504
|
-
|
|
6505
|
-
|
|
6506
|
-
|
|
6507
|
-
|
|
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
|
-
})
|
|
6458
|
+
index(child) {
|
|
6459
|
+
if (typeof child === 'number') return child
|
|
6460
|
+
if (child.proxyOf) child = child.proxyOf;
|
|
6461
|
+
return this.proxyOf.nodes.indexOf(child)
|
|
6518
6462
|
}
|
|
6519
6463
|
|
|
6520
|
-
|
|
6521
|
-
if (!
|
|
6522
|
-
|
|
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
|
-
})
|
|
6464
|
+
get first() {
|
|
6465
|
+
if (!this.proxyOf.nodes) return undefined
|
|
6466
|
+
return this.proxyOf.nodes[0]
|
|
6541
6467
|
}
|
|
6542
6468
|
|
|
6543
|
-
|
|
6544
|
-
|
|
6545
|
-
|
|
6546
|
-
return callback(child, i)
|
|
6547
|
-
}
|
|
6548
|
-
})
|
|
6469
|
+
get last() {
|
|
6470
|
+
if (!this.proxyOf.nodes) return undefined
|
|
6471
|
+
return this.proxyOf.nodes[this.proxyOf.nodes.length - 1]
|
|
6549
6472
|
}
|
|
6550
6473
|
|
|
6551
|
-
|
|
6552
|
-
if (
|
|
6553
|
-
|
|
6554
|
-
|
|
6555
|
-
|
|
6556
|
-
|
|
6557
|
-
|
|
6558
|
-
}
|
|
6474
|
+
normalize(nodes, sample) {
|
|
6475
|
+
if (typeof nodes === 'string') {
|
|
6476
|
+
nodes = cleanSource(parse$1(nodes).nodes);
|
|
6477
|
+
} else if (Array.isArray(nodes)) {
|
|
6478
|
+
nodes = nodes.slice(0);
|
|
6479
|
+
for (let i of nodes) {
|
|
6480
|
+
if (i.parent) i.parent.removeChild(i, 'ignore');
|
|
6481
|
+
}
|
|
6482
|
+
} else if (nodes.type === 'root' && this.type !== 'document') {
|
|
6483
|
+
nodes = nodes.nodes.slice(0);
|
|
6484
|
+
for (let i of nodes) {
|
|
6485
|
+
if (i.parent) i.parent.removeChild(i, 'ignore');
|
|
6486
|
+
}
|
|
6487
|
+
} else if (nodes.type) {
|
|
6488
|
+
nodes = [nodes];
|
|
6489
|
+
} else if (nodes.prop) {
|
|
6490
|
+
if (typeof nodes.value === 'undefined') {
|
|
6491
|
+
throw new Error('Value field is missed in node creation')
|
|
6492
|
+
} else if (typeof nodes.value !== 'string') {
|
|
6493
|
+
nodes.value = String(nodes.value);
|
|
6494
|
+
}
|
|
6495
|
+
nodes = [new declaration(nodes)];
|
|
6496
|
+
} else if (nodes.selector) {
|
|
6497
|
+
nodes = [new Rule$1(nodes)];
|
|
6498
|
+
} else if (nodes.name) {
|
|
6499
|
+
nodes = [new AtRule$1(nodes)];
|
|
6500
|
+
} else if (nodes.text) {
|
|
6501
|
+
nodes = [new comment(nodes)];
|
|
6502
|
+
} else {
|
|
6503
|
+
throw new Error('Unknown node type in node creation')
|
|
6559
6504
|
}
|
|
6560
|
-
|
|
6561
|
-
|
|
6562
|
-
|
|
6563
|
-
|
|
6505
|
+
|
|
6506
|
+
let processed = nodes.map(i => {
|
|
6507
|
+
/* c8 ignore next */
|
|
6508
|
+
if (!i[my$1]) Container.rebuild(i);
|
|
6509
|
+
i = i.proxyOf;
|
|
6510
|
+
if (i.parent) i.parent.removeChild(i);
|
|
6511
|
+
if (i[isClean$1]) markDirtyUp(i);
|
|
6512
|
+
if (typeof i.raws.before === 'undefined') {
|
|
6513
|
+
if (sample && typeof sample.raws.before !== 'undefined') {
|
|
6514
|
+
i.raws.before = sample.raws.before.replace(/\S/g, '');
|
|
6564
6515
|
}
|
|
6565
|
-
})
|
|
6566
|
-
}
|
|
6567
|
-
return this.walk((child, i) => {
|
|
6568
|
-
if (child.type === 'decl' && child.prop === prop) {
|
|
6569
|
-
return callback(child, i)
|
|
6570
6516
|
}
|
|
6571
|
-
|
|
6572
|
-
|
|
6517
|
+
i.parent = this.proxyOf;
|
|
6518
|
+
return i
|
|
6519
|
+
});
|
|
6573
6520
|
|
|
6574
|
-
|
|
6575
|
-
|
|
6576
|
-
callback = selector;
|
|
6521
|
+
return processed
|
|
6522
|
+
}
|
|
6577
6523
|
|
|
6578
|
-
|
|
6579
|
-
|
|
6580
|
-
|
|
6524
|
+
getProxyProcessor() {
|
|
6525
|
+
return {
|
|
6526
|
+
set(node, prop, value) {
|
|
6527
|
+
if (node[prop] === value) return true
|
|
6528
|
+
node[prop] = value;
|
|
6529
|
+
if (prop === 'name' || prop === 'params' || prop === 'selector') {
|
|
6530
|
+
node.markDirty();
|
|
6581
6531
|
}
|
|
6582
|
-
|
|
6583
|
-
|
|
6584
|
-
|
|
6585
|
-
|
|
6586
|
-
if (
|
|
6587
|
-
return
|
|
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]
|
|
6588
6569
|
}
|
|
6589
|
-
})
|
|
6590
|
-
}
|
|
6591
|
-
return this.walk((child, i) => {
|
|
6592
|
-
if (child.type === 'rule' && child.selector === selector) {
|
|
6593
|
-
return callback(child, i)
|
|
6594
6570
|
}
|
|
6595
|
-
}
|
|
6571
|
+
}
|
|
6596
6572
|
}
|
|
6597
6573
|
|
|
6598
|
-
|
|
6599
|
-
if (!this.
|
|
6600
|
-
|
|
6601
|
-
}
|
|
6574
|
+
getIterator() {
|
|
6575
|
+
if (!this.lastEach) this.lastEach = 0;
|
|
6576
|
+
if (!this.indexes) this.indexes = {};
|
|
6602
6577
|
|
|
6603
|
-
|
|
6604
|
-
|
|
6605
|
-
|
|
6578
|
+
this.lastEach += 1;
|
|
6579
|
+
let iterator = this.lastEach;
|
|
6580
|
+
this.indexes[iterator] = 0;
|
|
6581
|
+
|
|
6582
|
+
return iterator
|
|
6606
6583
|
}
|
|
6607
6584
|
}
|
|
6608
6585
|
|
|
@@ -6697,8 +6674,8 @@ class Warning {
|
|
|
6697
6674
|
toString() {
|
|
6698
6675
|
if (this.node) {
|
|
6699
6676
|
return this.node.error(this.text, {
|
|
6700
|
-
index: this.index,
|
|
6701
6677
|
plugin: this.plugin,
|
|
6678
|
+
index: this.index,
|
|
6702
6679
|
word: this.word
|
|
6703
6680
|
}).message
|
|
6704
6681
|
}
|
|
@@ -6775,7 +6752,7 @@ const AT = '@'.charCodeAt(0);
|
|
|
6775
6752
|
|
|
6776
6753
|
const RE_AT_END = /[\t\n\f\r "#'()/;[\\\]{}]/g;
|
|
6777
6754
|
const RE_WORD_END = /[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g;
|
|
6778
|
-
const RE_BAD_BRACKET = /.[\
|
|
6755
|
+
const RE_BAD_BRACKET = /.[\n"'(/\\]/;
|
|
6779
6756
|
const RE_HEX_ESCAPE = /[\da-f]/i;
|
|
6780
6757
|
|
|
6781
6758
|
var tokenize = function tokenizer(input, options = {}) {
|
|
@@ -7012,8 +6989,8 @@ var tokenize = function tokenizer(input, options = {}) {
|
|
|
7012
6989
|
|
|
7013
6990
|
return {
|
|
7014
6991
|
back,
|
|
7015
|
-
endOfFile,
|
|
7016
6992
|
nextToken,
|
|
6993
|
+
endOfFile,
|
|
7017
6994
|
position
|
|
7018
6995
|
}
|
|
7019
6996
|
};
|
|
@@ -7049,6 +7026,16 @@ class Root extends container {
|
|
|
7049
7026
|
if (!this.nodes) this.nodes = [];
|
|
7050
7027
|
}
|
|
7051
7028
|
|
|
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
|
+
|
|
7052
7039
|
normalize(child, sample, type) {
|
|
7053
7040
|
let nodes = super.normalize(child);
|
|
7054
7041
|
|
|
@@ -7069,16 +7056,6 @@ class Root extends container {
|
|
|
7069
7056
|
return nodes
|
|
7070
7057
|
}
|
|
7071
7058
|
|
|
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
|
-
|
|
7082
7059
|
toResult(opts = {}) {
|
|
7083
7060
|
let lazy = new LazyResult$1(new Processor$1(), this, opts);
|
|
7084
7061
|
return lazy.stringify()
|
|
@@ -7099,15 +7076,6 @@ Root.default = Root;
|
|
|
7099
7076
|
container.registerRoot(Root);
|
|
7100
7077
|
|
|
7101
7078
|
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
|
-
|
|
7111
7079
|
split(string, separators, last) {
|
|
7112
7080
|
let array = [];
|
|
7113
7081
|
let current = '';
|
|
@@ -7149,6 +7117,15 @@ let list = {
|
|
|
7149
7117
|
|
|
7150
7118
|
if (last || current !== '') array.push(current.trim());
|
|
7151
7119
|
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)
|
|
7152
7129
|
}
|
|
7153
7130
|
};
|
|
7154
7131
|
|
|
@@ -7202,150 +7179,55 @@ class Parser {
|
|
|
7202
7179
|
this.customProperty = false;
|
|
7203
7180
|
|
|
7204
7181
|
this.createTokenizer();
|
|
7205
|
-
this.root.source = { input, start: {
|
|
7182
|
+
this.root.source = { input, start: { offset: 0, line: 1, column: 1 } };
|
|
7206
7183
|
}
|
|
7207
7184
|
|
|
7208
|
-
|
|
7209
|
-
|
|
7210
|
-
|
|
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 = [];
|
|
7185
|
+
createTokenizer() {
|
|
7186
|
+
this.tokenizer = tokenize(this.input);
|
|
7187
|
+
}
|
|
7223
7188
|
|
|
7189
|
+
parse() {
|
|
7190
|
+
let token;
|
|
7224
7191
|
while (!this.tokenizer.endOfFile()) {
|
|
7225
7192
|
token = this.tokenizer.nextToken();
|
|
7226
|
-
type = token[0];
|
|
7227
|
-
|
|
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
|
-
}
|
|
7235
7193
|
|
|
7236
|
-
|
|
7237
|
-
|
|
7238
|
-
|
|
7239
|
-
node.source.end.offset++;
|
|
7240
|
-
this.semicolon = true;
|
|
7194
|
+
switch (token[0]) {
|
|
7195
|
+
case 'space':
|
|
7196
|
+
this.spaces += token[1];
|
|
7241
7197
|
break
|
|
7242
|
-
|
|
7243
|
-
|
|
7198
|
+
|
|
7199
|
+
case ';':
|
|
7200
|
+
this.freeSemicolon(token);
|
|
7244
7201
|
break
|
|
7245
|
-
|
|
7246
|
-
|
|
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
|
-
}
|
|
7202
|
+
|
|
7203
|
+
case '}':
|
|
7257
7204
|
this.end(token);
|
|
7258
7205
|
break
|
|
7259
|
-
} else {
|
|
7260
|
-
params.push(token);
|
|
7261
|
-
}
|
|
7262
|
-
} else {
|
|
7263
|
-
params.push(token);
|
|
7264
|
-
}
|
|
7265
|
-
|
|
7266
|
-
if (this.tokenizer.endOfFile()) {
|
|
7267
|
-
last = true;
|
|
7268
|
-
break
|
|
7269
|
-
}
|
|
7270
|
-
}
|
|
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
7206
|
|
|
7294
|
-
|
|
7295
|
-
|
|
7296
|
-
|
|
7207
|
+
case 'comment':
|
|
7208
|
+
this.comment(token);
|
|
7209
|
+
break
|
|
7297
7210
|
|
|
7298
|
-
|
|
7299
|
-
|
|
7300
|
-
|
|
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
|
-
}
|
|
7211
|
+
case 'at-word':
|
|
7212
|
+
this.atrule(token);
|
|
7213
|
+
break
|
|
7315
7214
|
|
|
7316
|
-
|
|
7317
|
-
|
|
7318
|
-
|
|
7319
|
-
for (let [i, element] of tokens.entries()) {
|
|
7320
|
-
token = element;
|
|
7321
|
-
type = token[0];
|
|
7215
|
+
case '{':
|
|
7216
|
+
this.emptyRule(token);
|
|
7217
|
+
break
|
|
7322
7218
|
|
|
7323
|
-
|
|
7324
|
-
|
|
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
|
-
}
|
|
7219
|
+
default:
|
|
7220
|
+
this.other(token);
|
|
7221
|
+
break
|
|
7337
7222
|
}
|
|
7338
|
-
|
|
7339
|
-
prev = token;
|
|
7340
7223
|
}
|
|
7341
|
-
|
|
7224
|
+
this.endFile();
|
|
7342
7225
|
}
|
|
7343
7226
|
|
|
7344
7227
|
comment(token) {
|
|
7345
7228
|
let node = new comment();
|
|
7346
7229
|
this.init(node, token[2]);
|
|
7347
7230
|
node.source.end = this.getPosition(token[3] || token[2]);
|
|
7348
|
-
node.source.end.offset++;
|
|
7349
7231
|
|
|
7350
7232
|
let text = token[1].slice(2, -2);
|
|
7351
7233
|
if (/^\s*$/.test(text)) {
|
|
@@ -7360,8 +7242,86 @@ class Parser {
|
|
|
7360
7242
|
}
|
|
7361
7243
|
}
|
|
7362
7244
|
|
|
7363
|
-
|
|
7364
|
-
|
|
7245
|
+
emptyRule(token) {
|
|
7246
|
+
let node = new rule();
|
|
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;
|
|
7365
7325
|
}
|
|
7366
7326
|
|
|
7367
7327
|
decl(tokens, customProperty) {
|
|
@@ -7377,7 +7337,6 @@ class Parser {
|
|
|
7377
7337
|
node.source.end = this.getPosition(
|
|
7378
7338
|
last[3] || last[2] || findLastWithPosition(tokens)
|
|
7379
7339
|
);
|
|
7380
|
-
node.source.end.offset++;
|
|
7381
7340
|
|
|
7382
7341
|
while (tokens[0][0] !== 'word') {
|
|
7383
7342
|
if (tokens.length === 1) this.unknownWord(tokens);
|
|
@@ -7469,185 +7428,145 @@ class Parser {
|
|
|
7469
7428
|
}
|
|
7470
7429
|
}
|
|
7471
7430
|
|
|
7472
|
-
|
|
7473
|
-
|
|
7474
|
-
|
|
7475
|
-
|
|
7476
|
-
|
|
7477
|
-
)
|
|
7478
|
-
}
|
|
7479
|
-
|
|
7480
|
-
emptyRule(token) {
|
|
7481
|
-
let node = new rule();
|
|
7482
|
-
this.init(node, token[2]);
|
|
7483
|
-
node.selector = '';
|
|
7484
|
-
node.raws.between = '';
|
|
7485
|
-
this.current = node;
|
|
7486
|
-
}
|
|
7487
|
-
|
|
7488
|
-
end(token) {
|
|
7489
|
-
if (this.current.nodes && this.current.nodes.length) {
|
|
7490
|
-
this.current.raws.semicolon = this.semicolon;
|
|
7491
|
-
}
|
|
7492
|
-
this.semicolon = false;
|
|
7493
|
-
|
|
7494
|
-
this.current.raws.after = (this.current.raws.after || '') + this.spaces;
|
|
7495
|
-
this.spaces = '';
|
|
7496
|
-
|
|
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 = '';
|
|
7522
|
-
}
|
|
7523
|
-
}
|
|
7524
|
-
}
|
|
7525
|
-
|
|
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
|
|
7431
|
+
atrule(token) {
|
|
7432
|
+
let node = new atRule();
|
|
7433
|
+
node.name = token[1].slice(1);
|
|
7434
|
+
if (node.name === '') {
|
|
7435
|
+
this.unnamedAtrule(node, token);
|
|
7534
7436
|
}
|
|
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
|
-
}
|
|
7437
|
+
this.init(node, token[2]);
|
|
7547
7438
|
|
|
7548
|
-
|
|
7549
|
-
let
|
|
7550
|
-
let
|
|
7551
|
-
let
|
|
7552
|
-
let
|
|
7439
|
+
let type;
|
|
7440
|
+
let prev;
|
|
7441
|
+
let shift;
|
|
7442
|
+
let last = false;
|
|
7443
|
+
let open = false;
|
|
7444
|
+
let params = [];
|
|
7553
7445
|
let brackets = [];
|
|
7554
|
-
let customProperty = start[1].startsWith('--');
|
|
7555
7446
|
|
|
7556
|
-
|
|
7557
|
-
|
|
7558
|
-
while (token) {
|
|
7447
|
+
while (!this.tokenizer.endOfFile()) {
|
|
7448
|
+
token = this.tokenizer.nextToken();
|
|
7559
7449
|
type = token[0];
|
|
7560
|
-
tokens.push(token);
|
|
7561
7450
|
|
|
7562
7451
|
if (type === '(' || type === '[') {
|
|
7563
|
-
if (!bracket) bracket = token;
|
|
7564
7452
|
brackets.push(type === '(' ? ')' : ']');
|
|
7565
|
-
} else if (
|
|
7566
|
-
if (!bracket) bracket = token;
|
|
7453
|
+
} else if (type === '{' && brackets.length > 0) {
|
|
7567
7454
|
brackets.push('}');
|
|
7568
|
-
} else if (brackets.length
|
|
7455
|
+
} else if (type === brackets[brackets.length - 1]) {
|
|
7456
|
+
brackets.pop();
|
|
7457
|
+
}
|
|
7458
|
+
|
|
7459
|
+
if (brackets.length === 0) {
|
|
7569
7460
|
if (type === ';') {
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
} else {
|
|
7574
|
-
break
|
|
7575
|
-
}
|
|
7461
|
+
node.source.end = this.getPosition(token[2]);
|
|
7462
|
+
this.semicolon = true;
|
|
7463
|
+
break
|
|
7576
7464
|
} else if (type === '{') {
|
|
7577
|
-
|
|
7578
|
-
|
|
7465
|
+
open = true;
|
|
7466
|
+
break
|
|
7579
7467
|
} else if (type === '}') {
|
|
7580
|
-
|
|
7581
|
-
|
|
7468
|
+
if (params.length > 0) {
|
|
7469
|
+
shift = params.length - 1;
|
|
7470
|
+
prev = params[shift];
|
|
7471
|
+
while (prev && prev[0] === 'space') {
|
|
7472
|
+
prev = params[--shift];
|
|
7473
|
+
}
|
|
7474
|
+
if (prev) {
|
|
7475
|
+
node.source.end = this.getPosition(prev[3] || prev[2]);
|
|
7476
|
+
}
|
|
7477
|
+
}
|
|
7478
|
+
this.end(token);
|
|
7582
7479
|
break
|
|
7583
|
-
} else
|
|
7584
|
-
|
|
7480
|
+
} else {
|
|
7481
|
+
params.push(token);
|
|
7585
7482
|
}
|
|
7586
|
-
} else
|
|
7587
|
-
|
|
7588
|
-
if (brackets.length === 0) bracket = null;
|
|
7483
|
+
} else {
|
|
7484
|
+
params.push(token);
|
|
7589
7485
|
}
|
|
7590
7486
|
|
|
7591
|
-
|
|
7592
|
-
|
|
7593
|
-
|
|
7594
|
-
|
|
7595
|
-
|
|
7596
|
-
|
|
7597
|
-
|
|
7598
|
-
|
|
7599
|
-
|
|
7600
|
-
|
|
7601
|
-
|
|
7602
|
-
|
|
7603
|
-
|
|
7487
|
+
if (this.tokenizer.endOfFile()) {
|
|
7488
|
+
last = true;
|
|
7489
|
+
break
|
|
7490
|
+
}
|
|
7491
|
+
}
|
|
7492
|
+
|
|
7493
|
+
node.raws.between = this.spacesAndCommentsFromEnd(params);
|
|
7494
|
+
if (params.length) {
|
|
7495
|
+
node.raws.afterName = this.spacesAndCommentsFromStart(params);
|
|
7496
|
+
this.raw(node, 'params', params);
|
|
7497
|
+
if (last) {
|
|
7498
|
+
token = params[params.length - 1];
|
|
7499
|
+
node.source.end = this.getPosition(token[3] || token[2]);
|
|
7500
|
+
this.spaces = node.raws.between;
|
|
7501
|
+
node.raws.between = '';
|
|
7604
7502
|
}
|
|
7605
|
-
this.decl(tokens, customProperty);
|
|
7606
7503
|
} else {
|
|
7607
|
-
|
|
7504
|
+
node.raws.afterName = '';
|
|
7505
|
+
node.params = '';
|
|
7608
7506
|
}
|
|
7609
|
-
}
|
|
7610
7507
|
|
|
7611
|
-
|
|
7612
|
-
|
|
7613
|
-
|
|
7614
|
-
|
|
7508
|
+
if (open) {
|
|
7509
|
+
node.nodes = [];
|
|
7510
|
+
this.current = node;
|
|
7511
|
+
}
|
|
7512
|
+
}
|
|
7615
7513
|
|
|
7616
|
-
|
|
7617
|
-
|
|
7618
|
-
|
|
7619
|
-
|
|
7514
|
+
end(token) {
|
|
7515
|
+
if (this.current.nodes && this.current.nodes.length) {
|
|
7516
|
+
this.current.raws.semicolon = this.semicolon;
|
|
7517
|
+
}
|
|
7518
|
+
this.semicolon = false;
|
|
7620
7519
|
|
|
7621
|
-
|
|
7622
|
-
|
|
7623
|
-
break
|
|
7520
|
+
this.current.raws.after = (this.current.raws.after || '') + this.spaces;
|
|
7521
|
+
this.spaces = '';
|
|
7624
7522
|
|
|
7625
|
-
|
|
7626
|
-
|
|
7627
|
-
|
|
7523
|
+
if (this.current.parent) {
|
|
7524
|
+
this.current.source.end = this.getPosition(token[2]);
|
|
7525
|
+
this.current = this.current.parent;
|
|
7526
|
+
} else {
|
|
7527
|
+
this.unexpectedClose(token);
|
|
7528
|
+
}
|
|
7529
|
+
}
|
|
7628
7530
|
|
|
7629
|
-
|
|
7630
|
-
|
|
7631
|
-
|
|
7531
|
+
endFile() {
|
|
7532
|
+
if (this.current.parent) this.unclosedBlock();
|
|
7533
|
+
if (this.current.nodes && this.current.nodes.length) {
|
|
7534
|
+
this.current.raws.semicolon = this.semicolon;
|
|
7535
|
+
}
|
|
7536
|
+
this.current.raws.after = (this.current.raws.after || '') + this.spaces;
|
|
7537
|
+
}
|
|
7632
7538
|
|
|
7633
|
-
|
|
7634
|
-
|
|
7635
|
-
|
|
7539
|
+
freeSemicolon(token) {
|
|
7540
|
+
this.spaces += token[1];
|
|
7541
|
+
if (this.current.nodes) {
|
|
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
|
+
}
|
|
7636
7549
|
|
|
7637
|
-
|
|
7638
|
-
this.emptyRule(token);
|
|
7639
|
-
break
|
|
7550
|
+
// Helpers
|
|
7640
7551
|
|
|
7641
|
-
|
|
7642
|
-
|
|
7643
|
-
|
|
7644
|
-
|
|
7552
|
+
getPosition(offset) {
|
|
7553
|
+
let pos = this.input.fromOffset(offset);
|
|
7554
|
+
return {
|
|
7555
|
+
offset,
|
|
7556
|
+
line: pos.line,
|
|
7557
|
+
column: pos.col
|
|
7645
7558
|
}
|
|
7646
|
-
this.endFile();
|
|
7647
7559
|
}
|
|
7648
7560
|
|
|
7649
|
-
|
|
7650
|
-
|
|
7561
|
+
init(node, offset) {
|
|
7562
|
+
this.current.push(node);
|
|
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;
|
|
7651
7570
|
}
|
|
7652
7571
|
|
|
7653
7572
|
raw(node, prop, tokens, customProperty) {
|
|
@@ -7680,22 +7599,11 @@ class Parser {
|
|
|
7680
7599
|
}
|
|
7681
7600
|
if (!clean) {
|
|
7682
7601
|
let raw = tokens.reduce((all, i) => all + i[1], '');
|
|
7683
|
-
node.raws[prop] = {
|
|
7602
|
+
node.raws[prop] = { value, raw };
|
|
7684
7603
|
}
|
|
7685
7604
|
node[prop] = value;
|
|
7686
7605
|
}
|
|
7687
7606
|
|
|
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
|
-
|
|
7699
7607
|
spacesAndCommentsFromEnd(tokens) {
|
|
7700
7608
|
let lastTokenType;
|
|
7701
7609
|
let spaces = '';
|
|
@@ -7707,8 +7615,6 @@ class Parser {
|
|
|
7707
7615
|
return spaces
|
|
7708
7616
|
}
|
|
7709
7617
|
|
|
7710
|
-
// Errors
|
|
7711
|
-
|
|
7712
7618
|
spacesAndCommentsFromStart(tokens) {
|
|
7713
7619
|
let next;
|
|
7714
7620
|
let spaces = '';
|
|
@@ -7740,11 +7646,36 @@ class Parser {
|
|
|
7740
7646
|
return result
|
|
7741
7647
|
}
|
|
7742
7648
|
|
|
7743
|
-
|
|
7744
|
-
let
|
|
7745
|
-
|
|
7649
|
+
colon(tokens) {
|
|
7650
|
+
let brackets = 0;
|
|
7651
|
+
let token, type, prev;
|
|
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
|
|
7746
7675
|
}
|
|
7747
7676
|
|
|
7677
|
+
// Errors
|
|
7678
|
+
|
|
7748
7679
|
unclosedBracket(bracket) {
|
|
7749
7680
|
throw this.input.error(
|
|
7750
7681
|
'Unclosed bracket',
|
|
@@ -7753,6 +7684,14 @@ class Parser {
|
|
|
7753
7684
|
)
|
|
7754
7685
|
}
|
|
7755
7686
|
|
|
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
|
+
|
|
7756
7695
|
unexpectedClose(token) {
|
|
7757
7696
|
throw this.input.error(
|
|
7758
7697
|
'Unexpected }',
|
|
@@ -7761,11 +7700,16 @@ class Parser {
|
|
|
7761
7700
|
)
|
|
7762
7701
|
}
|
|
7763
7702
|
|
|
7764
|
-
|
|
7703
|
+
unclosedBlock() {
|
|
7704
|
+
let pos = this.current.source.start;
|
|
7705
|
+
throw this.input.error('Unclosed block', pos.line, pos.column)
|
|
7706
|
+
}
|
|
7707
|
+
|
|
7708
|
+
doubleColon(token) {
|
|
7765
7709
|
throw this.input.error(
|
|
7766
|
-
'
|
|
7767
|
-
{ offset:
|
|
7768
|
-
{ offset:
|
|
7710
|
+
'Double colon',
|
|
7711
|
+
{ offset: token[2] },
|
|
7712
|
+
{ offset: token[2] + token[1].length }
|
|
7769
7713
|
)
|
|
7770
7714
|
}
|
|
7771
7715
|
|
|
@@ -7776,6 +7720,32 @@ class Parser {
|
|
|
7776
7720
|
{ offset: token[2] + token[1].length }
|
|
7777
7721
|
)
|
|
7778
7722
|
}
|
|
7723
|
+
|
|
7724
|
+
precheckMissedSemicolon(/* tokens */) {
|
|
7725
|
+
// Hook for Safe Parser
|
|
7726
|
+
}
|
|
7727
|
+
|
|
7728
|
+
checkMissedSemicolon(tokens) {
|
|
7729
|
+
let colon = this.colon(tokens);
|
|
7730
|
+
if (colon === false) return
|
|
7731
|
+
|
|
7732
|
+
let founded = 0;
|
|
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
|
+
}
|
|
7779
7749
|
}
|
|
7780
7750
|
|
|
7781
7751
|
var parser = Parser;
|
|
@@ -7808,37 +7778,37 @@ let { isClean, my } = symbols;
|
|
|
7808
7778
|
|
|
7809
7779
|
|
|
7810
7780
|
const TYPE_TO_CLASS_NAME = {
|
|
7811
|
-
atrule: 'AtRule',
|
|
7812
|
-
comment: 'Comment',
|
|
7813
|
-
decl: 'Declaration',
|
|
7814
7781
|
document: 'Document',
|
|
7815
7782
|
root: 'Root',
|
|
7816
|
-
|
|
7783
|
+
atrule: 'AtRule',
|
|
7784
|
+
rule: 'Rule',
|
|
7785
|
+
decl: 'Declaration',
|
|
7786
|
+
comment: 'Comment'
|
|
7817
7787
|
};
|
|
7818
7788
|
|
|
7819
7789
|
const PLUGIN_PROPS = {
|
|
7820
|
-
AtRule: true,
|
|
7821
|
-
AtRuleExit: true,
|
|
7822
|
-
Comment: true,
|
|
7823
|
-
CommentExit: true,
|
|
7824
|
-
Declaration: true,
|
|
7825
|
-
DeclarationExit: true,
|
|
7826
|
-
Document: true,
|
|
7827
|
-
DocumentExit: true,
|
|
7828
|
-
Once: true,
|
|
7829
|
-
OnceExit: true,
|
|
7830
7790
|
postcssPlugin: true,
|
|
7831
7791
|
prepare: true,
|
|
7792
|
+
Once: true,
|
|
7793
|
+
Document: true,
|
|
7832
7794
|
Root: true,
|
|
7833
|
-
|
|
7795
|
+
Declaration: true,
|
|
7834
7796
|
Rule: true,
|
|
7835
|
-
|
|
7797
|
+
AtRule: true,
|
|
7798
|
+
Comment: true,
|
|
7799
|
+
DeclarationExit: true,
|
|
7800
|
+
RuleExit: true,
|
|
7801
|
+
AtRuleExit: true,
|
|
7802
|
+
CommentExit: true,
|
|
7803
|
+
RootExit: true,
|
|
7804
|
+
DocumentExit: true,
|
|
7805
|
+
OnceExit: true
|
|
7836
7806
|
};
|
|
7837
7807
|
|
|
7838
7808
|
const NOT_VISITORS = {
|
|
7839
|
-
Once: true,
|
|
7840
7809
|
postcssPlugin: true,
|
|
7841
|
-
prepare: true
|
|
7810
|
+
prepare: true,
|
|
7811
|
+
Once: true
|
|
7842
7812
|
};
|
|
7843
7813
|
|
|
7844
7814
|
const CHILDREN = 0;
|
|
@@ -7884,12 +7854,12 @@ function toStack(node) {
|
|
|
7884
7854
|
}
|
|
7885
7855
|
|
|
7886
7856
|
return {
|
|
7887
|
-
eventIndex: 0,
|
|
7888
|
-
events,
|
|
7889
|
-
iterator: 0,
|
|
7890
7857
|
node,
|
|
7858
|
+
events,
|
|
7859
|
+
eventIndex: 0,
|
|
7860
|
+
visitors: [],
|
|
7891
7861
|
visitorIndex: 0,
|
|
7892
|
-
|
|
7862
|
+
iterator: 0
|
|
7893
7863
|
}
|
|
7894
7864
|
}
|
|
7895
7865
|
|
|
@@ -7939,24 +7909,59 @@ class LazyResult {
|
|
|
7939
7909
|
}
|
|
7940
7910
|
}
|
|
7941
7911
|
|
|
7942
|
-
this.result = new result(processor, root, opts);
|
|
7943
|
-
this.helpers = { ...postcss$1, postcss: postcss$1
|
|
7944
|
-
this.plugins = this.processor.plugins.map(plugin => {
|
|
7945
|
-
if (typeof plugin === 'object' && plugin.prepare) {
|
|
7946
|
-
return { ...plugin, ...plugin.prepare(this.result) }
|
|
7947
|
-
} else {
|
|
7948
|
-
return plugin
|
|
7949
|
-
}
|
|
7950
|
-
});
|
|
7912
|
+
this.result = new result(processor, root, opts);
|
|
7913
|
+
this.helpers = { ...postcss$1, result: this.result, postcss: postcss$1 };
|
|
7914
|
+
this.plugins = this.processor.plugins.map(plugin => {
|
|
7915
|
+
if (typeof plugin === 'object' && plugin.prepare) {
|
|
7916
|
+
return { ...plugin, ...plugin.prepare(this.result) }
|
|
7917
|
+
} else {
|
|
7918
|
+
return plugin
|
|
7919
|
+
}
|
|
7920
|
+
});
|
|
7921
|
+
}
|
|
7922
|
+
|
|
7923
|
+
get [Symbol.toStringTag]() {
|
|
7924
|
+
return 'LazyResult'
|
|
7925
|
+
}
|
|
7926
|
+
|
|
7927
|
+
get processor() {
|
|
7928
|
+
return this.result.processor
|
|
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()
|
|
7951
7957
|
}
|
|
7952
7958
|
|
|
7953
|
-
|
|
7954
|
-
|
|
7955
|
-
|
|
7956
|
-
|
|
7957
|
-
|
|
7958
|
-
|
|
7959
|
-
return this.processing
|
|
7959
|
+
toString() {
|
|
7960
|
+
return this.css
|
|
7961
|
+
}
|
|
7962
|
+
|
|
7963
|
+
then(onFulfilled, onRejected) {
|
|
7964
|
+
return this.async().then(onFulfilled, onRejected)
|
|
7960
7965
|
}
|
|
7961
7966
|
|
|
7962
7967
|
catch(onRejected) {
|
|
@@ -7967,76 +7972,28 @@ class LazyResult {
|
|
|
7967
7972
|
return this.async().then(onFinally, onFinally)
|
|
7968
7973
|
}
|
|
7969
7974
|
|
|
7970
|
-
|
|
7971
|
-
|
|
7972
|
-
|
|
7973
|
-
|
|
7974
|
-
|
|
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);
|
|
7975
|
+
async() {
|
|
7976
|
+
if (this.error) return Promise.reject(this.error)
|
|
7977
|
+
if (this.processed) return Promise.resolve(this.result)
|
|
7978
|
+
if (!this.processing) {
|
|
7979
|
+
this.processing = this.runAsync();
|
|
7987
7980
|
}
|
|
7988
|
-
return
|
|
7981
|
+
return this.processing
|
|
7989
7982
|
}
|
|
7990
7983
|
|
|
7991
|
-
|
|
7992
|
-
this.
|
|
7993
|
-
|
|
7994
|
-
|
|
7995
|
-
|
|
7996
|
-
|
|
7997
|
-
|
|
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
|
-
}
|
|
7984
|
+
sync() {
|
|
7985
|
+
if (this.error) throw this.error
|
|
7986
|
+
if (this.processed) return this.result
|
|
7987
|
+
this.processed = true;
|
|
7988
|
+
|
|
7989
|
+
if (this.processing) {
|
|
7990
|
+
throw this.getAsyncError()
|
|
8025
7991
|
}
|
|
8026
|
-
this.hasListener = Object.keys(this.listeners).length > 0;
|
|
8027
|
-
}
|
|
8028
7992
|
|
|
8029
|
-
|
|
8030
|
-
this.plugin = 0;
|
|
8031
|
-
for (let i = 0; i < this.plugins.length; i++) {
|
|
8032
|
-
let plugin = this.plugins[i];
|
|
7993
|
+
for (let plugin of this.plugins) {
|
|
8033
7994
|
let promise = this.runOnRoot(plugin);
|
|
8034
7995
|
if (isPromise(promise)) {
|
|
8035
|
-
|
|
8036
|
-
await promise;
|
|
8037
|
-
} catch (error) {
|
|
8038
|
-
throw this.handleError(error)
|
|
8039
|
-
}
|
|
7996
|
+
throw this.getAsyncError()
|
|
8040
7997
|
}
|
|
8041
7998
|
}
|
|
8042
7999
|
|
|
@@ -8045,42 +8002,78 @@ class LazyResult {
|
|
|
8045
8002
|
let root = this.result.root;
|
|
8046
8003
|
while (!root[isClean]) {
|
|
8047
8004
|
root[isClean] = true;
|
|
8048
|
-
|
|
8049
|
-
|
|
8050
|
-
|
|
8051
|
-
|
|
8052
|
-
|
|
8053
|
-
|
|
8054
|
-
} catch (e) {
|
|
8055
|
-
let node = stack[stack.length - 1].node;
|
|
8056
|
-
throw this.handleError(e, node)
|
|
8057
|
-
}
|
|
8005
|
+
this.walkSync(root);
|
|
8006
|
+
}
|
|
8007
|
+
if (this.listeners.OnceExit) {
|
|
8008
|
+
if (root.type === 'document') {
|
|
8009
|
+
for (let subRoot of root.nodes) {
|
|
8010
|
+
this.visitSync(this.listeners.OnceExit, subRoot);
|
|
8058
8011
|
}
|
|
8012
|
+
} else {
|
|
8013
|
+
this.visitSync(this.listeners.OnceExit, root);
|
|
8059
8014
|
}
|
|
8060
8015
|
}
|
|
8016
|
+
}
|
|
8061
8017
|
|
|
8062
|
-
|
|
8063
|
-
|
|
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
|
-
);
|
|
8018
|
+
return this.result
|
|
8019
|
+
}
|
|
8070
8020
|
|
|
8071
|
-
|
|
8072
|
-
|
|
8073
|
-
|
|
8074
|
-
|
|
8075
|
-
|
|
8076
|
-
|
|
8077
|
-
|
|
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
|
+
|
|
8028
|
+
let opts = this.result.opts;
|
|
8029
|
+
let str = stringify_1;
|
|
8030
|
+
if (opts.syntax) str = opts.syntax.stringify;
|
|
8031
|
+
if (opts.stringifier) str = opts.stringifier;
|
|
8032
|
+
if (str.stringify) str = str.stringify;
|
|
8033
|
+
|
|
8034
|
+
let map = new mapGenerator(str, this.result.root, this.result.opts);
|
|
8035
|
+
let data = map.generate();
|
|
8036
|
+
this.result.css = data[0];
|
|
8037
|
+
this.result.map = data[1];
|
|
8038
|
+
|
|
8039
|
+
return this.result
|
|
8040
|
+
}
|
|
8041
|
+
|
|
8042
|
+
walkSync(node) {
|
|
8043
|
+
node[isClean] = true;
|
|
8044
|
+
let events = getEvents(node);
|
|
8045
|
+
for (let event of events) {
|
|
8046
|
+
if (event === CHILDREN) {
|
|
8047
|
+
if (node.nodes) {
|
|
8048
|
+
node.each(child => {
|
|
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
|
|
8078
8056
|
}
|
|
8079
8057
|
}
|
|
8080
8058
|
}
|
|
8059
|
+
}
|
|
8081
8060
|
|
|
8082
|
-
|
|
8083
|
-
|
|
8061
|
+
visitSync(visitors, node) {
|
|
8062
|
+
for (let [plugin, visitor] of visitors) {
|
|
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
|
+
}
|
|
8084
8077
|
}
|
|
8085
8078
|
|
|
8086
8079
|
runOnRoot(plugin) {
|
|
@@ -8108,40 +8101,38 @@ class LazyResult {
|
|
|
8108
8101
|
}
|
|
8109
8102
|
}
|
|
8110
8103
|
|
|
8111
|
-
|
|
8112
|
-
|
|
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
|
|
8104
|
+
getAsyncError() {
|
|
8105
|
+
throw new Error('Use process(css).then(cb) to work with async plugins')
|
|
8130
8106
|
}
|
|
8131
8107
|
|
|
8132
|
-
|
|
8133
|
-
|
|
8134
|
-
|
|
8135
|
-
|
|
8136
|
-
|
|
8137
|
-
|
|
8138
|
-
|
|
8108
|
+
handleError(error, node) {
|
|
8109
|
+
let plugin = this.result.lastPlugin;
|
|
8110
|
+
try {
|
|
8111
|
+
if (node) node.addToError(error);
|
|
8112
|
+
this.error = error;
|
|
8113
|
+
if (error.name === 'CssSyntaxError' && !error.plugin) {
|
|
8114
|
+
error.plugin = plugin.postcssPlugin;
|
|
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);
|
|
8139
8121
|
}
|
|
8122
|
+
return error
|
|
8123
|
+
}
|
|
8140
8124
|
|
|
8141
|
-
|
|
8125
|
+
async runAsync() {
|
|
8126
|
+
this.plugin = 0;
|
|
8127
|
+
for (let i = 0; i < this.plugins.length; i++) {
|
|
8128
|
+
let plugin = this.plugins[i];
|
|
8142
8129
|
let promise = this.runOnRoot(plugin);
|
|
8143
8130
|
if (isPromise(promise)) {
|
|
8144
|
-
|
|
8131
|
+
try {
|
|
8132
|
+
await promise;
|
|
8133
|
+
} catch (error) {
|
|
8134
|
+
throw this.handleError(error)
|
|
8135
|
+
}
|
|
8145
8136
|
}
|
|
8146
8137
|
}
|
|
8147
8138
|
|
|
@@ -8150,46 +8141,80 @@ class LazyResult {
|
|
|
8150
8141
|
let root = this.result.root;
|
|
8151
8142
|
while (!root[isClean]) {
|
|
8152
8143
|
root[isClean] = true;
|
|
8153
|
-
|
|
8144
|
+
let stack = [toStack(root)];
|
|
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
|
+
}
|
|
8154
8156
|
}
|
|
8157
|
+
|
|
8155
8158
|
if (this.listeners.OnceExit) {
|
|
8156
|
-
|
|
8157
|
-
|
|
8158
|
-
|
|
8159
|
+
for (let [plugin, visitor] of this.listeners.OnceExit) {
|
|
8160
|
+
this.result.lastPlugin = plugin;
|
|
8161
|
+
try {
|
|
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)
|
|
8159
8173
|
}
|
|
8160
|
-
} else {
|
|
8161
|
-
this.visitSync(this.listeners.OnceExit, root);
|
|
8162
8174
|
}
|
|
8163
8175
|
}
|
|
8164
8176
|
}
|
|
8165
8177
|
|
|
8166
|
-
|
|
8167
|
-
|
|
8168
|
-
|
|
8169
|
-
then(onFulfilled, onRejected) {
|
|
8170
|
-
return this.async().then(onFulfilled, onRejected)
|
|
8171
|
-
}
|
|
8172
|
-
|
|
8173
|
-
toString() {
|
|
8174
|
-
return this.css
|
|
8178
|
+
this.processed = true;
|
|
8179
|
+
return this.stringify()
|
|
8175
8180
|
}
|
|
8176
8181
|
|
|
8177
|
-
|
|
8178
|
-
|
|
8179
|
-
|
|
8180
|
-
|
|
8181
|
-
|
|
8182
|
-
|
|
8183
|
-
|
|
8184
|
-
|
|
8185
|
-
|
|
8186
|
-
|
|
8187
|
-
|
|
8188
|
-
|
|
8189
|
-
|
|
8190
|
-
|
|
8182
|
+
prepareVisitors() {
|
|
8183
|
+
this.listeners = {};
|
|
8184
|
+
let add = (plugin, type, cb) => {
|
|
8185
|
+
if (!this.listeners[type]) this.listeners[type] = [];
|
|
8186
|
+
this.listeners[type].push([plugin, cb]);
|
|
8187
|
+
};
|
|
8188
|
+
for (let plugin of this.plugins) {
|
|
8189
|
+
if (typeof plugin === 'object') {
|
|
8190
|
+
for (let event in plugin) {
|
|
8191
|
+
if (!PLUGIN_PROPS[event] && /^[A-Z]/.test(event)) {
|
|
8192
|
+
throw new Error(
|
|
8193
|
+
`Unknown event ${event} in ${plugin.postcssPlugin}. ` +
|
|
8194
|
+
`Try to update PostCSS (${this.processor.version} now).`
|
|
8195
|
+
)
|
|
8196
|
+
}
|
|
8197
|
+
if (!NOT_VISITORS[event]) {
|
|
8198
|
+
if (typeof plugin[event] === 'object') {
|
|
8199
|
+
for (let filter in plugin[event]) {
|
|
8200
|
+
if (filter === '*') {
|
|
8201
|
+
add(plugin, event, plugin[event][filter]);
|
|
8202
|
+
} else {
|
|
8203
|
+
add(
|
|
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
|
+
}
|
|
8191
8215
|
}
|
|
8192
8216
|
}
|
|
8217
|
+
this.hasListener = Object.keys(this.listeners).length > 0;
|
|
8193
8218
|
}
|
|
8194
8219
|
|
|
8195
8220
|
visitTick(stack) {
|
|
@@ -8248,61 +8273,6 @@ class LazyResult {
|
|
|
8248
8273
|
}
|
|
8249
8274
|
stack.pop();
|
|
8250
8275
|
}
|
|
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
|
-
}
|
|
8306
8276
|
}
|
|
8307
8277
|
|
|
8308
8278
|
LazyResult.registerPostcss = dependant => {
|
|
@@ -8349,42 +8319,23 @@ class NoWorkResult {
|
|
|
8349
8319
|
}
|
|
8350
8320
|
}
|
|
8351
8321
|
|
|
8352
|
-
|
|
8353
|
-
|
|
8354
|
-
return Promise.resolve(this.result)
|
|
8355
|
-
}
|
|
8356
|
-
|
|
8357
|
-
catch(onRejected) {
|
|
8358
|
-
return this.async().catch(onRejected)
|
|
8359
|
-
}
|
|
8360
|
-
|
|
8361
|
-
finally(onFinally) {
|
|
8362
|
-
return this.async().then(onFinally, onFinally)
|
|
8363
|
-
}
|
|
8364
|
-
|
|
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)
|
|
8322
|
+
get [Symbol.toStringTag]() {
|
|
8323
|
+
return 'NoWorkResult'
|
|
8373
8324
|
}
|
|
8374
8325
|
|
|
8375
|
-
|
|
8376
|
-
return this.
|
|
8326
|
+
get processor() {
|
|
8327
|
+
return this.result.processor
|
|
8377
8328
|
}
|
|
8378
8329
|
|
|
8379
|
-
|
|
8380
|
-
return
|
|
8330
|
+
get opts() {
|
|
8331
|
+
return this.result.opts
|
|
8381
8332
|
}
|
|
8382
8333
|
|
|
8383
|
-
get
|
|
8334
|
+
get css() {
|
|
8384
8335
|
return this.result.css
|
|
8385
8336
|
}
|
|
8386
8337
|
|
|
8387
|
-
get
|
|
8338
|
+
get content() {
|
|
8388
8339
|
return this.result.css
|
|
8389
8340
|
}
|
|
8390
8341
|
|
|
@@ -8392,18 +8343,6 @@ class NoWorkResult {
|
|
|
8392
8343
|
return this.result.map
|
|
8393
8344
|
}
|
|
8394
8345
|
|
|
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
|
-
|
|
8407
8346
|
get root() {
|
|
8408
8347
|
if (this._root) {
|
|
8409
8348
|
return this._root
|
|
@@ -8426,8 +8365,39 @@ class NoWorkResult {
|
|
|
8426
8365
|
}
|
|
8427
8366
|
}
|
|
8428
8367
|
|
|
8429
|
-
get
|
|
8430
|
-
return
|
|
8368
|
+
get messages() {
|
|
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
|
|
8431
8401
|
}
|
|
8432
8402
|
}
|
|
8433
8403
|
|
|
@@ -8436,10 +8406,28 @@ NoWorkResult.default = NoWorkResult;
|
|
|
8436
8406
|
|
|
8437
8407
|
class Processor {
|
|
8438
8408
|
constructor(plugins = []) {
|
|
8439
|
-
this.version = '8.4.
|
|
8409
|
+
this.version = '8.4.24';
|
|
8440
8410
|
this.plugins = this.normalize(plugins);
|
|
8441
8411
|
}
|
|
8442
8412
|
|
|
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
|
+
|
|
8443
8431
|
normalize(plugins) {
|
|
8444
8432
|
let normalized = [];
|
|
8445
8433
|
for (let i of plugins) {
|
|
@@ -8461,24 +8449,6 @@ class Processor {
|
|
|
8461
8449
|
}
|
|
8462
8450
|
return normalized
|
|
8463
8451
|
}
|
|
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
|
-
}
|
|
8482
8452
|
}
|
|
8483
8453
|
|
|
8484
8454
|
var processor = Processor;
|