@posthog/rrdom 0.0.6 → 0.0.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/rrdom.cjs +1429 -1372
- package/dist/rrdom.cjs.map +1 -1
- package/dist/rrdom.js +1429 -1372
- package/dist/rrdom.js.map +1 -1
- package/dist/rrdom.umd.cjs +1433 -1376
- package/dist/rrdom.umd.cjs.map +3 -3
- package/dist/rrdom.umd.min.cjs +16 -14
- package/dist/rrdom.umd.min.cjs.map +3 -3
- package/package.json +1 -1
package/dist/rrdom.js
CHANGED
|
@@ -92,7 +92,7 @@ function getAugmentedNamespace(n) {
|
|
|
92
92
|
var picocolors_browser = { exports: {} };
|
|
93
93
|
var x = String;
|
|
94
94
|
var create = function() {
|
|
95
|
-
return { isColorSupported: false, reset: x, bold: x, dim: x, italic: x, underline: x, inverse: x, hidden: x, strikethrough: x, black: x, red: x, green: x, yellow: x, blue: x, magenta: x, cyan: x, white: x, gray: x, bgBlack: x, bgRed: x, bgGreen: x, bgYellow: x, bgBlue: x, bgMagenta: x, bgCyan: x, bgWhite: x };
|
|
95
|
+
return { isColorSupported: false, reset: x, bold: x, dim: x, italic: x, underline: x, inverse: x, hidden: x, strikethrough: x, black: x, red: x, green: x, yellow: x, blue: x, magenta: x, cyan: x, white: x, gray: x, bgBlack: x, bgRed: x, bgGreen: x, bgYellow: x, bgBlue: x, bgMagenta: x, bgCyan: x, bgWhite: x, blackBright: x, redBright: x, greenBright: x, yellowBright: x, blueBright: x, magentaBright: x, cyanBright: x, whiteBright: x, bgBlackBright: x, bgRedBright: x, bgGreenBright: x, bgYellowBright: x, bgBlueBright: x, bgMagentaBright: x, bgCyanBright: x, bgWhiteBright: x };
|
|
96
96
|
};
|
|
97
97
|
picocolors_browser.exports = create();
|
|
98
98
|
picocolors_browser.exports.createColors = create;
|
|
@@ -105,8 +105,8 @@ const __viteBrowserExternal$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Ob
|
|
|
105
105
|
const require$$2 = /* @__PURE__ */ getAugmentedNamespace(__viteBrowserExternal$1);
|
|
106
106
|
let pico = picocolors_browserExports;
|
|
107
107
|
let terminalHighlight$1 = require$$2;
|
|
108
|
-
let CssSyntaxError$
|
|
109
|
-
constructor(message, line, column, source, file,
|
|
108
|
+
let CssSyntaxError$4 = class CssSyntaxError extends Error {
|
|
109
|
+
constructor(message, line, column, source, file, plugin3) {
|
|
110
110
|
super(message);
|
|
111
111
|
this.name = "CssSyntaxError";
|
|
112
112
|
this.reason = message;
|
|
@@ -116,8 +116,8 @@ let CssSyntaxError$3 = class CssSyntaxError extends Error {
|
|
|
116
116
|
if (source) {
|
|
117
117
|
this.source = source;
|
|
118
118
|
}
|
|
119
|
-
if (
|
|
120
|
-
this.plugin =
|
|
119
|
+
if (plugin3) {
|
|
120
|
+
this.plugin = plugin3;
|
|
121
121
|
}
|
|
122
122
|
if (typeof line !== "undefined" && typeof column !== "undefined") {
|
|
123
123
|
if (typeof line === "number") {
|
|
@@ -147,29 +147,40 @@ let CssSyntaxError$3 = class CssSyntaxError extends Error {
|
|
|
147
147
|
if (!this.source) return "";
|
|
148
148
|
let css = this.source;
|
|
149
149
|
if (color == null) color = pico.isColorSupported;
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
let lines = css.split(/\r?\n/);
|
|
154
|
-
let start = Math.max(this.line - 3, 0);
|
|
155
|
-
let end = Math.min(this.line + 2, lines.length);
|
|
156
|
-
let maxWidth = String(end).length;
|
|
157
|
-
let mark, aside;
|
|
150
|
+
let aside = (text) => text;
|
|
151
|
+
let mark = (text) => text;
|
|
152
|
+
let highlight = (text) => text;
|
|
158
153
|
if (color) {
|
|
159
154
|
let { bold, gray, red } = pico.createColors(true);
|
|
160
155
|
mark = (text) => bold(red(text));
|
|
161
156
|
aside = (text) => gray(text);
|
|
162
|
-
|
|
163
|
-
|
|
157
|
+
if (terminalHighlight$1) {
|
|
158
|
+
highlight = (text) => terminalHighlight$1(text);
|
|
159
|
+
}
|
|
164
160
|
}
|
|
161
|
+
let lines = css.split(/\r?\n/);
|
|
162
|
+
let start = Math.max(this.line - 3, 0);
|
|
163
|
+
let end = Math.min(this.line + 2, lines.length);
|
|
164
|
+
let maxWidth = String(end).length;
|
|
165
165
|
return lines.slice(start, end).map((line, index2) => {
|
|
166
166
|
let number = start + 1 + index2;
|
|
167
167
|
let gutter = " " + (" " + number).slice(-maxWidth) + " | ";
|
|
168
168
|
if (number === this.line) {
|
|
169
|
+
if (line.length > 160) {
|
|
170
|
+
let padding = 20;
|
|
171
|
+
let subLineStart = Math.max(0, this.column - padding);
|
|
172
|
+
let subLineEnd = Math.max(
|
|
173
|
+
this.column + padding,
|
|
174
|
+
this.endColumn + padding
|
|
175
|
+
);
|
|
176
|
+
let subLine = line.slice(subLineStart, subLineEnd);
|
|
177
|
+
let spacing2 = aside(gutter.replace(/\d/g, " ")) + line.slice(0, Math.min(this.column - 1, padding - 1)).replace(/[^\t]/g, " ");
|
|
178
|
+
return mark(">") + aside(gutter) + highlight(subLine) + "\n " + spacing2 + mark("^");
|
|
179
|
+
}
|
|
169
180
|
let spacing = aside(gutter.replace(/\d/g, " ")) + line.slice(0, this.column - 1).replace(/[^\t]/g, " ");
|
|
170
|
-
return mark(">") + aside(gutter) + line + "\n " + spacing + mark("^");
|
|
181
|
+
return mark(">") + aside(gutter) + highlight(line) + "\n " + spacing + mark("^");
|
|
171
182
|
}
|
|
172
|
-
return " " + aside(gutter) + line;
|
|
183
|
+
return " " + aside(gutter) + highlight(line);
|
|
173
184
|
}).join("\n");
|
|
174
185
|
}
|
|
175
186
|
toString() {
|
|
@@ -180,11 +191,8 @@ let CssSyntaxError$3 = class CssSyntaxError extends Error {
|
|
|
180
191
|
return this.name + ": " + this.message + code;
|
|
181
192
|
}
|
|
182
193
|
};
|
|
183
|
-
var cssSyntaxError = CssSyntaxError$
|
|
184
|
-
CssSyntaxError$
|
|
185
|
-
var symbols = {};
|
|
186
|
-
symbols.isClean = Symbol("isClean");
|
|
187
|
-
symbols.my = Symbol("my");
|
|
194
|
+
var cssSyntaxError = CssSyntaxError$4;
|
|
195
|
+
CssSyntaxError$4.default = CssSyntaxError$4;
|
|
188
196
|
const DEFAULT_RAW = {
|
|
189
197
|
after: "\n",
|
|
190
198
|
beforeClose: "\n",
|
|
@@ -483,16 +491,19 @@ let Stringifier$2 = class Stringifier {
|
|
|
483
491
|
var stringifier = Stringifier$2;
|
|
484
492
|
Stringifier$2.default = Stringifier$2;
|
|
485
493
|
let Stringifier$1 = stringifier;
|
|
486
|
-
function stringify$
|
|
494
|
+
function stringify$5(node2, builder) {
|
|
487
495
|
let str = new Stringifier$1(builder);
|
|
488
496
|
str.stringify(node2);
|
|
489
497
|
}
|
|
490
|
-
var stringify_1 = stringify$
|
|
491
|
-
stringify$
|
|
492
|
-
|
|
493
|
-
|
|
498
|
+
var stringify_1 = stringify$5;
|
|
499
|
+
stringify$5.default = stringify$5;
|
|
500
|
+
var symbols = {};
|
|
501
|
+
symbols.isClean = Symbol("isClean");
|
|
502
|
+
symbols.my = Symbol("my");
|
|
503
|
+
let CssSyntaxError$3 = cssSyntaxError;
|
|
494
504
|
let Stringifier2 = stringifier;
|
|
495
|
-
let stringify$
|
|
505
|
+
let stringify$4 = stringify_1;
|
|
506
|
+
let { isClean: isClean$2, my: my$2 } = symbols;
|
|
496
507
|
function cloneNode(obj, parent) {
|
|
497
508
|
let cloned = new obj.constructor();
|
|
498
509
|
for (let i in obj) {
|
|
@@ -515,7 +526,28 @@ function cloneNode(obj, parent) {
|
|
|
515
526
|
}
|
|
516
527
|
return cloned;
|
|
517
528
|
}
|
|
518
|
-
|
|
529
|
+
function sourceOffset(inputCSS, position) {
|
|
530
|
+
if (position && typeof position.offset !== "undefined") {
|
|
531
|
+
return position.offset;
|
|
532
|
+
}
|
|
533
|
+
let column = 1;
|
|
534
|
+
let line = 1;
|
|
535
|
+
let offset = 0;
|
|
536
|
+
for (let i = 0; i < inputCSS.length; i++) {
|
|
537
|
+
if (line === position.line && column === position.column) {
|
|
538
|
+
offset = i;
|
|
539
|
+
break;
|
|
540
|
+
}
|
|
541
|
+
if (inputCSS[i] === "\n") {
|
|
542
|
+
column = 1;
|
|
543
|
+
line += 1;
|
|
544
|
+
} else {
|
|
545
|
+
column += 1;
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
return offset;
|
|
549
|
+
}
|
|
550
|
+
let Node$5 = class Node {
|
|
519
551
|
constructor(defaults = {}) {
|
|
520
552
|
this.raws = {};
|
|
521
553
|
this[isClean$2] = false;
|
|
@@ -592,7 +624,7 @@ let Node$4 = class Node {
|
|
|
592
624
|
opts
|
|
593
625
|
);
|
|
594
626
|
}
|
|
595
|
-
return new CssSyntaxError$
|
|
627
|
+
return new CssSyntaxError$3(message);
|
|
596
628
|
}
|
|
597
629
|
getProxyProcessor() {
|
|
598
630
|
return {
|
|
@@ -616,6 +648,10 @@ let Node$4 = class Node {
|
|
|
616
648
|
}
|
|
617
649
|
};
|
|
618
650
|
}
|
|
651
|
+
/* c8 ignore next 3 */
|
|
652
|
+
markClean() {
|
|
653
|
+
this[isClean$2] = true;
|
|
654
|
+
}
|
|
619
655
|
markDirty() {
|
|
620
656
|
if (this[isClean$2]) {
|
|
621
657
|
this[isClean$2] = false;
|
|
@@ -630,23 +666,29 @@ let Node$4 = class Node {
|
|
|
630
666
|
let index2 = this.parent.index(this);
|
|
631
667
|
return this.parent.nodes[index2 + 1];
|
|
632
668
|
}
|
|
633
|
-
positionBy(opts
|
|
669
|
+
positionBy(opts) {
|
|
634
670
|
let pos = this.source.start;
|
|
635
671
|
if (opts.index) {
|
|
636
|
-
pos = this.positionInside(opts.index
|
|
672
|
+
pos = this.positionInside(opts.index);
|
|
637
673
|
} else if (opts.word) {
|
|
638
|
-
|
|
674
|
+
let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
|
|
675
|
+
let stringRepresentation = inputString.slice(
|
|
676
|
+
sourceOffset(inputString, this.source.start),
|
|
677
|
+
sourceOffset(inputString, this.source.end)
|
|
678
|
+
);
|
|
639
679
|
let index2 = stringRepresentation.indexOf(opts.word);
|
|
640
|
-
if (index2 !== -1) pos = this.positionInside(index2
|
|
680
|
+
if (index2 !== -1) pos = this.positionInside(index2);
|
|
641
681
|
}
|
|
642
682
|
return pos;
|
|
643
683
|
}
|
|
644
|
-
positionInside(index2
|
|
645
|
-
let string = stringRepresentation || this.toString();
|
|
684
|
+
positionInside(index2) {
|
|
646
685
|
let column = this.source.start.column;
|
|
647
686
|
let line = this.source.start.line;
|
|
648
|
-
|
|
649
|
-
|
|
687
|
+
let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
|
|
688
|
+
let offset = sourceOffset(inputString, this.source.start);
|
|
689
|
+
let end = offset + index2;
|
|
690
|
+
for (let i = offset; i < end; i++) {
|
|
691
|
+
if (inputString[i] === "\n") {
|
|
650
692
|
column = 1;
|
|
651
693
|
line += 1;
|
|
652
694
|
} else {
|
|
@@ -673,11 +715,17 @@ let Node$4 = class Node {
|
|
|
673
715
|
line: start.line
|
|
674
716
|
};
|
|
675
717
|
if (opts.word) {
|
|
676
|
-
let
|
|
718
|
+
let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
|
|
719
|
+
let stringRepresentation = inputString.slice(
|
|
720
|
+
sourceOffset(inputString, this.source.start),
|
|
721
|
+
sourceOffset(inputString, this.source.end)
|
|
722
|
+
);
|
|
677
723
|
let index2 = stringRepresentation.indexOf(opts.word);
|
|
678
724
|
if (index2 !== -1) {
|
|
679
|
-
start = this.positionInside(index2
|
|
680
|
-
end = this.positionInside(
|
|
725
|
+
start = this.positionInside(index2);
|
|
726
|
+
end = this.positionInside(
|
|
727
|
+
index2 + opts.word.length
|
|
728
|
+
);
|
|
681
729
|
}
|
|
682
730
|
} else {
|
|
683
731
|
if (opts.start) {
|
|
@@ -790,7 +838,7 @@ let Node$4 = class Node {
|
|
|
790
838
|
}
|
|
791
839
|
return this.proxyCache;
|
|
792
840
|
}
|
|
793
|
-
toString(stringifier2 = stringify$
|
|
841
|
+
toString(stringifier2 = stringify$4) {
|
|
794
842
|
if (stringifier2.stringify) stringifier2 = stringifier2.stringify;
|
|
795
843
|
let result2 = "";
|
|
796
844
|
stringifier2(this, (i) => {
|
|
@@ -807,10 +855,19 @@ let Node$4 = class Node {
|
|
|
807
855
|
return this;
|
|
808
856
|
}
|
|
809
857
|
};
|
|
810
|
-
var node = Node$
|
|
811
|
-
Node$
|
|
858
|
+
var node = Node$5;
|
|
859
|
+
Node$5.default = Node$5;
|
|
860
|
+
let Node$4 = node;
|
|
861
|
+
let Comment$6 = class Comment extends Node$4 {
|
|
862
|
+
constructor(defaults) {
|
|
863
|
+
super(defaults);
|
|
864
|
+
this.type = "comment";
|
|
865
|
+
}
|
|
866
|
+
};
|
|
867
|
+
var comment$1 = Comment$6;
|
|
868
|
+
Comment$6.default = Comment$6;
|
|
812
869
|
let Node$3 = node;
|
|
813
|
-
let Declaration$
|
|
870
|
+
let Declaration$5 = class Declaration extends Node$3 {
|
|
814
871
|
constructor(defaults) {
|
|
815
872
|
if (defaults && typeof defaults.value !== "undefined" && typeof defaults.value !== "string") {
|
|
816
873
|
defaults = { ...defaults, value: String(defaults.value) };
|
|
@@ -822,1120 +879,1233 @@ let Declaration$4 = class Declaration extends Node$3 {
|
|
|
822
879
|
return this.prop.startsWith("--") || this.prop[0] === "$";
|
|
823
880
|
}
|
|
824
881
|
};
|
|
825
|
-
var declaration = Declaration$
|
|
826
|
-
Declaration$
|
|
827
|
-
let
|
|
828
|
-
let
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
882
|
+
var declaration = Declaration$5;
|
|
883
|
+
Declaration$5.default = Declaration$5;
|
|
884
|
+
let Comment$5 = comment$1;
|
|
885
|
+
let Declaration$4 = declaration;
|
|
886
|
+
let Node$2 = node;
|
|
887
|
+
let { isClean: isClean$1, my: my$1 } = symbols;
|
|
888
|
+
let AtRule$5, parse$5, Root$7, Rule$5;
|
|
889
|
+
function cleanSource(nodes) {
|
|
890
|
+
return nodes.map((i) => {
|
|
891
|
+
if (i.nodes) i.nodes = cleanSource(i.nodes);
|
|
892
|
+
delete i.source;
|
|
893
|
+
return i;
|
|
894
|
+
});
|
|
895
|
+
}
|
|
896
|
+
function markTreeDirty(node2) {
|
|
897
|
+
node2[isClean$1] = false;
|
|
898
|
+
if (node2.proxyOf.nodes) {
|
|
899
|
+
for (let i of node2.proxyOf.nodes) {
|
|
900
|
+
markTreeDirty(i);
|
|
834
901
|
}
|
|
835
|
-
return id;
|
|
836
|
-
};
|
|
837
|
-
};
|
|
838
|
-
let nanoid$1 = (size = 21) => {
|
|
839
|
-
let id = "";
|
|
840
|
-
let i = size;
|
|
841
|
-
while (i--) {
|
|
842
|
-
id += urlAlphabet[Math.random() * 64 | 0];
|
|
843
|
-
}
|
|
844
|
-
return id;
|
|
845
|
-
};
|
|
846
|
-
var nonSecure = { nanoid: nanoid$1, customAlphabet };
|
|
847
|
-
let { SourceMapConsumer: SourceMapConsumer$2, SourceMapGenerator: SourceMapGenerator$2 } = require$$2;
|
|
848
|
-
let { existsSync, readFileSync } = require$$2;
|
|
849
|
-
let { dirname: dirname$1, join } = require$$2;
|
|
850
|
-
function fromBase64(str) {
|
|
851
|
-
if (Buffer) {
|
|
852
|
-
return Buffer.from(str, "base64").toString();
|
|
853
|
-
} else {
|
|
854
|
-
return window.atob(str);
|
|
855
902
|
}
|
|
856
903
|
}
|
|
857
|
-
let
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
let prev = opts.map ? opts.map.prev : void 0;
|
|
863
|
-
let text = this.loadMap(opts.from, prev);
|
|
864
|
-
if (!this.mapFile && opts.from) {
|
|
865
|
-
this.mapFile = opts.from;
|
|
904
|
+
let Container$8 = class Container extends Node$2 {
|
|
905
|
+
append(...children) {
|
|
906
|
+
for (let child of children) {
|
|
907
|
+
let nodes = this.normalize(child, this.last);
|
|
908
|
+
for (let node2 of nodes) this.proxyOf.nodes.push(node2);
|
|
866
909
|
}
|
|
867
|
-
|
|
868
|
-
|
|
910
|
+
this.markDirty();
|
|
911
|
+
return this;
|
|
869
912
|
}
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
913
|
+
cleanRaws(keepBetween) {
|
|
914
|
+
super.cleanRaws(keepBetween);
|
|
915
|
+
if (this.nodes) {
|
|
916
|
+
for (let node2 of this.nodes) node2.cleanRaws(keepBetween);
|
|
873
917
|
}
|
|
874
|
-
return this.consumerCache;
|
|
875
918
|
}
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
let
|
|
879
|
-
let
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
return fromBase64(text.substr(RegExp.lastMatch.length));
|
|
919
|
+
each(callback) {
|
|
920
|
+
if (!this.proxyOf.nodes) return void 0;
|
|
921
|
+
let iterator = this.getIterator();
|
|
922
|
+
let index2, result2;
|
|
923
|
+
while (this.indexes[iterator] < this.proxyOf.nodes.length) {
|
|
924
|
+
index2 = this.indexes[iterator];
|
|
925
|
+
result2 = callback(this.proxyOf.nodes[index2], index2);
|
|
926
|
+
if (result2 === false) break;
|
|
927
|
+
this.indexes[iterator] += 1;
|
|
886
928
|
}
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
}
|
|
890
|
-
getAnnotationURL(sourceMapString) {
|
|
891
|
-
return sourceMapString.replace(/^\/\*\s*# sourceMappingURL=/, "").trim();
|
|
892
|
-
}
|
|
893
|
-
isMap(map) {
|
|
894
|
-
if (typeof map !== "object") return false;
|
|
895
|
-
return typeof map.mappings === "string" || typeof map._mappings === "string" || Array.isArray(map.sections);
|
|
929
|
+
delete this.indexes[iterator];
|
|
930
|
+
return result2;
|
|
896
931
|
}
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
if (!comments) return;
|
|
900
|
-
let start = css.lastIndexOf(comments.pop());
|
|
901
|
-
let end = css.indexOf("*/", start);
|
|
902
|
-
if (start > -1 && end > -1) {
|
|
903
|
-
this.annotation = this.getAnnotationURL(css.substring(start, end));
|
|
904
|
-
}
|
|
932
|
+
every(condition) {
|
|
933
|
+
return this.nodes.every(condition);
|
|
905
934
|
}
|
|
906
|
-
|
|
907
|
-
this.
|
|
908
|
-
if (
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
935
|
+
getIterator() {
|
|
936
|
+
if (!this.lastEach) this.lastEach = 0;
|
|
937
|
+
if (!this.indexes) this.indexes = {};
|
|
938
|
+
this.lastEach += 1;
|
|
939
|
+
let iterator = this.lastEach;
|
|
940
|
+
this.indexes[iterator] = 0;
|
|
941
|
+
return iterator;
|
|
912
942
|
}
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
if (
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
943
|
+
getProxyProcessor() {
|
|
944
|
+
return {
|
|
945
|
+
get(node2, prop) {
|
|
946
|
+
if (prop === "proxyOf") {
|
|
947
|
+
return node2;
|
|
948
|
+
} else if (!node2[prop]) {
|
|
949
|
+
return node2[prop];
|
|
950
|
+
} else if (prop === "each" || typeof prop === "string" && prop.startsWith("walk")) {
|
|
951
|
+
return (...args) => {
|
|
952
|
+
return node2[prop](
|
|
953
|
+
...args.map((i) => {
|
|
954
|
+
if (typeof i === "function") {
|
|
955
|
+
return (child, index2) => i(child.toProxy(), index2);
|
|
956
|
+
} else {
|
|
957
|
+
return i;
|
|
958
|
+
}
|
|
959
|
+
})
|
|
925
960
|
);
|
|
926
|
-
}
|
|
927
|
-
|
|
961
|
+
};
|
|
962
|
+
} else if (prop === "every" || prop === "some") {
|
|
963
|
+
return (cb) => {
|
|
964
|
+
return node2[prop](
|
|
965
|
+
(child, ...other) => cb(child.toProxy(), ...other)
|
|
966
|
+
);
|
|
967
|
+
};
|
|
968
|
+
} else if (prop === "root") {
|
|
969
|
+
return () => node2.root().toProxy();
|
|
970
|
+
} else if (prop === "nodes") {
|
|
971
|
+
return node2.nodes.map((i) => i.toProxy());
|
|
972
|
+
} else if (prop === "first" || prop === "last") {
|
|
973
|
+
return node2[prop].toProxy();
|
|
974
|
+
} else {
|
|
975
|
+
return node2[prop];
|
|
928
976
|
}
|
|
929
|
-
}
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
"Unsupported previous source map format: " + prev.toString()
|
|
938
|
-
);
|
|
977
|
+
},
|
|
978
|
+
set(node2, prop, value) {
|
|
979
|
+
if (node2[prop] === value) return true;
|
|
980
|
+
node2[prop] = value;
|
|
981
|
+
if (prop === "name" || prop === "params" || prop === "selector") {
|
|
982
|
+
node2.markDirty();
|
|
983
|
+
}
|
|
984
|
+
return true;
|
|
939
985
|
}
|
|
940
|
-
}
|
|
941
|
-
return this.decodeInline(this.annotation);
|
|
942
|
-
} else if (this.annotation) {
|
|
943
|
-
let map = this.annotation;
|
|
944
|
-
if (file) map = join(dirname$1(file), map);
|
|
945
|
-
return this.loadFile(map);
|
|
946
|
-
}
|
|
986
|
+
};
|
|
947
987
|
}
|
|
948
|
-
|
|
949
|
-
if (
|
|
950
|
-
|
|
988
|
+
index(child) {
|
|
989
|
+
if (typeof child === "number") return child;
|
|
990
|
+
if (child.proxyOf) child = child.proxyOf;
|
|
991
|
+
return this.proxyOf.nodes.indexOf(child);
|
|
951
992
|
}
|
|
952
|
-
|
|
953
|
-
|
|
993
|
+
insertAfter(exist, add) {
|
|
994
|
+
let existIndex = this.index(exist);
|
|
995
|
+
let nodes = this.normalize(add, this.proxyOf.nodes[existIndex]).reverse();
|
|
996
|
+
existIndex = this.index(exist);
|
|
997
|
+
for (let node2 of nodes) this.proxyOf.nodes.splice(existIndex + 1, 0, node2);
|
|
998
|
+
let index2;
|
|
999
|
+
for (let id in this.indexes) {
|
|
1000
|
+
index2 = this.indexes[id];
|
|
1001
|
+
if (existIndex < index2) {
|
|
1002
|
+
this.indexes[id] = index2 + nodes.length;
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
this.markDirty();
|
|
1006
|
+
return this;
|
|
954
1007
|
}
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
let
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
let
|
|
965
|
-
let
|
|
966
|
-
let
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
throw new Error(`PostCSS received ${css} instead of CSS string`);
|
|
1008
|
+
insertBefore(exist, add) {
|
|
1009
|
+
let existIndex = this.index(exist);
|
|
1010
|
+
let type = existIndex === 0 ? "prepend" : false;
|
|
1011
|
+
let nodes = this.normalize(
|
|
1012
|
+
add,
|
|
1013
|
+
this.proxyOf.nodes[existIndex],
|
|
1014
|
+
type
|
|
1015
|
+
).reverse();
|
|
1016
|
+
existIndex = this.index(exist);
|
|
1017
|
+
for (let node2 of nodes) this.proxyOf.nodes.splice(existIndex, 0, node2);
|
|
1018
|
+
let index2;
|
|
1019
|
+
for (let id in this.indexes) {
|
|
1020
|
+
index2 = this.indexes[id];
|
|
1021
|
+
if (existIndex <= index2) {
|
|
1022
|
+
this.indexes[id] = index2 + nodes.length;
|
|
1023
|
+
}
|
|
972
1024
|
}
|
|
973
|
-
this.
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
1025
|
+
this.markDirty();
|
|
1026
|
+
return this;
|
|
1027
|
+
}
|
|
1028
|
+
normalize(nodes, sample) {
|
|
1029
|
+
if (typeof nodes === "string") {
|
|
1030
|
+
nodes = cleanSource(parse$5(nodes).nodes);
|
|
1031
|
+
} else if (typeof nodes === "undefined") {
|
|
1032
|
+
nodes = [];
|
|
1033
|
+
} else if (Array.isArray(nodes)) {
|
|
1034
|
+
nodes = nodes.slice(0);
|
|
1035
|
+
for (let i of nodes) {
|
|
1036
|
+
if (i.parent) i.parent.removeChild(i, "ignore");
|
|
1037
|
+
}
|
|
1038
|
+
} else if (nodes.type === "root" && this.type !== "document") {
|
|
1039
|
+
nodes = nodes.nodes.slice(0);
|
|
1040
|
+
for (let i of nodes) {
|
|
1041
|
+
if (i.parent) i.parent.removeChild(i, "ignore");
|
|
1042
|
+
}
|
|
1043
|
+
} else if (nodes.type) {
|
|
1044
|
+
nodes = [nodes];
|
|
1045
|
+
} else if (nodes.prop) {
|
|
1046
|
+
if (typeof nodes.value === "undefined") {
|
|
1047
|
+
throw new Error("Value field is missed in node creation");
|
|
1048
|
+
} else if (typeof nodes.value !== "string") {
|
|
1049
|
+
nodes.value = String(nodes.value);
|
|
1050
|
+
}
|
|
1051
|
+
nodes = [new Declaration$4(nodes)];
|
|
1052
|
+
} else if (nodes.selector || nodes.selectors) {
|
|
1053
|
+
nodes = [new Rule$5(nodes)];
|
|
1054
|
+
} else if (nodes.name) {
|
|
1055
|
+
nodes = [new AtRule$5(nodes)];
|
|
1056
|
+
} else if (nodes.text) {
|
|
1057
|
+
nodes = [new Comment$5(nodes)];
|
|
977
1058
|
} else {
|
|
978
|
-
|
|
1059
|
+
throw new Error("Unknown node type in node creation");
|
|
979
1060
|
}
|
|
980
|
-
|
|
981
|
-
if (!
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
1061
|
+
let processed = nodes.map((i) => {
|
|
1062
|
+
if (!i[my$1]) Container.rebuild(i);
|
|
1063
|
+
i = i.proxyOf;
|
|
1064
|
+
if (i.parent) i.parent.removeChild(i);
|
|
1065
|
+
if (i[isClean$1]) markTreeDirty(i);
|
|
1066
|
+
if (!i.raws) i.raws = {};
|
|
1067
|
+
if (typeof i.raws.before === "undefined") {
|
|
1068
|
+
if (sample && typeof sample.raws.before !== "undefined") {
|
|
1069
|
+
i.raws.before = sample.raws.before.replace(/\S/g, "");
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
i.parent = this.proxyOf;
|
|
1073
|
+
return i;
|
|
1074
|
+
});
|
|
1075
|
+
return processed;
|
|
1076
|
+
}
|
|
1077
|
+
prepend(...children) {
|
|
1078
|
+
children = children.reverse();
|
|
1079
|
+
for (let child of children) {
|
|
1080
|
+
let nodes = this.normalize(child, this.first, "prepend").reverse();
|
|
1081
|
+
for (let node2 of nodes) this.proxyOf.nodes.unshift(node2);
|
|
1082
|
+
for (let id in this.indexes) {
|
|
1083
|
+
this.indexes[id] = this.indexes[id] + nodes.length;
|
|
985
1084
|
}
|
|
986
1085
|
}
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
1086
|
+
this.markDirty();
|
|
1087
|
+
return this;
|
|
1088
|
+
}
|
|
1089
|
+
push(child) {
|
|
1090
|
+
child.parent = this;
|
|
1091
|
+
this.proxyOf.nodes.push(child);
|
|
1092
|
+
return this;
|
|
1093
|
+
}
|
|
1094
|
+
removeAll() {
|
|
1095
|
+
for (let node2 of this.proxyOf.nodes) node2.parent = void 0;
|
|
1096
|
+
this.proxyOf.nodes = [];
|
|
1097
|
+
this.markDirty();
|
|
1098
|
+
return this;
|
|
1099
|
+
}
|
|
1100
|
+
removeChild(child) {
|
|
1101
|
+
child = this.index(child);
|
|
1102
|
+
this.proxyOf.nodes[child].parent = void 0;
|
|
1103
|
+
this.proxyOf.nodes.splice(child, 1);
|
|
1104
|
+
let index2;
|
|
1105
|
+
for (let id in this.indexes) {
|
|
1106
|
+
index2 = this.indexes[id];
|
|
1107
|
+
if (index2 >= child) {
|
|
1108
|
+
this.indexes[id] = index2 - 1;
|
|
993
1109
|
}
|
|
994
1110
|
}
|
|
995
|
-
|
|
996
|
-
|
|
1111
|
+
this.markDirty();
|
|
1112
|
+
return this;
|
|
1113
|
+
}
|
|
1114
|
+
replaceValues(pattern, opts, callback) {
|
|
1115
|
+
if (!callback) {
|
|
1116
|
+
callback = opts;
|
|
1117
|
+
opts = {};
|
|
997
1118
|
}
|
|
998
|
-
|
|
1119
|
+
this.walkDecls((decl2) => {
|
|
1120
|
+
if (opts.props && !opts.props.includes(decl2.prop)) return;
|
|
1121
|
+
if (opts.fast && !decl2.value.includes(opts.fast)) return;
|
|
1122
|
+
decl2.value = decl2.value.replace(pattern, callback);
|
|
1123
|
+
});
|
|
1124
|
+
this.markDirty();
|
|
1125
|
+
return this;
|
|
999
1126
|
}
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
line = start.line;
|
|
1011
|
-
column = start.column;
|
|
1127
|
+
some(condition) {
|
|
1128
|
+
return this.nodes.some(condition);
|
|
1129
|
+
}
|
|
1130
|
+
walk(callback) {
|
|
1131
|
+
return this.each((child, i) => {
|
|
1132
|
+
let result2;
|
|
1133
|
+
try {
|
|
1134
|
+
result2 = callback(child, i);
|
|
1135
|
+
} catch (e) {
|
|
1136
|
+
throw child.addToError(e);
|
|
1012
1137
|
}
|
|
1013
|
-
if (
|
|
1014
|
-
|
|
1015
|
-
endLine = pos.line;
|
|
1016
|
-
endColumn = pos.col;
|
|
1017
|
-
} else {
|
|
1018
|
-
endLine = end.line;
|
|
1019
|
-
endColumn = end.column;
|
|
1138
|
+
if (result2 !== false && child.walk) {
|
|
1139
|
+
result2 = child.walk(callback);
|
|
1020
1140
|
}
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1141
|
+
return result2;
|
|
1142
|
+
});
|
|
1143
|
+
}
|
|
1144
|
+
walkAtRules(name, callback) {
|
|
1145
|
+
if (!callback) {
|
|
1146
|
+
callback = name;
|
|
1147
|
+
return this.walk((child, i) => {
|
|
1148
|
+
if (child.type === "atrule") {
|
|
1149
|
+
return callback(child, i);
|
|
1150
|
+
}
|
|
1151
|
+
});
|
|
1025
1152
|
}
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
origin.source,
|
|
1033
|
-
origin.file,
|
|
1034
|
-
opts.plugin
|
|
1035
|
-
);
|
|
1036
|
-
} else {
|
|
1037
|
-
result2 = new CssSyntaxError$1(
|
|
1038
|
-
message,
|
|
1039
|
-
endLine === void 0 ? line : { column, line },
|
|
1040
|
-
endLine === void 0 ? column : { column: endColumn, line: endLine },
|
|
1041
|
-
this.css,
|
|
1042
|
-
this.file,
|
|
1043
|
-
opts.plugin
|
|
1044
|
-
);
|
|
1153
|
+
if (name instanceof RegExp) {
|
|
1154
|
+
return this.walk((child, i) => {
|
|
1155
|
+
if (child.type === "atrule" && name.test(child.name)) {
|
|
1156
|
+
return callback(child, i);
|
|
1157
|
+
}
|
|
1158
|
+
});
|
|
1045
1159
|
}
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
result2.input.url = pathToFileURL$1(this.file).toString();
|
|
1160
|
+
return this.walk((child, i) => {
|
|
1161
|
+
if (child.type === "atrule" && child.name === name) {
|
|
1162
|
+
return callback(child, i);
|
|
1050
1163
|
}
|
|
1051
|
-
|
|
1052
|
-
}
|
|
1053
|
-
return result2;
|
|
1164
|
+
});
|
|
1054
1165
|
}
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
lineToIndex = new Array(lines.length);
|
|
1060
|
-
let prevIndex = 0;
|
|
1061
|
-
for (let i = 0, l = lines.length; i < l; i++) {
|
|
1062
|
-
lineToIndex[i] = prevIndex;
|
|
1063
|
-
prevIndex += lines[i].length + 1;
|
|
1166
|
+
walkComments(callback) {
|
|
1167
|
+
return this.walk((child, i) => {
|
|
1168
|
+
if (child.type === "comment") {
|
|
1169
|
+
return callback(child, i);
|
|
1064
1170
|
}
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1171
|
+
});
|
|
1172
|
+
}
|
|
1173
|
+
walkDecls(prop, callback) {
|
|
1174
|
+
if (!callback) {
|
|
1175
|
+
callback = prop;
|
|
1176
|
+
return this.walk((child, i) => {
|
|
1177
|
+
if (child.type === "decl") {
|
|
1178
|
+
return callback(child, i);
|
|
1179
|
+
}
|
|
1180
|
+
});
|
|
1068
1181
|
}
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
} else {
|
|
1074
|
-
let max = lineToIndex.length - 2;
|
|
1075
|
-
let mid;
|
|
1076
|
-
while (min < max) {
|
|
1077
|
-
mid = min + (max - min >> 1);
|
|
1078
|
-
if (offset < lineToIndex[mid]) {
|
|
1079
|
-
max = mid - 1;
|
|
1080
|
-
} else if (offset >= lineToIndex[mid + 1]) {
|
|
1081
|
-
min = mid + 1;
|
|
1082
|
-
} else {
|
|
1083
|
-
min = mid;
|
|
1084
|
-
break;
|
|
1182
|
+
if (prop instanceof RegExp) {
|
|
1183
|
+
return this.walk((child, i) => {
|
|
1184
|
+
if (child.type === "decl" && prop.test(child.prop)) {
|
|
1185
|
+
return callback(child, i);
|
|
1085
1186
|
}
|
|
1086
|
-
}
|
|
1187
|
+
});
|
|
1087
1188
|
}
|
|
1088
|
-
return {
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1189
|
+
return this.walk((child, i) => {
|
|
1190
|
+
if (child.type === "decl" && child.prop === prop) {
|
|
1191
|
+
return callback(child, i);
|
|
1192
|
+
}
|
|
1193
|
+
});
|
|
1092
1194
|
}
|
|
1093
|
-
|
|
1094
|
-
if (
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
let consumer = this.map.consumer();
|
|
1102
|
-
let from = consumer.originalPositionFor({ column, line });
|
|
1103
|
-
if (!from.source) return false;
|
|
1104
|
-
let to;
|
|
1105
|
-
if (typeof endLine === "number") {
|
|
1106
|
-
to = consumer.originalPositionFor({ column: endColumn, line: endLine });
|
|
1195
|
+
walkRules(selector, callback) {
|
|
1196
|
+
if (!callback) {
|
|
1197
|
+
callback = selector;
|
|
1198
|
+
return this.walk((child, i) => {
|
|
1199
|
+
if (child.type === "rule") {
|
|
1200
|
+
return callback(child, i);
|
|
1201
|
+
}
|
|
1202
|
+
});
|
|
1107
1203
|
}
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
this.map.consumer().sourceRoot || pathToFileURL$1(this.map.mapFile)
|
|
1115
|
-
);
|
|
1204
|
+
if (selector instanceof RegExp) {
|
|
1205
|
+
return this.walk((child, i) => {
|
|
1206
|
+
if (child.type === "rule" && selector.test(child.selector)) {
|
|
1207
|
+
return callback(child, i);
|
|
1208
|
+
}
|
|
1209
|
+
});
|
|
1116
1210
|
}
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
endLine: to && to.line,
|
|
1121
|
-
line: from.line,
|
|
1122
|
-
url: fromUrl.toString()
|
|
1123
|
-
};
|
|
1124
|
-
if (fromUrl.protocol === "file:") {
|
|
1125
|
-
if (fileURLToPath) {
|
|
1126
|
-
result2.file = fileURLToPath(fromUrl);
|
|
1127
|
-
} else {
|
|
1128
|
-
throw new Error(`file: protocol is not available in this PostCSS build`);
|
|
1211
|
+
return this.walk((child, i) => {
|
|
1212
|
+
if (child.type === "rule" && child.selector === selector) {
|
|
1213
|
+
return callback(child, i);
|
|
1129
1214
|
}
|
|
1130
|
-
}
|
|
1131
|
-
let source = consumer.sourceContentFor(from.source);
|
|
1132
|
-
if (source) result2.source = source;
|
|
1133
|
-
return result2;
|
|
1215
|
+
});
|
|
1134
1216
|
}
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
if (this[name] != null) {
|
|
1139
|
-
json[name] = this[name];
|
|
1140
|
-
}
|
|
1141
|
-
}
|
|
1142
|
-
if (this.map) {
|
|
1143
|
-
json.map = { ...this.map };
|
|
1144
|
-
if (json.map.consumerCache) {
|
|
1145
|
-
json.map.consumerCache = void 0;
|
|
1146
|
-
}
|
|
1147
|
-
}
|
|
1148
|
-
return json;
|
|
1217
|
+
get first() {
|
|
1218
|
+
if (!this.proxyOf.nodes) return void 0;
|
|
1219
|
+
return this.proxyOf.nodes[0];
|
|
1149
1220
|
}
|
|
1150
|
-
get
|
|
1151
|
-
|
|
1221
|
+
get last() {
|
|
1222
|
+
if (!this.proxyOf.nodes) return void 0;
|
|
1223
|
+
return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
|
|
1152
1224
|
}
|
|
1153
1225
|
};
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1226
|
+
Container$8.registerParse = (dependant) => {
|
|
1227
|
+
parse$5 = dependant;
|
|
1228
|
+
};
|
|
1229
|
+
Container$8.registerRule = (dependant) => {
|
|
1230
|
+
Rule$5 = dependant;
|
|
1231
|
+
};
|
|
1232
|
+
Container$8.registerAtRule = (dependant) => {
|
|
1233
|
+
AtRule$5 = dependant;
|
|
1234
|
+
};
|
|
1235
|
+
Container$8.registerRoot = (dependant) => {
|
|
1236
|
+
Root$7 = dependant;
|
|
1237
|
+
};
|
|
1238
|
+
var container = Container$8;
|
|
1239
|
+
Container$8.default = Container$8;
|
|
1240
|
+
Container$8.rebuild = (node2) => {
|
|
1241
|
+
if (node2.type === "atrule") {
|
|
1242
|
+
Object.setPrototypeOf(node2, AtRule$5.prototype);
|
|
1243
|
+
} else if (node2.type === "rule") {
|
|
1244
|
+
Object.setPrototypeOf(node2, Rule$5.prototype);
|
|
1245
|
+
} else if (node2.type === "decl") {
|
|
1246
|
+
Object.setPrototypeOf(node2, Declaration$4.prototype);
|
|
1247
|
+
} else if (node2.type === "comment") {
|
|
1248
|
+
Object.setPrototypeOf(node2, Comment$5.prototype);
|
|
1249
|
+
} else if (node2.type === "root") {
|
|
1250
|
+
Object.setPrototypeOf(node2, Root$7.prototype);
|
|
1177
1251
|
}
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
}
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1252
|
+
node2[my$1] = true;
|
|
1253
|
+
if (node2.nodes) {
|
|
1254
|
+
node2.nodes.forEach((child) => {
|
|
1255
|
+
Container$8.rebuild(child);
|
|
1256
|
+
});
|
|
1257
|
+
}
|
|
1258
|
+
};
|
|
1259
|
+
let Container$7 = container;
|
|
1260
|
+
let AtRule$4 = class AtRule extends Container$7 {
|
|
1261
|
+
constructor(defaults) {
|
|
1262
|
+
super(defaults);
|
|
1263
|
+
this.type = "atrule";
|
|
1264
|
+
}
|
|
1265
|
+
append(...children) {
|
|
1266
|
+
if (!this.proxyOf.nodes) this.nodes = [];
|
|
1267
|
+
return super.append(...children);
|
|
1268
|
+
}
|
|
1269
|
+
prepend(...children) {
|
|
1270
|
+
if (!this.proxyOf.nodes) this.nodes = [];
|
|
1271
|
+
return super.prepend(...children);
|
|
1272
|
+
}
|
|
1273
|
+
};
|
|
1274
|
+
var atRule$1 = AtRule$4;
|
|
1275
|
+
AtRule$4.default = AtRule$4;
|
|
1276
|
+
Container$7.registerAtRule(AtRule$4);
|
|
1277
|
+
let Container$6 = container;
|
|
1278
|
+
let LazyResult$4, Processor$4;
|
|
1279
|
+
let Document$4 = class Document2 extends Container$6 {
|
|
1280
|
+
constructor(defaults) {
|
|
1281
|
+
super({ type: "document", ...defaults });
|
|
1282
|
+
if (!this.nodes) {
|
|
1283
|
+
this.nodes = [];
|
|
1188
1284
|
}
|
|
1189
|
-
let eol = "\n";
|
|
1190
|
-
if (this.css.includes("\r\n")) eol = "\r\n";
|
|
1191
|
-
this.css += eol + "/*# sourceMappingURL=" + content + " */";
|
|
1192
1285
|
}
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1286
|
+
toResult(opts = {}) {
|
|
1287
|
+
let lazy = new LazyResult$4(new Processor$4(), this, opts);
|
|
1288
|
+
return lazy.stringify();
|
|
1289
|
+
}
|
|
1290
|
+
};
|
|
1291
|
+
Document$4.registerLazyResult = (dependant) => {
|
|
1292
|
+
LazyResult$4 = dependant;
|
|
1293
|
+
};
|
|
1294
|
+
Document$4.registerProcessor = (dependant) => {
|
|
1295
|
+
Processor$4 = dependant;
|
|
1296
|
+
};
|
|
1297
|
+
var document$2 = Document$4;
|
|
1298
|
+
Document$4.default = Document$4;
|
|
1299
|
+
let urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
1300
|
+
let customAlphabet = (alphabet, defaultSize = 21) => {
|
|
1301
|
+
return (size = defaultSize) => {
|
|
1302
|
+
let id = "";
|
|
1303
|
+
let i = size | 0;
|
|
1304
|
+
while (i--) {
|
|
1305
|
+
id += alphabet[Math.random() * alphabet.length | 0];
|
|
1207
1306
|
}
|
|
1307
|
+
return id;
|
|
1308
|
+
};
|
|
1309
|
+
};
|
|
1310
|
+
let nanoid$1 = (size = 21) => {
|
|
1311
|
+
let id = "";
|
|
1312
|
+
let i = size | 0;
|
|
1313
|
+
while (i--) {
|
|
1314
|
+
id += urlAlphabet[Math.random() * 64 | 0];
|
|
1208
1315
|
}
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1316
|
+
return id;
|
|
1317
|
+
};
|
|
1318
|
+
var nonSecure = { nanoid: nanoid$1, customAlphabet };
|
|
1319
|
+
let { existsSync, readFileSync } = require$$2;
|
|
1320
|
+
let { dirname: dirname$1, join } = require$$2;
|
|
1321
|
+
let { SourceMapConsumer: SourceMapConsumer$2, SourceMapGenerator: SourceMapGenerator$2 } = require$$2;
|
|
1322
|
+
function fromBase64(str) {
|
|
1323
|
+
if (Buffer) {
|
|
1324
|
+
return Buffer.from(str, "base64").toString();
|
|
1325
|
+
} else {
|
|
1326
|
+
return window.atob(str);
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
let PreviousMap$2 = class PreviousMap {
|
|
1330
|
+
constructor(css, opts) {
|
|
1331
|
+
if (opts.map === false) return;
|
|
1332
|
+
this.loadAnnotation(css);
|
|
1333
|
+
this.inline = this.startWith(this.annotation, "data:");
|
|
1334
|
+
let prev = opts.map ? opts.map.prev : void 0;
|
|
1335
|
+
let text = this.loadMap(opts.from, prev);
|
|
1336
|
+
if (!this.mapFile && opts.from) {
|
|
1337
|
+
this.mapFile = opts.from;
|
|
1222
1338
|
}
|
|
1339
|
+
if (this.mapFile) this.root = dirname$1(this.mapFile);
|
|
1340
|
+
if (text) this.text = text;
|
|
1223
1341
|
}
|
|
1224
|
-
|
|
1225
|
-
this.
|
|
1226
|
-
|
|
1227
|
-
return this.generateMap();
|
|
1228
|
-
} else {
|
|
1229
|
-
let result2 = "";
|
|
1230
|
-
this.stringify(this.root, (i) => {
|
|
1231
|
-
result2 += i;
|
|
1232
|
-
});
|
|
1233
|
-
return [result2];
|
|
1342
|
+
consumer() {
|
|
1343
|
+
if (!this.consumerCache) {
|
|
1344
|
+
this.consumerCache = new SourceMapConsumer$2(this.text);
|
|
1234
1345
|
}
|
|
1346
|
+
return this.consumerCache;
|
|
1235
1347
|
}
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
});
|
|
1245
|
-
} else {
|
|
1246
|
-
this.map = new SourceMapGenerator({
|
|
1247
|
-
file: this.outputFile(),
|
|
1248
|
-
ignoreInvalidMapping: true
|
|
1249
|
-
});
|
|
1250
|
-
this.map.addMapping({
|
|
1251
|
-
generated: { column: 0, line: 1 },
|
|
1252
|
-
original: { column: 0, line: 1 },
|
|
1253
|
-
source: this.opts.from ? this.toUrl(this.path(this.opts.from)) : "<no source>"
|
|
1254
|
-
});
|
|
1348
|
+
decodeInline(text) {
|
|
1349
|
+
let baseCharsetUri = /^data:application\/json;charset=utf-?8;base64,/;
|
|
1350
|
+
let baseUri = /^data:application\/json;base64,/;
|
|
1351
|
+
let charsetUri = /^data:application\/json;charset=utf-?8,/;
|
|
1352
|
+
let uri = /^data:application\/json,/;
|
|
1353
|
+
let uriMatch = text.match(charsetUri) || text.match(uri);
|
|
1354
|
+
if (uriMatch) {
|
|
1355
|
+
return decodeURIComponent(text.substr(uriMatch[0].length));
|
|
1255
1356
|
}
|
|
1256
|
-
|
|
1257
|
-
if (
|
|
1258
|
-
|
|
1259
|
-
if (this.isInline()) {
|
|
1260
|
-
return [this.css];
|
|
1261
|
-
} else {
|
|
1262
|
-
return [this.css, this.map];
|
|
1357
|
+
let baseUriMatch = text.match(baseCharsetUri) || text.match(baseUri);
|
|
1358
|
+
if (baseUriMatch) {
|
|
1359
|
+
return fromBase64(text.substr(baseUriMatch[0].length));
|
|
1263
1360
|
}
|
|
1361
|
+
let encoding = text.match(/data:application\/json;([^,]+),/)[1];
|
|
1362
|
+
throw new Error("Unsupported source map encoding " + encoding);
|
|
1264
1363
|
}
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
this.map = new SourceMapGenerator({
|
|
1268
|
-
file: this.outputFile(),
|
|
1269
|
-
ignoreInvalidMapping: true
|
|
1270
|
-
});
|
|
1271
|
-
let line = 1;
|
|
1272
|
-
let column = 1;
|
|
1273
|
-
let noSource = "<no source>";
|
|
1274
|
-
let mapping = {
|
|
1275
|
-
generated: { column: 0, line: 0 },
|
|
1276
|
-
original: { column: 0, line: 0 },
|
|
1277
|
-
source: ""
|
|
1278
|
-
};
|
|
1279
|
-
let lines, last;
|
|
1280
|
-
this.stringify(this.root, (str, node2, type) => {
|
|
1281
|
-
this.css += str;
|
|
1282
|
-
if (node2 && type !== "end") {
|
|
1283
|
-
mapping.generated.line = line;
|
|
1284
|
-
mapping.generated.column = column - 1;
|
|
1285
|
-
if (node2.source && node2.source.start) {
|
|
1286
|
-
mapping.source = this.sourcePath(node2);
|
|
1287
|
-
mapping.original.line = node2.source.start.line;
|
|
1288
|
-
mapping.original.column = node2.source.start.column - 1;
|
|
1289
|
-
this.map.addMapping(mapping);
|
|
1290
|
-
} else {
|
|
1291
|
-
mapping.source = noSource;
|
|
1292
|
-
mapping.original.line = 1;
|
|
1293
|
-
mapping.original.column = 0;
|
|
1294
|
-
this.map.addMapping(mapping);
|
|
1295
|
-
}
|
|
1296
|
-
}
|
|
1297
|
-
lines = str.match(/\n/g);
|
|
1298
|
-
if (lines) {
|
|
1299
|
-
line += lines.length;
|
|
1300
|
-
last = str.lastIndexOf("\n");
|
|
1301
|
-
column = str.length - last;
|
|
1302
|
-
} else {
|
|
1303
|
-
column += str.length;
|
|
1304
|
-
}
|
|
1305
|
-
if (node2 && type !== "start") {
|
|
1306
|
-
let p = node2.parent || { raws: {} };
|
|
1307
|
-
let childless = node2.type === "decl" || node2.type === "atrule" && !node2.nodes;
|
|
1308
|
-
if (!childless || node2 !== p.last || p.raws.semicolon) {
|
|
1309
|
-
if (node2.source && node2.source.end) {
|
|
1310
|
-
mapping.source = this.sourcePath(node2);
|
|
1311
|
-
mapping.original.line = node2.source.end.line;
|
|
1312
|
-
mapping.original.column = node2.source.end.column - 1;
|
|
1313
|
-
mapping.generated.line = line;
|
|
1314
|
-
mapping.generated.column = column - 2;
|
|
1315
|
-
this.map.addMapping(mapping);
|
|
1316
|
-
} else {
|
|
1317
|
-
mapping.source = noSource;
|
|
1318
|
-
mapping.original.line = 1;
|
|
1319
|
-
mapping.original.column = 0;
|
|
1320
|
-
mapping.generated.line = line;
|
|
1321
|
-
mapping.generated.column = column - 1;
|
|
1322
|
-
this.map.addMapping(mapping);
|
|
1323
|
-
}
|
|
1324
|
-
}
|
|
1325
|
-
}
|
|
1326
|
-
});
|
|
1364
|
+
getAnnotationURL(sourceMapString) {
|
|
1365
|
+
return sourceMapString.replace(/^\/\*\s*# sourceMappingURL=/, "").trim();
|
|
1327
1366
|
}
|
|
1328
|
-
|
|
1329
|
-
if (
|
|
1330
|
-
|
|
1331
|
-
}
|
|
1332
|
-
if (typeof this.mapOpts.annotation !== "undefined") {
|
|
1333
|
-
return this.mapOpts.annotation;
|
|
1334
|
-
}
|
|
1335
|
-
if (this.previous().length) {
|
|
1336
|
-
return this.previous().some((i) => i.annotation);
|
|
1337
|
-
}
|
|
1338
|
-
return true;
|
|
1367
|
+
isMap(map) {
|
|
1368
|
+
if (typeof map !== "object") return false;
|
|
1369
|
+
return typeof map.mappings === "string" || typeof map._mappings === "string" || Array.isArray(map.sections);
|
|
1339
1370
|
}
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
let
|
|
1345
|
-
if (
|
|
1346
|
-
|
|
1347
|
-
}
|
|
1348
|
-
if (this.previous().length) {
|
|
1349
|
-
return this.previous().some((i) => i.inline);
|
|
1371
|
+
loadAnnotation(css) {
|
|
1372
|
+
let comments = css.match(/\/\*\s*# sourceMappingURL=/g);
|
|
1373
|
+
if (!comments) return;
|
|
1374
|
+
let start = css.lastIndexOf(comments.pop());
|
|
1375
|
+
let end = css.indexOf("*/", start);
|
|
1376
|
+
if (start > -1 && end > -1) {
|
|
1377
|
+
this.annotation = this.getAnnotationURL(css.substring(start, end));
|
|
1350
1378
|
}
|
|
1351
|
-
return true;
|
|
1352
1379
|
}
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1380
|
+
loadFile(path) {
|
|
1381
|
+
this.root = dirname$1(path);
|
|
1382
|
+
if (existsSync(path)) {
|
|
1383
|
+
this.mapFile = path;
|
|
1384
|
+
return readFileSync(path, "utf-8").toString().trim();
|
|
1356
1385
|
}
|
|
1357
|
-
return this.previous().length > 0;
|
|
1358
1386
|
}
|
|
1359
|
-
|
|
1360
|
-
if (
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1387
|
+
loadMap(file, prev) {
|
|
1388
|
+
if (prev === false) return false;
|
|
1389
|
+
if (prev) {
|
|
1390
|
+
if (typeof prev === "string") {
|
|
1391
|
+
return prev;
|
|
1392
|
+
} else if (typeof prev === "function") {
|
|
1393
|
+
let prevPath = prev(file);
|
|
1394
|
+
if (prevPath) {
|
|
1395
|
+
let map = this.loadFile(prevPath);
|
|
1396
|
+
if (!map) {
|
|
1397
|
+
throw new Error(
|
|
1398
|
+
"Unable to load previous source map: " + prevPath.toString()
|
|
1399
|
+
);
|
|
1400
|
+
}
|
|
1401
|
+
return map;
|
|
1402
|
+
}
|
|
1403
|
+
} else if (prev instanceof SourceMapConsumer$2) {
|
|
1404
|
+
return SourceMapGenerator$2.fromSourceMap(prev).toString();
|
|
1405
|
+
} else if (prev instanceof SourceMapGenerator$2) {
|
|
1406
|
+
return prev.toString();
|
|
1407
|
+
} else if (this.isMap(prev)) {
|
|
1408
|
+
return JSON.stringify(prev);
|
|
1409
|
+
} else {
|
|
1410
|
+
throw new Error(
|
|
1411
|
+
"Unsupported previous source map format: " + prev.toString()
|
|
1412
|
+
);
|
|
1413
|
+
}
|
|
1414
|
+
} else if (this.inline) {
|
|
1415
|
+
return this.decodeInline(this.annotation);
|
|
1416
|
+
} else if (this.annotation) {
|
|
1417
|
+
let map = this.annotation;
|
|
1418
|
+
if (file) map = join(dirname$1(file), map);
|
|
1419
|
+
return this.loadFile(map);
|
|
1365
1420
|
}
|
|
1366
|
-
return true;
|
|
1367
1421
|
}
|
|
1368
|
-
|
|
1369
|
-
if (
|
|
1370
|
-
|
|
1371
|
-
} else if (this.opts.from) {
|
|
1372
|
-
return this.path(this.opts.from);
|
|
1373
|
-
} else {
|
|
1374
|
-
return "to.css";
|
|
1375
|
-
}
|
|
1422
|
+
startWith(string, start) {
|
|
1423
|
+
if (!string) return false;
|
|
1424
|
+
return string.substr(0, start.length) === start;
|
|
1376
1425
|
}
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
if (file.charCodeAt(0) === 60) return file;
|
|
1380
|
-
if (/^\w+:\/\//.test(file)) return file;
|
|
1381
|
-
let cached = this.memoizedPaths.get(file);
|
|
1382
|
-
if (cached) return cached;
|
|
1383
|
-
let from = this.opts.to ? dirname(this.opts.to) : ".";
|
|
1384
|
-
if (typeof this.mapOpts.annotation === "string") {
|
|
1385
|
-
from = dirname(resolve(from, this.mapOpts.annotation));
|
|
1386
|
-
}
|
|
1387
|
-
let path = relative(from, file);
|
|
1388
|
-
this.memoizedPaths.set(file, path);
|
|
1389
|
-
return path;
|
|
1426
|
+
withContent() {
|
|
1427
|
+
return !!(this.consumer().sourcesContent && this.consumer().sourcesContent.length > 0);
|
|
1390
1428
|
}
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1429
|
+
};
|
|
1430
|
+
var previousMap = PreviousMap$2;
|
|
1431
|
+
PreviousMap$2.default = PreviousMap$2;
|
|
1432
|
+
let { nanoid } = nonSecure;
|
|
1433
|
+
let { isAbsolute, resolve: resolve$1 } = require$$2;
|
|
1434
|
+
let { SourceMapConsumer: SourceMapConsumer$1, SourceMapGenerator: SourceMapGenerator$1 } = require$$2;
|
|
1435
|
+
let { fileURLToPath, pathToFileURL: pathToFileURL$1 } = require$$2;
|
|
1436
|
+
let CssSyntaxError$2 = cssSyntaxError;
|
|
1437
|
+
let PreviousMap$1 = previousMap;
|
|
1438
|
+
let terminalHighlight = require$$2;
|
|
1439
|
+
let fromOffsetCache = Symbol("fromOffsetCache");
|
|
1440
|
+
let sourceMapAvailable$1 = Boolean(SourceMapConsumer$1 && SourceMapGenerator$1);
|
|
1441
|
+
let pathAvailable$1 = Boolean(resolve$1 && isAbsolute);
|
|
1442
|
+
let Input$6 = class Input {
|
|
1443
|
+
constructor(css, opts = {}) {
|
|
1444
|
+
if (css === null || typeof css === "undefined" || typeof css === "object" && !css.toString) {
|
|
1445
|
+
throw new Error(`PostCSS received ${css} instead of CSS string`);
|
|
1446
|
+
}
|
|
1447
|
+
this.css = css.toString();
|
|
1448
|
+
if (this.css[0] === "\uFEFF" || this.css[0] === "") {
|
|
1449
|
+
this.hasBOM = true;
|
|
1450
|
+
this.css = this.css.slice(1);
|
|
1451
|
+
} else {
|
|
1452
|
+
this.hasBOM = false;
|
|
1453
|
+
}
|
|
1454
|
+
this.document = this.css;
|
|
1455
|
+
if (opts.document) this.document = opts.document.toString();
|
|
1456
|
+
if (opts.from) {
|
|
1457
|
+
if (!pathAvailable$1 || /^\w+:\/\//.test(opts.from) || isAbsolute(opts.from)) {
|
|
1458
|
+
this.file = opts.from;
|
|
1403
1459
|
} else {
|
|
1404
|
-
|
|
1405
|
-
if (input2.map) this.previousMaps.push(input2.map);
|
|
1460
|
+
this.file = resolve$1(opts.from);
|
|
1406
1461
|
}
|
|
1407
1462
|
}
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
let from = node2.source.input.from;
|
|
1416
|
-
if (from && !already[from]) {
|
|
1417
|
-
already[from] = true;
|
|
1418
|
-
let fromUrl = this.usesFileUrls ? this.toFileUrl(from) : this.toUrl(this.path(from));
|
|
1419
|
-
this.map.setSourceContent(fromUrl, node2.source.input.css);
|
|
1420
|
-
}
|
|
1421
|
-
}
|
|
1422
|
-
});
|
|
1423
|
-
} else if (this.css) {
|
|
1424
|
-
let from = this.opts.from ? this.toUrl(this.path(this.opts.from)) : "<no source>";
|
|
1425
|
-
this.map.setSourceContent(from, this.css);
|
|
1463
|
+
if (pathAvailable$1 && sourceMapAvailable$1) {
|
|
1464
|
+
let map = new PreviousMap$1(this.css, opts);
|
|
1465
|
+
if (map.text) {
|
|
1466
|
+
this.map = map;
|
|
1467
|
+
let file = map.consumer().file;
|
|
1468
|
+
if (!this.file && file) this.file = this.mapResolve(file);
|
|
1469
|
+
}
|
|
1426
1470
|
}
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
if (this.mapOpts.from) {
|
|
1430
|
-
return this.toUrl(this.mapOpts.from);
|
|
1431
|
-
} else if (this.usesFileUrls) {
|
|
1432
|
-
return this.toFileUrl(node2.source.input.from);
|
|
1433
|
-
} else {
|
|
1434
|
-
return this.toUrl(this.path(node2.source.input.from));
|
|
1471
|
+
if (!this.file) {
|
|
1472
|
+
this.id = "<input css " + nanoid(6) + ">";
|
|
1435
1473
|
}
|
|
1474
|
+
if (this.map) this.map.file = this.from;
|
|
1436
1475
|
}
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1476
|
+
error(message, line, column, opts = {}) {
|
|
1477
|
+
let endColumn, endLine, result2;
|
|
1478
|
+
if (line && typeof line === "object") {
|
|
1479
|
+
let start = line;
|
|
1480
|
+
let end = column;
|
|
1481
|
+
if (typeof start.offset === "number") {
|
|
1482
|
+
let pos = this.fromOffset(start.offset);
|
|
1483
|
+
line = pos.line;
|
|
1484
|
+
column = pos.col;
|
|
1485
|
+
} else {
|
|
1486
|
+
line = start.line;
|
|
1487
|
+
column = start.column;
|
|
1488
|
+
}
|
|
1489
|
+
if (typeof end.offset === "number") {
|
|
1490
|
+
let pos = this.fromOffset(end.offset);
|
|
1491
|
+
endLine = pos.line;
|
|
1492
|
+
endColumn = pos.col;
|
|
1493
|
+
} else {
|
|
1494
|
+
endLine = end.line;
|
|
1495
|
+
endColumn = end.column;
|
|
1496
|
+
}
|
|
1497
|
+
} else if (!column) {
|
|
1498
|
+
let pos = this.fromOffset(line);
|
|
1499
|
+
line = pos.line;
|
|
1500
|
+
column = pos.col;
|
|
1442
1501
|
}
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1502
|
+
let origin = this.origin(line, column, endLine, endColumn);
|
|
1503
|
+
if (origin) {
|
|
1504
|
+
result2 = new CssSyntaxError$2(
|
|
1505
|
+
message,
|
|
1506
|
+
origin.endLine === void 0 ? origin.line : { column: origin.column, line: origin.line },
|
|
1507
|
+
origin.endLine === void 0 ? origin.column : { column: origin.endColumn, line: origin.endLine },
|
|
1508
|
+
origin.source,
|
|
1509
|
+
origin.file,
|
|
1510
|
+
opts.plugin
|
|
1511
|
+
);
|
|
1451
1512
|
} else {
|
|
1452
|
-
|
|
1453
|
-
|
|
1513
|
+
result2 = new CssSyntaxError$2(
|
|
1514
|
+
message,
|
|
1515
|
+
endLine === void 0 ? line : { column, line },
|
|
1516
|
+
endLine === void 0 ? column : { column: endColumn, line: endLine },
|
|
1517
|
+
this.css,
|
|
1518
|
+
this.file,
|
|
1519
|
+
opts.plugin
|
|
1454
1520
|
);
|
|
1455
1521
|
}
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1522
|
+
result2.input = { column, endColumn, endLine, line, source: this.css };
|
|
1523
|
+
if (this.file) {
|
|
1524
|
+
if (pathToFileURL$1) {
|
|
1525
|
+
result2.input.url = pathToFileURL$1(this.file).toString();
|
|
1526
|
+
}
|
|
1527
|
+
result2.input.file = this.file;
|
|
1462
1528
|
}
|
|
1463
|
-
|
|
1464
|
-
this.memoizedURLs.set(path, url);
|
|
1465
|
-
return url;
|
|
1466
|
-
}
|
|
1467
|
-
};
|
|
1468
|
-
var mapGenerator = MapGenerator$2;
|
|
1469
|
-
let Node$2 = node;
|
|
1470
|
-
let Comment$4 = class Comment extends Node$2 {
|
|
1471
|
-
constructor(defaults) {
|
|
1472
|
-
super(defaults);
|
|
1473
|
-
this.type = "comment";
|
|
1529
|
+
return result2;
|
|
1474
1530
|
}
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
let
|
|
1479
|
-
|
|
1480
|
-
let
|
|
1481
|
-
let
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1531
|
+
fromOffset(offset) {
|
|
1532
|
+
let lastLine, lineToIndex;
|
|
1533
|
+
if (!this[fromOffsetCache]) {
|
|
1534
|
+
let lines = this.css.split("\n");
|
|
1535
|
+
lineToIndex = new Array(lines.length);
|
|
1536
|
+
let prevIndex = 0;
|
|
1537
|
+
for (let i = 0, l = lines.length; i < l; i++) {
|
|
1538
|
+
lineToIndex[i] = prevIndex;
|
|
1539
|
+
prevIndex += lines[i].length + 1;
|
|
1540
|
+
}
|
|
1541
|
+
this[fromOffsetCache] = lineToIndex;
|
|
1542
|
+
} else {
|
|
1543
|
+
lineToIndex = this[fromOffsetCache];
|
|
1544
|
+
}
|
|
1545
|
+
lastLine = lineToIndex[lineToIndex.length - 1];
|
|
1546
|
+
let min = 0;
|
|
1547
|
+
if (offset >= lastLine) {
|
|
1548
|
+
min = lineToIndex.length - 1;
|
|
1549
|
+
} else {
|
|
1550
|
+
let max = lineToIndex.length - 2;
|
|
1551
|
+
let mid;
|
|
1552
|
+
while (min < max) {
|
|
1553
|
+
mid = min + (max - min >> 1);
|
|
1554
|
+
if (offset < lineToIndex[mid]) {
|
|
1555
|
+
max = mid - 1;
|
|
1556
|
+
} else if (offset >= lineToIndex[mid + 1]) {
|
|
1557
|
+
min = mid + 1;
|
|
1558
|
+
} else {
|
|
1559
|
+
min = mid;
|
|
1560
|
+
break;
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1495
1563
|
}
|
|
1564
|
+
return {
|
|
1565
|
+
col: offset - lineToIndex[min] + 1,
|
|
1566
|
+
line: min + 1
|
|
1567
|
+
};
|
|
1496
1568
|
}
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
for (let child of children) {
|
|
1501
|
-
let nodes = this.normalize(child, this.last);
|
|
1502
|
-
for (let node2 of nodes) this.proxyOf.nodes.push(node2);
|
|
1569
|
+
mapResolve(file) {
|
|
1570
|
+
if (/^\w+:\/\//.test(file)) {
|
|
1571
|
+
return file;
|
|
1503
1572
|
}
|
|
1504
|
-
this.
|
|
1505
|
-
return this;
|
|
1573
|
+
return resolve$1(this.map.consumer().sourceRoot || this.map.root || ".", file);
|
|
1506
1574
|
}
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1575
|
+
origin(line, column, endLine, endColumn) {
|
|
1576
|
+
if (!this.map) return false;
|
|
1577
|
+
let consumer = this.map.consumer();
|
|
1578
|
+
let from = consumer.originalPositionFor({ column, line });
|
|
1579
|
+
if (!from.source) return false;
|
|
1580
|
+
let to;
|
|
1581
|
+
if (typeof endLine === "number") {
|
|
1582
|
+
to = consumer.originalPositionFor({ column: endColumn, line: endLine });
|
|
1511
1583
|
}
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
if (result2 === false) break;
|
|
1521
|
-
this.indexes[iterator] += 1;
|
|
1584
|
+
let fromUrl;
|
|
1585
|
+
if (isAbsolute(from.source)) {
|
|
1586
|
+
fromUrl = pathToFileURL$1(from.source);
|
|
1587
|
+
} else {
|
|
1588
|
+
fromUrl = new URL(
|
|
1589
|
+
from.source,
|
|
1590
|
+
this.map.consumer().sourceRoot || pathToFileURL$1(this.map.mapFile)
|
|
1591
|
+
);
|
|
1522
1592
|
}
|
|
1523
|
-
|
|
1593
|
+
let result2 = {
|
|
1594
|
+
column: from.column,
|
|
1595
|
+
endColumn: to && to.column,
|
|
1596
|
+
endLine: to && to.line,
|
|
1597
|
+
line: from.line,
|
|
1598
|
+
url: fromUrl.toString()
|
|
1599
|
+
};
|
|
1600
|
+
if (fromUrl.protocol === "file:") {
|
|
1601
|
+
if (fileURLToPath) {
|
|
1602
|
+
result2.file = fileURLToPath(fromUrl);
|
|
1603
|
+
} else {
|
|
1604
|
+
throw new Error(`file: protocol is not available in this PostCSS build`);
|
|
1605
|
+
}
|
|
1606
|
+
}
|
|
1607
|
+
let source = consumer.sourceContentFor(from.source);
|
|
1608
|
+
if (source) result2.source = source;
|
|
1524
1609
|
return result2;
|
|
1525
1610
|
}
|
|
1526
|
-
|
|
1527
|
-
|
|
1611
|
+
toJSON() {
|
|
1612
|
+
let json = {};
|
|
1613
|
+
for (let name of ["hasBOM", "css", "file", "id"]) {
|
|
1614
|
+
if (this[name] != null) {
|
|
1615
|
+
json[name] = this[name];
|
|
1616
|
+
}
|
|
1617
|
+
}
|
|
1618
|
+
if (this.map) {
|
|
1619
|
+
json.map = { ...this.map };
|
|
1620
|
+
if (json.map.consumerCache) {
|
|
1621
|
+
json.map.consumerCache = void 0;
|
|
1622
|
+
}
|
|
1623
|
+
}
|
|
1624
|
+
return json;
|
|
1528
1625
|
}
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
if (!this.indexes) this.indexes = {};
|
|
1532
|
-
this.lastEach += 1;
|
|
1533
|
-
let iterator = this.lastEach;
|
|
1534
|
-
this.indexes[iterator] = 0;
|
|
1535
|
-
return iterator;
|
|
1626
|
+
get from() {
|
|
1627
|
+
return this.file || this.id;
|
|
1536
1628
|
}
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
return (cb) => {
|
|
1558
|
-
return node2[prop](
|
|
1559
|
-
(child, ...other) => cb(child.toProxy(), ...other)
|
|
1560
|
-
);
|
|
1561
|
-
};
|
|
1562
|
-
} else if (prop === "root") {
|
|
1563
|
-
return () => node2.root().toProxy();
|
|
1564
|
-
} else if (prop === "nodes") {
|
|
1565
|
-
return node2.nodes.map((i) => i.toProxy());
|
|
1566
|
-
} else if (prop === "first" || prop === "last") {
|
|
1567
|
-
return node2[prop].toProxy();
|
|
1629
|
+
};
|
|
1630
|
+
var input = Input$6;
|
|
1631
|
+
Input$6.default = Input$6;
|
|
1632
|
+
if (terminalHighlight && terminalHighlight.registerInput) {
|
|
1633
|
+
terminalHighlight.registerInput(Input$6);
|
|
1634
|
+
}
|
|
1635
|
+
let Container$5 = container;
|
|
1636
|
+
let LazyResult$3, Processor$3;
|
|
1637
|
+
let Root$6 = class Root extends Container$5 {
|
|
1638
|
+
constructor(defaults) {
|
|
1639
|
+
super(defaults);
|
|
1640
|
+
this.type = "root";
|
|
1641
|
+
if (!this.nodes) this.nodes = [];
|
|
1642
|
+
}
|
|
1643
|
+
normalize(child, sample, type) {
|
|
1644
|
+
let nodes = super.normalize(child);
|
|
1645
|
+
if (sample) {
|
|
1646
|
+
if (type === "prepend") {
|
|
1647
|
+
if (this.nodes.length > 1) {
|
|
1648
|
+
sample.raws.before = this.nodes[1].raws.before;
|
|
1568
1649
|
} else {
|
|
1569
|
-
|
|
1650
|
+
delete sample.raws.before;
|
|
1570
1651
|
}
|
|
1571
|
-
}
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
node2[prop] = value;
|
|
1575
|
-
if (prop === "name" || prop === "params" || prop === "selector") {
|
|
1576
|
-
node2.markDirty();
|
|
1652
|
+
} else if (this.first !== sample) {
|
|
1653
|
+
for (let node2 of nodes) {
|
|
1654
|
+
node2.raws.before = sample.raws.before;
|
|
1577
1655
|
}
|
|
1578
|
-
return true;
|
|
1579
|
-
}
|
|
1580
|
-
};
|
|
1581
|
-
}
|
|
1582
|
-
index(child) {
|
|
1583
|
-
if (typeof child === "number") return child;
|
|
1584
|
-
if (child.proxyOf) child = child.proxyOf;
|
|
1585
|
-
return this.proxyOf.nodes.indexOf(child);
|
|
1586
|
-
}
|
|
1587
|
-
insertAfter(exist, add) {
|
|
1588
|
-
let existIndex = this.index(exist);
|
|
1589
|
-
let nodes = this.normalize(add, this.proxyOf.nodes[existIndex]).reverse();
|
|
1590
|
-
existIndex = this.index(exist);
|
|
1591
|
-
for (let node2 of nodes) this.proxyOf.nodes.splice(existIndex + 1, 0, node2);
|
|
1592
|
-
let index2;
|
|
1593
|
-
for (let id in this.indexes) {
|
|
1594
|
-
index2 = this.indexes[id];
|
|
1595
|
-
if (existIndex < index2) {
|
|
1596
|
-
this.indexes[id] = index2 + nodes.length;
|
|
1597
1656
|
}
|
|
1598
1657
|
}
|
|
1599
|
-
|
|
1600
|
-
return this;
|
|
1658
|
+
return nodes;
|
|
1601
1659
|
}
|
|
1602
|
-
|
|
1603
|
-
let
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
existIndex = this.index(exist);
|
|
1607
|
-
for (let node2 of nodes) this.proxyOf.nodes.splice(existIndex, 0, node2);
|
|
1608
|
-
let index2;
|
|
1609
|
-
for (let id in this.indexes) {
|
|
1610
|
-
index2 = this.indexes[id];
|
|
1611
|
-
if (existIndex <= index2) {
|
|
1612
|
-
this.indexes[id] = index2 + nodes.length;
|
|
1613
|
-
}
|
|
1660
|
+
removeChild(child, ignore) {
|
|
1661
|
+
let index2 = this.index(child);
|
|
1662
|
+
if (!ignore && index2 === 0 && this.nodes.length > 1) {
|
|
1663
|
+
this.nodes[1].raws.before = this.nodes[index2].raws.before;
|
|
1614
1664
|
}
|
|
1615
|
-
|
|
1616
|
-
return this;
|
|
1665
|
+
return super.removeChild(child);
|
|
1617
1666
|
}
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
if (typeof i.raws.before === "undefined") {
|
|
1657
|
-
if (sample && typeof sample.raws.before !== "undefined") {
|
|
1658
|
-
i.raws.before = sample.raws.before.replace(/\S/g, "");
|
|
1667
|
+
toResult(opts = {}) {
|
|
1668
|
+
let lazy = new LazyResult$3(new Processor$3(), this, opts);
|
|
1669
|
+
return lazy.stringify();
|
|
1670
|
+
}
|
|
1671
|
+
};
|
|
1672
|
+
Root$6.registerLazyResult = (dependant) => {
|
|
1673
|
+
LazyResult$3 = dependant;
|
|
1674
|
+
};
|
|
1675
|
+
Root$6.registerProcessor = (dependant) => {
|
|
1676
|
+
Processor$3 = dependant;
|
|
1677
|
+
};
|
|
1678
|
+
var root$1 = Root$6;
|
|
1679
|
+
Root$6.default = Root$6;
|
|
1680
|
+
Container$5.registerRoot(Root$6);
|
|
1681
|
+
let list$3 = {
|
|
1682
|
+
comma(string) {
|
|
1683
|
+
return list$3.split(string, [","], true);
|
|
1684
|
+
},
|
|
1685
|
+
space(string) {
|
|
1686
|
+
let spaces = [" ", "\n", " "];
|
|
1687
|
+
return list$3.split(string, spaces);
|
|
1688
|
+
},
|
|
1689
|
+
split(string, separators, last) {
|
|
1690
|
+
let array = [];
|
|
1691
|
+
let current = "";
|
|
1692
|
+
let split = false;
|
|
1693
|
+
let func = 0;
|
|
1694
|
+
let inQuote = false;
|
|
1695
|
+
let prevQuote = "";
|
|
1696
|
+
let escape = false;
|
|
1697
|
+
for (let letter of string) {
|
|
1698
|
+
if (escape) {
|
|
1699
|
+
escape = false;
|
|
1700
|
+
} else if (letter === "\\") {
|
|
1701
|
+
escape = true;
|
|
1702
|
+
} else if (inQuote) {
|
|
1703
|
+
if (letter === prevQuote) {
|
|
1704
|
+
inQuote = false;
|
|
1659
1705
|
}
|
|
1706
|
+
} else if (letter === '"' || letter === "'") {
|
|
1707
|
+
inQuote = true;
|
|
1708
|
+
prevQuote = letter;
|
|
1709
|
+
} else if (letter === "(") {
|
|
1710
|
+
func += 1;
|
|
1711
|
+
} else if (letter === ")") {
|
|
1712
|
+
if (func > 0) func -= 1;
|
|
1713
|
+
} else if (func === 0) {
|
|
1714
|
+
if (separators.includes(letter)) split = true;
|
|
1660
1715
|
}
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
children = children.reverse();
|
|
1668
|
-
for (let child of children) {
|
|
1669
|
-
let nodes = this.normalize(child, this.first, "prepend").reverse();
|
|
1670
|
-
for (let node2 of nodes) this.proxyOf.nodes.unshift(node2);
|
|
1671
|
-
for (let id in this.indexes) {
|
|
1672
|
-
this.indexes[id] = this.indexes[id] + nodes.length;
|
|
1716
|
+
if (split) {
|
|
1717
|
+
if (current !== "") array.push(current.trim());
|
|
1718
|
+
current = "";
|
|
1719
|
+
split = false;
|
|
1720
|
+
} else {
|
|
1721
|
+
current += letter;
|
|
1673
1722
|
}
|
|
1674
1723
|
}
|
|
1675
|
-
|
|
1676
|
-
return
|
|
1724
|
+
if (last || current !== "") array.push(current.trim());
|
|
1725
|
+
return array;
|
|
1677
1726
|
}
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1727
|
+
};
|
|
1728
|
+
var list_1 = list$3;
|
|
1729
|
+
list$3.default = list$3;
|
|
1730
|
+
let Container$4 = container;
|
|
1731
|
+
let list$2 = list_1;
|
|
1732
|
+
let Rule$4 = class Rule extends Container$4 {
|
|
1733
|
+
constructor(defaults) {
|
|
1734
|
+
super(defaults);
|
|
1735
|
+
this.type = "rule";
|
|
1736
|
+
if (!this.nodes) this.nodes = [];
|
|
1682
1737
|
}
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
this.proxyOf.nodes = [];
|
|
1686
|
-
this.markDirty();
|
|
1687
|
-
return this;
|
|
1738
|
+
get selectors() {
|
|
1739
|
+
return list$2.comma(this.selector);
|
|
1688
1740
|
}
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
this.
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1741
|
+
set selectors(values) {
|
|
1742
|
+
let match = this.selector ? this.selector.match(/,\s*/) : null;
|
|
1743
|
+
let sep2 = match ? match[0] : "," + this.raw("between", "beforeOpen");
|
|
1744
|
+
this.selector = values.join(sep2);
|
|
1745
|
+
}
|
|
1746
|
+
};
|
|
1747
|
+
var rule$1 = Rule$4;
|
|
1748
|
+
Rule$4.default = Rule$4;
|
|
1749
|
+
Container$4.registerRule(Rule$4);
|
|
1750
|
+
let AtRule$3 = atRule$1;
|
|
1751
|
+
let Comment$4 = comment$1;
|
|
1752
|
+
let Declaration$3 = declaration;
|
|
1753
|
+
let Input$5 = input;
|
|
1754
|
+
let PreviousMap2 = previousMap;
|
|
1755
|
+
let Root$5 = root$1;
|
|
1756
|
+
let Rule$3 = rule$1;
|
|
1757
|
+
function fromJSON$2(json, inputs) {
|
|
1758
|
+
if (Array.isArray(json)) return json.map((n) => fromJSON$2(n));
|
|
1759
|
+
let { inputs: ownInputs, ...defaults } = json;
|
|
1760
|
+
if (ownInputs) {
|
|
1761
|
+
inputs = [];
|
|
1762
|
+
for (let input2 of ownInputs) {
|
|
1763
|
+
let inputHydrated = { ...input2, __proto__: Input$5.prototype };
|
|
1764
|
+
if (inputHydrated.map) {
|
|
1765
|
+
inputHydrated.map = {
|
|
1766
|
+
...inputHydrated.map,
|
|
1767
|
+
__proto__: PreviousMap2.prototype
|
|
1768
|
+
};
|
|
1698
1769
|
}
|
|
1770
|
+
inputs.push(inputHydrated);
|
|
1699
1771
|
}
|
|
1700
|
-
this.markDirty();
|
|
1701
|
-
return this;
|
|
1702
1772
|
}
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1773
|
+
if (defaults.nodes) {
|
|
1774
|
+
defaults.nodes = json.nodes.map((n) => fromJSON$2(n, inputs));
|
|
1775
|
+
}
|
|
1776
|
+
if (defaults.source) {
|
|
1777
|
+
let { inputId, ...source } = defaults.source;
|
|
1778
|
+
defaults.source = source;
|
|
1779
|
+
if (inputId != null) {
|
|
1780
|
+
defaults.source.input = inputs[inputId];
|
|
1707
1781
|
}
|
|
1708
|
-
this.walkDecls((decl) => {
|
|
1709
|
-
if (opts.props && !opts.props.includes(decl.prop)) return;
|
|
1710
|
-
if (opts.fast && !decl.value.includes(opts.fast)) return;
|
|
1711
|
-
decl.value = decl.value.replace(pattern, callback);
|
|
1712
|
-
});
|
|
1713
|
-
this.markDirty();
|
|
1714
|
-
return this;
|
|
1715
1782
|
}
|
|
1716
|
-
|
|
1717
|
-
return
|
|
1783
|
+
if (defaults.type === "root") {
|
|
1784
|
+
return new Root$5(defaults);
|
|
1785
|
+
} else if (defaults.type === "decl") {
|
|
1786
|
+
return new Declaration$3(defaults);
|
|
1787
|
+
} else if (defaults.type === "rule") {
|
|
1788
|
+
return new Rule$3(defaults);
|
|
1789
|
+
} else if (defaults.type === "comment") {
|
|
1790
|
+
return new Comment$4(defaults);
|
|
1791
|
+
} else if (defaults.type === "atrule") {
|
|
1792
|
+
return new AtRule$3(defaults);
|
|
1793
|
+
} else {
|
|
1794
|
+
throw new Error("Unknown node type: " + json.type);
|
|
1718
1795
|
}
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1796
|
+
}
|
|
1797
|
+
var fromJSON_1 = fromJSON$2;
|
|
1798
|
+
fromJSON$2.default = fromJSON$2;
|
|
1799
|
+
let { dirname, relative, resolve, sep } = require$$2;
|
|
1800
|
+
let { SourceMapConsumer, SourceMapGenerator } = require$$2;
|
|
1801
|
+
let { pathToFileURL } = require$$2;
|
|
1802
|
+
let Input$4 = input;
|
|
1803
|
+
let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);
|
|
1804
|
+
let pathAvailable = Boolean(dirname && resolve && relative && sep);
|
|
1805
|
+
let MapGenerator$2 = class MapGenerator {
|
|
1806
|
+
constructor(stringify2, root2, opts, cssString) {
|
|
1807
|
+
this.stringify = stringify2;
|
|
1808
|
+
this.mapOpts = opts.map || {};
|
|
1809
|
+
this.root = root2;
|
|
1810
|
+
this.opts = opts;
|
|
1811
|
+
this.css = cssString;
|
|
1812
|
+
this.originalCSS = cssString;
|
|
1813
|
+
this.usesFileUrls = !this.mapOpts.from && this.mapOpts.absolute;
|
|
1814
|
+
this.memoizedFileURLs = /* @__PURE__ */ new Map();
|
|
1815
|
+
this.memoizedPaths = /* @__PURE__ */ new Map();
|
|
1816
|
+
this.memoizedURLs = /* @__PURE__ */ new Map();
|
|
1817
|
+
}
|
|
1818
|
+
addAnnotation() {
|
|
1819
|
+
let content;
|
|
1820
|
+
if (this.isInline()) {
|
|
1821
|
+
content = "data:application/json;base64," + this.toBase64(this.map.toString());
|
|
1822
|
+
} else if (typeof this.mapOpts.annotation === "string") {
|
|
1823
|
+
content = this.mapOpts.annotation;
|
|
1824
|
+
} else if (typeof this.mapOpts.annotation === "function") {
|
|
1825
|
+
content = this.mapOpts.annotation(this.opts.to, this.root);
|
|
1826
|
+
} else {
|
|
1827
|
+
content = this.outputFile() + ".map";
|
|
1828
|
+
}
|
|
1829
|
+
let eol = "\n";
|
|
1830
|
+
if (this.css.includes("\r\n")) eol = "\r\n";
|
|
1831
|
+
this.css += eol + "/*# sourceMappingURL=" + content + " */";
|
|
1832
|
+
}
|
|
1833
|
+
applyPrevMaps() {
|
|
1834
|
+
for (let prev of this.previous()) {
|
|
1835
|
+
let from = this.toUrl(this.path(prev.file));
|
|
1836
|
+
let root2 = prev.root || dirname(prev.file);
|
|
1837
|
+
let map;
|
|
1838
|
+
if (this.mapOpts.sourcesContent === false) {
|
|
1839
|
+
map = new SourceMapConsumer(prev.text);
|
|
1840
|
+
if (map.sourcesContent) {
|
|
1841
|
+
map.sourcesContent = null;
|
|
1842
|
+
}
|
|
1843
|
+
} else {
|
|
1844
|
+
map = prev.consumer();
|
|
1729
1845
|
}
|
|
1730
|
-
|
|
1731
|
-
}
|
|
1846
|
+
this.map.applySourceMap(map, from, this.toUrl(this.path(root2)));
|
|
1847
|
+
}
|
|
1732
1848
|
}
|
|
1733
|
-
|
|
1734
|
-
if (
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1849
|
+
clearAnnotation() {
|
|
1850
|
+
if (this.mapOpts.annotation === false) return;
|
|
1851
|
+
if (this.root) {
|
|
1852
|
+
let node2;
|
|
1853
|
+
for (let i = this.root.nodes.length - 1; i >= 0; i--) {
|
|
1854
|
+
node2 = this.root.nodes[i];
|
|
1855
|
+
if (node2.type !== "comment") continue;
|
|
1856
|
+
if (node2.text.startsWith("# sourceMappingURL=")) {
|
|
1857
|
+
this.root.removeChild(i);
|
|
1739
1858
|
}
|
|
1859
|
+
}
|
|
1860
|
+
} else if (this.css) {
|
|
1861
|
+
this.css = this.css.replace(/\n*\/\*#[\S\s]*?\*\/$/gm, "");
|
|
1862
|
+
}
|
|
1863
|
+
}
|
|
1864
|
+
generate() {
|
|
1865
|
+
this.clearAnnotation();
|
|
1866
|
+
if (pathAvailable && sourceMapAvailable && this.isMap()) {
|
|
1867
|
+
return this.generateMap();
|
|
1868
|
+
} else {
|
|
1869
|
+
let result2 = "";
|
|
1870
|
+
this.stringify(this.root, (i) => {
|
|
1871
|
+
result2 += i;
|
|
1740
1872
|
});
|
|
1873
|
+
return [result2];
|
|
1741
1874
|
}
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1875
|
+
}
|
|
1876
|
+
generateMap() {
|
|
1877
|
+
if (this.root) {
|
|
1878
|
+
this.generateString();
|
|
1879
|
+
} else if (this.previous().length === 1) {
|
|
1880
|
+
let prev = this.previous()[0].consumer();
|
|
1881
|
+
prev.file = this.outputFile();
|
|
1882
|
+
this.map = SourceMapGenerator.fromSourceMap(prev, {
|
|
1883
|
+
ignoreInvalidMapping: true
|
|
1884
|
+
});
|
|
1885
|
+
} else {
|
|
1886
|
+
this.map = new SourceMapGenerator({
|
|
1887
|
+
file: this.outputFile(),
|
|
1888
|
+
ignoreInvalidMapping: true
|
|
1889
|
+
});
|
|
1890
|
+
this.map.addMapping({
|
|
1891
|
+
generated: { column: 0, line: 1 },
|
|
1892
|
+
original: { column: 0, line: 1 },
|
|
1893
|
+
source: this.opts.from ? this.toUrl(this.path(this.opts.from)) : "<no source>"
|
|
1747
1894
|
});
|
|
1748
1895
|
}
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1896
|
+
if (this.isSourcesContent()) this.setSourcesContent();
|
|
1897
|
+
if (this.root && this.previous().length > 0) this.applyPrevMaps();
|
|
1898
|
+
if (this.isAnnotation()) this.addAnnotation();
|
|
1899
|
+
if (this.isInline()) {
|
|
1900
|
+
return [this.css];
|
|
1901
|
+
} else {
|
|
1902
|
+
return [this.css, this.map];
|
|
1903
|
+
}
|
|
1904
|
+
}
|
|
1905
|
+
generateString() {
|
|
1906
|
+
this.css = "";
|
|
1907
|
+
this.map = new SourceMapGenerator({
|
|
1908
|
+
file: this.outputFile(),
|
|
1909
|
+
ignoreInvalidMapping: true
|
|
1910
|
+
});
|
|
1911
|
+
let line = 1;
|
|
1912
|
+
let column = 1;
|
|
1913
|
+
let noSource = "<no source>";
|
|
1914
|
+
let mapping = {
|
|
1915
|
+
generated: { column: 0, line: 0 },
|
|
1916
|
+
original: { column: 0, line: 0 },
|
|
1917
|
+
source: ""
|
|
1918
|
+
};
|
|
1919
|
+
let last, lines;
|
|
1920
|
+
this.stringify(this.root, (str, node2, type) => {
|
|
1921
|
+
this.css += str;
|
|
1922
|
+
if (node2 && type !== "end") {
|
|
1923
|
+
mapping.generated.line = line;
|
|
1924
|
+
mapping.generated.column = column - 1;
|
|
1925
|
+
if (node2.source && node2.source.start) {
|
|
1926
|
+
mapping.source = this.sourcePath(node2);
|
|
1927
|
+
mapping.original.line = node2.source.start.line;
|
|
1928
|
+
mapping.original.column = node2.source.start.column - 1;
|
|
1929
|
+
this.map.addMapping(mapping);
|
|
1930
|
+
} else {
|
|
1931
|
+
mapping.source = noSource;
|
|
1932
|
+
mapping.original.line = 1;
|
|
1933
|
+
mapping.original.column = 0;
|
|
1934
|
+
this.map.addMapping(mapping);
|
|
1935
|
+
}
|
|
1752
1936
|
}
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1937
|
+
lines = str.match(/\n/g);
|
|
1938
|
+
if (lines) {
|
|
1939
|
+
line += lines.length;
|
|
1940
|
+
last = str.lastIndexOf("\n");
|
|
1941
|
+
column = str.length - last;
|
|
1942
|
+
} else {
|
|
1943
|
+
column += str.length;
|
|
1759
1944
|
}
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1945
|
+
if (node2 && type !== "start") {
|
|
1946
|
+
let p = node2.parent || { raws: {} };
|
|
1947
|
+
let childless = node2.type === "decl" || node2.type === "atrule" && !node2.nodes;
|
|
1948
|
+
if (!childless || node2 !== p.last || p.raws.semicolon) {
|
|
1949
|
+
if (node2.source && node2.source.end) {
|
|
1950
|
+
mapping.source = this.sourcePath(node2);
|
|
1951
|
+
mapping.original.line = node2.source.end.line;
|
|
1952
|
+
mapping.original.column = node2.source.end.column - 1;
|
|
1953
|
+
mapping.generated.line = line;
|
|
1954
|
+
mapping.generated.column = column - 2;
|
|
1955
|
+
this.map.addMapping(mapping);
|
|
1956
|
+
} else {
|
|
1957
|
+
mapping.source = noSource;
|
|
1958
|
+
mapping.original.line = 1;
|
|
1959
|
+
mapping.original.column = 0;
|
|
1960
|
+
mapping.generated.line = line;
|
|
1961
|
+
mapping.generated.column = column - 1;
|
|
1962
|
+
this.map.addMapping(mapping);
|
|
1963
|
+
}
|
|
1775
1964
|
}
|
|
1776
|
-
});
|
|
1777
|
-
}
|
|
1778
|
-
return this.walk((child, i) => {
|
|
1779
|
-
if (child.type === "decl" && child.prop === prop) {
|
|
1780
|
-
return callback(child, i);
|
|
1781
1965
|
}
|
|
1782
1966
|
});
|
|
1783
1967
|
}
|
|
1784
|
-
|
|
1785
|
-
if (
|
|
1786
|
-
|
|
1787
|
-
return this.walk((child, i) => {
|
|
1788
|
-
if (child.type === "rule") {
|
|
1789
|
-
return callback(child, i);
|
|
1790
|
-
}
|
|
1791
|
-
});
|
|
1968
|
+
isAnnotation() {
|
|
1969
|
+
if (this.isInline()) {
|
|
1970
|
+
return true;
|
|
1792
1971
|
}
|
|
1793
|
-
if (
|
|
1794
|
-
return this.
|
|
1795
|
-
if (child.type === "rule" && selector.test(child.selector)) {
|
|
1796
|
-
return callback(child, i);
|
|
1797
|
-
}
|
|
1798
|
-
});
|
|
1972
|
+
if (typeof this.mapOpts.annotation !== "undefined") {
|
|
1973
|
+
return this.mapOpts.annotation;
|
|
1799
1974
|
}
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
});
|
|
1805
|
-
}
|
|
1806
|
-
get first() {
|
|
1807
|
-
if (!this.proxyOf.nodes) return void 0;
|
|
1808
|
-
return this.proxyOf.nodes[0];
|
|
1809
|
-
}
|
|
1810
|
-
get last() {
|
|
1811
|
-
if (!this.proxyOf.nodes) return void 0;
|
|
1812
|
-
return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
|
|
1813
|
-
}
|
|
1814
|
-
};
|
|
1815
|
-
Container$7.registerParse = (dependant) => {
|
|
1816
|
-
parse$4 = dependant;
|
|
1817
|
-
};
|
|
1818
|
-
Container$7.registerRule = (dependant) => {
|
|
1819
|
-
Rule$4 = dependant;
|
|
1820
|
-
};
|
|
1821
|
-
Container$7.registerAtRule = (dependant) => {
|
|
1822
|
-
AtRule$4 = dependant;
|
|
1823
|
-
};
|
|
1824
|
-
Container$7.registerRoot = (dependant) => {
|
|
1825
|
-
Root$6 = dependant;
|
|
1826
|
-
};
|
|
1827
|
-
var container = Container$7;
|
|
1828
|
-
Container$7.default = Container$7;
|
|
1829
|
-
Container$7.rebuild = (node2) => {
|
|
1830
|
-
if (node2.type === "atrule") {
|
|
1831
|
-
Object.setPrototypeOf(node2, AtRule$4.prototype);
|
|
1832
|
-
} else if (node2.type === "rule") {
|
|
1833
|
-
Object.setPrototypeOf(node2, Rule$4.prototype);
|
|
1834
|
-
} else if (node2.type === "decl") {
|
|
1835
|
-
Object.setPrototypeOf(node2, Declaration$3.prototype);
|
|
1836
|
-
} else if (node2.type === "comment") {
|
|
1837
|
-
Object.setPrototypeOf(node2, Comment$3.prototype);
|
|
1838
|
-
} else if (node2.type === "root") {
|
|
1839
|
-
Object.setPrototypeOf(node2, Root$6.prototype);
|
|
1840
|
-
}
|
|
1841
|
-
node2[my$1] = true;
|
|
1842
|
-
if (node2.nodes) {
|
|
1843
|
-
node2.nodes.forEach((child) => {
|
|
1844
|
-
Container$7.rebuild(child);
|
|
1845
|
-
});
|
|
1975
|
+
if (this.previous().length) {
|
|
1976
|
+
return this.previous().some((i) => i.annotation);
|
|
1977
|
+
}
|
|
1978
|
+
return true;
|
|
1846
1979
|
}
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1980
|
+
isInline() {
|
|
1981
|
+
if (typeof this.mapOpts.inline !== "undefined") {
|
|
1982
|
+
return this.mapOpts.inline;
|
|
1983
|
+
}
|
|
1984
|
+
let annotation = this.mapOpts.annotation;
|
|
1985
|
+
if (typeof annotation !== "undefined" && annotation !== true) {
|
|
1986
|
+
return false;
|
|
1987
|
+
}
|
|
1988
|
+
if (this.previous().length) {
|
|
1989
|
+
return this.previous().some((i) => i.inline);
|
|
1855
1990
|
}
|
|
1991
|
+
return true;
|
|
1856
1992
|
}
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1993
|
+
isMap() {
|
|
1994
|
+
if (typeof this.opts.map !== "undefined") {
|
|
1995
|
+
return !!this.opts.map;
|
|
1996
|
+
}
|
|
1997
|
+
return this.previous().length > 0;
|
|
1860
1998
|
}
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
}
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
}
|
|
1868
|
-
|
|
1869
|
-
Document$3.default = Document$3;
|
|
1870
|
-
let printed = {};
|
|
1871
|
-
var warnOnce$2 = function warnOnce(message) {
|
|
1872
|
-
if (printed[message]) return;
|
|
1873
|
-
printed[message] = true;
|
|
1874
|
-
if (typeof console !== "undefined" && console.warn) {
|
|
1875
|
-
console.warn(message);
|
|
1999
|
+
isSourcesContent() {
|
|
2000
|
+
if (typeof this.mapOpts.sourcesContent !== "undefined") {
|
|
2001
|
+
return this.mapOpts.sourcesContent;
|
|
2002
|
+
}
|
|
2003
|
+
if (this.previous().length) {
|
|
2004
|
+
return this.previous().some((i) => i.withContent());
|
|
2005
|
+
}
|
|
2006
|
+
return true;
|
|
1876
2007
|
}
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
this.
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
this.line = range.start.line;
|
|
1885
|
-
this.column = range.start.column;
|
|
1886
|
-
this.endLine = range.end.line;
|
|
1887
|
-
this.endColumn = range.end.column;
|
|
2008
|
+
outputFile() {
|
|
2009
|
+
if (this.opts.to) {
|
|
2010
|
+
return this.path(this.opts.to);
|
|
2011
|
+
} else if (this.opts.from) {
|
|
2012
|
+
return this.path(this.opts.from);
|
|
2013
|
+
} else {
|
|
2014
|
+
return "to.css";
|
|
1888
2015
|
}
|
|
1889
|
-
for (let opt in opts) this[opt] = opts[opt];
|
|
1890
2016
|
}
|
|
1891
|
-
|
|
1892
|
-
if (this.
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
2017
|
+
path(file) {
|
|
2018
|
+
if (this.mapOpts.absolute) return file;
|
|
2019
|
+
if (file.charCodeAt(0) === 60) return file;
|
|
2020
|
+
if (/^\w+:\/\//.test(file)) return file;
|
|
2021
|
+
let cached = this.memoizedPaths.get(file);
|
|
2022
|
+
if (cached) return cached;
|
|
2023
|
+
let from = this.opts.to ? dirname(this.opts.to) : ".";
|
|
2024
|
+
if (typeof this.mapOpts.annotation === "string") {
|
|
2025
|
+
from = dirname(resolve(from, this.mapOpts.annotation));
|
|
1898
2026
|
}
|
|
1899
|
-
|
|
1900
|
-
|
|
2027
|
+
let path = relative(from, file);
|
|
2028
|
+
this.memoizedPaths.set(file, path);
|
|
2029
|
+
return path;
|
|
2030
|
+
}
|
|
2031
|
+
previous() {
|
|
2032
|
+
if (!this.previousMaps) {
|
|
2033
|
+
this.previousMaps = [];
|
|
2034
|
+
if (this.root) {
|
|
2035
|
+
this.root.walk((node2) => {
|
|
2036
|
+
if (node2.source && node2.source.input.map) {
|
|
2037
|
+
let map = node2.source.input.map;
|
|
2038
|
+
if (!this.previousMaps.includes(map)) {
|
|
2039
|
+
this.previousMaps.push(map);
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
2042
|
+
});
|
|
2043
|
+
} else {
|
|
2044
|
+
let input2 = new Input$4(this.originalCSS, this.opts);
|
|
2045
|
+
if (input2.map) this.previousMaps.push(input2.map);
|
|
2046
|
+
}
|
|
1901
2047
|
}
|
|
1902
|
-
return this.
|
|
2048
|
+
return this.previousMaps;
|
|
1903
2049
|
}
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
2050
|
+
setSourcesContent() {
|
|
2051
|
+
let already = {};
|
|
2052
|
+
if (this.root) {
|
|
2053
|
+
this.root.walk((node2) => {
|
|
2054
|
+
if (node2.source) {
|
|
2055
|
+
let from = node2.source.input.from;
|
|
2056
|
+
if (from && !already[from]) {
|
|
2057
|
+
already[from] = true;
|
|
2058
|
+
let fromUrl = this.usesFileUrls ? this.toFileUrl(from) : this.toUrl(this.path(from));
|
|
2059
|
+
this.map.setSourceContent(fromUrl, node2.source.input.css);
|
|
2060
|
+
}
|
|
2061
|
+
}
|
|
2062
|
+
});
|
|
2063
|
+
} else if (this.css) {
|
|
2064
|
+
let from = this.opts.from ? this.toUrl(this.path(this.opts.from)) : "<no source>";
|
|
2065
|
+
this.map.setSourceContent(from, this.css);
|
|
2066
|
+
}
|
|
1916
2067
|
}
|
|
1917
|
-
|
|
1918
|
-
|
|
2068
|
+
sourcePath(node2) {
|
|
2069
|
+
if (this.mapOpts.from) {
|
|
2070
|
+
return this.toUrl(this.mapOpts.from);
|
|
2071
|
+
} else if (this.usesFileUrls) {
|
|
2072
|
+
return this.toFileUrl(node2.source.input.from);
|
|
2073
|
+
} else {
|
|
2074
|
+
return this.toUrl(this.path(node2.source.input.from));
|
|
2075
|
+
}
|
|
1919
2076
|
}
|
|
1920
|
-
|
|
1921
|
-
if (
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
2077
|
+
toBase64(str) {
|
|
2078
|
+
if (Buffer) {
|
|
2079
|
+
return Buffer.from(str).toString("base64");
|
|
2080
|
+
} else {
|
|
2081
|
+
return window.btoa(unescape(encodeURIComponent(str)));
|
|
1925
2082
|
}
|
|
1926
|
-
let warning2 = new Warning$1(text, opts);
|
|
1927
|
-
this.messages.push(warning2);
|
|
1928
|
-
return warning2;
|
|
1929
2083
|
}
|
|
1930
|
-
|
|
1931
|
-
|
|
2084
|
+
toFileUrl(path) {
|
|
2085
|
+
let cached = this.memoizedFileURLs.get(path);
|
|
2086
|
+
if (cached) return cached;
|
|
2087
|
+
if (pathToFileURL) {
|
|
2088
|
+
let fileURL = pathToFileURL(path).toString();
|
|
2089
|
+
this.memoizedFileURLs.set(path, fileURL);
|
|
2090
|
+
return fileURL;
|
|
2091
|
+
} else {
|
|
2092
|
+
throw new Error(
|
|
2093
|
+
"`map.absolute` option is not available in this PostCSS build"
|
|
2094
|
+
);
|
|
2095
|
+
}
|
|
1932
2096
|
}
|
|
1933
|
-
|
|
1934
|
-
|
|
2097
|
+
toUrl(path) {
|
|
2098
|
+
let cached = this.memoizedURLs.get(path);
|
|
2099
|
+
if (cached) return cached;
|
|
2100
|
+
if (sep === "\\") {
|
|
2101
|
+
path = path.replace(/\\/g, "/");
|
|
2102
|
+
}
|
|
2103
|
+
let url = encodeURI(path).replace(/[#?]/g, encodeURIComponent);
|
|
2104
|
+
this.memoizedURLs.set(path, url);
|
|
2105
|
+
return url;
|
|
1935
2106
|
}
|
|
1936
2107
|
};
|
|
1937
|
-
var
|
|
1938
|
-
Result$3.default = Result$3;
|
|
2108
|
+
var mapGenerator = MapGenerator$2;
|
|
1939
2109
|
const SINGLE_QUOTE = "'".charCodeAt(0);
|
|
1940
2110
|
const DOUBLE_QUOTE = '"'.charCodeAt(0);
|
|
1941
2111
|
const BACKSLASH = "\\".charCodeAt(0);
|
|
@@ -1962,8 +2132,8 @@ const RE_HEX_ESCAPE = /[\da-f]/i;
|
|
|
1962
2132
|
var tokenize = function tokenizer(input2, options = {}) {
|
|
1963
2133
|
let css = input2.css.valueOf();
|
|
1964
2134
|
let ignore = options.ignoreErrors;
|
|
1965
|
-
let code,
|
|
1966
|
-
let escaped, escapePos,
|
|
2135
|
+
let code, content, escape, next, quote;
|
|
2136
|
+
let currentToken, escaped, escapePos, n, prev;
|
|
1967
2137
|
let length = css.length;
|
|
1968
2138
|
let pos = 0;
|
|
1969
2139
|
let buffer = [];
|
|
@@ -2144,145 +2314,12 @@ var tokenize = function tokenizer(input2, options = {}) {
|
|
|
2144
2314
|
position
|
|
2145
2315
|
};
|
|
2146
2316
|
};
|
|
2147
|
-
let
|
|
2148
|
-
let
|
|
2149
|
-
constructor(defaults) {
|
|
2150
|
-
super(defaults);
|
|
2151
|
-
this.type = "atrule";
|
|
2152
|
-
}
|
|
2153
|
-
append(...children) {
|
|
2154
|
-
if (!this.proxyOf.nodes) this.nodes = [];
|
|
2155
|
-
return super.append(...children);
|
|
2156
|
-
}
|
|
2157
|
-
prepend(...children) {
|
|
2158
|
-
if (!this.proxyOf.nodes) this.nodes = [];
|
|
2159
|
-
return super.prepend(...children);
|
|
2160
|
-
}
|
|
2161
|
-
};
|
|
2162
|
-
var atRule = AtRule$3;
|
|
2163
|
-
AtRule$3.default = AtRule$3;
|
|
2164
|
-
Container$5.registerAtRule(AtRule$3);
|
|
2165
|
-
let Container$4 = container;
|
|
2166
|
-
let LazyResult$3, Processor$2;
|
|
2167
|
-
let Root$5 = class Root extends Container$4 {
|
|
2168
|
-
constructor(defaults) {
|
|
2169
|
-
super(defaults);
|
|
2170
|
-
this.type = "root";
|
|
2171
|
-
if (!this.nodes) this.nodes = [];
|
|
2172
|
-
}
|
|
2173
|
-
normalize(child, sample, type) {
|
|
2174
|
-
let nodes = super.normalize(child);
|
|
2175
|
-
if (sample) {
|
|
2176
|
-
if (type === "prepend") {
|
|
2177
|
-
if (this.nodes.length > 1) {
|
|
2178
|
-
sample.raws.before = this.nodes[1].raws.before;
|
|
2179
|
-
} else {
|
|
2180
|
-
delete sample.raws.before;
|
|
2181
|
-
}
|
|
2182
|
-
} else if (this.first !== sample) {
|
|
2183
|
-
for (let node2 of nodes) {
|
|
2184
|
-
node2.raws.before = sample.raws.before;
|
|
2185
|
-
}
|
|
2186
|
-
}
|
|
2187
|
-
}
|
|
2188
|
-
return nodes;
|
|
2189
|
-
}
|
|
2190
|
-
removeChild(child, ignore) {
|
|
2191
|
-
let index2 = this.index(child);
|
|
2192
|
-
if (!ignore && index2 === 0 && this.nodes.length > 1) {
|
|
2193
|
-
this.nodes[1].raws.before = this.nodes[index2].raws.before;
|
|
2194
|
-
}
|
|
2195
|
-
return super.removeChild(child);
|
|
2196
|
-
}
|
|
2197
|
-
toResult(opts = {}) {
|
|
2198
|
-
let lazy = new LazyResult$3(new Processor$2(), this, opts);
|
|
2199
|
-
return lazy.stringify();
|
|
2200
|
-
}
|
|
2201
|
-
};
|
|
2202
|
-
Root$5.registerLazyResult = (dependant) => {
|
|
2203
|
-
LazyResult$3 = dependant;
|
|
2204
|
-
};
|
|
2205
|
-
Root$5.registerProcessor = (dependant) => {
|
|
2206
|
-
Processor$2 = dependant;
|
|
2207
|
-
};
|
|
2208
|
-
var root = Root$5;
|
|
2209
|
-
Root$5.default = Root$5;
|
|
2210
|
-
Container$4.registerRoot(Root$5);
|
|
2211
|
-
let list$2 = {
|
|
2212
|
-
comma(string) {
|
|
2213
|
-
return list$2.split(string, [","], true);
|
|
2214
|
-
},
|
|
2215
|
-
space(string) {
|
|
2216
|
-
let spaces = [" ", "\n", " "];
|
|
2217
|
-
return list$2.split(string, spaces);
|
|
2218
|
-
},
|
|
2219
|
-
split(string, separators, last) {
|
|
2220
|
-
let array = [];
|
|
2221
|
-
let current = "";
|
|
2222
|
-
let split = false;
|
|
2223
|
-
let func = 0;
|
|
2224
|
-
let inQuote = false;
|
|
2225
|
-
let prevQuote = "";
|
|
2226
|
-
let escape = false;
|
|
2227
|
-
for (let letter of string) {
|
|
2228
|
-
if (escape) {
|
|
2229
|
-
escape = false;
|
|
2230
|
-
} else if (letter === "\\") {
|
|
2231
|
-
escape = true;
|
|
2232
|
-
} else if (inQuote) {
|
|
2233
|
-
if (letter === prevQuote) {
|
|
2234
|
-
inQuote = false;
|
|
2235
|
-
}
|
|
2236
|
-
} else if (letter === '"' || letter === "'") {
|
|
2237
|
-
inQuote = true;
|
|
2238
|
-
prevQuote = letter;
|
|
2239
|
-
} else if (letter === "(") {
|
|
2240
|
-
func += 1;
|
|
2241
|
-
} else if (letter === ")") {
|
|
2242
|
-
if (func > 0) func -= 1;
|
|
2243
|
-
} else if (func === 0) {
|
|
2244
|
-
if (separators.includes(letter)) split = true;
|
|
2245
|
-
}
|
|
2246
|
-
if (split) {
|
|
2247
|
-
if (current !== "") array.push(current.trim());
|
|
2248
|
-
current = "";
|
|
2249
|
-
split = false;
|
|
2250
|
-
} else {
|
|
2251
|
-
current += letter;
|
|
2252
|
-
}
|
|
2253
|
-
}
|
|
2254
|
-
if (last || current !== "") array.push(current.trim());
|
|
2255
|
-
return array;
|
|
2256
|
-
}
|
|
2257
|
-
};
|
|
2258
|
-
var list_1 = list$2;
|
|
2259
|
-
list$2.default = list$2;
|
|
2260
|
-
let Container$3 = container;
|
|
2261
|
-
let list$1 = list_1;
|
|
2262
|
-
let Rule$3 = class Rule extends Container$3 {
|
|
2263
|
-
constructor(defaults) {
|
|
2264
|
-
super(defaults);
|
|
2265
|
-
this.type = "rule";
|
|
2266
|
-
if (!this.nodes) this.nodes = [];
|
|
2267
|
-
}
|
|
2268
|
-
get selectors() {
|
|
2269
|
-
return list$1.comma(this.selector);
|
|
2270
|
-
}
|
|
2271
|
-
set selectors(values) {
|
|
2272
|
-
let match = this.selector ? this.selector.match(/,\s*/) : null;
|
|
2273
|
-
let sep2 = match ? match[0] : "," + this.raw("between", "beforeOpen");
|
|
2274
|
-
this.selector = values.join(sep2);
|
|
2275
|
-
}
|
|
2276
|
-
};
|
|
2277
|
-
var rule = Rule$3;
|
|
2278
|
-
Rule$3.default = Rule$3;
|
|
2279
|
-
Container$3.registerRule(Rule$3);
|
|
2317
|
+
let AtRule$2 = atRule$1;
|
|
2318
|
+
let Comment$3 = comment$1;
|
|
2280
2319
|
let Declaration$2 = declaration;
|
|
2281
|
-
let
|
|
2282
|
-
let
|
|
2283
|
-
let
|
|
2284
|
-
let Root$4 = root;
|
|
2285
|
-
let Rule$2 = rule;
|
|
2320
|
+
let Root$4 = root$1;
|
|
2321
|
+
let Rule$2 = rule$1;
|
|
2322
|
+
let tokenizer$1 = tokenize;
|
|
2286
2323
|
const SAFE_COMMENT_NEIGHBOR = {
|
|
2287
2324
|
empty: true,
|
|
2288
2325
|
space: true
|
|
@@ -2294,7 +2331,7 @@ function findLastWithPosition(tokens) {
|
|
|
2294
2331
|
if (pos) return pos;
|
|
2295
2332
|
}
|
|
2296
2333
|
}
|
|
2297
|
-
let Parser$
|
|
2334
|
+
let Parser$2 = class Parser {
|
|
2298
2335
|
constructor(input2) {
|
|
2299
2336
|
this.input = input2;
|
|
2300
2337
|
this.root = new Root$4();
|
|
@@ -2401,7 +2438,7 @@ let Parser$1 = class Parser {
|
|
|
2401
2438
|
}
|
|
2402
2439
|
colon(tokens) {
|
|
2403
2440
|
let brackets = 0;
|
|
2404
|
-
let token, type
|
|
2441
|
+
let prev, token, type;
|
|
2405
2442
|
for (let [i, element] of tokens.entries()) {
|
|
2406
2443
|
token = element;
|
|
2407
2444
|
type = token[0];
|
|
@@ -2425,7 +2462,7 @@ let Parser$1 = class Parser {
|
|
|
2425
2462
|
return false;
|
|
2426
2463
|
}
|
|
2427
2464
|
comment(token) {
|
|
2428
|
-
let node2 = new Comment$
|
|
2465
|
+
let node2 = new Comment$3();
|
|
2429
2466
|
this.init(node2, token[2]);
|
|
2430
2467
|
node2.source.end = this.getPosition(token[3] || token[2]);
|
|
2431
2468
|
node2.source.end.offset++;
|
|
@@ -2442,7 +2479,7 @@ let Parser$1 = class Parser {
|
|
|
2442
2479
|
}
|
|
2443
2480
|
}
|
|
2444
2481
|
createTokenizer() {
|
|
2445
|
-
this.tokenizer =
|
|
2482
|
+
this.tokenizer = tokenizer$1(this.input);
|
|
2446
2483
|
}
|
|
2447
2484
|
decl(tokens, customProperty) {
|
|
2448
2485
|
let node2 = new Declaration$2();
|
|
@@ -2508,12 +2545,12 @@ let Parser$1 = class Parser {
|
|
|
2508
2545
|
let str = "";
|
|
2509
2546
|
for (let j = i; j > 0; j--) {
|
|
2510
2547
|
let type = cache[j][0];
|
|
2511
|
-
if (str.trim().
|
|
2548
|
+
if (str.trim().startsWith("!") && type !== "space") {
|
|
2512
2549
|
break;
|
|
2513
2550
|
}
|
|
2514
2551
|
str = cache.pop()[1] + str;
|
|
2515
2552
|
}
|
|
2516
|
-
if (str.trim().
|
|
2553
|
+
if (str.trim().startsWith("!")) {
|
|
2517
2554
|
node2.important = true;
|
|
2518
2555
|
node2.raws.important = str;
|
|
2519
2556
|
tokens = cache;
|
|
@@ -2801,13 +2838,13 @@ let Parser$1 = class Parser {
|
|
|
2801
2838
|
);
|
|
2802
2839
|
}
|
|
2803
2840
|
};
|
|
2804
|
-
var parser = Parser$
|
|
2805
|
-
let Container$
|
|
2806
|
-
let
|
|
2807
|
-
let
|
|
2808
|
-
function parse$
|
|
2809
|
-
let input2 = new Input$
|
|
2810
|
-
let parser2 = new
|
|
2841
|
+
var parser = Parser$2;
|
|
2842
|
+
let Container$3 = container;
|
|
2843
|
+
let Input$3 = input;
|
|
2844
|
+
let Parser$1 = parser;
|
|
2845
|
+
function parse$4(css, opts) {
|
|
2846
|
+
let input2 = new Input$3(css, opts);
|
|
2847
|
+
let parser2 = new Parser$1(input2);
|
|
2811
2848
|
try {
|
|
2812
2849
|
parser2.parse();
|
|
2813
2850
|
} catch (e) {
|
|
@@ -2826,18 +2863,87 @@ function parse$3(css, opts) {
|
|
|
2826
2863
|
}
|
|
2827
2864
|
return parser2.root;
|
|
2828
2865
|
}
|
|
2829
|
-
var parse_1 = parse$
|
|
2830
|
-
parse$
|
|
2831
|
-
Container$
|
|
2832
|
-
let
|
|
2866
|
+
var parse_1 = parse$4;
|
|
2867
|
+
parse$4.default = parse$4;
|
|
2868
|
+
Container$3.registerParse(parse$4);
|
|
2869
|
+
let Warning$3 = class Warning {
|
|
2870
|
+
constructor(text, opts = {}) {
|
|
2871
|
+
this.type = "warning";
|
|
2872
|
+
this.text = text;
|
|
2873
|
+
if (opts.node && opts.node.source) {
|
|
2874
|
+
let range = opts.node.rangeBy(opts);
|
|
2875
|
+
this.line = range.start.line;
|
|
2876
|
+
this.column = range.start.column;
|
|
2877
|
+
this.endLine = range.end.line;
|
|
2878
|
+
this.endColumn = range.end.column;
|
|
2879
|
+
}
|
|
2880
|
+
for (let opt in opts) this[opt] = opts[opt];
|
|
2881
|
+
}
|
|
2882
|
+
toString() {
|
|
2883
|
+
if (this.node) {
|
|
2884
|
+
return this.node.error(this.text, {
|
|
2885
|
+
index: this.index,
|
|
2886
|
+
plugin: this.plugin,
|
|
2887
|
+
word: this.word
|
|
2888
|
+
}).message;
|
|
2889
|
+
}
|
|
2890
|
+
if (this.plugin) {
|
|
2891
|
+
return this.plugin + ": " + this.text;
|
|
2892
|
+
}
|
|
2893
|
+
return this.text;
|
|
2894
|
+
}
|
|
2895
|
+
};
|
|
2896
|
+
var warning = Warning$3;
|
|
2897
|
+
Warning$3.default = Warning$3;
|
|
2898
|
+
let Warning$2 = warning;
|
|
2899
|
+
let Result$4 = class Result {
|
|
2900
|
+
constructor(processor2, root2, opts) {
|
|
2901
|
+
this.processor = processor2;
|
|
2902
|
+
this.messages = [];
|
|
2903
|
+
this.root = root2;
|
|
2904
|
+
this.opts = opts;
|
|
2905
|
+
this.css = void 0;
|
|
2906
|
+
this.map = void 0;
|
|
2907
|
+
}
|
|
2908
|
+
toString() {
|
|
2909
|
+
return this.css;
|
|
2910
|
+
}
|
|
2911
|
+
warn(text, opts = {}) {
|
|
2912
|
+
if (!opts.plugin) {
|
|
2913
|
+
if (this.lastPlugin && this.lastPlugin.postcssPlugin) {
|
|
2914
|
+
opts.plugin = this.lastPlugin.postcssPlugin;
|
|
2915
|
+
}
|
|
2916
|
+
}
|
|
2917
|
+
let warning2 = new Warning$2(text, opts);
|
|
2918
|
+
this.messages.push(warning2);
|
|
2919
|
+
return warning2;
|
|
2920
|
+
}
|
|
2921
|
+
warnings() {
|
|
2922
|
+
return this.messages.filter((i) => i.type === "warning");
|
|
2923
|
+
}
|
|
2924
|
+
get content() {
|
|
2925
|
+
return this.css;
|
|
2926
|
+
}
|
|
2927
|
+
};
|
|
2928
|
+
var result = Result$4;
|
|
2929
|
+
Result$4.default = Result$4;
|
|
2930
|
+
let printed = {};
|
|
2931
|
+
var warnOnce$2 = function warnOnce(message) {
|
|
2932
|
+
if (printed[message]) return;
|
|
2933
|
+
printed[message] = true;
|
|
2934
|
+
if (typeof console !== "undefined" && console.warn) {
|
|
2935
|
+
console.warn(message);
|
|
2936
|
+
}
|
|
2937
|
+
};
|
|
2938
|
+
let Container$2 = container;
|
|
2939
|
+
let Document$3 = document$2;
|
|
2833
2940
|
let MapGenerator$1 = mapGenerator;
|
|
2834
|
-
let
|
|
2835
|
-
let
|
|
2836
|
-
let
|
|
2941
|
+
let parse$3 = parse_1;
|
|
2942
|
+
let Result$3 = result;
|
|
2943
|
+
let Root$3 = root$1;
|
|
2944
|
+
let stringify$3 = stringify_1;
|
|
2945
|
+
let { isClean, my } = symbols;
|
|
2837
2946
|
let warnOnce$1 = warnOnce$2;
|
|
2838
|
-
let Result$2 = result;
|
|
2839
|
-
let parse$2 = parse_1;
|
|
2840
|
-
let Root$3 = root;
|
|
2841
2947
|
const TYPE_TO_CLASS_NAME = {
|
|
2842
2948
|
atrule: "AtRule",
|
|
2843
2949
|
comment: "Comment",
|
|
@@ -2920,7 +3026,7 @@ function cleanMarks(node2) {
|
|
|
2920
3026
|
if (node2.nodes) node2.nodes.forEach((i) => cleanMarks(i));
|
|
2921
3027
|
return node2;
|
|
2922
3028
|
}
|
|
2923
|
-
let postcss$
|
|
3029
|
+
let postcss$3 = {};
|
|
2924
3030
|
let LazyResult$2 = class LazyResult {
|
|
2925
3031
|
constructor(processor2, css, opts) {
|
|
2926
3032
|
this.stringified = false;
|
|
@@ -2928,7 +3034,7 @@ let LazyResult$2 = class LazyResult {
|
|
|
2928
3034
|
let root2;
|
|
2929
3035
|
if (typeof css === "object" && css !== null && (css.type === "root" || css.type === "document")) {
|
|
2930
3036
|
root2 = cleanMarks(css);
|
|
2931
|
-
} else if (css instanceof LazyResult || css instanceof Result$
|
|
3037
|
+
} else if (css instanceof LazyResult || css instanceof Result$3) {
|
|
2932
3038
|
root2 = cleanMarks(css.root);
|
|
2933
3039
|
if (css.map) {
|
|
2934
3040
|
if (typeof opts.map === "undefined") opts.map = {};
|
|
@@ -2936,7 +3042,7 @@ let LazyResult$2 = class LazyResult {
|
|
|
2936
3042
|
opts.map.prev = css.map;
|
|
2937
3043
|
}
|
|
2938
3044
|
} else {
|
|
2939
|
-
let parser2 = parse$
|
|
3045
|
+
let parser2 = parse$3;
|
|
2940
3046
|
if (opts.syntax) parser2 = opts.syntax.parse;
|
|
2941
3047
|
if (opts.parser) parser2 = opts.parser;
|
|
2942
3048
|
if (parser2.parse) parser2 = parser2.parse;
|
|
@@ -2947,16 +3053,16 @@ let LazyResult$2 = class LazyResult {
|
|
|
2947
3053
|
this.error = error;
|
|
2948
3054
|
}
|
|
2949
3055
|
if (root2 && !root2[my]) {
|
|
2950
|
-
Container$
|
|
3056
|
+
Container$2.rebuild(root2);
|
|
2951
3057
|
}
|
|
2952
3058
|
}
|
|
2953
|
-
this.result = new Result$
|
|
2954
|
-
this.helpers = { ...postcss$
|
|
2955
|
-
this.plugins = this.processor.plugins.map((
|
|
2956
|
-
if (typeof
|
|
2957
|
-
return { ...
|
|
3059
|
+
this.result = new Result$3(processor2, root2, opts);
|
|
3060
|
+
this.helpers = { ...postcss$3, postcss: postcss$3, result: this.result };
|
|
3061
|
+
this.plugins = this.processor.plugins.map((plugin3) => {
|
|
3062
|
+
if (typeof plugin3 === "object" && plugin3.prepare) {
|
|
3063
|
+
return { ...plugin3, ...plugin3.prepare(this.result) };
|
|
2958
3064
|
} else {
|
|
2959
|
-
return
|
|
3065
|
+
return plugin3;
|
|
2960
3066
|
}
|
|
2961
3067
|
});
|
|
2962
3068
|
}
|
|
@@ -2978,17 +3084,17 @@ let LazyResult$2 = class LazyResult {
|
|
|
2978
3084
|
throw new Error("Use process(css).then(cb) to work with async plugins");
|
|
2979
3085
|
}
|
|
2980
3086
|
handleError(error, node2) {
|
|
2981
|
-
let
|
|
3087
|
+
let plugin3 = this.result.lastPlugin;
|
|
2982
3088
|
try {
|
|
2983
3089
|
if (node2) node2.addToError(error);
|
|
2984
3090
|
this.error = error;
|
|
2985
3091
|
if (error.name === "CssSyntaxError" && !error.plugin) {
|
|
2986
|
-
error.plugin =
|
|
3092
|
+
error.plugin = plugin3.postcssPlugin;
|
|
2987
3093
|
error.setMessage();
|
|
2988
|
-
} else if (
|
|
3094
|
+
} else if (plugin3.postcssVersion) {
|
|
2989
3095
|
if (process.env.NODE_ENV !== "production") {
|
|
2990
|
-
let pluginName =
|
|
2991
|
-
let pluginVer =
|
|
3096
|
+
let pluginName = plugin3.postcssPlugin;
|
|
3097
|
+
let pluginVer = plugin3.postcssVersion;
|
|
2992
3098
|
let runtimeVer = this.result.processor.version;
|
|
2993
3099
|
let a = pluginVer.split(".");
|
|
2994
3100
|
let b = runtimeVer.split(".");
|
|
@@ -3006,33 +3112,33 @@ let LazyResult$2 = class LazyResult {
|
|
|
3006
3112
|
}
|
|
3007
3113
|
prepareVisitors() {
|
|
3008
3114
|
this.listeners = {};
|
|
3009
|
-
let add = (
|
|
3115
|
+
let add = (plugin3, type, cb) => {
|
|
3010
3116
|
if (!this.listeners[type]) this.listeners[type] = [];
|
|
3011
|
-
this.listeners[type].push([
|
|
3117
|
+
this.listeners[type].push([plugin3, cb]);
|
|
3012
3118
|
};
|
|
3013
|
-
for (let
|
|
3014
|
-
if (typeof
|
|
3015
|
-
for (let event in
|
|
3119
|
+
for (let plugin3 of this.plugins) {
|
|
3120
|
+
if (typeof plugin3 === "object") {
|
|
3121
|
+
for (let event in plugin3) {
|
|
3016
3122
|
if (!PLUGIN_PROPS[event] && /^[A-Z]/.test(event)) {
|
|
3017
3123
|
throw new Error(
|
|
3018
|
-
`Unknown event ${event} in ${
|
|
3124
|
+
`Unknown event ${event} in ${plugin3.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`
|
|
3019
3125
|
);
|
|
3020
3126
|
}
|
|
3021
3127
|
if (!NOT_VISITORS[event]) {
|
|
3022
|
-
if (typeof
|
|
3023
|
-
for (let filter in
|
|
3128
|
+
if (typeof plugin3[event] === "object") {
|
|
3129
|
+
for (let filter in plugin3[event]) {
|
|
3024
3130
|
if (filter === "*") {
|
|
3025
|
-
add(
|
|
3131
|
+
add(plugin3, event, plugin3[event][filter]);
|
|
3026
3132
|
} else {
|
|
3027
3133
|
add(
|
|
3028
|
-
|
|
3134
|
+
plugin3,
|
|
3029
3135
|
event + "-" + filter.toLowerCase(),
|
|
3030
|
-
|
|
3136
|
+
plugin3[event][filter]
|
|
3031
3137
|
);
|
|
3032
3138
|
}
|
|
3033
3139
|
}
|
|
3034
|
-
} else if (typeof
|
|
3035
|
-
add(
|
|
3140
|
+
} else if (typeof plugin3[event] === "function") {
|
|
3141
|
+
add(plugin3, event, plugin3[event]);
|
|
3036
3142
|
}
|
|
3037
3143
|
}
|
|
3038
3144
|
}
|
|
@@ -3043,8 +3149,8 @@ let LazyResult$2 = class LazyResult {
|
|
|
3043
3149
|
async runAsync() {
|
|
3044
3150
|
this.plugin = 0;
|
|
3045
3151
|
for (let i = 0; i < this.plugins.length; i++) {
|
|
3046
|
-
let
|
|
3047
|
-
let promise = this.runOnRoot(
|
|
3152
|
+
let plugin3 = this.plugins[i];
|
|
3153
|
+
let promise = this.runOnRoot(plugin3);
|
|
3048
3154
|
if (isPromise(promise)) {
|
|
3049
3155
|
try {
|
|
3050
3156
|
await promise;
|
|
@@ -3072,8 +3178,8 @@ let LazyResult$2 = class LazyResult {
|
|
|
3072
3178
|
}
|
|
3073
3179
|
}
|
|
3074
3180
|
if (this.listeners.OnceExit) {
|
|
3075
|
-
for (let [
|
|
3076
|
-
this.result.lastPlugin =
|
|
3181
|
+
for (let [plugin3, visitor] of this.listeners.OnceExit) {
|
|
3182
|
+
this.result.lastPlugin = plugin3;
|
|
3077
3183
|
try {
|
|
3078
3184
|
if (root2.type === "document") {
|
|
3079
3185
|
let roots = root2.nodes.map(
|
|
@@ -3092,22 +3198,22 @@ let LazyResult$2 = class LazyResult {
|
|
|
3092
3198
|
this.processed = true;
|
|
3093
3199
|
return this.stringify();
|
|
3094
3200
|
}
|
|
3095
|
-
runOnRoot(
|
|
3096
|
-
this.result.lastPlugin =
|
|
3201
|
+
runOnRoot(plugin3) {
|
|
3202
|
+
this.result.lastPlugin = plugin3;
|
|
3097
3203
|
try {
|
|
3098
|
-
if (typeof
|
|
3204
|
+
if (typeof plugin3 === "object" && plugin3.Once) {
|
|
3099
3205
|
if (this.result.root.type === "document") {
|
|
3100
3206
|
let roots = this.result.root.nodes.map(
|
|
3101
|
-
(root2) =>
|
|
3207
|
+
(root2) => plugin3.Once(root2, this.helpers)
|
|
3102
3208
|
);
|
|
3103
3209
|
if (isPromise(roots[0])) {
|
|
3104
3210
|
return Promise.all(roots);
|
|
3105
3211
|
}
|
|
3106
3212
|
return roots;
|
|
3107
3213
|
}
|
|
3108
|
-
return
|
|
3109
|
-
} else if (typeof
|
|
3110
|
-
return
|
|
3214
|
+
return plugin3.Once(this.result.root, this.helpers);
|
|
3215
|
+
} else if (typeof plugin3 === "function") {
|
|
3216
|
+
return plugin3(this.result.root, this.result);
|
|
3111
3217
|
}
|
|
3112
3218
|
} catch (error) {
|
|
3113
3219
|
throw this.handleError(error);
|
|
@@ -3119,7 +3225,7 @@ let LazyResult$2 = class LazyResult {
|
|
|
3119
3225
|
this.stringified = true;
|
|
3120
3226
|
this.sync();
|
|
3121
3227
|
let opts = this.result.opts;
|
|
3122
|
-
let str = stringify$
|
|
3228
|
+
let str = stringify$3;
|
|
3123
3229
|
if (opts.syntax) str = opts.syntax.stringify;
|
|
3124
3230
|
if (opts.stringifier) str = opts.stringifier;
|
|
3125
3231
|
if (str.stringify) str = str.stringify;
|
|
@@ -3136,8 +3242,8 @@ let LazyResult$2 = class LazyResult {
|
|
|
3136
3242
|
if (this.processing) {
|
|
3137
3243
|
throw this.getAsyncError();
|
|
3138
3244
|
}
|
|
3139
|
-
for (let
|
|
3140
|
-
let promise = this.runOnRoot(
|
|
3245
|
+
for (let plugin3 of this.plugins) {
|
|
3246
|
+
let promise = this.runOnRoot(plugin3);
|
|
3141
3247
|
if (isPromise(promise)) {
|
|
3142
3248
|
throw this.getAsyncError();
|
|
3143
3249
|
}
|
|
@@ -3175,8 +3281,8 @@ let LazyResult$2 = class LazyResult {
|
|
|
3175
3281
|
return this.css;
|
|
3176
3282
|
}
|
|
3177
3283
|
visitSync(visitors, node2) {
|
|
3178
|
-
for (let [
|
|
3179
|
-
this.result.lastPlugin =
|
|
3284
|
+
for (let [plugin3, visitor] of visitors) {
|
|
3285
|
+
this.result.lastPlugin = plugin3;
|
|
3180
3286
|
let promise;
|
|
3181
3287
|
try {
|
|
3182
3288
|
promise = visitor(node2, this.helpers);
|
|
@@ -3199,13 +3305,13 @@ let LazyResult$2 = class LazyResult {
|
|
|
3199
3305
|
return;
|
|
3200
3306
|
}
|
|
3201
3307
|
if (visitors.length > 0 && visit2.visitorIndex < visitors.length) {
|
|
3202
|
-
let [
|
|
3308
|
+
let [plugin3, visitor] = visitors[visit2.visitorIndex];
|
|
3203
3309
|
visit2.visitorIndex += 1;
|
|
3204
3310
|
if (visit2.visitorIndex === visitors.length) {
|
|
3205
3311
|
visit2.visitors = [];
|
|
3206
3312
|
visit2.visitorIndex = 0;
|
|
3207
3313
|
}
|
|
3208
|
-
this.result.lastPlugin =
|
|
3314
|
+
this.result.lastPlugin = plugin3;
|
|
3209
3315
|
try {
|
|
3210
3316
|
return visitor(node2.toProxy(), this.helpers);
|
|
3211
3317
|
} catch (e) {
|
|
@@ -3290,17 +3396,17 @@ let LazyResult$2 = class LazyResult {
|
|
|
3290
3396
|
}
|
|
3291
3397
|
};
|
|
3292
3398
|
LazyResult$2.registerPostcss = (dependant) => {
|
|
3293
|
-
postcss$
|
|
3399
|
+
postcss$3 = dependant;
|
|
3294
3400
|
};
|
|
3295
3401
|
var lazyResult = LazyResult$2;
|
|
3296
3402
|
LazyResult$2.default = LazyResult$2;
|
|
3297
3403
|
Root$3.registerLazyResult(LazyResult$2);
|
|
3298
|
-
Document$
|
|
3404
|
+
Document$3.registerLazyResult(LazyResult$2);
|
|
3299
3405
|
let MapGenerator2 = mapGenerator;
|
|
3300
|
-
let
|
|
3406
|
+
let parse$2 = parse_1;
|
|
3407
|
+
const Result$2 = result;
|
|
3408
|
+
let stringify$2 = stringify_1;
|
|
3301
3409
|
let warnOnce2 = warnOnce$2;
|
|
3302
|
-
let parse$1 = parse_1;
|
|
3303
|
-
const Result$1 = result;
|
|
3304
3410
|
let NoWorkResult$1 = class NoWorkResult {
|
|
3305
3411
|
constructor(processor2, css, opts) {
|
|
3306
3412
|
css = css.toString();
|
|
@@ -3310,8 +3416,8 @@ let NoWorkResult$1 = class NoWorkResult {
|
|
|
3310
3416
|
this._opts = opts;
|
|
3311
3417
|
this._map = void 0;
|
|
3312
3418
|
let root2;
|
|
3313
|
-
let str = stringify$
|
|
3314
|
-
this.result = new Result$
|
|
3419
|
+
let str = stringify$2;
|
|
3420
|
+
this.result = new Result$2(this._processor, root2, this._opts);
|
|
3315
3421
|
this.result.css = css;
|
|
3316
3422
|
let self = this;
|
|
3317
3423
|
Object.defineProperty(this.result, "root", {
|
|
@@ -3386,7 +3492,7 @@ let NoWorkResult$1 = class NoWorkResult {
|
|
|
3386
3492
|
return this._root;
|
|
3387
3493
|
}
|
|
3388
3494
|
let root2;
|
|
3389
|
-
let parser2 = parse$
|
|
3495
|
+
let parser2 = parse$2;
|
|
3390
3496
|
try {
|
|
3391
3497
|
root2 = parser2(this._css, this._opts);
|
|
3392
3498
|
} catch (error) {
|
|
@@ -3405,13 +3511,13 @@ let NoWorkResult$1 = class NoWorkResult {
|
|
|
3405
3511
|
};
|
|
3406
3512
|
var noWorkResult = NoWorkResult$1;
|
|
3407
3513
|
NoWorkResult$1.default = NoWorkResult$1;
|
|
3408
|
-
let
|
|
3514
|
+
let Document$2 = document$2;
|
|
3409
3515
|
let LazyResult$1 = lazyResult;
|
|
3410
|
-
let
|
|
3411
|
-
let Root$2 = root;
|
|
3412
|
-
let Processor$
|
|
3516
|
+
let NoWorkResult2 = noWorkResult;
|
|
3517
|
+
let Root$2 = root$1;
|
|
3518
|
+
let Processor$2 = class Processor {
|
|
3413
3519
|
constructor(plugins = []) {
|
|
3414
|
-
this.version = "8.
|
|
3520
|
+
this.version = "8.5.1";
|
|
3415
3521
|
this.plugins = this.normalize(plugins);
|
|
3416
3522
|
}
|
|
3417
3523
|
normalize(plugins) {
|
|
@@ -3447,89 +3553,40 @@ let Processor$1 = class Processor {
|
|
|
3447
3553
|
return new LazyResult$1(this, css, opts);
|
|
3448
3554
|
}
|
|
3449
3555
|
}
|
|
3450
|
-
use(
|
|
3451
|
-
this.plugins = this.plugins.concat(this.normalize([
|
|
3556
|
+
use(plugin3) {
|
|
3557
|
+
this.plugins = this.plugins.concat(this.normalize([plugin3]));
|
|
3452
3558
|
return this;
|
|
3453
3559
|
}
|
|
3454
3560
|
};
|
|
3455
|
-
var processor = Processor$
|
|
3456
|
-
Processor$
|
|
3457
|
-
Root$2.registerProcessor(Processor$
|
|
3458
|
-
Document$
|
|
3561
|
+
var processor = Processor$2;
|
|
3562
|
+
Processor$2.default = Processor$2;
|
|
3563
|
+
Root$2.registerProcessor(Processor$2);
|
|
3564
|
+
Document$2.registerProcessor(Processor$2);
|
|
3565
|
+
let AtRule$1 = atRule$1;
|
|
3566
|
+
let Comment$2 = comment$1;
|
|
3567
|
+
let Container$1 = container;
|
|
3568
|
+
let CssSyntaxError$1 = cssSyntaxError;
|
|
3459
3569
|
let Declaration$1 = declaration;
|
|
3460
|
-
let
|
|
3461
|
-
let
|
|
3462
|
-
let
|
|
3463
|
-
let Input$1 = input;
|
|
3464
|
-
let Root$1 = root;
|
|
3465
|
-
let Rule$1 = rule;
|
|
3466
|
-
function fromJSON$1(json, inputs) {
|
|
3467
|
-
if (Array.isArray(json)) return json.map((n) => fromJSON$1(n));
|
|
3468
|
-
let { inputs: ownInputs, ...defaults } = json;
|
|
3469
|
-
if (ownInputs) {
|
|
3470
|
-
inputs = [];
|
|
3471
|
-
for (let input2 of ownInputs) {
|
|
3472
|
-
let inputHydrated = { ...input2, __proto__: Input$1.prototype };
|
|
3473
|
-
if (inputHydrated.map) {
|
|
3474
|
-
inputHydrated.map = {
|
|
3475
|
-
...inputHydrated.map,
|
|
3476
|
-
__proto__: PreviousMap2.prototype
|
|
3477
|
-
};
|
|
3478
|
-
}
|
|
3479
|
-
inputs.push(inputHydrated);
|
|
3480
|
-
}
|
|
3481
|
-
}
|
|
3482
|
-
if (defaults.nodes) {
|
|
3483
|
-
defaults.nodes = json.nodes.map((n) => fromJSON$1(n, inputs));
|
|
3484
|
-
}
|
|
3485
|
-
if (defaults.source) {
|
|
3486
|
-
let { inputId, ...source } = defaults.source;
|
|
3487
|
-
defaults.source = source;
|
|
3488
|
-
if (inputId != null) {
|
|
3489
|
-
defaults.source.input = inputs[inputId];
|
|
3490
|
-
}
|
|
3491
|
-
}
|
|
3492
|
-
if (defaults.type === "root") {
|
|
3493
|
-
return new Root$1(defaults);
|
|
3494
|
-
} else if (defaults.type === "decl") {
|
|
3495
|
-
return new Declaration$1(defaults);
|
|
3496
|
-
} else if (defaults.type === "rule") {
|
|
3497
|
-
return new Rule$1(defaults);
|
|
3498
|
-
} else if (defaults.type === "comment") {
|
|
3499
|
-
return new Comment$1(defaults);
|
|
3500
|
-
} else if (defaults.type === "atrule") {
|
|
3501
|
-
return new AtRule$1(defaults);
|
|
3502
|
-
} else {
|
|
3503
|
-
throw new Error("Unknown node type: " + json.type);
|
|
3504
|
-
}
|
|
3505
|
-
}
|
|
3506
|
-
var fromJSON_1 = fromJSON$1;
|
|
3507
|
-
fromJSON$1.default = fromJSON$1;
|
|
3508
|
-
let CssSyntaxError2 = cssSyntaxError;
|
|
3509
|
-
let Declaration2 = declaration;
|
|
3570
|
+
let Document$1 = document$2;
|
|
3571
|
+
let fromJSON$1 = fromJSON_1;
|
|
3572
|
+
let Input$2 = input;
|
|
3510
3573
|
let LazyResult2 = lazyResult;
|
|
3511
|
-
let
|
|
3512
|
-
let
|
|
3513
|
-
let
|
|
3514
|
-
let
|
|
3515
|
-
let
|
|
3516
|
-
let
|
|
3517
|
-
let
|
|
3518
|
-
let
|
|
3519
|
-
let
|
|
3520
|
-
|
|
3521
|
-
let parse = parse_1;
|
|
3522
|
-
let list = list_1;
|
|
3523
|
-
let Rule2 = rule;
|
|
3524
|
-
let Root2 = root;
|
|
3525
|
-
let Node2 = node;
|
|
3526
|
-
function postcss(...plugins) {
|
|
3574
|
+
let list$1 = list_1;
|
|
3575
|
+
let Node$1 = node;
|
|
3576
|
+
let parse$1 = parse_1;
|
|
3577
|
+
let Processor$1 = processor;
|
|
3578
|
+
let Result$1 = result;
|
|
3579
|
+
let Root$1 = root$1;
|
|
3580
|
+
let Rule$1 = rule$1;
|
|
3581
|
+
let stringify$1 = stringify_1;
|
|
3582
|
+
let Warning$1 = warning;
|
|
3583
|
+
function postcss$1(...plugins) {
|
|
3527
3584
|
if (plugins.length === 1 && Array.isArray(plugins[0])) {
|
|
3528
3585
|
plugins = plugins[0];
|
|
3529
3586
|
}
|
|
3530
|
-
return new
|
|
3587
|
+
return new Processor$1(plugins);
|
|
3531
3588
|
}
|
|
3532
|
-
postcss.plugin = function plugin(name, initializer) {
|
|
3589
|
+
postcss$1.plugin = function plugin(name, initializer) {
|
|
3533
3590
|
let warningPrinted = false;
|
|
3534
3591
|
function creator(...args) {
|
|
3535
3592
|
if (console && console.warn && !warningPrinted) {
|
|
@@ -3545,7 +3602,7 @@ postcss.plugin = function plugin(name, initializer) {
|
|
|
3545
3602
|
}
|
|
3546
3603
|
let transformer = initializer(...args);
|
|
3547
3604
|
transformer.postcssPlugin = name;
|
|
3548
|
-
transformer.postcssVersion = new
|
|
3605
|
+
transformer.postcssVersion = new Processor$1().version;
|
|
3549
3606
|
return transformer;
|
|
3550
3607
|
}
|
|
3551
3608
|
let cache;
|
|
@@ -3556,61 +3613,61 @@ postcss.plugin = function plugin(name, initializer) {
|
|
|
3556
3613
|
}
|
|
3557
3614
|
});
|
|
3558
3615
|
creator.process = function(css, processOpts, pluginOpts) {
|
|
3559
|
-
return postcss([creator(pluginOpts)]).process(css, processOpts);
|
|
3616
|
+
return postcss$1([creator(pluginOpts)]).process(css, processOpts);
|
|
3560
3617
|
};
|
|
3561
3618
|
return creator;
|
|
3562
3619
|
};
|
|
3563
|
-
postcss.stringify = stringify;
|
|
3564
|
-
postcss.parse = parse;
|
|
3565
|
-
postcss.fromJSON = fromJSON;
|
|
3566
|
-
postcss.list = list;
|
|
3567
|
-
postcss.comment = (defaults) => new
|
|
3568
|
-
postcss.atRule = (defaults) => new
|
|
3569
|
-
postcss.decl = (defaults) => new
|
|
3570
|
-
postcss.rule = (defaults) => new
|
|
3571
|
-
postcss.root = (defaults) => new
|
|
3572
|
-
postcss.document = (defaults) => new
|
|
3573
|
-
postcss.CssSyntaxError =
|
|
3574
|
-
postcss.Declaration =
|
|
3575
|
-
postcss.Container =
|
|
3576
|
-
postcss.Processor =
|
|
3577
|
-
postcss.Document =
|
|
3578
|
-
postcss.Comment =
|
|
3579
|
-
postcss.Warning =
|
|
3580
|
-
postcss.AtRule =
|
|
3581
|
-
postcss.Result =
|
|
3582
|
-
postcss.Input =
|
|
3583
|
-
postcss.Rule =
|
|
3584
|
-
postcss.Root =
|
|
3585
|
-
postcss.Node =
|
|
3586
|
-
LazyResult2.registerPostcss(postcss);
|
|
3587
|
-
var postcss_1 = postcss;
|
|
3588
|
-
postcss.default = postcss;
|
|
3589
|
-
const postcss$
|
|
3590
|
-
postcss$
|
|
3591
|
-
postcss$
|
|
3592
|
-
postcss$
|
|
3593
|
-
postcss$
|
|
3594
|
-
postcss$
|
|
3595
|
-
postcss$
|
|
3596
|
-
postcss$
|
|
3597
|
-
postcss$
|
|
3598
|
-
postcss$
|
|
3599
|
-
postcss$
|
|
3600
|
-
postcss$
|
|
3601
|
-
postcss$
|
|
3602
|
-
postcss$
|
|
3603
|
-
postcss$
|
|
3604
|
-
postcss$
|
|
3605
|
-
postcss$
|
|
3606
|
-
postcss$
|
|
3607
|
-
postcss$
|
|
3608
|
-
postcss$
|
|
3609
|
-
postcss$
|
|
3610
|
-
postcss$
|
|
3611
|
-
postcss$
|
|
3612
|
-
postcss$
|
|
3613
|
-
postcss$
|
|
3620
|
+
postcss$1.stringify = stringify$1;
|
|
3621
|
+
postcss$1.parse = parse$1;
|
|
3622
|
+
postcss$1.fromJSON = fromJSON$1;
|
|
3623
|
+
postcss$1.list = list$1;
|
|
3624
|
+
postcss$1.comment = (defaults) => new Comment$2(defaults);
|
|
3625
|
+
postcss$1.atRule = (defaults) => new AtRule$1(defaults);
|
|
3626
|
+
postcss$1.decl = (defaults) => new Declaration$1(defaults);
|
|
3627
|
+
postcss$1.rule = (defaults) => new Rule$1(defaults);
|
|
3628
|
+
postcss$1.root = (defaults) => new Root$1(defaults);
|
|
3629
|
+
postcss$1.document = (defaults) => new Document$1(defaults);
|
|
3630
|
+
postcss$1.CssSyntaxError = CssSyntaxError$1;
|
|
3631
|
+
postcss$1.Declaration = Declaration$1;
|
|
3632
|
+
postcss$1.Container = Container$1;
|
|
3633
|
+
postcss$1.Processor = Processor$1;
|
|
3634
|
+
postcss$1.Document = Document$1;
|
|
3635
|
+
postcss$1.Comment = Comment$2;
|
|
3636
|
+
postcss$1.Warning = Warning$1;
|
|
3637
|
+
postcss$1.AtRule = AtRule$1;
|
|
3638
|
+
postcss$1.Result = Result$1;
|
|
3639
|
+
postcss$1.Input = Input$2;
|
|
3640
|
+
postcss$1.Rule = Rule$1;
|
|
3641
|
+
postcss$1.Root = Root$1;
|
|
3642
|
+
postcss$1.Node = Node$1;
|
|
3643
|
+
LazyResult2.registerPostcss(postcss$1);
|
|
3644
|
+
var postcss_1 = postcss$1;
|
|
3645
|
+
postcss$1.default = postcss$1;
|
|
3646
|
+
const postcss$2 = /* @__PURE__ */ getDefaultExportFromCjs(postcss_1);
|
|
3647
|
+
postcss$2.stringify;
|
|
3648
|
+
postcss$2.fromJSON;
|
|
3649
|
+
postcss$2.plugin;
|
|
3650
|
+
postcss$2.parse;
|
|
3651
|
+
postcss$2.list;
|
|
3652
|
+
postcss$2.document;
|
|
3653
|
+
postcss$2.comment;
|
|
3654
|
+
postcss$2.atRule;
|
|
3655
|
+
postcss$2.rule;
|
|
3656
|
+
postcss$2.decl;
|
|
3657
|
+
postcss$2.root;
|
|
3658
|
+
postcss$2.CssSyntaxError;
|
|
3659
|
+
postcss$2.Declaration;
|
|
3660
|
+
postcss$2.Container;
|
|
3661
|
+
postcss$2.Processor;
|
|
3662
|
+
postcss$2.Document;
|
|
3663
|
+
postcss$2.Comment;
|
|
3664
|
+
postcss$2.Warning;
|
|
3665
|
+
postcss$2.AtRule;
|
|
3666
|
+
postcss$2.Result;
|
|
3667
|
+
postcss$2.Input;
|
|
3668
|
+
postcss$2.Rule;
|
|
3669
|
+
postcss$2.Root;
|
|
3670
|
+
postcss$2.Node;
|
|
3614
3671
|
var NodeType$1 = /* @__PURE__ */ ((NodeType2) => {
|
|
3615
3672
|
NodeType2[NodeType2["Document"] = 0] = "Document";
|
|
3616
3673
|
NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
|
|
@@ -3624,8 +3681,8 @@ function parseCSSText(cssText) {
|
|
|
3624
3681
|
const res = {};
|
|
3625
3682
|
const listDelimiter = /;(?![^(]*\))/g;
|
|
3626
3683
|
const propertyDelimiter = /:(.+)/;
|
|
3627
|
-
const
|
|
3628
|
-
cssText.replace(
|
|
3684
|
+
const comment = /\/\*.*?\*\//g;
|
|
3685
|
+
cssText.replace(comment, "").split(listDelimiter).forEach(function(item) {
|
|
3629
3686
|
if (item) {
|
|
3630
3687
|
const tmp = item.split(propertyDelimiter);
|
|
3631
3688
|
tmp.length > 1 && (res[camelize(tmp[0].trim())] = tmp[1].trim());
|
|
@@ -3820,9 +3877,9 @@ class BaseRRDocument extends BaseRRNode {
|
|
|
3820
3877
|
return text;
|
|
3821
3878
|
}
|
|
3822
3879
|
createComment(data) {
|
|
3823
|
-
const
|
|
3824
|
-
|
|
3825
|
-
return
|
|
3880
|
+
const comment = new BaseRRComment(data);
|
|
3881
|
+
comment.ownerDocument = this;
|
|
3882
|
+
return comment;
|
|
3826
3883
|
}
|
|
3827
3884
|
createCDATASection(data) {
|
|
3828
3885
|
const CDATASection = new BaseRRCDATASection(data);
|