@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
|
@@ -1,16 +1,4 @@
|
|
|
1
|
-
(function (g, f) {
|
|
2
|
-
if ("object" == typeof exports && "object" == typeof module) {
|
|
3
|
-
module.exports = f();
|
|
4
|
-
} else if ("function" == typeof define && define.amd) {
|
|
5
|
-
define("rrdomNodejs", [], f);
|
|
6
|
-
} else if ("object" == typeof exports) {
|
|
7
|
-
exports["rrdomNodejs"] = f();
|
|
8
|
-
} else {
|
|
9
|
-
g["rrdomNodejs"] = f();
|
|
10
|
-
}
|
|
11
|
-
}(this, () => {
|
|
12
|
-
var exports = {};
|
|
13
|
-
var module = { exports };
|
|
1
|
+
(function (g, f) {if ("object" == typeof exports && "object" == typeof module) {module.exports = f();} else if ("function" == typeof define && define.amd) {define("rrdomNodejs", [], f);} else if ("object" == typeof exports) {exports["rrdomNodejs"] = f();} else {g["rrdomNodejs"] = f();}}(typeof self !== 'undefined' ? self : typeof globalThis !== 'undefined' ? globalThis : this, () => {var exports = {};var module = { exports };
|
|
14
2
|
"use strict";
|
|
15
3
|
var __defProp = Object.defineProperty;
|
|
16
4
|
var __defProps = Object.defineProperties;
|
|
@@ -150,12 +138,12 @@ function getAugmentedNamespace(n) {
|
|
|
150
138
|
} else
|
|
151
139
|
a = {};
|
|
152
140
|
Object.defineProperty(a, "__esModule", { value: true });
|
|
153
|
-
Object.keys(n).forEach(function(
|
|
154
|
-
var d = Object.getOwnPropertyDescriptor(n,
|
|
155
|
-
Object.defineProperty(a,
|
|
141
|
+
Object.keys(n).forEach(function(k2) {
|
|
142
|
+
var d = Object.getOwnPropertyDescriptor(n, k2);
|
|
143
|
+
Object.defineProperty(a, k2, d.get ? d : {
|
|
156
144
|
enumerable: true,
|
|
157
145
|
get: function() {
|
|
158
|
-
return n[
|
|
146
|
+
return n[k2];
|
|
159
147
|
}
|
|
160
148
|
});
|
|
161
149
|
});
|
|
@@ -164,7 +152,7 @@ function getAugmentedNamespace(n) {
|
|
|
164
152
|
var picocolors_browser = { exports: {} };
|
|
165
153
|
var x = String;
|
|
166
154
|
var create = function() {
|
|
167
|
-
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 };
|
|
155
|
+
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 };
|
|
168
156
|
};
|
|
169
157
|
picocolors_browser.exports = create();
|
|
170
158
|
picocolors_browser.exports.createColors = create;
|
|
@@ -221,30 +209,40 @@ let CssSyntaxError$3 = class CssSyntaxError extends Error {
|
|
|
221
209
|
let css = this.source;
|
|
222
210
|
if (color == null)
|
|
223
211
|
color = pico.isColorSupported;
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
}
|
|
228
|
-
let lines = css.split(/\r?\n/);
|
|
229
|
-
let start = Math.max(this.line - 3, 0);
|
|
230
|
-
let end = Math.min(this.line + 2, lines.length);
|
|
231
|
-
let maxWidth = String(end).length;
|
|
232
|
-
let mark, aside;
|
|
212
|
+
let aside = (text) => text;
|
|
213
|
+
let mark = (text) => text;
|
|
214
|
+
let highlight = (text) => text;
|
|
233
215
|
if (color) {
|
|
234
216
|
let { bold, gray, red } = pico.createColors(true);
|
|
235
217
|
mark = (text) => bold(red(text));
|
|
236
218
|
aside = (text) => gray(text);
|
|
237
|
-
|
|
238
|
-
|
|
219
|
+
if (terminalHighlight$1) {
|
|
220
|
+
highlight = (text) => terminalHighlight$1(text);
|
|
221
|
+
}
|
|
239
222
|
}
|
|
223
|
+
let lines = css.split(/\r?\n/);
|
|
224
|
+
let start = Math.max(this.line - 3, 0);
|
|
225
|
+
let end = Math.min(this.line + 2, lines.length);
|
|
226
|
+
let maxWidth = String(end).length;
|
|
240
227
|
return lines.slice(start, end).map((line, index2) => {
|
|
241
228
|
let number = start + 1 + index2;
|
|
242
229
|
let gutter = " " + (" " + number).slice(-maxWidth) + " | ";
|
|
243
230
|
if (number === this.line) {
|
|
231
|
+
if (line.length > 160) {
|
|
232
|
+
let padding = 20;
|
|
233
|
+
let subLineStart = Math.max(0, this.column - padding);
|
|
234
|
+
let subLineEnd = Math.max(
|
|
235
|
+
this.column + padding,
|
|
236
|
+
this.endColumn + padding
|
|
237
|
+
);
|
|
238
|
+
let subLine = line.slice(subLineStart, subLineEnd);
|
|
239
|
+
let spacing2 = aside(gutter.replace(/\d/g, " ")) + line.slice(0, Math.min(this.column - 1, padding - 1)).replace(/[^\t]/g, " ");
|
|
240
|
+
return mark(">") + aside(gutter) + highlight(subLine) + "\n " + spacing2 + mark("^");
|
|
241
|
+
}
|
|
244
242
|
let spacing = aside(gutter.replace(/\d/g, " ")) + line.slice(0, this.column - 1).replace(/[^\t]/g, " ");
|
|
245
|
-
return mark(">") + aside(gutter) + line + "\n " + spacing + mark("^");
|
|
243
|
+
return mark(">") + aside(gutter) + highlight(line) + "\n " + spacing + mark("^");
|
|
246
244
|
}
|
|
247
|
-
return " " + aside(gutter) + line;
|
|
245
|
+
return " " + aside(gutter) + highlight(line);
|
|
248
246
|
}).join("\n");
|
|
249
247
|
}
|
|
250
248
|
toString() {
|
|
@@ -257,9 +255,6 @@ let CssSyntaxError$3 = class CssSyntaxError extends Error {
|
|
|
257
255
|
};
|
|
258
256
|
var cssSyntaxError = CssSyntaxError$3;
|
|
259
257
|
CssSyntaxError$3.default = CssSyntaxError$3;
|
|
260
|
-
var symbols = {};
|
|
261
|
-
symbols.isClean = Symbol("isClean");
|
|
262
|
-
symbols.my = Symbol("my");
|
|
263
258
|
const DEFAULT_RAW = {
|
|
264
259
|
after: "\n",
|
|
265
260
|
beforeClose: "\n",
|
|
@@ -582,10 +577,13 @@ function stringify$4(node2, builder) {
|
|
|
582
577
|
}
|
|
583
578
|
var stringify_1 = stringify$4;
|
|
584
579
|
stringify$4.default = stringify$4;
|
|
585
|
-
|
|
580
|
+
var symbols = {};
|
|
581
|
+
symbols.isClean = Symbol("isClean");
|
|
582
|
+
symbols.my = Symbol("my");
|
|
586
583
|
let CssSyntaxError$2 = cssSyntaxError;
|
|
587
584
|
let Stringifier2 = stringifier;
|
|
588
585
|
let stringify$3 = stringify_1;
|
|
586
|
+
let { isClean: isClean$2, my: my$2 } = symbols;
|
|
589
587
|
function cloneNode(obj, parent) {
|
|
590
588
|
let cloned = new obj.constructor();
|
|
591
589
|
for (let i in obj) {
|
|
@@ -602,7 +600,7 @@ function cloneNode(obj, parent) {
|
|
|
602
600
|
} else if (i === "source") {
|
|
603
601
|
cloned[i] = value;
|
|
604
602
|
} else if (Array.isArray(value)) {
|
|
605
|
-
cloned[i] = value.map((
|
|
603
|
+
cloned[i] = value.map((j2) => cloneNode(j2, cloned));
|
|
606
604
|
} else {
|
|
607
605
|
if (type === "object" && value !== null)
|
|
608
606
|
value = cloneNode(value);
|
|
@@ -611,7 +609,31 @@ function cloneNode(obj, parent) {
|
|
|
611
609
|
}
|
|
612
610
|
return cloned;
|
|
613
611
|
}
|
|
612
|
+
function sourceOffset(inputCSS, position) {
|
|
613
|
+
if (position && typeof position.offset !== "undefined") {
|
|
614
|
+
return position.offset;
|
|
615
|
+
}
|
|
616
|
+
let column = 1;
|
|
617
|
+
let line = 1;
|
|
618
|
+
let offset = 0;
|
|
619
|
+
for (let i = 0; i < inputCSS.length; i++) {
|
|
620
|
+
if (line === position.line && column === position.column) {
|
|
621
|
+
offset = i;
|
|
622
|
+
break;
|
|
623
|
+
}
|
|
624
|
+
if (inputCSS[i] === "\n") {
|
|
625
|
+
column = 1;
|
|
626
|
+
line += 1;
|
|
627
|
+
} else {
|
|
628
|
+
column += 1;
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
return offset;
|
|
632
|
+
}
|
|
614
633
|
let Node$5 = class Node2 {
|
|
634
|
+
get proxyOf() {
|
|
635
|
+
return this;
|
|
636
|
+
}
|
|
615
637
|
constructor(defaults = {}) {
|
|
616
638
|
this.raws = {};
|
|
617
639
|
this[isClean$2] = false;
|
|
@@ -714,6 +736,10 @@ let Node$5 = class Node2 {
|
|
|
714
736
|
}
|
|
715
737
|
};
|
|
716
738
|
}
|
|
739
|
+
/* c8 ignore next 3 */
|
|
740
|
+
markClean() {
|
|
741
|
+
this[isClean$2] = true;
|
|
742
|
+
}
|
|
717
743
|
markDirty() {
|
|
718
744
|
if (this[isClean$2]) {
|
|
719
745
|
this[isClean$2] = false;
|
|
@@ -729,31 +755,37 @@ let Node$5 = class Node2 {
|
|
|
729
755
|
let index2 = this.parent.index(this);
|
|
730
756
|
return this.parent.nodes[index2 + 1];
|
|
731
757
|
}
|
|
732
|
-
positionBy(opts
|
|
758
|
+
positionBy(opts = {}) {
|
|
733
759
|
let pos = this.source.start;
|
|
734
760
|
if (opts.index) {
|
|
735
|
-
pos = this.positionInside(opts.index
|
|
761
|
+
pos = this.positionInside(opts.index);
|
|
736
762
|
} else if (opts.word) {
|
|
737
|
-
|
|
763
|
+
let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
|
|
764
|
+
let stringRepresentation = inputString.slice(
|
|
765
|
+
sourceOffset(inputString, this.source.start),
|
|
766
|
+
sourceOffset(inputString, this.source.end)
|
|
767
|
+
);
|
|
738
768
|
let index2 = stringRepresentation.indexOf(opts.word);
|
|
739
769
|
if (index2 !== -1)
|
|
740
|
-
pos = this.positionInside(index2
|
|
770
|
+
pos = this.positionInside(index2);
|
|
741
771
|
}
|
|
742
772
|
return pos;
|
|
743
773
|
}
|
|
744
|
-
positionInside(index2
|
|
745
|
-
let string = stringRepresentation || this.toString();
|
|
774
|
+
positionInside(index2) {
|
|
746
775
|
let column = this.source.start.column;
|
|
747
776
|
let line = this.source.start.line;
|
|
748
|
-
|
|
749
|
-
|
|
777
|
+
let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
|
|
778
|
+
let offset = sourceOffset(inputString, this.source.start);
|
|
779
|
+
let end = offset + index2;
|
|
780
|
+
for (let i = offset; i < end; i++) {
|
|
781
|
+
if (inputString[i] === "\n") {
|
|
750
782
|
column = 1;
|
|
751
783
|
line += 1;
|
|
752
784
|
} else {
|
|
753
785
|
column += 1;
|
|
754
786
|
}
|
|
755
787
|
}
|
|
756
|
-
return { column, line };
|
|
788
|
+
return { column, line, offset: end };
|
|
757
789
|
}
|
|
758
790
|
prev() {
|
|
759
791
|
if (!this.parent)
|
|
@@ -761,30 +793,46 @@ let Node$5 = class Node2 {
|
|
|
761
793
|
let index2 = this.parent.index(this);
|
|
762
794
|
return this.parent.nodes[index2 - 1];
|
|
763
795
|
}
|
|
764
|
-
rangeBy(opts) {
|
|
796
|
+
rangeBy(opts = {}) {
|
|
797
|
+
let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
|
|
765
798
|
let start = {
|
|
766
799
|
column: this.source.start.column,
|
|
767
|
-
line: this.source.start.line
|
|
800
|
+
line: this.source.start.line,
|
|
801
|
+
offset: sourceOffset(inputString, this.source.start)
|
|
768
802
|
};
|
|
769
803
|
let end = this.source.end ? {
|
|
770
804
|
column: this.source.end.column + 1,
|
|
771
|
-
line: this.source.end.line
|
|
805
|
+
line: this.source.end.line,
|
|
806
|
+
offset: typeof this.source.end.offset === "number" ? (
|
|
807
|
+
// `source.end.offset` is exclusive, so we don't need to add 1
|
|
808
|
+
this.source.end.offset
|
|
809
|
+
) : (
|
|
810
|
+
// Since line/column in this.source.end is inclusive,
|
|
811
|
+
// the `sourceOffset(... , this.source.end)` returns an inclusive offset.
|
|
812
|
+
// So, we add 1 to convert it to exclusive.
|
|
813
|
+
sourceOffset(inputString, this.source.end) + 1
|
|
814
|
+
)
|
|
772
815
|
} : {
|
|
773
816
|
column: start.column + 1,
|
|
774
|
-
line: start.line
|
|
817
|
+
line: start.line,
|
|
818
|
+
offset: start.offset + 1
|
|
775
819
|
};
|
|
776
820
|
if (opts.word) {
|
|
777
|
-
let stringRepresentation =
|
|
821
|
+
let stringRepresentation = inputString.slice(
|
|
822
|
+
sourceOffset(inputString, this.source.start),
|
|
823
|
+
sourceOffset(inputString, this.source.end)
|
|
824
|
+
);
|
|
778
825
|
let index2 = stringRepresentation.indexOf(opts.word);
|
|
779
826
|
if (index2 !== -1) {
|
|
780
|
-
start = this.positionInside(index2
|
|
781
|
-
end = this.positionInside(index2 + opts.word.length
|
|
827
|
+
start = this.positionInside(index2);
|
|
828
|
+
end = this.positionInside(index2 + opts.word.length);
|
|
782
829
|
}
|
|
783
830
|
} else {
|
|
784
831
|
if (opts.start) {
|
|
785
832
|
start = {
|
|
786
833
|
column: opts.start.column,
|
|
787
|
-
line: opts.start.line
|
|
834
|
+
line: opts.start.line,
|
|
835
|
+
offset: sourceOffset(inputString, opts.start)
|
|
788
836
|
};
|
|
789
837
|
} else if (opts.index) {
|
|
790
838
|
start = this.positionInside(opts.index);
|
|
@@ -792,7 +840,8 @@ let Node$5 = class Node2 {
|
|
|
792
840
|
if (opts.end) {
|
|
793
841
|
end = {
|
|
794
842
|
column: opts.end.column,
|
|
795
|
-
line: opts.end.line
|
|
843
|
+
line: opts.end.line,
|
|
844
|
+
offset: sourceOffset(inputString, opts.end)
|
|
796
845
|
};
|
|
797
846
|
} else if (typeof opts.endIndex === "number") {
|
|
798
847
|
end = this.positionInside(opts.endIndex);
|
|
@@ -801,7 +850,11 @@ let Node$5 = class Node2 {
|
|
|
801
850
|
}
|
|
802
851
|
}
|
|
803
852
|
if (end.line < start.line || end.line === start.line && end.column <= start.column) {
|
|
804
|
-
end = {
|
|
853
|
+
end = {
|
|
854
|
+
column: start.column + 1,
|
|
855
|
+
line: start.line,
|
|
856
|
+
offset: start.offset + 1
|
|
857
|
+
};
|
|
805
858
|
}
|
|
806
859
|
return { end, start };
|
|
807
860
|
}
|
|
@@ -843,7 +896,7 @@ let Node$5 = class Node2 {
|
|
|
843
896
|
}
|
|
844
897
|
return result2;
|
|
845
898
|
}
|
|
846
|
-
toJSON(
|
|
899
|
+
toJSON(_2, inputs) {
|
|
847
900
|
let fixed = {};
|
|
848
901
|
let emitInputs = inputs == null;
|
|
849
902
|
inputs = inputs || /* @__PURE__ */ new Map();
|
|
@@ -866,6 +919,8 @@ let Node$5 = class Node2 {
|
|
|
866
919
|
} else if (typeof value === "object" && value.toJSON) {
|
|
867
920
|
fixed[name] = value.toJSON(null, inputs);
|
|
868
921
|
} else if (name === "source") {
|
|
922
|
+
if (value == null)
|
|
923
|
+
continue;
|
|
869
924
|
let inputId = inputs.get(value.input);
|
|
870
925
|
if (inputId == null) {
|
|
871
926
|
inputId = inputsNextIndex;
|
|
@@ -901,20 +956,29 @@ let Node$5 = class Node2 {
|
|
|
901
956
|
});
|
|
902
957
|
return result2;
|
|
903
958
|
}
|
|
904
|
-
warn(result2, text, opts) {
|
|
959
|
+
warn(result2, text, opts = {}) {
|
|
905
960
|
let data = { node: this };
|
|
906
961
|
for (let i in opts)
|
|
907
962
|
data[i] = opts[i];
|
|
908
963
|
return result2.warn(text, data);
|
|
909
964
|
}
|
|
910
|
-
get proxyOf() {
|
|
911
|
-
return this;
|
|
912
|
-
}
|
|
913
965
|
};
|
|
914
966
|
var node = Node$5;
|
|
915
967
|
Node$5.default = Node$5;
|
|
916
968
|
let Node$4 = node;
|
|
917
|
-
let
|
|
969
|
+
let Comment$4 = class Comment extends Node$4 {
|
|
970
|
+
constructor(defaults) {
|
|
971
|
+
super(defaults);
|
|
972
|
+
this.type = "comment";
|
|
973
|
+
}
|
|
974
|
+
};
|
|
975
|
+
var comment = Comment$4;
|
|
976
|
+
Comment$4.default = Comment$4;
|
|
977
|
+
let Node$3 = node;
|
|
978
|
+
let Declaration$4 = class Declaration extends Node$3 {
|
|
979
|
+
get variable() {
|
|
980
|
+
return this.prop.startsWith("--") || this.prop[0] === "$";
|
|
981
|
+
}
|
|
918
982
|
constructor(defaults) {
|
|
919
983
|
if (defaults && typeof defaults.value !== "undefined" && typeof defaults.value !== "string") {
|
|
920
984
|
defaults = __spreadProps(__spreadValues({}, defaults), { value: String(defaults.value) });
|
|
@@ -922,1179 +986,1301 @@ let Declaration$4 = class Declaration extends Node$4 {
|
|
|
922
986
|
super(defaults);
|
|
923
987
|
this.type = "decl";
|
|
924
988
|
}
|
|
925
|
-
get variable() {
|
|
926
|
-
return this.prop.startsWith("--") || this.prop[0] === "$";
|
|
927
|
-
}
|
|
928
989
|
};
|
|
929
990
|
var declaration = Declaration$4;
|
|
930
991
|
Declaration$4.default = Declaration$4;
|
|
931
|
-
let
|
|
932
|
-
let
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
id += urlAlphabet[Math.random() * 64 | 0];
|
|
947
|
-
}
|
|
948
|
-
return id;
|
|
949
|
-
};
|
|
950
|
-
var nonSecure = { nanoid: nanoid$1, customAlphabet };
|
|
951
|
-
let { SourceMapConsumer: SourceMapConsumer$2, SourceMapGenerator: SourceMapGenerator$2 } = require$$2;
|
|
952
|
-
let { existsSync, readFileSync } = require$$2;
|
|
953
|
-
let { dirname: dirname$1, join } = require$$2;
|
|
954
|
-
function fromBase64(str) {
|
|
955
|
-
if (Buffer) {
|
|
956
|
-
return Buffer.from(str, "base64").toString();
|
|
957
|
-
} else {
|
|
958
|
-
return window.atob(str);
|
|
959
|
-
}
|
|
992
|
+
let Comment$3 = comment;
|
|
993
|
+
let Declaration$3 = declaration;
|
|
994
|
+
let Node$2 = node;
|
|
995
|
+
let { isClean: isClean$1, my: my$1 } = symbols;
|
|
996
|
+
let AtRule$4;
|
|
997
|
+
let parse$4;
|
|
998
|
+
let Root$6;
|
|
999
|
+
let Rule$4;
|
|
1000
|
+
function cleanSource(nodes) {
|
|
1001
|
+
return nodes.map((i) => {
|
|
1002
|
+
if (i.nodes)
|
|
1003
|
+
i.nodes = cleanSource(i.nodes);
|
|
1004
|
+
delete i.source;
|
|
1005
|
+
return i;
|
|
1006
|
+
});
|
|
960
1007
|
}
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
this.inline = this.startWith(this.annotation, "data:");
|
|
967
|
-
let prev = opts.map ? opts.map.prev : void 0;
|
|
968
|
-
let text = this.loadMap(opts.from, prev);
|
|
969
|
-
if (!this.mapFile && opts.from) {
|
|
970
|
-
this.mapFile = opts.from;
|
|
971
|
-
}
|
|
972
|
-
if (this.mapFile)
|
|
973
|
-
this.root = dirname$1(this.mapFile);
|
|
974
|
-
if (text)
|
|
975
|
-
this.text = text;
|
|
976
|
-
}
|
|
977
|
-
consumer() {
|
|
978
|
-
if (!this.consumerCache) {
|
|
979
|
-
this.consumerCache = new SourceMapConsumer$2(this.text);
|
|
980
|
-
}
|
|
981
|
-
return this.consumerCache;
|
|
982
|
-
}
|
|
983
|
-
decodeInline(text) {
|
|
984
|
-
let baseCharsetUri = /^data:application\/json;charset=utf-?8;base64,/;
|
|
985
|
-
let baseUri = /^data:application\/json;base64,/;
|
|
986
|
-
let charsetUri = /^data:application\/json;charset=utf-?8,/;
|
|
987
|
-
let uri = /^data:application\/json,/;
|
|
988
|
-
if (charsetUri.test(text) || uri.test(text)) {
|
|
989
|
-
return decodeURIComponent(text.substr(RegExp.lastMatch.length));
|
|
990
|
-
}
|
|
991
|
-
if (baseCharsetUri.test(text) || baseUri.test(text)) {
|
|
992
|
-
return fromBase64(text.substr(RegExp.lastMatch.length));
|
|
1008
|
+
function markTreeDirty(node2) {
|
|
1009
|
+
node2[isClean$1] = false;
|
|
1010
|
+
if (node2.proxyOf.nodes) {
|
|
1011
|
+
for (let i of node2.proxyOf.nodes) {
|
|
1012
|
+
markTreeDirty(i);
|
|
993
1013
|
}
|
|
994
|
-
let encoding = text.match(/data:application\/json;([^,]+),/)[1];
|
|
995
|
-
throw new Error("Unsupported source map encoding " + encoding);
|
|
996
1014
|
}
|
|
997
|
-
|
|
998
|
-
|
|
1015
|
+
}
|
|
1016
|
+
let Container$7 = class Container extends Node$2 {
|
|
1017
|
+
get first() {
|
|
1018
|
+
if (!this.proxyOf.nodes)
|
|
1019
|
+
return void 0;
|
|
1020
|
+
return this.proxyOf.nodes[0];
|
|
999
1021
|
}
|
|
1000
|
-
|
|
1001
|
-
if (
|
|
1002
|
-
return
|
|
1003
|
-
return
|
|
1022
|
+
get last() {
|
|
1023
|
+
if (!this.proxyOf.nodes)
|
|
1024
|
+
return void 0;
|
|
1025
|
+
return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
|
|
1004
1026
|
}
|
|
1005
|
-
|
|
1006
|
-
let
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
let end = css.indexOf("*/", start);
|
|
1011
|
-
if (start > -1 && end > -1) {
|
|
1012
|
-
this.annotation = this.getAnnotationURL(css.substring(start, end));
|
|
1027
|
+
append(...children) {
|
|
1028
|
+
for (let child of children) {
|
|
1029
|
+
let nodes = this.normalize(child, this.last);
|
|
1030
|
+
for (let node2 of nodes)
|
|
1031
|
+
this.proxyOf.nodes.push(node2);
|
|
1013
1032
|
}
|
|
1033
|
+
this.markDirty();
|
|
1034
|
+
return this;
|
|
1014
1035
|
}
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
if (
|
|
1018
|
-
this.
|
|
1019
|
-
|
|
1036
|
+
cleanRaws(keepBetween) {
|
|
1037
|
+
super.cleanRaws(keepBetween);
|
|
1038
|
+
if (this.nodes) {
|
|
1039
|
+
for (let node2 of this.nodes)
|
|
1040
|
+
node2.cleanRaws(keepBetween);
|
|
1020
1041
|
}
|
|
1021
1042
|
}
|
|
1022
|
-
|
|
1023
|
-
if (
|
|
1024
|
-
return
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
throw new Error(
|
|
1034
|
-
"Unable to load previous source map: " + prevPath.toString()
|
|
1035
|
-
);
|
|
1036
|
-
}
|
|
1037
|
-
return map;
|
|
1038
|
-
}
|
|
1039
|
-
} else if (prev instanceof SourceMapConsumer$2) {
|
|
1040
|
-
return SourceMapGenerator$2.fromSourceMap(prev).toString();
|
|
1041
|
-
} else if (prev instanceof SourceMapGenerator$2) {
|
|
1042
|
-
return prev.toString();
|
|
1043
|
-
} else if (this.isMap(prev)) {
|
|
1044
|
-
return JSON.stringify(prev);
|
|
1045
|
-
} else {
|
|
1046
|
-
throw new Error(
|
|
1047
|
-
"Unsupported previous source map format: " + prev.toString()
|
|
1048
|
-
);
|
|
1049
|
-
}
|
|
1050
|
-
} else if (this.inline) {
|
|
1051
|
-
return this.decodeInline(this.annotation);
|
|
1052
|
-
} else if (this.annotation) {
|
|
1053
|
-
let map = this.annotation;
|
|
1054
|
-
if (file)
|
|
1055
|
-
map = join(dirname$1(file), map);
|
|
1056
|
-
return this.loadFile(map);
|
|
1043
|
+
each(callback) {
|
|
1044
|
+
if (!this.proxyOf.nodes)
|
|
1045
|
+
return void 0;
|
|
1046
|
+
let iterator = this.getIterator();
|
|
1047
|
+
let index2, result2;
|
|
1048
|
+
while (this.indexes[iterator] < this.proxyOf.nodes.length) {
|
|
1049
|
+
index2 = this.indexes[iterator];
|
|
1050
|
+
result2 = callback(this.proxyOf.nodes[index2], index2);
|
|
1051
|
+
if (result2 === false)
|
|
1052
|
+
break;
|
|
1053
|
+
this.indexes[iterator] += 1;
|
|
1057
1054
|
}
|
|
1055
|
+
delete this.indexes[iterator];
|
|
1056
|
+
return result2;
|
|
1058
1057
|
}
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
return false;
|
|
1062
|
-
return string.substr(0, start.length) === start;
|
|
1058
|
+
every(condition) {
|
|
1059
|
+
return this.nodes.every(condition);
|
|
1063
1060
|
}
|
|
1064
|
-
|
|
1065
|
-
|
|
1061
|
+
getIterator() {
|
|
1062
|
+
if (!this.lastEach)
|
|
1063
|
+
this.lastEach = 0;
|
|
1064
|
+
if (!this.indexes)
|
|
1065
|
+
this.indexes = {};
|
|
1066
|
+
this.lastEach += 1;
|
|
1067
|
+
let iterator = this.lastEach;
|
|
1068
|
+
this.indexes[iterator] = 0;
|
|
1069
|
+
return iterator;
|
|
1066
1070
|
}
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1071
|
+
getProxyProcessor() {
|
|
1072
|
+
return {
|
|
1073
|
+
get(node2, prop) {
|
|
1074
|
+
if (prop === "proxyOf") {
|
|
1075
|
+
return node2;
|
|
1076
|
+
} else if (!node2[prop]) {
|
|
1077
|
+
return node2[prop];
|
|
1078
|
+
} else if (prop === "each" || typeof prop === "string" && prop.startsWith("walk")) {
|
|
1079
|
+
return (...args) => {
|
|
1080
|
+
return node2[prop](
|
|
1081
|
+
...args.map((i) => {
|
|
1082
|
+
if (typeof i === "function") {
|
|
1083
|
+
return (child, index2) => i(child.toProxy(), index2);
|
|
1084
|
+
} else {
|
|
1085
|
+
return i;
|
|
1086
|
+
}
|
|
1087
|
+
})
|
|
1088
|
+
);
|
|
1089
|
+
};
|
|
1090
|
+
} else if (prop === "every" || prop === "some") {
|
|
1091
|
+
return (cb) => {
|
|
1092
|
+
return node2[prop](
|
|
1093
|
+
(child, ...other) => cb(child.toProxy(), ...other)
|
|
1094
|
+
);
|
|
1095
|
+
};
|
|
1096
|
+
} else if (prop === "root") {
|
|
1097
|
+
return () => node2.root().toProxy();
|
|
1098
|
+
} else if (prop === "nodes") {
|
|
1099
|
+
return node2.nodes.map((i) => i.toProxy());
|
|
1100
|
+
} else if (prop === "first" || prop === "last") {
|
|
1101
|
+
return node2[prop].toProxy();
|
|
1102
|
+
} else {
|
|
1103
|
+
return node2[prop];
|
|
1104
|
+
}
|
|
1105
|
+
},
|
|
1106
|
+
set(node2, prop, value) {
|
|
1107
|
+
if (node2[prop] === value)
|
|
1108
|
+
return true;
|
|
1109
|
+
node2[prop] = value;
|
|
1110
|
+
if (prop === "name" || prop === "params" || prop === "selector") {
|
|
1111
|
+
node2.markDirty();
|
|
1112
|
+
}
|
|
1113
|
+
return true;
|
|
1106
1114
|
}
|
|
1107
|
-
}
|
|
1108
|
-
if (!this.file) {
|
|
1109
|
-
this.id = "<input css " + nanoid(6) + ">";
|
|
1110
|
-
}
|
|
1111
|
-
if (this.map)
|
|
1112
|
-
this.map.file = this.from;
|
|
1115
|
+
};
|
|
1113
1116
|
}
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
endLine = end.line;
|
|
1133
|
-
endColumn = end.column;
|
|
1117
|
+
index(child) {
|
|
1118
|
+
if (typeof child === "number")
|
|
1119
|
+
return child;
|
|
1120
|
+
if (child.proxyOf)
|
|
1121
|
+
child = child.proxyOf;
|
|
1122
|
+
return this.proxyOf.nodes.indexOf(child);
|
|
1123
|
+
}
|
|
1124
|
+
insertAfter(exist, add) {
|
|
1125
|
+
let existIndex = this.index(exist);
|
|
1126
|
+
let nodes = this.normalize(add, this.proxyOf.nodes[existIndex]).reverse();
|
|
1127
|
+
existIndex = this.index(exist);
|
|
1128
|
+
for (let node2 of nodes)
|
|
1129
|
+
this.proxyOf.nodes.splice(existIndex + 1, 0, node2);
|
|
1130
|
+
let index2;
|
|
1131
|
+
for (let id in this.indexes) {
|
|
1132
|
+
index2 = this.indexes[id];
|
|
1133
|
+
if (existIndex < index2) {
|
|
1134
|
+
this.indexes[id] = index2 + nodes.length;
|
|
1134
1135
|
}
|
|
1135
|
-
} else if (!column) {
|
|
1136
|
-
let pos = this.fromOffset(line);
|
|
1137
|
-
line = pos.line;
|
|
1138
|
-
column = pos.col;
|
|
1139
|
-
}
|
|
1140
|
-
let origin = this.origin(line, column, endLine, endColumn);
|
|
1141
|
-
if (origin) {
|
|
1142
|
-
result2 = new CssSyntaxError$1(
|
|
1143
|
-
message,
|
|
1144
|
-
origin.endLine === void 0 ? origin.line : { column: origin.column, line: origin.line },
|
|
1145
|
-
origin.endLine === void 0 ? origin.column : { column: origin.endColumn, line: origin.endLine },
|
|
1146
|
-
origin.source,
|
|
1147
|
-
origin.file,
|
|
1148
|
-
opts.plugin
|
|
1149
|
-
);
|
|
1150
|
-
} else {
|
|
1151
|
-
result2 = new CssSyntaxError$1(
|
|
1152
|
-
message,
|
|
1153
|
-
endLine === void 0 ? line : { column, line },
|
|
1154
|
-
endLine === void 0 ? column : { column: endColumn, line: endLine },
|
|
1155
|
-
this.css,
|
|
1156
|
-
this.file,
|
|
1157
|
-
opts.plugin
|
|
1158
|
-
);
|
|
1159
1136
|
}
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1137
|
+
this.markDirty();
|
|
1138
|
+
return this;
|
|
1139
|
+
}
|
|
1140
|
+
insertBefore(exist, add) {
|
|
1141
|
+
let existIndex = this.index(exist);
|
|
1142
|
+
let type = existIndex === 0 ? "prepend" : false;
|
|
1143
|
+
let nodes = this.normalize(
|
|
1144
|
+
add,
|
|
1145
|
+
this.proxyOf.nodes[existIndex],
|
|
1146
|
+
type
|
|
1147
|
+
).reverse();
|
|
1148
|
+
existIndex = this.index(exist);
|
|
1149
|
+
for (let node2 of nodes)
|
|
1150
|
+
this.proxyOf.nodes.splice(existIndex, 0, node2);
|
|
1151
|
+
let index2;
|
|
1152
|
+
for (let id in this.indexes) {
|
|
1153
|
+
index2 = this.indexes[id];
|
|
1154
|
+
if (existIndex <= index2) {
|
|
1155
|
+
this.indexes[id] = index2 + nodes.length;
|
|
1164
1156
|
}
|
|
1165
|
-
result2.input.file = this.file;
|
|
1166
1157
|
}
|
|
1167
|
-
|
|
1158
|
+
this.markDirty();
|
|
1159
|
+
return this;
|
|
1168
1160
|
}
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1161
|
+
normalize(nodes, sample) {
|
|
1162
|
+
if (typeof nodes === "string") {
|
|
1163
|
+
nodes = cleanSource(parse$4(nodes).nodes);
|
|
1164
|
+
} else if (typeof nodes === "undefined") {
|
|
1165
|
+
nodes = [];
|
|
1166
|
+
} else if (Array.isArray(nodes)) {
|
|
1167
|
+
nodes = nodes.slice(0);
|
|
1168
|
+
for (let i of nodes) {
|
|
1169
|
+
if (i.parent)
|
|
1170
|
+
i.parent.removeChild(i, "ignore");
|
|
1171
|
+
}
|
|
1172
|
+
} else if (nodes.type === "root" && this.type !== "document") {
|
|
1173
|
+
nodes = nodes.nodes.slice(0);
|
|
1174
|
+
for (let i of nodes) {
|
|
1175
|
+
if (i.parent)
|
|
1176
|
+
i.parent.removeChild(i, "ignore");
|
|
1177
|
+
}
|
|
1178
|
+
} else if (nodes.type) {
|
|
1179
|
+
nodes = [nodes];
|
|
1180
|
+
} else if (nodes.prop) {
|
|
1181
|
+
if (typeof nodes.value === "undefined") {
|
|
1182
|
+
throw new Error("Value field is missed in node creation");
|
|
1183
|
+
} else if (typeof nodes.value !== "string") {
|
|
1184
|
+
nodes.value = String(nodes.value);
|
|
1178
1185
|
}
|
|
1179
|
-
|
|
1186
|
+
nodes = [new Declaration$3(nodes)];
|
|
1187
|
+
} else if (nodes.selector || nodes.selectors) {
|
|
1188
|
+
nodes = [new Rule$4(nodes)];
|
|
1189
|
+
} else if (nodes.name) {
|
|
1190
|
+
nodes = [new AtRule$4(nodes)];
|
|
1191
|
+
} else if (nodes.text) {
|
|
1192
|
+
nodes = [new Comment$3(nodes)];
|
|
1180
1193
|
} else {
|
|
1181
|
-
|
|
1194
|
+
throw new Error("Unknown node type in node creation");
|
|
1182
1195
|
}
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
} else {
|
|
1197
|
-
min = mid;
|
|
1198
|
-
break;
|
|
1196
|
+
let processed = nodes.map((i) => {
|
|
1197
|
+
if (!i[my$1])
|
|
1198
|
+
Container.rebuild(i);
|
|
1199
|
+
i = i.proxyOf;
|
|
1200
|
+
if (i.parent)
|
|
1201
|
+
i.parent.removeChild(i);
|
|
1202
|
+
if (i[isClean$1])
|
|
1203
|
+
markTreeDirty(i);
|
|
1204
|
+
if (!i.raws)
|
|
1205
|
+
i.raws = {};
|
|
1206
|
+
if (typeof i.raws.before === "undefined") {
|
|
1207
|
+
if (sample && typeof sample.raws.before !== "undefined") {
|
|
1208
|
+
i.raws.before = sample.raws.before.replace(/\S/g, "");
|
|
1199
1209
|
}
|
|
1200
1210
|
}
|
|
1211
|
+
i.parent = this.proxyOf;
|
|
1212
|
+
return i;
|
|
1213
|
+
});
|
|
1214
|
+
return processed;
|
|
1215
|
+
}
|
|
1216
|
+
prepend(...children) {
|
|
1217
|
+
children = children.reverse();
|
|
1218
|
+
for (let child of children) {
|
|
1219
|
+
let nodes = this.normalize(child, this.first, "prepend").reverse();
|
|
1220
|
+
for (let node2 of nodes)
|
|
1221
|
+
this.proxyOf.nodes.unshift(node2);
|
|
1222
|
+
for (let id in this.indexes) {
|
|
1223
|
+
this.indexes[id] = this.indexes[id] + nodes.length;
|
|
1224
|
+
}
|
|
1201
1225
|
}
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
line: min + 1
|
|
1205
|
-
};
|
|
1226
|
+
this.markDirty();
|
|
1227
|
+
return this;
|
|
1206
1228
|
}
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1229
|
+
push(child) {
|
|
1230
|
+
child.parent = this;
|
|
1231
|
+
this.proxyOf.nodes.push(child);
|
|
1232
|
+
return this;
|
|
1233
|
+
}
|
|
1234
|
+
removeAll() {
|
|
1235
|
+
for (let node2 of this.proxyOf.nodes)
|
|
1236
|
+
node2.parent = void 0;
|
|
1237
|
+
this.proxyOf.nodes = [];
|
|
1238
|
+
this.markDirty();
|
|
1239
|
+
return this;
|
|
1240
|
+
}
|
|
1241
|
+
removeChild(child) {
|
|
1242
|
+
child = this.index(child);
|
|
1243
|
+
this.proxyOf.nodes[child].parent = void 0;
|
|
1244
|
+
this.proxyOf.nodes.splice(child, 1);
|
|
1245
|
+
let index2;
|
|
1246
|
+
for (let id in this.indexes) {
|
|
1247
|
+
index2 = this.indexes[id];
|
|
1248
|
+
if (index2 >= child) {
|
|
1249
|
+
this.indexes[id] = index2 - 1;
|
|
1250
|
+
}
|
|
1210
1251
|
}
|
|
1211
|
-
|
|
1252
|
+
this.markDirty();
|
|
1253
|
+
return this;
|
|
1212
1254
|
}
|
|
1213
|
-
|
|
1214
|
-
if (!
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
let from = consumer.originalPositionFor({ column, line });
|
|
1218
|
-
if (!from.source)
|
|
1219
|
-
return false;
|
|
1220
|
-
let to;
|
|
1221
|
-
if (typeof endLine === "number") {
|
|
1222
|
-
to = consumer.originalPositionFor({ column: endColumn, line: endLine });
|
|
1255
|
+
replaceValues(pattern, opts, callback) {
|
|
1256
|
+
if (!callback) {
|
|
1257
|
+
callback = opts;
|
|
1258
|
+
opts = {};
|
|
1223
1259
|
}
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
let result2 = {
|
|
1234
|
-
column: from.column,
|
|
1235
|
-
endColumn: to && to.column,
|
|
1236
|
-
endLine: to && to.line,
|
|
1237
|
-
line: from.line,
|
|
1238
|
-
url: fromUrl.toString()
|
|
1239
|
-
};
|
|
1240
|
-
if (fromUrl.protocol === "file:") {
|
|
1241
|
-
if (fileURLToPath) {
|
|
1242
|
-
result2.file = fileURLToPath(fromUrl);
|
|
1243
|
-
} else {
|
|
1244
|
-
throw new Error(`file: protocol is not available in this PostCSS build`);
|
|
1245
|
-
}
|
|
1246
|
-
}
|
|
1247
|
-
let source = consumer.sourceContentFor(from.source);
|
|
1248
|
-
if (source)
|
|
1249
|
-
result2.source = source;
|
|
1250
|
-
return result2;
|
|
1260
|
+
this.walkDecls((decl) => {
|
|
1261
|
+
if (opts.props && !opts.props.includes(decl.prop))
|
|
1262
|
+
return;
|
|
1263
|
+
if (opts.fast && !decl.value.includes(opts.fast))
|
|
1264
|
+
return;
|
|
1265
|
+
decl.value = decl.value.replace(pattern, callback);
|
|
1266
|
+
});
|
|
1267
|
+
this.markDirty();
|
|
1268
|
+
return this;
|
|
1251
1269
|
}
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1270
|
+
some(condition) {
|
|
1271
|
+
return this.nodes.some(condition);
|
|
1272
|
+
}
|
|
1273
|
+
walk(callback) {
|
|
1274
|
+
return this.each((child, i) => {
|
|
1275
|
+
let result2;
|
|
1276
|
+
try {
|
|
1277
|
+
result2 = callback(child, i);
|
|
1278
|
+
} catch (e) {
|
|
1279
|
+
throw child.addToError(e);
|
|
1257
1280
|
}
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
json.map = __spreadValues({}, this.map);
|
|
1261
|
-
if (json.map.consumerCache) {
|
|
1262
|
-
json.map.consumerCache = void 0;
|
|
1281
|
+
if (result2 !== false && child.walk) {
|
|
1282
|
+
result2 = child.walk(callback);
|
|
1263
1283
|
}
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
}
|
|
1267
|
-
get from() {
|
|
1268
|
-
return this.file || this.id;
|
|
1269
|
-
}
|
|
1270
|
-
};
|
|
1271
|
-
var input = Input$4;
|
|
1272
|
-
Input$4.default = Input$4;
|
|
1273
|
-
if (terminalHighlight && terminalHighlight.registerInput) {
|
|
1274
|
-
terminalHighlight.registerInput(Input$4);
|
|
1275
|
-
}
|
|
1276
|
-
let { SourceMapConsumer, SourceMapGenerator } = require$$2;
|
|
1277
|
-
let { dirname, relative, resolve, sep } = require$$2;
|
|
1278
|
-
let { pathToFileURL } = require$$2;
|
|
1279
|
-
let Input$3 = input;
|
|
1280
|
-
let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);
|
|
1281
|
-
let pathAvailable = Boolean(dirname && resolve && relative && sep);
|
|
1282
|
-
let MapGenerator$2 = class MapGenerator {
|
|
1283
|
-
constructor(stringify2, root2, opts, cssString) {
|
|
1284
|
-
this.stringify = stringify2;
|
|
1285
|
-
this.mapOpts = opts.map || {};
|
|
1286
|
-
this.root = root2;
|
|
1287
|
-
this.opts = opts;
|
|
1288
|
-
this.css = cssString;
|
|
1289
|
-
this.originalCSS = cssString;
|
|
1290
|
-
this.usesFileUrls = !this.mapOpts.from && this.mapOpts.absolute;
|
|
1291
|
-
this.memoizedFileURLs = /* @__PURE__ */ new Map();
|
|
1292
|
-
this.memoizedPaths = /* @__PURE__ */ new Map();
|
|
1293
|
-
this.memoizedURLs = /* @__PURE__ */ new Map();
|
|
1284
|
+
return result2;
|
|
1285
|
+
});
|
|
1294
1286
|
}
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
} else {
|
|
1304
|
-
content = this.outputFile() + ".map";
|
|
1287
|
+
walkAtRules(name, callback) {
|
|
1288
|
+
if (!callback) {
|
|
1289
|
+
callback = name;
|
|
1290
|
+
return this.walk((child, i) => {
|
|
1291
|
+
if (child.type === "atrule") {
|
|
1292
|
+
return callback(child, i);
|
|
1293
|
+
}
|
|
1294
|
+
});
|
|
1305
1295
|
}
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
}
|
|
1311
|
-
applyPrevMaps() {
|
|
1312
|
-
for (let prev of this.previous()) {
|
|
1313
|
-
let from = this.toUrl(this.path(prev.file));
|
|
1314
|
-
let root2 = prev.root || dirname(prev.file);
|
|
1315
|
-
let map;
|
|
1316
|
-
if (this.mapOpts.sourcesContent === false) {
|
|
1317
|
-
map = new SourceMapConsumer(prev.text);
|
|
1318
|
-
if (map.sourcesContent) {
|
|
1319
|
-
map.sourcesContent = null;
|
|
1296
|
+
if (name instanceof RegExp) {
|
|
1297
|
+
return this.walk((child, i) => {
|
|
1298
|
+
if (child.type === "atrule" && name.test(child.name)) {
|
|
1299
|
+
return callback(child, i);
|
|
1320
1300
|
}
|
|
1321
|
-
}
|
|
1322
|
-
map = prev.consumer();
|
|
1323
|
-
}
|
|
1324
|
-
this.map.applySourceMap(map, from, this.toUrl(this.path(root2)));
|
|
1301
|
+
});
|
|
1325
1302
|
}
|
|
1303
|
+
return this.walk((child, i) => {
|
|
1304
|
+
if (child.type === "atrule" && child.name === name) {
|
|
1305
|
+
return callback(child, i);
|
|
1306
|
+
}
|
|
1307
|
+
});
|
|
1326
1308
|
}
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
let node2;
|
|
1332
|
-
for (let i = this.root.nodes.length - 1; i >= 0; i--) {
|
|
1333
|
-
node2 = this.root.nodes[i];
|
|
1334
|
-
if (node2.type !== "comment")
|
|
1335
|
-
continue;
|
|
1336
|
-
if (node2.text.indexOf("# sourceMappingURL=") === 0) {
|
|
1337
|
-
this.root.removeChild(i);
|
|
1338
|
-
}
|
|
1309
|
+
walkComments(callback) {
|
|
1310
|
+
return this.walk((child, i) => {
|
|
1311
|
+
if (child.type === "comment") {
|
|
1312
|
+
return callback(child, i);
|
|
1339
1313
|
}
|
|
1340
|
-
}
|
|
1341
|
-
this.css = this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm, "");
|
|
1342
|
-
}
|
|
1314
|
+
});
|
|
1343
1315
|
}
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
return this.
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
result2 += i;
|
|
1316
|
+
walkDecls(prop, callback) {
|
|
1317
|
+
if (!callback) {
|
|
1318
|
+
callback = prop;
|
|
1319
|
+
return this.walk((child, i) => {
|
|
1320
|
+
if (child.type === "decl") {
|
|
1321
|
+
return callback(child, i);
|
|
1322
|
+
}
|
|
1352
1323
|
});
|
|
1353
|
-
return [result2];
|
|
1354
1324
|
}
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
let prev = this.previous()[0].consumer();
|
|
1361
|
-
prev.file = this.outputFile();
|
|
1362
|
-
this.map = SourceMapGenerator.fromSourceMap(prev, {
|
|
1363
|
-
ignoreInvalidMapping: true
|
|
1364
|
-
});
|
|
1365
|
-
} else {
|
|
1366
|
-
this.map = new SourceMapGenerator({
|
|
1367
|
-
file: this.outputFile(),
|
|
1368
|
-
ignoreInvalidMapping: true
|
|
1369
|
-
});
|
|
1370
|
-
this.map.addMapping({
|
|
1371
|
-
generated: { column: 0, line: 1 },
|
|
1372
|
-
original: { column: 0, line: 1 },
|
|
1373
|
-
source: this.opts.from ? this.toUrl(this.path(this.opts.from)) : "<no source>"
|
|
1325
|
+
if (prop instanceof RegExp) {
|
|
1326
|
+
return this.walk((child, i) => {
|
|
1327
|
+
if (child.type === "decl" && prop.test(child.prop)) {
|
|
1328
|
+
return callback(child, i);
|
|
1329
|
+
}
|
|
1374
1330
|
});
|
|
1375
1331
|
}
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
if (this.isAnnotation())
|
|
1381
|
-
this.addAnnotation();
|
|
1382
|
-
if (this.isInline()) {
|
|
1383
|
-
return [this.css];
|
|
1384
|
-
} else {
|
|
1385
|
-
return [this.css, this.map];
|
|
1386
|
-
}
|
|
1387
|
-
}
|
|
1388
|
-
generateString() {
|
|
1389
|
-
this.css = "";
|
|
1390
|
-
this.map = new SourceMapGenerator({
|
|
1391
|
-
file: this.outputFile(),
|
|
1392
|
-
ignoreInvalidMapping: true
|
|
1332
|
+
return this.walk((child, i) => {
|
|
1333
|
+
if (child.type === "decl" && child.prop === prop) {
|
|
1334
|
+
return callback(child, i);
|
|
1335
|
+
}
|
|
1393
1336
|
});
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
if (node2.source && node2.source.start) {
|
|
1409
|
-
mapping.source = this.sourcePath(node2);
|
|
1410
|
-
mapping.original.line = node2.source.start.line;
|
|
1411
|
-
mapping.original.column = node2.source.start.column - 1;
|
|
1412
|
-
this.map.addMapping(mapping);
|
|
1413
|
-
} else {
|
|
1414
|
-
mapping.source = noSource;
|
|
1415
|
-
mapping.original.line = 1;
|
|
1416
|
-
mapping.original.column = 0;
|
|
1417
|
-
this.map.addMapping(mapping);
|
|
1418
|
-
}
|
|
1419
|
-
}
|
|
1420
|
-
lines = str.match(/\n/g);
|
|
1421
|
-
if (lines) {
|
|
1422
|
-
line += lines.length;
|
|
1423
|
-
last = str.lastIndexOf("\n");
|
|
1424
|
-
column = str.length - last;
|
|
1425
|
-
} else {
|
|
1426
|
-
column += str.length;
|
|
1427
|
-
}
|
|
1428
|
-
if (node2 && type !== "start") {
|
|
1429
|
-
let p = node2.parent || { raws: {} };
|
|
1430
|
-
let childless = node2.type === "decl" || node2.type === "atrule" && !node2.nodes;
|
|
1431
|
-
if (!childless || node2 !== p.last || p.raws.semicolon) {
|
|
1432
|
-
if (node2.source && node2.source.end) {
|
|
1433
|
-
mapping.source = this.sourcePath(node2);
|
|
1434
|
-
mapping.original.line = node2.source.end.line;
|
|
1435
|
-
mapping.original.column = node2.source.end.column - 1;
|
|
1436
|
-
mapping.generated.line = line;
|
|
1437
|
-
mapping.generated.column = column - 2;
|
|
1438
|
-
this.map.addMapping(mapping);
|
|
1439
|
-
} else {
|
|
1440
|
-
mapping.source = noSource;
|
|
1441
|
-
mapping.original.line = 1;
|
|
1442
|
-
mapping.original.column = 0;
|
|
1443
|
-
mapping.generated.line = line;
|
|
1444
|
-
mapping.generated.column = column - 1;
|
|
1445
|
-
this.map.addMapping(mapping);
|
|
1446
|
-
}
|
|
1337
|
+
}
|
|
1338
|
+
walkRules(selector, callback) {
|
|
1339
|
+
if (!callback) {
|
|
1340
|
+
callback = selector;
|
|
1341
|
+
return this.walk((child, i) => {
|
|
1342
|
+
if (child.type === "rule") {
|
|
1343
|
+
return callback(child, i);
|
|
1344
|
+
}
|
|
1345
|
+
});
|
|
1346
|
+
}
|
|
1347
|
+
if (selector instanceof RegExp) {
|
|
1348
|
+
return this.walk((child, i) => {
|
|
1349
|
+
if (child.type === "rule" && selector.test(child.selector)) {
|
|
1350
|
+
return callback(child, i);
|
|
1447
1351
|
}
|
|
1352
|
+
});
|
|
1353
|
+
}
|
|
1354
|
+
return this.walk((child, i) => {
|
|
1355
|
+
if (child.type === "rule" && child.selector === selector) {
|
|
1356
|
+
return callback(child, i);
|
|
1448
1357
|
}
|
|
1449
1358
|
});
|
|
1450
1359
|
}
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1360
|
+
};
|
|
1361
|
+
Container$7.registerParse = (dependant) => {
|
|
1362
|
+
parse$4 = dependant;
|
|
1363
|
+
};
|
|
1364
|
+
Container$7.registerRule = (dependant) => {
|
|
1365
|
+
Rule$4 = dependant;
|
|
1366
|
+
};
|
|
1367
|
+
Container$7.registerAtRule = (dependant) => {
|
|
1368
|
+
AtRule$4 = dependant;
|
|
1369
|
+
};
|
|
1370
|
+
Container$7.registerRoot = (dependant) => {
|
|
1371
|
+
Root$6 = dependant;
|
|
1372
|
+
};
|
|
1373
|
+
var container = Container$7;
|
|
1374
|
+
Container$7.default = Container$7;
|
|
1375
|
+
Container$7.rebuild = (node2) => {
|
|
1376
|
+
if (node2.type === "atrule") {
|
|
1377
|
+
Object.setPrototypeOf(node2, AtRule$4.prototype);
|
|
1378
|
+
} else if (node2.type === "rule") {
|
|
1379
|
+
Object.setPrototypeOf(node2, Rule$4.prototype);
|
|
1380
|
+
} else if (node2.type === "decl") {
|
|
1381
|
+
Object.setPrototypeOf(node2, Declaration$3.prototype);
|
|
1382
|
+
} else if (node2.type === "comment") {
|
|
1383
|
+
Object.setPrototypeOf(node2, Comment$3.prototype);
|
|
1384
|
+
} else if (node2.type === "root") {
|
|
1385
|
+
Object.setPrototypeOf(node2, Root$6.prototype);
|
|
1462
1386
|
}
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1387
|
+
node2[my$1] = true;
|
|
1388
|
+
if (node2.nodes) {
|
|
1389
|
+
node2.nodes.forEach((child) => {
|
|
1390
|
+
Container$7.rebuild(child);
|
|
1391
|
+
});
|
|
1392
|
+
}
|
|
1393
|
+
};
|
|
1394
|
+
let Container$6 = container;
|
|
1395
|
+
let AtRule$3 = class AtRule extends Container$6 {
|
|
1396
|
+
constructor(defaults) {
|
|
1397
|
+
super(defaults);
|
|
1398
|
+
this.type = "atrule";
|
|
1399
|
+
}
|
|
1400
|
+
append(...children) {
|
|
1401
|
+
if (!this.proxyOf.nodes)
|
|
1402
|
+
this.nodes = [];
|
|
1403
|
+
return super.append(...children);
|
|
1404
|
+
}
|
|
1405
|
+
prepend(...children) {
|
|
1406
|
+
if (!this.proxyOf.nodes)
|
|
1407
|
+
this.nodes = [];
|
|
1408
|
+
return super.prepend(...children);
|
|
1409
|
+
}
|
|
1410
|
+
};
|
|
1411
|
+
var atRule = AtRule$3;
|
|
1412
|
+
AtRule$3.default = AtRule$3;
|
|
1413
|
+
Container$6.registerAtRule(AtRule$3);
|
|
1414
|
+
let Container$5 = container;
|
|
1415
|
+
let LazyResult$4;
|
|
1416
|
+
let Processor$3;
|
|
1417
|
+
let Document$4 = class Document2 extends Container$5 {
|
|
1418
|
+
constructor(defaults) {
|
|
1419
|
+
super(__spreadValues({ type: "document" }, defaults));
|
|
1420
|
+
if (!this.nodes) {
|
|
1421
|
+
this.nodes = [];
|
|
1470
1422
|
}
|
|
1471
|
-
|
|
1472
|
-
|
|
1423
|
+
}
|
|
1424
|
+
toResult(opts = {}) {
|
|
1425
|
+
let lazy = new LazyResult$4(new Processor$3(), this, opts);
|
|
1426
|
+
return lazy.stringify();
|
|
1427
|
+
}
|
|
1428
|
+
};
|
|
1429
|
+
Document$4.registerLazyResult = (dependant) => {
|
|
1430
|
+
LazyResult$4 = dependant;
|
|
1431
|
+
};
|
|
1432
|
+
Document$4.registerProcessor = (dependant) => {
|
|
1433
|
+
Processor$3 = dependant;
|
|
1434
|
+
};
|
|
1435
|
+
var document$1 = Document$4;
|
|
1436
|
+
Document$4.default = Document$4;
|
|
1437
|
+
let urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
1438
|
+
let nanoid$1 = (size = 21) => {
|
|
1439
|
+
let id = "";
|
|
1440
|
+
let i = size | 0;
|
|
1441
|
+
while (i--) {
|
|
1442
|
+
id += urlAlphabet[Math.random() * 64 | 0];
|
|
1443
|
+
}
|
|
1444
|
+
return id;
|
|
1445
|
+
};
|
|
1446
|
+
var nonSecure = { nanoid: nanoid$1 };
|
|
1447
|
+
let { existsSync, readFileSync } = require$$2;
|
|
1448
|
+
let { dirname: dirname$1, join } = require$$2;
|
|
1449
|
+
let { SourceMapConsumer: SourceMapConsumer$2, SourceMapGenerator: SourceMapGenerator$2 } = require$$2;
|
|
1450
|
+
function fromBase64(str) {
|
|
1451
|
+
if (Buffer) {
|
|
1452
|
+
return Buffer.from(str, "base64").toString();
|
|
1453
|
+
} else {
|
|
1454
|
+
return window.atob(str);
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1457
|
+
let PreviousMap$2 = class PreviousMap {
|
|
1458
|
+
constructor(css, opts) {
|
|
1459
|
+
if (opts.map === false)
|
|
1460
|
+
return;
|
|
1461
|
+
this.loadAnnotation(css);
|
|
1462
|
+
this.inline = this.startWith(this.annotation, "data:");
|
|
1463
|
+
let prev = opts.map ? opts.map.prev : void 0;
|
|
1464
|
+
let text = this.loadMap(opts.from, prev);
|
|
1465
|
+
if (!this.mapFile && opts.from) {
|
|
1466
|
+
this.mapFile = opts.from;
|
|
1473
1467
|
}
|
|
1474
|
-
|
|
1468
|
+
if (this.mapFile)
|
|
1469
|
+
this.root = dirname$1(this.mapFile);
|
|
1470
|
+
if (text)
|
|
1471
|
+
this.text = text;
|
|
1475
1472
|
}
|
|
1476
|
-
|
|
1477
|
-
if (
|
|
1478
|
-
|
|
1473
|
+
consumer() {
|
|
1474
|
+
if (!this.consumerCache) {
|
|
1475
|
+
this.consumerCache = new SourceMapConsumer$2(this.text);
|
|
1479
1476
|
}
|
|
1480
|
-
return this.
|
|
1477
|
+
return this.consumerCache;
|
|
1481
1478
|
}
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1479
|
+
decodeInline(text) {
|
|
1480
|
+
let baseCharsetUri = /^data:application\/json;charset=utf-?8;base64,/;
|
|
1481
|
+
let baseUri = /^data:application\/json;base64,/;
|
|
1482
|
+
let charsetUri = /^data:application\/json;charset=utf-?8,/;
|
|
1483
|
+
let uri = /^data:application\/json,/;
|
|
1484
|
+
let uriMatch = text.match(charsetUri) || text.match(uri);
|
|
1485
|
+
if (uriMatch) {
|
|
1486
|
+
return decodeURIComponent(text.substr(uriMatch[0].length));
|
|
1485
1487
|
}
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
+
let baseUriMatch = text.match(baseCharsetUri) || text.match(baseUri);
|
|
1489
|
+
if (baseUriMatch) {
|
|
1490
|
+
return fromBase64(text.substr(baseUriMatch[0].length));
|
|
1488
1491
|
}
|
|
1489
|
-
|
|
1492
|
+
let encoding = text.match(/data:application\/json;([^,]+),/)[1];
|
|
1493
|
+
throw new Error("Unsupported source map encoding " + encoding);
|
|
1490
1494
|
}
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
return this.path(this.opts.to);
|
|
1494
|
-
} else if (this.opts.from) {
|
|
1495
|
-
return this.path(this.opts.from);
|
|
1496
|
-
} else {
|
|
1497
|
-
return "to.css";
|
|
1498
|
-
}
|
|
1495
|
+
getAnnotationURL(sourceMapString) {
|
|
1496
|
+
return sourceMapString.replace(/^\/\*\s*# sourceMappingURL=/, "").trim();
|
|
1499
1497
|
}
|
|
1500
|
-
|
|
1501
|
-
if (
|
|
1502
|
-
return
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
let
|
|
1511
|
-
if (
|
|
1512
|
-
|
|
1498
|
+
isMap(map) {
|
|
1499
|
+
if (typeof map !== "object")
|
|
1500
|
+
return false;
|
|
1501
|
+
return typeof map.mappings === "string" || typeof map._mappings === "string" || Array.isArray(map.sections);
|
|
1502
|
+
}
|
|
1503
|
+
loadAnnotation(css) {
|
|
1504
|
+
let comments = css.match(/\/\*\s*# sourceMappingURL=/g);
|
|
1505
|
+
if (!comments)
|
|
1506
|
+
return;
|
|
1507
|
+
let start = css.lastIndexOf(comments.pop());
|
|
1508
|
+
let end = css.indexOf("*/", start);
|
|
1509
|
+
if (start > -1 && end > -1) {
|
|
1510
|
+
this.annotation = this.getAnnotationURL(css.substring(start, end));
|
|
1513
1511
|
}
|
|
1514
|
-
let path = relative(from, file);
|
|
1515
|
-
this.memoizedPaths.set(file, path);
|
|
1516
|
-
return path;
|
|
1517
1512
|
}
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
if (node2.source && node2.source.input.map) {
|
|
1524
|
-
let map = node2.source.input.map;
|
|
1525
|
-
if (!this.previousMaps.includes(map)) {
|
|
1526
|
-
this.previousMaps.push(map);
|
|
1527
|
-
}
|
|
1528
|
-
}
|
|
1529
|
-
});
|
|
1530
|
-
} else {
|
|
1531
|
-
let input2 = new Input$3(this.originalCSS, this.opts);
|
|
1532
|
-
if (input2.map)
|
|
1533
|
-
this.previousMaps.push(input2.map);
|
|
1534
|
-
}
|
|
1513
|
+
loadFile(path) {
|
|
1514
|
+
this.root = dirname$1(path);
|
|
1515
|
+
if (existsSync(path)) {
|
|
1516
|
+
this.mapFile = path;
|
|
1517
|
+
return readFileSync(path, "utf-8").toString().trim();
|
|
1535
1518
|
}
|
|
1536
|
-
return this.previousMaps;
|
|
1537
1519
|
}
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1520
|
+
loadMap(file, prev) {
|
|
1521
|
+
if (prev === false)
|
|
1522
|
+
return false;
|
|
1523
|
+
if (prev) {
|
|
1524
|
+
if (typeof prev === "string") {
|
|
1525
|
+
return prev;
|
|
1526
|
+
} else if (typeof prev === "function") {
|
|
1527
|
+
let prevPath = prev(file);
|
|
1528
|
+
if (prevPath) {
|
|
1529
|
+
let map = this.loadFile(prevPath);
|
|
1530
|
+
if (!map) {
|
|
1531
|
+
throw new Error(
|
|
1532
|
+
"Unable to load previous source map: " + prevPath.toString()
|
|
1533
|
+
);
|
|
1548
1534
|
}
|
|
1535
|
+
return map;
|
|
1549
1536
|
}
|
|
1550
|
-
})
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1537
|
+
} else if (prev instanceof SourceMapConsumer$2) {
|
|
1538
|
+
return SourceMapGenerator$2.fromSourceMap(prev).toString();
|
|
1539
|
+
} else if (prev instanceof SourceMapGenerator$2) {
|
|
1540
|
+
return prev.toString();
|
|
1541
|
+
} else if (this.isMap(prev)) {
|
|
1542
|
+
return JSON.stringify(prev);
|
|
1543
|
+
} else {
|
|
1544
|
+
throw new Error(
|
|
1545
|
+
"Unsupported previous source map format: " + prev.toString()
|
|
1546
|
+
);
|
|
1547
|
+
}
|
|
1548
|
+
} else if (this.inline) {
|
|
1549
|
+
return this.decodeInline(this.annotation);
|
|
1550
|
+
} else if (this.annotation) {
|
|
1551
|
+
let map = this.annotation;
|
|
1552
|
+
if (file)
|
|
1553
|
+
map = join(dirname$1(file), map);
|
|
1554
|
+
return this.loadFile(map);
|
|
1554
1555
|
}
|
|
1555
1556
|
}
|
|
1556
|
-
|
|
1557
|
-
if (
|
|
1558
|
-
return
|
|
1559
|
-
|
|
1560
|
-
|
|
1557
|
+
startWith(string, start) {
|
|
1558
|
+
if (!string)
|
|
1559
|
+
return false;
|
|
1560
|
+
return string.substr(0, start.length) === start;
|
|
1561
|
+
}
|
|
1562
|
+
withContent() {
|
|
1563
|
+
return !!(this.consumer().sourcesContent && this.consumer().sourcesContent.length > 0);
|
|
1564
|
+
}
|
|
1565
|
+
};
|
|
1566
|
+
var previousMap = PreviousMap$2;
|
|
1567
|
+
PreviousMap$2.default = PreviousMap$2;
|
|
1568
|
+
let { nanoid } = nonSecure;
|
|
1569
|
+
let { isAbsolute, resolve: resolve$1 } = require$$2;
|
|
1570
|
+
let { SourceMapConsumer: SourceMapConsumer$1, SourceMapGenerator: SourceMapGenerator$1 } = require$$2;
|
|
1571
|
+
let { fileURLToPath, pathToFileURL: pathToFileURL$1 } = require$$2;
|
|
1572
|
+
let CssSyntaxError$1 = cssSyntaxError;
|
|
1573
|
+
let PreviousMap$1 = previousMap;
|
|
1574
|
+
let terminalHighlight = require$$2;
|
|
1575
|
+
let lineToIndexCache = Symbol("lineToIndexCache");
|
|
1576
|
+
let sourceMapAvailable$1 = Boolean(SourceMapConsumer$1 && SourceMapGenerator$1);
|
|
1577
|
+
let pathAvailable$1 = Boolean(resolve$1 && isAbsolute);
|
|
1578
|
+
function getLineToIndex(input2) {
|
|
1579
|
+
if (input2[lineToIndexCache])
|
|
1580
|
+
return input2[lineToIndexCache];
|
|
1581
|
+
let lines = input2.css.split("\n");
|
|
1582
|
+
let lineToIndex = new Array(lines.length);
|
|
1583
|
+
let prevIndex = 0;
|
|
1584
|
+
for (let i = 0, l = lines.length; i < l; i++) {
|
|
1585
|
+
lineToIndex[i] = prevIndex;
|
|
1586
|
+
prevIndex += lines[i].length + 1;
|
|
1587
|
+
}
|
|
1588
|
+
input2[lineToIndexCache] = lineToIndex;
|
|
1589
|
+
return lineToIndex;
|
|
1590
|
+
}
|
|
1591
|
+
let Input$4 = class Input {
|
|
1592
|
+
get from() {
|
|
1593
|
+
return this.file || this.id;
|
|
1594
|
+
}
|
|
1595
|
+
constructor(css, opts = {}) {
|
|
1596
|
+
if (css === null || typeof css === "undefined" || typeof css === "object" && !css.toString) {
|
|
1597
|
+
throw new Error(`PostCSS received ${css} instead of CSS string`);
|
|
1598
|
+
}
|
|
1599
|
+
this.css = css.toString();
|
|
1600
|
+
if (this.css[0] === "\uFEFF" || this.css[0] === "\uFFFE") {
|
|
1601
|
+
this.hasBOM = true;
|
|
1602
|
+
this.css = this.css.slice(1);
|
|
1561
1603
|
} else {
|
|
1562
|
-
|
|
1604
|
+
this.hasBOM = false;
|
|
1605
|
+
}
|
|
1606
|
+
this.document = this.css;
|
|
1607
|
+
if (opts.document)
|
|
1608
|
+
this.document = opts.document.toString();
|
|
1609
|
+
if (opts.from) {
|
|
1610
|
+
if (!pathAvailable$1 || /^\w+:\/\//.test(opts.from) || isAbsolute(opts.from)) {
|
|
1611
|
+
this.file = opts.from;
|
|
1612
|
+
} else {
|
|
1613
|
+
this.file = resolve$1(opts.from);
|
|
1614
|
+
}
|
|
1615
|
+
}
|
|
1616
|
+
if (pathAvailable$1 && sourceMapAvailable$1) {
|
|
1617
|
+
let map = new PreviousMap$1(this.css, opts);
|
|
1618
|
+
if (map.text) {
|
|
1619
|
+
this.map = map;
|
|
1620
|
+
let file = map.consumer().file;
|
|
1621
|
+
if (!this.file && file)
|
|
1622
|
+
this.file = this.mapResolve(file);
|
|
1623
|
+
}
|
|
1563
1624
|
}
|
|
1625
|
+
if (!this.file) {
|
|
1626
|
+
this.id = "<input css " + nanoid(6) + ">";
|
|
1627
|
+
}
|
|
1628
|
+
if (this.map)
|
|
1629
|
+
this.map.file = this.from;
|
|
1564
1630
|
}
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1631
|
+
error(message, line, column, opts = {}) {
|
|
1632
|
+
let endColumn, endLine, endOffset, offset, result2;
|
|
1633
|
+
if (line && typeof line === "object") {
|
|
1634
|
+
let start = line;
|
|
1635
|
+
let end = column;
|
|
1636
|
+
if (typeof start.offset === "number") {
|
|
1637
|
+
offset = start.offset;
|
|
1638
|
+
let pos = this.fromOffset(offset);
|
|
1639
|
+
line = pos.line;
|
|
1640
|
+
column = pos.col;
|
|
1641
|
+
} else {
|
|
1642
|
+
line = start.line;
|
|
1643
|
+
column = start.column;
|
|
1644
|
+
offset = this.fromLineAndColumn(line, column);
|
|
1645
|
+
}
|
|
1646
|
+
if (typeof end.offset === "number") {
|
|
1647
|
+
endOffset = end.offset;
|
|
1648
|
+
let pos = this.fromOffset(endOffset);
|
|
1649
|
+
endLine = pos.line;
|
|
1650
|
+
endColumn = pos.col;
|
|
1651
|
+
} else {
|
|
1652
|
+
endLine = end.line;
|
|
1653
|
+
endColumn = end.column;
|
|
1654
|
+
endOffset = this.fromLineAndColumn(end.line, end.column);
|
|
1655
|
+
}
|
|
1656
|
+
} else if (!column) {
|
|
1657
|
+
offset = line;
|
|
1658
|
+
let pos = this.fromOffset(offset);
|
|
1659
|
+
line = pos.line;
|
|
1660
|
+
column = pos.col;
|
|
1568
1661
|
} else {
|
|
1569
|
-
|
|
1662
|
+
offset = this.fromLineAndColumn(line, column);
|
|
1570
1663
|
}
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1664
|
+
let origin = this.origin(line, column, endLine, endColumn);
|
|
1665
|
+
if (origin) {
|
|
1666
|
+
result2 = new CssSyntaxError$1(
|
|
1667
|
+
message,
|
|
1668
|
+
origin.endLine === void 0 ? origin.line : { column: origin.column, line: origin.line },
|
|
1669
|
+
origin.endLine === void 0 ? origin.column : { column: origin.endColumn, line: origin.endLine },
|
|
1670
|
+
origin.source,
|
|
1671
|
+
origin.file,
|
|
1672
|
+
opts.plugin
|
|
1673
|
+
);
|
|
1580
1674
|
} else {
|
|
1581
|
-
|
|
1582
|
-
|
|
1675
|
+
result2 = new CssSyntaxError$1(
|
|
1676
|
+
message,
|
|
1677
|
+
endLine === void 0 ? line : { column, line },
|
|
1678
|
+
endLine === void 0 ? column : { column: endColumn, line: endLine },
|
|
1679
|
+
this.css,
|
|
1680
|
+
this.file,
|
|
1681
|
+
opts.plugin
|
|
1583
1682
|
);
|
|
1584
1683
|
}
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
path = path.replace(/\\/g, "/");
|
|
1684
|
+
result2.input = { column, endColumn, endLine, endOffset, line, offset, source: this.css };
|
|
1685
|
+
if (this.file) {
|
|
1686
|
+
if (pathToFileURL$1) {
|
|
1687
|
+
result2.input.url = pathToFileURL$1(this.file).toString();
|
|
1688
|
+
}
|
|
1689
|
+
result2.input.file = this.file;
|
|
1592
1690
|
}
|
|
1593
|
-
|
|
1594
|
-
this.memoizedURLs.set(path, url);
|
|
1595
|
-
return url;
|
|
1691
|
+
return result2;
|
|
1596
1692
|
}
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
let
|
|
1600
|
-
|
|
1601
|
-
constructor(defaults) {
|
|
1602
|
-
super(defaults);
|
|
1603
|
-
this.type = "comment";
|
|
1693
|
+
fromLineAndColumn(line, column) {
|
|
1694
|
+
let lineToIndex = getLineToIndex(this);
|
|
1695
|
+
let index2 = lineToIndex[line - 1];
|
|
1696
|
+
return index2 + column - 1;
|
|
1604
1697
|
}
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
let
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
let
|
|
1613
|
-
let
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
}
|
|
1624
|
-
|
|
1625
|
-
node2[isClean$1] = false;
|
|
1626
|
-
if (node2.proxyOf.nodes) {
|
|
1627
|
-
for (let i of node2.proxyOf.nodes) {
|
|
1628
|
-
markDirtyUp(i);
|
|
1698
|
+
fromOffset(offset) {
|
|
1699
|
+
let lineToIndex = getLineToIndex(this);
|
|
1700
|
+
let lastLine = lineToIndex[lineToIndex.length - 1];
|
|
1701
|
+
let min = 0;
|
|
1702
|
+
if (offset >= lastLine) {
|
|
1703
|
+
min = lineToIndex.length - 1;
|
|
1704
|
+
} else {
|
|
1705
|
+
let max = lineToIndex.length - 2;
|
|
1706
|
+
let mid;
|
|
1707
|
+
while (min < max) {
|
|
1708
|
+
mid = min + (max - min >> 1);
|
|
1709
|
+
if (offset < lineToIndex[mid]) {
|
|
1710
|
+
max = mid - 1;
|
|
1711
|
+
} else if (offset >= lineToIndex[mid + 1]) {
|
|
1712
|
+
min = mid + 1;
|
|
1713
|
+
} else {
|
|
1714
|
+
min = mid;
|
|
1715
|
+
break;
|
|
1716
|
+
}
|
|
1717
|
+
}
|
|
1629
1718
|
}
|
|
1719
|
+
return {
|
|
1720
|
+
col: offset - lineToIndex[min] + 1,
|
|
1721
|
+
line: min + 1
|
|
1722
|
+
};
|
|
1630
1723
|
}
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
for (let child of children) {
|
|
1635
|
-
let nodes = this.normalize(child, this.last);
|
|
1636
|
-
for (let node2 of nodes)
|
|
1637
|
-
this.proxyOf.nodes.push(node2);
|
|
1724
|
+
mapResolve(file) {
|
|
1725
|
+
if (/^\w+:\/\//.test(file)) {
|
|
1726
|
+
return file;
|
|
1638
1727
|
}
|
|
1639
|
-
this.
|
|
1640
|
-
return this;
|
|
1728
|
+
return resolve$1(this.map.consumer().sourceRoot || this.map.root || ".", file);
|
|
1641
1729
|
}
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1730
|
+
origin(line, column, endLine, endColumn) {
|
|
1731
|
+
if (!this.map)
|
|
1732
|
+
return false;
|
|
1733
|
+
let consumer = this.map.consumer();
|
|
1734
|
+
let from = consumer.originalPositionFor({ column, line });
|
|
1735
|
+
if (!from.source)
|
|
1736
|
+
return false;
|
|
1737
|
+
let to;
|
|
1738
|
+
if (typeof endLine === "number") {
|
|
1739
|
+
to = consumer.originalPositionFor({ column: endColumn, line: endLine });
|
|
1647
1740
|
}
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
result2 = callback(this.proxyOf.nodes[index2], index2);
|
|
1657
|
-
if (result2 === false)
|
|
1658
|
-
break;
|
|
1659
|
-
this.indexes[iterator] += 1;
|
|
1741
|
+
let fromUrl;
|
|
1742
|
+
if (isAbsolute(from.source)) {
|
|
1743
|
+
fromUrl = pathToFileURL$1(from.source);
|
|
1744
|
+
} else {
|
|
1745
|
+
fromUrl = new URL(
|
|
1746
|
+
from.source,
|
|
1747
|
+
this.map.consumer().sourceRoot || pathToFileURL$1(this.map.mapFile)
|
|
1748
|
+
);
|
|
1660
1749
|
}
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
if (
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1750
|
+
let result2 = {
|
|
1751
|
+
column: from.column,
|
|
1752
|
+
endColumn: to && to.column,
|
|
1753
|
+
endLine: to && to.line,
|
|
1754
|
+
line: from.line,
|
|
1755
|
+
url: fromUrl.toString()
|
|
1756
|
+
};
|
|
1757
|
+
if (fromUrl.protocol === "file:") {
|
|
1758
|
+
if (fileURLToPath) {
|
|
1759
|
+
result2.file = fileURLToPath(fromUrl);
|
|
1760
|
+
} else {
|
|
1761
|
+
throw new Error(`file: protocol is not available in this PostCSS build`);
|
|
1762
|
+
}
|
|
1763
|
+
}
|
|
1764
|
+
let source = consumer.sourceContentFor(from.source);
|
|
1765
|
+
if (source)
|
|
1766
|
+
result2.source = source;
|
|
1767
|
+
return result2;
|
|
1676
1768
|
}
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
} else if (!node2[prop]) {
|
|
1683
|
-
return node2[prop];
|
|
1684
|
-
} else if (prop === "each" || typeof prop === "string" && prop.startsWith("walk")) {
|
|
1685
|
-
return (...args) => {
|
|
1686
|
-
return node2[prop](
|
|
1687
|
-
...args.map((i) => {
|
|
1688
|
-
if (typeof i === "function") {
|
|
1689
|
-
return (child, index2) => i(child.toProxy(), index2);
|
|
1690
|
-
} else {
|
|
1691
|
-
return i;
|
|
1692
|
-
}
|
|
1693
|
-
})
|
|
1694
|
-
);
|
|
1695
|
-
};
|
|
1696
|
-
} else if (prop === "every" || prop === "some") {
|
|
1697
|
-
return (cb) => {
|
|
1698
|
-
return node2[prop](
|
|
1699
|
-
(child, ...other) => cb(child.toProxy(), ...other)
|
|
1700
|
-
);
|
|
1701
|
-
};
|
|
1702
|
-
} else if (prop === "root") {
|
|
1703
|
-
return () => node2.root().toProxy();
|
|
1704
|
-
} else if (prop === "nodes") {
|
|
1705
|
-
return node2.nodes.map((i) => i.toProxy());
|
|
1706
|
-
} else if (prop === "first" || prop === "last") {
|
|
1707
|
-
return node2[prop].toProxy();
|
|
1708
|
-
} else {
|
|
1709
|
-
return node2[prop];
|
|
1710
|
-
}
|
|
1711
|
-
},
|
|
1712
|
-
set(node2, prop, value) {
|
|
1713
|
-
if (node2[prop] === value)
|
|
1714
|
-
return true;
|
|
1715
|
-
node2[prop] = value;
|
|
1716
|
-
if (prop === "name" || prop === "params" || prop === "selector") {
|
|
1717
|
-
node2.markDirty();
|
|
1718
|
-
}
|
|
1719
|
-
return true;
|
|
1769
|
+
toJSON() {
|
|
1770
|
+
let json = {};
|
|
1771
|
+
for (let name of ["hasBOM", "css", "file", "id"]) {
|
|
1772
|
+
if (this[name] != null) {
|
|
1773
|
+
json[name] = this[name];
|
|
1720
1774
|
}
|
|
1721
|
-
}
|
|
1775
|
+
}
|
|
1776
|
+
if (this.map) {
|
|
1777
|
+
json.map = __spreadValues({}, this.map);
|
|
1778
|
+
if (json.map.consumerCache) {
|
|
1779
|
+
json.map.consumerCache = void 0;
|
|
1780
|
+
}
|
|
1781
|
+
}
|
|
1782
|
+
return json;
|
|
1722
1783
|
}
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1784
|
+
};
|
|
1785
|
+
var input = Input$4;
|
|
1786
|
+
Input$4.default = Input$4;
|
|
1787
|
+
if (terminalHighlight && terminalHighlight.registerInput) {
|
|
1788
|
+
terminalHighlight.registerInput(Input$4);
|
|
1789
|
+
}
|
|
1790
|
+
let Container$4 = container;
|
|
1791
|
+
let LazyResult$3;
|
|
1792
|
+
let Processor$2;
|
|
1793
|
+
let Root$5 = class Root extends Container$4 {
|
|
1794
|
+
constructor(defaults) {
|
|
1795
|
+
super(defaults);
|
|
1796
|
+
this.type = "root";
|
|
1797
|
+
if (!this.nodes)
|
|
1798
|
+
this.nodes = [];
|
|
1729
1799
|
}
|
|
1730
|
-
|
|
1731
|
-
let
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
if (
|
|
1740
|
-
|
|
1800
|
+
normalize(child, sample, type) {
|
|
1801
|
+
let nodes = super.normalize(child);
|
|
1802
|
+
if (sample) {
|
|
1803
|
+
if (type === "prepend") {
|
|
1804
|
+
if (this.nodes.length > 1) {
|
|
1805
|
+
sample.raws.before = this.nodes[1].raws.before;
|
|
1806
|
+
} else {
|
|
1807
|
+
delete sample.raws.before;
|
|
1808
|
+
}
|
|
1809
|
+
} else if (this.first !== sample) {
|
|
1810
|
+
for (let node2 of nodes) {
|
|
1811
|
+
node2.raws.before = sample.raws.before;
|
|
1812
|
+
}
|
|
1741
1813
|
}
|
|
1742
1814
|
}
|
|
1743
|
-
|
|
1744
|
-
return this;
|
|
1815
|
+
return nodes;
|
|
1745
1816
|
}
|
|
1746
|
-
|
|
1747
|
-
let
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
existIndex = this.index(exist);
|
|
1751
|
-
for (let node2 of nodes)
|
|
1752
|
-
this.proxyOf.nodes.splice(existIndex, 0, node2);
|
|
1753
|
-
let index2;
|
|
1754
|
-
for (let id in this.indexes) {
|
|
1755
|
-
index2 = this.indexes[id];
|
|
1756
|
-
if (existIndex <= index2) {
|
|
1757
|
-
this.indexes[id] = index2 + nodes.length;
|
|
1758
|
-
}
|
|
1817
|
+
removeChild(child, ignore) {
|
|
1818
|
+
let index2 = this.index(child);
|
|
1819
|
+
if (!ignore && index2 === 0 && this.nodes.length > 1) {
|
|
1820
|
+
this.nodes[1].raws.before = this.nodes[index2].raws.before;
|
|
1759
1821
|
}
|
|
1760
|
-
|
|
1761
|
-
return this;
|
|
1822
|
+
return super.removeChild(child);
|
|
1762
1823
|
}
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1824
|
+
toResult(opts = {}) {
|
|
1825
|
+
let lazy = new LazyResult$3(new Processor$2(), this, opts);
|
|
1826
|
+
return lazy.stringify();
|
|
1827
|
+
}
|
|
1828
|
+
};
|
|
1829
|
+
Root$5.registerLazyResult = (dependant) => {
|
|
1830
|
+
LazyResult$3 = dependant;
|
|
1831
|
+
};
|
|
1832
|
+
Root$5.registerProcessor = (dependant) => {
|
|
1833
|
+
Processor$2 = dependant;
|
|
1834
|
+
};
|
|
1835
|
+
var root = Root$5;
|
|
1836
|
+
Root$5.default = Root$5;
|
|
1837
|
+
Container$4.registerRoot(Root$5);
|
|
1838
|
+
let list$2 = {
|
|
1839
|
+
comma(string) {
|
|
1840
|
+
return list$2.split(string, [","], true);
|
|
1841
|
+
},
|
|
1842
|
+
space(string) {
|
|
1843
|
+
let spaces = [" ", "\n", " "];
|
|
1844
|
+
return list$2.split(string, spaces);
|
|
1845
|
+
},
|
|
1846
|
+
split(string, separators, last) {
|
|
1847
|
+
let array = [];
|
|
1848
|
+
let current = "";
|
|
1849
|
+
let split = false;
|
|
1850
|
+
let func = 0;
|
|
1851
|
+
let inQuote = false;
|
|
1852
|
+
let prevQuote = "";
|
|
1853
|
+
let escape = false;
|
|
1854
|
+
for (let letter of string) {
|
|
1855
|
+
if (escape) {
|
|
1856
|
+
escape = false;
|
|
1857
|
+
} else if (letter === "\\") {
|
|
1858
|
+
escape = true;
|
|
1859
|
+
} else if (inQuote) {
|
|
1860
|
+
if (letter === prevQuote) {
|
|
1861
|
+
inQuote = false;
|
|
1862
|
+
}
|
|
1863
|
+
} else if (letter === '"' || letter === "'") {
|
|
1864
|
+
inQuote = true;
|
|
1865
|
+
prevQuote = letter;
|
|
1866
|
+
} else if (letter === "(") {
|
|
1867
|
+
func += 1;
|
|
1868
|
+
} else if (letter === ")") {
|
|
1869
|
+
if (func > 0)
|
|
1870
|
+
func -= 1;
|
|
1871
|
+
} else if (func === 0) {
|
|
1872
|
+
if (separators.includes(letter))
|
|
1873
|
+
split = true;
|
|
1779
1874
|
}
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
} else
|
|
1786
|
-
|
|
1875
|
+
if (split) {
|
|
1876
|
+
if (current !== "")
|
|
1877
|
+
array.push(current.trim());
|
|
1878
|
+
current = "";
|
|
1879
|
+
split = false;
|
|
1880
|
+
} else {
|
|
1881
|
+
current += letter;
|
|
1787
1882
|
}
|
|
1788
|
-
nodes = [new Declaration$3(nodes)];
|
|
1789
|
-
} else if (nodes.selector) {
|
|
1790
|
-
nodes = [new Rule$4(nodes)];
|
|
1791
|
-
} else if (nodes.name) {
|
|
1792
|
-
nodes = [new AtRule$4(nodes)];
|
|
1793
|
-
} else if (nodes.text) {
|
|
1794
|
-
nodes = [new Comment$3(nodes)];
|
|
1795
|
-
} else {
|
|
1796
|
-
throw new Error("Unknown node type in node creation");
|
|
1797
1883
|
}
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
i = i.proxyOf;
|
|
1802
|
-
if (i.parent)
|
|
1803
|
-
i.parent.removeChild(i);
|
|
1804
|
-
if (i[isClean$1])
|
|
1805
|
-
markDirtyUp(i);
|
|
1806
|
-
if (typeof i.raws.before === "undefined") {
|
|
1807
|
-
if (sample && typeof sample.raws.before !== "undefined") {
|
|
1808
|
-
i.raws.before = sample.raws.before.replace(/\S/g, "");
|
|
1809
|
-
}
|
|
1810
|
-
}
|
|
1811
|
-
i.parent = this.proxyOf;
|
|
1812
|
-
return i;
|
|
1813
|
-
});
|
|
1814
|
-
return processed;
|
|
1884
|
+
if (last || current !== "")
|
|
1885
|
+
array.push(current.trim());
|
|
1886
|
+
return array;
|
|
1815
1887
|
}
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1888
|
+
};
|
|
1889
|
+
var list_1 = list$2;
|
|
1890
|
+
list$2.default = list$2;
|
|
1891
|
+
let Container$3 = container;
|
|
1892
|
+
let list$1 = list_1;
|
|
1893
|
+
let Rule$3 = class Rule extends Container$3 {
|
|
1894
|
+
get selectors() {
|
|
1895
|
+
return list$1.comma(this.selector);
|
|
1896
|
+
}
|
|
1897
|
+
set selectors(values) {
|
|
1898
|
+
let match = this.selector ? this.selector.match(/,\s*/) : null;
|
|
1899
|
+
let sep2 = match ? match[0] : "," + this.raw("between", "beforeOpen");
|
|
1900
|
+
this.selector = values.join(sep2);
|
|
1901
|
+
}
|
|
1902
|
+
constructor(defaults) {
|
|
1903
|
+
super(defaults);
|
|
1904
|
+
this.type = "rule";
|
|
1905
|
+
if (!this.nodes)
|
|
1906
|
+
this.nodes = [];
|
|
1907
|
+
}
|
|
1908
|
+
};
|
|
1909
|
+
var rule = Rule$3;
|
|
1910
|
+
Rule$3.default = Rule$3;
|
|
1911
|
+
Container$3.registerRule(Rule$3);
|
|
1912
|
+
let AtRule$2 = atRule;
|
|
1913
|
+
let Comment$2 = comment;
|
|
1914
|
+
let Declaration$2 = declaration;
|
|
1915
|
+
let Input$3 = input;
|
|
1916
|
+
let PreviousMap2 = previousMap;
|
|
1917
|
+
let Root$4 = root;
|
|
1918
|
+
let Rule$2 = rule;
|
|
1919
|
+
function fromJSON$1(json, inputs) {
|
|
1920
|
+
if (Array.isArray(json))
|
|
1921
|
+
return json.map((n) => fromJSON$1(n));
|
|
1922
|
+
let _a = json, { inputs: ownInputs } = _a, defaults = __objRest(_a, ["inputs"]);
|
|
1923
|
+
if (ownInputs) {
|
|
1924
|
+
inputs = [];
|
|
1925
|
+
for (let input2 of ownInputs) {
|
|
1926
|
+
let inputHydrated = __spreadProps(__spreadValues({}, input2), { __proto__: Input$3.prototype });
|
|
1927
|
+
if (inputHydrated.map) {
|
|
1928
|
+
inputHydrated.map = __spreadProps(__spreadValues({}, inputHydrated.map), {
|
|
1929
|
+
__proto__: PreviousMap2.prototype
|
|
1930
|
+
});
|
|
1824
1931
|
}
|
|
1932
|
+
inputs.push(inputHydrated);
|
|
1825
1933
|
}
|
|
1826
|
-
this.markDirty();
|
|
1827
|
-
return this;
|
|
1828
|
-
}
|
|
1829
|
-
push(child) {
|
|
1830
|
-
child.parent = this;
|
|
1831
|
-
this.proxyOf.nodes.push(child);
|
|
1832
|
-
return this;
|
|
1833
1934
|
}
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
node2.parent = void 0;
|
|
1837
|
-
this.proxyOf.nodes = [];
|
|
1838
|
-
this.markDirty();
|
|
1839
|
-
return this;
|
|
1935
|
+
if (defaults.nodes) {
|
|
1936
|
+
defaults.nodes = json.nodes.map((n) => fromJSON$1(n, inputs));
|
|
1840
1937
|
}
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
for (let id in this.indexes) {
|
|
1847
|
-
index2 = this.indexes[id];
|
|
1848
|
-
if (index2 >= child) {
|
|
1849
|
-
this.indexes[id] = index2 - 1;
|
|
1850
|
-
}
|
|
1938
|
+
if (defaults.source) {
|
|
1939
|
+
let _b = defaults.source, { inputId } = _b, source = __objRest(_b, ["inputId"]);
|
|
1940
|
+
defaults.source = source;
|
|
1941
|
+
if (inputId != null) {
|
|
1942
|
+
defaults.source.input = inputs[inputId];
|
|
1851
1943
|
}
|
|
1852
|
-
this.markDirty();
|
|
1853
|
-
return this;
|
|
1854
1944
|
}
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
this.markDirty();
|
|
1868
|
-
return this;
|
|
1945
|
+
if (defaults.type === "root") {
|
|
1946
|
+
return new Root$4(defaults);
|
|
1947
|
+
} else if (defaults.type === "decl") {
|
|
1948
|
+
return new Declaration$2(defaults);
|
|
1949
|
+
} else if (defaults.type === "rule") {
|
|
1950
|
+
return new Rule$2(defaults);
|
|
1951
|
+
} else if (defaults.type === "comment") {
|
|
1952
|
+
return new Comment$2(defaults);
|
|
1953
|
+
} else if (defaults.type === "atrule") {
|
|
1954
|
+
return new AtRule$2(defaults);
|
|
1955
|
+
} else {
|
|
1956
|
+
throw new Error("Unknown node type: " + json.type);
|
|
1869
1957
|
}
|
|
1870
|
-
|
|
1871
|
-
|
|
1958
|
+
}
|
|
1959
|
+
var fromJSON_1 = fromJSON$1;
|
|
1960
|
+
fromJSON$1.default = fromJSON$1;
|
|
1961
|
+
let { dirname, relative, resolve, sep } = require$$2;
|
|
1962
|
+
let { SourceMapConsumer, SourceMapGenerator } = require$$2;
|
|
1963
|
+
let { pathToFileURL } = require$$2;
|
|
1964
|
+
let Input$2 = input;
|
|
1965
|
+
let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);
|
|
1966
|
+
let pathAvailable = Boolean(dirname && resolve && relative && sep);
|
|
1967
|
+
let MapGenerator$2 = class MapGenerator {
|
|
1968
|
+
constructor(stringify2, root2, opts, cssString) {
|
|
1969
|
+
this.stringify = stringify2;
|
|
1970
|
+
this.mapOpts = opts.map || {};
|
|
1971
|
+
this.root = root2;
|
|
1972
|
+
this.opts = opts;
|
|
1973
|
+
this.css = cssString;
|
|
1974
|
+
this.originalCSS = cssString;
|
|
1975
|
+
this.usesFileUrls = !this.mapOpts.from && this.mapOpts.absolute;
|
|
1976
|
+
this.memoizedFileURLs = /* @__PURE__ */ new Map();
|
|
1977
|
+
this.memoizedPaths = /* @__PURE__ */ new Map();
|
|
1978
|
+
this.memoizedURLs = /* @__PURE__ */ new Map();
|
|
1872
1979
|
}
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1980
|
+
addAnnotation() {
|
|
1981
|
+
let content;
|
|
1982
|
+
if (this.isInline()) {
|
|
1983
|
+
content = "data:application/json;base64," + this.toBase64(this.map.toString());
|
|
1984
|
+
} else if (typeof this.mapOpts.annotation === "string") {
|
|
1985
|
+
content = this.mapOpts.annotation;
|
|
1986
|
+
} else if (typeof this.mapOpts.annotation === "function") {
|
|
1987
|
+
content = this.mapOpts.annotation(this.opts.to, this.root);
|
|
1988
|
+
} else {
|
|
1989
|
+
content = this.outputFile() + ".map";
|
|
1990
|
+
}
|
|
1991
|
+
let eol = "\n";
|
|
1992
|
+
if (this.css.includes("\r\n"))
|
|
1993
|
+
eol = "\r\n";
|
|
1994
|
+
this.css += eol + "/*# sourceMappingURL=" + content + " */";
|
|
1995
|
+
}
|
|
1996
|
+
applyPrevMaps() {
|
|
1997
|
+
for (let prev of this.previous()) {
|
|
1998
|
+
let from = this.toUrl(this.path(prev.file));
|
|
1999
|
+
let root2 = prev.root || dirname(prev.file);
|
|
2000
|
+
let map;
|
|
2001
|
+
if (this.mapOpts.sourcesContent === false) {
|
|
2002
|
+
map = new SourceMapConsumer(prev.text);
|
|
2003
|
+
if (map.sourcesContent) {
|
|
2004
|
+
map.sourcesContent = null;
|
|
2005
|
+
}
|
|
2006
|
+
} else {
|
|
2007
|
+
map = prev.consumer();
|
|
1883
2008
|
}
|
|
1884
|
-
|
|
1885
|
-
}
|
|
2009
|
+
this.map.applySourceMap(map, from, this.toUrl(this.path(root2)));
|
|
2010
|
+
}
|
|
1886
2011
|
}
|
|
1887
|
-
|
|
1888
|
-
if (
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
2012
|
+
clearAnnotation() {
|
|
2013
|
+
if (this.mapOpts.annotation === false)
|
|
2014
|
+
return;
|
|
2015
|
+
if (this.root) {
|
|
2016
|
+
let node2;
|
|
2017
|
+
for (let i = this.root.nodes.length - 1; i >= 0; i--) {
|
|
2018
|
+
node2 = this.root.nodes[i];
|
|
2019
|
+
if (node2.type !== "comment")
|
|
2020
|
+
continue;
|
|
2021
|
+
if (node2.text.startsWith("# sourceMappingURL=")) {
|
|
2022
|
+
this.root.removeChild(i);
|
|
1893
2023
|
}
|
|
2024
|
+
}
|
|
2025
|
+
} else if (this.css) {
|
|
2026
|
+
this.css = this.css.replace(/\n*\/\*#[\S\s]*?\*\/$/gm, "");
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
2029
|
+
generate() {
|
|
2030
|
+
this.clearAnnotation();
|
|
2031
|
+
if (pathAvailable && sourceMapAvailable && this.isMap()) {
|
|
2032
|
+
return this.generateMap();
|
|
2033
|
+
} else {
|
|
2034
|
+
let result2 = "";
|
|
2035
|
+
this.stringify(this.root, (i) => {
|
|
2036
|
+
result2 += i;
|
|
1894
2037
|
});
|
|
2038
|
+
return [result2];
|
|
1895
2039
|
}
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
2040
|
+
}
|
|
2041
|
+
generateMap() {
|
|
2042
|
+
if (this.root) {
|
|
2043
|
+
this.generateString();
|
|
2044
|
+
} else if (this.previous().length === 1) {
|
|
2045
|
+
let prev = this.previous()[0].consumer();
|
|
2046
|
+
prev.file = this.outputFile();
|
|
2047
|
+
this.map = SourceMapGenerator.fromSourceMap(prev, {
|
|
2048
|
+
ignoreInvalidMapping: true
|
|
2049
|
+
});
|
|
2050
|
+
} else {
|
|
2051
|
+
this.map = new SourceMapGenerator({
|
|
2052
|
+
file: this.outputFile(),
|
|
2053
|
+
ignoreInvalidMapping: true
|
|
2054
|
+
});
|
|
2055
|
+
this.map.addMapping({
|
|
2056
|
+
generated: { column: 0, line: 1 },
|
|
2057
|
+
original: { column: 0, line: 1 },
|
|
2058
|
+
source: this.opts.from ? this.toUrl(this.path(this.opts.from)) : "<no source>"
|
|
1901
2059
|
});
|
|
1902
2060
|
}
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
2061
|
+
if (this.isSourcesContent())
|
|
2062
|
+
this.setSourcesContent();
|
|
2063
|
+
if (this.root && this.previous().length > 0)
|
|
2064
|
+
this.applyPrevMaps();
|
|
2065
|
+
if (this.isAnnotation())
|
|
2066
|
+
this.addAnnotation();
|
|
2067
|
+
if (this.isInline()) {
|
|
2068
|
+
return [this.css];
|
|
2069
|
+
} else {
|
|
2070
|
+
return [this.css, this.map];
|
|
2071
|
+
}
|
|
1908
2072
|
}
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
2073
|
+
generateString() {
|
|
2074
|
+
this.css = "";
|
|
2075
|
+
this.map = new SourceMapGenerator({
|
|
2076
|
+
file: this.outputFile(),
|
|
2077
|
+
ignoreInvalidMapping: true
|
|
2078
|
+
});
|
|
2079
|
+
let line = 1;
|
|
2080
|
+
let column = 1;
|
|
2081
|
+
let noSource = "<no source>";
|
|
2082
|
+
let mapping = {
|
|
2083
|
+
generated: { column: 0, line: 0 },
|
|
2084
|
+
original: { column: 0, line: 0 },
|
|
2085
|
+
source: ""
|
|
2086
|
+
};
|
|
2087
|
+
let last, lines;
|
|
2088
|
+
this.stringify(this.root, (str, node2, type) => {
|
|
2089
|
+
this.css += str;
|
|
2090
|
+
if (node2 && type !== "end") {
|
|
2091
|
+
mapping.generated.line = line;
|
|
2092
|
+
mapping.generated.column = column - 1;
|
|
2093
|
+
if (node2.source && node2.source.start) {
|
|
2094
|
+
mapping.source = this.sourcePath(node2);
|
|
2095
|
+
mapping.original.line = node2.source.start.line;
|
|
2096
|
+
mapping.original.column = node2.source.start.column - 1;
|
|
2097
|
+
this.map.addMapping(mapping);
|
|
2098
|
+
} else {
|
|
2099
|
+
mapping.source = noSource;
|
|
2100
|
+
mapping.original.line = 1;
|
|
2101
|
+
mapping.original.column = 0;
|
|
2102
|
+
this.map.addMapping(mapping);
|
|
2103
|
+
}
|
|
2104
|
+
}
|
|
2105
|
+
lines = str.match(/\n/g);
|
|
2106
|
+
if (lines) {
|
|
2107
|
+
line += lines.length;
|
|
2108
|
+
last = str.lastIndexOf("\n");
|
|
2109
|
+
column = str.length - last;
|
|
2110
|
+
} else {
|
|
2111
|
+
column += str.length;
|
|
2112
|
+
}
|
|
2113
|
+
if (node2 && type !== "start") {
|
|
2114
|
+
let p = node2.parent || { raws: {} };
|
|
2115
|
+
let childless = node2.type === "decl" || node2.type === "atrule" && !node2.nodes;
|
|
2116
|
+
if (!childless || node2 !== p.last || p.raws.semicolon) {
|
|
2117
|
+
if (node2.source && node2.source.end) {
|
|
2118
|
+
mapping.source = this.sourcePath(node2);
|
|
2119
|
+
mapping.original.line = node2.source.end.line;
|
|
2120
|
+
mapping.original.column = node2.source.end.column - 1;
|
|
2121
|
+
mapping.generated.line = line;
|
|
2122
|
+
mapping.generated.column = column - 2;
|
|
2123
|
+
this.map.addMapping(mapping);
|
|
2124
|
+
} else {
|
|
2125
|
+
mapping.source = noSource;
|
|
2126
|
+
mapping.original.line = 1;
|
|
2127
|
+
mapping.original.column = 0;
|
|
2128
|
+
mapping.generated.line = line;
|
|
2129
|
+
mapping.generated.column = column - 1;
|
|
2130
|
+
this.map.addMapping(mapping);
|
|
2131
|
+
}
|
|
2132
|
+
}
|
|
1913
2133
|
}
|
|
1914
2134
|
});
|
|
1915
2135
|
}
|
|
1916
|
-
|
|
1917
|
-
if (
|
|
1918
|
-
|
|
1919
|
-
return this.walk((child, i) => {
|
|
1920
|
-
if (child.type === "decl") {
|
|
1921
|
-
return callback(child, i);
|
|
1922
|
-
}
|
|
1923
|
-
});
|
|
2136
|
+
isAnnotation() {
|
|
2137
|
+
if (this.isInline()) {
|
|
2138
|
+
return true;
|
|
1924
2139
|
}
|
|
1925
|
-
if (
|
|
1926
|
-
return this.
|
|
1927
|
-
if (child.type === "decl" && prop.test(child.prop)) {
|
|
1928
|
-
return callback(child, i);
|
|
1929
|
-
}
|
|
1930
|
-
});
|
|
2140
|
+
if (typeof this.mapOpts.annotation !== "undefined") {
|
|
2141
|
+
return this.mapOpts.annotation;
|
|
1931
2142
|
}
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
});
|
|
2143
|
+
if (this.previous().length) {
|
|
2144
|
+
return this.previous().some((i) => i.annotation);
|
|
2145
|
+
}
|
|
2146
|
+
return true;
|
|
1937
2147
|
}
|
|
1938
|
-
|
|
1939
|
-
if (
|
|
1940
|
-
|
|
1941
|
-
return this.walk((child, i) => {
|
|
1942
|
-
if (child.type === "rule") {
|
|
1943
|
-
return callback(child, i);
|
|
1944
|
-
}
|
|
1945
|
-
});
|
|
2148
|
+
isInline() {
|
|
2149
|
+
if (typeof this.mapOpts.inline !== "undefined") {
|
|
2150
|
+
return this.mapOpts.inline;
|
|
1946
2151
|
}
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
return callback(child, i);
|
|
1951
|
-
}
|
|
1952
|
-
});
|
|
2152
|
+
let annotation = this.mapOpts.annotation;
|
|
2153
|
+
if (typeof annotation !== "undefined" && annotation !== true) {
|
|
2154
|
+
return false;
|
|
1953
2155
|
}
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
return callback(child, i);
|
|
1957
|
-
}
|
|
1958
|
-
});
|
|
1959
|
-
}
|
|
1960
|
-
get first() {
|
|
1961
|
-
if (!this.proxyOf.nodes)
|
|
1962
|
-
return void 0;
|
|
1963
|
-
return this.proxyOf.nodes[0];
|
|
1964
|
-
}
|
|
1965
|
-
get last() {
|
|
1966
|
-
if (!this.proxyOf.nodes)
|
|
1967
|
-
return void 0;
|
|
1968
|
-
return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
|
|
1969
|
-
}
|
|
1970
|
-
};
|
|
1971
|
-
Container$7.registerParse = (dependant) => {
|
|
1972
|
-
parse$4 = dependant;
|
|
1973
|
-
};
|
|
1974
|
-
Container$7.registerRule = (dependant) => {
|
|
1975
|
-
Rule$4 = dependant;
|
|
1976
|
-
};
|
|
1977
|
-
Container$7.registerAtRule = (dependant) => {
|
|
1978
|
-
AtRule$4 = dependant;
|
|
1979
|
-
};
|
|
1980
|
-
Container$7.registerRoot = (dependant) => {
|
|
1981
|
-
Root$6 = dependant;
|
|
1982
|
-
};
|
|
1983
|
-
var container = Container$7;
|
|
1984
|
-
Container$7.default = Container$7;
|
|
1985
|
-
Container$7.rebuild = (node2) => {
|
|
1986
|
-
if (node2.type === "atrule") {
|
|
1987
|
-
Object.setPrototypeOf(node2, AtRule$4.prototype);
|
|
1988
|
-
} else if (node2.type === "rule") {
|
|
1989
|
-
Object.setPrototypeOf(node2, Rule$4.prototype);
|
|
1990
|
-
} else if (node2.type === "decl") {
|
|
1991
|
-
Object.setPrototypeOf(node2, Declaration$3.prototype);
|
|
1992
|
-
} else if (node2.type === "comment") {
|
|
1993
|
-
Object.setPrototypeOf(node2, Comment$3.prototype);
|
|
1994
|
-
} else if (node2.type === "root") {
|
|
1995
|
-
Object.setPrototypeOf(node2, Root$6.prototype);
|
|
1996
|
-
}
|
|
1997
|
-
node2[my$1] = true;
|
|
1998
|
-
if (node2.nodes) {
|
|
1999
|
-
node2.nodes.forEach((child) => {
|
|
2000
|
-
Container$7.rebuild(child);
|
|
2001
|
-
});
|
|
2002
|
-
}
|
|
2003
|
-
};
|
|
2004
|
-
let Container$6 = container;
|
|
2005
|
-
let LazyResult$4;
|
|
2006
|
-
let Processor$3;
|
|
2007
|
-
let Document$3 = class Document2 extends Container$6 {
|
|
2008
|
-
constructor(defaults) {
|
|
2009
|
-
super(__spreadValues({ type: "document" }, defaults));
|
|
2010
|
-
if (!this.nodes) {
|
|
2011
|
-
this.nodes = [];
|
|
2156
|
+
if (this.previous().length) {
|
|
2157
|
+
return this.previous().some((i) => i.inline);
|
|
2012
2158
|
}
|
|
2159
|
+
return true;
|
|
2013
2160
|
}
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
}
|
|
2018
|
-
};
|
|
2019
|
-
Document$3.registerLazyResult = (dependant) => {
|
|
2020
|
-
LazyResult$4 = dependant;
|
|
2021
|
-
};
|
|
2022
|
-
Document$3.registerProcessor = (dependant) => {
|
|
2023
|
-
Processor$3 = dependant;
|
|
2024
|
-
};
|
|
2025
|
-
var document$1 = Document$3;
|
|
2026
|
-
Document$3.default = Document$3;
|
|
2027
|
-
let printed = {};
|
|
2028
|
-
var warnOnce$2 = function warnOnce(message) {
|
|
2029
|
-
if (printed[message])
|
|
2030
|
-
return;
|
|
2031
|
-
printed[message] = true;
|
|
2032
|
-
if (typeof console !== "undefined" && console.warn) {
|
|
2033
|
-
console.warn(message);
|
|
2034
|
-
}
|
|
2035
|
-
};
|
|
2036
|
-
let Warning$2 = class Warning {
|
|
2037
|
-
constructor(text, opts = {}) {
|
|
2038
|
-
this.type = "warning";
|
|
2039
|
-
this.text = text;
|
|
2040
|
-
if (opts.node && opts.node.source) {
|
|
2041
|
-
let range = opts.node.rangeBy(opts);
|
|
2042
|
-
this.line = range.start.line;
|
|
2043
|
-
this.column = range.start.column;
|
|
2044
|
-
this.endLine = range.end.line;
|
|
2045
|
-
this.endColumn = range.end.column;
|
|
2161
|
+
isMap() {
|
|
2162
|
+
if (typeof this.opts.map !== "undefined") {
|
|
2163
|
+
return !!this.opts.map;
|
|
2046
2164
|
}
|
|
2047
|
-
|
|
2048
|
-
this[opt] = opts[opt];
|
|
2165
|
+
return this.previous().length > 0;
|
|
2049
2166
|
}
|
|
2050
|
-
|
|
2051
|
-
if (this.
|
|
2052
|
-
return this.
|
|
2053
|
-
index: this.index,
|
|
2054
|
-
plugin: this.plugin,
|
|
2055
|
-
word: this.word
|
|
2056
|
-
}).message;
|
|
2167
|
+
isSourcesContent() {
|
|
2168
|
+
if (typeof this.mapOpts.sourcesContent !== "undefined") {
|
|
2169
|
+
return this.mapOpts.sourcesContent;
|
|
2057
2170
|
}
|
|
2058
|
-
if (this.
|
|
2059
|
-
return this.
|
|
2171
|
+
if (this.previous().length) {
|
|
2172
|
+
return this.previous().some((i) => i.withContent());
|
|
2060
2173
|
}
|
|
2061
|
-
return
|
|
2174
|
+
return true;
|
|
2062
2175
|
}
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
this.root = root2;
|
|
2072
|
-
this.opts = opts;
|
|
2073
|
-
this.css = void 0;
|
|
2074
|
-
this.map = void 0;
|
|
2176
|
+
outputFile() {
|
|
2177
|
+
if (this.opts.to) {
|
|
2178
|
+
return this.path(this.opts.to);
|
|
2179
|
+
} else if (this.opts.from) {
|
|
2180
|
+
return this.path(this.opts.from);
|
|
2181
|
+
} else {
|
|
2182
|
+
return "to.css";
|
|
2183
|
+
}
|
|
2075
2184
|
}
|
|
2076
|
-
|
|
2077
|
-
|
|
2185
|
+
path(file) {
|
|
2186
|
+
if (this.mapOpts.absolute)
|
|
2187
|
+
return file;
|
|
2188
|
+
if (file.charCodeAt(0) === 60)
|
|
2189
|
+
return file;
|
|
2190
|
+
if (/^\w+:\/\//.test(file))
|
|
2191
|
+
return file;
|
|
2192
|
+
let cached = this.memoizedPaths.get(file);
|
|
2193
|
+
if (cached)
|
|
2194
|
+
return cached;
|
|
2195
|
+
let from = this.opts.to ? dirname(this.opts.to) : ".";
|
|
2196
|
+
if (typeof this.mapOpts.annotation === "string") {
|
|
2197
|
+
from = dirname(resolve(from, this.mapOpts.annotation));
|
|
2198
|
+
}
|
|
2199
|
+
let path = relative(from, file);
|
|
2200
|
+
this.memoizedPaths.set(file, path);
|
|
2201
|
+
return path;
|
|
2078
2202
|
}
|
|
2079
|
-
|
|
2080
|
-
if (!
|
|
2081
|
-
|
|
2082
|
-
|
|
2203
|
+
previous() {
|
|
2204
|
+
if (!this.previousMaps) {
|
|
2205
|
+
this.previousMaps = [];
|
|
2206
|
+
if (this.root) {
|
|
2207
|
+
this.root.walk((node2) => {
|
|
2208
|
+
if (node2.source && node2.source.input.map) {
|
|
2209
|
+
let map = node2.source.input.map;
|
|
2210
|
+
if (!this.previousMaps.includes(map)) {
|
|
2211
|
+
this.previousMaps.push(map);
|
|
2212
|
+
}
|
|
2213
|
+
}
|
|
2214
|
+
});
|
|
2215
|
+
} else {
|
|
2216
|
+
let input2 = new Input$2(this.originalCSS, this.opts);
|
|
2217
|
+
if (input2.map)
|
|
2218
|
+
this.previousMaps.push(input2.map);
|
|
2083
2219
|
}
|
|
2084
2220
|
}
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2221
|
+
return this.previousMaps;
|
|
2222
|
+
}
|
|
2223
|
+
setSourcesContent() {
|
|
2224
|
+
let already = {};
|
|
2225
|
+
if (this.root) {
|
|
2226
|
+
this.root.walk((node2) => {
|
|
2227
|
+
if (node2.source) {
|
|
2228
|
+
let from = node2.source.input.from;
|
|
2229
|
+
if (from && !already[from]) {
|
|
2230
|
+
already[from] = true;
|
|
2231
|
+
let fromUrl = this.usesFileUrls ? this.toFileUrl(from) : this.toUrl(this.path(from));
|
|
2232
|
+
this.map.setSourceContent(fromUrl, node2.source.input.css);
|
|
2233
|
+
}
|
|
2234
|
+
}
|
|
2235
|
+
});
|
|
2236
|
+
} else if (this.css) {
|
|
2237
|
+
let from = this.opts.from ? this.toUrl(this.path(this.opts.from)) : "<no source>";
|
|
2238
|
+
this.map.setSourceContent(from, this.css);
|
|
2239
|
+
}
|
|
2240
|
+
}
|
|
2241
|
+
sourcePath(node2) {
|
|
2242
|
+
if (this.mapOpts.from) {
|
|
2243
|
+
return this.toUrl(this.mapOpts.from);
|
|
2244
|
+
} else if (this.usesFileUrls) {
|
|
2245
|
+
return this.toFileUrl(node2.source.input.from);
|
|
2246
|
+
} else {
|
|
2247
|
+
return this.toUrl(this.path(node2.source.input.from));
|
|
2248
|
+
}
|
|
2249
|
+
}
|
|
2250
|
+
toBase64(str) {
|
|
2251
|
+
if (Buffer) {
|
|
2252
|
+
return Buffer.from(str).toString("base64");
|
|
2253
|
+
} else {
|
|
2254
|
+
return window.btoa(unescape(encodeURIComponent(str)));
|
|
2255
|
+
}
|
|
2088
2256
|
}
|
|
2089
|
-
|
|
2090
|
-
|
|
2257
|
+
toFileUrl(path) {
|
|
2258
|
+
let cached = this.memoizedFileURLs.get(path);
|
|
2259
|
+
if (cached)
|
|
2260
|
+
return cached;
|
|
2261
|
+
if (pathToFileURL) {
|
|
2262
|
+
let fileURL = pathToFileURL(path).toString();
|
|
2263
|
+
this.memoizedFileURLs.set(path, fileURL);
|
|
2264
|
+
return fileURL;
|
|
2265
|
+
} else {
|
|
2266
|
+
throw new Error(
|
|
2267
|
+
"`map.absolute` option is not available in this PostCSS build"
|
|
2268
|
+
);
|
|
2269
|
+
}
|
|
2091
2270
|
}
|
|
2092
|
-
|
|
2093
|
-
|
|
2271
|
+
toUrl(path) {
|
|
2272
|
+
let cached = this.memoizedURLs.get(path);
|
|
2273
|
+
if (cached)
|
|
2274
|
+
return cached;
|
|
2275
|
+
if (sep === "\\") {
|
|
2276
|
+
path = path.replace(/\\/g, "/");
|
|
2277
|
+
}
|
|
2278
|
+
let url = encodeURI(path).replace(/[#?]/g, encodeURIComponent);
|
|
2279
|
+
this.memoizedURLs.set(path, url);
|
|
2280
|
+
return url;
|
|
2094
2281
|
}
|
|
2095
2282
|
};
|
|
2096
|
-
var
|
|
2097
|
-
Result$3.default = Result$3;
|
|
2283
|
+
var mapGenerator = MapGenerator$2;
|
|
2098
2284
|
const SINGLE_QUOTE = "'".charCodeAt(0);
|
|
2099
2285
|
const DOUBLE_QUOTE = '"'.charCodeAt(0);
|
|
2100
2286
|
const BACKSLASH = "\\".charCodeAt(0);
|
|
@@ -2121,8 +2307,8 @@ const RE_HEX_ESCAPE = /[\da-f]/i;
|
|
|
2121
2307
|
var tokenize = function tokenizer(input2, options = {}) {
|
|
2122
2308
|
let css = input2.css.valueOf();
|
|
2123
2309
|
let ignore = options.ignoreErrors;
|
|
2124
|
-
let code,
|
|
2125
|
-
let escaped, escapePos,
|
|
2310
|
+
let code, content, escape, next, quote;
|
|
2311
|
+
let currentToken, escaped, escapePos, n, prev;
|
|
2126
2312
|
let length = css.length;
|
|
2127
2313
|
let pos = 0;
|
|
2128
2314
|
let buffer = [];
|
|
@@ -2305,154 +2491,12 @@ var tokenize = function tokenizer(input2, options = {}) {
|
|
|
2305
2491
|
position
|
|
2306
2492
|
};
|
|
2307
2493
|
};
|
|
2308
|
-
let
|
|
2309
|
-
let
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
}
|
|
2314
|
-
append(...children) {
|
|
2315
|
-
if (!this.proxyOf.nodes)
|
|
2316
|
-
this.nodes = [];
|
|
2317
|
-
return super.append(...children);
|
|
2318
|
-
}
|
|
2319
|
-
prepend(...children) {
|
|
2320
|
-
if (!this.proxyOf.nodes)
|
|
2321
|
-
this.nodes = [];
|
|
2322
|
-
return super.prepend(...children);
|
|
2323
|
-
}
|
|
2324
|
-
};
|
|
2325
|
-
var atRule = AtRule$3;
|
|
2326
|
-
AtRule$3.default = AtRule$3;
|
|
2327
|
-
Container$5.registerAtRule(AtRule$3);
|
|
2328
|
-
let Container$4 = container;
|
|
2329
|
-
let LazyResult$3;
|
|
2330
|
-
let Processor$2;
|
|
2331
|
-
let Root$5 = class Root extends Container$4 {
|
|
2332
|
-
constructor(defaults) {
|
|
2333
|
-
super(defaults);
|
|
2334
|
-
this.type = "root";
|
|
2335
|
-
if (!this.nodes)
|
|
2336
|
-
this.nodes = [];
|
|
2337
|
-
}
|
|
2338
|
-
normalize(child, sample, type) {
|
|
2339
|
-
let nodes = super.normalize(child);
|
|
2340
|
-
if (sample) {
|
|
2341
|
-
if (type === "prepend") {
|
|
2342
|
-
if (this.nodes.length > 1) {
|
|
2343
|
-
sample.raws.before = this.nodes[1].raws.before;
|
|
2344
|
-
} else {
|
|
2345
|
-
delete sample.raws.before;
|
|
2346
|
-
}
|
|
2347
|
-
} else if (this.first !== sample) {
|
|
2348
|
-
for (let node2 of nodes) {
|
|
2349
|
-
node2.raws.before = sample.raws.before;
|
|
2350
|
-
}
|
|
2351
|
-
}
|
|
2352
|
-
}
|
|
2353
|
-
return nodes;
|
|
2354
|
-
}
|
|
2355
|
-
removeChild(child, ignore) {
|
|
2356
|
-
let index2 = this.index(child);
|
|
2357
|
-
if (!ignore && index2 === 0 && this.nodes.length > 1) {
|
|
2358
|
-
this.nodes[1].raws.before = this.nodes[index2].raws.before;
|
|
2359
|
-
}
|
|
2360
|
-
return super.removeChild(child);
|
|
2361
|
-
}
|
|
2362
|
-
toResult(opts = {}) {
|
|
2363
|
-
let lazy = new LazyResult$3(new Processor$2(), this, opts);
|
|
2364
|
-
return lazy.stringify();
|
|
2365
|
-
}
|
|
2366
|
-
};
|
|
2367
|
-
Root$5.registerLazyResult = (dependant) => {
|
|
2368
|
-
LazyResult$3 = dependant;
|
|
2369
|
-
};
|
|
2370
|
-
Root$5.registerProcessor = (dependant) => {
|
|
2371
|
-
Processor$2 = dependant;
|
|
2372
|
-
};
|
|
2373
|
-
var root = Root$5;
|
|
2374
|
-
Root$5.default = Root$5;
|
|
2375
|
-
Container$4.registerRoot(Root$5);
|
|
2376
|
-
let list$2 = {
|
|
2377
|
-
comma(string) {
|
|
2378
|
-
return list$2.split(string, [","], true);
|
|
2379
|
-
},
|
|
2380
|
-
space(string) {
|
|
2381
|
-
let spaces = [" ", "\n", " "];
|
|
2382
|
-
return list$2.split(string, spaces);
|
|
2383
|
-
},
|
|
2384
|
-
split(string, separators, last) {
|
|
2385
|
-
let array = [];
|
|
2386
|
-
let current = "";
|
|
2387
|
-
let split = false;
|
|
2388
|
-
let func = 0;
|
|
2389
|
-
let inQuote = false;
|
|
2390
|
-
let prevQuote = "";
|
|
2391
|
-
let escape = false;
|
|
2392
|
-
for (let letter of string) {
|
|
2393
|
-
if (escape) {
|
|
2394
|
-
escape = false;
|
|
2395
|
-
} else if (letter === "\\") {
|
|
2396
|
-
escape = true;
|
|
2397
|
-
} else if (inQuote) {
|
|
2398
|
-
if (letter === prevQuote) {
|
|
2399
|
-
inQuote = false;
|
|
2400
|
-
}
|
|
2401
|
-
} else if (letter === '"' || letter === "'") {
|
|
2402
|
-
inQuote = true;
|
|
2403
|
-
prevQuote = letter;
|
|
2404
|
-
} else if (letter === "(") {
|
|
2405
|
-
func += 1;
|
|
2406
|
-
} else if (letter === ")") {
|
|
2407
|
-
if (func > 0)
|
|
2408
|
-
func -= 1;
|
|
2409
|
-
} else if (func === 0) {
|
|
2410
|
-
if (separators.includes(letter))
|
|
2411
|
-
split = true;
|
|
2412
|
-
}
|
|
2413
|
-
if (split) {
|
|
2414
|
-
if (current !== "")
|
|
2415
|
-
array.push(current.trim());
|
|
2416
|
-
current = "";
|
|
2417
|
-
split = false;
|
|
2418
|
-
} else {
|
|
2419
|
-
current += letter;
|
|
2420
|
-
}
|
|
2421
|
-
}
|
|
2422
|
-
if (last || current !== "")
|
|
2423
|
-
array.push(current.trim());
|
|
2424
|
-
return array;
|
|
2425
|
-
}
|
|
2426
|
-
};
|
|
2427
|
-
var list_1 = list$2;
|
|
2428
|
-
list$2.default = list$2;
|
|
2429
|
-
let Container$3 = container;
|
|
2430
|
-
let list$1 = list_1;
|
|
2431
|
-
let Rule$3 = class Rule extends Container$3 {
|
|
2432
|
-
constructor(defaults) {
|
|
2433
|
-
super(defaults);
|
|
2434
|
-
this.type = "rule";
|
|
2435
|
-
if (!this.nodes)
|
|
2436
|
-
this.nodes = [];
|
|
2437
|
-
}
|
|
2438
|
-
get selectors() {
|
|
2439
|
-
return list$1.comma(this.selector);
|
|
2440
|
-
}
|
|
2441
|
-
set selectors(values) {
|
|
2442
|
-
let match = this.selector ? this.selector.match(/,\s*/) : null;
|
|
2443
|
-
let sep2 = match ? match[0] : "," + this.raw("between", "beforeOpen");
|
|
2444
|
-
this.selector = values.join(sep2);
|
|
2445
|
-
}
|
|
2446
|
-
};
|
|
2447
|
-
var rule = Rule$3;
|
|
2448
|
-
Rule$3.default = Rule$3;
|
|
2449
|
-
Container$3.registerRule(Rule$3);
|
|
2450
|
-
let Declaration$2 = declaration;
|
|
2494
|
+
let AtRule$1 = atRule;
|
|
2495
|
+
let Comment$1 = comment;
|
|
2496
|
+
let Declaration$1 = declaration;
|
|
2497
|
+
let Root$3 = root;
|
|
2498
|
+
let Rule$1 = rule;
|
|
2451
2499
|
let tokenizer2 = tokenize;
|
|
2452
|
-
let Comment$2 = comment;
|
|
2453
|
-
let AtRule$2 = atRule;
|
|
2454
|
-
let Root$4 = root;
|
|
2455
|
-
let Rule$2 = rule;
|
|
2456
2500
|
const SAFE_COMMENT_NEIGHBOR = {
|
|
2457
2501
|
empty: true,
|
|
2458
2502
|
space: true
|
|
@@ -2468,7 +2512,7 @@ function findLastWithPosition(tokens) {
|
|
|
2468
2512
|
let Parser$1 = class Parser {
|
|
2469
2513
|
constructor(input2) {
|
|
2470
2514
|
this.input = input2;
|
|
2471
|
-
this.root = new Root$
|
|
2515
|
+
this.root = new Root$3();
|
|
2472
2516
|
this.current = this.root;
|
|
2473
2517
|
this.spaces = "";
|
|
2474
2518
|
this.semicolon = false;
|
|
@@ -2476,7 +2520,7 @@ let Parser$1 = class Parser {
|
|
|
2476
2520
|
this.root.source = { input: input2, start: { column: 1, line: 1, offset: 0 } };
|
|
2477
2521
|
}
|
|
2478
2522
|
atrule(token) {
|
|
2479
|
-
let node2 = new AtRule$
|
|
2523
|
+
let node2 = new AtRule$1();
|
|
2480
2524
|
node2.name = token[1].slice(1);
|
|
2481
2525
|
if (node2.name === "") {
|
|
2482
2526
|
this.unnamedAtrule(node2, token);
|
|
@@ -2559,8 +2603,8 @@ let Parser$1 = class Parser {
|
|
|
2559
2603
|
return;
|
|
2560
2604
|
let founded = 0;
|
|
2561
2605
|
let token;
|
|
2562
|
-
for (let
|
|
2563
|
-
token = tokens[
|
|
2606
|
+
for (let j2 = colon - 1; j2 >= 0; j2--) {
|
|
2607
|
+
token = tokens[j2];
|
|
2564
2608
|
if (token[0] !== "space") {
|
|
2565
2609
|
founded += 1;
|
|
2566
2610
|
if (founded === 2)
|
|
@@ -2574,7 +2618,7 @@ let Parser$1 = class Parser {
|
|
|
2574
2618
|
}
|
|
2575
2619
|
colon(tokens) {
|
|
2576
2620
|
let brackets = 0;
|
|
2577
|
-
let token, type
|
|
2621
|
+
let prev, token, type;
|
|
2578
2622
|
for (let [i, element] of tokens.entries()) {
|
|
2579
2623
|
token = element;
|
|
2580
2624
|
type = token[0];
|
|
@@ -2598,7 +2642,7 @@ let Parser$1 = class Parser {
|
|
|
2598
2642
|
return false;
|
|
2599
2643
|
}
|
|
2600
2644
|
comment(token) {
|
|
2601
|
-
let node2 = new Comment$
|
|
2645
|
+
let node2 = new Comment$1();
|
|
2602
2646
|
this.init(node2, token[2]);
|
|
2603
2647
|
node2.source.end = this.getPosition(token[3] || token[2]);
|
|
2604
2648
|
node2.source.end.offset++;
|
|
@@ -2618,7 +2662,7 @@ let Parser$1 = class Parser {
|
|
|
2618
2662
|
this.tokenizer = tokenizer2(this.input);
|
|
2619
2663
|
}
|
|
2620
2664
|
decl(tokens, customProperty) {
|
|
2621
|
-
let node2 = new Declaration$
|
|
2665
|
+
let node2 = new Declaration$1();
|
|
2622
2666
|
this.init(node2, tokens[0][2]);
|
|
2623
2667
|
let last = tokens[tokens.length - 1];
|
|
2624
2668
|
if (last[0] === ";") {
|
|
@@ -2682,14 +2726,14 @@ let Parser$1 = class Parser {
|
|
|
2682
2726
|
} else if (token[1].toLowerCase() === "important") {
|
|
2683
2727
|
let cache = tokens.slice(0);
|
|
2684
2728
|
let str = "";
|
|
2685
|
-
for (let
|
|
2686
|
-
let type = cache[
|
|
2687
|
-
if (str.trim().
|
|
2729
|
+
for (let j2 = i; j2 > 0; j2--) {
|
|
2730
|
+
let type = cache[j2][0];
|
|
2731
|
+
if (str.trim().startsWith("!") && type !== "space") {
|
|
2688
2732
|
break;
|
|
2689
2733
|
}
|
|
2690
2734
|
str = cache.pop()[1] + str;
|
|
2691
2735
|
}
|
|
2692
|
-
if (str.trim().
|
|
2736
|
+
if (str.trim().startsWith("!")) {
|
|
2693
2737
|
node2.important = true;
|
|
2694
2738
|
node2.raws.important = str;
|
|
2695
2739
|
tokens = cache;
|
|
@@ -2717,7 +2761,7 @@ let Parser$1 = class Parser {
|
|
|
2717
2761
|
);
|
|
2718
2762
|
}
|
|
2719
2763
|
emptyRule(token) {
|
|
2720
|
-
let node2 = new Rule$
|
|
2764
|
+
let node2 = new Rule$1();
|
|
2721
2765
|
this.init(node2, token[2]);
|
|
2722
2766
|
node2.selector = "";
|
|
2723
2767
|
node2.raws.between = "";
|
|
@@ -2754,6 +2798,8 @@ let Parser$1 = class Parser {
|
|
|
2754
2798
|
if (prev && prev.type === "rule" && !prev.raws.ownSemicolon) {
|
|
2755
2799
|
prev.raws.ownSemicolon = this.spaces;
|
|
2756
2800
|
this.spaces = "";
|
|
2801
|
+
prev.source.end = this.getPosition(token[2]);
|
|
2802
|
+
prev.source.end.offset += prev.raws.ownSemicolon.length;
|
|
2757
2803
|
}
|
|
2758
2804
|
}
|
|
2759
2805
|
}
|
|
@@ -2907,7 +2953,7 @@ let Parser$1 = class Parser {
|
|
|
2907
2953
|
}
|
|
2908
2954
|
rule(tokens) {
|
|
2909
2955
|
tokens.pop();
|
|
2910
|
-
let node2 = new Rule$
|
|
2956
|
+
let node2 = new Rule$1();
|
|
2911
2957
|
this.init(node2, tokens[0][2]);
|
|
2912
2958
|
node2.raws.between = this.spacesAndCommentsFromEnd(tokens);
|
|
2913
2959
|
this.raw(node2, "selector", tokens);
|
|
@@ -2975,56 +3021,127 @@ let Parser$1 = class Parser {
|
|
|
2975
3021
|
}
|
|
2976
3022
|
unknownWord(tokens) {
|
|
2977
3023
|
throw this.input.error(
|
|
2978
|
-
"Unknown word",
|
|
3024
|
+
"Unknown word " + tokens[0][1],
|
|
2979
3025
|
{ offset: tokens[0][2] },
|
|
2980
3026
|
{ offset: tokens[0][2] + tokens[0][1].length }
|
|
2981
3027
|
);
|
|
2982
3028
|
}
|
|
2983
|
-
unnamedAtrule(node2, token) {
|
|
2984
|
-
throw this.input.error(
|
|
2985
|
-
"At-rule without name",
|
|
2986
|
-
{ offset: token[2] },
|
|
2987
|
-
{ offset: token[2] + token[1].length }
|
|
2988
|
-
);
|
|
3029
|
+
unnamedAtrule(node2, token) {
|
|
3030
|
+
throw this.input.error(
|
|
3031
|
+
"At-rule without name",
|
|
3032
|
+
{ offset: token[2] },
|
|
3033
|
+
{ offset: token[2] + token[1].length }
|
|
3034
|
+
);
|
|
3035
|
+
}
|
|
3036
|
+
};
|
|
3037
|
+
var parser = Parser$1;
|
|
3038
|
+
let Container$2 = container;
|
|
3039
|
+
let Input$1 = input;
|
|
3040
|
+
let Parser2 = parser;
|
|
3041
|
+
function parse$3(css, opts) {
|
|
3042
|
+
let input2 = new Input$1(css, opts);
|
|
3043
|
+
let parser2 = new Parser2(input2);
|
|
3044
|
+
try {
|
|
3045
|
+
parser2.parse();
|
|
3046
|
+
} catch (e) {
|
|
3047
|
+
if (true) {
|
|
3048
|
+
if (e.name === "CssSyntaxError" && opts && opts.from) {
|
|
3049
|
+
if (/\.scss$/i.test(opts.from)) {
|
|
3050
|
+
e.message += "\nYou tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser";
|
|
3051
|
+
} else if (/\.sass/i.test(opts.from)) {
|
|
3052
|
+
e.message += "\nYou tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser";
|
|
3053
|
+
} else if (/\.less$/i.test(opts.from)) {
|
|
3054
|
+
e.message += "\nYou tried to parse Less with the standard CSS parser; try again with the postcss-less parser";
|
|
3055
|
+
}
|
|
3056
|
+
}
|
|
3057
|
+
}
|
|
3058
|
+
throw e;
|
|
3059
|
+
}
|
|
3060
|
+
return parser2.root;
|
|
3061
|
+
}
|
|
3062
|
+
var parse_1 = parse$3;
|
|
3063
|
+
parse$3.default = parse$3;
|
|
3064
|
+
Container$2.registerParse(parse$3);
|
|
3065
|
+
let Warning$2 = class Warning {
|
|
3066
|
+
constructor(text, opts = {}) {
|
|
3067
|
+
this.type = "warning";
|
|
3068
|
+
this.text = text;
|
|
3069
|
+
if (opts.node && opts.node.source) {
|
|
3070
|
+
let range = opts.node.rangeBy(opts);
|
|
3071
|
+
this.line = range.start.line;
|
|
3072
|
+
this.column = range.start.column;
|
|
3073
|
+
this.endLine = range.end.line;
|
|
3074
|
+
this.endColumn = range.end.column;
|
|
3075
|
+
}
|
|
3076
|
+
for (let opt in opts)
|
|
3077
|
+
this[opt] = opts[opt];
|
|
3078
|
+
}
|
|
3079
|
+
toString() {
|
|
3080
|
+
if (this.node) {
|
|
3081
|
+
return this.node.error(this.text, {
|
|
3082
|
+
index: this.index,
|
|
3083
|
+
plugin: this.plugin,
|
|
3084
|
+
word: this.word
|
|
3085
|
+
}).message;
|
|
3086
|
+
}
|
|
3087
|
+
if (this.plugin) {
|
|
3088
|
+
return this.plugin + ": " + this.text;
|
|
3089
|
+
}
|
|
3090
|
+
return this.text;
|
|
3091
|
+
}
|
|
3092
|
+
};
|
|
3093
|
+
var warning = Warning$2;
|
|
3094
|
+
Warning$2.default = Warning$2;
|
|
3095
|
+
let Warning$1 = warning;
|
|
3096
|
+
let Result$3 = class Result {
|
|
3097
|
+
get content() {
|
|
3098
|
+
return this.css;
|
|
3099
|
+
}
|
|
3100
|
+
constructor(processor2, root2, opts) {
|
|
3101
|
+
this.processor = processor2;
|
|
3102
|
+
this.messages = [];
|
|
3103
|
+
this.root = root2;
|
|
3104
|
+
this.opts = opts;
|
|
3105
|
+
this.css = "";
|
|
3106
|
+
this.map = void 0;
|
|
3107
|
+
}
|
|
3108
|
+
toString() {
|
|
3109
|
+
return this.css;
|
|
2989
3110
|
}
|
|
2990
|
-
}
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
let Input$2 = input;
|
|
2995
|
-
function parse$3(css, opts) {
|
|
2996
|
-
let input2 = new Input$2(css, opts);
|
|
2997
|
-
let parser2 = new Parser2(input2);
|
|
2998
|
-
try {
|
|
2999
|
-
parser2.parse();
|
|
3000
|
-
} catch (e) {
|
|
3001
|
-
if (true) {
|
|
3002
|
-
if (e.name === "CssSyntaxError" && opts && opts.from) {
|
|
3003
|
-
if (/\.scss$/i.test(opts.from)) {
|
|
3004
|
-
e.message += "\nYou tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser";
|
|
3005
|
-
} else if (/\.sass/i.test(opts.from)) {
|
|
3006
|
-
e.message += "\nYou tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser";
|
|
3007
|
-
} else if (/\.less$/i.test(opts.from)) {
|
|
3008
|
-
e.message += "\nYou tried to parse Less with the standard CSS parser; try again with the postcss-less parser";
|
|
3009
|
-
}
|
|
3111
|
+
warn(text, opts = {}) {
|
|
3112
|
+
if (!opts.plugin) {
|
|
3113
|
+
if (this.lastPlugin && this.lastPlugin.postcssPlugin) {
|
|
3114
|
+
opts.plugin = this.lastPlugin.postcssPlugin;
|
|
3010
3115
|
}
|
|
3011
3116
|
}
|
|
3012
|
-
|
|
3117
|
+
let warning2 = new Warning$1(text, opts);
|
|
3118
|
+
this.messages.push(warning2);
|
|
3119
|
+
return warning2;
|
|
3013
3120
|
}
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3121
|
+
warnings() {
|
|
3122
|
+
return this.messages.filter((i) => i.type === "warning");
|
|
3123
|
+
}
|
|
3124
|
+
};
|
|
3125
|
+
var result = Result$3;
|
|
3126
|
+
Result$3.default = Result$3;
|
|
3127
|
+
let printed = {};
|
|
3128
|
+
var warnOnce$2 = function warnOnce(message) {
|
|
3129
|
+
if (printed[message])
|
|
3130
|
+
return;
|
|
3131
|
+
printed[message] = true;
|
|
3132
|
+
if (typeof console !== "undefined" && console.warn) {
|
|
3133
|
+
console.warn(message);
|
|
3134
|
+
}
|
|
3135
|
+
};
|
|
3136
|
+
let Container$1 = container;
|
|
3137
|
+
let Document$3 = document$1;
|
|
3020
3138
|
let MapGenerator$1 = mapGenerator;
|
|
3139
|
+
let parse$2 = parse_1;
|
|
3140
|
+
let Result$2 = result;
|
|
3141
|
+
let Root$2 = root;
|
|
3021
3142
|
let stringify$2 = stringify_1;
|
|
3022
|
-
let
|
|
3023
|
-
let Document$2 = document$1;
|
|
3143
|
+
let { isClean, my } = symbols;
|
|
3024
3144
|
let warnOnce$1 = warnOnce$2;
|
|
3025
|
-
let Result$2 = result;
|
|
3026
|
-
let parse$2 = parse_1;
|
|
3027
|
-
let Root$3 = root;
|
|
3028
3145
|
const TYPE_TO_CLASS_NAME = {
|
|
3029
3146
|
atrule: "AtRule",
|
|
3030
3147
|
comment: "Comment",
|
|
@@ -3110,6 +3227,30 @@ function cleanMarks(node2) {
|
|
|
3110
3227
|
}
|
|
3111
3228
|
let postcss$2 = {};
|
|
3112
3229
|
let LazyResult$2 = class LazyResult {
|
|
3230
|
+
get content() {
|
|
3231
|
+
return this.stringify().content;
|
|
3232
|
+
}
|
|
3233
|
+
get css() {
|
|
3234
|
+
return this.stringify().css;
|
|
3235
|
+
}
|
|
3236
|
+
get map() {
|
|
3237
|
+
return this.stringify().map;
|
|
3238
|
+
}
|
|
3239
|
+
get messages() {
|
|
3240
|
+
return this.sync().messages;
|
|
3241
|
+
}
|
|
3242
|
+
get opts() {
|
|
3243
|
+
return this.result.opts;
|
|
3244
|
+
}
|
|
3245
|
+
get processor() {
|
|
3246
|
+
return this.result.processor;
|
|
3247
|
+
}
|
|
3248
|
+
get root() {
|
|
3249
|
+
return this.sync().root;
|
|
3250
|
+
}
|
|
3251
|
+
get [Symbol.toStringTag]() {
|
|
3252
|
+
return "LazyResult";
|
|
3253
|
+
}
|
|
3113
3254
|
constructor(processor2, css, opts) {
|
|
3114
3255
|
this.stringified = false;
|
|
3115
3256
|
this.processed = false;
|
|
@@ -3471,17 +3612,31 @@ let LazyResult$2 = class LazyResult {
|
|
|
3471
3612
|
warnings() {
|
|
3472
3613
|
return this.sync().warnings();
|
|
3473
3614
|
}
|
|
3615
|
+
};
|
|
3616
|
+
LazyResult$2.registerPostcss = (dependant) => {
|
|
3617
|
+
postcss$2 = dependant;
|
|
3618
|
+
};
|
|
3619
|
+
var lazyResult = LazyResult$2;
|
|
3620
|
+
LazyResult$2.default = LazyResult$2;
|
|
3621
|
+
Root$2.registerLazyResult(LazyResult$2);
|
|
3622
|
+
Document$3.registerLazyResult(LazyResult$2);
|
|
3623
|
+
let MapGenerator2 = mapGenerator;
|
|
3624
|
+
let parse$1 = parse_1;
|
|
3625
|
+
const Result$1 = result;
|
|
3626
|
+
let stringify$1 = stringify_1;
|
|
3627
|
+
let warnOnce2 = warnOnce$2;
|
|
3628
|
+
let NoWorkResult$1 = class NoWorkResult {
|
|
3474
3629
|
get content() {
|
|
3475
|
-
return this.
|
|
3630
|
+
return this.result.css;
|
|
3476
3631
|
}
|
|
3477
3632
|
get css() {
|
|
3478
|
-
return this.
|
|
3633
|
+
return this.result.css;
|
|
3479
3634
|
}
|
|
3480
3635
|
get map() {
|
|
3481
|
-
return this.
|
|
3636
|
+
return this.result.map;
|
|
3482
3637
|
}
|
|
3483
3638
|
get messages() {
|
|
3484
|
-
return
|
|
3639
|
+
return [];
|
|
3485
3640
|
}
|
|
3486
3641
|
get opts() {
|
|
3487
3642
|
return this.result.opts;
|
|
@@ -3490,25 +3645,26 @@ let LazyResult$2 = class LazyResult {
|
|
|
3490
3645
|
return this.result.processor;
|
|
3491
3646
|
}
|
|
3492
3647
|
get root() {
|
|
3493
|
-
|
|
3648
|
+
if (this._root) {
|
|
3649
|
+
return this._root;
|
|
3650
|
+
}
|
|
3651
|
+
let root2;
|
|
3652
|
+
let parser2 = parse$1;
|
|
3653
|
+
try {
|
|
3654
|
+
root2 = parser2(this._css, this._opts);
|
|
3655
|
+
} catch (error) {
|
|
3656
|
+
this.error = error;
|
|
3657
|
+
}
|
|
3658
|
+
if (this.error) {
|
|
3659
|
+
throw this.error;
|
|
3660
|
+
} else {
|
|
3661
|
+
this._root = root2;
|
|
3662
|
+
return root2;
|
|
3663
|
+
}
|
|
3494
3664
|
}
|
|
3495
3665
|
get [Symbol.toStringTag]() {
|
|
3496
|
-
return "
|
|
3666
|
+
return "NoWorkResult";
|
|
3497
3667
|
}
|
|
3498
|
-
};
|
|
3499
|
-
LazyResult$2.registerPostcss = (dependant) => {
|
|
3500
|
-
postcss$2 = dependant;
|
|
3501
|
-
};
|
|
3502
|
-
var lazyResult = LazyResult$2;
|
|
3503
|
-
LazyResult$2.default = LazyResult$2;
|
|
3504
|
-
Root$3.registerLazyResult(LazyResult$2);
|
|
3505
|
-
Document$2.registerLazyResult(LazyResult$2);
|
|
3506
|
-
let MapGenerator2 = mapGenerator;
|
|
3507
|
-
let stringify$1 = stringify_1;
|
|
3508
|
-
let warnOnce2 = warnOnce$2;
|
|
3509
|
-
let parse$1 = parse_1;
|
|
3510
|
-
const Result$1 = result;
|
|
3511
|
-
let NoWorkResult$1 = class NoWorkResult {
|
|
3512
3668
|
constructor(processor2, css, opts) {
|
|
3513
3669
|
css = css.toString();
|
|
3514
3670
|
this.stringified = false;
|
|
@@ -3572,55 +3728,16 @@ let NoWorkResult$1 = class NoWorkResult {
|
|
|
3572
3728
|
warnings() {
|
|
3573
3729
|
return [];
|
|
3574
3730
|
}
|
|
3575
|
-
get content() {
|
|
3576
|
-
return this.result.css;
|
|
3577
|
-
}
|
|
3578
|
-
get css() {
|
|
3579
|
-
return this.result.css;
|
|
3580
|
-
}
|
|
3581
|
-
get map() {
|
|
3582
|
-
return this.result.map;
|
|
3583
|
-
}
|
|
3584
|
-
get messages() {
|
|
3585
|
-
return [];
|
|
3586
|
-
}
|
|
3587
|
-
get opts() {
|
|
3588
|
-
return this.result.opts;
|
|
3589
|
-
}
|
|
3590
|
-
get processor() {
|
|
3591
|
-
return this.result.processor;
|
|
3592
|
-
}
|
|
3593
|
-
get root() {
|
|
3594
|
-
if (this._root) {
|
|
3595
|
-
return this._root;
|
|
3596
|
-
}
|
|
3597
|
-
let root2;
|
|
3598
|
-
let parser2 = parse$1;
|
|
3599
|
-
try {
|
|
3600
|
-
root2 = parser2(this._css, this._opts);
|
|
3601
|
-
} catch (error) {
|
|
3602
|
-
this.error = error;
|
|
3603
|
-
}
|
|
3604
|
-
if (this.error) {
|
|
3605
|
-
throw this.error;
|
|
3606
|
-
} else {
|
|
3607
|
-
this._root = root2;
|
|
3608
|
-
return root2;
|
|
3609
|
-
}
|
|
3610
|
-
}
|
|
3611
|
-
get [Symbol.toStringTag]() {
|
|
3612
|
-
return "NoWorkResult";
|
|
3613
|
-
}
|
|
3614
3731
|
};
|
|
3615
3732
|
var noWorkResult = NoWorkResult$1;
|
|
3616
3733
|
NoWorkResult$1.default = NoWorkResult$1;
|
|
3617
|
-
let
|
|
3734
|
+
let Document$2 = document$1;
|
|
3618
3735
|
let LazyResult$1 = lazyResult;
|
|
3619
|
-
let
|
|
3620
|
-
let Root$
|
|
3736
|
+
let NoWorkResult2 = noWorkResult;
|
|
3737
|
+
let Root$1 = root;
|
|
3621
3738
|
let Processor$1 = class Processor {
|
|
3622
3739
|
constructor(plugins = []) {
|
|
3623
|
-
this.version = "8.
|
|
3740
|
+
this.version = "8.5.6";
|
|
3624
3741
|
this.plugins = this.normalize(plugins);
|
|
3625
3742
|
}
|
|
3626
3743
|
normalize(plugins) {
|
|
@@ -3663,75 +3780,26 @@ let Processor$1 = class Processor {
|
|
|
3663
3780
|
};
|
|
3664
3781
|
var processor = Processor$1;
|
|
3665
3782
|
Processor$1.default = Processor$1;
|
|
3666
|
-
Root$
|
|
3667
|
-
Document$
|
|
3668
|
-
let
|
|
3669
|
-
let
|
|
3670
|
-
let
|
|
3671
|
-
let AtRule$1 = atRule;
|
|
3672
|
-
let Input$1 = input;
|
|
3673
|
-
let Root$1 = root;
|
|
3674
|
-
let Rule$1 = rule;
|
|
3675
|
-
function fromJSON$1(json, inputs) {
|
|
3676
|
-
if (Array.isArray(json))
|
|
3677
|
-
return json.map((n) => fromJSON$1(n));
|
|
3678
|
-
let _a = json, { inputs: ownInputs } = _a, defaults = __objRest(_a, ["inputs"]);
|
|
3679
|
-
if (ownInputs) {
|
|
3680
|
-
inputs = [];
|
|
3681
|
-
for (let input2 of ownInputs) {
|
|
3682
|
-
let inputHydrated = __spreadProps(__spreadValues({}, input2), { __proto__: Input$1.prototype });
|
|
3683
|
-
if (inputHydrated.map) {
|
|
3684
|
-
inputHydrated.map = __spreadProps(__spreadValues({}, inputHydrated.map), {
|
|
3685
|
-
__proto__: PreviousMap2.prototype
|
|
3686
|
-
});
|
|
3687
|
-
}
|
|
3688
|
-
inputs.push(inputHydrated);
|
|
3689
|
-
}
|
|
3690
|
-
}
|
|
3691
|
-
if (defaults.nodes) {
|
|
3692
|
-
defaults.nodes = json.nodes.map((n) => fromJSON$1(n, inputs));
|
|
3693
|
-
}
|
|
3694
|
-
if (defaults.source) {
|
|
3695
|
-
let _b = defaults.source, { inputId } = _b, source = __objRest(_b, ["inputId"]);
|
|
3696
|
-
defaults.source = source;
|
|
3697
|
-
if (inputId != null) {
|
|
3698
|
-
defaults.source.input = inputs[inputId];
|
|
3699
|
-
}
|
|
3700
|
-
}
|
|
3701
|
-
if (defaults.type === "root") {
|
|
3702
|
-
return new Root$1(defaults);
|
|
3703
|
-
} else if (defaults.type === "decl") {
|
|
3704
|
-
return new Declaration$1(defaults);
|
|
3705
|
-
} else if (defaults.type === "rule") {
|
|
3706
|
-
return new Rule$1(defaults);
|
|
3707
|
-
} else if (defaults.type === "comment") {
|
|
3708
|
-
return new Comment$1(defaults);
|
|
3709
|
-
} else if (defaults.type === "atrule") {
|
|
3710
|
-
return new AtRule$1(defaults);
|
|
3711
|
-
} else {
|
|
3712
|
-
throw new Error("Unknown node type: " + json.type);
|
|
3713
|
-
}
|
|
3714
|
-
}
|
|
3715
|
-
var fromJSON_1 = fromJSON$1;
|
|
3716
|
-
fromJSON$1.default = fromJSON$1;
|
|
3783
|
+
Root$1.registerProcessor(Processor$1);
|
|
3784
|
+
Document$2.registerProcessor(Processor$1);
|
|
3785
|
+
let AtRule2 = atRule;
|
|
3786
|
+
let Comment2 = comment;
|
|
3787
|
+
let Container2 = container;
|
|
3717
3788
|
let CssSyntaxError2 = cssSyntaxError;
|
|
3718
3789
|
let Declaration2 = declaration;
|
|
3719
|
-
let
|
|
3720
|
-
let Container2 = container;
|
|
3721
|
-
let Processor2 = processor;
|
|
3722
|
-
let stringify = stringify_1;
|
|
3790
|
+
let Document$1 = document$1;
|
|
3723
3791
|
let fromJSON = fromJSON_1;
|
|
3724
|
-
let Document22 = document$1;
|
|
3725
|
-
let Warning2 = warning;
|
|
3726
|
-
let Comment2 = comment;
|
|
3727
|
-
let AtRule2 = atRule;
|
|
3728
|
-
let Result2 = result;
|
|
3729
3792
|
let Input2 = input;
|
|
3730
|
-
let
|
|
3793
|
+
let LazyResult2 = lazyResult;
|
|
3731
3794
|
let list = list_1;
|
|
3732
|
-
let Rule2 = rule;
|
|
3733
|
-
let Root2 = root;
|
|
3734
3795
|
let Node$1 = node;
|
|
3796
|
+
let parse = parse_1;
|
|
3797
|
+
let Processor2 = processor;
|
|
3798
|
+
let Result2 = result;
|
|
3799
|
+
let Root2 = root;
|
|
3800
|
+
let Rule2 = rule;
|
|
3801
|
+
let stringify = stringify_1;
|
|
3802
|
+
let Warning2 = warning;
|
|
3735
3803
|
function postcss(...plugins) {
|
|
3736
3804
|
if (plugins.length === 1 && Array.isArray(plugins[0])) {
|
|
3737
3805
|
plugins = plugins[0];
|
|
@@ -3779,12 +3847,12 @@ postcss.atRule = (defaults) => new AtRule2(defaults);
|
|
|
3779
3847
|
postcss.decl = (defaults) => new Declaration2(defaults);
|
|
3780
3848
|
postcss.rule = (defaults) => new Rule2(defaults);
|
|
3781
3849
|
postcss.root = (defaults) => new Root2(defaults);
|
|
3782
|
-
postcss.document = (defaults) => new
|
|
3850
|
+
postcss.document = (defaults) => new Document$1(defaults);
|
|
3783
3851
|
postcss.CssSyntaxError = CssSyntaxError2;
|
|
3784
3852
|
postcss.Declaration = Declaration2;
|
|
3785
3853
|
postcss.Container = Container2;
|
|
3786
3854
|
postcss.Processor = Processor2;
|
|
3787
|
-
postcss.Document =
|
|
3855
|
+
postcss.Document = Document$1;
|
|
3788
3856
|
postcss.Comment = Comment2;
|
|
3789
3857
|
postcss.Warning = Warning2;
|
|
3790
3858
|
postcss.AtRule = AtRule2;
|
|
@@ -4744,7 +4812,7 @@ exports.RRMediaElement = RRMediaElement;
|
|
|
4744
4812
|
exports.RRStyleElement = RRStyleElement;
|
|
4745
4813
|
exports.RRText = RRText;
|
|
4746
4814
|
exports.RRWindow = RRWindow;
|
|
4747
|
-
if (typeof module.exports == "object" && typeof exports == "object") {
|
|
4815
|
+
;if (typeof module.exports == "object" && typeof exports == "object") {
|
|
4748
4816
|
var __cp = (to, from, except, desc) => {
|
|
4749
4817
|
if ((from && typeof from === "object") || typeof from === "function") {
|
|
4750
4818
|
for (let key of Object.getOwnPropertyNames(from)) {
|