@posthog/rrdom 0.0.7 → 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.umd.cjs
CHANGED
|
@@ -138,7 +138,7 @@ function getAugmentedNamespace(n) {
|
|
|
138
138
|
var picocolors_browser = { exports: {} };
|
|
139
139
|
var x = String;
|
|
140
140
|
var create = function() {
|
|
141
|
-
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 };
|
|
141
|
+
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 };
|
|
142
142
|
};
|
|
143
143
|
picocolors_browser.exports = create();
|
|
144
144
|
picocolors_browser.exports.createColors = create;
|
|
@@ -151,8 +151,8 @@ const __viteBrowserExternal$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Ob
|
|
|
151
151
|
const require$$2 = /* @__PURE__ */ getAugmentedNamespace(__viteBrowserExternal$1);
|
|
152
152
|
let pico = picocolors_browserExports;
|
|
153
153
|
let terminalHighlight$1 = require$$2;
|
|
154
|
-
let CssSyntaxError$
|
|
155
|
-
constructor(message, line, column, source, file,
|
|
154
|
+
let CssSyntaxError$4 = class CssSyntaxError extends Error {
|
|
155
|
+
constructor(message, line, column, source, file, plugin3) {
|
|
156
156
|
super(message);
|
|
157
157
|
this.name = "CssSyntaxError";
|
|
158
158
|
this.reason = message;
|
|
@@ -162,8 +162,8 @@ let CssSyntaxError$3 = class CssSyntaxError extends Error {
|
|
|
162
162
|
if (source) {
|
|
163
163
|
this.source = source;
|
|
164
164
|
}
|
|
165
|
-
if (
|
|
166
|
-
this.plugin =
|
|
165
|
+
if (plugin3) {
|
|
166
|
+
this.plugin = plugin3;
|
|
167
167
|
}
|
|
168
168
|
if (typeof line !== "undefined" && typeof column !== "undefined") {
|
|
169
169
|
if (typeof line === "number") {
|
|
@@ -193,29 +193,40 @@ let CssSyntaxError$3 = class CssSyntaxError extends Error {
|
|
|
193
193
|
if (!this.source) return "";
|
|
194
194
|
let css = this.source;
|
|
195
195
|
if (color == null) color = pico.isColorSupported;
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
let lines = css.split(/\r?\n/);
|
|
200
|
-
let start = Math.max(this.line - 3, 0);
|
|
201
|
-
let end = Math.min(this.line + 2, lines.length);
|
|
202
|
-
let maxWidth = String(end).length;
|
|
203
|
-
let mark, aside;
|
|
196
|
+
let aside = (text) => text;
|
|
197
|
+
let mark = (text) => text;
|
|
198
|
+
let highlight = (text) => text;
|
|
204
199
|
if (color) {
|
|
205
200
|
let { bold, gray, red } = pico.createColors(true);
|
|
206
201
|
mark = (text) => bold(red(text));
|
|
207
202
|
aside = (text) => gray(text);
|
|
208
|
-
|
|
209
|
-
|
|
203
|
+
if (terminalHighlight$1) {
|
|
204
|
+
highlight = (text) => terminalHighlight$1(text);
|
|
205
|
+
}
|
|
210
206
|
}
|
|
207
|
+
let lines = css.split(/\r?\n/);
|
|
208
|
+
let start = Math.max(this.line - 3, 0);
|
|
209
|
+
let end = Math.min(this.line + 2, lines.length);
|
|
210
|
+
let maxWidth = String(end).length;
|
|
211
211
|
return lines.slice(start, end).map((line, index2) => {
|
|
212
212
|
let number = start + 1 + index2;
|
|
213
213
|
let gutter = " " + (" " + number).slice(-maxWidth) + " | ";
|
|
214
214
|
if (number === this.line) {
|
|
215
|
+
if (line.length > 160) {
|
|
216
|
+
let padding = 20;
|
|
217
|
+
let subLineStart = Math.max(0, this.column - padding);
|
|
218
|
+
let subLineEnd = Math.max(
|
|
219
|
+
this.column + padding,
|
|
220
|
+
this.endColumn + padding
|
|
221
|
+
);
|
|
222
|
+
let subLine = line.slice(subLineStart, subLineEnd);
|
|
223
|
+
let spacing2 = aside(gutter.replace(/\d/g, " ")) + line.slice(0, Math.min(this.column - 1, padding - 1)).replace(/[^\t]/g, " ");
|
|
224
|
+
return mark(">") + aside(gutter) + highlight(subLine) + "\n " + spacing2 + mark("^");
|
|
225
|
+
}
|
|
215
226
|
let spacing = aside(gutter.replace(/\d/g, " ")) + line.slice(0, this.column - 1).replace(/[^\t]/g, " ");
|
|
216
|
-
return mark(">") + aside(gutter) + line + "\n " + spacing + mark("^");
|
|
227
|
+
return mark(">") + aside(gutter) + highlight(line) + "\n " + spacing + mark("^");
|
|
217
228
|
}
|
|
218
|
-
return " " + aside(gutter) + line;
|
|
229
|
+
return " " + aside(gutter) + highlight(line);
|
|
219
230
|
}).join("\n");
|
|
220
231
|
}
|
|
221
232
|
toString() {
|
|
@@ -226,11 +237,8 @@ let CssSyntaxError$3 = class CssSyntaxError extends Error {
|
|
|
226
237
|
return this.name + ": " + this.message + code;
|
|
227
238
|
}
|
|
228
239
|
};
|
|
229
|
-
var cssSyntaxError = CssSyntaxError$
|
|
230
|
-
CssSyntaxError$
|
|
231
|
-
var symbols = {};
|
|
232
|
-
symbols.isClean = Symbol("isClean");
|
|
233
|
-
symbols.my = Symbol("my");
|
|
240
|
+
var cssSyntaxError = CssSyntaxError$4;
|
|
241
|
+
CssSyntaxError$4.default = CssSyntaxError$4;
|
|
234
242
|
const DEFAULT_RAW = {
|
|
235
243
|
after: "\n",
|
|
236
244
|
beforeClose: "\n",
|
|
@@ -529,16 +537,19 @@ let Stringifier$2 = class Stringifier {
|
|
|
529
537
|
var stringifier = Stringifier$2;
|
|
530
538
|
Stringifier$2.default = Stringifier$2;
|
|
531
539
|
let Stringifier$1 = stringifier;
|
|
532
|
-
function stringify$
|
|
540
|
+
function stringify$5(node2, builder) {
|
|
533
541
|
let str = new Stringifier$1(builder);
|
|
534
542
|
str.stringify(node2);
|
|
535
543
|
}
|
|
536
|
-
var stringify_1 = stringify$
|
|
537
|
-
stringify$
|
|
538
|
-
|
|
539
|
-
|
|
544
|
+
var stringify_1 = stringify$5;
|
|
545
|
+
stringify$5.default = stringify$5;
|
|
546
|
+
var symbols = {};
|
|
547
|
+
symbols.isClean = Symbol("isClean");
|
|
548
|
+
symbols.my = Symbol("my");
|
|
549
|
+
let CssSyntaxError$3 = cssSyntaxError;
|
|
540
550
|
let Stringifier2 = stringifier;
|
|
541
|
-
let stringify$
|
|
551
|
+
let stringify$4 = stringify_1;
|
|
552
|
+
let { isClean: isClean$2, my: my$2 } = symbols;
|
|
542
553
|
function cloneNode(obj, parent) {
|
|
543
554
|
let cloned = new obj.constructor();
|
|
544
555
|
for (let i in obj) {
|
|
@@ -561,7 +572,28 @@ function cloneNode(obj, parent) {
|
|
|
561
572
|
}
|
|
562
573
|
return cloned;
|
|
563
574
|
}
|
|
564
|
-
|
|
575
|
+
function sourceOffset(inputCSS, position) {
|
|
576
|
+
if (position && typeof position.offset !== "undefined") {
|
|
577
|
+
return position.offset;
|
|
578
|
+
}
|
|
579
|
+
let column = 1;
|
|
580
|
+
let line = 1;
|
|
581
|
+
let offset = 0;
|
|
582
|
+
for (let i = 0; i < inputCSS.length; i++) {
|
|
583
|
+
if (line === position.line && column === position.column) {
|
|
584
|
+
offset = i;
|
|
585
|
+
break;
|
|
586
|
+
}
|
|
587
|
+
if (inputCSS[i] === "\n") {
|
|
588
|
+
column = 1;
|
|
589
|
+
line += 1;
|
|
590
|
+
} else {
|
|
591
|
+
column += 1;
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
return offset;
|
|
595
|
+
}
|
|
596
|
+
let Node$5 = class Node {
|
|
565
597
|
constructor(defaults = {}) {
|
|
566
598
|
this.raws = {};
|
|
567
599
|
this[isClean$2] = false;
|
|
@@ -638,7 +670,7 @@ let Node$4 = class Node {
|
|
|
638
670
|
opts
|
|
639
671
|
);
|
|
640
672
|
}
|
|
641
|
-
return new CssSyntaxError$
|
|
673
|
+
return new CssSyntaxError$3(message);
|
|
642
674
|
}
|
|
643
675
|
getProxyProcessor() {
|
|
644
676
|
return {
|
|
@@ -662,6 +694,10 @@ let Node$4 = class Node {
|
|
|
662
694
|
}
|
|
663
695
|
};
|
|
664
696
|
}
|
|
697
|
+
/* c8 ignore next 3 */
|
|
698
|
+
markClean() {
|
|
699
|
+
this[isClean$2] = true;
|
|
700
|
+
}
|
|
665
701
|
markDirty() {
|
|
666
702
|
if (this[isClean$2]) {
|
|
667
703
|
this[isClean$2] = false;
|
|
@@ -676,23 +712,29 @@ let Node$4 = class Node {
|
|
|
676
712
|
let index2 = this.parent.index(this);
|
|
677
713
|
return this.parent.nodes[index2 + 1];
|
|
678
714
|
}
|
|
679
|
-
positionBy(opts
|
|
715
|
+
positionBy(opts) {
|
|
680
716
|
let pos = this.source.start;
|
|
681
717
|
if (opts.index) {
|
|
682
|
-
pos = this.positionInside(opts.index
|
|
718
|
+
pos = this.positionInside(opts.index);
|
|
683
719
|
} else if (opts.word) {
|
|
684
|
-
|
|
720
|
+
let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
|
|
721
|
+
let stringRepresentation = inputString.slice(
|
|
722
|
+
sourceOffset(inputString, this.source.start),
|
|
723
|
+
sourceOffset(inputString, this.source.end)
|
|
724
|
+
);
|
|
685
725
|
let index2 = stringRepresentation.indexOf(opts.word);
|
|
686
|
-
if (index2 !== -1) pos = this.positionInside(index2
|
|
726
|
+
if (index2 !== -1) pos = this.positionInside(index2);
|
|
687
727
|
}
|
|
688
728
|
return pos;
|
|
689
729
|
}
|
|
690
|
-
positionInside(index2
|
|
691
|
-
let string = stringRepresentation || this.toString();
|
|
730
|
+
positionInside(index2) {
|
|
692
731
|
let column = this.source.start.column;
|
|
693
732
|
let line = this.source.start.line;
|
|
694
|
-
|
|
695
|
-
|
|
733
|
+
let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
|
|
734
|
+
let offset = sourceOffset(inputString, this.source.start);
|
|
735
|
+
let end = offset + index2;
|
|
736
|
+
for (let i = offset; i < end; i++) {
|
|
737
|
+
if (inputString[i] === "\n") {
|
|
696
738
|
column = 1;
|
|
697
739
|
line += 1;
|
|
698
740
|
} else {
|
|
@@ -719,11 +761,17 @@ let Node$4 = class Node {
|
|
|
719
761
|
line: start.line
|
|
720
762
|
};
|
|
721
763
|
if (opts.word) {
|
|
722
|
-
let
|
|
764
|
+
let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
|
|
765
|
+
let stringRepresentation = inputString.slice(
|
|
766
|
+
sourceOffset(inputString, this.source.start),
|
|
767
|
+
sourceOffset(inputString, this.source.end)
|
|
768
|
+
);
|
|
723
769
|
let index2 = stringRepresentation.indexOf(opts.word);
|
|
724
770
|
if (index2 !== -1) {
|
|
725
|
-
start = this.positionInside(index2
|
|
726
|
-
end = this.positionInside(
|
|
771
|
+
start = this.positionInside(index2);
|
|
772
|
+
end = this.positionInside(
|
|
773
|
+
index2 + opts.word.length
|
|
774
|
+
);
|
|
727
775
|
}
|
|
728
776
|
} else {
|
|
729
777
|
if (opts.start) {
|
|
@@ -836,7 +884,7 @@ let Node$4 = class Node {
|
|
|
836
884
|
}
|
|
837
885
|
return this.proxyCache;
|
|
838
886
|
}
|
|
839
|
-
toString(stringifier2 = stringify$
|
|
887
|
+
toString(stringifier2 = stringify$4) {
|
|
840
888
|
if (stringifier2.stringify) stringifier2 = stringifier2.stringify;
|
|
841
889
|
let result2 = "";
|
|
842
890
|
stringifier2(this, (i) => {
|
|
@@ -853,10 +901,19 @@ let Node$4 = class Node {
|
|
|
853
901
|
return this;
|
|
854
902
|
}
|
|
855
903
|
};
|
|
856
|
-
var node = Node$
|
|
857
|
-
Node$
|
|
904
|
+
var node = Node$5;
|
|
905
|
+
Node$5.default = Node$5;
|
|
906
|
+
let Node$4 = node;
|
|
907
|
+
let Comment$6 = class Comment extends Node$4 {
|
|
908
|
+
constructor(defaults) {
|
|
909
|
+
super(defaults);
|
|
910
|
+
this.type = "comment";
|
|
911
|
+
}
|
|
912
|
+
};
|
|
913
|
+
var comment$1 = Comment$6;
|
|
914
|
+
Comment$6.default = Comment$6;
|
|
858
915
|
let Node$3 = node;
|
|
859
|
-
let Declaration$
|
|
916
|
+
let Declaration$5 = class Declaration extends Node$3 {
|
|
860
917
|
constructor(defaults) {
|
|
861
918
|
if (defaults && typeof defaults.value !== "undefined" && typeof defaults.value !== "string") {
|
|
862
919
|
defaults = __spreadProps(__spreadValues({}, defaults), { value: String(defaults.value) });
|
|
@@ -868,1124 +925,1237 @@ let Declaration$4 = class Declaration extends Node$3 {
|
|
|
868
925
|
return this.prop.startsWith("--") || this.prop[0] === "$";
|
|
869
926
|
}
|
|
870
927
|
};
|
|
871
|
-
var declaration = Declaration$
|
|
872
|
-
Declaration$
|
|
873
|
-
let
|
|
874
|
-
let
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
928
|
+
var declaration = Declaration$5;
|
|
929
|
+
Declaration$5.default = Declaration$5;
|
|
930
|
+
let Comment$5 = comment$1;
|
|
931
|
+
let Declaration$4 = declaration;
|
|
932
|
+
let Node$2 = node;
|
|
933
|
+
let { isClean: isClean$1, my: my$1 } = symbols;
|
|
934
|
+
let AtRule$5;
|
|
935
|
+
let parse$5;
|
|
936
|
+
let Root$7;
|
|
937
|
+
let Rule$5;
|
|
938
|
+
function cleanSource(nodes) {
|
|
939
|
+
return nodes.map((i) => {
|
|
940
|
+
if (i.nodes) i.nodes = cleanSource(i.nodes);
|
|
941
|
+
delete i.source;
|
|
942
|
+
return i;
|
|
943
|
+
});
|
|
944
|
+
}
|
|
945
|
+
function markTreeDirty(node2) {
|
|
946
|
+
node2[isClean$1] = false;
|
|
947
|
+
if (node2.proxyOf.nodes) {
|
|
948
|
+
for (let i of node2.proxyOf.nodes) {
|
|
949
|
+
markTreeDirty(i);
|
|
880
950
|
}
|
|
881
|
-
return id;
|
|
882
|
-
};
|
|
883
|
-
};
|
|
884
|
-
let nanoid$1 = (size = 21) => {
|
|
885
|
-
let id = "";
|
|
886
|
-
let i = size;
|
|
887
|
-
while (i--) {
|
|
888
|
-
id += urlAlphabet[Math.random() * 64 | 0];
|
|
889
|
-
}
|
|
890
|
-
return id;
|
|
891
|
-
};
|
|
892
|
-
var nonSecure = { nanoid: nanoid$1, customAlphabet };
|
|
893
|
-
let { SourceMapConsumer: SourceMapConsumer$2, SourceMapGenerator: SourceMapGenerator$2 } = require$$2;
|
|
894
|
-
let { existsSync, readFileSync } = require$$2;
|
|
895
|
-
let { dirname: dirname$1, join } = require$$2;
|
|
896
|
-
function fromBase64(str) {
|
|
897
|
-
if (Buffer) {
|
|
898
|
-
return Buffer.from(str, "base64").toString();
|
|
899
|
-
} else {
|
|
900
|
-
return window.atob(str);
|
|
901
951
|
}
|
|
902
952
|
}
|
|
903
|
-
let
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
let prev = opts.map ? opts.map.prev : void 0;
|
|
909
|
-
let text = this.loadMap(opts.from, prev);
|
|
910
|
-
if (!this.mapFile && opts.from) {
|
|
911
|
-
this.mapFile = opts.from;
|
|
953
|
+
let Container$8 = class Container extends Node$2 {
|
|
954
|
+
append(...children) {
|
|
955
|
+
for (let child of children) {
|
|
956
|
+
let nodes = this.normalize(child, this.last);
|
|
957
|
+
for (let node2 of nodes) this.proxyOf.nodes.push(node2);
|
|
912
958
|
}
|
|
913
|
-
|
|
914
|
-
|
|
959
|
+
this.markDirty();
|
|
960
|
+
return this;
|
|
915
961
|
}
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
962
|
+
cleanRaws(keepBetween) {
|
|
963
|
+
super.cleanRaws(keepBetween);
|
|
964
|
+
if (this.nodes) {
|
|
965
|
+
for (let node2 of this.nodes) node2.cleanRaws(keepBetween);
|
|
919
966
|
}
|
|
920
|
-
return this.consumerCache;
|
|
921
967
|
}
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
let
|
|
925
|
-
let
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
return fromBase64(text.substr(RegExp.lastMatch.length));
|
|
968
|
+
each(callback) {
|
|
969
|
+
if (!this.proxyOf.nodes) return void 0;
|
|
970
|
+
let iterator = this.getIterator();
|
|
971
|
+
let index2, result2;
|
|
972
|
+
while (this.indexes[iterator] < this.proxyOf.nodes.length) {
|
|
973
|
+
index2 = this.indexes[iterator];
|
|
974
|
+
result2 = callback(this.proxyOf.nodes[index2], index2);
|
|
975
|
+
if (result2 === false) break;
|
|
976
|
+
this.indexes[iterator] += 1;
|
|
932
977
|
}
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
}
|
|
936
|
-
getAnnotationURL(sourceMapString) {
|
|
937
|
-
return sourceMapString.replace(/^\/\*\s*# sourceMappingURL=/, "").trim();
|
|
938
|
-
}
|
|
939
|
-
isMap(map) {
|
|
940
|
-
if (typeof map !== "object") return false;
|
|
941
|
-
return typeof map.mappings === "string" || typeof map._mappings === "string" || Array.isArray(map.sections);
|
|
978
|
+
delete this.indexes[iterator];
|
|
979
|
+
return result2;
|
|
942
980
|
}
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
if (!comments) return;
|
|
946
|
-
let start = css.lastIndexOf(comments.pop());
|
|
947
|
-
let end = css.indexOf("*/", start);
|
|
948
|
-
if (start > -1 && end > -1) {
|
|
949
|
-
this.annotation = this.getAnnotationURL(css.substring(start, end));
|
|
950
|
-
}
|
|
981
|
+
every(condition) {
|
|
982
|
+
return this.nodes.every(condition);
|
|
951
983
|
}
|
|
952
|
-
|
|
953
|
-
this.
|
|
954
|
-
if (
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
984
|
+
getIterator() {
|
|
985
|
+
if (!this.lastEach) this.lastEach = 0;
|
|
986
|
+
if (!this.indexes) this.indexes = {};
|
|
987
|
+
this.lastEach += 1;
|
|
988
|
+
let iterator = this.lastEach;
|
|
989
|
+
this.indexes[iterator] = 0;
|
|
990
|
+
return iterator;
|
|
958
991
|
}
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
if (
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
992
|
+
getProxyProcessor() {
|
|
993
|
+
return {
|
|
994
|
+
get(node2, prop) {
|
|
995
|
+
if (prop === "proxyOf") {
|
|
996
|
+
return node2;
|
|
997
|
+
} else if (!node2[prop]) {
|
|
998
|
+
return node2[prop];
|
|
999
|
+
} else if (prop === "each" || typeof prop === "string" && prop.startsWith("walk")) {
|
|
1000
|
+
return (...args) => {
|
|
1001
|
+
return node2[prop](
|
|
1002
|
+
...args.map((i) => {
|
|
1003
|
+
if (typeof i === "function") {
|
|
1004
|
+
return (child, index2) => i(child.toProxy(), index2);
|
|
1005
|
+
} else {
|
|
1006
|
+
return i;
|
|
1007
|
+
}
|
|
1008
|
+
})
|
|
971
1009
|
);
|
|
972
|
-
}
|
|
973
|
-
|
|
1010
|
+
};
|
|
1011
|
+
} else if (prop === "every" || prop === "some") {
|
|
1012
|
+
return (cb) => {
|
|
1013
|
+
return node2[prop](
|
|
1014
|
+
(child, ...other) => cb(child.toProxy(), ...other)
|
|
1015
|
+
);
|
|
1016
|
+
};
|
|
1017
|
+
} else if (prop === "root") {
|
|
1018
|
+
return () => node2.root().toProxy();
|
|
1019
|
+
} else if (prop === "nodes") {
|
|
1020
|
+
return node2.nodes.map((i) => i.toProxy());
|
|
1021
|
+
} else if (prop === "first" || prop === "last") {
|
|
1022
|
+
return node2[prop].toProxy();
|
|
1023
|
+
} else {
|
|
1024
|
+
return node2[prop];
|
|
974
1025
|
}
|
|
975
|
-
}
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
"Unsupported previous source map format: " + prev.toString()
|
|
984
|
-
);
|
|
1026
|
+
},
|
|
1027
|
+
set(node2, prop, value) {
|
|
1028
|
+
if (node2[prop] === value) return true;
|
|
1029
|
+
node2[prop] = value;
|
|
1030
|
+
if (prop === "name" || prop === "params" || prop === "selector") {
|
|
1031
|
+
node2.markDirty();
|
|
1032
|
+
}
|
|
1033
|
+
return true;
|
|
985
1034
|
}
|
|
986
|
-
}
|
|
987
|
-
return this.decodeInline(this.annotation);
|
|
988
|
-
} else if (this.annotation) {
|
|
989
|
-
let map = this.annotation;
|
|
990
|
-
if (file) map = join(dirname$1(file), map);
|
|
991
|
-
return this.loadFile(map);
|
|
992
|
-
}
|
|
1035
|
+
};
|
|
993
1036
|
}
|
|
994
|
-
|
|
995
|
-
if (
|
|
996
|
-
|
|
1037
|
+
index(child) {
|
|
1038
|
+
if (typeof child === "number") return child;
|
|
1039
|
+
if (child.proxyOf) child = child.proxyOf;
|
|
1040
|
+
return this.proxyOf.nodes.indexOf(child);
|
|
997
1041
|
}
|
|
998
|
-
|
|
999
|
-
|
|
1042
|
+
insertAfter(exist, add) {
|
|
1043
|
+
let existIndex = this.index(exist);
|
|
1044
|
+
let nodes = this.normalize(add, this.proxyOf.nodes[existIndex]).reverse();
|
|
1045
|
+
existIndex = this.index(exist);
|
|
1046
|
+
for (let node2 of nodes) this.proxyOf.nodes.splice(existIndex + 1, 0, node2);
|
|
1047
|
+
let index2;
|
|
1048
|
+
for (let id in this.indexes) {
|
|
1049
|
+
index2 = this.indexes[id];
|
|
1050
|
+
if (existIndex < index2) {
|
|
1051
|
+
this.indexes[id] = index2 + nodes.length;
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
this.markDirty();
|
|
1055
|
+
return this;
|
|
1000
1056
|
}
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
let
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
let
|
|
1011
|
-
let
|
|
1012
|
-
let
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
throw new Error(`PostCSS received ${css} instead of CSS string`);
|
|
1057
|
+
insertBefore(exist, add) {
|
|
1058
|
+
let existIndex = this.index(exist);
|
|
1059
|
+
let type = existIndex === 0 ? "prepend" : false;
|
|
1060
|
+
let nodes = this.normalize(
|
|
1061
|
+
add,
|
|
1062
|
+
this.proxyOf.nodes[existIndex],
|
|
1063
|
+
type
|
|
1064
|
+
).reverse();
|
|
1065
|
+
existIndex = this.index(exist);
|
|
1066
|
+
for (let node2 of nodes) this.proxyOf.nodes.splice(existIndex, 0, node2);
|
|
1067
|
+
let index2;
|
|
1068
|
+
for (let id in this.indexes) {
|
|
1069
|
+
index2 = this.indexes[id];
|
|
1070
|
+
if (existIndex <= index2) {
|
|
1071
|
+
this.indexes[id] = index2 + nodes.length;
|
|
1072
|
+
}
|
|
1018
1073
|
}
|
|
1019
|
-
this.
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1074
|
+
this.markDirty();
|
|
1075
|
+
return this;
|
|
1076
|
+
}
|
|
1077
|
+
normalize(nodes, sample) {
|
|
1078
|
+
if (typeof nodes === "string") {
|
|
1079
|
+
nodes = cleanSource(parse$5(nodes).nodes);
|
|
1080
|
+
} else if (typeof nodes === "undefined") {
|
|
1081
|
+
nodes = [];
|
|
1082
|
+
} else if (Array.isArray(nodes)) {
|
|
1083
|
+
nodes = nodes.slice(0);
|
|
1084
|
+
for (let i of nodes) {
|
|
1085
|
+
if (i.parent) i.parent.removeChild(i, "ignore");
|
|
1086
|
+
}
|
|
1087
|
+
} else if (nodes.type === "root" && this.type !== "document") {
|
|
1088
|
+
nodes = nodes.nodes.slice(0);
|
|
1089
|
+
for (let i of nodes) {
|
|
1090
|
+
if (i.parent) i.parent.removeChild(i, "ignore");
|
|
1091
|
+
}
|
|
1092
|
+
} else if (nodes.type) {
|
|
1093
|
+
nodes = [nodes];
|
|
1094
|
+
} else if (nodes.prop) {
|
|
1095
|
+
if (typeof nodes.value === "undefined") {
|
|
1096
|
+
throw new Error("Value field is missed in node creation");
|
|
1097
|
+
} else if (typeof nodes.value !== "string") {
|
|
1098
|
+
nodes.value = String(nodes.value);
|
|
1099
|
+
}
|
|
1100
|
+
nodes = [new Declaration$4(nodes)];
|
|
1101
|
+
} else if (nodes.selector || nodes.selectors) {
|
|
1102
|
+
nodes = [new Rule$5(nodes)];
|
|
1103
|
+
} else if (nodes.name) {
|
|
1104
|
+
nodes = [new AtRule$5(nodes)];
|
|
1105
|
+
} else if (nodes.text) {
|
|
1106
|
+
nodes = [new Comment$5(nodes)];
|
|
1023
1107
|
} else {
|
|
1024
|
-
|
|
1108
|
+
throw new Error("Unknown node type in node creation");
|
|
1025
1109
|
}
|
|
1026
|
-
|
|
1027
|
-
if (!
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1110
|
+
let processed = nodes.map((i) => {
|
|
1111
|
+
if (!i[my$1]) Container.rebuild(i);
|
|
1112
|
+
i = i.proxyOf;
|
|
1113
|
+
if (i.parent) i.parent.removeChild(i);
|
|
1114
|
+
if (i[isClean$1]) markTreeDirty(i);
|
|
1115
|
+
if (!i.raws) i.raws = {};
|
|
1116
|
+
if (typeof i.raws.before === "undefined") {
|
|
1117
|
+
if (sample && typeof sample.raws.before !== "undefined") {
|
|
1118
|
+
i.raws.before = sample.raws.before.replace(/\S/g, "");
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
i.parent = this.proxyOf;
|
|
1122
|
+
return i;
|
|
1123
|
+
});
|
|
1124
|
+
return processed;
|
|
1125
|
+
}
|
|
1126
|
+
prepend(...children) {
|
|
1127
|
+
children = children.reverse();
|
|
1128
|
+
for (let child of children) {
|
|
1129
|
+
let nodes = this.normalize(child, this.first, "prepend").reverse();
|
|
1130
|
+
for (let node2 of nodes) this.proxyOf.nodes.unshift(node2);
|
|
1131
|
+
for (let id in this.indexes) {
|
|
1132
|
+
this.indexes[id] = this.indexes[id] + nodes.length;
|
|
1031
1133
|
}
|
|
1032
1134
|
}
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1135
|
+
this.markDirty();
|
|
1136
|
+
return this;
|
|
1137
|
+
}
|
|
1138
|
+
push(child) {
|
|
1139
|
+
child.parent = this;
|
|
1140
|
+
this.proxyOf.nodes.push(child);
|
|
1141
|
+
return this;
|
|
1142
|
+
}
|
|
1143
|
+
removeAll() {
|
|
1144
|
+
for (let node2 of this.proxyOf.nodes) node2.parent = void 0;
|
|
1145
|
+
this.proxyOf.nodes = [];
|
|
1146
|
+
this.markDirty();
|
|
1147
|
+
return this;
|
|
1148
|
+
}
|
|
1149
|
+
removeChild(child) {
|
|
1150
|
+
child = this.index(child);
|
|
1151
|
+
this.proxyOf.nodes[child].parent = void 0;
|
|
1152
|
+
this.proxyOf.nodes.splice(child, 1);
|
|
1153
|
+
let index2;
|
|
1154
|
+
for (let id in this.indexes) {
|
|
1155
|
+
index2 = this.indexes[id];
|
|
1156
|
+
if (index2 >= child) {
|
|
1157
|
+
this.indexes[id] = index2 - 1;
|
|
1039
1158
|
}
|
|
1040
1159
|
}
|
|
1041
|
-
|
|
1042
|
-
|
|
1160
|
+
this.markDirty();
|
|
1161
|
+
return this;
|
|
1162
|
+
}
|
|
1163
|
+
replaceValues(pattern, opts, callback) {
|
|
1164
|
+
if (!callback) {
|
|
1165
|
+
callback = opts;
|
|
1166
|
+
opts = {};
|
|
1043
1167
|
}
|
|
1044
|
-
|
|
1168
|
+
this.walkDecls((decl2) => {
|
|
1169
|
+
if (opts.props && !opts.props.includes(decl2.prop)) return;
|
|
1170
|
+
if (opts.fast && !decl2.value.includes(opts.fast)) return;
|
|
1171
|
+
decl2.value = decl2.value.replace(pattern, callback);
|
|
1172
|
+
});
|
|
1173
|
+
this.markDirty();
|
|
1174
|
+
return this;
|
|
1045
1175
|
}
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
line = start.line;
|
|
1057
|
-
column = start.column;
|
|
1176
|
+
some(condition) {
|
|
1177
|
+
return this.nodes.some(condition);
|
|
1178
|
+
}
|
|
1179
|
+
walk(callback) {
|
|
1180
|
+
return this.each((child, i) => {
|
|
1181
|
+
let result2;
|
|
1182
|
+
try {
|
|
1183
|
+
result2 = callback(child, i);
|
|
1184
|
+
} catch (e) {
|
|
1185
|
+
throw child.addToError(e);
|
|
1058
1186
|
}
|
|
1059
|
-
if (
|
|
1060
|
-
|
|
1061
|
-
endLine = pos.line;
|
|
1062
|
-
endColumn = pos.col;
|
|
1063
|
-
} else {
|
|
1064
|
-
endLine = end.line;
|
|
1065
|
-
endColumn = end.column;
|
|
1187
|
+
if (result2 !== false && child.walk) {
|
|
1188
|
+
result2 = child.walk(callback);
|
|
1066
1189
|
}
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1190
|
+
return result2;
|
|
1191
|
+
});
|
|
1192
|
+
}
|
|
1193
|
+
walkAtRules(name, callback) {
|
|
1194
|
+
if (!callback) {
|
|
1195
|
+
callback = name;
|
|
1196
|
+
return this.walk((child, i) => {
|
|
1197
|
+
if (child.type === "atrule") {
|
|
1198
|
+
return callback(child, i);
|
|
1199
|
+
}
|
|
1200
|
+
});
|
|
1071
1201
|
}
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
origin.source,
|
|
1079
|
-
origin.file,
|
|
1080
|
-
opts.plugin
|
|
1081
|
-
);
|
|
1082
|
-
} else {
|
|
1083
|
-
result2 = new CssSyntaxError$1(
|
|
1084
|
-
message,
|
|
1085
|
-
endLine === void 0 ? line : { column, line },
|
|
1086
|
-
endLine === void 0 ? column : { column: endColumn, line: endLine },
|
|
1087
|
-
this.css,
|
|
1088
|
-
this.file,
|
|
1089
|
-
opts.plugin
|
|
1090
|
-
);
|
|
1202
|
+
if (name instanceof RegExp) {
|
|
1203
|
+
return this.walk((child, i) => {
|
|
1204
|
+
if (child.type === "atrule" && name.test(child.name)) {
|
|
1205
|
+
return callback(child, i);
|
|
1206
|
+
}
|
|
1207
|
+
});
|
|
1091
1208
|
}
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
result2.input.url = pathToFileURL$1(this.file).toString();
|
|
1209
|
+
return this.walk((child, i) => {
|
|
1210
|
+
if (child.type === "atrule" && child.name === name) {
|
|
1211
|
+
return callback(child, i);
|
|
1096
1212
|
}
|
|
1097
|
-
|
|
1098
|
-
}
|
|
1099
|
-
return result2;
|
|
1213
|
+
});
|
|
1100
1214
|
}
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
lineToIndex = new Array(lines.length);
|
|
1106
|
-
let prevIndex = 0;
|
|
1107
|
-
for (let i = 0, l = lines.length; i < l; i++) {
|
|
1108
|
-
lineToIndex[i] = prevIndex;
|
|
1109
|
-
prevIndex += lines[i].length + 1;
|
|
1215
|
+
walkComments(callback) {
|
|
1216
|
+
return this.walk((child, i) => {
|
|
1217
|
+
if (child.type === "comment") {
|
|
1218
|
+
return callback(child, i);
|
|
1110
1219
|
}
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1220
|
+
});
|
|
1221
|
+
}
|
|
1222
|
+
walkDecls(prop, callback) {
|
|
1223
|
+
if (!callback) {
|
|
1224
|
+
callback = prop;
|
|
1225
|
+
return this.walk((child, i) => {
|
|
1226
|
+
if (child.type === "decl") {
|
|
1227
|
+
return callback(child, i);
|
|
1228
|
+
}
|
|
1229
|
+
});
|
|
1114
1230
|
}
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
} else {
|
|
1120
|
-
let max = lineToIndex.length - 2;
|
|
1121
|
-
let mid;
|
|
1122
|
-
while (min < max) {
|
|
1123
|
-
mid = min + (max - min >> 1);
|
|
1124
|
-
if (offset < lineToIndex[mid]) {
|
|
1125
|
-
max = mid - 1;
|
|
1126
|
-
} else if (offset >= lineToIndex[mid + 1]) {
|
|
1127
|
-
min = mid + 1;
|
|
1128
|
-
} else {
|
|
1129
|
-
min = mid;
|
|
1130
|
-
break;
|
|
1231
|
+
if (prop instanceof RegExp) {
|
|
1232
|
+
return this.walk((child, i) => {
|
|
1233
|
+
if (child.type === "decl" && prop.test(child.prop)) {
|
|
1234
|
+
return callback(child, i);
|
|
1131
1235
|
}
|
|
1132
|
-
}
|
|
1236
|
+
});
|
|
1133
1237
|
}
|
|
1134
|
-
return {
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1238
|
+
return this.walk((child, i) => {
|
|
1239
|
+
if (child.type === "decl" && child.prop === prop) {
|
|
1240
|
+
return callback(child, i);
|
|
1241
|
+
}
|
|
1242
|
+
});
|
|
1138
1243
|
}
|
|
1139
|
-
|
|
1140
|
-
if (
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
let consumer = this.map.consumer();
|
|
1148
|
-
let from = consumer.originalPositionFor({ column, line });
|
|
1149
|
-
if (!from.source) return false;
|
|
1150
|
-
let to;
|
|
1151
|
-
if (typeof endLine === "number") {
|
|
1152
|
-
to = consumer.originalPositionFor({ column: endColumn, line: endLine });
|
|
1244
|
+
walkRules(selector, callback) {
|
|
1245
|
+
if (!callback) {
|
|
1246
|
+
callback = selector;
|
|
1247
|
+
return this.walk((child, i) => {
|
|
1248
|
+
if (child.type === "rule") {
|
|
1249
|
+
return callback(child, i);
|
|
1250
|
+
}
|
|
1251
|
+
});
|
|
1153
1252
|
}
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
this.map.consumer().sourceRoot || pathToFileURL$1(this.map.mapFile)
|
|
1161
|
-
);
|
|
1253
|
+
if (selector instanceof RegExp) {
|
|
1254
|
+
return this.walk((child, i) => {
|
|
1255
|
+
if (child.type === "rule" && selector.test(child.selector)) {
|
|
1256
|
+
return callback(child, i);
|
|
1257
|
+
}
|
|
1258
|
+
});
|
|
1162
1259
|
}
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
endLine: to && to.line,
|
|
1167
|
-
line: from.line,
|
|
1168
|
-
url: fromUrl.toString()
|
|
1169
|
-
};
|
|
1170
|
-
if (fromUrl.protocol === "file:") {
|
|
1171
|
-
if (fileURLToPath) {
|
|
1172
|
-
result2.file = fileURLToPath(fromUrl);
|
|
1173
|
-
} else {
|
|
1174
|
-
throw new Error(`file: protocol is not available in this PostCSS build`);
|
|
1260
|
+
return this.walk((child, i) => {
|
|
1261
|
+
if (child.type === "rule" && child.selector === selector) {
|
|
1262
|
+
return callback(child, i);
|
|
1175
1263
|
}
|
|
1176
|
-
}
|
|
1177
|
-
let source = consumer.sourceContentFor(from.source);
|
|
1178
|
-
if (source) result2.source = source;
|
|
1179
|
-
return result2;
|
|
1264
|
+
});
|
|
1180
1265
|
}
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
if (this[name] != null) {
|
|
1185
|
-
json[name] = this[name];
|
|
1186
|
-
}
|
|
1187
|
-
}
|
|
1188
|
-
if (this.map) {
|
|
1189
|
-
json.map = __spreadValues({}, this.map);
|
|
1190
|
-
if (json.map.consumerCache) {
|
|
1191
|
-
json.map.consumerCache = void 0;
|
|
1192
|
-
}
|
|
1193
|
-
}
|
|
1194
|
-
return json;
|
|
1266
|
+
get first() {
|
|
1267
|
+
if (!this.proxyOf.nodes) return void 0;
|
|
1268
|
+
return this.proxyOf.nodes[0];
|
|
1195
1269
|
}
|
|
1196
|
-
get
|
|
1197
|
-
|
|
1270
|
+
get last() {
|
|
1271
|
+
if (!this.proxyOf.nodes) return void 0;
|
|
1272
|
+
return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
|
|
1198
1273
|
}
|
|
1199
1274
|
};
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1275
|
+
Container$8.registerParse = (dependant) => {
|
|
1276
|
+
parse$5 = dependant;
|
|
1277
|
+
};
|
|
1278
|
+
Container$8.registerRule = (dependant) => {
|
|
1279
|
+
Rule$5 = dependant;
|
|
1280
|
+
};
|
|
1281
|
+
Container$8.registerAtRule = (dependant) => {
|
|
1282
|
+
AtRule$5 = dependant;
|
|
1283
|
+
};
|
|
1284
|
+
Container$8.registerRoot = (dependant) => {
|
|
1285
|
+
Root$7 = dependant;
|
|
1286
|
+
};
|
|
1287
|
+
var container = Container$8;
|
|
1288
|
+
Container$8.default = Container$8;
|
|
1289
|
+
Container$8.rebuild = (node2) => {
|
|
1290
|
+
if (node2.type === "atrule") {
|
|
1291
|
+
Object.setPrototypeOf(node2, AtRule$5.prototype);
|
|
1292
|
+
} else if (node2.type === "rule") {
|
|
1293
|
+
Object.setPrototypeOf(node2, Rule$5.prototype);
|
|
1294
|
+
} else if (node2.type === "decl") {
|
|
1295
|
+
Object.setPrototypeOf(node2, Declaration$4.prototype);
|
|
1296
|
+
} else if (node2.type === "comment") {
|
|
1297
|
+
Object.setPrototypeOf(node2, Comment$5.prototype);
|
|
1298
|
+
} else if (node2.type === "root") {
|
|
1299
|
+
Object.setPrototypeOf(node2, Root$7.prototype);
|
|
1223
1300
|
}
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
}
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1301
|
+
node2[my$1] = true;
|
|
1302
|
+
if (node2.nodes) {
|
|
1303
|
+
node2.nodes.forEach((child) => {
|
|
1304
|
+
Container$8.rebuild(child);
|
|
1305
|
+
});
|
|
1306
|
+
}
|
|
1307
|
+
};
|
|
1308
|
+
let Container$7 = container;
|
|
1309
|
+
let AtRule$4 = class AtRule extends Container$7 {
|
|
1310
|
+
constructor(defaults) {
|
|
1311
|
+
super(defaults);
|
|
1312
|
+
this.type = "atrule";
|
|
1313
|
+
}
|
|
1314
|
+
append(...children) {
|
|
1315
|
+
if (!this.proxyOf.nodes) this.nodes = [];
|
|
1316
|
+
return super.append(...children);
|
|
1317
|
+
}
|
|
1318
|
+
prepend(...children) {
|
|
1319
|
+
if (!this.proxyOf.nodes) this.nodes = [];
|
|
1320
|
+
return super.prepend(...children);
|
|
1321
|
+
}
|
|
1322
|
+
};
|
|
1323
|
+
var atRule$1 = AtRule$4;
|
|
1324
|
+
AtRule$4.default = AtRule$4;
|
|
1325
|
+
Container$7.registerAtRule(AtRule$4);
|
|
1326
|
+
let Container$6 = container;
|
|
1327
|
+
let LazyResult$4;
|
|
1328
|
+
let Processor$4;
|
|
1329
|
+
let Document$4 = class Document2 extends Container$6 {
|
|
1330
|
+
constructor(defaults) {
|
|
1331
|
+
super(__spreadValues({ type: "document" }, defaults));
|
|
1332
|
+
if (!this.nodes) {
|
|
1333
|
+
this.nodes = [];
|
|
1234
1334
|
}
|
|
1235
|
-
let eol = "\n";
|
|
1236
|
-
if (this.css.includes("\r\n")) eol = "\r\n";
|
|
1237
|
-
this.css += eol + "/*# sourceMappingURL=" + content + " */";
|
|
1238
1335
|
}
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1336
|
+
toResult(opts = {}) {
|
|
1337
|
+
let lazy = new LazyResult$4(new Processor$4(), this, opts);
|
|
1338
|
+
return lazy.stringify();
|
|
1339
|
+
}
|
|
1340
|
+
};
|
|
1341
|
+
Document$4.registerLazyResult = (dependant) => {
|
|
1342
|
+
LazyResult$4 = dependant;
|
|
1343
|
+
};
|
|
1344
|
+
Document$4.registerProcessor = (dependant) => {
|
|
1345
|
+
Processor$4 = dependant;
|
|
1346
|
+
};
|
|
1347
|
+
var document$2 = Document$4;
|
|
1348
|
+
Document$4.default = Document$4;
|
|
1349
|
+
let urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
1350
|
+
let customAlphabet = (alphabet, defaultSize = 21) => {
|
|
1351
|
+
return (size = defaultSize) => {
|
|
1352
|
+
let id = "";
|
|
1353
|
+
let i = size | 0;
|
|
1354
|
+
while (i--) {
|
|
1355
|
+
id += alphabet[Math.random() * alphabet.length | 0];
|
|
1253
1356
|
}
|
|
1357
|
+
return id;
|
|
1358
|
+
};
|
|
1359
|
+
};
|
|
1360
|
+
let nanoid$1 = (size = 21) => {
|
|
1361
|
+
let id = "";
|
|
1362
|
+
let i = size | 0;
|
|
1363
|
+
while (i--) {
|
|
1364
|
+
id += urlAlphabet[Math.random() * 64 | 0];
|
|
1254
1365
|
}
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1366
|
+
return id;
|
|
1367
|
+
};
|
|
1368
|
+
var nonSecure = { nanoid: nanoid$1, customAlphabet };
|
|
1369
|
+
let { existsSync, readFileSync } = require$$2;
|
|
1370
|
+
let { dirname: dirname$1, join } = require$$2;
|
|
1371
|
+
let { SourceMapConsumer: SourceMapConsumer$2, SourceMapGenerator: SourceMapGenerator$2 } = require$$2;
|
|
1372
|
+
function fromBase64(str) {
|
|
1373
|
+
if (Buffer) {
|
|
1374
|
+
return Buffer.from(str, "base64").toString();
|
|
1375
|
+
} else {
|
|
1376
|
+
return window.atob(str);
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
let PreviousMap$2 = class PreviousMap {
|
|
1380
|
+
constructor(css, opts) {
|
|
1381
|
+
if (opts.map === false) return;
|
|
1382
|
+
this.loadAnnotation(css);
|
|
1383
|
+
this.inline = this.startWith(this.annotation, "data:");
|
|
1384
|
+
let prev = opts.map ? opts.map.prev : void 0;
|
|
1385
|
+
let text = this.loadMap(opts.from, prev);
|
|
1386
|
+
if (!this.mapFile && opts.from) {
|
|
1387
|
+
this.mapFile = opts.from;
|
|
1268
1388
|
}
|
|
1389
|
+
if (this.mapFile) this.root = dirname$1(this.mapFile);
|
|
1390
|
+
if (text) this.text = text;
|
|
1269
1391
|
}
|
|
1270
|
-
|
|
1271
|
-
this.
|
|
1272
|
-
|
|
1273
|
-
return this.generateMap();
|
|
1274
|
-
} else {
|
|
1275
|
-
let result2 = "";
|
|
1276
|
-
this.stringify(this.root, (i) => {
|
|
1277
|
-
result2 += i;
|
|
1278
|
-
});
|
|
1279
|
-
return [result2];
|
|
1392
|
+
consumer() {
|
|
1393
|
+
if (!this.consumerCache) {
|
|
1394
|
+
this.consumerCache = new SourceMapConsumer$2(this.text);
|
|
1280
1395
|
}
|
|
1396
|
+
return this.consumerCache;
|
|
1281
1397
|
}
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
});
|
|
1291
|
-
} else {
|
|
1292
|
-
this.map = new SourceMapGenerator({
|
|
1293
|
-
file: this.outputFile(),
|
|
1294
|
-
ignoreInvalidMapping: true
|
|
1295
|
-
});
|
|
1296
|
-
this.map.addMapping({
|
|
1297
|
-
generated: { column: 0, line: 1 },
|
|
1298
|
-
original: { column: 0, line: 1 },
|
|
1299
|
-
source: this.opts.from ? this.toUrl(this.path(this.opts.from)) : "<no source>"
|
|
1300
|
-
});
|
|
1398
|
+
decodeInline(text) {
|
|
1399
|
+
let baseCharsetUri = /^data:application\/json;charset=utf-?8;base64,/;
|
|
1400
|
+
let baseUri = /^data:application\/json;base64,/;
|
|
1401
|
+
let charsetUri = /^data:application\/json;charset=utf-?8,/;
|
|
1402
|
+
let uri = /^data:application\/json,/;
|
|
1403
|
+
let uriMatch = text.match(charsetUri) || text.match(uri);
|
|
1404
|
+
if (uriMatch) {
|
|
1405
|
+
return decodeURIComponent(text.substr(uriMatch[0].length));
|
|
1301
1406
|
}
|
|
1302
|
-
|
|
1303
|
-
if (
|
|
1304
|
-
|
|
1305
|
-
if (this.isInline()) {
|
|
1306
|
-
return [this.css];
|
|
1307
|
-
} else {
|
|
1308
|
-
return [this.css, this.map];
|
|
1407
|
+
let baseUriMatch = text.match(baseCharsetUri) || text.match(baseUri);
|
|
1408
|
+
if (baseUriMatch) {
|
|
1409
|
+
return fromBase64(text.substr(baseUriMatch[0].length));
|
|
1309
1410
|
}
|
|
1411
|
+
let encoding = text.match(/data:application\/json;([^,]+),/)[1];
|
|
1412
|
+
throw new Error("Unsupported source map encoding " + encoding);
|
|
1310
1413
|
}
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
this.map = new SourceMapGenerator({
|
|
1314
|
-
file: this.outputFile(),
|
|
1315
|
-
ignoreInvalidMapping: true
|
|
1316
|
-
});
|
|
1317
|
-
let line = 1;
|
|
1318
|
-
let column = 1;
|
|
1319
|
-
let noSource = "<no source>";
|
|
1320
|
-
let mapping = {
|
|
1321
|
-
generated: { column: 0, line: 0 },
|
|
1322
|
-
original: { column: 0, line: 0 },
|
|
1323
|
-
source: ""
|
|
1324
|
-
};
|
|
1325
|
-
let lines, last;
|
|
1326
|
-
this.stringify(this.root, (str, node2, type) => {
|
|
1327
|
-
this.css += str;
|
|
1328
|
-
if (node2 && type !== "end") {
|
|
1329
|
-
mapping.generated.line = line;
|
|
1330
|
-
mapping.generated.column = column - 1;
|
|
1331
|
-
if (node2.source && node2.source.start) {
|
|
1332
|
-
mapping.source = this.sourcePath(node2);
|
|
1333
|
-
mapping.original.line = node2.source.start.line;
|
|
1334
|
-
mapping.original.column = node2.source.start.column - 1;
|
|
1335
|
-
this.map.addMapping(mapping);
|
|
1336
|
-
} else {
|
|
1337
|
-
mapping.source = noSource;
|
|
1338
|
-
mapping.original.line = 1;
|
|
1339
|
-
mapping.original.column = 0;
|
|
1340
|
-
this.map.addMapping(mapping);
|
|
1341
|
-
}
|
|
1342
|
-
}
|
|
1343
|
-
lines = str.match(/\n/g);
|
|
1344
|
-
if (lines) {
|
|
1345
|
-
line += lines.length;
|
|
1346
|
-
last = str.lastIndexOf("\n");
|
|
1347
|
-
column = str.length - last;
|
|
1348
|
-
} else {
|
|
1349
|
-
column += str.length;
|
|
1350
|
-
}
|
|
1351
|
-
if (node2 && type !== "start") {
|
|
1352
|
-
let p = node2.parent || { raws: {} };
|
|
1353
|
-
let childless = node2.type === "decl" || node2.type === "atrule" && !node2.nodes;
|
|
1354
|
-
if (!childless || node2 !== p.last || p.raws.semicolon) {
|
|
1355
|
-
if (node2.source && node2.source.end) {
|
|
1356
|
-
mapping.source = this.sourcePath(node2);
|
|
1357
|
-
mapping.original.line = node2.source.end.line;
|
|
1358
|
-
mapping.original.column = node2.source.end.column - 1;
|
|
1359
|
-
mapping.generated.line = line;
|
|
1360
|
-
mapping.generated.column = column - 2;
|
|
1361
|
-
this.map.addMapping(mapping);
|
|
1362
|
-
} else {
|
|
1363
|
-
mapping.source = noSource;
|
|
1364
|
-
mapping.original.line = 1;
|
|
1365
|
-
mapping.original.column = 0;
|
|
1366
|
-
mapping.generated.line = line;
|
|
1367
|
-
mapping.generated.column = column - 1;
|
|
1368
|
-
this.map.addMapping(mapping);
|
|
1369
|
-
}
|
|
1370
|
-
}
|
|
1371
|
-
}
|
|
1372
|
-
});
|
|
1414
|
+
getAnnotationURL(sourceMapString) {
|
|
1415
|
+
return sourceMapString.replace(/^\/\*\s*# sourceMappingURL=/, "").trim();
|
|
1373
1416
|
}
|
|
1374
|
-
|
|
1375
|
-
if (
|
|
1376
|
-
|
|
1377
|
-
}
|
|
1378
|
-
if (typeof this.mapOpts.annotation !== "undefined") {
|
|
1379
|
-
return this.mapOpts.annotation;
|
|
1380
|
-
}
|
|
1381
|
-
if (this.previous().length) {
|
|
1382
|
-
return this.previous().some((i) => i.annotation);
|
|
1383
|
-
}
|
|
1384
|
-
return true;
|
|
1417
|
+
isMap(map) {
|
|
1418
|
+
if (typeof map !== "object") return false;
|
|
1419
|
+
return typeof map.mappings === "string" || typeof map._mappings === "string" || Array.isArray(map.sections);
|
|
1385
1420
|
}
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
let
|
|
1391
|
-
if (
|
|
1392
|
-
|
|
1393
|
-
}
|
|
1394
|
-
if (this.previous().length) {
|
|
1395
|
-
return this.previous().some((i) => i.inline);
|
|
1421
|
+
loadAnnotation(css) {
|
|
1422
|
+
let comments = css.match(/\/\*\s*# sourceMappingURL=/g);
|
|
1423
|
+
if (!comments) return;
|
|
1424
|
+
let start = css.lastIndexOf(comments.pop());
|
|
1425
|
+
let end = css.indexOf("*/", start);
|
|
1426
|
+
if (start > -1 && end > -1) {
|
|
1427
|
+
this.annotation = this.getAnnotationURL(css.substring(start, end));
|
|
1396
1428
|
}
|
|
1397
|
-
return true;
|
|
1398
1429
|
}
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1430
|
+
loadFile(path) {
|
|
1431
|
+
this.root = dirname$1(path);
|
|
1432
|
+
if (existsSync(path)) {
|
|
1433
|
+
this.mapFile = path;
|
|
1434
|
+
return readFileSync(path, "utf-8").toString().trim();
|
|
1402
1435
|
}
|
|
1403
|
-
return this.previous().length > 0;
|
|
1404
1436
|
}
|
|
1405
|
-
|
|
1406
|
-
if (
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1437
|
+
loadMap(file, prev) {
|
|
1438
|
+
if (prev === false) return false;
|
|
1439
|
+
if (prev) {
|
|
1440
|
+
if (typeof prev === "string") {
|
|
1441
|
+
return prev;
|
|
1442
|
+
} else if (typeof prev === "function") {
|
|
1443
|
+
let prevPath = prev(file);
|
|
1444
|
+
if (prevPath) {
|
|
1445
|
+
let map = this.loadFile(prevPath);
|
|
1446
|
+
if (!map) {
|
|
1447
|
+
throw new Error(
|
|
1448
|
+
"Unable to load previous source map: " + prevPath.toString()
|
|
1449
|
+
);
|
|
1450
|
+
}
|
|
1451
|
+
return map;
|
|
1452
|
+
}
|
|
1453
|
+
} else if (prev instanceof SourceMapConsumer$2) {
|
|
1454
|
+
return SourceMapGenerator$2.fromSourceMap(prev).toString();
|
|
1455
|
+
} else if (prev instanceof SourceMapGenerator$2) {
|
|
1456
|
+
return prev.toString();
|
|
1457
|
+
} else if (this.isMap(prev)) {
|
|
1458
|
+
return JSON.stringify(prev);
|
|
1459
|
+
} else {
|
|
1460
|
+
throw new Error(
|
|
1461
|
+
"Unsupported previous source map format: " + prev.toString()
|
|
1462
|
+
);
|
|
1463
|
+
}
|
|
1464
|
+
} else if (this.inline) {
|
|
1465
|
+
return this.decodeInline(this.annotation);
|
|
1466
|
+
} else if (this.annotation) {
|
|
1467
|
+
let map = this.annotation;
|
|
1468
|
+
if (file) map = join(dirname$1(file), map);
|
|
1469
|
+
return this.loadFile(map);
|
|
1411
1470
|
}
|
|
1412
|
-
return true;
|
|
1413
1471
|
}
|
|
1414
|
-
|
|
1415
|
-
if (
|
|
1416
|
-
|
|
1417
|
-
} else if (this.opts.from) {
|
|
1418
|
-
return this.path(this.opts.from);
|
|
1419
|
-
} else {
|
|
1420
|
-
return "to.css";
|
|
1421
|
-
}
|
|
1472
|
+
startWith(string, start) {
|
|
1473
|
+
if (!string) return false;
|
|
1474
|
+
return string.substr(0, start.length) === start;
|
|
1422
1475
|
}
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
if (file.charCodeAt(0) === 60) return file;
|
|
1426
|
-
if (/^\w+:\/\//.test(file)) return file;
|
|
1427
|
-
let cached = this.memoizedPaths.get(file);
|
|
1428
|
-
if (cached) return cached;
|
|
1429
|
-
let from = this.opts.to ? dirname(this.opts.to) : ".";
|
|
1430
|
-
if (typeof this.mapOpts.annotation === "string") {
|
|
1431
|
-
from = dirname(resolve(from, this.mapOpts.annotation));
|
|
1432
|
-
}
|
|
1433
|
-
let path = relative(from, file);
|
|
1434
|
-
this.memoizedPaths.set(file, path);
|
|
1435
|
-
return path;
|
|
1476
|
+
withContent() {
|
|
1477
|
+
return !!(this.consumer().sourcesContent && this.consumer().sourcesContent.length > 0);
|
|
1436
1478
|
}
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1479
|
+
};
|
|
1480
|
+
var previousMap = PreviousMap$2;
|
|
1481
|
+
PreviousMap$2.default = PreviousMap$2;
|
|
1482
|
+
let { nanoid } = nonSecure;
|
|
1483
|
+
let { isAbsolute, resolve: resolve$1 } = require$$2;
|
|
1484
|
+
let { SourceMapConsumer: SourceMapConsumer$1, SourceMapGenerator: SourceMapGenerator$1 } = require$$2;
|
|
1485
|
+
let { fileURLToPath, pathToFileURL: pathToFileURL$1 } = require$$2;
|
|
1486
|
+
let CssSyntaxError$2 = cssSyntaxError;
|
|
1487
|
+
let PreviousMap$1 = previousMap;
|
|
1488
|
+
let terminalHighlight = require$$2;
|
|
1489
|
+
let fromOffsetCache = Symbol("fromOffsetCache");
|
|
1490
|
+
let sourceMapAvailable$1 = Boolean(SourceMapConsumer$1 && SourceMapGenerator$1);
|
|
1491
|
+
let pathAvailable$1 = Boolean(resolve$1 && isAbsolute);
|
|
1492
|
+
let Input$6 = class Input {
|
|
1493
|
+
constructor(css, opts = {}) {
|
|
1494
|
+
if (css === null || typeof css === "undefined" || typeof css === "object" && !css.toString) {
|
|
1495
|
+
throw new Error(`PostCSS received ${css} instead of CSS string`);
|
|
1496
|
+
}
|
|
1497
|
+
this.css = css.toString();
|
|
1498
|
+
if (this.css[0] === "\uFEFF" || this.css[0] === "\uFFFE") {
|
|
1499
|
+
this.hasBOM = true;
|
|
1500
|
+
this.css = this.css.slice(1);
|
|
1501
|
+
} else {
|
|
1502
|
+
this.hasBOM = false;
|
|
1503
|
+
}
|
|
1504
|
+
this.document = this.css;
|
|
1505
|
+
if (opts.document) this.document = opts.document.toString();
|
|
1506
|
+
if (opts.from) {
|
|
1507
|
+
if (!pathAvailable$1 || /^\w+:\/\//.test(opts.from) || isAbsolute(opts.from)) {
|
|
1508
|
+
this.file = opts.from;
|
|
1449
1509
|
} else {
|
|
1450
|
-
|
|
1451
|
-
if (input2.map) this.previousMaps.push(input2.map);
|
|
1510
|
+
this.file = resolve$1(opts.from);
|
|
1452
1511
|
}
|
|
1453
1512
|
}
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
let from = node2.source.input.from;
|
|
1462
|
-
if (from && !already[from]) {
|
|
1463
|
-
already[from] = true;
|
|
1464
|
-
let fromUrl = this.usesFileUrls ? this.toFileUrl(from) : this.toUrl(this.path(from));
|
|
1465
|
-
this.map.setSourceContent(fromUrl, node2.source.input.css);
|
|
1466
|
-
}
|
|
1467
|
-
}
|
|
1468
|
-
});
|
|
1469
|
-
} else if (this.css) {
|
|
1470
|
-
let from = this.opts.from ? this.toUrl(this.path(this.opts.from)) : "<no source>";
|
|
1471
|
-
this.map.setSourceContent(from, this.css);
|
|
1513
|
+
if (pathAvailable$1 && sourceMapAvailable$1) {
|
|
1514
|
+
let map = new PreviousMap$1(this.css, opts);
|
|
1515
|
+
if (map.text) {
|
|
1516
|
+
this.map = map;
|
|
1517
|
+
let file = map.consumer().file;
|
|
1518
|
+
if (!this.file && file) this.file = this.mapResolve(file);
|
|
1519
|
+
}
|
|
1472
1520
|
}
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
if (this.mapOpts.from) {
|
|
1476
|
-
return this.toUrl(this.mapOpts.from);
|
|
1477
|
-
} else if (this.usesFileUrls) {
|
|
1478
|
-
return this.toFileUrl(node2.source.input.from);
|
|
1479
|
-
} else {
|
|
1480
|
-
return this.toUrl(this.path(node2.source.input.from));
|
|
1521
|
+
if (!this.file) {
|
|
1522
|
+
this.id = "<input css " + nanoid(6) + ">";
|
|
1481
1523
|
}
|
|
1524
|
+
if (this.map) this.map.file = this.from;
|
|
1482
1525
|
}
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1526
|
+
error(message, line, column, opts = {}) {
|
|
1527
|
+
let endColumn, endLine, result2;
|
|
1528
|
+
if (line && typeof line === "object") {
|
|
1529
|
+
let start = line;
|
|
1530
|
+
let end = column;
|
|
1531
|
+
if (typeof start.offset === "number") {
|
|
1532
|
+
let pos = this.fromOffset(start.offset);
|
|
1533
|
+
line = pos.line;
|
|
1534
|
+
column = pos.col;
|
|
1535
|
+
} else {
|
|
1536
|
+
line = start.line;
|
|
1537
|
+
column = start.column;
|
|
1538
|
+
}
|
|
1539
|
+
if (typeof end.offset === "number") {
|
|
1540
|
+
let pos = this.fromOffset(end.offset);
|
|
1541
|
+
endLine = pos.line;
|
|
1542
|
+
endColumn = pos.col;
|
|
1543
|
+
} else {
|
|
1544
|
+
endLine = end.line;
|
|
1545
|
+
endColumn = end.column;
|
|
1546
|
+
}
|
|
1547
|
+
} else if (!column) {
|
|
1548
|
+
let pos = this.fromOffset(line);
|
|
1549
|
+
line = pos.line;
|
|
1550
|
+
column = pos.col;
|
|
1488
1551
|
}
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1552
|
+
let origin = this.origin(line, column, endLine, endColumn);
|
|
1553
|
+
if (origin) {
|
|
1554
|
+
result2 = new CssSyntaxError$2(
|
|
1555
|
+
message,
|
|
1556
|
+
origin.endLine === void 0 ? origin.line : { column: origin.column, line: origin.line },
|
|
1557
|
+
origin.endLine === void 0 ? origin.column : { column: origin.endColumn, line: origin.endLine },
|
|
1558
|
+
origin.source,
|
|
1559
|
+
origin.file,
|
|
1560
|
+
opts.plugin
|
|
1561
|
+
);
|
|
1497
1562
|
} else {
|
|
1498
|
-
|
|
1499
|
-
|
|
1563
|
+
result2 = new CssSyntaxError$2(
|
|
1564
|
+
message,
|
|
1565
|
+
endLine === void 0 ? line : { column, line },
|
|
1566
|
+
endLine === void 0 ? column : { column: endColumn, line: endLine },
|
|
1567
|
+
this.css,
|
|
1568
|
+
this.file,
|
|
1569
|
+
opts.plugin
|
|
1500
1570
|
);
|
|
1501
1571
|
}
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1572
|
+
result2.input = { column, endColumn, endLine, line, source: this.css };
|
|
1573
|
+
if (this.file) {
|
|
1574
|
+
if (pathToFileURL$1) {
|
|
1575
|
+
result2.input.url = pathToFileURL$1(this.file).toString();
|
|
1576
|
+
}
|
|
1577
|
+
result2.input.file = this.file;
|
|
1508
1578
|
}
|
|
1509
|
-
|
|
1510
|
-
this.memoizedURLs.set(path, url);
|
|
1511
|
-
return url;
|
|
1512
|
-
}
|
|
1513
|
-
};
|
|
1514
|
-
var mapGenerator = MapGenerator$2;
|
|
1515
|
-
let Node$2 = node;
|
|
1516
|
-
let Comment$4 = class Comment extends Node$2 {
|
|
1517
|
-
constructor(defaults) {
|
|
1518
|
-
super(defaults);
|
|
1519
|
-
this.type = "comment";
|
|
1579
|
+
return result2;
|
|
1520
1580
|
}
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
let
|
|
1525
|
-
|
|
1526
|
-
let
|
|
1527
|
-
let
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1581
|
+
fromOffset(offset) {
|
|
1582
|
+
let lastLine, lineToIndex;
|
|
1583
|
+
if (!this[fromOffsetCache]) {
|
|
1584
|
+
let lines = this.css.split("\n");
|
|
1585
|
+
lineToIndex = new Array(lines.length);
|
|
1586
|
+
let prevIndex = 0;
|
|
1587
|
+
for (let i = 0, l = lines.length; i < l; i++) {
|
|
1588
|
+
lineToIndex[i] = prevIndex;
|
|
1589
|
+
prevIndex += lines[i].length + 1;
|
|
1590
|
+
}
|
|
1591
|
+
this[fromOffsetCache] = lineToIndex;
|
|
1592
|
+
} else {
|
|
1593
|
+
lineToIndex = this[fromOffsetCache];
|
|
1594
|
+
}
|
|
1595
|
+
lastLine = lineToIndex[lineToIndex.length - 1];
|
|
1596
|
+
let min = 0;
|
|
1597
|
+
if (offset >= lastLine) {
|
|
1598
|
+
min = lineToIndex.length - 1;
|
|
1599
|
+
} else {
|
|
1600
|
+
let max = lineToIndex.length - 2;
|
|
1601
|
+
let mid;
|
|
1602
|
+
while (min < max) {
|
|
1603
|
+
mid = min + (max - min >> 1);
|
|
1604
|
+
if (offset < lineToIndex[mid]) {
|
|
1605
|
+
max = mid - 1;
|
|
1606
|
+
} else if (offset >= lineToIndex[mid + 1]) {
|
|
1607
|
+
min = mid + 1;
|
|
1608
|
+
} else {
|
|
1609
|
+
min = mid;
|
|
1610
|
+
break;
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1544
1613
|
}
|
|
1614
|
+
return {
|
|
1615
|
+
col: offset - lineToIndex[min] + 1,
|
|
1616
|
+
line: min + 1
|
|
1617
|
+
};
|
|
1545
1618
|
}
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
for (let child of children) {
|
|
1550
|
-
let nodes = this.normalize(child, this.last);
|
|
1551
|
-
for (let node2 of nodes) this.proxyOf.nodes.push(node2);
|
|
1619
|
+
mapResolve(file) {
|
|
1620
|
+
if (/^\w+:\/\//.test(file)) {
|
|
1621
|
+
return file;
|
|
1552
1622
|
}
|
|
1553
|
-
this.
|
|
1554
|
-
return this;
|
|
1623
|
+
return resolve$1(this.map.consumer().sourceRoot || this.map.root || ".", file);
|
|
1555
1624
|
}
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1625
|
+
origin(line, column, endLine, endColumn) {
|
|
1626
|
+
if (!this.map) return false;
|
|
1627
|
+
let consumer = this.map.consumer();
|
|
1628
|
+
let from = consumer.originalPositionFor({ column, line });
|
|
1629
|
+
if (!from.source) return false;
|
|
1630
|
+
let to;
|
|
1631
|
+
if (typeof endLine === "number") {
|
|
1632
|
+
to = consumer.originalPositionFor({ column: endColumn, line: endLine });
|
|
1560
1633
|
}
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
if (result2 === false) break;
|
|
1570
|
-
this.indexes[iterator] += 1;
|
|
1634
|
+
let fromUrl;
|
|
1635
|
+
if (isAbsolute(from.source)) {
|
|
1636
|
+
fromUrl = pathToFileURL$1(from.source);
|
|
1637
|
+
} else {
|
|
1638
|
+
fromUrl = new URL(
|
|
1639
|
+
from.source,
|
|
1640
|
+
this.map.consumer().sourceRoot || pathToFileURL$1(this.map.mapFile)
|
|
1641
|
+
);
|
|
1571
1642
|
}
|
|
1572
|
-
|
|
1643
|
+
let result2 = {
|
|
1644
|
+
column: from.column,
|
|
1645
|
+
endColumn: to && to.column,
|
|
1646
|
+
endLine: to && to.line,
|
|
1647
|
+
line: from.line,
|
|
1648
|
+
url: fromUrl.toString()
|
|
1649
|
+
};
|
|
1650
|
+
if (fromUrl.protocol === "file:") {
|
|
1651
|
+
if (fileURLToPath) {
|
|
1652
|
+
result2.file = fileURLToPath(fromUrl);
|
|
1653
|
+
} else {
|
|
1654
|
+
throw new Error(`file: protocol is not available in this PostCSS build`);
|
|
1655
|
+
}
|
|
1656
|
+
}
|
|
1657
|
+
let source = consumer.sourceContentFor(from.source);
|
|
1658
|
+
if (source) result2.source = source;
|
|
1573
1659
|
return result2;
|
|
1574
1660
|
}
|
|
1575
|
-
|
|
1576
|
-
|
|
1661
|
+
toJSON() {
|
|
1662
|
+
let json = {};
|
|
1663
|
+
for (let name of ["hasBOM", "css", "file", "id"]) {
|
|
1664
|
+
if (this[name] != null) {
|
|
1665
|
+
json[name] = this[name];
|
|
1666
|
+
}
|
|
1667
|
+
}
|
|
1668
|
+
if (this.map) {
|
|
1669
|
+
json.map = __spreadValues({}, this.map);
|
|
1670
|
+
if (json.map.consumerCache) {
|
|
1671
|
+
json.map.consumerCache = void 0;
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1674
|
+
return json;
|
|
1577
1675
|
}
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
if (!this.indexes) this.indexes = {};
|
|
1581
|
-
this.lastEach += 1;
|
|
1582
|
-
let iterator = this.lastEach;
|
|
1583
|
-
this.indexes[iterator] = 0;
|
|
1584
|
-
return iterator;
|
|
1676
|
+
get from() {
|
|
1677
|
+
return this.file || this.id;
|
|
1585
1678
|
}
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
return node2[prop](
|
|
1608
|
-
(child, ...other) => cb(child.toProxy(), ...other)
|
|
1609
|
-
);
|
|
1610
|
-
};
|
|
1611
|
-
} else if (prop === "root") {
|
|
1612
|
-
return () => node2.root().toProxy();
|
|
1613
|
-
} else if (prop === "nodes") {
|
|
1614
|
-
return node2.nodes.map((i) => i.toProxy());
|
|
1615
|
-
} else if (prop === "first" || prop === "last") {
|
|
1616
|
-
return node2[prop].toProxy();
|
|
1679
|
+
};
|
|
1680
|
+
var input = Input$6;
|
|
1681
|
+
Input$6.default = Input$6;
|
|
1682
|
+
if (terminalHighlight && terminalHighlight.registerInput) {
|
|
1683
|
+
terminalHighlight.registerInput(Input$6);
|
|
1684
|
+
}
|
|
1685
|
+
let Container$5 = container;
|
|
1686
|
+
let LazyResult$3;
|
|
1687
|
+
let Processor$3;
|
|
1688
|
+
let Root$6 = class Root extends Container$5 {
|
|
1689
|
+
constructor(defaults) {
|
|
1690
|
+
super(defaults);
|
|
1691
|
+
this.type = "root";
|
|
1692
|
+
if (!this.nodes) this.nodes = [];
|
|
1693
|
+
}
|
|
1694
|
+
normalize(child, sample, type) {
|
|
1695
|
+
let nodes = super.normalize(child);
|
|
1696
|
+
if (sample) {
|
|
1697
|
+
if (type === "prepend") {
|
|
1698
|
+
if (this.nodes.length > 1) {
|
|
1699
|
+
sample.raws.before = this.nodes[1].raws.before;
|
|
1617
1700
|
} else {
|
|
1618
|
-
|
|
1701
|
+
delete sample.raws.before;
|
|
1619
1702
|
}
|
|
1620
|
-
}
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
node2[prop] = value;
|
|
1624
|
-
if (prop === "name" || prop === "params" || prop === "selector") {
|
|
1625
|
-
node2.markDirty();
|
|
1703
|
+
} else if (this.first !== sample) {
|
|
1704
|
+
for (let node2 of nodes) {
|
|
1705
|
+
node2.raws.before = sample.raws.before;
|
|
1626
1706
|
}
|
|
1627
|
-
return true;
|
|
1628
|
-
}
|
|
1629
|
-
};
|
|
1630
|
-
}
|
|
1631
|
-
index(child) {
|
|
1632
|
-
if (typeof child === "number") return child;
|
|
1633
|
-
if (child.proxyOf) child = child.proxyOf;
|
|
1634
|
-
return this.proxyOf.nodes.indexOf(child);
|
|
1635
|
-
}
|
|
1636
|
-
insertAfter(exist, add) {
|
|
1637
|
-
let existIndex = this.index(exist);
|
|
1638
|
-
let nodes = this.normalize(add, this.proxyOf.nodes[existIndex]).reverse();
|
|
1639
|
-
existIndex = this.index(exist);
|
|
1640
|
-
for (let node2 of nodes) this.proxyOf.nodes.splice(existIndex + 1, 0, node2);
|
|
1641
|
-
let index2;
|
|
1642
|
-
for (let id in this.indexes) {
|
|
1643
|
-
index2 = this.indexes[id];
|
|
1644
|
-
if (existIndex < index2) {
|
|
1645
|
-
this.indexes[id] = index2 + nodes.length;
|
|
1646
1707
|
}
|
|
1647
1708
|
}
|
|
1648
|
-
|
|
1649
|
-
return this;
|
|
1709
|
+
return nodes;
|
|
1650
1710
|
}
|
|
1651
|
-
|
|
1652
|
-
let
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
existIndex = this.index(exist);
|
|
1656
|
-
for (let node2 of nodes) this.proxyOf.nodes.splice(existIndex, 0, node2);
|
|
1657
|
-
let index2;
|
|
1658
|
-
for (let id in this.indexes) {
|
|
1659
|
-
index2 = this.indexes[id];
|
|
1660
|
-
if (existIndex <= index2) {
|
|
1661
|
-
this.indexes[id] = index2 + nodes.length;
|
|
1662
|
-
}
|
|
1711
|
+
removeChild(child, ignore) {
|
|
1712
|
+
let index2 = this.index(child);
|
|
1713
|
+
if (!ignore && index2 === 0 && this.nodes.length > 1) {
|
|
1714
|
+
this.nodes[1].raws.before = this.nodes[index2].raws.before;
|
|
1663
1715
|
}
|
|
1664
|
-
|
|
1665
|
-
return this;
|
|
1716
|
+
return super.removeChild(child);
|
|
1666
1717
|
}
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
if (typeof i.raws.before === "undefined") {
|
|
1706
|
-
if (sample && typeof sample.raws.before !== "undefined") {
|
|
1707
|
-
i.raws.before = sample.raws.before.replace(/\S/g, "");
|
|
1718
|
+
toResult(opts = {}) {
|
|
1719
|
+
let lazy = new LazyResult$3(new Processor$3(), this, opts);
|
|
1720
|
+
return lazy.stringify();
|
|
1721
|
+
}
|
|
1722
|
+
};
|
|
1723
|
+
Root$6.registerLazyResult = (dependant) => {
|
|
1724
|
+
LazyResult$3 = dependant;
|
|
1725
|
+
};
|
|
1726
|
+
Root$6.registerProcessor = (dependant) => {
|
|
1727
|
+
Processor$3 = dependant;
|
|
1728
|
+
};
|
|
1729
|
+
var root$1 = Root$6;
|
|
1730
|
+
Root$6.default = Root$6;
|
|
1731
|
+
Container$5.registerRoot(Root$6);
|
|
1732
|
+
let list$3 = {
|
|
1733
|
+
comma(string) {
|
|
1734
|
+
return list$3.split(string, [","], true);
|
|
1735
|
+
},
|
|
1736
|
+
space(string) {
|
|
1737
|
+
let spaces = [" ", "\n", " "];
|
|
1738
|
+
return list$3.split(string, spaces);
|
|
1739
|
+
},
|
|
1740
|
+
split(string, separators, last) {
|
|
1741
|
+
let array = [];
|
|
1742
|
+
let current = "";
|
|
1743
|
+
let split = false;
|
|
1744
|
+
let func = 0;
|
|
1745
|
+
let inQuote = false;
|
|
1746
|
+
let prevQuote = "";
|
|
1747
|
+
let escape = false;
|
|
1748
|
+
for (let letter of string) {
|
|
1749
|
+
if (escape) {
|
|
1750
|
+
escape = false;
|
|
1751
|
+
} else if (letter === "\\") {
|
|
1752
|
+
escape = true;
|
|
1753
|
+
} else if (inQuote) {
|
|
1754
|
+
if (letter === prevQuote) {
|
|
1755
|
+
inQuote = false;
|
|
1708
1756
|
}
|
|
1757
|
+
} else if (letter === '"' || letter === "'") {
|
|
1758
|
+
inQuote = true;
|
|
1759
|
+
prevQuote = letter;
|
|
1760
|
+
} else if (letter === "(") {
|
|
1761
|
+
func += 1;
|
|
1762
|
+
} else if (letter === ")") {
|
|
1763
|
+
if (func > 0) func -= 1;
|
|
1764
|
+
} else if (func === 0) {
|
|
1765
|
+
if (separators.includes(letter)) split = true;
|
|
1709
1766
|
}
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
children = children.reverse();
|
|
1717
|
-
for (let child of children) {
|
|
1718
|
-
let nodes = this.normalize(child, this.first, "prepend").reverse();
|
|
1719
|
-
for (let node2 of nodes) this.proxyOf.nodes.unshift(node2);
|
|
1720
|
-
for (let id in this.indexes) {
|
|
1721
|
-
this.indexes[id] = this.indexes[id] + nodes.length;
|
|
1767
|
+
if (split) {
|
|
1768
|
+
if (current !== "") array.push(current.trim());
|
|
1769
|
+
current = "";
|
|
1770
|
+
split = false;
|
|
1771
|
+
} else {
|
|
1772
|
+
current += letter;
|
|
1722
1773
|
}
|
|
1723
1774
|
}
|
|
1724
|
-
|
|
1725
|
-
return
|
|
1775
|
+
if (last || current !== "") array.push(current.trim());
|
|
1776
|
+
return array;
|
|
1726
1777
|
}
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1778
|
+
};
|
|
1779
|
+
var list_1 = list$3;
|
|
1780
|
+
list$3.default = list$3;
|
|
1781
|
+
let Container$4 = container;
|
|
1782
|
+
let list$2 = list_1;
|
|
1783
|
+
let Rule$4 = class Rule extends Container$4 {
|
|
1784
|
+
constructor(defaults) {
|
|
1785
|
+
super(defaults);
|
|
1786
|
+
this.type = "rule";
|
|
1787
|
+
if (!this.nodes) this.nodes = [];
|
|
1731
1788
|
}
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
this.proxyOf.nodes = [];
|
|
1735
|
-
this.markDirty();
|
|
1736
|
-
return this;
|
|
1789
|
+
get selectors() {
|
|
1790
|
+
return list$2.comma(this.selector);
|
|
1737
1791
|
}
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
this.
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1792
|
+
set selectors(values) {
|
|
1793
|
+
let match = this.selector ? this.selector.match(/,\s*/) : null;
|
|
1794
|
+
let sep2 = match ? match[0] : "," + this.raw("between", "beforeOpen");
|
|
1795
|
+
this.selector = values.join(sep2);
|
|
1796
|
+
}
|
|
1797
|
+
};
|
|
1798
|
+
var rule$1 = Rule$4;
|
|
1799
|
+
Rule$4.default = Rule$4;
|
|
1800
|
+
Container$4.registerRule(Rule$4);
|
|
1801
|
+
let AtRule$3 = atRule$1;
|
|
1802
|
+
let Comment$4 = comment$1;
|
|
1803
|
+
let Declaration$3 = declaration;
|
|
1804
|
+
let Input$5 = input;
|
|
1805
|
+
let PreviousMap2 = previousMap;
|
|
1806
|
+
let Root$5 = root$1;
|
|
1807
|
+
let Rule$3 = rule$1;
|
|
1808
|
+
function fromJSON$2(json, inputs) {
|
|
1809
|
+
if (Array.isArray(json)) return json.map((n) => fromJSON$2(n));
|
|
1810
|
+
let _a = json, { inputs: ownInputs } = _a, defaults = __objRest(_a, ["inputs"]);
|
|
1811
|
+
if (ownInputs) {
|
|
1812
|
+
inputs = [];
|
|
1813
|
+
for (let input2 of ownInputs) {
|
|
1814
|
+
let inputHydrated = __spreadProps(__spreadValues({}, input2), { __proto__: Input$5.prototype });
|
|
1815
|
+
if (inputHydrated.map) {
|
|
1816
|
+
inputHydrated.map = __spreadProps(__spreadValues({}, inputHydrated.map), {
|
|
1817
|
+
__proto__: PreviousMap2.prototype
|
|
1818
|
+
});
|
|
1747
1819
|
}
|
|
1820
|
+
inputs.push(inputHydrated);
|
|
1748
1821
|
}
|
|
1749
|
-
this.markDirty();
|
|
1750
|
-
return this;
|
|
1751
1822
|
}
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1823
|
+
if (defaults.nodes) {
|
|
1824
|
+
defaults.nodes = json.nodes.map((n) => fromJSON$2(n, inputs));
|
|
1825
|
+
}
|
|
1826
|
+
if (defaults.source) {
|
|
1827
|
+
let _b = defaults.source, { inputId } = _b, source = __objRest(_b, ["inputId"]);
|
|
1828
|
+
defaults.source = source;
|
|
1829
|
+
if (inputId != null) {
|
|
1830
|
+
defaults.source.input = inputs[inputId];
|
|
1756
1831
|
}
|
|
1757
|
-
this.walkDecls((decl) => {
|
|
1758
|
-
if (opts.props && !opts.props.includes(decl.prop)) return;
|
|
1759
|
-
if (opts.fast && !decl.value.includes(opts.fast)) return;
|
|
1760
|
-
decl.value = decl.value.replace(pattern, callback);
|
|
1761
|
-
});
|
|
1762
|
-
this.markDirty();
|
|
1763
|
-
return this;
|
|
1764
1832
|
}
|
|
1765
|
-
|
|
1766
|
-
return
|
|
1833
|
+
if (defaults.type === "root") {
|
|
1834
|
+
return new Root$5(defaults);
|
|
1835
|
+
} else if (defaults.type === "decl") {
|
|
1836
|
+
return new Declaration$3(defaults);
|
|
1837
|
+
} else if (defaults.type === "rule") {
|
|
1838
|
+
return new Rule$3(defaults);
|
|
1839
|
+
} else if (defaults.type === "comment") {
|
|
1840
|
+
return new Comment$4(defaults);
|
|
1841
|
+
} else if (defaults.type === "atrule") {
|
|
1842
|
+
return new AtRule$3(defaults);
|
|
1843
|
+
} else {
|
|
1844
|
+
throw new Error("Unknown node type: " + json.type);
|
|
1767
1845
|
}
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1846
|
+
}
|
|
1847
|
+
var fromJSON_1 = fromJSON$2;
|
|
1848
|
+
fromJSON$2.default = fromJSON$2;
|
|
1849
|
+
let { dirname, relative, resolve, sep } = require$$2;
|
|
1850
|
+
let { SourceMapConsumer, SourceMapGenerator } = require$$2;
|
|
1851
|
+
let { pathToFileURL } = require$$2;
|
|
1852
|
+
let Input$4 = input;
|
|
1853
|
+
let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);
|
|
1854
|
+
let pathAvailable = Boolean(dirname && resolve && relative && sep);
|
|
1855
|
+
let MapGenerator$2 = class MapGenerator {
|
|
1856
|
+
constructor(stringify2, root2, opts, cssString) {
|
|
1857
|
+
this.stringify = stringify2;
|
|
1858
|
+
this.mapOpts = opts.map || {};
|
|
1859
|
+
this.root = root2;
|
|
1860
|
+
this.opts = opts;
|
|
1861
|
+
this.css = cssString;
|
|
1862
|
+
this.originalCSS = cssString;
|
|
1863
|
+
this.usesFileUrls = !this.mapOpts.from && this.mapOpts.absolute;
|
|
1864
|
+
this.memoizedFileURLs = /* @__PURE__ */ new Map();
|
|
1865
|
+
this.memoizedPaths = /* @__PURE__ */ new Map();
|
|
1866
|
+
this.memoizedURLs = /* @__PURE__ */ new Map();
|
|
1867
|
+
}
|
|
1868
|
+
addAnnotation() {
|
|
1869
|
+
let content;
|
|
1870
|
+
if (this.isInline()) {
|
|
1871
|
+
content = "data:application/json;base64," + this.toBase64(this.map.toString());
|
|
1872
|
+
} else if (typeof this.mapOpts.annotation === "string") {
|
|
1873
|
+
content = this.mapOpts.annotation;
|
|
1874
|
+
} else if (typeof this.mapOpts.annotation === "function") {
|
|
1875
|
+
content = this.mapOpts.annotation(this.opts.to, this.root);
|
|
1876
|
+
} else {
|
|
1877
|
+
content = this.outputFile() + ".map";
|
|
1878
|
+
}
|
|
1879
|
+
let eol = "\n";
|
|
1880
|
+
if (this.css.includes("\r\n")) eol = "\r\n";
|
|
1881
|
+
this.css += eol + "/*# sourceMappingURL=" + content + " */";
|
|
1882
|
+
}
|
|
1883
|
+
applyPrevMaps() {
|
|
1884
|
+
for (let prev of this.previous()) {
|
|
1885
|
+
let from = this.toUrl(this.path(prev.file));
|
|
1886
|
+
let root2 = prev.root || dirname(prev.file);
|
|
1887
|
+
let map;
|
|
1888
|
+
if (this.mapOpts.sourcesContent === false) {
|
|
1889
|
+
map = new SourceMapConsumer(prev.text);
|
|
1890
|
+
if (map.sourcesContent) {
|
|
1891
|
+
map.sourcesContent = null;
|
|
1892
|
+
}
|
|
1893
|
+
} else {
|
|
1894
|
+
map = prev.consumer();
|
|
1778
1895
|
}
|
|
1779
|
-
|
|
1780
|
-
}
|
|
1896
|
+
this.map.applySourceMap(map, from, this.toUrl(this.path(root2)));
|
|
1897
|
+
}
|
|
1781
1898
|
}
|
|
1782
|
-
|
|
1783
|
-
if (
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1899
|
+
clearAnnotation() {
|
|
1900
|
+
if (this.mapOpts.annotation === false) return;
|
|
1901
|
+
if (this.root) {
|
|
1902
|
+
let node2;
|
|
1903
|
+
for (let i = this.root.nodes.length - 1; i >= 0; i--) {
|
|
1904
|
+
node2 = this.root.nodes[i];
|
|
1905
|
+
if (node2.type !== "comment") continue;
|
|
1906
|
+
if (node2.text.startsWith("# sourceMappingURL=")) {
|
|
1907
|
+
this.root.removeChild(i);
|
|
1788
1908
|
}
|
|
1909
|
+
}
|
|
1910
|
+
} else if (this.css) {
|
|
1911
|
+
this.css = this.css.replace(/\n*\/\*#[\S\s]*?\*\/$/gm, "");
|
|
1912
|
+
}
|
|
1913
|
+
}
|
|
1914
|
+
generate() {
|
|
1915
|
+
this.clearAnnotation();
|
|
1916
|
+
if (pathAvailable && sourceMapAvailable && this.isMap()) {
|
|
1917
|
+
return this.generateMap();
|
|
1918
|
+
} else {
|
|
1919
|
+
let result2 = "";
|
|
1920
|
+
this.stringify(this.root, (i) => {
|
|
1921
|
+
result2 += i;
|
|
1789
1922
|
});
|
|
1923
|
+
return [result2];
|
|
1790
1924
|
}
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1925
|
+
}
|
|
1926
|
+
generateMap() {
|
|
1927
|
+
if (this.root) {
|
|
1928
|
+
this.generateString();
|
|
1929
|
+
} else if (this.previous().length === 1) {
|
|
1930
|
+
let prev = this.previous()[0].consumer();
|
|
1931
|
+
prev.file = this.outputFile();
|
|
1932
|
+
this.map = SourceMapGenerator.fromSourceMap(prev, {
|
|
1933
|
+
ignoreInvalidMapping: true
|
|
1934
|
+
});
|
|
1935
|
+
} else {
|
|
1936
|
+
this.map = new SourceMapGenerator({
|
|
1937
|
+
file: this.outputFile(),
|
|
1938
|
+
ignoreInvalidMapping: true
|
|
1939
|
+
});
|
|
1940
|
+
this.map.addMapping({
|
|
1941
|
+
generated: { column: 0, line: 1 },
|
|
1942
|
+
original: { column: 0, line: 1 },
|
|
1943
|
+
source: this.opts.from ? this.toUrl(this.path(this.opts.from)) : "<no source>"
|
|
1796
1944
|
});
|
|
1797
1945
|
}
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1946
|
+
if (this.isSourcesContent()) this.setSourcesContent();
|
|
1947
|
+
if (this.root && this.previous().length > 0) this.applyPrevMaps();
|
|
1948
|
+
if (this.isAnnotation()) this.addAnnotation();
|
|
1949
|
+
if (this.isInline()) {
|
|
1950
|
+
return [this.css];
|
|
1951
|
+
} else {
|
|
1952
|
+
return [this.css, this.map];
|
|
1953
|
+
}
|
|
1954
|
+
}
|
|
1955
|
+
generateString() {
|
|
1956
|
+
this.css = "";
|
|
1957
|
+
this.map = new SourceMapGenerator({
|
|
1958
|
+
file: this.outputFile(),
|
|
1959
|
+
ignoreInvalidMapping: true
|
|
1960
|
+
});
|
|
1961
|
+
let line = 1;
|
|
1962
|
+
let column = 1;
|
|
1963
|
+
let noSource = "<no source>";
|
|
1964
|
+
let mapping = {
|
|
1965
|
+
generated: { column: 0, line: 0 },
|
|
1966
|
+
original: { column: 0, line: 0 },
|
|
1967
|
+
source: ""
|
|
1968
|
+
};
|
|
1969
|
+
let last, lines;
|
|
1970
|
+
this.stringify(this.root, (str, node2, type) => {
|
|
1971
|
+
this.css += str;
|
|
1972
|
+
if (node2 && type !== "end") {
|
|
1973
|
+
mapping.generated.line = line;
|
|
1974
|
+
mapping.generated.column = column - 1;
|
|
1975
|
+
if (node2.source && node2.source.start) {
|
|
1976
|
+
mapping.source = this.sourcePath(node2);
|
|
1977
|
+
mapping.original.line = node2.source.start.line;
|
|
1978
|
+
mapping.original.column = node2.source.start.column - 1;
|
|
1979
|
+
this.map.addMapping(mapping);
|
|
1980
|
+
} else {
|
|
1981
|
+
mapping.source = noSource;
|
|
1982
|
+
mapping.original.line = 1;
|
|
1983
|
+
mapping.original.column = 0;
|
|
1984
|
+
this.map.addMapping(mapping);
|
|
1985
|
+
}
|
|
1801
1986
|
}
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1987
|
+
lines = str.match(/\n/g);
|
|
1988
|
+
if (lines) {
|
|
1989
|
+
line += lines.length;
|
|
1990
|
+
last = str.lastIndexOf("\n");
|
|
1991
|
+
column = str.length - last;
|
|
1992
|
+
} else {
|
|
1993
|
+
column += str.length;
|
|
1808
1994
|
}
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1995
|
+
if (node2 && type !== "start") {
|
|
1996
|
+
let p = node2.parent || { raws: {} };
|
|
1997
|
+
let childless = node2.type === "decl" || node2.type === "atrule" && !node2.nodes;
|
|
1998
|
+
if (!childless || node2 !== p.last || p.raws.semicolon) {
|
|
1999
|
+
if (node2.source && node2.source.end) {
|
|
2000
|
+
mapping.source = this.sourcePath(node2);
|
|
2001
|
+
mapping.original.line = node2.source.end.line;
|
|
2002
|
+
mapping.original.column = node2.source.end.column - 1;
|
|
2003
|
+
mapping.generated.line = line;
|
|
2004
|
+
mapping.generated.column = column - 2;
|
|
2005
|
+
this.map.addMapping(mapping);
|
|
2006
|
+
} else {
|
|
2007
|
+
mapping.source = noSource;
|
|
2008
|
+
mapping.original.line = 1;
|
|
2009
|
+
mapping.original.column = 0;
|
|
2010
|
+
mapping.generated.line = line;
|
|
2011
|
+
mapping.generated.column = column - 1;
|
|
2012
|
+
this.map.addMapping(mapping);
|
|
2013
|
+
}
|
|
1824
2014
|
}
|
|
1825
|
-
});
|
|
1826
|
-
}
|
|
1827
|
-
return this.walk((child, i) => {
|
|
1828
|
-
if (child.type === "decl" && child.prop === prop) {
|
|
1829
|
-
return callback(child, i);
|
|
1830
2015
|
}
|
|
1831
2016
|
});
|
|
1832
2017
|
}
|
|
1833
|
-
|
|
1834
|
-
if (
|
|
1835
|
-
|
|
1836
|
-
return this.walk((child, i) => {
|
|
1837
|
-
if (child.type === "rule") {
|
|
1838
|
-
return callback(child, i);
|
|
1839
|
-
}
|
|
1840
|
-
});
|
|
2018
|
+
isAnnotation() {
|
|
2019
|
+
if (this.isInline()) {
|
|
2020
|
+
return true;
|
|
1841
2021
|
}
|
|
1842
|
-
if (
|
|
1843
|
-
return this.
|
|
1844
|
-
if (child.type === "rule" && selector.test(child.selector)) {
|
|
1845
|
-
return callback(child, i);
|
|
1846
|
-
}
|
|
1847
|
-
});
|
|
2022
|
+
if (typeof this.mapOpts.annotation !== "undefined") {
|
|
2023
|
+
return this.mapOpts.annotation;
|
|
1848
2024
|
}
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
});
|
|
1854
|
-
}
|
|
1855
|
-
get first() {
|
|
1856
|
-
if (!this.proxyOf.nodes) return void 0;
|
|
1857
|
-
return this.proxyOf.nodes[0];
|
|
1858
|
-
}
|
|
1859
|
-
get last() {
|
|
1860
|
-
if (!this.proxyOf.nodes) return void 0;
|
|
1861
|
-
return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
|
|
1862
|
-
}
|
|
1863
|
-
};
|
|
1864
|
-
Container$7.registerParse = (dependant) => {
|
|
1865
|
-
parse$4 = dependant;
|
|
1866
|
-
};
|
|
1867
|
-
Container$7.registerRule = (dependant) => {
|
|
1868
|
-
Rule$4 = dependant;
|
|
1869
|
-
};
|
|
1870
|
-
Container$7.registerAtRule = (dependant) => {
|
|
1871
|
-
AtRule$4 = dependant;
|
|
1872
|
-
};
|
|
1873
|
-
Container$7.registerRoot = (dependant) => {
|
|
1874
|
-
Root$6 = dependant;
|
|
1875
|
-
};
|
|
1876
|
-
var container = Container$7;
|
|
1877
|
-
Container$7.default = Container$7;
|
|
1878
|
-
Container$7.rebuild = (node2) => {
|
|
1879
|
-
if (node2.type === "atrule") {
|
|
1880
|
-
Object.setPrototypeOf(node2, AtRule$4.prototype);
|
|
1881
|
-
} else if (node2.type === "rule") {
|
|
1882
|
-
Object.setPrototypeOf(node2, Rule$4.prototype);
|
|
1883
|
-
} else if (node2.type === "decl") {
|
|
1884
|
-
Object.setPrototypeOf(node2, Declaration$3.prototype);
|
|
1885
|
-
} else if (node2.type === "comment") {
|
|
1886
|
-
Object.setPrototypeOf(node2, Comment$3.prototype);
|
|
1887
|
-
} else if (node2.type === "root") {
|
|
1888
|
-
Object.setPrototypeOf(node2, Root$6.prototype);
|
|
1889
|
-
}
|
|
1890
|
-
node2[my$1] = true;
|
|
1891
|
-
if (node2.nodes) {
|
|
1892
|
-
node2.nodes.forEach((child) => {
|
|
1893
|
-
Container$7.rebuild(child);
|
|
1894
|
-
});
|
|
2025
|
+
if (this.previous().length) {
|
|
2026
|
+
return this.previous().some((i) => i.annotation);
|
|
2027
|
+
}
|
|
2028
|
+
return true;
|
|
1895
2029
|
}
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
let
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
2030
|
+
isInline() {
|
|
2031
|
+
if (typeof this.mapOpts.inline !== "undefined") {
|
|
2032
|
+
return this.mapOpts.inline;
|
|
2033
|
+
}
|
|
2034
|
+
let annotation = this.mapOpts.annotation;
|
|
2035
|
+
if (typeof annotation !== "undefined" && annotation !== true) {
|
|
2036
|
+
return false;
|
|
2037
|
+
}
|
|
2038
|
+
if (this.previous().length) {
|
|
2039
|
+
return this.previous().some((i) => i.inline);
|
|
1905
2040
|
}
|
|
2041
|
+
return true;
|
|
1906
2042
|
}
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
2043
|
+
isMap() {
|
|
2044
|
+
if (typeof this.opts.map !== "undefined") {
|
|
2045
|
+
return !!this.opts.map;
|
|
2046
|
+
}
|
|
2047
|
+
return this.previous().length > 0;
|
|
1910
2048
|
}
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
}
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
}
|
|
1918
|
-
|
|
1919
|
-
Document$3.default = Document$3;
|
|
1920
|
-
let printed = {};
|
|
1921
|
-
var warnOnce$2 = function warnOnce(message) {
|
|
1922
|
-
if (printed[message]) return;
|
|
1923
|
-
printed[message] = true;
|
|
1924
|
-
if (typeof console !== "undefined" && console.warn) {
|
|
1925
|
-
console.warn(message);
|
|
2049
|
+
isSourcesContent() {
|
|
2050
|
+
if (typeof this.mapOpts.sourcesContent !== "undefined") {
|
|
2051
|
+
return this.mapOpts.sourcesContent;
|
|
2052
|
+
}
|
|
2053
|
+
if (this.previous().length) {
|
|
2054
|
+
return this.previous().some((i) => i.withContent());
|
|
2055
|
+
}
|
|
2056
|
+
return true;
|
|
1926
2057
|
}
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
this.
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
this.line = range.start.line;
|
|
1935
|
-
this.column = range.start.column;
|
|
1936
|
-
this.endLine = range.end.line;
|
|
1937
|
-
this.endColumn = range.end.column;
|
|
2058
|
+
outputFile() {
|
|
2059
|
+
if (this.opts.to) {
|
|
2060
|
+
return this.path(this.opts.to);
|
|
2061
|
+
} else if (this.opts.from) {
|
|
2062
|
+
return this.path(this.opts.from);
|
|
2063
|
+
} else {
|
|
2064
|
+
return "to.css";
|
|
1938
2065
|
}
|
|
1939
|
-
for (let opt in opts) this[opt] = opts[opt];
|
|
1940
2066
|
}
|
|
1941
|
-
|
|
1942
|
-
if (this.
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
2067
|
+
path(file) {
|
|
2068
|
+
if (this.mapOpts.absolute) return file;
|
|
2069
|
+
if (file.charCodeAt(0) === 60) return file;
|
|
2070
|
+
if (/^\w+:\/\//.test(file)) return file;
|
|
2071
|
+
let cached = this.memoizedPaths.get(file);
|
|
2072
|
+
if (cached) return cached;
|
|
2073
|
+
let from = this.opts.to ? dirname(this.opts.to) : ".";
|
|
2074
|
+
if (typeof this.mapOpts.annotation === "string") {
|
|
2075
|
+
from = dirname(resolve(from, this.mapOpts.annotation));
|
|
1948
2076
|
}
|
|
1949
|
-
|
|
1950
|
-
|
|
2077
|
+
let path = relative(from, file);
|
|
2078
|
+
this.memoizedPaths.set(file, path);
|
|
2079
|
+
return path;
|
|
2080
|
+
}
|
|
2081
|
+
previous() {
|
|
2082
|
+
if (!this.previousMaps) {
|
|
2083
|
+
this.previousMaps = [];
|
|
2084
|
+
if (this.root) {
|
|
2085
|
+
this.root.walk((node2) => {
|
|
2086
|
+
if (node2.source && node2.source.input.map) {
|
|
2087
|
+
let map = node2.source.input.map;
|
|
2088
|
+
if (!this.previousMaps.includes(map)) {
|
|
2089
|
+
this.previousMaps.push(map);
|
|
2090
|
+
}
|
|
2091
|
+
}
|
|
2092
|
+
});
|
|
2093
|
+
} else {
|
|
2094
|
+
let input2 = new Input$4(this.originalCSS, this.opts);
|
|
2095
|
+
if (input2.map) this.previousMaps.push(input2.map);
|
|
2096
|
+
}
|
|
1951
2097
|
}
|
|
1952
|
-
return this.
|
|
2098
|
+
return this.previousMaps;
|
|
1953
2099
|
}
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
2100
|
+
setSourcesContent() {
|
|
2101
|
+
let already = {};
|
|
2102
|
+
if (this.root) {
|
|
2103
|
+
this.root.walk((node2) => {
|
|
2104
|
+
if (node2.source) {
|
|
2105
|
+
let from = node2.source.input.from;
|
|
2106
|
+
if (from && !already[from]) {
|
|
2107
|
+
already[from] = true;
|
|
2108
|
+
let fromUrl = this.usesFileUrls ? this.toFileUrl(from) : this.toUrl(this.path(from));
|
|
2109
|
+
this.map.setSourceContent(fromUrl, node2.source.input.css);
|
|
2110
|
+
}
|
|
2111
|
+
}
|
|
2112
|
+
});
|
|
2113
|
+
} else if (this.css) {
|
|
2114
|
+
let from = this.opts.from ? this.toUrl(this.path(this.opts.from)) : "<no source>";
|
|
2115
|
+
this.map.setSourceContent(from, this.css);
|
|
2116
|
+
}
|
|
1966
2117
|
}
|
|
1967
|
-
|
|
1968
|
-
|
|
2118
|
+
sourcePath(node2) {
|
|
2119
|
+
if (this.mapOpts.from) {
|
|
2120
|
+
return this.toUrl(this.mapOpts.from);
|
|
2121
|
+
} else if (this.usesFileUrls) {
|
|
2122
|
+
return this.toFileUrl(node2.source.input.from);
|
|
2123
|
+
} else {
|
|
2124
|
+
return this.toUrl(this.path(node2.source.input.from));
|
|
2125
|
+
}
|
|
1969
2126
|
}
|
|
1970
|
-
|
|
1971
|
-
if (
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
2127
|
+
toBase64(str) {
|
|
2128
|
+
if (Buffer) {
|
|
2129
|
+
return Buffer.from(str).toString("base64");
|
|
2130
|
+
} else {
|
|
2131
|
+
return window.btoa(unescape(encodeURIComponent(str)));
|
|
1975
2132
|
}
|
|
1976
|
-
let warning2 = new Warning$1(text, opts);
|
|
1977
|
-
this.messages.push(warning2);
|
|
1978
|
-
return warning2;
|
|
1979
2133
|
}
|
|
1980
|
-
|
|
1981
|
-
|
|
2134
|
+
toFileUrl(path) {
|
|
2135
|
+
let cached = this.memoizedFileURLs.get(path);
|
|
2136
|
+
if (cached) return cached;
|
|
2137
|
+
if (pathToFileURL) {
|
|
2138
|
+
let fileURL = pathToFileURL(path).toString();
|
|
2139
|
+
this.memoizedFileURLs.set(path, fileURL);
|
|
2140
|
+
return fileURL;
|
|
2141
|
+
} else {
|
|
2142
|
+
throw new Error(
|
|
2143
|
+
"`map.absolute` option is not available in this PostCSS build"
|
|
2144
|
+
);
|
|
2145
|
+
}
|
|
1982
2146
|
}
|
|
1983
|
-
|
|
1984
|
-
|
|
2147
|
+
toUrl(path) {
|
|
2148
|
+
let cached = this.memoizedURLs.get(path);
|
|
2149
|
+
if (cached) return cached;
|
|
2150
|
+
if (sep === "\\") {
|
|
2151
|
+
path = path.replace(/\\/g, "/");
|
|
2152
|
+
}
|
|
2153
|
+
let url = encodeURI(path).replace(/[#?]/g, encodeURIComponent);
|
|
2154
|
+
this.memoizedURLs.set(path, url);
|
|
2155
|
+
return url;
|
|
1985
2156
|
}
|
|
1986
2157
|
};
|
|
1987
|
-
var
|
|
1988
|
-
Result$3.default = Result$3;
|
|
2158
|
+
var mapGenerator = MapGenerator$2;
|
|
1989
2159
|
const SINGLE_QUOTE = "'".charCodeAt(0);
|
|
1990
2160
|
const DOUBLE_QUOTE = '"'.charCodeAt(0);
|
|
1991
2161
|
const BACKSLASH = "\\".charCodeAt(0);
|
|
@@ -2012,8 +2182,8 @@ const RE_HEX_ESCAPE = /[\da-f]/i;
|
|
|
2012
2182
|
var tokenize = function tokenizer(input2, options = {}) {
|
|
2013
2183
|
let css = input2.css.valueOf();
|
|
2014
2184
|
let ignore = options.ignoreErrors;
|
|
2015
|
-
let code,
|
|
2016
|
-
let escaped, escapePos,
|
|
2185
|
+
let code, content, escape, next, quote;
|
|
2186
|
+
let currentToken, escaped, escapePos, n, prev;
|
|
2017
2187
|
let length = css.length;
|
|
2018
2188
|
let pos = 0;
|
|
2019
2189
|
let buffer = [];
|
|
@@ -2194,146 +2364,12 @@ var tokenize = function tokenizer(input2, options = {}) {
|
|
|
2194
2364
|
position
|
|
2195
2365
|
};
|
|
2196
2366
|
};
|
|
2197
|
-
let
|
|
2198
|
-
let
|
|
2199
|
-
constructor(defaults) {
|
|
2200
|
-
super(defaults);
|
|
2201
|
-
this.type = "atrule";
|
|
2202
|
-
}
|
|
2203
|
-
append(...children) {
|
|
2204
|
-
if (!this.proxyOf.nodes) this.nodes = [];
|
|
2205
|
-
return super.append(...children);
|
|
2206
|
-
}
|
|
2207
|
-
prepend(...children) {
|
|
2208
|
-
if (!this.proxyOf.nodes) this.nodes = [];
|
|
2209
|
-
return super.prepend(...children);
|
|
2210
|
-
}
|
|
2211
|
-
};
|
|
2212
|
-
var atRule = AtRule$3;
|
|
2213
|
-
AtRule$3.default = AtRule$3;
|
|
2214
|
-
Container$5.registerAtRule(AtRule$3);
|
|
2215
|
-
let Container$4 = container;
|
|
2216
|
-
let LazyResult$3;
|
|
2217
|
-
let Processor$2;
|
|
2218
|
-
let Root$5 = class Root extends Container$4 {
|
|
2219
|
-
constructor(defaults) {
|
|
2220
|
-
super(defaults);
|
|
2221
|
-
this.type = "root";
|
|
2222
|
-
if (!this.nodes) this.nodes = [];
|
|
2223
|
-
}
|
|
2224
|
-
normalize(child, sample, type) {
|
|
2225
|
-
let nodes = super.normalize(child);
|
|
2226
|
-
if (sample) {
|
|
2227
|
-
if (type === "prepend") {
|
|
2228
|
-
if (this.nodes.length > 1) {
|
|
2229
|
-
sample.raws.before = this.nodes[1].raws.before;
|
|
2230
|
-
} else {
|
|
2231
|
-
delete sample.raws.before;
|
|
2232
|
-
}
|
|
2233
|
-
} else if (this.first !== sample) {
|
|
2234
|
-
for (let node2 of nodes) {
|
|
2235
|
-
node2.raws.before = sample.raws.before;
|
|
2236
|
-
}
|
|
2237
|
-
}
|
|
2238
|
-
}
|
|
2239
|
-
return nodes;
|
|
2240
|
-
}
|
|
2241
|
-
removeChild(child, ignore) {
|
|
2242
|
-
let index2 = this.index(child);
|
|
2243
|
-
if (!ignore && index2 === 0 && this.nodes.length > 1) {
|
|
2244
|
-
this.nodes[1].raws.before = this.nodes[index2].raws.before;
|
|
2245
|
-
}
|
|
2246
|
-
return super.removeChild(child);
|
|
2247
|
-
}
|
|
2248
|
-
toResult(opts = {}) {
|
|
2249
|
-
let lazy = new LazyResult$3(new Processor$2(), this, opts);
|
|
2250
|
-
return lazy.stringify();
|
|
2251
|
-
}
|
|
2252
|
-
};
|
|
2253
|
-
Root$5.registerLazyResult = (dependant) => {
|
|
2254
|
-
LazyResult$3 = dependant;
|
|
2255
|
-
};
|
|
2256
|
-
Root$5.registerProcessor = (dependant) => {
|
|
2257
|
-
Processor$2 = dependant;
|
|
2258
|
-
};
|
|
2259
|
-
var root = Root$5;
|
|
2260
|
-
Root$5.default = Root$5;
|
|
2261
|
-
Container$4.registerRoot(Root$5);
|
|
2262
|
-
let list$2 = {
|
|
2263
|
-
comma(string) {
|
|
2264
|
-
return list$2.split(string, [","], true);
|
|
2265
|
-
},
|
|
2266
|
-
space(string) {
|
|
2267
|
-
let spaces = [" ", "\n", " "];
|
|
2268
|
-
return list$2.split(string, spaces);
|
|
2269
|
-
},
|
|
2270
|
-
split(string, separators, last) {
|
|
2271
|
-
let array = [];
|
|
2272
|
-
let current = "";
|
|
2273
|
-
let split = false;
|
|
2274
|
-
let func = 0;
|
|
2275
|
-
let inQuote = false;
|
|
2276
|
-
let prevQuote = "";
|
|
2277
|
-
let escape = false;
|
|
2278
|
-
for (let letter of string) {
|
|
2279
|
-
if (escape) {
|
|
2280
|
-
escape = false;
|
|
2281
|
-
} else if (letter === "\\") {
|
|
2282
|
-
escape = true;
|
|
2283
|
-
} else if (inQuote) {
|
|
2284
|
-
if (letter === prevQuote) {
|
|
2285
|
-
inQuote = false;
|
|
2286
|
-
}
|
|
2287
|
-
} else if (letter === '"' || letter === "'") {
|
|
2288
|
-
inQuote = true;
|
|
2289
|
-
prevQuote = letter;
|
|
2290
|
-
} else if (letter === "(") {
|
|
2291
|
-
func += 1;
|
|
2292
|
-
} else if (letter === ")") {
|
|
2293
|
-
if (func > 0) func -= 1;
|
|
2294
|
-
} else if (func === 0) {
|
|
2295
|
-
if (separators.includes(letter)) split = true;
|
|
2296
|
-
}
|
|
2297
|
-
if (split) {
|
|
2298
|
-
if (current !== "") array.push(current.trim());
|
|
2299
|
-
current = "";
|
|
2300
|
-
split = false;
|
|
2301
|
-
} else {
|
|
2302
|
-
current += letter;
|
|
2303
|
-
}
|
|
2304
|
-
}
|
|
2305
|
-
if (last || current !== "") array.push(current.trim());
|
|
2306
|
-
return array;
|
|
2307
|
-
}
|
|
2308
|
-
};
|
|
2309
|
-
var list_1 = list$2;
|
|
2310
|
-
list$2.default = list$2;
|
|
2311
|
-
let Container$3 = container;
|
|
2312
|
-
let list$1 = list_1;
|
|
2313
|
-
let Rule$3 = class Rule extends Container$3 {
|
|
2314
|
-
constructor(defaults) {
|
|
2315
|
-
super(defaults);
|
|
2316
|
-
this.type = "rule";
|
|
2317
|
-
if (!this.nodes) this.nodes = [];
|
|
2318
|
-
}
|
|
2319
|
-
get selectors() {
|
|
2320
|
-
return list$1.comma(this.selector);
|
|
2321
|
-
}
|
|
2322
|
-
set selectors(values) {
|
|
2323
|
-
let match = this.selector ? this.selector.match(/,\s*/) : null;
|
|
2324
|
-
let sep2 = match ? match[0] : "," + this.raw("between", "beforeOpen");
|
|
2325
|
-
this.selector = values.join(sep2);
|
|
2326
|
-
}
|
|
2327
|
-
};
|
|
2328
|
-
var rule = Rule$3;
|
|
2329
|
-
Rule$3.default = Rule$3;
|
|
2330
|
-
Container$3.registerRule(Rule$3);
|
|
2367
|
+
let AtRule$2 = atRule$1;
|
|
2368
|
+
let Comment$3 = comment$1;
|
|
2331
2369
|
let Declaration$2 = declaration;
|
|
2332
|
-
let
|
|
2333
|
-
let
|
|
2334
|
-
let
|
|
2335
|
-
let Root$4 = root;
|
|
2336
|
-
let Rule$2 = rule;
|
|
2370
|
+
let Root$4 = root$1;
|
|
2371
|
+
let Rule$2 = rule$1;
|
|
2372
|
+
let tokenizer$1 = tokenize;
|
|
2337
2373
|
const SAFE_COMMENT_NEIGHBOR = {
|
|
2338
2374
|
empty: true,
|
|
2339
2375
|
space: true
|
|
@@ -2345,7 +2381,7 @@ function findLastWithPosition(tokens) {
|
|
|
2345
2381
|
if (pos) return pos;
|
|
2346
2382
|
}
|
|
2347
2383
|
}
|
|
2348
|
-
let Parser$
|
|
2384
|
+
let Parser$2 = class Parser {
|
|
2349
2385
|
constructor(input2) {
|
|
2350
2386
|
this.input = input2;
|
|
2351
2387
|
this.root = new Root$4();
|
|
@@ -2452,7 +2488,7 @@ let Parser$1 = class Parser {
|
|
|
2452
2488
|
}
|
|
2453
2489
|
colon(tokens) {
|
|
2454
2490
|
let brackets = 0;
|
|
2455
|
-
let token, type
|
|
2491
|
+
let prev, token, type;
|
|
2456
2492
|
for (let [i, element] of tokens.entries()) {
|
|
2457
2493
|
token = element;
|
|
2458
2494
|
type = token[0];
|
|
@@ -2476,7 +2512,7 @@ let Parser$1 = class Parser {
|
|
|
2476
2512
|
return false;
|
|
2477
2513
|
}
|
|
2478
2514
|
comment(token) {
|
|
2479
|
-
let node2 = new Comment$
|
|
2515
|
+
let node2 = new Comment$3();
|
|
2480
2516
|
this.init(node2, token[2]);
|
|
2481
2517
|
node2.source.end = this.getPosition(token[3] || token[2]);
|
|
2482
2518
|
node2.source.end.offset++;
|
|
@@ -2493,7 +2529,7 @@ let Parser$1 = class Parser {
|
|
|
2493
2529
|
}
|
|
2494
2530
|
}
|
|
2495
2531
|
createTokenizer() {
|
|
2496
|
-
this.tokenizer =
|
|
2532
|
+
this.tokenizer = tokenizer$1(this.input);
|
|
2497
2533
|
}
|
|
2498
2534
|
decl(tokens, customProperty) {
|
|
2499
2535
|
let node2 = new Declaration$2();
|
|
@@ -2559,12 +2595,12 @@ let Parser$1 = class Parser {
|
|
|
2559
2595
|
let str = "";
|
|
2560
2596
|
for (let j = i; j > 0; j--) {
|
|
2561
2597
|
let type = cache[j][0];
|
|
2562
|
-
if (str.trim().
|
|
2598
|
+
if (str.trim().startsWith("!") && type !== "space") {
|
|
2563
2599
|
break;
|
|
2564
2600
|
}
|
|
2565
2601
|
str = cache.pop()[1] + str;
|
|
2566
2602
|
}
|
|
2567
|
-
if (str.trim().
|
|
2603
|
+
if (str.trim().startsWith("!")) {
|
|
2568
2604
|
node2.important = true;
|
|
2569
2605
|
node2.raws.important = str;
|
|
2570
2606
|
tokens = cache;
|
|
@@ -2852,13 +2888,13 @@ let Parser$1 = class Parser {
|
|
|
2852
2888
|
);
|
|
2853
2889
|
}
|
|
2854
2890
|
};
|
|
2855
|
-
var parser = Parser$
|
|
2856
|
-
let Container$
|
|
2857
|
-
let
|
|
2858
|
-
let
|
|
2859
|
-
function parse$
|
|
2860
|
-
let input2 = new Input$
|
|
2861
|
-
let parser2 = new
|
|
2891
|
+
var parser = Parser$2;
|
|
2892
|
+
let Container$3 = container;
|
|
2893
|
+
let Input$3 = input;
|
|
2894
|
+
let Parser$1 = parser;
|
|
2895
|
+
function parse$4(css, opts) {
|
|
2896
|
+
let input2 = new Input$3(css, opts);
|
|
2897
|
+
let parser2 = new Parser$1(input2);
|
|
2862
2898
|
try {
|
|
2863
2899
|
parser2.parse();
|
|
2864
2900
|
} catch (e) {
|
|
@@ -2877,18 +2913,87 @@ function parse$3(css, opts) {
|
|
|
2877
2913
|
}
|
|
2878
2914
|
return parser2.root;
|
|
2879
2915
|
}
|
|
2880
|
-
var parse_1 = parse$
|
|
2881
|
-
parse$
|
|
2882
|
-
Container$
|
|
2883
|
-
let
|
|
2916
|
+
var parse_1 = parse$4;
|
|
2917
|
+
parse$4.default = parse$4;
|
|
2918
|
+
Container$3.registerParse(parse$4);
|
|
2919
|
+
let Warning$3 = class Warning {
|
|
2920
|
+
constructor(text, opts = {}) {
|
|
2921
|
+
this.type = "warning";
|
|
2922
|
+
this.text = text;
|
|
2923
|
+
if (opts.node && opts.node.source) {
|
|
2924
|
+
let range = opts.node.rangeBy(opts);
|
|
2925
|
+
this.line = range.start.line;
|
|
2926
|
+
this.column = range.start.column;
|
|
2927
|
+
this.endLine = range.end.line;
|
|
2928
|
+
this.endColumn = range.end.column;
|
|
2929
|
+
}
|
|
2930
|
+
for (let opt in opts) this[opt] = opts[opt];
|
|
2931
|
+
}
|
|
2932
|
+
toString() {
|
|
2933
|
+
if (this.node) {
|
|
2934
|
+
return this.node.error(this.text, {
|
|
2935
|
+
index: this.index,
|
|
2936
|
+
plugin: this.plugin,
|
|
2937
|
+
word: this.word
|
|
2938
|
+
}).message;
|
|
2939
|
+
}
|
|
2940
|
+
if (this.plugin) {
|
|
2941
|
+
return this.plugin + ": " + this.text;
|
|
2942
|
+
}
|
|
2943
|
+
return this.text;
|
|
2944
|
+
}
|
|
2945
|
+
};
|
|
2946
|
+
var warning = Warning$3;
|
|
2947
|
+
Warning$3.default = Warning$3;
|
|
2948
|
+
let Warning$2 = warning;
|
|
2949
|
+
let Result$4 = class Result {
|
|
2950
|
+
constructor(processor2, root2, opts) {
|
|
2951
|
+
this.processor = processor2;
|
|
2952
|
+
this.messages = [];
|
|
2953
|
+
this.root = root2;
|
|
2954
|
+
this.opts = opts;
|
|
2955
|
+
this.css = void 0;
|
|
2956
|
+
this.map = void 0;
|
|
2957
|
+
}
|
|
2958
|
+
toString() {
|
|
2959
|
+
return this.css;
|
|
2960
|
+
}
|
|
2961
|
+
warn(text, opts = {}) {
|
|
2962
|
+
if (!opts.plugin) {
|
|
2963
|
+
if (this.lastPlugin && this.lastPlugin.postcssPlugin) {
|
|
2964
|
+
opts.plugin = this.lastPlugin.postcssPlugin;
|
|
2965
|
+
}
|
|
2966
|
+
}
|
|
2967
|
+
let warning2 = new Warning$2(text, opts);
|
|
2968
|
+
this.messages.push(warning2);
|
|
2969
|
+
return warning2;
|
|
2970
|
+
}
|
|
2971
|
+
warnings() {
|
|
2972
|
+
return this.messages.filter((i) => i.type === "warning");
|
|
2973
|
+
}
|
|
2974
|
+
get content() {
|
|
2975
|
+
return this.css;
|
|
2976
|
+
}
|
|
2977
|
+
};
|
|
2978
|
+
var result = Result$4;
|
|
2979
|
+
Result$4.default = Result$4;
|
|
2980
|
+
let printed = {};
|
|
2981
|
+
var warnOnce$2 = function warnOnce(message) {
|
|
2982
|
+
if (printed[message]) return;
|
|
2983
|
+
printed[message] = true;
|
|
2984
|
+
if (typeof console !== "undefined" && console.warn) {
|
|
2985
|
+
console.warn(message);
|
|
2986
|
+
}
|
|
2987
|
+
};
|
|
2988
|
+
let Container$2 = container;
|
|
2989
|
+
let Document$3 = document$2;
|
|
2884
2990
|
let MapGenerator$1 = mapGenerator;
|
|
2885
|
-
let
|
|
2886
|
-
let
|
|
2887
|
-
let
|
|
2991
|
+
let parse$3 = parse_1;
|
|
2992
|
+
let Result$3 = result;
|
|
2993
|
+
let Root$3 = root$1;
|
|
2994
|
+
let stringify$3 = stringify_1;
|
|
2995
|
+
let { isClean, my } = symbols;
|
|
2888
2996
|
let warnOnce$1 = warnOnce$2;
|
|
2889
|
-
let Result$2 = result;
|
|
2890
|
-
let parse$2 = parse_1;
|
|
2891
|
-
let Root$3 = root;
|
|
2892
2997
|
const TYPE_TO_CLASS_NAME = {
|
|
2893
2998
|
atrule: "AtRule",
|
|
2894
2999
|
comment: "Comment",
|
|
@@ -2971,7 +3076,7 @@ function cleanMarks(node2) {
|
|
|
2971
3076
|
if (node2.nodes) node2.nodes.forEach((i) => cleanMarks(i));
|
|
2972
3077
|
return node2;
|
|
2973
3078
|
}
|
|
2974
|
-
let postcss$
|
|
3079
|
+
let postcss$3 = {};
|
|
2975
3080
|
let LazyResult$2 = class LazyResult {
|
|
2976
3081
|
constructor(processor2, css, opts) {
|
|
2977
3082
|
this.stringified = false;
|
|
@@ -2979,7 +3084,7 @@ let LazyResult$2 = class LazyResult {
|
|
|
2979
3084
|
let root2;
|
|
2980
3085
|
if (typeof css === "object" && css !== null && (css.type === "root" || css.type === "document")) {
|
|
2981
3086
|
root2 = cleanMarks(css);
|
|
2982
|
-
} else if (css instanceof LazyResult || css instanceof Result$
|
|
3087
|
+
} else if (css instanceof LazyResult || css instanceof Result$3) {
|
|
2983
3088
|
root2 = cleanMarks(css.root);
|
|
2984
3089
|
if (css.map) {
|
|
2985
3090
|
if (typeof opts.map === "undefined") opts.map = {};
|
|
@@ -2987,7 +3092,7 @@ let LazyResult$2 = class LazyResult {
|
|
|
2987
3092
|
opts.map.prev = css.map;
|
|
2988
3093
|
}
|
|
2989
3094
|
} else {
|
|
2990
|
-
let parser2 = parse$
|
|
3095
|
+
let parser2 = parse$3;
|
|
2991
3096
|
if (opts.syntax) parser2 = opts.syntax.parse;
|
|
2992
3097
|
if (opts.parser) parser2 = opts.parser;
|
|
2993
3098
|
if (parser2.parse) parser2 = parser2.parse;
|
|
@@ -2998,16 +3103,16 @@ let LazyResult$2 = class LazyResult {
|
|
|
2998
3103
|
this.error = error;
|
|
2999
3104
|
}
|
|
3000
3105
|
if (root2 && !root2[my]) {
|
|
3001
|
-
Container$
|
|
3106
|
+
Container$2.rebuild(root2);
|
|
3002
3107
|
}
|
|
3003
3108
|
}
|
|
3004
|
-
this.result = new Result$
|
|
3005
|
-
this.helpers = __spreadProps(__spreadValues({}, postcss$
|
|
3006
|
-
this.plugins = this.processor.plugins.map((
|
|
3007
|
-
if (typeof
|
|
3008
|
-
return __spreadValues(__spreadValues({},
|
|
3109
|
+
this.result = new Result$3(processor2, root2, opts);
|
|
3110
|
+
this.helpers = __spreadProps(__spreadValues({}, postcss$3), { postcss: postcss$3, result: this.result });
|
|
3111
|
+
this.plugins = this.processor.plugins.map((plugin3) => {
|
|
3112
|
+
if (typeof plugin3 === "object" && plugin3.prepare) {
|
|
3113
|
+
return __spreadValues(__spreadValues({}, plugin3), plugin3.prepare(this.result));
|
|
3009
3114
|
} else {
|
|
3010
|
-
return
|
|
3115
|
+
return plugin3;
|
|
3011
3116
|
}
|
|
3012
3117
|
});
|
|
3013
3118
|
}
|
|
@@ -3029,17 +3134,17 @@ let LazyResult$2 = class LazyResult {
|
|
|
3029
3134
|
throw new Error("Use process(css).then(cb) to work with async plugins");
|
|
3030
3135
|
}
|
|
3031
3136
|
handleError(error, node2) {
|
|
3032
|
-
let
|
|
3137
|
+
let plugin3 = this.result.lastPlugin;
|
|
3033
3138
|
try {
|
|
3034
3139
|
if (node2) node2.addToError(error);
|
|
3035
3140
|
this.error = error;
|
|
3036
3141
|
if (error.name === "CssSyntaxError" && !error.plugin) {
|
|
3037
|
-
error.plugin =
|
|
3142
|
+
error.plugin = plugin3.postcssPlugin;
|
|
3038
3143
|
error.setMessage();
|
|
3039
|
-
} else if (
|
|
3144
|
+
} else if (plugin3.postcssVersion) {
|
|
3040
3145
|
if (true) {
|
|
3041
|
-
let pluginName =
|
|
3042
|
-
let pluginVer =
|
|
3146
|
+
let pluginName = plugin3.postcssPlugin;
|
|
3147
|
+
let pluginVer = plugin3.postcssVersion;
|
|
3043
3148
|
let runtimeVer = this.result.processor.version;
|
|
3044
3149
|
let a = pluginVer.split(".");
|
|
3045
3150
|
let b = runtimeVer.split(".");
|
|
@@ -3057,33 +3162,33 @@ let LazyResult$2 = class LazyResult {
|
|
|
3057
3162
|
}
|
|
3058
3163
|
prepareVisitors() {
|
|
3059
3164
|
this.listeners = {};
|
|
3060
|
-
let add = (
|
|
3165
|
+
let add = (plugin3, type, cb) => {
|
|
3061
3166
|
if (!this.listeners[type]) this.listeners[type] = [];
|
|
3062
|
-
this.listeners[type].push([
|
|
3167
|
+
this.listeners[type].push([plugin3, cb]);
|
|
3063
3168
|
};
|
|
3064
|
-
for (let
|
|
3065
|
-
if (typeof
|
|
3066
|
-
for (let event in
|
|
3169
|
+
for (let plugin3 of this.plugins) {
|
|
3170
|
+
if (typeof plugin3 === "object") {
|
|
3171
|
+
for (let event in plugin3) {
|
|
3067
3172
|
if (!PLUGIN_PROPS[event] && /^[A-Z]/.test(event)) {
|
|
3068
3173
|
throw new Error(
|
|
3069
|
-
`Unknown event ${event} in ${
|
|
3174
|
+
`Unknown event ${event} in ${plugin3.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`
|
|
3070
3175
|
);
|
|
3071
3176
|
}
|
|
3072
3177
|
if (!NOT_VISITORS[event]) {
|
|
3073
|
-
if (typeof
|
|
3074
|
-
for (let filter in
|
|
3178
|
+
if (typeof plugin3[event] === "object") {
|
|
3179
|
+
for (let filter in plugin3[event]) {
|
|
3075
3180
|
if (filter === "*") {
|
|
3076
|
-
add(
|
|
3181
|
+
add(plugin3, event, plugin3[event][filter]);
|
|
3077
3182
|
} else {
|
|
3078
3183
|
add(
|
|
3079
|
-
|
|
3184
|
+
plugin3,
|
|
3080
3185
|
event + "-" + filter.toLowerCase(),
|
|
3081
|
-
|
|
3186
|
+
plugin3[event][filter]
|
|
3082
3187
|
);
|
|
3083
3188
|
}
|
|
3084
3189
|
}
|
|
3085
|
-
} else if (typeof
|
|
3086
|
-
add(
|
|
3190
|
+
} else if (typeof plugin3[event] === "function") {
|
|
3191
|
+
add(plugin3, event, plugin3[event]);
|
|
3087
3192
|
}
|
|
3088
3193
|
}
|
|
3089
3194
|
}
|
|
@@ -3094,8 +3199,8 @@ let LazyResult$2 = class LazyResult {
|
|
|
3094
3199
|
async runAsync() {
|
|
3095
3200
|
this.plugin = 0;
|
|
3096
3201
|
for (let i = 0; i < this.plugins.length; i++) {
|
|
3097
|
-
let
|
|
3098
|
-
let promise = this.runOnRoot(
|
|
3202
|
+
let plugin3 = this.plugins[i];
|
|
3203
|
+
let promise = this.runOnRoot(plugin3);
|
|
3099
3204
|
if (isPromise(promise)) {
|
|
3100
3205
|
try {
|
|
3101
3206
|
await promise;
|
|
@@ -3123,8 +3228,8 @@ let LazyResult$2 = class LazyResult {
|
|
|
3123
3228
|
}
|
|
3124
3229
|
}
|
|
3125
3230
|
if (this.listeners.OnceExit) {
|
|
3126
|
-
for (let [
|
|
3127
|
-
this.result.lastPlugin =
|
|
3231
|
+
for (let [plugin3, visitor] of this.listeners.OnceExit) {
|
|
3232
|
+
this.result.lastPlugin = plugin3;
|
|
3128
3233
|
try {
|
|
3129
3234
|
if (root2.type === "document") {
|
|
3130
3235
|
let roots = root2.nodes.map(
|
|
@@ -3143,22 +3248,22 @@ let LazyResult$2 = class LazyResult {
|
|
|
3143
3248
|
this.processed = true;
|
|
3144
3249
|
return this.stringify();
|
|
3145
3250
|
}
|
|
3146
|
-
runOnRoot(
|
|
3147
|
-
this.result.lastPlugin =
|
|
3251
|
+
runOnRoot(plugin3) {
|
|
3252
|
+
this.result.lastPlugin = plugin3;
|
|
3148
3253
|
try {
|
|
3149
|
-
if (typeof
|
|
3254
|
+
if (typeof plugin3 === "object" && plugin3.Once) {
|
|
3150
3255
|
if (this.result.root.type === "document") {
|
|
3151
3256
|
let roots = this.result.root.nodes.map(
|
|
3152
|
-
(root2) =>
|
|
3257
|
+
(root2) => plugin3.Once(root2, this.helpers)
|
|
3153
3258
|
);
|
|
3154
3259
|
if (isPromise(roots[0])) {
|
|
3155
3260
|
return Promise.all(roots);
|
|
3156
3261
|
}
|
|
3157
3262
|
return roots;
|
|
3158
3263
|
}
|
|
3159
|
-
return
|
|
3160
|
-
} else if (typeof
|
|
3161
|
-
return
|
|
3264
|
+
return plugin3.Once(this.result.root, this.helpers);
|
|
3265
|
+
} else if (typeof plugin3 === "function") {
|
|
3266
|
+
return plugin3(this.result.root, this.result);
|
|
3162
3267
|
}
|
|
3163
3268
|
} catch (error) {
|
|
3164
3269
|
throw this.handleError(error);
|
|
@@ -3170,7 +3275,7 @@ let LazyResult$2 = class LazyResult {
|
|
|
3170
3275
|
this.stringified = true;
|
|
3171
3276
|
this.sync();
|
|
3172
3277
|
let opts = this.result.opts;
|
|
3173
|
-
let str = stringify$
|
|
3278
|
+
let str = stringify$3;
|
|
3174
3279
|
if (opts.syntax) str = opts.syntax.stringify;
|
|
3175
3280
|
if (opts.stringifier) str = opts.stringifier;
|
|
3176
3281
|
if (str.stringify) str = str.stringify;
|
|
@@ -3187,8 +3292,8 @@ let LazyResult$2 = class LazyResult {
|
|
|
3187
3292
|
if (this.processing) {
|
|
3188
3293
|
throw this.getAsyncError();
|
|
3189
3294
|
}
|
|
3190
|
-
for (let
|
|
3191
|
-
let promise = this.runOnRoot(
|
|
3295
|
+
for (let plugin3 of this.plugins) {
|
|
3296
|
+
let promise = this.runOnRoot(plugin3);
|
|
3192
3297
|
if (isPromise(promise)) {
|
|
3193
3298
|
throw this.getAsyncError();
|
|
3194
3299
|
}
|
|
@@ -3226,8 +3331,8 @@ let LazyResult$2 = class LazyResult {
|
|
|
3226
3331
|
return this.css;
|
|
3227
3332
|
}
|
|
3228
3333
|
visitSync(visitors, node2) {
|
|
3229
|
-
for (let [
|
|
3230
|
-
this.result.lastPlugin =
|
|
3334
|
+
for (let [plugin3, visitor] of visitors) {
|
|
3335
|
+
this.result.lastPlugin = plugin3;
|
|
3231
3336
|
let promise;
|
|
3232
3337
|
try {
|
|
3233
3338
|
promise = visitor(node2, this.helpers);
|
|
@@ -3250,13 +3355,13 @@ let LazyResult$2 = class LazyResult {
|
|
|
3250
3355
|
return;
|
|
3251
3356
|
}
|
|
3252
3357
|
if (visitors.length > 0 && visit2.visitorIndex < visitors.length) {
|
|
3253
|
-
let [
|
|
3358
|
+
let [plugin3, visitor] = visitors[visit2.visitorIndex];
|
|
3254
3359
|
visit2.visitorIndex += 1;
|
|
3255
3360
|
if (visit2.visitorIndex === visitors.length) {
|
|
3256
3361
|
visit2.visitors = [];
|
|
3257
3362
|
visit2.visitorIndex = 0;
|
|
3258
3363
|
}
|
|
3259
|
-
this.result.lastPlugin =
|
|
3364
|
+
this.result.lastPlugin = plugin3;
|
|
3260
3365
|
try {
|
|
3261
3366
|
return visitor(node2.toProxy(), this.helpers);
|
|
3262
3367
|
} catch (e) {
|
|
@@ -3341,17 +3446,17 @@ let LazyResult$2 = class LazyResult {
|
|
|
3341
3446
|
}
|
|
3342
3447
|
};
|
|
3343
3448
|
LazyResult$2.registerPostcss = (dependant) => {
|
|
3344
|
-
postcss$
|
|
3449
|
+
postcss$3 = dependant;
|
|
3345
3450
|
};
|
|
3346
3451
|
var lazyResult = LazyResult$2;
|
|
3347
3452
|
LazyResult$2.default = LazyResult$2;
|
|
3348
3453
|
Root$3.registerLazyResult(LazyResult$2);
|
|
3349
|
-
Document$
|
|
3454
|
+
Document$3.registerLazyResult(LazyResult$2);
|
|
3350
3455
|
let MapGenerator2 = mapGenerator;
|
|
3351
|
-
let
|
|
3456
|
+
let parse$2 = parse_1;
|
|
3457
|
+
const Result$2 = result;
|
|
3458
|
+
let stringify$2 = stringify_1;
|
|
3352
3459
|
let warnOnce2 = warnOnce$2;
|
|
3353
|
-
let parse$1 = parse_1;
|
|
3354
|
-
const Result$1 = result;
|
|
3355
3460
|
let NoWorkResult$1 = class NoWorkResult {
|
|
3356
3461
|
constructor(processor2, css, opts) {
|
|
3357
3462
|
css = css.toString();
|
|
@@ -3361,8 +3466,8 @@ let NoWorkResult$1 = class NoWorkResult {
|
|
|
3361
3466
|
this._opts = opts;
|
|
3362
3467
|
this._map = void 0;
|
|
3363
3468
|
let root2;
|
|
3364
|
-
let str = stringify$
|
|
3365
|
-
this.result = new Result$
|
|
3469
|
+
let str = stringify$2;
|
|
3470
|
+
this.result = new Result$2(this._processor, root2, this._opts);
|
|
3366
3471
|
this.result.css = css;
|
|
3367
3472
|
let self = this;
|
|
3368
3473
|
Object.defineProperty(this.result, "root", {
|
|
@@ -3437,7 +3542,7 @@ let NoWorkResult$1 = class NoWorkResult {
|
|
|
3437
3542
|
return this._root;
|
|
3438
3543
|
}
|
|
3439
3544
|
let root2;
|
|
3440
|
-
let parser2 = parse$
|
|
3545
|
+
let parser2 = parse$2;
|
|
3441
3546
|
try {
|
|
3442
3547
|
root2 = parser2(this._css, this._opts);
|
|
3443
3548
|
} catch (error) {
|
|
@@ -3456,13 +3561,13 @@ let NoWorkResult$1 = class NoWorkResult {
|
|
|
3456
3561
|
};
|
|
3457
3562
|
var noWorkResult = NoWorkResult$1;
|
|
3458
3563
|
NoWorkResult$1.default = NoWorkResult$1;
|
|
3459
|
-
let
|
|
3564
|
+
let Document$2 = document$2;
|
|
3460
3565
|
let LazyResult$1 = lazyResult;
|
|
3461
|
-
let
|
|
3462
|
-
let Root$2 = root;
|
|
3463
|
-
let Processor$
|
|
3566
|
+
let NoWorkResult2 = noWorkResult;
|
|
3567
|
+
let Root$2 = root$1;
|
|
3568
|
+
let Processor$2 = class Processor {
|
|
3464
3569
|
constructor(plugins = []) {
|
|
3465
|
-
this.version = "8.
|
|
3570
|
+
this.version = "8.5.1";
|
|
3466
3571
|
this.plugins = this.normalize(plugins);
|
|
3467
3572
|
}
|
|
3468
3573
|
normalize(plugins) {
|
|
@@ -3498,88 +3603,40 @@ let Processor$1 = class Processor {
|
|
|
3498
3603
|
return new LazyResult$1(this, css, opts);
|
|
3499
3604
|
}
|
|
3500
3605
|
}
|
|
3501
|
-
use(
|
|
3502
|
-
this.plugins = this.plugins.concat(this.normalize([
|
|
3606
|
+
use(plugin3) {
|
|
3607
|
+
this.plugins = this.plugins.concat(this.normalize([plugin3]));
|
|
3503
3608
|
return this;
|
|
3504
3609
|
}
|
|
3505
3610
|
};
|
|
3506
|
-
var processor = Processor$
|
|
3507
|
-
Processor$
|
|
3508
|
-
Root$2.registerProcessor(Processor$
|
|
3509
|
-
Document$
|
|
3611
|
+
var processor = Processor$2;
|
|
3612
|
+
Processor$2.default = Processor$2;
|
|
3613
|
+
Root$2.registerProcessor(Processor$2);
|
|
3614
|
+
Document$2.registerProcessor(Processor$2);
|
|
3615
|
+
let AtRule$1 = atRule$1;
|
|
3616
|
+
let Comment$2 = comment$1;
|
|
3617
|
+
let Container$1 = container;
|
|
3618
|
+
let CssSyntaxError$1 = cssSyntaxError;
|
|
3510
3619
|
let Declaration$1 = declaration;
|
|
3511
|
-
let
|
|
3512
|
-
let
|
|
3513
|
-
let
|
|
3514
|
-
let Input$1 = input;
|
|
3515
|
-
let Root$1 = root;
|
|
3516
|
-
let Rule$1 = rule;
|
|
3517
|
-
function fromJSON$1(json, inputs) {
|
|
3518
|
-
if (Array.isArray(json)) return json.map((n) => fromJSON$1(n));
|
|
3519
|
-
let _a = json, { inputs: ownInputs } = _a, defaults = __objRest(_a, ["inputs"]);
|
|
3520
|
-
if (ownInputs) {
|
|
3521
|
-
inputs = [];
|
|
3522
|
-
for (let input2 of ownInputs) {
|
|
3523
|
-
let inputHydrated = __spreadProps(__spreadValues({}, input2), { __proto__: Input$1.prototype });
|
|
3524
|
-
if (inputHydrated.map) {
|
|
3525
|
-
inputHydrated.map = __spreadProps(__spreadValues({}, inputHydrated.map), {
|
|
3526
|
-
__proto__: PreviousMap2.prototype
|
|
3527
|
-
});
|
|
3528
|
-
}
|
|
3529
|
-
inputs.push(inputHydrated);
|
|
3530
|
-
}
|
|
3531
|
-
}
|
|
3532
|
-
if (defaults.nodes) {
|
|
3533
|
-
defaults.nodes = json.nodes.map((n) => fromJSON$1(n, inputs));
|
|
3534
|
-
}
|
|
3535
|
-
if (defaults.source) {
|
|
3536
|
-
let _b = defaults.source, { inputId } = _b, source = __objRest(_b, ["inputId"]);
|
|
3537
|
-
defaults.source = source;
|
|
3538
|
-
if (inputId != null) {
|
|
3539
|
-
defaults.source.input = inputs[inputId];
|
|
3540
|
-
}
|
|
3541
|
-
}
|
|
3542
|
-
if (defaults.type === "root") {
|
|
3543
|
-
return new Root$1(defaults);
|
|
3544
|
-
} else if (defaults.type === "decl") {
|
|
3545
|
-
return new Declaration$1(defaults);
|
|
3546
|
-
} else if (defaults.type === "rule") {
|
|
3547
|
-
return new Rule$1(defaults);
|
|
3548
|
-
} else if (defaults.type === "comment") {
|
|
3549
|
-
return new Comment$1(defaults);
|
|
3550
|
-
} else if (defaults.type === "atrule") {
|
|
3551
|
-
return new AtRule$1(defaults);
|
|
3552
|
-
} else {
|
|
3553
|
-
throw new Error("Unknown node type: " + json.type);
|
|
3554
|
-
}
|
|
3555
|
-
}
|
|
3556
|
-
var fromJSON_1 = fromJSON$1;
|
|
3557
|
-
fromJSON$1.default = fromJSON$1;
|
|
3558
|
-
let CssSyntaxError2 = cssSyntaxError;
|
|
3559
|
-
let Declaration2 = declaration;
|
|
3620
|
+
let Document$1 = document$2;
|
|
3621
|
+
let fromJSON$1 = fromJSON_1;
|
|
3622
|
+
let Input$2 = input;
|
|
3560
3623
|
let LazyResult2 = lazyResult;
|
|
3561
|
-
let
|
|
3562
|
-
let
|
|
3563
|
-
let
|
|
3564
|
-
let
|
|
3565
|
-
let
|
|
3566
|
-
let
|
|
3567
|
-
let
|
|
3568
|
-
let
|
|
3569
|
-
let
|
|
3570
|
-
|
|
3571
|
-
let parse = parse_1;
|
|
3572
|
-
let list = list_1;
|
|
3573
|
-
let Rule2 = rule;
|
|
3574
|
-
let Root2 = root;
|
|
3575
|
-
let Node2 = node;
|
|
3576
|
-
function postcss(...plugins) {
|
|
3624
|
+
let list$1 = list_1;
|
|
3625
|
+
let Node$1 = node;
|
|
3626
|
+
let parse$1 = parse_1;
|
|
3627
|
+
let Processor$1 = processor;
|
|
3628
|
+
let Result$1 = result;
|
|
3629
|
+
let Root$1 = root$1;
|
|
3630
|
+
let Rule$1 = rule$1;
|
|
3631
|
+
let stringify$1 = stringify_1;
|
|
3632
|
+
let Warning$1 = warning;
|
|
3633
|
+
function postcss$1(...plugins) {
|
|
3577
3634
|
if (plugins.length === 1 && Array.isArray(plugins[0])) {
|
|
3578
3635
|
plugins = plugins[0];
|
|
3579
3636
|
}
|
|
3580
|
-
return new
|
|
3637
|
+
return new Processor$1(plugins);
|
|
3581
3638
|
}
|
|
3582
|
-
postcss.plugin = function plugin(name, initializer) {
|
|
3639
|
+
postcss$1.plugin = function plugin(name, initializer) {
|
|
3583
3640
|
let warningPrinted = false;
|
|
3584
3641
|
function creator(...args) {
|
|
3585
3642
|
if (console && console.warn && !warningPrinted) {
|
|
@@ -3595,7 +3652,7 @@ postcss.plugin = function plugin(name, initializer) {
|
|
|
3595
3652
|
}
|
|
3596
3653
|
let transformer = initializer(...args);
|
|
3597
3654
|
transformer.postcssPlugin = name;
|
|
3598
|
-
transformer.postcssVersion = new
|
|
3655
|
+
transformer.postcssVersion = new Processor$1().version;
|
|
3599
3656
|
return transformer;
|
|
3600
3657
|
}
|
|
3601
3658
|
let cache;
|
|
@@ -3606,61 +3663,61 @@ postcss.plugin = function plugin(name, initializer) {
|
|
|
3606
3663
|
}
|
|
3607
3664
|
});
|
|
3608
3665
|
creator.process = function(css, processOpts, pluginOpts) {
|
|
3609
|
-
return postcss([creator(pluginOpts)]).process(css, processOpts);
|
|
3666
|
+
return postcss$1([creator(pluginOpts)]).process(css, processOpts);
|
|
3610
3667
|
};
|
|
3611
3668
|
return creator;
|
|
3612
3669
|
};
|
|
3613
|
-
postcss.stringify = stringify;
|
|
3614
|
-
postcss.parse = parse;
|
|
3615
|
-
postcss.fromJSON = fromJSON;
|
|
3616
|
-
postcss.list = list;
|
|
3617
|
-
postcss.comment = (defaults) => new
|
|
3618
|
-
postcss.atRule = (defaults) => new
|
|
3619
|
-
postcss.decl = (defaults) => new
|
|
3620
|
-
postcss.rule = (defaults) => new
|
|
3621
|
-
postcss.root = (defaults) => new
|
|
3622
|
-
postcss.document = (defaults) => new
|
|
3623
|
-
postcss.CssSyntaxError =
|
|
3624
|
-
postcss.Declaration =
|
|
3625
|
-
postcss.Container =
|
|
3626
|
-
postcss.Processor =
|
|
3627
|
-
postcss.Document =
|
|
3628
|
-
postcss.Comment =
|
|
3629
|
-
postcss.Warning =
|
|
3630
|
-
postcss.AtRule =
|
|
3631
|
-
postcss.Result =
|
|
3632
|
-
postcss.Input =
|
|
3633
|
-
postcss.Rule =
|
|
3634
|
-
postcss.Root =
|
|
3635
|
-
postcss.Node =
|
|
3636
|
-
LazyResult2.registerPostcss(postcss);
|
|
3637
|
-
var postcss_1 = postcss;
|
|
3638
|
-
postcss.default = postcss;
|
|
3639
|
-
const postcss$
|
|
3640
|
-
postcss$
|
|
3641
|
-
postcss$
|
|
3642
|
-
postcss$
|
|
3643
|
-
postcss$
|
|
3644
|
-
postcss$
|
|
3645
|
-
postcss$
|
|
3646
|
-
postcss$
|
|
3647
|
-
postcss$
|
|
3648
|
-
postcss$
|
|
3649
|
-
postcss$
|
|
3650
|
-
postcss$
|
|
3651
|
-
postcss$
|
|
3652
|
-
postcss$
|
|
3653
|
-
postcss$
|
|
3654
|
-
postcss$
|
|
3655
|
-
postcss$
|
|
3656
|
-
postcss$
|
|
3657
|
-
postcss$
|
|
3658
|
-
postcss$
|
|
3659
|
-
postcss$
|
|
3660
|
-
postcss$
|
|
3661
|
-
postcss$
|
|
3662
|
-
postcss$
|
|
3663
|
-
postcss$
|
|
3670
|
+
postcss$1.stringify = stringify$1;
|
|
3671
|
+
postcss$1.parse = parse$1;
|
|
3672
|
+
postcss$1.fromJSON = fromJSON$1;
|
|
3673
|
+
postcss$1.list = list$1;
|
|
3674
|
+
postcss$1.comment = (defaults) => new Comment$2(defaults);
|
|
3675
|
+
postcss$1.atRule = (defaults) => new AtRule$1(defaults);
|
|
3676
|
+
postcss$1.decl = (defaults) => new Declaration$1(defaults);
|
|
3677
|
+
postcss$1.rule = (defaults) => new Rule$1(defaults);
|
|
3678
|
+
postcss$1.root = (defaults) => new Root$1(defaults);
|
|
3679
|
+
postcss$1.document = (defaults) => new Document$1(defaults);
|
|
3680
|
+
postcss$1.CssSyntaxError = CssSyntaxError$1;
|
|
3681
|
+
postcss$1.Declaration = Declaration$1;
|
|
3682
|
+
postcss$1.Container = Container$1;
|
|
3683
|
+
postcss$1.Processor = Processor$1;
|
|
3684
|
+
postcss$1.Document = Document$1;
|
|
3685
|
+
postcss$1.Comment = Comment$2;
|
|
3686
|
+
postcss$1.Warning = Warning$1;
|
|
3687
|
+
postcss$1.AtRule = AtRule$1;
|
|
3688
|
+
postcss$1.Result = Result$1;
|
|
3689
|
+
postcss$1.Input = Input$2;
|
|
3690
|
+
postcss$1.Rule = Rule$1;
|
|
3691
|
+
postcss$1.Root = Root$1;
|
|
3692
|
+
postcss$1.Node = Node$1;
|
|
3693
|
+
LazyResult2.registerPostcss(postcss$1);
|
|
3694
|
+
var postcss_1 = postcss$1;
|
|
3695
|
+
postcss$1.default = postcss$1;
|
|
3696
|
+
const postcss$2 = /* @__PURE__ */ getDefaultExportFromCjs(postcss_1);
|
|
3697
|
+
postcss$2.stringify;
|
|
3698
|
+
postcss$2.fromJSON;
|
|
3699
|
+
postcss$2.plugin;
|
|
3700
|
+
postcss$2.parse;
|
|
3701
|
+
postcss$2.list;
|
|
3702
|
+
postcss$2.document;
|
|
3703
|
+
postcss$2.comment;
|
|
3704
|
+
postcss$2.atRule;
|
|
3705
|
+
postcss$2.rule;
|
|
3706
|
+
postcss$2.decl;
|
|
3707
|
+
postcss$2.root;
|
|
3708
|
+
postcss$2.CssSyntaxError;
|
|
3709
|
+
postcss$2.Declaration;
|
|
3710
|
+
postcss$2.Container;
|
|
3711
|
+
postcss$2.Processor;
|
|
3712
|
+
postcss$2.Document;
|
|
3713
|
+
postcss$2.Comment;
|
|
3714
|
+
postcss$2.Warning;
|
|
3715
|
+
postcss$2.AtRule;
|
|
3716
|
+
postcss$2.Result;
|
|
3717
|
+
postcss$2.Input;
|
|
3718
|
+
postcss$2.Rule;
|
|
3719
|
+
postcss$2.Root;
|
|
3720
|
+
postcss$2.Node;
|
|
3664
3721
|
var NodeType$1 = /* @__PURE__ */ ((NodeType2) => {
|
|
3665
3722
|
NodeType2[NodeType2["Document"] = 0] = "Document";
|
|
3666
3723
|
NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
|
|
@@ -3674,8 +3731,8 @@ function parseCSSText(cssText) {
|
|
|
3674
3731
|
const res = {};
|
|
3675
3732
|
const listDelimiter = /;(?![^(]*\))/g;
|
|
3676
3733
|
const propertyDelimiter = /:(.+)/;
|
|
3677
|
-
const
|
|
3678
|
-
cssText.replace(
|
|
3734
|
+
const comment = /\/\*.*?\*\//g;
|
|
3735
|
+
cssText.replace(comment, "").split(listDelimiter).forEach(function(item) {
|
|
3679
3736
|
if (item) {
|
|
3680
3737
|
const tmp = item.split(propertyDelimiter);
|
|
3681
3738
|
tmp.length > 1 && (res[camelize(tmp[0].trim())] = tmp[1].trim());
|
|
@@ -3869,9 +3926,9 @@ class BaseRRDocument extends BaseRRNode {
|
|
|
3869
3926
|
return text;
|
|
3870
3927
|
}
|
|
3871
3928
|
createComment(data) {
|
|
3872
|
-
const
|
|
3873
|
-
|
|
3874
|
-
return
|
|
3929
|
+
const comment = new BaseRRComment(data);
|
|
3930
|
+
comment.ownerDocument = this;
|
|
3931
|
+
return comment;
|
|
3875
3932
|
}
|
|
3876
3933
|
createCDATASection(data) {
|
|
3877
3934
|
const CDATASection = new BaseRRCDATASection(data);
|