@appsurify-testmap/rrdom-nodejs 2.1.3-alpha.4 → 3.1.1-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/rrdom-nodejs.cjs +1424 -1347
- package/dist/rrdom-nodejs.cjs.map +1 -1
- package/dist/rrdom-nodejs.js +1424 -1347
- package/dist/rrdom-nodejs.js.map +1 -1
- package/dist/rrdom-nodejs.umd.cjs +1493 -1425
- package/dist/rrdom-nodejs.umd.cjs.map +2 -2
- package/dist/rrdom-nodejs.umd.min.cjs +18 -28
- package/dist/rrdom-nodejs.umd.min.cjs.map +3 -3
- package/package.json +3 -3
package/dist/rrdom-nodejs.js
CHANGED
|
@@ -102,12 +102,12 @@ function getAugmentedNamespace(n) {
|
|
|
102
102
|
a.prototype = f.prototype;
|
|
103
103
|
} else a = {};
|
|
104
104
|
Object.defineProperty(a, "__esModule", { value: true });
|
|
105
|
-
Object.keys(n).forEach(function(
|
|
106
|
-
var d = Object.getOwnPropertyDescriptor(n,
|
|
107
|
-
Object.defineProperty(a,
|
|
105
|
+
Object.keys(n).forEach(function(k2) {
|
|
106
|
+
var d = Object.getOwnPropertyDescriptor(n, k2);
|
|
107
|
+
Object.defineProperty(a, k2, d.get ? d : {
|
|
108
108
|
enumerable: true,
|
|
109
109
|
get: function() {
|
|
110
|
-
return n[
|
|
110
|
+
return n[k2];
|
|
111
111
|
}
|
|
112
112
|
});
|
|
113
113
|
});
|
|
@@ -116,7 +116,7 @@ function getAugmentedNamespace(n) {
|
|
|
116
116
|
var picocolors_browser = { exports: {} };
|
|
117
117
|
var x = String;
|
|
118
118
|
var create = function() {
|
|
119
|
-
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 };
|
|
119
|
+
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 };
|
|
120
120
|
};
|
|
121
121
|
picocolors_browser.exports = create();
|
|
122
122
|
picocolors_browser.exports.createColors = create;
|
|
@@ -171,29 +171,40 @@ let CssSyntaxError$3 = class CssSyntaxError extends Error {
|
|
|
171
171
|
if (!this.source) return "";
|
|
172
172
|
let css = this.source;
|
|
173
173
|
if (color == null) color = pico.isColorSupported;
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
let lines = css.split(/\r?\n/);
|
|
178
|
-
let start = Math.max(this.line - 3, 0);
|
|
179
|
-
let end = Math.min(this.line + 2, lines.length);
|
|
180
|
-
let maxWidth = String(end).length;
|
|
181
|
-
let mark, aside;
|
|
174
|
+
let aside = (text) => text;
|
|
175
|
+
let mark = (text) => text;
|
|
176
|
+
let highlight = (text) => text;
|
|
182
177
|
if (color) {
|
|
183
178
|
let { bold, gray, red } = pico.createColors(true);
|
|
184
179
|
mark = (text) => bold(red(text));
|
|
185
180
|
aside = (text) => gray(text);
|
|
186
|
-
|
|
187
|
-
|
|
181
|
+
if (terminalHighlight$1) {
|
|
182
|
+
highlight = (text) => terminalHighlight$1(text);
|
|
183
|
+
}
|
|
188
184
|
}
|
|
185
|
+
let lines = css.split(/\r?\n/);
|
|
186
|
+
let start = Math.max(this.line - 3, 0);
|
|
187
|
+
let end = Math.min(this.line + 2, lines.length);
|
|
188
|
+
let maxWidth = String(end).length;
|
|
189
189
|
return lines.slice(start, end).map((line, index2) => {
|
|
190
190
|
let number = start + 1 + index2;
|
|
191
191
|
let gutter = " " + (" " + number).slice(-maxWidth) + " | ";
|
|
192
192
|
if (number === this.line) {
|
|
193
|
+
if (line.length > 160) {
|
|
194
|
+
let padding = 20;
|
|
195
|
+
let subLineStart = Math.max(0, this.column - padding);
|
|
196
|
+
let subLineEnd = Math.max(
|
|
197
|
+
this.column + padding,
|
|
198
|
+
this.endColumn + padding
|
|
199
|
+
);
|
|
200
|
+
let subLine = line.slice(subLineStart, subLineEnd);
|
|
201
|
+
let spacing2 = aside(gutter.replace(/\d/g, " ")) + line.slice(0, Math.min(this.column - 1, padding - 1)).replace(/[^\t]/g, " ");
|
|
202
|
+
return mark(">") + aside(gutter) + highlight(subLine) + "\n " + spacing2 + mark("^");
|
|
203
|
+
}
|
|
193
204
|
let spacing = aside(gutter.replace(/\d/g, " ")) + line.slice(0, this.column - 1).replace(/[^\t]/g, " ");
|
|
194
|
-
return mark(">") + aside(gutter) + line + "\n " + spacing + mark("^");
|
|
205
|
+
return mark(">") + aside(gutter) + highlight(line) + "\n " + spacing + mark("^");
|
|
195
206
|
}
|
|
196
|
-
return " " + aside(gutter) + line;
|
|
207
|
+
return " " + aside(gutter) + highlight(line);
|
|
197
208
|
}).join("\n");
|
|
198
209
|
}
|
|
199
210
|
toString() {
|
|
@@ -206,9 +217,6 @@ let CssSyntaxError$3 = class CssSyntaxError extends Error {
|
|
|
206
217
|
};
|
|
207
218
|
var cssSyntaxError = CssSyntaxError$3;
|
|
208
219
|
CssSyntaxError$3.default = CssSyntaxError$3;
|
|
209
|
-
var symbols = {};
|
|
210
|
-
symbols.isClean = Symbol("isClean");
|
|
211
|
-
symbols.my = Symbol("my");
|
|
212
220
|
const DEFAULT_RAW = {
|
|
213
221
|
after: "\n",
|
|
214
222
|
beforeClose: "\n",
|
|
@@ -513,10 +521,13 @@ function stringify$4(node2, builder) {
|
|
|
513
521
|
}
|
|
514
522
|
var stringify_1 = stringify$4;
|
|
515
523
|
stringify$4.default = stringify$4;
|
|
516
|
-
|
|
524
|
+
var symbols = {};
|
|
525
|
+
symbols.isClean = Symbol("isClean");
|
|
526
|
+
symbols.my = Symbol("my");
|
|
517
527
|
let CssSyntaxError$2 = cssSyntaxError;
|
|
518
528
|
let Stringifier2 = stringifier;
|
|
519
529
|
let stringify$3 = stringify_1;
|
|
530
|
+
let { isClean: isClean$2, my: my$2 } = symbols;
|
|
520
531
|
function cloneNode(obj, parent) {
|
|
521
532
|
let cloned = new obj.constructor();
|
|
522
533
|
for (let i in obj) {
|
|
@@ -531,7 +542,7 @@ function cloneNode(obj, parent) {
|
|
|
531
542
|
} else if (i === "source") {
|
|
532
543
|
cloned[i] = value;
|
|
533
544
|
} else if (Array.isArray(value)) {
|
|
534
|
-
cloned[i] = value.map((
|
|
545
|
+
cloned[i] = value.map((j2) => cloneNode(j2, cloned));
|
|
535
546
|
} else {
|
|
536
547
|
if (type === "object" && value !== null) value = cloneNode(value);
|
|
537
548
|
cloned[i] = value;
|
|
@@ -539,7 +550,31 @@ function cloneNode(obj, parent) {
|
|
|
539
550
|
}
|
|
540
551
|
return cloned;
|
|
541
552
|
}
|
|
553
|
+
function sourceOffset(inputCSS, position) {
|
|
554
|
+
if (position && typeof position.offset !== "undefined") {
|
|
555
|
+
return position.offset;
|
|
556
|
+
}
|
|
557
|
+
let column = 1;
|
|
558
|
+
let line = 1;
|
|
559
|
+
let offset = 0;
|
|
560
|
+
for (let i = 0; i < inputCSS.length; i++) {
|
|
561
|
+
if (line === position.line && column === position.column) {
|
|
562
|
+
offset = i;
|
|
563
|
+
break;
|
|
564
|
+
}
|
|
565
|
+
if (inputCSS[i] === "\n") {
|
|
566
|
+
column = 1;
|
|
567
|
+
line += 1;
|
|
568
|
+
} else {
|
|
569
|
+
column += 1;
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
return offset;
|
|
573
|
+
}
|
|
542
574
|
let Node$5 = class Node2 {
|
|
575
|
+
get proxyOf() {
|
|
576
|
+
return this;
|
|
577
|
+
}
|
|
543
578
|
constructor(defaults = {}) {
|
|
544
579
|
this.raws = {};
|
|
545
580
|
this[isClean$2] = false;
|
|
@@ -640,6 +675,10 @@ let Node$5 = class Node2 {
|
|
|
640
675
|
}
|
|
641
676
|
};
|
|
642
677
|
}
|
|
678
|
+
/* c8 ignore next 3 */
|
|
679
|
+
markClean() {
|
|
680
|
+
this[isClean$2] = true;
|
|
681
|
+
}
|
|
643
682
|
markDirty() {
|
|
644
683
|
if (this[isClean$2]) {
|
|
645
684
|
this[isClean$2] = false;
|
|
@@ -654,60 +693,82 @@ let Node$5 = class Node2 {
|
|
|
654
693
|
let index2 = this.parent.index(this);
|
|
655
694
|
return this.parent.nodes[index2 + 1];
|
|
656
695
|
}
|
|
657
|
-
positionBy(opts
|
|
696
|
+
positionBy(opts = {}) {
|
|
658
697
|
let pos = this.source.start;
|
|
659
698
|
if (opts.index) {
|
|
660
|
-
pos = this.positionInside(opts.index
|
|
699
|
+
pos = this.positionInside(opts.index);
|
|
661
700
|
} else if (opts.word) {
|
|
662
|
-
|
|
701
|
+
let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
|
|
702
|
+
let stringRepresentation = inputString.slice(
|
|
703
|
+
sourceOffset(inputString, this.source.start),
|
|
704
|
+
sourceOffset(inputString, this.source.end)
|
|
705
|
+
);
|
|
663
706
|
let index2 = stringRepresentation.indexOf(opts.word);
|
|
664
|
-
if (index2 !== -1) pos = this.positionInside(index2
|
|
707
|
+
if (index2 !== -1) pos = this.positionInside(index2);
|
|
665
708
|
}
|
|
666
709
|
return pos;
|
|
667
710
|
}
|
|
668
|
-
positionInside(index2
|
|
669
|
-
let string = stringRepresentation || this.toString();
|
|
711
|
+
positionInside(index2) {
|
|
670
712
|
let column = this.source.start.column;
|
|
671
713
|
let line = this.source.start.line;
|
|
672
|
-
|
|
673
|
-
|
|
714
|
+
let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
|
|
715
|
+
let offset = sourceOffset(inputString, this.source.start);
|
|
716
|
+
let end = offset + index2;
|
|
717
|
+
for (let i = offset; i < end; i++) {
|
|
718
|
+
if (inputString[i] === "\n") {
|
|
674
719
|
column = 1;
|
|
675
720
|
line += 1;
|
|
676
721
|
} else {
|
|
677
722
|
column += 1;
|
|
678
723
|
}
|
|
679
724
|
}
|
|
680
|
-
return { column, line };
|
|
725
|
+
return { column, line, offset: end };
|
|
681
726
|
}
|
|
682
727
|
prev() {
|
|
683
728
|
if (!this.parent) return void 0;
|
|
684
729
|
let index2 = this.parent.index(this);
|
|
685
730
|
return this.parent.nodes[index2 - 1];
|
|
686
731
|
}
|
|
687
|
-
rangeBy(opts) {
|
|
732
|
+
rangeBy(opts = {}) {
|
|
733
|
+
let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
|
|
688
734
|
let start = {
|
|
689
735
|
column: this.source.start.column,
|
|
690
|
-
line: this.source.start.line
|
|
736
|
+
line: this.source.start.line,
|
|
737
|
+
offset: sourceOffset(inputString, this.source.start)
|
|
691
738
|
};
|
|
692
739
|
let end = this.source.end ? {
|
|
693
740
|
column: this.source.end.column + 1,
|
|
694
|
-
line: this.source.end.line
|
|
741
|
+
line: this.source.end.line,
|
|
742
|
+
offset: typeof this.source.end.offset === "number" ? (
|
|
743
|
+
// `source.end.offset` is exclusive, so we don't need to add 1
|
|
744
|
+
this.source.end.offset
|
|
745
|
+
) : (
|
|
746
|
+
// Since line/column in this.source.end is inclusive,
|
|
747
|
+
// the `sourceOffset(... , this.source.end)` returns an inclusive offset.
|
|
748
|
+
// So, we add 1 to convert it to exclusive.
|
|
749
|
+
sourceOffset(inputString, this.source.end) + 1
|
|
750
|
+
)
|
|
695
751
|
} : {
|
|
696
752
|
column: start.column + 1,
|
|
697
|
-
line: start.line
|
|
753
|
+
line: start.line,
|
|
754
|
+
offset: start.offset + 1
|
|
698
755
|
};
|
|
699
756
|
if (opts.word) {
|
|
700
|
-
let stringRepresentation =
|
|
757
|
+
let stringRepresentation = inputString.slice(
|
|
758
|
+
sourceOffset(inputString, this.source.start),
|
|
759
|
+
sourceOffset(inputString, this.source.end)
|
|
760
|
+
);
|
|
701
761
|
let index2 = stringRepresentation.indexOf(opts.word);
|
|
702
762
|
if (index2 !== -1) {
|
|
703
|
-
start = this.positionInside(index2
|
|
704
|
-
end = this.positionInside(index2 + opts.word.length
|
|
763
|
+
start = this.positionInside(index2);
|
|
764
|
+
end = this.positionInside(index2 + opts.word.length);
|
|
705
765
|
}
|
|
706
766
|
} else {
|
|
707
767
|
if (opts.start) {
|
|
708
768
|
start = {
|
|
709
769
|
column: opts.start.column,
|
|
710
|
-
line: opts.start.line
|
|
770
|
+
line: opts.start.line,
|
|
771
|
+
offset: sourceOffset(inputString, opts.start)
|
|
711
772
|
};
|
|
712
773
|
} else if (opts.index) {
|
|
713
774
|
start = this.positionInside(opts.index);
|
|
@@ -715,7 +776,8 @@ let Node$5 = class Node2 {
|
|
|
715
776
|
if (opts.end) {
|
|
716
777
|
end = {
|
|
717
778
|
column: opts.end.column,
|
|
718
|
-
line: opts.end.line
|
|
779
|
+
line: opts.end.line,
|
|
780
|
+
offset: sourceOffset(inputString, opts.end)
|
|
719
781
|
};
|
|
720
782
|
} else if (typeof opts.endIndex === "number") {
|
|
721
783
|
end = this.positionInside(opts.endIndex);
|
|
@@ -724,7 +786,11 @@ let Node$5 = class Node2 {
|
|
|
724
786
|
}
|
|
725
787
|
}
|
|
726
788
|
if (end.line < start.line || end.line === start.line && end.column <= start.column) {
|
|
727
|
-
end = {
|
|
789
|
+
end = {
|
|
790
|
+
column: start.column + 1,
|
|
791
|
+
line: start.line,
|
|
792
|
+
offset: start.offset + 1
|
|
793
|
+
};
|
|
728
794
|
}
|
|
729
795
|
return { end, start };
|
|
730
796
|
}
|
|
@@ -766,7 +832,7 @@ let Node$5 = class Node2 {
|
|
|
766
832
|
}
|
|
767
833
|
return result2;
|
|
768
834
|
}
|
|
769
|
-
toJSON(
|
|
835
|
+
toJSON(_2, inputs) {
|
|
770
836
|
let fixed = {};
|
|
771
837
|
let emitInputs = inputs == null;
|
|
772
838
|
inputs = inputs || /* @__PURE__ */ new Map();
|
|
@@ -788,6 +854,7 @@ let Node$5 = class Node2 {
|
|
|
788
854
|
} else if (typeof value === "object" && value.toJSON) {
|
|
789
855
|
fixed[name] = value.toJSON(null, inputs);
|
|
790
856
|
} else if (name === "source") {
|
|
857
|
+
if (value == null) continue;
|
|
791
858
|
let inputId = inputs.get(value.input);
|
|
792
859
|
if (inputId == null) {
|
|
793
860
|
inputId = inputsNextIndex;
|
|
@@ -822,19 +889,28 @@ let Node$5 = class Node2 {
|
|
|
822
889
|
});
|
|
823
890
|
return result2;
|
|
824
891
|
}
|
|
825
|
-
warn(result2, text, opts) {
|
|
892
|
+
warn(result2, text, opts = {}) {
|
|
826
893
|
let data = { node: this };
|
|
827
894
|
for (let i in opts) data[i] = opts[i];
|
|
828
895
|
return result2.warn(text, data);
|
|
829
896
|
}
|
|
830
|
-
get proxyOf() {
|
|
831
|
-
return this;
|
|
832
|
-
}
|
|
833
897
|
};
|
|
834
898
|
var node = Node$5;
|
|
835
899
|
Node$5.default = Node$5;
|
|
836
900
|
let Node$4 = node;
|
|
837
|
-
let
|
|
901
|
+
let Comment$4 = class Comment extends Node$4 {
|
|
902
|
+
constructor(defaults) {
|
|
903
|
+
super(defaults);
|
|
904
|
+
this.type = "comment";
|
|
905
|
+
}
|
|
906
|
+
};
|
|
907
|
+
var comment = Comment$4;
|
|
908
|
+
Comment$4.default = Comment$4;
|
|
909
|
+
let Node$3 = node;
|
|
910
|
+
let Declaration$4 = class Declaration extends Node$3 {
|
|
911
|
+
get variable() {
|
|
912
|
+
return this.prop.startsWith("--") || this.prop[0] === "$";
|
|
913
|
+
}
|
|
838
914
|
constructor(defaults) {
|
|
839
915
|
if (defaults && typeof defaults.value !== "undefined" && typeof defaults.value !== "string") {
|
|
840
916
|
defaults = { ...defaults, value: String(defaults.value) };
|
|
@@ -842,1124 +918,1236 @@ let Declaration$4 = class Declaration extends Node$4 {
|
|
|
842
918
|
super(defaults);
|
|
843
919
|
this.type = "decl";
|
|
844
920
|
}
|
|
845
|
-
get variable() {
|
|
846
|
-
return this.prop.startsWith("--") || this.prop[0] === "$";
|
|
847
|
-
}
|
|
848
921
|
};
|
|
849
922
|
var declaration = Declaration$4;
|
|
850
923
|
Declaration$4.default = Declaration$4;
|
|
851
|
-
let
|
|
852
|
-
let
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
};
|
|
862
|
-
let nanoid$1 = (size = 21) => {
|
|
863
|
-
let id = "";
|
|
864
|
-
let i = size;
|
|
865
|
-
while (i--) {
|
|
866
|
-
id += urlAlphabet[Math.random() * 64 | 0];
|
|
867
|
-
}
|
|
868
|
-
return id;
|
|
869
|
-
};
|
|
870
|
-
var nonSecure = { nanoid: nanoid$1, customAlphabet };
|
|
871
|
-
let { SourceMapConsumer: SourceMapConsumer$2, SourceMapGenerator: SourceMapGenerator$2 } = require$$2;
|
|
872
|
-
let { existsSync, readFileSync } = require$$2;
|
|
873
|
-
let { dirname: dirname$1, join } = require$$2;
|
|
874
|
-
function fromBase64(str) {
|
|
875
|
-
if (Buffer) {
|
|
876
|
-
return Buffer.from(str, "base64").toString();
|
|
877
|
-
} else {
|
|
878
|
-
return window.atob(str);
|
|
879
|
-
}
|
|
924
|
+
let Comment$3 = comment;
|
|
925
|
+
let Declaration$3 = declaration;
|
|
926
|
+
let Node$2 = node;
|
|
927
|
+
let { isClean: isClean$1, my: my$1 } = symbols;
|
|
928
|
+
let AtRule$4, parse$4, Root$6, Rule$4;
|
|
929
|
+
function cleanSource(nodes) {
|
|
930
|
+
return nodes.map((i) => {
|
|
931
|
+
if (i.nodes) i.nodes = cleanSource(i.nodes);
|
|
932
|
+
delete i.source;
|
|
933
|
+
return i;
|
|
934
|
+
});
|
|
880
935
|
}
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
let prev = opts.map ? opts.map.prev : void 0;
|
|
887
|
-
let text = this.loadMap(opts.from, prev);
|
|
888
|
-
if (!this.mapFile && opts.from) {
|
|
889
|
-
this.mapFile = opts.from;
|
|
890
|
-
}
|
|
891
|
-
if (this.mapFile) this.root = dirname$1(this.mapFile);
|
|
892
|
-
if (text) this.text = text;
|
|
893
|
-
}
|
|
894
|
-
consumer() {
|
|
895
|
-
if (!this.consumerCache) {
|
|
896
|
-
this.consumerCache = new SourceMapConsumer$2(this.text);
|
|
936
|
+
function markTreeDirty(node2) {
|
|
937
|
+
node2[isClean$1] = false;
|
|
938
|
+
if (node2.proxyOf.nodes) {
|
|
939
|
+
for (let i of node2.proxyOf.nodes) {
|
|
940
|
+
markTreeDirty(i);
|
|
897
941
|
}
|
|
898
|
-
return this.consumerCache;
|
|
899
942
|
}
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
if (charsetUri.test(text) || uri.test(text)) {
|
|
906
|
-
return decodeURIComponent(text.substr(RegExp.lastMatch.length));
|
|
907
|
-
}
|
|
908
|
-
if (baseCharsetUri.test(text) || baseUri.test(text)) {
|
|
909
|
-
return fromBase64(text.substr(RegExp.lastMatch.length));
|
|
910
|
-
}
|
|
911
|
-
let encoding = text.match(/data:application\/json;([^,]+),/)[1];
|
|
912
|
-
throw new Error("Unsupported source map encoding " + encoding);
|
|
943
|
+
}
|
|
944
|
+
let Container$7 = class Container extends Node$2 {
|
|
945
|
+
get first() {
|
|
946
|
+
if (!this.proxyOf.nodes) return void 0;
|
|
947
|
+
return this.proxyOf.nodes[0];
|
|
913
948
|
}
|
|
914
|
-
|
|
915
|
-
|
|
949
|
+
get last() {
|
|
950
|
+
if (!this.proxyOf.nodes) return void 0;
|
|
951
|
+
return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
|
|
916
952
|
}
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
953
|
+
append(...children) {
|
|
954
|
+
for (let child of children) {
|
|
955
|
+
let nodes = this.normalize(child, this.last);
|
|
956
|
+
for (let node2 of nodes) this.proxyOf.nodes.push(node2);
|
|
957
|
+
}
|
|
958
|
+
this.markDirty();
|
|
959
|
+
return this;
|
|
920
960
|
}
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
if (
|
|
924
|
-
|
|
925
|
-
let end = css.indexOf("*/", start);
|
|
926
|
-
if (start > -1 && end > -1) {
|
|
927
|
-
this.annotation = this.getAnnotationURL(css.substring(start, end));
|
|
961
|
+
cleanRaws(keepBetween) {
|
|
962
|
+
super.cleanRaws(keepBetween);
|
|
963
|
+
if (this.nodes) {
|
|
964
|
+
for (let node2 of this.nodes) node2.cleanRaws(keepBetween);
|
|
928
965
|
}
|
|
929
966
|
}
|
|
930
|
-
|
|
931
|
-
this.
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
967
|
+
each(callback) {
|
|
968
|
+
if (!this.proxyOf.nodes) return void 0;
|
|
969
|
+
let iterator = this.getIterator();
|
|
970
|
+
let index2, result2;
|
|
971
|
+
while (this.indexes[iterator] < this.proxyOf.nodes.length) {
|
|
972
|
+
index2 = this.indexes[iterator];
|
|
973
|
+
result2 = callback(this.proxyOf.nodes[index2], index2);
|
|
974
|
+
if (result2 === false) break;
|
|
975
|
+
this.indexes[iterator] += 1;
|
|
935
976
|
}
|
|
977
|
+
delete this.indexes[iterator];
|
|
978
|
+
return result2;
|
|
936
979
|
}
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
980
|
+
every(condition) {
|
|
981
|
+
return this.nodes.every(condition);
|
|
982
|
+
}
|
|
983
|
+
getIterator() {
|
|
984
|
+
if (!this.lastEach) this.lastEach = 0;
|
|
985
|
+
if (!this.indexes) this.indexes = {};
|
|
986
|
+
this.lastEach += 1;
|
|
987
|
+
let iterator = this.lastEach;
|
|
988
|
+
this.indexes[iterator] = 0;
|
|
989
|
+
return iterator;
|
|
990
|
+
}
|
|
991
|
+
getProxyProcessor() {
|
|
992
|
+
return {
|
|
993
|
+
get(node2, prop) {
|
|
994
|
+
if (prop === "proxyOf") {
|
|
995
|
+
return node2;
|
|
996
|
+
} else if (!node2[prop]) {
|
|
997
|
+
return node2[prop];
|
|
998
|
+
} else if (prop === "each" || typeof prop === "string" && prop.startsWith("walk")) {
|
|
999
|
+
return (...args) => {
|
|
1000
|
+
return node2[prop](
|
|
1001
|
+
...args.map((i) => {
|
|
1002
|
+
if (typeof i === "function") {
|
|
1003
|
+
return (child, index2) => i(child.toProxy(), index2);
|
|
1004
|
+
} else {
|
|
1005
|
+
return i;
|
|
1006
|
+
}
|
|
1007
|
+
})
|
|
949
1008
|
);
|
|
950
|
-
}
|
|
951
|
-
|
|
1009
|
+
};
|
|
1010
|
+
} else if (prop === "every" || prop === "some") {
|
|
1011
|
+
return (cb) => {
|
|
1012
|
+
return node2[prop](
|
|
1013
|
+
(child, ...other) => cb(child.toProxy(), ...other)
|
|
1014
|
+
);
|
|
1015
|
+
};
|
|
1016
|
+
} else if (prop === "root") {
|
|
1017
|
+
return () => node2.root().toProxy();
|
|
1018
|
+
} else if (prop === "nodes") {
|
|
1019
|
+
return node2.nodes.map((i) => i.toProxy());
|
|
1020
|
+
} else if (prop === "first" || prop === "last") {
|
|
1021
|
+
return node2[prop].toProxy();
|
|
1022
|
+
} else {
|
|
1023
|
+
return node2[prop];
|
|
952
1024
|
}
|
|
953
|
-
}
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
"Unsupported previous source map format: " + prev.toString()
|
|
962
|
-
);
|
|
1025
|
+
},
|
|
1026
|
+
set(node2, prop, value) {
|
|
1027
|
+
if (node2[prop] === value) return true;
|
|
1028
|
+
node2[prop] = value;
|
|
1029
|
+
if (prop === "name" || prop === "params" || prop === "selector") {
|
|
1030
|
+
node2.markDirty();
|
|
1031
|
+
}
|
|
1032
|
+
return true;
|
|
963
1033
|
}
|
|
964
|
-
}
|
|
965
|
-
return this.decodeInline(this.annotation);
|
|
966
|
-
} else if (this.annotation) {
|
|
967
|
-
let map = this.annotation;
|
|
968
|
-
if (file) map = join(dirname$1(file), map);
|
|
969
|
-
return this.loadFile(map);
|
|
970
|
-
}
|
|
971
|
-
}
|
|
972
|
-
startWith(string, start) {
|
|
973
|
-
if (!string) return false;
|
|
974
|
-
return string.substr(0, start.length) === start;
|
|
1034
|
+
};
|
|
975
1035
|
}
|
|
976
|
-
|
|
977
|
-
|
|
1036
|
+
index(child) {
|
|
1037
|
+
if (typeof child === "number") return child;
|
|
1038
|
+
if (child.proxyOf) child = child.proxyOf;
|
|
1039
|
+
return this.proxyOf.nodes.indexOf(child);
|
|
978
1040
|
}
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
let
|
|
984
|
-
let
|
|
985
|
-
let
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
let fromOffsetCache = Symbol("fromOffsetCache");
|
|
990
|
-
let sourceMapAvailable$1 = Boolean(SourceMapConsumer$1 && SourceMapGenerator$1);
|
|
991
|
-
let pathAvailable$1 = Boolean(resolve$1 && isAbsolute);
|
|
992
|
-
let Input$4 = class Input {
|
|
993
|
-
constructor(css, opts = {}) {
|
|
994
|
-
if (css === null || typeof css === "undefined" || typeof css === "object" && !css.toString) {
|
|
995
|
-
throw new Error(`PostCSS received ${css} instead of CSS string`);
|
|
996
|
-
}
|
|
997
|
-
this.css = css.toString();
|
|
998
|
-
if (this.css[0] === "\uFEFF" || this.css[0] === "") {
|
|
999
|
-
this.hasBOM = true;
|
|
1000
|
-
this.css = this.css.slice(1);
|
|
1001
|
-
} else {
|
|
1002
|
-
this.hasBOM = false;
|
|
1003
|
-
}
|
|
1004
|
-
if (opts.from) {
|
|
1005
|
-
if (!pathAvailable$1 || /^\w+:\/\//.test(opts.from) || isAbsolute(opts.from)) {
|
|
1006
|
-
this.file = opts.from;
|
|
1007
|
-
} else {
|
|
1008
|
-
this.file = resolve$1(opts.from);
|
|
1041
|
+
insertAfter(exist, add) {
|
|
1042
|
+
let existIndex = this.index(exist);
|
|
1043
|
+
let nodes = this.normalize(add, this.proxyOf.nodes[existIndex]).reverse();
|
|
1044
|
+
existIndex = this.index(exist);
|
|
1045
|
+
for (let node2 of nodes) this.proxyOf.nodes.splice(existIndex + 1, 0, node2);
|
|
1046
|
+
let index2;
|
|
1047
|
+
for (let id in this.indexes) {
|
|
1048
|
+
index2 = this.indexes[id];
|
|
1049
|
+
if (existIndex < index2) {
|
|
1050
|
+
this.indexes[id] = index2 + nodes.length;
|
|
1009
1051
|
}
|
|
1010
1052
|
}
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1053
|
+
this.markDirty();
|
|
1054
|
+
return this;
|
|
1055
|
+
}
|
|
1056
|
+
insertBefore(exist, add) {
|
|
1057
|
+
let existIndex = this.index(exist);
|
|
1058
|
+
let type = existIndex === 0 ? "prepend" : false;
|
|
1059
|
+
let nodes = this.normalize(
|
|
1060
|
+
add,
|
|
1061
|
+
this.proxyOf.nodes[existIndex],
|
|
1062
|
+
type
|
|
1063
|
+
).reverse();
|
|
1064
|
+
existIndex = this.index(exist);
|
|
1065
|
+
for (let node2 of nodes) this.proxyOf.nodes.splice(existIndex, 0, node2);
|
|
1066
|
+
let index2;
|
|
1067
|
+
for (let id in this.indexes) {
|
|
1068
|
+
index2 = this.indexes[id];
|
|
1069
|
+
if (existIndex <= index2) {
|
|
1070
|
+
this.indexes[id] = index2 + nodes.length;
|
|
1017
1071
|
}
|
|
1018
1072
|
}
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
}
|
|
1022
|
-
if (this.map) this.map.file = this.from;
|
|
1073
|
+
this.markDirty();
|
|
1074
|
+
return this;
|
|
1023
1075
|
}
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
} else {
|
|
1034
|
-
line = start.line;
|
|
1035
|
-
column = start.column;
|
|
1036
|
-
}
|
|
1037
|
-
if (typeof end.offset === "number") {
|
|
1038
|
-
let pos = this.fromOffset(end.offset);
|
|
1039
|
-
endLine = pos.line;
|
|
1040
|
-
endColumn = pos.col;
|
|
1041
|
-
} else {
|
|
1042
|
-
endLine = end.line;
|
|
1043
|
-
endColumn = end.column;
|
|
1076
|
+
normalize(nodes, sample) {
|
|
1077
|
+
if (typeof nodes === "string") {
|
|
1078
|
+
nodes = cleanSource(parse$4(nodes).nodes);
|
|
1079
|
+
} else if (typeof nodes === "undefined") {
|
|
1080
|
+
nodes = [];
|
|
1081
|
+
} else if (Array.isArray(nodes)) {
|
|
1082
|
+
nodes = nodes.slice(0);
|
|
1083
|
+
for (let i of nodes) {
|
|
1084
|
+
if (i.parent) i.parent.removeChild(i, "ignore");
|
|
1044
1085
|
}
|
|
1045
|
-
} else if (
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
}
|
|
1050
|
-
let origin = this.origin(line, column, endLine, endColumn);
|
|
1051
|
-
if (origin) {
|
|
1052
|
-
result2 = new CssSyntaxError$1(
|
|
1053
|
-
message,
|
|
1054
|
-
origin.endLine === void 0 ? origin.line : { column: origin.column, line: origin.line },
|
|
1055
|
-
origin.endLine === void 0 ? origin.column : { column: origin.endColumn, line: origin.endLine },
|
|
1056
|
-
origin.source,
|
|
1057
|
-
origin.file,
|
|
1058
|
-
opts.plugin
|
|
1059
|
-
);
|
|
1060
|
-
} else {
|
|
1061
|
-
result2 = new CssSyntaxError$1(
|
|
1062
|
-
message,
|
|
1063
|
-
endLine === void 0 ? line : { column, line },
|
|
1064
|
-
endLine === void 0 ? column : { column: endColumn, line: endLine },
|
|
1065
|
-
this.css,
|
|
1066
|
-
this.file,
|
|
1067
|
-
opts.plugin
|
|
1068
|
-
);
|
|
1069
|
-
}
|
|
1070
|
-
result2.input = { column, endColumn, endLine, line, source: this.css };
|
|
1071
|
-
if (this.file) {
|
|
1072
|
-
if (pathToFileURL$1) {
|
|
1073
|
-
result2.input.url = pathToFileURL$1(this.file).toString();
|
|
1086
|
+
} else if (nodes.type === "root" && this.type !== "document") {
|
|
1087
|
+
nodes = nodes.nodes.slice(0);
|
|
1088
|
+
for (let i of nodes) {
|
|
1089
|
+
if (i.parent) i.parent.removeChild(i, "ignore");
|
|
1074
1090
|
}
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
let lines = this.css.split("\n");
|
|
1083
|
-
lineToIndex = new Array(lines.length);
|
|
1084
|
-
let prevIndex = 0;
|
|
1085
|
-
for (let i = 0, l = lines.length; i < l; i++) {
|
|
1086
|
-
lineToIndex[i] = prevIndex;
|
|
1087
|
-
prevIndex += lines[i].length + 1;
|
|
1091
|
+
} else if (nodes.type) {
|
|
1092
|
+
nodes = [nodes];
|
|
1093
|
+
} else if (nodes.prop) {
|
|
1094
|
+
if (typeof nodes.value === "undefined") {
|
|
1095
|
+
throw new Error("Value field is missed in node creation");
|
|
1096
|
+
} else if (typeof nodes.value !== "string") {
|
|
1097
|
+
nodes.value = String(nodes.value);
|
|
1088
1098
|
}
|
|
1089
|
-
|
|
1099
|
+
nodes = [new Declaration$3(nodes)];
|
|
1100
|
+
} else if (nodes.selector || nodes.selectors) {
|
|
1101
|
+
nodes = [new Rule$4(nodes)];
|
|
1102
|
+
} else if (nodes.name) {
|
|
1103
|
+
nodes = [new AtRule$4(nodes)];
|
|
1104
|
+
} else if (nodes.text) {
|
|
1105
|
+
nodes = [new Comment$3(nodes)];
|
|
1090
1106
|
} else {
|
|
1091
|
-
|
|
1107
|
+
throw new Error("Unknown node type in node creation");
|
|
1092
1108
|
}
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
if (offset < lineToIndex[mid]) {
|
|
1103
|
-
max = mid - 1;
|
|
1104
|
-
} else if (offset >= lineToIndex[mid + 1]) {
|
|
1105
|
-
min = mid + 1;
|
|
1106
|
-
} else {
|
|
1107
|
-
min = mid;
|
|
1108
|
-
break;
|
|
1109
|
+
let processed = nodes.map((i) => {
|
|
1110
|
+
if (!i[my$1]) Container.rebuild(i);
|
|
1111
|
+
i = i.proxyOf;
|
|
1112
|
+
if (i.parent) i.parent.removeChild(i);
|
|
1113
|
+
if (i[isClean$1]) markTreeDirty(i);
|
|
1114
|
+
if (!i.raws) i.raws = {};
|
|
1115
|
+
if (typeof i.raws.before === "undefined") {
|
|
1116
|
+
if (sample && typeof sample.raws.before !== "undefined") {
|
|
1117
|
+
i.raws.before = sample.raws.before.replace(/\S/g, "");
|
|
1109
1118
|
}
|
|
1110
1119
|
}
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
};
|
|
1116
|
-
}
|
|
1117
|
-
mapResolve(file) {
|
|
1118
|
-
if (/^\w+:\/\//.test(file)) {
|
|
1119
|
-
return file;
|
|
1120
|
-
}
|
|
1121
|
-
return resolve$1(this.map.consumer().sourceRoot || this.map.root || ".", file);
|
|
1120
|
+
i.parent = this.proxyOf;
|
|
1121
|
+
return i;
|
|
1122
|
+
});
|
|
1123
|
+
return processed;
|
|
1122
1124
|
}
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
let
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
to = consumer.originalPositionFor({ column: endColumn, line: endLine });
|
|
1131
|
-
}
|
|
1132
|
-
let fromUrl;
|
|
1133
|
-
if (isAbsolute(from.source)) {
|
|
1134
|
-
fromUrl = pathToFileURL$1(from.source);
|
|
1135
|
-
} else {
|
|
1136
|
-
fromUrl = new URL(
|
|
1137
|
-
from.source,
|
|
1138
|
-
this.map.consumer().sourceRoot || pathToFileURL$1(this.map.mapFile)
|
|
1139
|
-
);
|
|
1140
|
-
}
|
|
1141
|
-
let result2 = {
|
|
1142
|
-
column: from.column,
|
|
1143
|
-
endColumn: to && to.column,
|
|
1144
|
-
endLine: to && to.line,
|
|
1145
|
-
line: from.line,
|
|
1146
|
-
url: fromUrl.toString()
|
|
1147
|
-
};
|
|
1148
|
-
if (fromUrl.protocol === "file:") {
|
|
1149
|
-
if (fileURLToPath) {
|
|
1150
|
-
result2.file = fileURLToPath(fromUrl);
|
|
1151
|
-
} else {
|
|
1152
|
-
throw new Error(`file: protocol is not available in this PostCSS build`);
|
|
1125
|
+
prepend(...children) {
|
|
1126
|
+
children = children.reverse();
|
|
1127
|
+
for (let child of children) {
|
|
1128
|
+
let nodes = this.normalize(child, this.first, "prepend").reverse();
|
|
1129
|
+
for (let node2 of nodes) this.proxyOf.nodes.unshift(node2);
|
|
1130
|
+
for (let id in this.indexes) {
|
|
1131
|
+
this.indexes[id] = this.indexes[id] + nodes.length;
|
|
1153
1132
|
}
|
|
1154
1133
|
}
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
return result2;
|
|
1134
|
+
this.markDirty();
|
|
1135
|
+
return this;
|
|
1158
1136
|
}
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1137
|
+
push(child) {
|
|
1138
|
+
child.parent = this;
|
|
1139
|
+
this.proxyOf.nodes.push(child);
|
|
1140
|
+
return this;
|
|
1141
|
+
}
|
|
1142
|
+
removeAll() {
|
|
1143
|
+
for (let node2 of this.proxyOf.nodes) node2.parent = void 0;
|
|
1144
|
+
this.proxyOf.nodes = [];
|
|
1145
|
+
this.markDirty();
|
|
1146
|
+
return this;
|
|
1147
|
+
}
|
|
1148
|
+
removeChild(child) {
|
|
1149
|
+
child = this.index(child);
|
|
1150
|
+
this.proxyOf.nodes[child].parent = void 0;
|
|
1151
|
+
this.proxyOf.nodes.splice(child, 1);
|
|
1152
|
+
let index2;
|
|
1153
|
+
for (let id in this.indexes) {
|
|
1154
|
+
index2 = this.indexes[id];
|
|
1155
|
+
if (index2 >= child) {
|
|
1156
|
+
this.indexes[id] = index2 - 1;
|
|
1170
1157
|
}
|
|
1171
1158
|
}
|
|
1172
|
-
|
|
1159
|
+
this.markDirty();
|
|
1160
|
+
return this;
|
|
1173
1161
|
}
|
|
1174
|
-
|
|
1175
|
-
|
|
1162
|
+
replaceValues(pattern, opts, callback) {
|
|
1163
|
+
if (!callback) {
|
|
1164
|
+
callback = opts;
|
|
1165
|
+
opts = {};
|
|
1166
|
+
}
|
|
1167
|
+
this.walkDecls((decl) => {
|
|
1168
|
+
if (opts.props && !opts.props.includes(decl.prop)) return;
|
|
1169
|
+
if (opts.fast && !decl.value.includes(opts.fast)) return;
|
|
1170
|
+
decl.value = decl.value.replace(pattern, callback);
|
|
1171
|
+
});
|
|
1172
|
+
this.markDirty();
|
|
1173
|
+
return this;
|
|
1176
1174
|
}
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
Input$4.default = Input$4;
|
|
1180
|
-
if (terminalHighlight && terminalHighlight.registerInput) {
|
|
1181
|
-
terminalHighlight.registerInput(Input$4);
|
|
1182
|
-
}
|
|
1183
|
-
let { SourceMapConsumer, SourceMapGenerator } = require$$2;
|
|
1184
|
-
let { dirname, relative, resolve, sep } = require$$2;
|
|
1185
|
-
let { pathToFileURL } = require$$2;
|
|
1186
|
-
let Input$3 = input;
|
|
1187
|
-
let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);
|
|
1188
|
-
let pathAvailable = Boolean(dirname && resolve && relative && sep);
|
|
1189
|
-
let MapGenerator$2 = class MapGenerator {
|
|
1190
|
-
constructor(stringify2, root2, opts, cssString) {
|
|
1191
|
-
this.stringify = stringify2;
|
|
1192
|
-
this.mapOpts = opts.map || {};
|
|
1193
|
-
this.root = root2;
|
|
1194
|
-
this.opts = opts;
|
|
1195
|
-
this.css = cssString;
|
|
1196
|
-
this.originalCSS = cssString;
|
|
1197
|
-
this.usesFileUrls = !this.mapOpts.from && this.mapOpts.absolute;
|
|
1198
|
-
this.memoizedFileURLs = /* @__PURE__ */ new Map();
|
|
1199
|
-
this.memoizedPaths = /* @__PURE__ */ new Map();
|
|
1200
|
-
this.memoizedURLs = /* @__PURE__ */ new Map();
|
|
1201
|
-
}
|
|
1202
|
-
addAnnotation() {
|
|
1203
|
-
let content;
|
|
1204
|
-
if (this.isInline()) {
|
|
1205
|
-
content = "data:application/json;base64," + this.toBase64(this.map.toString());
|
|
1206
|
-
} else if (typeof this.mapOpts.annotation === "string") {
|
|
1207
|
-
content = this.mapOpts.annotation;
|
|
1208
|
-
} else if (typeof this.mapOpts.annotation === "function") {
|
|
1209
|
-
content = this.mapOpts.annotation(this.opts.to, this.root);
|
|
1210
|
-
} else {
|
|
1211
|
-
content = this.outputFile() + ".map";
|
|
1212
|
-
}
|
|
1213
|
-
let eol = "\n";
|
|
1214
|
-
if (this.css.includes("\r\n")) eol = "\r\n";
|
|
1215
|
-
this.css += eol + "/*# sourceMappingURL=" + content + " */";
|
|
1175
|
+
some(condition) {
|
|
1176
|
+
return this.nodes.some(condition);
|
|
1216
1177
|
}
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
let
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
if (map.sourcesContent) {
|
|
1225
|
-
map.sourcesContent = null;
|
|
1226
|
-
}
|
|
1227
|
-
} else {
|
|
1228
|
-
map = prev.consumer();
|
|
1178
|
+
walk(callback) {
|
|
1179
|
+
return this.each((child, i) => {
|
|
1180
|
+
let result2;
|
|
1181
|
+
try {
|
|
1182
|
+
result2 = callback(child, i);
|
|
1183
|
+
} catch (e) {
|
|
1184
|
+
throw child.addToError(e);
|
|
1229
1185
|
}
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
}
|
|
1233
|
-
clearAnnotation() {
|
|
1234
|
-
if (this.mapOpts.annotation === false) return;
|
|
1235
|
-
if (this.root) {
|
|
1236
|
-
let node2;
|
|
1237
|
-
for (let i = this.root.nodes.length - 1; i >= 0; i--) {
|
|
1238
|
-
node2 = this.root.nodes[i];
|
|
1239
|
-
if (node2.type !== "comment") continue;
|
|
1240
|
-
if (node2.text.indexOf("# sourceMappingURL=") === 0) {
|
|
1241
|
-
this.root.removeChild(i);
|
|
1242
|
-
}
|
|
1186
|
+
if (result2 !== false && child.walk) {
|
|
1187
|
+
result2 = child.walk(callback);
|
|
1243
1188
|
}
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
}
|
|
1189
|
+
return result2;
|
|
1190
|
+
});
|
|
1247
1191
|
}
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
return this.
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
result2 += i;
|
|
1192
|
+
walkAtRules(name, callback) {
|
|
1193
|
+
if (!callback) {
|
|
1194
|
+
callback = name;
|
|
1195
|
+
return this.walk((child, i) => {
|
|
1196
|
+
if (child.type === "atrule") {
|
|
1197
|
+
return callback(child, i);
|
|
1198
|
+
}
|
|
1256
1199
|
});
|
|
1257
|
-
return [result2];
|
|
1258
1200
|
}
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
let prev = this.previous()[0].consumer();
|
|
1265
|
-
prev.file = this.outputFile();
|
|
1266
|
-
this.map = SourceMapGenerator.fromSourceMap(prev, {
|
|
1267
|
-
ignoreInvalidMapping: true
|
|
1268
|
-
});
|
|
1269
|
-
} else {
|
|
1270
|
-
this.map = new SourceMapGenerator({
|
|
1271
|
-
file: this.outputFile(),
|
|
1272
|
-
ignoreInvalidMapping: true
|
|
1273
|
-
});
|
|
1274
|
-
this.map.addMapping({
|
|
1275
|
-
generated: { column: 0, line: 1 },
|
|
1276
|
-
original: { column: 0, line: 1 },
|
|
1277
|
-
source: this.opts.from ? this.toUrl(this.path(this.opts.from)) : "<no source>"
|
|
1201
|
+
if (name instanceof RegExp) {
|
|
1202
|
+
return this.walk((child, i) => {
|
|
1203
|
+
if (child.type === "atrule" && name.test(child.name)) {
|
|
1204
|
+
return callback(child, i);
|
|
1205
|
+
}
|
|
1278
1206
|
});
|
|
1279
1207
|
}
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
if (this.isInline()) {
|
|
1284
|
-
return [this.css];
|
|
1285
|
-
} else {
|
|
1286
|
-
return [this.css, this.map];
|
|
1287
|
-
}
|
|
1288
|
-
}
|
|
1289
|
-
generateString() {
|
|
1290
|
-
this.css = "";
|
|
1291
|
-
this.map = new SourceMapGenerator({
|
|
1292
|
-
file: this.outputFile(),
|
|
1293
|
-
ignoreInvalidMapping: true
|
|
1294
|
-
});
|
|
1295
|
-
let line = 1;
|
|
1296
|
-
let column = 1;
|
|
1297
|
-
let noSource = "<no source>";
|
|
1298
|
-
let mapping = {
|
|
1299
|
-
generated: { column: 0, line: 0 },
|
|
1300
|
-
original: { column: 0, line: 0 },
|
|
1301
|
-
source: ""
|
|
1302
|
-
};
|
|
1303
|
-
let lines, last;
|
|
1304
|
-
this.stringify(this.root, (str, node2, type) => {
|
|
1305
|
-
this.css += str;
|
|
1306
|
-
if (node2 && type !== "end") {
|
|
1307
|
-
mapping.generated.line = line;
|
|
1308
|
-
mapping.generated.column = column - 1;
|
|
1309
|
-
if (node2.source && node2.source.start) {
|
|
1310
|
-
mapping.source = this.sourcePath(node2);
|
|
1311
|
-
mapping.original.line = node2.source.start.line;
|
|
1312
|
-
mapping.original.column = node2.source.start.column - 1;
|
|
1313
|
-
this.map.addMapping(mapping);
|
|
1314
|
-
} else {
|
|
1315
|
-
mapping.source = noSource;
|
|
1316
|
-
mapping.original.line = 1;
|
|
1317
|
-
mapping.original.column = 0;
|
|
1318
|
-
this.map.addMapping(mapping);
|
|
1319
|
-
}
|
|
1320
|
-
}
|
|
1321
|
-
lines = str.match(/\n/g);
|
|
1322
|
-
if (lines) {
|
|
1323
|
-
line += lines.length;
|
|
1324
|
-
last = str.lastIndexOf("\n");
|
|
1325
|
-
column = str.length - last;
|
|
1326
|
-
} else {
|
|
1327
|
-
column += str.length;
|
|
1208
|
+
return this.walk((child, i) => {
|
|
1209
|
+
if (child.type === "atrule" && child.name === name) {
|
|
1210
|
+
return callback(child, i);
|
|
1328
1211
|
}
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
mapping.original.line = node2.source.end.line;
|
|
1336
|
-
mapping.original.column = node2.source.end.column - 1;
|
|
1337
|
-
mapping.generated.line = line;
|
|
1338
|
-
mapping.generated.column = column - 2;
|
|
1339
|
-
this.map.addMapping(mapping);
|
|
1340
|
-
} else {
|
|
1341
|
-
mapping.source = noSource;
|
|
1342
|
-
mapping.original.line = 1;
|
|
1343
|
-
mapping.original.column = 0;
|
|
1344
|
-
mapping.generated.line = line;
|
|
1345
|
-
mapping.generated.column = column - 1;
|
|
1346
|
-
this.map.addMapping(mapping);
|
|
1347
|
-
}
|
|
1348
|
-
}
|
|
1212
|
+
});
|
|
1213
|
+
}
|
|
1214
|
+
walkComments(callback) {
|
|
1215
|
+
return this.walk((child, i) => {
|
|
1216
|
+
if (child.type === "comment") {
|
|
1217
|
+
return callback(child, i);
|
|
1349
1218
|
}
|
|
1350
1219
|
});
|
|
1351
1220
|
}
|
|
1352
|
-
|
|
1353
|
-
if (
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1221
|
+
walkDecls(prop, callback) {
|
|
1222
|
+
if (!callback) {
|
|
1223
|
+
callback = prop;
|
|
1224
|
+
return this.walk((child, i) => {
|
|
1225
|
+
if (child.type === "decl") {
|
|
1226
|
+
return callback(child, i);
|
|
1227
|
+
}
|
|
1228
|
+
});
|
|
1358
1229
|
}
|
|
1359
|
-
if (
|
|
1360
|
-
return this.
|
|
1230
|
+
if (prop instanceof RegExp) {
|
|
1231
|
+
return this.walk((child, i) => {
|
|
1232
|
+
if (child.type === "decl" && prop.test(child.prop)) {
|
|
1233
|
+
return callback(child, i);
|
|
1234
|
+
}
|
|
1235
|
+
});
|
|
1361
1236
|
}
|
|
1362
|
-
return
|
|
1237
|
+
return this.walk((child, i) => {
|
|
1238
|
+
if (child.type === "decl" && child.prop === prop) {
|
|
1239
|
+
return callback(child, i);
|
|
1240
|
+
}
|
|
1241
|
+
});
|
|
1363
1242
|
}
|
|
1364
|
-
|
|
1365
|
-
if (
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1243
|
+
walkRules(selector, callback) {
|
|
1244
|
+
if (!callback) {
|
|
1245
|
+
callback = selector;
|
|
1246
|
+
return this.walk((child, i) => {
|
|
1247
|
+
if (child.type === "rule") {
|
|
1248
|
+
return callback(child, i);
|
|
1249
|
+
}
|
|
1250
|
+
});
|
|
1371
1251
|
}
|
|
1372
|
-
if (
|
|
1373
|
-
return this.
|
|
1252
|
+
if (selector instanceof RegExp) {
|
|
1253
|
+
return this.walk((child, i) => {
|
|
1254
|
+
if (child.type === "rule" && selector.test(child.selector)) {
|
|
1255
|
+
return callback(child, i);
|
|
1256
|
+
}
|
|
1257
|
+
});
|
|
1374
1258
|
}
|
|
1375
|
-
return
|
|
1259
|
+
return this.walk((child, i) => {
|
|
1260
|
+
if (child.type === "rule" && child.selector === selector) {
|
|
1261
|
+
return callback(child, i);
|
|
1262
|
+
}
|
|
1263
|
+
});
|
|
1376
1264
|
}
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
if (file.charCodeAt(0) === 60) return file;
|
|
1404
|
-
if (/^\w+:\/\//.test(file)) return file;
|
|
1405
|
-
let cached = this.memoizedPaths.get(file);
|
|
1406
|
-
if (cached) return cached;
|
|
1407
|
-
let from = this.opts.to ? dirname(this.opts.to) : ".";
|
|
1408
|
-
if (typeof this.mapOpts.annotation === "string") {
|
|
1409
|
-
from = dirname(resolve(from, this.mapOpts.annotation));
|
|
1410
|
-
}
|
|
1411
|
-
let path = relative(from, file);
|
|
1412
|
-
this.memoizedPaths.set(file, path);
|
|
1413
|
-
return path;
|
|
1265
|
+
};
|
|
1266
|
+
Container$7.registerParse = (dependant) => {
|
|
1267
|
+
parse$4 = dependant;
|
|
1268
|
+
};
|
|
1269
|
+
Container$7.registerRule = (dependant) => {
|
|
1270
|
+
Rule$4 = dependant;
|
|
1271
|
+
};
|
|
1272
|
+
Container$7.registerAtRule = (dependant) => {
|
|
1273
|
+
AtRule$4 = dependant;
|
|
1274
|
+
};
|
|
1275
|
+
Container$7.registerRoot = (dependant) => {
|
|
1276
|
+
Root$6 = dependant;
|
|
1277
|
+
};
|
|
1278
|
+
var container = Container$7;
|
|
1279
|
+
Container$7.default = Container$7;
|
|
1280
|
+
Container$7.rebuild = (node2) => {
|
|
1281
|
+
if (node2.type === "atrule") {
|
|
1282
|
+
Object.setPrototypeOf(node2, AtRule$4.prototype);
|
|
1283
|
+
} else if (node2.type === "rule") {
|
|
1284
|
+
Object.setPrototypeOf(node2, Rule$4.prototype);
|
|
1285
|
+
} else if (node2.type === "decl") {
|
|
1286
|
+
Object.setPrototypeOf(node2, Declaration$3.prototype);
|
|
1287
|
+
} else if (node2.type === "comment") {
|
|
1288
|
+
Object.setPrototypeOf(node2, Comment$3.prototype);
|
|
1289
|
+
} else if (node2.type === "root") {
|
|
1290
|
+
Object.setPrototypeOf(node2, Root$6.prototype);
|
|
1414
1291
|
}
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
if (node2.source && node2.source.input.map) {
|
|
1421
|
-
let map = node2.source.input.map;
|
|
1422
|
-
if (!this.previousMaps.includes(map)) {
|
|
1423
|
-
this.previousMaps.push(map);
|
|
1424
|
-
}
|
|
1425
|
-
}
|
|
1426
|
-
});
|
|
1427
|
-
} else {
|
|
1428
|
-
let input2 = new Input$3(this.originalCSS, this.opts);
|
|
1429
|
-
if (input2.map) this.previousMaps.push(input2.map);
|
|
1430
|
-
}
|
|
1431
|
-
}
|
|
1432
|
-
return this.previousMaps;
|
|
1292
|
+
node2[my$1] = true;
|
|
1293
|
+
if (node2.nodes) {
|
|
1294
|
+
node2.nodes.forEach((child) => {
|
|
1295
|
+
Container$7.rebuild(child);
|
|
1296
|
+
});
|
|
1433
1297
|
}
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
if (from && !already[from]) {
|
|
1441
|
-
already[from] = true;
|
|
1442
|
-
let fromUrl = this.usesFileUrls ? this.toFileUrl(from) : this.toUrl(this.path(from));
|
|
1443
|
-
this.map.setSourceContent(fromUrl, node2.source.input.css);
|
|
1444
|
-
}
|
|
1445
|
-
}
|
|
1446
|
-
});
|
|
1447
|
-
} else if (this.css) {
|
|
1448
|
-
let from = this.opts.from ? this.toUrl(this.path(this.opts.from)) : "<no source>";
|
|
1449
|
-
this.map.setSourceContent(from, this.css);
|
|
1450
|
-
}
|
|
1298
|
+
};
|
|
1299
|
+
let Container$6 = container;
|
|
1300
|
+
let AtRule$3 = class AtRule extends Container$6 {
|
|
1301
|
+
constructor(defaults) {
|
|
1302
|
+
super(defaults);
|
|
1303
|
+
this.type = "atrule";
|
|
1451
1304
|
}
|
|
1452
|
-
|
|
1453
|
-
if (this.
|
|
1454
|
-
|
|
1455
|
-
} else if (this.usesFileUrls) {
|
|
1456
|
-
return this.toFileUrl(node2.source.input.from);
|
|
1457
|
-
} else {
|
|
1458
|
-
return this.toUrl(this.path(node2.source.input.from));
|
|
1459
|
-
}
|
|
1305
|
+
append(...children) {
|
|
1306
|
+
if (!this.proxyOf.nodes) this.nodes = [];
|
|
1307
|
+
return super.append(...children);
|
|
1460
1308
|
}
|
|
1461
|
-
|
|
1462
|
-
if (
|
|
1463
|
-
|
|
1464
|
-
} else {
|
|
1465
|
-
return window.btoa(unescape(encodeURIComponent(str)));
|
|
1466
|
-
}
|
|
1309
|
+
prepend(...children) {
|
|
1310
|
+
if (!this.proxyOf.nodes) this.nodes = [];
|
|
1311
|
+
return super.prepend(...children);
|
|
1467
1312
|
}
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1313
|
+
};
|
|
1314
|
+
var atRule = AtRule$3;
|
|
1315
|
+
AtRule$3.default = AtRule$3;
|
|
1316
|
+
Container$6.registerAtRule(AtRule$3);
|
|
1317
|
+
let Container$5 = container;
|
|
1318
|
+
let LazyResult$4, Processor$3;
|
|
1319
|
+
let Document$4 = class Document2 extends Container$5 {
|
|
1320
|
+
constructor(defaults) {
|
|
1321
|
+
super({ type: "document", ...defaults });
|
|
1322
|
+
if (!this.nodes) {
|
|
1323
|
+
this.nodes = [];
|
|
1479
1324
|
}
|
|
1480
1325
|
}
|
|
1481
|
-
|
|
1482
|
-
let
|
|
1483
|
-
|
|
1484
|
-
if (sep === "\\") {
|
|
1485
|
-
path = path.replace(/\\/g, "/");
|
|
1486
|
-
}
|
|
1487
|
-
let url = encodeURI(path).replace(/[#?]/g, encodeURIComponent);
|
|
1488
|
-
this.memoizedURLs.set(path, url);
|
|
1489
|
-
return url;
|
|
1326
|
+
toResult(opts = {}) {
|
|
1327
|
+
let lazy = new LazyResult$4(new Processor$3(), this, opts);
|
|
1328
|
+
return lazy.stringify();
|
|
1490
1329
|
}
|
|
1491
1330
|
};
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1331
|
+
Document$4.registerLazyResult = (dependant) => {
|
|
1332
|
+
LazyResult$4 = dependant;
|
|
1333
|
+
};
|
|
1334
|
+
Document$4.registerProcessor = (dependant) => {
|
|
1335
|
+
Processor$3 = dependant;
|
|
1336
|
+
};
|
|
1337
|
+
var document$1 = Document$4;
|
|
1338
|
+
Document$4.default = Document$4;
|
|
1339
|
+
let urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
1340
|
+
let nanoid$1 = (size = 21) => {
|
|
1341
|
+
let id = "";
|
|
1342
|
+
let i = size | 0;
|
|
1343
|
+
while (i--) {
|
|
1344
|
+
id += urlAlphabet[Math.random() * 64 | 0];
|
|
1498
1345
|
}
|
|
1346
|
+
return id;
|
|
1499
1347
|
};
|
|
1500
|
-
var
|
|
1501
|
-
|
|
1502
|
-
let {
|
|
1503
|
-
let
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
if (i.nodes) i.nodes = cleanSource(i.nodes);
|
|
1510
|
-
delete i.source;
|
|
1511
|
-
return i;
|
|
1512
|
-
});
|
|
1513
|
-
}
|
|
1514
|
-
function markDirtyUp(node2) {
|
|
1515
|
-
node2[isClean$1] = false;
|
|
1516
|
-
if (node2.proxyOf.nodes) {
|
|
1517
|
-
for (let i of node2.proxyOf.nodes) {
|
|
1518
|
-
markDirtyUp(i);
|
|
1519
|
-
}
|
|
1348
|
+
var nonSecure = { nanoid: nanoid$1 };
|
|
1349
|
+
let { existsSync, readFileSync } = require$$2;
|
|
1350
|
+
let { dirname: dirname$1, join } = require$$2;
|
|
1351
|
+
let { SourceMapConsumer: SourceMapConsumer$2, SourceMapGenerator: SourceMapGenerator$2 } = require$$2;
|
|
1352
|
+
function fromBase64(str) {
|
|
1353
|
+
if (Buffer) {
|
|
1354
|
+
return Buffer.from(str, "base64").toString();
|
|
1355
|
+
} else {
|
|
1356
|
+
return window.atob(str);
|
|
1520
1357
|
}
|
|
1521
1358
|
}
|
|
1522
|
-
let
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1359
|
+
let PreviousMap$2 = class PreviousMap {
|
|
1360
|
+
constructor(css, opts) {
|
|
1361
|
+
if (opts.map === false) return;
|
|
1362
|
+
this.loadAnnotation(css);
|
|
1363
|
+
this.inline = this.startWith(this.annotation, "data:");
|
|
1364
|
+
let prev = opts.map ? opts.map.prev : void 0;
|
|
1365
|
+
let text = this.loadMap(opts.from, prev);
|
|
1366
|
+
if (!this.mapFile && opts.from) {
|
|
1367
|
+
this.mapFile = opts.from;
|
|
1527
1368
|
}
|
|
1528
|
-
this.
|
|
1529
|
-
|
|
1369
|
+
if (this.mapFile) this.root = dirname$1(this.mapFile);
|
|
1370
|
+
if (text) this.text = text;
|
|
1530
1371
|
}
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
for (let node2 of this.nodes) node2.cleanRaws(keepBetween);
|
|
1372
|
+
consumer() {
|
|
1373
|
+
if (!this.consumerCache) {
|
|
1374
|
+
this.consumerCache = new SourceMapConsumer$2(this.text);
|
|
1535
1375
|
}
|
|
1376
|
+
return this.consumerCache;
|
|
1536
1377
|
}
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
let
|
|
1540
|
-
let
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
this.indexes[iterator] += 1;
|
|
1378
|
+
decodeInline(text) {
|
|
1379
|
+
let baseCharsetUri = /^data:application\/json;charset=utf-?8;base64,/;
|
|
1380
|
+
let baseUri = /^data:application\/json;base64,/;
|
|
1381
|
+
let charsetUri = /^data:application\/json;charset=utf-?8,/;
|
|
1382
|
+
let uri = /^data:application\/json,/;
|
|
1383
|
+
let uriMatch = text.match(charsetUri) || text.match(uri);
|
|
1384
|
+
if (uriMatch) {
|
|
1385
|
+
return decodeURIComponent(text.substr(uriMatch[0].length));
|
|
1546
1386
|
}
|
|
1547
|
-
|
|
1548
|
-
|
|
1387
|
+
let baseUriMatch = text.match(baseCharsetUri) || text.match(baseUri);
|
|
1388
|
+
if (baseUriMatch) {
|
|
1389
|
+
return fromBase64(text.substr(baseUriMatch[0].length));
|
|
1390
|
+
}
|
|
1391
|
+
let encoding = text.match(/data:application\/json;([^,]+),/)[1];
|
|
1392
|
+
throw new Error("Unsupported source map encoding " + encoding);
|
|
1549
1393
|
}
|
|
1550
|
-
|
|
1551
|
-
return
|
|
1394
|
+
getAnnotationURL(sourceMapString) {
|
|
1395
|
+
return sourceMapString.replace(/^\/\*\s*# sourceMappingURL=/, "").trim();
|
|
1552
1396
|
}
|
|
1553
|
-
|
|
1554
|
-
if (
|
|
1555
|
-
|
|
1556
|
-
this.lastEach += 1;
|
|
1557
|
-
let iterator = this.lastEach;
|
|
1558
|
-
this.indexes[iterator] = 0;
|
|
1559
|
-
return iterator;
|
|
1397
|
+
isMap(map) {
|
|
1398
|
+
if (typeof map !== "object") return false;
|
|
1399
|
+
return typeof map.mappings === "string" || typeof map._mappings === "string" || Array.isArray(map.sections);
|
|
1560
1400
|
}
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1401
|
+
loadAnnotation(css) {
|
|
1402
|
+
let comments = css.match(/\/\*\s*# sourceMappingURL=/g);
|
|
1403
|
+
if (!comments) return;
|
|
1404
|
+
let start = css.lastIndexOf(comments.pop());
|
|
1405
|
+
let end = css.indexOf("*/", start);
|
|
1406
|
+
if (start > -1 && end > -1) {
|
|
1407
|
+
this.annotation = this.getAnnotationURL(css.substring(start, end));
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
loadFile(path) {
|
|
1411
|
+
this.root = dirname$1(path);
|
|
1412
|
+
if (existsSync(path)) {
|
|
1413
|
+
this.mapFile = path;
|
|
1414
|
+
return readFileSync(path, "utf-8").toString().trim();
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
loadMap(file, prev) {
|
|
1418
|
+
if (prev === false) return false;
|
|
1419
|
+
if (prev) {
|
|
1420
|
+
if (typeof prev === "string") {
|
|
1421
|
+
return prev;
|
|
1422
|
+
} else if (typeof prev === "function") {
|
|
1423
|
+
let prevPath = prev(file);
|
|
1424
|
+
if (prevPath) {
|
|
1425
|
+
let map = this.loadFile(prevPath);
|
|
1426
|
+
if (!map) {
|
|
1427
|
+
throw new Error(
|
|
1428
|
+
"Unable to load previous source map: " + prevPath.toString()
|
|
1584
1429
|
);
|
|
1585
|
-
}
|
|
1586
|
-
|
|
1587
|
-
return () => node2.root().toProxy();
|
|
1588
|
-
} else if (prop === "nodes") {
|
|
1589
|
-
return node2.nodes.map((i) => i.toProxy());
|
|
1590
|
-
} else if (prop === "first" || prop === "last") {
|
|
1591
|
-
return node2[prop].toProxy();
|
|
1592
|
-
} else {
|
|
1593
|
-
return node2[prop];
|
|
1594
|
-
}
|
|
1595
|
-
},
|
|
1596
|
-
set(node2, prop, value) {
|
|
1597
|
-
if (node2[prop] === value) return true;
|
|
1598
|
-
node2[prop] = value;
|
|
1599
|
-
if (prop === "name" || prop === "params" || prop === "selector") {
|
|
1600
|
-
node2.markDirty();
|
|
1430
|
+
}
|
|
1431
|
+
return map;
|
|
1601
1432
|
}
|
|
1602
|
-
|
|
1433
|
+
} else if (prev instanceof SourceMapConsumer$2) {
|
|
1434
|
+
return SourceMapGenerator$2.fromSourceMap(prev).toString();
|
|
1435
|
+
} else if (prev instanceof SourceMapGenerator$2) {
|
|
1436
|
+
return prev.toString();
|
|
1437
|
+
} else if (this.isMap(prev)) {
|
|
1438
|
+
return JSON.stringify(prev);
|
|
1439
|
+
} else {
|
|
1440
|
+
throw new Error(
|
|
1441
|
+
"Unsupported previous source map format: " + prev.toString()
|
|
1442
|
+
);
|
|
1603
1443
|
}
|
|
1604
|
-
}
|
|
1444
|
+
} else if (this.inline) {
|
|
1445
|
+
return this.decodeInline(this.annotation);
|
|
1446
|
+
} else if (this.annotation) {
|
|
1447
|
+
let map = this.annotation;
|
|
1448
|
+
if (file) map = join(dirname$1(file), map);
|
|
1449
|
+
return this.loadFile(map);
|
|
1450
|
+
}
|
|
1605
1451
|
}
|
|
1606
|
-
|
|
1607
|
-
if (
|
|
1608
|
-
|
|
1609
|
-
return this.proxyOf.nodes.indexOf(child);
|
|
1452
|
+
startWith(string, start) {
|
|
1453
|
+
if (!string) return false;
|
|
1454
|
+
return string.substr(0, start.length) === start;
|
|
1610
1455
|
}
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1456
|
+
withContent() {
|
|
1457
|
+
return !!(this.consumer().sourcesContent && this.consumer().sourcesContent.length > 0);
|
|
1458
|
+
}
|
|
1459
|
+
};
|
|
1460
|
+
var previousMap = PreviousMap$2;
|
|
1461
|
+
PreviousMap$2.default = PreviousMap$2;
|
|
1462
|
+
let { nanoid } = nonSecure;
|
|
1463
|
+
let { isAbsolute, resolve: resolve$1 } = require$$2;
|
|
1464
|
+
let { SourceMapConsumer: SourceMapConsumer$1, SourceMapGenerator: SourceMapGenerator$1 } = require$$2;
|
|
1465
|
+
let { fileURLToPath, pathToFileURL: pathToFileURL$1 } = require$$2;
|
|
1466
|
+
let CssSyntaxError$1 = cssSyntaxError;
|
|
1467
|
+
let PreviousMap$1 = previousMap;
|
|
1468
|
+
let terminalHighlight = require$$2;
|
|
1469
|
+
let lineToIndexCache = Symbol("lineToIndexCache");
|
|
1470
|
+
let sourceMapAvailable$1 = Boolean(SourceMapConsumer$1 && SourceMapGenerator$1);
|
|
1471
|
+
let pathAvailable$1 = Boolean(resolve$1 && isAbsolute);
|
|
1472
|
+
function getLineToIndex(input2) {
|
|
1473
|
+
if (input2[lineToIndexCache]) return input2[lineToIndexCache];
|
|
1474
|
+
let lines = input2.css.split("\n");
|
|
1475
|
+
let lineToIndex = new Array(lines.length);
|
|
1476
|
+
let prevIndex = 0;
|
|
1477
|
+
for (let i = 0, l = lines.length; i < l; i++) {
|
|
1478
|
+
lineToIndex[i] = prevIndex;
|
|
1479
|
+
prevIndex += lines[i].length + 1;
|
|
1480
|
+
}
|
|
1481
|
+
input2[lineToIndexCache] = lineToIndex;
|
|
1482
|
+
return lineToIndex;
|
|
1483
|
+
}
|
|
1484
|
+
let Input$4 = class Input {
|
|
1485
|
+
get from() {
|
|
1486
|
+
return this.file || this.id;
|
|
1487
|
+
}
|
|
1488
|
+
constructor(css, opts = {}) {
|
|
1489
|
+
if (css === null || typeof css === "undefined" || typeof css === "object" && !css.toString) {
|
|
1490
|
+
throw new Error(`PostCSS received ${css} instead of CSS string`);
|
|
1491
|
+
}
|
|
1492
|
+
this.css = css.toString();
|
|
1493
|
+
if (this.css[0] === "\uFEFF" || this.css[0] === "") {
|
|
1494
|
+
this.hasBOM = true;
|
|
1495
|
+
this.css = this.css.slice(1);
|
|
1496
|
+
} else {
|
|
1497
|
+
this.hasBOM = false;
|
|
1498
|
+
}
|
|
1499
|
+
this.document = this.css;
|
|
1500
|
+
if (opts.document) this.document = opts.document.toString();
|
|
1501
|
+
if (opts.from) {
|
|
1502
|
+
if (!pathAvailable$1 || /^\w+:\/\//.test(opts.from) || isAbsolute(opts.from)) {
|
|
1503
|
+
this.file = opts.from;
|
|
1504
|
+
} else {
|
|
1505
|
+
this.file = resolve$1(opts.from);
|
|
1621
1506
|
}
|
|
1622
1507
|
}
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
let nodes = this.normalize(add, this.proxyOf.nodes[existIndex], type).reverse();
|
|
1630
|
-
existIndex = this.index(exist);
|
|
1631
|
-
for (let node2 of nodes) this.proxyOf.nodes.splice(existIndex, 0, node2);
|
|
1632
|
-
let index2;
|
|
1633
|
-
for (let id in this.indexes) {
|
|
1634
|
-
index2 = this.indexes[id];
|
|
1635
|
-
if (existIndex <= index2) {
|
|
1636
|
-
this.indexes[id] = index2 + nodes.length;
|
|
1508
|
+
if (pathAvailable$1 && sourceMapAvailable$1) {
|
|
1509
|
+
let map = new PreviousMap$1(this.css, opts);
|
|
1510
|
+
if (map.text) {
|
|
1511
|
+
this.map = map;
|
|
1512
|
+
let file = map.consumer().file;
|
|
1513
|
+
if (!this.file && file) this.file = this.mapResolve(file);
|
|
1637
1514
|
}
|
|
1638
1515
|
}
|
|
1639
|
-
this.
|
|
1640
|
-
|
|
1516
|
+
if (!this.file) {
|
|
1517
|
+
this.id = "<input css " + nanoid(6) + ">";
|
|
1518
|
+
}
|
|
1519
|
+
if (this.map) this.map.file = this.from;
|
|
1641
1520
|
}
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1521
|
+
error(message, line, column, opts = {}) {
|
|
1522
|
+
let endColumn, endLine, endOffset, offset, result2;
|
|
1523
|
+
if (line && typeof line === "object") {
|
|
1524
|
+
let start = line;
|
|
1525
|
+
let end = column;
|
|
1526
|
+
if (typeof start.offset === "number") {
|
|
1527
|
+
offset = start.offset;
|
|
1528
|
+
let pos = this.fromOffset(offset);
|
|
1529
|
+
line = pos.line;
|
|
1530
|
+
column = pos.col;
|
|
1531
|
+
} else {
|
|
1532
|
+
line = start.line;
|
|
1533
|
+
column = start.column;
|
|
1534
|
+
offset = this.fromLineAndColumn(line, column);
|
|
1651
1535
|
}
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1536
|
+
if (typeof end.offset === "number") {
|
|
1537
|
+
endOffset = end.offset;
|
|
1538
|
+
let pos = this.fromOffset(endOffset);
|
|
1539
|
+
endLine = pos.line;
|
|
1540
|
+
endColumn = pos.col;
|
|
1541
|
+
} else {
|
|
1542
|
+
endLine = end.line;
|
|
1543
|
+
endColumn = end.column;
|
|
1544
|
+
endOffset = this.fromLineAndColumn(end.line, end.column);
|
|
1656
1545
|
}
|
|
1657
|
-
} else if (
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1546
|
+
} else if (!column) {
|
|
1547
|
+
offset = line;
|
|
1548
|
+
let pos = this.fromOffset(offset);
|
|
1549
|
+
line = pos.line;
|
|
1550
|
+
column = pos.col;
|
|
1551
|
+
} else {
|
|
1552
|
+
offset = this.fromLineAndColumn(line, column);
|
|
1553
|
+
}
|
|
1554
|
+
let origin = this.origin(line, column, endLine, endColumn);
|
|
1555
|
+
if (origin) {
|
|
1556
|
+
result2 = new CssSyntaxError$1(
|
|
1557
|
+
message,
|
|
1558
|
+
origin.endLine === void 0 ? origin.line : { column: origin.column, line: origin.line },
|
|
1559
|
+
origin.endLine === void 0 ? origin.column : { column: origin.endColumn, line: origin.endLine },
|
|
1560
|
+
origin.source,
|
|
1561
|
+
origin.file,
|
|
1562
|
+
opts.plugin
|
|
1563
|
+
);
|
|
1564
|
+
} else {
|
|
1565
|
+
result2 = new CssSyntaxError$1(
|
|
1566
|
+
message,
|
|
1567
|
+
endLine === void 0 ? line : { column, line },
|
|
1568
|
+
endLine === void 0 ? column : { column: endColumn, line: endLine },
|
|
1569
|
+
this.css,
|
|
1570
|
+
this.file,
|
|
1571
|
+
opts.plugin
|
|
1572
|
+
);
|
|
1573
|
+
}
|
|
1574
|
+
result2.input = { column, endColumn, endLine, endOffset, line, offset, source: this.css };
|
|
1575
|
+
if (this.file) {
|
|
1576
|
+
if (pathToFileURL$1) {
|
|
1577
|
+
result2.input.url = pathToFileURL$1(this.file).toString();
|
|
1664
1578
|
}
|
|
1665
|
-
|
|
1666
|
-
}
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1579
|
+
result2.input.file = this.file;
|
|
1580
|
+
}
|
|
1581
|
+
return result2;
|
|
1582
|
+
}
|
|
1583
|
+
fromLineAndColumn(line, column) {
|
|
1584
|
+
let lineToIndex = getLineToIndex(this);
|
|
1585
|
+
let index2 = lineToIndex[line - 1];
|
|
1586
|
+
return index2 + column - 1;
|
|
1587
|
+
}
|
|
1588
|
+
fromOffset(offset) {
|
|
1589
|
+
let lineToIndex = getLineToIndex(this);
|
|
1590
|
+
let lastLine = lineToIndex[lineToIndex.length - 1];
|
|
1591
|
+
let min = 0;
|
|
1592
|
+
if (offset >= lastLine) {
|
|
1593
|
+
min = lineToIndex.length - 1;
|
|
1672
1594
|
} else {
|
|
1673
|
-
|
|
1595
|
+
let max = lineToIndex.length - 2;
|
|
1596
|
+
let mid;
|
|
1597
|
+
while (min < max) {
|
|
1598
|
+
mid = min + (max - min >> 1);
|
|
1599
|
+
if (offset < lineToIndex[mid]) {
|
|
1600
|
+
max = mid - 1;
|
|
1601
|
+
} else if (offset >= lineToIndex[mid + 1]) {
|
|
1602
|
+
min = mid + 1;
|
|
1603
|
+
} else {
|
|
1604
|
+
min = mid;
|
|
1605
|
+
break;
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1674
1608
|
}
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1609
|
+
return {
|
|
1610
|
+
col: offset - lineToIndex[min] + 1,
|
|
1611
|
+
line: min + 1
|
|
1612
|
+
};
|
|
1613
|
+
}
|
|
1614
|
+
mapResolve(file) {
|
|
1615
|
+
if (/^\w+:\/\//.test(file)) {
|
|
1616
|
+
return file;
|
|
1617
|
+
}
|
|
1618
|
+
return resolve$1(this.map.consumer().sourceRoot || this.map.root || ".", file);
|
|
1619
|
+
}
|
|
1620
|
+
origin(line, column, endLine, endColumn) {
|
|
1621
|
+
if (!this.map) return false;
|
|
1622
|
+
let consumer = this.map.consumer();
|
|
1623
|
+
let from = consumer.originalPositionFor({ column, line });
|
|
1624
|
+
if (!from.source) return false;
|
|
1625
|
+
let to;
|
|
1626
|
+
if (typeof endLine === "number") {
|
|
1627
|
+
to = consumer.originalPositionFor({ column: endColumn, line: endLine });
|
|
1628
|
+
}
|
|
1629
|
+
let fromUrl;
|
|
1630
|
+
if (isAbsolute(from.source)) {
|
|
1631
|
+
fromUrl = pathToFileURL$1(from.source);
|
|
1632
|
+
} else {
|
|
1633
|
+
fromUrl = new URL(
|
|
1634
|
+
from.source,
|
|
1635
|
+
this.map.consumer().sourceRoot || pathToFileURL$1(this.map.mapFile)
|
|
1636
|
+
);
|
|
1637
|
+
}
|
|
1638
|
+
let result2 = {
|
|
1639
|
+
column: from.column,
|
|
1640
|
+
endColumn: to && to.column,
|
|
1641
|
+
endLine: to && to.line,
|
|
1642
|
+
line: from.line,
|
|
1643
|
+
url: fromUrl.toString()
|
|
1644
|
+
};
|
|
1645
|
+
if (fromUrl.protocol === "file:") {
|
|
1646
|
+
if (fileURLToPath) {
|
|
1647
|
+
result2.file = fileURLToPath(fromUrl);
|
|
1648
|
+
} else {
|
|
1649
|
+
throw new Error(`file: protocol is not available in this PostCSS build`);
|
|
1650
|
+
}
|
|
1651
|
+
}
|
|
1652
|
+
let source = consumer.sourceContentFor(from.source);
|
|
1653
|
+
if (source) result2.source = source;
|
|
1654
|
+
return result2;
|
|
1655
|
+
}
|
|
1656
|
+
toJSON() {
|
|
1657
|
+
let json = {};
|
|
1658
|
+
for (let name of ["hasBOM", "css", "file", "id"]) {
|
|
1659
|
+
if (this[name] != null) {
|
|
1660
|
+
json[name] = this[name];
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1663
|
+
if (this.map) {
|
|
1664
|
+
json.map = { ...this.map };
|
|
1665
|
+
if (json.map.consumerCache) {
|
|
1666
|
+
json.map.consumerCache = void 0;
|
|
1667
|
+
}
|
|
1668
|
+
}
|
|
1669
|
+
return json;
|
|
1670
|
+
}
|
|
1671
|
+
};
|
|
1672
|
+
var input = Input$4;
|
|
1673
|
+
Input$4.default = Input$4;
|
|
1674
|
+
if (terminalHighlight && terminalHighlight.registerInput) {
|
|
1675
|
+
terminalHighlight.registerInput(Input$4);
|
|
1676
|
+
}
|
|
1677
|
+
let Container$4 = container;
|
|
1678
|
+
let LazyResult$3, Processor$2;
|
|
1679
|
+
let Root$5 = class Root extends Container$4 {
|
|
1680
|
+
constructor(defaults) {
|
|
1681
|
+
super(defaults);
|
|
1682
|
+
this.type = "root";
|
|
1683
|
+
if (!this.nodes) this.nodes = [];
|
|
1684
|
+
}
|
|
1685
|
+
normalize(child, sample, type) {
|
|
1686
|
+
let nodes = super.normalize(child);
|
|
1687
|
+
if (sample) {
|
|
1688
|
+
if (type === "prepend") {
|
|
1689
|
+
if (this.nodes.length > 1) {
|
|
1690
|
+
sample.raws.before = this.nodes[1].raws.before;
|
|
1691
|
+
} else {
|
|
1692
|
+
delete sample.raws.before;
|
|
1693
|
+
}
|
|
1694
|
+
} else if (this.first !== sample) {
|
|
1695
|
+
for (let node2 of nodes) {
|
|
1696
|
+
node2.raws.before = sample.raws.before;
|
|
1683
1697
|
}
|
|
1684
1698
|
}
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
});
|
|
1688
|
-
return processed;
|
|
1699
|
+
}
|
|
1700
|
+
return nodes;
|
|
1689
1701
|
}
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1702
|
+
removeChild(child, ignore) {
|
|
1703
|
+
let index2 = this.index(child);
|
|
1704
|
+
if (!ignore && index2 === 0 && this.nodes.length > 1) {
|
|
1705
|
+
this.nodes[1].raws.before = this.nodes[index2].raws.before;
|
|
1706
|
+
}
|
|
1707
|
+
return super.removeChild(child);
|
|
1708
|
+
}
|
|
1709
|
+
toResult(opts = {}) {
|
|
1710
|
+
let lazy = new LazyResult$3(new Processor$2(), this, opts);
|
|
1711
|
+
return lazy.stringify();
|
|
1712
|
+
}
|
|
1713
|
+
};
|
|
1714
|
+
Root$5.registerLazyResult = (dependant) => {
|
|
1715
|
+
LazyResult$3 = dependant;
|
|
1716
|
+
};
|
|
1717
|
+
Root$5.registerProcessor = (dependant) => {
|
|
1718
|
+
Processor$2 = dependant;
|
|
1719
|
+
};
|
|
1720
|
+
var root = Root$5;
|
|
1721
|
+
Root$5.default = Root$5;
|
|
1722
|
+
Container$4.registerRoot(Root$5);
|
|
1723
|
+
let list$2 = {
|
|
1724
|
+
comma(string) {
|
|
1725
|
+
return list$2.split(string, [","], true);
|
|
1726
|
+
},
|
|
1727
|
+
space(string) {
|
|
1728
|
+
let spaces = [" ", "\n", " "];
|
|
1729
|
+
return list$2.split(string, spaces);
|
|
1730
|
+
},
|
|
1731
|
+
split(string, separators, last) {
|
|
1732
|
+
let array = [];
|
|
1733
|
+
let current = "";
|
|
1734
|
+
let split = false;
|
|
1735
|
+
let func = 0;
|
|
1736
|
+
let inQuote = false;
|
|
1737
|
+
let prevQuote = "";
|
|
1738
|
+
let escape = false;
|
|
1739
|
+
for (let letter of string) {
|
|
1740
|
+
if (escape) {
|
|
1741
|
+
escape = false;
|
|
1742
|
+
} else if (letter === "\\") {
|
|
1743
|
+
escape = true;
|
|
1744
|
+
} else if (inQuote) {
|
|
1745
|
+
if (letter === prevQuote) {
|
|
1746
|
+
inQuote = false;
|
|
1747
|
+
}
|
|
1748
|
+
} else if (letter === '"' || letter === "'") {
|
|
1749
|
+
inQuote = true;
|
|
1750
|
+
prevQuote = letter;
|
|
1751
|
+
} else if (letter === "(") {
|
|
1752
|
+
func += 1;
|
|
1753
|
+
} else if (letter === ")") {
|
|
1754
|
+
if (func > 0) func -= 1;
|
|
1755
|
+
} else if (func === 0) {
|
|
1756
|
+
if (separators.includes(letter)) split = true;
|
|
1757
|
+
}
|
|
1758
|
+
if (split) {
|
|
1759
|
+
if (current !== "") array.push(current.trim());
|
|
1760
|
+
current = "";
|
|
1761
|
+
split = false;
|
|
1762
|
+
} else {
|
|
1763
|
+
current += letter;
|
|
1697
1764
|
}
|
|
1698
1765
|
}
|
|
1699
|
-
|
|
1700
|
-
return
|
|
1766
|
+
if (last || current !== "") array.push(current.trim());
|
|
1767
|
+
return array;
|
|
1701
1768
|
}
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1769
|
+
};
|
|
1770
|
+
var list_1 = list$2;
|
|
1771
|
+
list$2.default = list$2;
|
|
1772
|
+
let Container$3 = container;
|
|
1773
|
+
let list$1 = list_1;
|
|
1774
|
+
let Rule$3 = class Rule extends Container$3 {
|
|
1775
|
+
get selectors() {
|
|
1776
|
+
return list$1.comma(this.selector);
|
|
1706
1777
|
}
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
this.
|
|
1711
|
-
return this;
|
|
1778
|
+
set selectors(values) {
|
|
1779
|
+
let match = this.selector ? this.selector.match(/,\s*/) : null;
|
|
1780
|
+
let sep2 = match ? match[0] : "," + this.raw("between", "beforeOpen");
|
|
1781
|
+
this.selector = values.join(sep2);
|
|
1712
1782
|
}
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
this.
|
|
1716
|
-
this.
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1783
|
+
constructor(defaults) {
|
|
1784
|
+
super(defaults);
|
|
1785
|
+
this.type = "rule";
|
|
1786
|
+
if (!this.nodes) this.nodes = [];
|
|
1787
|
+
}
|
|
1788
|
+
};
|
|
1789
|
+
var rule = Rule$3;
|
|
1790
|
+
Rule$3.default = Rule$3;
|
|
1791
|
+
Container$3.registerRule(Rule$3);
|
|
1792
|
+
let AtRule$2 = atRule;
|
|
1793
|
+
let Comment$2 = comment;
|
|
1794
|
+
let Declaration$2 = declaration;
|
|
1795
|
+
let Input$3 = input;
|
|
1796
|
+
let PreviousMap2 = previousMap;
|
|
1797
|
+
let Root$4 = root;
|
|
1798
|
+
let Rule$2 = rule;
|
|
1799
|
+
function fromJSON$1(json, inputs) {
|
|
1800
|
+
if (Array.isArray(json)) return json.map((n) => fromJSON$1(n));
|
|
1801
|
+
let { inputs: ownInputs, ...defaults } = json;
|
|
1802
|
+
if (ownInputs) {
|
|
1803
|
+
inputs = [];
|
|
1804
|
+
for (let input2 of ownInputs) {
|
|
1805
|
+
let inputHydrated = { ...input2, __proto__: Input$3.prototype };
|
|
1806
|
+
if (inputHydrated.map) {
|
|
1807
|
+
inputHydrated.map = {
|
|
1808
|
+
...inputHydrated.map,
|
|
1809
|
+
__proto__: PreviousMap2.prototype
|
|
1810
|
+
};
|
|
1722
1811
|
}
|
|
1812
|
+
inputs.push(inputHydrated);
|
|
1723
1813
|
}
|
|
1724
|
-
this.markDirty();
|
|
1725
|
-
return this;
|
|
1726
1814
|
}
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1815
|
+
if (defaults.nodes) {
|
|
1816
|
+
defaults.nodes = json.nodes.map((n) => fromJSON$1(n, inputs));
|
|
1817
|
+
}
|
|
1818
|
+
if (defaults.source) {
|
|
1819
|
+
let { inputId, ...source } = defaults.source;
|
|
1820
|
+
defaults.source = source;
|
|
1821
|
+
if (inputId != null) {
|
|
1822
|
+
defaults.source.input = inputs[inputId];
|
|
1731
1823
|
}
|
|
1732
|
-
this.walkDecls((decl) => {
|
|
1733
|
-
if (opts.props && !opts.props.includes(decl.prop)) return;
|
|
1734
|
-
if (opts.fast && !decl.value.includes(opts.fast)) return;
|
|
1735
|
-
decl.value = decl.value.replace(pattern, callback);
|
|
1736
|
-
});
|
|
1737
|
-
this.markDirty();
|
|
1738
|
-
return this;
|
|
1739
1824
|
}
|
|
1740
|
-
|
|
1741
|
-
return
|
|
1825
|
+
if (defaults.type === "root") {
|
|
1826
|
+
return new Root$4(defaults);
|
|
1827
|
+
} else if (defaults.type === "decl") {
|
|
1828
|
+
return new Declaration$2(defaults);
|
|
1829
|
+
} else if (defaults.type === "rule") {
|
|
1830
|
+
return new Rule$2(defaults);
|
|
1831
|
+
} else if (defaults.type === "comment") {
|
|
1832
|
+
return new Comment$2(defaults);
|
|
1833
|
+
} else if (defaults.type === "atrule") {
|
|
1834
|
+
return new AtRule$2(defaults);
|
|
1835
|
+
} else {
|
|
1836
|
+
throw new Error("Unknown node type: " + json.type);
|
|
1742
1837
|
}
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1838
|
+
}
|
|
1839
|
+
var fromJSON_1 = fromJSON$1;
|
|
1840
|
+
fromJSON$1.default = fromJSON$1;
|
|
1841
|
+
let { dirname, relative, resolve, sep } = require$$2;
|
|
1842
|
+
let { SourceMapConsumer, SourceMapGenerator } = require$$2;
|
|
1843
|
+
let { pathToFileURL } = require$$2;
|
|
1844
|
+
let Input$2 = input;
|
|
1845
|
+
let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);
|
|
1846
|
+
let pathAvailable = Boolean(dirname && resolve && relative && sep);
|
|
1847
|
+
let MapGenerator$2 = class MapGenerator {
|
|
1848
|
+
constructor(stringify2, root2, opts, cssString) {
|
|
1849
|
+
this.stringify = stringify2;
|
|
1850
|
+
this.mapOpts = opts.map || {};
|
|
1851
|
+
this.root = root2;
|
|
1852
|
+
this.opts = opts;
|
|
1853
|
+
this.css = cssString;
|
|
1854
|
+
this.originalCSS = cssString;
|
|
1855
|
+
this.usesFileUrls = !this.mapOpts.from && this.mapOpts.absolute;
|
|
1856
|
+
this.memoizedFileURLs = /* @__PURE__ */ new Map();
|
|
1857
|
+
this.memoizedPaths = /* @__PURE__ */ new Map();
|
|
1858
|
+
this.memoizedURLs = /* @__PURE__ */ new Map();
|
|
1859
|
+
}
|
|
1860
|
+
addAnnotation() {
|
|
1861
|
+
let content;
|
|
1862
|
+
if (this.isInline()) {
|
|
1863
|
+
content = "data:application/json;base64," + this.toBase64(this.map.toString());
|
|
1864
|
+
} else if (typeof this.mapOpts.annotation === "string") {
|
|
1865
|
+
content = this.mapOpts.annotation;
|
|
1866
|
+
} else if (typeof this.mapOpts.annotation === "function") {
|
|
1867
|
+
content = this.mapOpts.annotation(this.opts.to, this.root);
|
|
1868
|
+
} else {
|
|
1869
|
+
content = this.outputFile() + ".map";
|
|
1870
|
+
}
|
|
1871
|
+
let eol = "\n";
|
|
1872
|
+
if (this.css.includes("\r\n")) eol = "\r\n";
|
|
1873
|
+
this.css += eol + "/*# sourceMappingURL=" + content + " */";
|
|
1874
|
+
}
|
|
1875
|
+
applyPrevMaps() {
|
|
1876
|
+
for (let prev of this.previous()) {
|
|
1877
|
+
let from = this.toUrl(this.path(prev.file));
|
|
1878
|
+
let root2 = prev.root || dirname(prev.file);
|
|
1879
|
+
let map;
|
|
1880
|
+
if (this.mapOpts.sourcesContent === false) {
|
|
1881
|
+
map = new SourceMapConsumer(prev.text);
|
|
1882
|
+
if (map.sourcesContent) {
|
|
1883
|
+
map.sourcesContent = null;
|
|
1884
|
+
}
|
|
1885
|
+
} else {
|
|
1886
|
+
map = prev.consumer();
|
|
1753
1887
|
}
|
|
1754
|
-
|
|
1755
|
-
}
|
|
1888
|
+
this.map.applySourceMap(map, from, this.toUrl(this.path(root2)));
|
|
1889
|
+
}
|
|
1756
1890
|
}
|
|
1757
|
-
|
|
1758
|
-
if (
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1891
|
+
clearAnnotation() {
|
|
1892
|
+
if (this.mapOpts.annotation === false) return;
|
|
1893
|
+
if (this.root) {
|
|
1894
|
+
let node2;
|
|
1895
|
+
for (let i = this.root.nodes.length - 1; i >= 0; i--) {
|
|
1896
|
+
node2 = this.root.nodes[i];
|
|
1897
|
+
if (node2.type !== "comment") continue;
|
|
1898
|
+
if (node2.text.startsWith("# sourceMappingURL=")) {
|
|
1899
|
+
this.root.removeChild(i);
|
|
1763
1900
|
}
|
|
1901
|
+
}
|
|
1902
|
+
} else if (this.css) {
|
|
1903
|
+
this.css = this.css.replace(/\n*\/\*#[\S\s]*?\*\/$/gm, "");
|
|
1904
|
+
}
|
|
1905
|
+
}
|
|
1906
|
+
generate() {
|
|
1907
|
+
this.clearAnnotation();
|
|
1908
|
+
if (pathAvailable && sourceMapAvailable && this.isMap()) {
|
|
1909
|
+
return this.generateMap();
|
|
1910
|
+
} else {
|
|
1911
|
+
let result2 = "";
|
|
1912
|
+
this.stringify(this.root, (i) => {
|
|
1913
|
+
result2 += i;
|
|
1764
1914
|
});
|
|
1915
|
+
return [result2];
|
|
1765
1916
|
}
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1917
|
+
}
|
|
1918
|
+
generateMap() {
|
|
1919
|
+
if (this.root) {
|
|
1920
|
+
this.generateString();
|
|
1921
|
+
} else if (this.previous().length === 1) {
|
|
1922
|
+
let prev = this.previous()[0].consumer();
|
|
1923
|
+
prev.file = this.outputFile();
|
|
1924
|
+
this.map = SourceMapGenerator.fromSourceMap(prev, {
|
|
1925
|
+
ignoreInvalidMapping: true
|
|
1926
|
+
});
|
|
1927
|
+
} else {
|
|
1928
|
+
this.map = new SourceMapGenerator({
|
|
1929
|
+
file: this.outputFile(),
|
|
1930
|
+
ignoreInvalidMapping: true
|
|
1931
|
+
});
|
|
1932
|
+
this.map.addMapping({
|
|
1933
|
+
generated: { column: 0, line: 1 },
|
|
1934
|
+
original: { column: 0, line: 1 },
|
|
1935
|
+
source: this.opts.from ? this.toUrl(this.path(this.opts.from)) : "<no source>"
|
|
1771
1936
|
});
|
|
1772
1937
|
}
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1938
|
+
if (this.isSourcesContent()) this.setSourcesContent();
|
|
1939
|
+
if (this.root && this.previous().length > 0) this.applyPrevMaps();
|
|
1940
|
+
if (this.isAnnotation()) this.addAnnotation();
|
|
1941
|
+
if (this.isInline()) {
|
|
1942
|
+
return [this.css];
|
|
1943
|
+
} else {
|
|
1944
|
+
return [this.css, this.map];
|
|
1945
|
+
}
|
|
1946
|
+
}
|
|
1947
|
+
generateString() {
|
|
1948
|
+
this.css = "";
|
|
1949
|
+
this.map = new SourceMapGenerator({
|
|
1950
|
+
file: this.outputFile(),
|
|
1951
|
+
ignoreInvalidMapping: true
|
|
1952
|
+
});
|
|
1953
|
+
let line = 1;
|
|
1954
|
+
let column = 1;
|
|
1955
|
+
let noSource = "<no source>";
|
|
1956
|
+
let mapping = {
|
|
1957
|
+
generated: { column: 0, line: 0 },
|
|
1958
|
+
original: { column: 0, line: 0 },
|
|
1959
|
+
source: ""
|
|
1960
|
+
};
|
|
1961
|
+
let last, lines;
|
|
1962
|
+
this.stringify(this.root, (str, node2, type) => {
|
|
1963
|
+
this.css += str;
|
|
1964
|
+
if (node2 && type !== "end") {
|
|
1965
|
+
mapping.generated.line = line;
|
|
1966
|
+
mapping.generated.column = column - 1;
|
|
1967
|
+
if (node2.source && node2.source.start) {
|
|
1968
|
+
mapping.source = this.sourcePath(node2);
|
|
1969
|
+
mapping.original.line = node2.source.start.line;
|
|
1970
|
+
mapping.original.column = node2.source.start.column - 1;
|
|
1971
|
+
this.map.addMapping(mapping);
|
|
1972
|
+
} else {
|
|
1973
|
+
mapping.source = noSource;
|
|
1974
|
+
mapping.original.line = 1;
|
|
1975
|
+
mapping.original.column = 0;
|
|
1976
|
+
this.map.addMapping(mapping);
|
|
1977
|
+
}
|
|
1978
|
+
}
|
|
1979
|
+
lines = str.match(/\n/g);
|
|
1980
|
+
if (lines) {
|
|
1981
|
+
line += lines.length;
|
|
1982
|
+
last = str.lastIndexOf("\n");
|
|
1983
|
+
column = str.length - last;
|
|
1984
|
+
} else {
|
|
1985
|
+
column += str.length;
|
|
1776
1986
|
}
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1987
|
+
if (node2 && type !== "start") {
|
|
1988
|
+
let p = node2.parent || { raws: {} };
|
|
1989
|
+
let childless = node2.type === "decl" || node2.type === "atrule" && !node2.nodes;
|
|
1990
|
+
if (!childless || node2 !== p.last || p.raws.semicolon) {
|
|
1991
|
+
if (node2.source && node2.source.end) {
|
|
1992
|
+
mapping.source = this.sourcePath(node2);
|
|
1993
|
+
mapping.original.line = node2.source.end.line;
|
|
1994
|
+
mapping.original.column = node2.source.end.column - 1;
|
|
1995
|
+
mapping.generated.line = line;
|
|
1996
|
+
mapping.generated.column = column - 2;
|
|
1997
|
+
this.map.addMapping(mapping);
|
|
1998
|
+
} else {
|
|
1999
|
+
mapping.source = noSource;
|
|
2000
|
+
mapping.original.line = 1;
|
|
2001
|
+
mapping.original.column = 0;
|
|
2002
|
+
mapping.generated.line = line;
|
|
2003
|
+
mapping.generated.column = column - 1;
|
|
2004
|
+
this.map.addMapping(mapping);
|
|
2005
|
+
}
|
|
2006
|
+
}
|
|
1783
2007
|
}
|
|
1784
2008
|
});
|
|
1785
2009
|
}
|
|
1786
|
-
|
|
1787
|
-
if (
|
|
1788
|
-
|
|
1789
|
-
return this.walk((child, i) => {
|
|
1790
|
-
if (child.type === "decl") {
|
|
1791
|
-
return callback(child, i);
|
|
1792
|
-
}
|
|
1793
|
-
});
|
|
2010
|
+
isAnnotation() {
|
|
2011
|
+
if (this.isInline()) {
|
|
2012
|
+
return true;
|
|
1794
2013
|
}
|
|
1795
|
-
if (
|
|
1796
|
-
return this.
|
|
1797
|
-
if (child.type === "decl" && prop.test(child.prop)) {
|
|
1798
|
-
return callback(child, i);
|
|
1799
|
-
}
|
|
1800
|
-
});
|
|
2014
|
+
if (typeof this.mapOpts.annotation !== "undefined") {
|
|
2015
|
+
return this.mapOpts.annotation;
|
|
1801
2016
|
}
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
});
|
|
2017
|
+
if (this.previous().length) {
|
|
2018
|
+
return this.previous().some((i) => i.annotation);
|
|
2019
|
+
}
|
|
2020
|
+
return true;
|
|
1807
2021
|
}
|
|
1808
|
-
|
|
1809
|
-
if (
|
|
1810
|
-
|
|
1811
|
-
return this.walk((child, i) => {
|
|
1812
|
-
if (child.type === "rule") {
|
|
1813
|
-
return callback(child, i);
|
|
1814
|
-
}
|
|
1815
|
-
});
|
|
2022
|
+
isInline() {
|
|
2023
|
+
if (typeof this.mapOpts.inline !== "undefined") {
|
|
2024
|
+
return this.mapOpts.inline;
|
|
1816
2025
|
}
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
return callback(child, i);
|
|
1821
|
-
}
|
|
1822
|
-
});
|
|
2026
|
+
let annotation = this.mapOpts.annotation;
|
|
2027
|
+
if (typeof annotation !== "undefined" && annotation !== true) {
|
|
2028
|
+
return false;
|
|
1823
2029
|
}
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
return callback(child, i);
|
|
1827
|
-
}
|
|
1828
|
-
});
|
|
1829
|
-
}
|
|
1830
|
-
get first() {
|
|
1831
|
-
if (!this.proxyOf.nodes) return void 0;
|
|
1832
|
-
return this.proxyOf.nodes[0];
|
|
1833
|
-
}
|
|
1834
|
-
get last() {
|
|
1835
|
-
if (!this.proxyOf.nodes) return void 0;
|
|
1836
|
-
return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
|
|
1837
|
-
}
|
|
1838
|
-
};
|
|
1839
|
-
Container$7.registerParse = (dependant) => {
|
|
1840
|
-
parse$4 = dependant;
|
|
1841
|
-
};
|
|
1842
|
-
Container$7.registerRule = (dependant) => {
|
|
1843
|
-
Rule$4 = dependant;
|
|
1844
|
-
};
|
|
1845
|
-
Container$7.registerAtRule = (dependant) => {
|
|
1846
|
-
AtRule$4 = dependant;
|
|
1847
|
-
};
|
|
1848
|
-
Container$7.registerRoot = (dependant) => {
|
|
1849
|
-
Root$6 = dependant;
|
|
1850
|
-
};
|
|
1851
|
-
var container = Container$7;
|
|
1852
|
-
Container$7.default = Container$7;
|
|
1853
|
-
Container$7.rebuild = (node2) => {
|
|
1854
|
-
if (node2.type === "atrule") {
|
|
1855
|
-
Object.setPrototypeOf(node2, AtRule$4.prototype);
|
|
1856
|
-
} else if (node2.type === "rule") {
|
|
1857
|
-
Object.setPrototypeOf(node2, Rule$4.prototype);
|
|
1858
|
-
} else if (node2.type === "decl") {
|
|
1859
|
-
Object.setPrototypeOf(node2, Declaration$3.prototype);
|
|
1860
|
-
} else if (node2.type === "comment") {
|
|
1861
|
-
Object.setPrototypeOf(node2, Comment$3.prototype);
|
|
1862
|
-
} else if (node2.type === "root") {
|
|
1863
|
-
Object.setPrototypeOf(node2, Root$6.prototype);
|
|
1864
|
-
}
|
|
1865
|
-
node2[my$1] = true;
|
|
1866
|
-
if (node2.nodes) {
|
|
1867
|
-
node2.nodes.forEach((child) => {
|
|
1868
|
-
Container$7.rebuild(child);
|
|
1869
|
-
});
|
|
1870
|
-
}
|
|
1871
|
-
};
|
|
1872
|
-
let Container$6 = container;
|
|
1873
|
-
let LazyResult$4, Processor$3;
|
|
1874
|
-
let Document$3 = class Document2 extends Container$6 {
|
|
1875
|
-
constructor(defaults) {
|
|
1876
|
-
super({ type: "document", ...defaults });
|
|
1877
|
-
if (!this.nodes) {
|
|
1878
|
-
this.nodes = [];
|
|
2030
|
+
if (this.previous().length) {
|
|
2031
|
+
return this.previous().some((i) => i.inline);
|
|
1879
2032
|
}
|
|
2033
|
+
return true;
|
|
1880
2034
|
}
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
2035
|
+
isMap() {
|
|
2036
|
+
if (typeof this.opts.map !== "undefined") {
|
|
2037
|
+
return !!this.opts.map;
|
|
2038
|
+
}
|
|
2039
|
+
return this.previous().length > 0;
|
|
1884
2040
|
}
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
}
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
}
|
|
1892
|
-
|
|
1893
|
-
Document$3.default = Document$3;
|
|
1894
|
-
let printed = {};
|
|
1895
|
-
var warnOnce$2 = function warnOnce(message) {
|
|
1896
|
-
if (printed[message]) return;
|
|
1897
|
-
printed[message] = true;
|
|
1898
|
-
if (typeof console !== "undefined" && console.warn) {
|
|
1899
|
-
console.warn(message);
|
|
2041
|
+
isSourcesContent() {
|
|
2042
|
+
if (typeof this.mapOpts.sourcesContent !== "undefined") {
|
|
2043
|
+
return this.mapOpts.sourcesContent;
|
|
2044
|
+
}
|
|
2045
|
+
if (this.previous().length) {
|
|
2046
|
+
return this.previous().some((i) => i.withContent());
|
|
2047
|
+
}
|
|
2048
|
+
return true;
|
|
1900
2049
|
}
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
this.
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
this.line = range.start.line;
|
|
1909
|
-
this.column = range.start.column;
|
|
1910
|
-
this.endLine = range.end.line;
|
|
1911
|
-
this.endColumn = range.end.column;
|
|
2050
|
+
outputFile() {
|
|
2051
|
+
if (this.opts.to) {
|
|
2052
|
+
return this.path(this.opts.to);
|
|
2053
|
+
} else if (this.opts.from) {
|
|
2054
|
+
return this.path(this.opts.from);
|
|
2055
|
+
} else {
|
|
2056
|
+
return "to.css";
|
|
1912
2057
|
}
|
|
1913
|
-
for (let opt in opts) this[opt] = opts[opt];
|
|
1914
2058
|
}
|
|
1915
|
-
|
|
1916
|
-
if (this.
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
2059
|
+
path(file) {
|
|
2060
|
+
if (this.mapOpts.absolute) return file;
|
|
2061
|
+
if (file.charCodeAt(0) === 60) return file;
|
|
2062
|
+
if (/^\w+:\/\//.test(file)) return file;
|
|
2063
|
+
let cached = this.memoizedPaths.get(file);
|
|
2064
|
+
if (cached) return cached;
|
|
2065
|
+
let from = this.opts.to ? dirname(this.opts.to) : ".";
|
|
2066
|
+
if (typeof this.mapOpts.annotation === "string") {
|
|
2067
|
+
from = dirname(resolve(from, this.mapOpts.annotation));
|
|
1922
2068
|
}
|
|
1923
|
-
|
|
1924
|
-
|
|
2069
|
+
let path = relative(from, file);
|
|
2070
|
+
this.memoizedPaths.set(file, path);
|
|
2071
|
+
return path;
|
|
2072
|
+
}
|
|
2073
|
+
previous() {
|
|
2074
|
+
if (!this.previousMaps) {
|
|
2075
|
+
this.previousMaps = [];
|
|
2076
|
+
if (this.root) {
|
|
2077
|
+
this.root.walk((node2) => {
|
|
2078
|
+
if (node2.source && node2.source.input.map) {
|
|
2079
|
+
let map = node2.source.input.map;
|
|
2080
|
+
if (!this.previousMaps.includes(map)) {
|
|
2081
|
+
this.previousMaps.push(map);
|
|
2082
|
+
}
|
|
2083
|
+
}
|
|
2084
|
+
});
|
|
2085
|
+
} else {
|
|
2086
|
+
let input2 = new Input$2(this.originalCSS, this.opts);
|
|
2087
|
+
if (input2.map) this.previousMaps.push(input2.map);
|
|
2088
|
+
}
|
|
1925
2089
|
}
|
|
1926
|
-
return this.
|
|
2090
|
+
return this.previousMaps;
|
|
1927
2091
|
}
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
2092
|
+
setSourcesContent() {
|
|
2093
|
+
let already = {};
|
|
2094
|
+
if (this.root) {
|
|
2095
|
+
this.root.walk((node2) => {
|
|
2096
|
+
if (node2.source) {
|
|
2097
|
+
let from = node2.source.input.from;
|
|
2098
|
+
if (from && !already[from]) {
|
|
2099
|
+
already[from] = true;
|
|
2100
|
+
let fromUrl = this.usesFileUrls ? this.toFileUrl(from) : this.toUrl(this.path(from));
|
|
2101
|
+
this.map.setSourceContent(fromUrl, node2.source.input.css);
|
|
2102
|
+
}
|
|
2103
|
+
}
|
|
2104
|
+
});
|
|
2105
|
+
} else if (this.css) {
|
|
2106
|
+
let from = this.opts.from ? this.toUrl(this.path(this.opts.from)) : "<no source>";
|
|
2107
|
+
this.map.setSourceContent(from, this.css);
|
|
2108
|
+
}
|
|
1940
2109
|
}
|
|
1941
|
-
|
|
1942
|
-
|
|
2110
|
+
sourcePath(node2) {
|
|
2111
|
+
if (this.mapOpts.from) {
|
|
2112
|
+
return this.toUrl(this.mapOpts.from);
|
|
2113
|
+
} else if (this.usesFileUrls) {
|
|
2114
|
+
return this.toFileUrl(node2.source.input.from);
|
|
2115
|
+
} else {
|
|
2116
|
+
return this.toUrl(this.path(node2.source.input.from));
|
|
2117
|
+
}
|
|
1943
2118
|
}
|
|
1944
|
-
|
|
1945
|
-
if (
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
2119
|
+
toBase64(str) {
|
|
2120
|
+
if (Buffer) {
|
|
2121
|
+
return Buffer.from(str).toString("base64");
|
|
2122
|
+
} else {
|
|
2123
|
+
return window.btoa(unescape(encodeURIComponent(str)));
|
|
1949
2124
|
}
|
|
1950
|
-
let warning2 = new Warning$1(text, opts);
|
|
1951
|
-
this.messages.push(warning2);
|
|
1952
|
-
return warning2;
|
|
1953
2125
|
}
|
|
1954
|
-
|
|
1955
|
-
|
|
2126
|
+
toFileUrl(path) {
|
|
2127
|
+
let cached = this.memoizedFileURLs.get(path);
|
|
2128
|
+
if (cached) return cached;
|
|
2129
|
+
if (pathToFileURL) {
|
|
2130
|
+
let fileURL = pathToFileURL(path).toString();
|
|
2131
|
+
this.memoizedFileURLs.set(path, fileURL);
|
|
2132
|
+
return fileURL;
|
|
2133
|
+
} else {
|
|
2134
|
+
throw new Error(
|
|
2135
|
+
"`map.absolute` option is not available in this PostCSS build"
|
|
2136
|
+
);
|
|
2137
|
+
}
|
|
1956
2138
|
}
|
|
1957
|
-
|
|
1958
|
-
|
|
2139
|
+
toUrl(path) {
|
|
2140
|
+
let cached = this.memoizedURLs.get(path);
|
|
2141
|
+
if (cached) return cached;
|
|
2142
|
+
if (sep === "\\") {
|
|
2143
|
+
path = path.replace(/\\/g, "/");
|
|
2144
|
+
}
|
|
2145
|
+
let url = encodeURI(path).replace(/[#?]/g, encodeURIComponent);
|
|
2146
|
+
this.memoizedURLs.set(path, url);
|
|
2147
|
+
return url;
|
|
1959
2148
|
}
|
|
1960
2149
|
};
|
|
1961
|
-
var
|
|
1962
|
-
Result$3.default = Result$3;
|
|
2150
|
+
var mapGenerator = MapGenerator$2;
|
|
1963
2151
|
const SINGLE_QUOTE = "'".charCodeAt(0);
|
|
1964
2152
|
const DOUBLE_QUOTE = '"'.charCodeAt(0);
|
|
1965
2153
|
const BACKSLASH = "\\".charCodeAt(0);
|
|
@@ -1986,8 +2174,8 @@ const RE_HEX_ESCAPE = /[\da-f]/i;
|
|
|
1986
2174
|
var tokenize = function tokenizer(input2, options = {}) {
|
|
1987
2175
|
let css = input2.css.valueOf();
|
|
1988
2176
|
let ignore = options.ignoreErrors;
|
|
1989
|
-
let code,
|
|
1990
|
-
let escaped, escapePos,
|
|
2177
|
+
let code, content, escape, next, quote;
|
|
2178
|
+
let currentToken, escaped, escapePos, n, prev;
|
|
1991
2179
|
let length = css.length;
|
|
1992
2180
|
let pos = 0;
|
|
1993
2181
|
let buffer = [];
|
|
@@ -2168,145 +2356,12 @@ var tokenize = function tokenizer(input2, options = {}) {
|
|
|
2168
2356
|
position
|
|
2169
2357
|
};
|
|
2170
2358
|
};
|
|
2171
|
-
let
|
|
2172
|
-
let
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
}
|
|
2177
|
-
append(...children) {
|
|
2178
|
-
if (!this.proxyOf.nodes) this.nodes = [];
|
|
2179
|
-
return super.append(...children);
|
|
2180
|
-
}
|
|
2181
|
-
prepend(...children) {
|
|
2182
|
-
if (!this.proxyOf.nodes) this.nodes = [];
|
|
2183
|
-
return super.prepend(...children);
|
|
2184
|
-
}
|
|
2185
|
-
};
|
|
2186
|
-
var atRule = AtRule$3;
|
|
2187
|
-
AtRule$3.default = AtRule$3;
|
|
2188
|
-
Container$5.registerAtRule(AtRule$3);
|
|
2189
|
-
let Container$4 = container;
|
|
2190
|
-
let LazyResult$3, Processor$2;
|
|
2191
|
-
let Root$5 = class Root extends Container$4 {
|
|
2192
|
-
constructor(defaults) {
|
|
2193
|
-
super(defaults);
|
|
2194
|
-
this.type = "root";
|
|
2195
|
-
if (!this.nodes) this.nodes = [];
|
|
2196
|
-
}
|
|
2197
|
-
normalize(child, sample, type) {
|
|
2198
|
-
let nodes = super.normalize(child);
|
|
2199
|
-
if (sample) {
|
|
2200
|
-
if (type === "prepend") {
|
|
2201
|
-
if (this.nodes.length > 1) {
|
|
2202
|
-
sample.raws.before = this.nodes[1].raws.before;
|
|
2203
|
-
} else {
|
|
2204
|
-
delete sample.raws.before;
|
|
2205
|
-
}
|
|
2206
|
-
} else if (this.first !== sample) {
|
|
2207
|
-
for (let node2 of nodes) {
|
|
2208
|
-
node2.raws.before = sample.raws.before;
|
|
2209
|
-
}
|
|
2210
|
-
}
|
|
2211
|
-
}
|
|
2212
|
-
return nodes;
|
|
2213
|
-
}
|
|
2214
|
-
removeChild(child, ignore) {
|
|
2215
|
-
let index2 = this.index(child);
|
|
2216
|
-
if (!ignore && index2 === 0 && this.nodes.length > 1) {
|
|
2217
|
-
this.nodes[1].raws.before = this.nodes[index2].raws.before;
|
|
2218
|
-
}
|
|
2219
|
-
return super.removeChild(child);
|
|
2220
|
-
}
|
|
2221
|
-
toResult(opts = {}) {
|
|
2222
|
-
let lazy = new LazyResult$3(new Processor$2(), this, opts);
|
|
2223
|
-
return lazy.stringify();
|
|
2224
|
-
}
|
|
2225
|
-
};
|
|
2226
|
-
Root$5.registerLazyResult = (dependant) => {
|
|
2227
|
-
LazyResult$3 = dependant;
|
|
2228
|
-
};
|
|
2229
|
-
Root$5.registerProcessor = (dependant) => {
|
|
2230
|
-
Processor$2 = dependant;
|
|
2231
|
-
};
|
|
2232
|
-
var root = Root$5;
|
|
2233
|
-
Root$5.default = Root$5;
|
|
2234
|
-
Container$4.registerRoot(Root$5);
|
|
2235
|
-
let list$2 = {
|
|
2236
|
-
comma(string) {
|
|
2237
|
-
return list$2.split(string, [","], true);
|
|
2238
|
-
},
|
|
2239
|
-
space(string) {
|
|
2240
|
-
let spaces = [" ", "\n", " "];
|
|
2241
|
-
return list$2.split(string, spaces);
|
|
2242
|
-
},
|
|
2243
|
-
split(string, separators, last) {
|
|
2244
|
-
let array = [];
|
|
2245
|
-
let current = "";
|
|
2246
|
-
let split = false;
|
|
2247
|
-
let func = 0;
|
|
2248
|
-
let inQuote = false;
|
|
2249
|
-
let prevQuote = "";
|
|
2250
|
-
let escape = false;
|
|
2251
|
-
for (let letter of string) {
|
|
2252
|
-
if (escape) {
|
|
2253
|
-
escape = false;
|
|
2254
|
-
} else if (letter === "\\") {
|
|
2255
|
-
escape = true;
|
|
2256
|
-
} else if (inQuote) {
|
|
2257
|
-
if (letter === prevQuote) {
|
|
2258
|
-
inQuote = false;
|
|
2259
|
-
}
|
|
2260
|
-
} else if (letter === '"' || letter === "'") {
|
|
2261
|
-
inQuote = true;
|
|
2262
|
-
prevQuote = letter;
|
|
2263
|
-
} else if (letter === "(") {
|
|
2264
|
-
func += 1;
|
|
2265
|
-
} else if (letter === ")") {
|
|
2266
|
-
if (func > 0) func -= 1;
|
|
2267
|
-
} else if (func === 0) {
|
|
2268
|
-
if (separators.includes(letter)) split = true;
|
|
2269
|
-
}
|
|
2270
|
-
if (split) {
|
|
2271
|
-
if (current !== "") array.push(current.trim());
|
|
2272
|
-
current = "";
|
|
2273
|
-
split = false;
|
|
2274
|
-
} else {
|
|
2275
|
-
current += letter;
|
|
2276
|
-
}
|
|
2277
|
-
}
|
|
2278
|
-
if (last || current !== "") array.push(current.trim());
|
|
2279
|
-
return array;
|
|
2280
|
-
}
|
|
2281
|
-
};
|
|
2282
|
-
var list_1 = list$2;
|
|
2283
|
-
list$2.default = list$2;
|
|
2284
|
-
let Container$3 = container;
|
|
2285
|
-
let list$1 = list_1;
|
|
2286
|
-
let Rule$3 = class Rule extends Container$3 {
|
|
2287
|
-
constructor(defaults) {
|
|
2288
|
-
super(defaults);
|
|
2289
|
-
this.type = "rule";
|
|
2290
|
-
if (!this.nodes) this.nodes = [];
|
|
2291
|
-
}
|
|
2292
|
-
get selectors() {
|
|
2293
|
-
return list$1.comma(this.selector);
|
|
2294
|
-
}
|
|
2295
|
-
set selectors(values) {
|
|
2296
|
-
let match = this.selector ? this.selector.match(/,\s*/) : null;
|
|
2297
|
-
let sep2 = match ? match[0] : "," + this.raw("between", "beforeOpen");
|
|
2298
|
-
this.selector = values.join(sep2);
|
|
2299
|
-
}
|
|
2300
|
-
};
|
|
2301
|
-
var rule = Rule$3;
|
|
2302
|
-
Rule$3.default = Rule$3;
|
|
2303
|
-
Container$3.registerRule(Rule$3);
|
|
2304
|
-
let Declaration$2 = declaration;
|
|
2359
|
+
let AtRule$1 = atRule;
|
|
2360
|
+
let Comment$1 = comment;
|
|
2361
|
+
let Declaration$1 = declaration;
|
|
2362
|
+
let Root$3 = root;
|
|
2363
|
+
let Rule$1 = rule;
|
|
2305
2364
|
let tokenizer2 = tokenize;
|
|
2306
|
-
let Comment$2 = comment;
|
|
2307
|
-
let AtRule$2 = atRule;
|
|
2308
|
-
let Root$4 = root;
|
|
2309
|
-
let Rule$2 = rule;
|
|
2310
2365
|
const SAFE_COMMENT_NEIGHBOR = {
|
|
2311
2366
|
empty: true,
|
|
2312
2367
|
space: true
|
|
@@ -2321,7 +2376,7 @@ function findLastWithPosition(tokens) {
|
|
|
2321
2376
|
let Parser$1 = class Parser {
|
|
2322
2377
|
constructor(input2) {
|
|
2323
2378
|
this.input = input2;
|
|
2324
|
-
this.root = new Root$
|
|
2379
|
+
this.root = new Root$3();
|
|
2325
2380
|
this.current = this.root;
|
|
2326
2381
|
this.spaces = "";
|
|
2327
2382
|
this.semicolon = false;
|
|
@@ -2329,7 +2384,7 @@ let Parser$1 = class Parser {
|
|
|
2329
2384
|
this.root.source = { input: input2, start: { column: 1, line: 1, offset: 0 } };
|
|
2330
2385
|
}
|
|
2331
2386
|
atrule(token) {
|
|
2332
|
-
let node2 = new AtRule$
|
|
2387
|
+
let node2 = new AtRule$1();
|
|
2333
2388
|
node2.name = token[1].slice(1);
|
|
2334
2389
|
if (node2.name === "") {
|
|
2335
2390
|
this.unnamedAtrule(node2, token);
|
|
@@ -2411,8 +2466,8 @@ let Parser$1 = class Parser {
|
|
|
2411
2466
|
if (colon === false) return;
|
|
2412
2467
|
let founded = 0;
|
|
2413
2468
|
let token;
|
|
2414
|
-
for (let
|
|
2415
|
-
token = tokens[
|
|
2469
|
+
for (let j2 = colon - 1; j2 >= 0; j2--) {
|
|
2470
|
+
token = tokens[j2];
|
|
2416
2471
|
if (token[0] !== "space") {
|
|
2417
2472
|
founded += 1;
|
|
2418
2473
|
if (founded === 2) break;
|
|
@@ -2425,7 +2480,7 @@ let Parser$1 = class Parser {
|
|
|
2425
2480
|
}
|
|
2426
2481
|
colon(tokens) {
|
|
2427
2482
|
let brackets = 0;
|
|
2428
|
-
let token, type
|
|
2483
|
+
let prev, token, type;
|
|
2429
2484
|
for (let [i, element] of tokens.entries()) {
|
|
2430
2485
|
token = element;
|
|
2431
2486
|
type = token[0];
|
|
@@ -2449,7 +2504,7 @@ let Parser$1 = class Parser {
|
|
|
2449
2504
|
return false;
|
|
2450
2505
|
}
|
|
2451
2506
|
comment(token) {
|
|
2452
|
-
let node2 = new Comment$
|
|
2507
|
+
let node2 = new Comment$1();
|
|
2453
2508
|
this.init(node2, token[2]);
|
|
2454
2509
|
node2.source.end = this.getPosition(token[3] || token[2]);
|
|
2455
2510
|
node2.source.end.offset++;
|
|
@@ -2469,7 +2524,7 @@ let Parser$1 = class Parser {
|
|
|
2469
2524
|
this.tokenizer = tokenizer2(this.input);
|
|
2470
2525
|
}
|
|
2471
2526
|
decl(tokens, customProperty) {
|
|
2472
|
-
let node2 = new Declaration$
|
|
2527
|
+
let node2 = new Declaration$1();
|
|
2473
2528
|
this.init(node2, tokens[0][2]);
|
|
2474
2529
|
let last = tokens[tokens.length - 1];
|
|
2475
2530
|
if (last[0] === ";") {
|
|
@@ -2530,14 +2585,14 @@ let Parser$1 = class Parser {
|
|
|
2530
2585
|
} else if (token[1].toLowerCase() === "important") {
|
|
2531
2586
|
let cache = tokens.slice(0);
|
|
2532
2587
|
let str = "";
|
|
2533
|
-
for (let
|
|
2534
|
-
let type = cache[
|
|
2535
|
-
if (str.trim().
|
|
2588
|
+
for (let j2 = i; j2 > 0; j2--) {
|
|
2589
|
+
let type = cache[j2][0];
|
|
2590
|
+
if (str.trim().startsWith("!") && type !== "space") {
|
|
2536
2591
|
break;
|
|
2537
2592
|
}
|
|
2538
2593
|
str = cache.pop()[1] + str;
|
|
2539
2594
|
}
|
|
2540
|
-
if (str.trim().
|
|
2595
|
+
if (str.trim().startsWith("!")) {
|
|
2541
2596
|
node2.important = true;
|
|
2542
2597
|
node2.raws.important = str;
|
|
2543
2598
|
tokens = cache;
|
|
@@ -2565,7 +2620,7 @@ let Parser$1 = class Parser {
|
|
|
2565
2620
|
);
|
|
2566
2621
|
}
|
|
2567
2622
|
emptyRule(token) {
|
|
2568
|
-
let node2 = new Rule$
|
|
2623
|
+
let node2 = new Rule$1();
|
|
2569
2624
|
this.init(node2, token[2]);
|
|
2570
2625
|
node2.selector = "";
|
|
2571
2626
|
node2.raws.between = "";
|
|
@@ -2601,6 +2656,8 @@ let Parser$1 = class Parser {
|
|
|
2601
2656
|
if (prev && prev.type === "rule" && !prev.raws.ownSemicolon) {
|
|
2602
2657
|
prev.raws.ownSemicolon = this.spaces;
|
|
2603
2658
|
this.spaces = "";
|
|
2659
|
+
prev.source.end = this.getPosition(token[2]);
|
|
2660
|
+
prev.source.end.offset += prev.raws.ownSemicolon.length;
|
|
2604
2661
|
}
|
|
2605
2662
|
}
|
|
2606
2663
|
}
|
|
@@ -2747,7 +2804,7 @@ let Parser$1 = class Parser {
|
|
|
2747
2804
|
}
|
|
2748
2805
|
rule(tokens) {
|
|
2749
2806
|
tokens.pop();
|
|
2750
|
-
let node2 = new Rule$
|
|
2807
|
+
let node2 = new Rule$1();
|
|
2751
2808
|
this.init(node2, tokens[0][2]);
|
|
2752
2809
|
node2.raws.between = this.spacesAndCommentsFromEnd(tokens);
|
|
2753
2810
|
this.raw(node2, "selector", tokens);
|
|
@@ -2812,56 +2869,125 @@ let Parser$1 = class Parser {
|
|
|
2812
2869
|
}
|
|
2813
2870
|
unknownWord(tokens) {
|
|
2814
2871
|
throw this.input.error(
|
|
2815
|
-
"Unknown word",
|
|
2872
|
+
"Unknown word " + tokens[0][1],
|
|
2816
2873
|
{ offset: tokens[0][2] },
|
|
2817
2874
|
{ offset: tokens[0][2] + tokens[0][1].length }
|
|
2818
2875
|
);
|
|
2819
2876
|
}
|
|
2820
|
-
unnamedAtrule(node2, token) {
|
|
2821
|
-
throw this.input.error(
|
|
2822
|
-
"At-rule without name",
|
|
2823
|
-
{ offset: token[2] },
|
|
2824
|
-
{ offset: token[2] + token[1].length }
|
|
2825
|
-
);
|
|
2877
|
+
unnamedAtrule(node2, token) {
|
|
2878
|
+
throw this.input.error(
|
|
2879
|
+
"At-rule without name",
|
|
2880
|
+
{ offset: token[2] },
|
|
2881
|
+
{ offset: token[2] + token[1].length }
|
|
2882
|
+
);
|
|
2883
|
+
}
|
|
2884
|
+
};
|
|
2885
|
+
var parser = Parser$1;
|
|
2886
|
+
let Container$2 = container;
|
|
2887
|
+
let Input$1 = input;
|
|
2888
|
+
let Parser2 = parser;
|
|
2889
|
+
function parse$3(css, opts) {
|
|
2890
|
+
let input2 = new Input$1(css, opts);
|
|
2891
|
+
let parser2 = new Parser2(input2);
|
|
2892
|
+
try {
|
|
2893
|
+
parser2.parse();
|
|
2894
|
+
} catch (e) {
|
|
2895
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2896
|
+
if (e.name === "CssSyntaxError" && opts && opts.from) {
|
|
2897
|
+
if (/\.scss$/i.test(opts.from)) {
|
|
2898
|
+
e.message += "\nYou tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser";
|
|
2899
|
+
} else if (/\.sass/i.test(opts.from)) {
|
|
2900
|
+
e.message += "\nYou tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser";
|
|
2901
|
+
} else if (/\.less$/i.test(opts.from)) {
|
|
2902
|
+
e.message += "\nYou tried to parse Less with the standard CSS parser; try again with the postcss-less parser";
|
|
2903
|
+
}
|
|
2904
|
+
}
|
|
2905
|
+
}
|
|
2906
|
+
throw e;
|
|
2907
|
+
}
|
|
2908
|
+
return parser2.root;
|
|
2909
|
+
}
|
|
2910
|
+
var parse_1 = parse$3;
|
|
2911
|
+
parse$3.default = parse$3;
|
|
2912
|
+
Container$2.registerParse(parse$3);
|
|
2913
|
+
let Warning$2 = class Warning {
|
|
2914
|
+
constructor(text, opts = {}) {
|
|
2915
|
+
this.type = "warning";
|
|
2916
|
+
this.text = text;
|
|
2917
|
+
if (opts.node && opts.node.source) {
|
|
2918
|
+
let range = opts.node.rangeBy(opts);
|
|
2919
|
+
this.line = range.start.line;
|
|
2920
|
+
this.column = range.start.column;
|
|
2921
|
+
this.endLine = range.end.line;
|
|
2922
|
+
this.endColumn = range.end.column;
|
|
2923
|
+
}
|
|
2924
|
+
for (let opt in opts) this[opt] = opts[opt];
|
|
2925
|
+
}
|
|
2926
|
+
toString() {
|
|
2927
|
+
if (this.node) {
|
|
2928
|
+
return this.node.error(this.text, {
|
|
2929
|
+
index: this.index,
|
|
2930
|
+
plugin: this.plugin,
|
|
2931
|
+
word: this.word
|
|
2932
|
+
}).message;
|
|
2933
|
+
}
|
|
2934
|
+
if (this.plugin) {
|
|
2935
|
+
return this.plugin + ": " + this.text;
|
|
2936
|
+
}
|
|
2937
|
+
return this.text;
|
|
2938
|
+
}
|
|
2939
|
+
};
|
|
2940
|
+
var warning = Warning$2;
|
|
2941
|
+
Warning$2.default = Warning$2;
|
|
2942
|
+
let Warning$1 = warning;
|
|
2943
|
+
let Result$3 = class Result {
|
|
2944
|
+
get content() {
|
|
2945
|
+
return this.css;
|
|
2946
|
+
}
|
|
2947
|
+
constructor(processor2, root2, opts) {
|
|
2948
|
+
this.processor = processor2;
|
|
2949
|
+
this.messages = [];
|
|
2950
|
+
this.root = root2;
|
|
2951
|
+
this.opts = opts;
|
|
2952
|
+
this.css = "";
|
|
2953
|
+
this.map = void 0;
|
|
2954
|
+
}
|
|
2955
|
+
toString() {
|
|
2956
|
+
return this.css;
|
|
2826
2957
|
}
|
|
2827
|
-
}
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
let Input$2 = input;
|
|
2832
|
-
function parse$3(css, opts) {
|
|
2833
|
-
let input2 = new Input$2(css, opts);
|
|
2834
|
-
let parser2 = new Parser2(input2);
|
|
2835
|
-
try {
|
|
2836
|
-
parser2.parse();
|
|
2837
|
-
} catch (e) {
|
|
2838
|
-
if (process.env.NODE_ENV !== "production") {
|
|
2839
|
-
if (e.name === "CssSyntaxError" && opts && opts.from) {
|
|
2840
|
-
if (/\.scss$/i.test(opts.from)) {
|
|
2841
|
-
e.message += "\nYou tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser";
|
|
2842
|
-
} else if (/\.sass/i.test(opts.from)) {
|
|
2843
|
-
e.message += "\nYou tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser";
|
|
2844
|
-
} else if (/\.less$/i.test(opts.from)) {
|
|
2845
|
-
e.message += "\nYou tried to parse Less with the standard CSS parser; try again with the postcss-less parser";
|
|
2846
|
-
}
|
|
2958
|
+
warn(text, opts = {}) {
|
|
2959
|
+
if (!opts.plugin) {
|
|
2960
|
+
if (this.lastPlugin && this.lastPlugin.postcssPlugin) {
|
|
2961
|
+
opts.plugin = this.lastPlugin.postcssPlugin;
|
|
2847
2962
|
}
|
|
2848
2963
|
}
|
|
2849
|
-
|
|
2964
|
+
let warning2 = new Warning$1(text, opts);
|
|
2965
|
+
this.messages.push(warning2);
|
|
2966
|
+
return warning2;
|
|
2850
2967
|
}
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2968
|
+
warnings() {
|
|
2969
|
+
return this.messages.filter((i) => i.type === "warning");
|
|
2970
|
+
}
|
|
2971
|
+
};
|
|
2972
|
+
var result = Result$3;
|
|
2973
|
+
Result$3.default = Result$3;
|
|
2974
|
+
let printed = {};
|
|
2975
|
+
var warnOnce$2 = function warnOnce(message) {
|
|
2976
|
+
if (printed[message]) return;
|
|
2977
|
+
printed[message] = true;
|
|
2978
|
+
if (typeof console !== "undefined" && console.warn) {
|
|
2979
|
+
console.warn(message);
|
|
2980
|
+
}
|
|
2981
|
+
};
|
|
2982
|
+
let Container$1 = container;
|
|
2983
|
+
let Document$3 = document$1;
|
|
2857
2984
|
let MapGenerator$1 = mapGenerator;
|
|
2985
|
+
let parse$2 = parse_1;
|
|
2986
|
+
let Result$2 = result;
|
|
2987
|
+
let Root$2 = root;
|
|
2858
2988
|
let stringify$2 = stringify_1;
|
|
2859
|
-
let
|
|
2860
|
-
let Document$2 = document$1;
|
|
2989
|
+
let { isClean, my } = symbols;
|
|
2861
2990
|
let warnOnce$1 = warnOnce$2;
|
|
2862
|
-
let Result$2 = result;
|
|
2863
|
-
let parse$2 = parse_1;
|
|
2864
|
-
let Root$3 = root;
|
|
2865
2991
|
const TYPE_TO_CLASS_NAME = {
|
|
2866
2992
|
atrule: "AtRule",
|
|
2867
2993
|
comment: "Comment",
|
|
@@ -2946,6 +3072,30 @@ function cleanMarks(node2) {
|
|
|
2946
3072
|
}
|
|
2947
3073
|
let postcss$2 = {};
|
|
2948
3074
|
let LazyResult$2 = class LazyResult {
|
|
3075
|
+
get content() {
|
|
3076
|
+
return this.stringify().content;
|
|
3077
|
+
}
|
|
3078
|
+
get css() {
|
|
3079
|
+
return this.stringify().css;
|
|
3080
|
+
}
|
|
3081
|
+
get map() {
|
|
3082
|
+
return this.stringify().map;
|
|
3083
|
+
}
|
|
3084
|
+
get messages() {
|
|
3085
|
+
return this.sync().messages;
|
|
3086
|
+
}
|
|
3087
|
+
get opts() {
|
|
3088
|
+
return this.result.opts;
|
|
3089
|
+
}
|
|
3090
|
+
get processor() {
|
|
3091
|
+
return this.result.processor;
|
|
3092
|
+
}
|
|
3093
|
+
get root() {
|
|
3094
|
+
return this.sync().root;
|
|
3095
|
+
}
|
|
3096
|
+
get [Symbol.toStringTag]() {
|
|
3097
|
+
return "LazyResult";
|
|
3098
|
+
}
|
|
2949
3099
|
constructor(processor2, css, opts) {
|
|
2950
3100
|
this.stringified = false;
|
|
2951
3101
|
this.processed = false;
|
|
@@ -3288,17 +3438,31 @@ let LazyResult$2 = class LazyResult {
|
|
|
3288
3438
|
warnings() {
|
|
3289
3439
|
return this.sync().warnings();
|
|
3290
3440
|
}
|
|
3441
|
+
};
|
|
3442
|
+
LazyResult$2.registerPostcss = (dependant) => {
|
|
3443
|
+
postcss$2 = dependant;
|
|
3444
|
+
};
|
|
3445
|
+
var lazyResult = LazyResult$2;
|
|
3446
|
+
LazyResult$2.default = LazyResult$2;
|
|
3447
|
+
Root$2.registerLazyResult(LazyResult$2);
|
|
3448
|
+
Document$3.registerLazyResult(LazyResult$2);
|
|
3449
|
+
let MapGenerator2 = mapGenerator;
|
|
3450
|
+
let parse$1 = parse_1;
|
|
3451
|
+
const Result$1 = result;
|
|
3452
|
+
let stringify$1 = stringify_1;
|
|
3453
|
+
let warnOnce2 = warnOnce$2;
|
|
3454
|
+
let NoWorkResult$1 = class NoWorkResult {
|
|
3291
3455
|
get content() {
|
|
3292
|
-
return this.
|
|
3456
|
+
return this.result.css;
|
|
3293
3457
|
}
|
|
3294
3458
|
get css() {
|
|
3295
|
-
return this.
|
|
3459
|
+
return this.result.css;
|
|
3296
3460
|
}
|
|
3297
3461
|
get map() {
|
|
3298
|
-
return this.
|
|
3462
|
+
return this.result.map;
|
|
3299
3463
|
}
|
|
3300
3464
|
get messages() {
|
|
3301
|
-
return
|
|
3465
|
+
return [];
|
|
3302
3466
|
}
|
|
3303
3467
|
get opts() {
|
|
3304
3468
|
return this.result.opts;
|
|
@@ -3307,25 +3471,26 @@ let LazyResult$2 = class LazyResult {
|
|
|
3307
3471
|
return this.result.processor;
|
|
3308
3472
|
}
|
|
3309
3473
|
get root() {
|
|
3310
|
-
|
|
3474
|
+
if (this._root) {
|
|
3475
|
+
return this._root;
|
|
3476
|
+
}
|
|
3477
|
+
let root2;
|
|
3478
|
+
let parser2 = parse$1;
|
|
3479
|
+
try {
|
|
3480
|
+
root2 = parser2(this._css, this._opts);
|
|
3481
|
+
} catch (error) {
|
|
3482
|
+
this.error = error;
|
|
3483
|
+
}
|
|
3484
|
+
if (this.error) {
|
|
3485
|
+
throw this.error;
|
|
3486
|
+
} else {
|
|
3487
|
+
this._root = root2;
|
|
3488
|
+
return root2;
|
|
3489
|
+
}
|
|
3311
3490
|
}
|
|
3312
3491
|
get [Symbol.toStringTag]() {
|
|
3313
|
-
return "
|
|
3492
|
+
return "NoWorkResult";
|
|
3314
3493
|
}
|
|
3315
|
-
};
|
|
3316
|
-
LazyResult$2.registerPostcss = (dependant) => {
|
|
3317
|
-
postcss$2 = dependant;
|
|
3318
|
-
};
|
|
3319
|
-
var lazyResult = LazyResult$2;
|
|
3320
|
-
LazyResult$2.default = LazyResult$2;
|
|
3321
|
-
Root$3.registerLazyResult(LazyResult$2);
|
|
3322
|
-
Document$2.registerLazyResult(LazyResult$2);
|
|
3323
|
-
let MapGenerator2 = mapGenerator;
|
|
3324
|
-
let stringify$1 = stringify_1;
|
|
3325
|
-
let warnOnce2 = warnOnce$2;
|
|
3326
|
-
let parse$1 = parse_1;
|
|
3327
|
-
const Result$1 = result;
|
|
3328
|
-
let NoWorkResult$1 = class NoWorkResult {
|
|
3329
3494
|
constructor(processor2, css, opts) {
|
|
3330
3495
|
css = css.toString();
|
|
3331
3496
|
this.stringified = false;
|
|
@@ -3387,55 +3552,16 @@ let NoWorkResult$1 = class NoWorkResult {
|
|
|
3387
3552
|
warnings() {
|
|
3388
3553
|
return [];
|
|
3389
3554
|
}
|
|
3390
|
-
get content() {
|
|
3391
|
-
return this.result.css;
|
|
3392
|
-
}
|
|
3393
|
-
get css() {
|
|
3394
|
-
return this.result.css;
|
|
3395
|
-
}
|
|
3396
|
-
get map() {
|
|
3397
|
-
return this.result.map;
|
|
3398
|
-
}
|
|
3399
|
-
get messages() {
|
|
3400
|
-
return [];
|
|
3401
|
-
}
|
|
3402
|
-
get opts() {
|
|
3403
|
-
return this.result.opts;
|
|
3404
|
-
}
|
|
3405
|
-
get processor() {
|
|
3406
|
-
return this.result.processor;
|
|
3407
|
-
}
|
|
3408
|
-
get root() {
|
|
3409
|
-
if (this._root) {
|
|
3410
|
-
return this._root;
|
|
3411
|
-
}
|
|
3412
|
-
let root2;
|
|
3413
|
-
let parser2 = parse$1;
|
|
3414
|
-
try {
|
|
3415
|
-
root2 = parser2(this._css, this._opts);
|
|
3416
|
-
} catch (error) {
|
|
3417
|
-
this.error = error;
|
|
3418
|
-
}
|
|
3419
|
-
if (this.error) {
|
|
3420
|
-
throw this.error;
|
|
3421
|
-
} else {
|
|
3422
|
-
this._root = root2;
|
|
3423
|
-
return root2;
|
|
3424
|
-
}
|
|
3425
|
-
}
|
|
3426
|
-
get [Symbol.toStringTag]() {
|
|
3427
|
-
return "NoWorkResult";
|
|
3428
|
-
}
|
|
3429
3555
|
};
|
|
3430
3556
|
var noWorkResult = NoWorkResult$1;
|
|
3431
3557
|
NoWorkResult$1.default = NoWorkResult$1;
|
|
3432
|
-
let
|
|
3558
|
+
let Document$2 = document$1;
|
|
3433
3559
|
let LazyResult$1 = lazyResult;
|
|
3434
|
-
let
|
|
3435
|
-
let Root$
|
|
3560
|
+
let NoWorkResult2 = noWorkResult;
|
|
3561
|
+
let Root$1 = root;
|
|
3436
3562
|
let Processor$1 = class Processor {
|
|
3437
3563
|
constructor(plugins = []) {
|
|
3438
|
-
this.version = "8.
|
|
3564
|
+
this.version = "8.5.6";
|
|
3439
3565
|
this.plugins = this.normalize(plugins);
|
|
3440
3566
|
}
|
|
3441
3567
|
normalize(plugins) {
|
|
@@ -3478,75 +3604,26 @@ let Processor$1 = class Processor {
|
|
|
3478
3604
|
};
|
|
3479
3605
|
var processor = Processor$1;
|
|
3480
3606
|
Processor$1.default = Processor$1;
|
|
3481
|
-
Root$
|
|
3482
|
-
Document$
|
|
3483
|
-
let
|
|
3484
|
-
let
|
|
3485
|
-
let
|
|
3486
|
-
let AtRule$1 = atRule;
|
|
3487
|
-
let Input$1 = input;
|
|
3488
|
-
let Root$1 = root;
|
|
3489
|
-
let Rule$1 = rule;
|
|
3490
|
-
function fromJSON$1(json, inputs) {
|
|
3491
|
-
if (Array.isArray(json)) return json.map((n) => fromJSON$1(n));
|
|
3492
|
-
let { inputs: ownInputs, ...defaults } = json;
|
|
3493
|
-
if (ownInputs) {
|
|
3494
|
-
inputs = [];
|
|
3495
|
-
for (let input2 of ownInputs) {
|
|
3496
|
-
let inputHydrated = { ...input2, __proto__: Input$1.prototype };
|
|
3497
|
-
if (inputHydrated.map) {
|
|
3498
|
-
inputHydrated.map = {
|
|
3499
|
-
...inputHydrated.map,
|
|
3500
|
-
__proto__: PreviousMap2.prototype
|
|
3501
|
-
};
|
|
3502
|
-
}
|
|
3503
|
-
inputs.push(inputHydrated);
|
|
3504
|
-
}
|
|
3505
|
-
}
|
|
3506
|
-
if (defaults.nodes) {
|
|
3507
|
-
defaults.nodes = json.nodes.map((n) => fromJSON$1(n, inputs));
|
|
3508
|
-
}
|
|
3509
|
-
if (defaults.source) {
|
|
3510
|
-
let { inputId, ...source } = defaults.source;
|
|
3511
|
-
defaults.source = source;
|
|
3512
|
-
if (inputId != null) {
|
|
3513
|
-
defaults.source.input = inputs[inputId];
|
|
3514
|
-
}
|
|
3515
|
-
}
|
|
3516
|
-
if (defaults.type === "root") {
|
|
3517
|
-
return new Root$1(defaults);
|
|
3518
|
-
} else if (defaults.type === "decl") {
|
|
3519
|
-
return new Declaration$1(defaults);
|
|
3520
|
-
} else if (defaults.type === "rule") {
|
|
3521
|
-
return new Rule$1(defaults);
|
|
3522
|
-
} else if (defaults.type === "comment") {
|
|
3523
|
-
return new Comment$1(defaults);
|
|
3524
|
-
} else if (defaults.type === "atrule") {
|
|
3525
|
-
return new AtRule$1(defaults);
|
|
3526
|
-
} else {
|
|
3527
|
-
throw new Error("Unknown node type: " + json.type);
|
|
3528
|
-
}
|
|
3529
|
-
}
|
|
3530
|
-
var fromJSON_1 = fromJSON$1;
|
|
3531
|
-
fromJSON$1.default = fromJSON$1;
|
|
3607
|
+
Root$1.registerProcessor(Processor$1);
|
|
3608
|
+
Document$2.registerProcessor(Processor$1);
|
|
3609
|
+
let AtRule2 = atRule;
|
|
3610
|
+
let Comment2 = comment;
|
|
3611
|
+
let Container2 = container;
|
|
3532
3612
|
let CssSyntaxError2 = cssSyntaxError;
|
|
3533
3613
|
let Declaration2 = declaration;
|
|
3534
|
-
let
|
|
3535
|
-
let Container2 = container;
|
|
3536
|
-
let Processor2 = processor;
|
|
3537
|
-
let stringify = stringify_1;
|
|
3614
|
+
let Document$1 = document$1;
|
|
3538
3615
|
let fromJSON = fromJSON_1;
|
|
3539
|
-
let Document22 = document$1;
|
|
3540
|
-
let Warning2 = warning;
|
|
3541
|
-
let Comment2 = comment;
|
|
3542
|
-
let AtRule2 = atRule;
|
|
3543
|
-
let Result2 = result;
|
|
3544
3616
|
let Input2 = input;
|
|
3545
|
-
let
|
|
3617
|
+
let LazyResult2 = lazyResult;
|
|
3546
3618
|
let list = list_1;
|
|
3547
|
-
let Rule2 = rule;
|
|
3548
|
-
let Root2 = root;
|
|
3549
3619
|
let Node$1 = node;
|
|
3620
|
+
let parse = parse_1;
|
|
3621
|
+
let Processor2 = processor;
|
|
3622
|
+
let Result2 = result;
|
|
3623
|
+
let Root2 = root;
|
|
3624
|
+
let Rule2 = rule;
|
|
3625
|
+
let stringify = stringify_1;
|
|
3626
|
+
let Warning2 = warning;
|
|
3550
3627
|
function postcss(...plugins) {
|
|
3551
3628
|
if (plugins.length === 1 && Array.isArray(plugins[0])) {
|
|
3552
3629
|
plugins = plugins[0];
|
|
@@ -3593,12 +3670,12 @@ postcss.atRule = (defaults) => new AtRule2(defaults);
|
|
|
3593
3670
|
postcss.decl = (defaults) => new Declaration2(defaults);
|
|
3594
3671
|
postcss.rule = (defaults) => new Rule2(defaults);
|
|
3595
3672
|
postcss.root = (defaults) => new Root2(defaults);
|
|
3596
|
-
postcss.document = (defaults) => new
|
|
3673
|
+
postcss.document = (defaults) => new Document$1(defaults);
|
|
3597
3674
|
postcss.CssSyntaxError = CssSyntaxError2;
|
|
3598
3675
|
postcss.Declaration = Declaration2;
|
|
3599
3676
|
postcss.Container = Container2;
|
|
3600
3677
|
postcss.Processor = Processor2;
|
|
3601
|
-
postcss.Document =
|
|
3678
|
+
postcss.Document = Document$1;
|
|
3602
3679
|
postcss.Comment = Comment2;
|
|
3603
3680
|
postcss.Warning = Warning2;
|
|
3604
3681
|
postcss.AtRule = AtRule2;
|