@posthog/rrweb-snapshot 0.0.6 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/rrweb-snapshot.cjs +1606 -1424
- package/dist/rrweb-snapshot.cjs.map +1 -1
- package/dist/rrweb-snapshot.js +1606 -1424
- package/dist/rrweb-snapshot.js.map +1 -1
- package/dist/rrweb-snapshot.umd.cjs +1609 -1427
- package/dist/rrweb-snapshot.umd.cjs.map +4 -4
- package/dist/rrweb-snapshot.umd.min.cjs +16 -14
- package/dist/rrweb-snapshot.umd.min.cjs.map +4 -4
- package/package.json +4 -2
package/dist/rrweb-snapshot.js
CHANGED
|
@@ -1534,7 +1534,7 @@ function getAugmentedNamespace(n) {
|
|
|
1534
1534
|
var picocolors_browser = { exports: {} };
|
|
1535
1535
|
var x = String;
|
|
1536
1536
|
var create = function() {
|
|
1537
|
-
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 };
|
|
1537
|
+
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 };
|
|
1538
1538
|
};
|
|
1539
1539
|
picocolors_browser.exports = create();
|
|
1540
1540
|
picocolors_browser.exports.createColors = create;
|
|
@@ -1547,8 +1547,8 @@ const __viteBrowserExternal$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Ob
|
|
|
1547
1547
|
const require$$2 = /* @__PURE__ */ getAugmentedNamespace(__viteBrowserExternal$1);
|
|
1548
1548
|
let pico = picocolors_browserExports;
|
|
1549
1549
|
let terminalHighlight$1 = require$$2;
|
|
1550
|
-
let CssSyntaxError$
|
|
1551
|
-
constructor(message, line, column, source, file,
|
|
1550
|
+
let CssSyntaxError$4 = class CssSyntaxError extends Error {
|
|
1551
|
+
constructor(message, line, column, source, file, plugin3) {
|
|
1552
1552
|
super(message);
|
|
1553
1553
|
this.name = "CssSyntaxError";
|
|
1554
1554
|
this.reason = message;
|
|
@@ -1558,8 +1558,8 @@ let CssSyntaxError$3 = class CssSyntaxError extends Error {
|
|
|
1558
1558
|
if (source) {
|
|
1559
1559
|
this.source = source;
|
|
1560
1560
|
}
|
|
1561
|
-
if (
|
|
1562
|
-
this.plugin =
|
|
1561
|
+
if (plugin3) {
|
|
1562
|
+
this.plugin = plugin3;
|
|
1563
1563
|
}
|
|
1564
1564
|
if (typeof line !== "undefined" && typeof column !== "undefined") {
|
|
1565
1565
|
if (typeof line === "number") {
|
|
@@ -1589,29 +1589,40 @@ let CssSyntaxError$3 = class CssSyntaxError extends Error {
|
|
|
1589
1589
|
if (!this.source) return "";
|
|
1590
1590
|
let css = this.source;
|
|
1591
1591
|
if (color == null) color = pico.isColorSupported;
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
let lines = css.split(/\r?\n/);
|
|
1596
|
-
let start = Math.max(this.line - 3, 0);
|
|
1597
|
-
let end = Math.min(this.line + 2, lines.length);
|
|
1598
|
-
let maxWidth = String(end).length;
|
|
1599
|
-
let mark, aside;
|
|
1592
|
+
let aside = (text) => text;
|
|
1593
|
+
let mark = (text) => text;
|
|
1594
|
+
let highlight = (text) => text;
|
|
1600
1595
|
if (color) {
|
|
1601
1596
|
let { bold, gray, red } = pico.createColors(true);
|
|
1602
1597
|
mark = (text) => bold(red(text));
|
|
1603
1598
|
aside = (text) => gray(text);
|
|
1604
|
-
|
|
1605
|
-
|
|
1599
|
+
if (terminalHighlight$1) {
|
|
1600
|
+
highlight = (text) => terminalHighlight$1(text);
|
|
1601
|
+
}
|
|
1606
1602
|
}
|
|
1603
|
+
let lines = css.split(/\r?\n/);
|
|
1604
|
+
let start = Math.max(this.line - 3, 0);
|
|
1605
|
+
let end = Math.min(this.line + 2, lines.length);
|
|
1606
|
+
let maxWidth = String(end).length;
|
|
1607
1607
|
return lines.slice(start, end).map((line, index2) => {
|
|
1608
1608
|
let number = start + 1 + index2;
|
|
1609
1609
|
let gutter = " " + (" " + number).slice(-maxWidth) + " | ";
|
|
1610
1610
|
if (number === this.line) {
|
|
1611
|
+
if (line.length > 160) {
|
|
1612
|
+
let padding = 20;
|
|
1613
|
+
let subLineStart = Math.max(0, this.column - padding);
|
|
1614
|
+
let subLineEnd = Math.max(
|
|
1615
|
+
this.column + padding,
|
|
1616
|
+
this.endColumn + padding
|
|
1617
|
+
);
|
|
1618
|
+
let subLine = line.slice(subLineStart, subLineEnd);
|
|
1619
|
+
let spacing2 = aside(gutter.replace(/\d/g, " ")) + line.slice(0, Math.min(this.column - 1, padding - 1)).replace(/[^\t]/g, " ");
|
|
1620
|
+
return mark(">") + aside(gutter) + highlight(subLine) + "\n " + spacing2 + mark("^");
|
|
1621
|
+
}
|
|
1611
1622
|
let spacing = aside(gutter.replace(/\d/g, " ")) + line.slice(0, this.column - 1).replace(/[^\t]/g, " ");
|
|
1612
|
-
return mark(">") + aside(gutter) + line + "\n " + spacing + mark("^");
|
|
1623
|
+
return mark(">") + aside(gutter) + highlight(line) + "\n " + spacing + mark("^");
|
|
1613
1624
|
}
|
|
1614
|
-
return " " + aside(gutter) + line;
|
|
1625
|
+
return " " + aside(gutter) + highlight(line);
|
|
1615
1626
|
}).join("\n");
|
|
1616
1627
|
}
|
|
1617
1628
|
toString() {
|
|
@@ -1622,11 +1633,8 @@ let CssSyntaxError$3 = class CssSyntaxError extends Error {
|
|
|
1622
1633
|
return this.name + ": " + this.message + code;
|
|
1623
1634
|
}
|
|
1624
1635
|
};
|
|
1625
|
-
var cssSyntaxError = CssSyntaxError$
|
|
1626
|
-
CssSyntaxError$
|
|
1627
|
-
var symbols = {};
|
|
1628
|
-
symbols.isClean = Symbol("isClean");
|
|
1629
|
-
symbols.my = Symbol("my");
|
|
1636
|
+
var cssSyntaxError = CssSyntaxError$4;
|
|
1637
|
+
CssSyntaxError$4.default = CssSyntaxError$4;
|
|
1630
1638
|
const DEFAULT_RAW = {
|
|
1631
1639
|
after: "\n",
|
|
1632
1640
|
beforeClose: "\n",
|
|
@@ -1925,16 +1933,19 @@ let Stringifier$2 = class Stringifier {
|
|
|
1925
1933
|
var stringifier = Stringifier$2;
|
|
1926
1934
|
Stringifier$2.default = Stringifier$2;
|
|
1927
1935
|
let Stringifier$1 = stringifier;
|
|
1928
|
-
function stringify$
|
|
1936
|
+
function stringify$5(node2, builder) {
|
|
1929
1937
|
let str = new Stringifier$1(builder);
|
|
1930
1938
|
str.stringify(node2);
|
|
1931
1939
|
}
|
|
1932
|
-
var stringify_1 = stringify$
|
|
1933
|
-
stringify$
|
|
1934
|
-
|
|
1935
|
-
|
|
1940
|
+
var stringify_1 = stringify$5;
|
|
1941
|
+
stringify$5.default = stringify$5;
|
|
1942
|
+
var symbols = {};
|
|
1943
|
+
symbols.isClean = Symbol("isClean");
|
|
1944
|
+
symbols.my = Symbol("my");
|
|
1945
|
+
let CssSyntaxError$3 = cssSyntaxError;
|
|
1936
1946
|
let Stringifier2 = stringifier;
|
|
1937
|
-
let stringify$
|
|
1947
|
+
let stringify$4 = stringify_1;
|
|
1948
|
+
let { isClean: isClean$2, my: my$2 } = symbols;
|
|
1938
1949
|
function cloneNode(obj, parent) {
|
|
1939
1950
|
let cloned = new obj.constructor();
|
|
1940
1951
|
for (let i in obj) {
|
|
@@ -1957,7 +1968,28 @@ function cloneNode(obj, parent) {
|
|
|
1957
1968
|
}
|
|
1958
1969
|
return cloned;
|
|
1959
1970
|
}
|
|
1960
|
-
|
|
1971
|
+
function sourceOffset(inputCSS, position) {
|
|
1972
|
+
if (position && typeof position.offset !== "undefined") {
|
|
1973
|
+
return position.offset;
|
|
1974
|
+
}
|
|
1975
|
+
let column = 1;
|
|
1976
|
+
let line = 1;
|
|
1977
|
+
let offset = 0;
|
|
1978
|
+
for (let i = 0; i < inputCSS.length; i++) {
|
|
1979
|
+
if (line === position.line && column === position.column) {
|
|
1980
|
+
offset = i;
|
|
1981
|
+
break;
|
|
1982
|
+
}
|
|
1983
|
+
if (inputCSS[i] === "\n") {
|
|
1984
|
+
column = 1;
|
|
1985
|
+
line += 1;
|
|
1986
|
+
} else {
|
|
1987
|
+
column += 1;
|
|
1988
|
+
}
|
|
1989
|
+
}
|
|
1990
|
+
return offset;
|
|
1991
|
+
}
|
|
1992
|
+
let Node$5 = class Node {
|
|
1961
1993
|
constructor(defaults = {}) {
|
|
1962
1994
|
this.raws = {};
|
|
1963
1995
|
this[isClean$2] = false;
|
|
@@ -2034,7 +2066,7 @@ let Node$4 = class Node {
|
|
|
2034
2066
|
opts
|
|
2035
2067
|
);
|
|
2036
2068
|
}
|
|
2037
|
-
return new CssSyntaxError$
|
|
2069
|
+
return new CssSyntaxError$3(message);
|
|
2038
2070
|
}
|
|
2039
2071
|
getProxyProcessor() {
|
|
2040
2072
|
return {
|
|
@@ -2058,6 +2090,10 @@ let Node$4 = class Node {
|
|
|
2058
2090
|
}
|
|
2059
2091
|
};
|
|
2060
2092
|
}
|
|
2093
|
+
/* c8 ignore next 3 */
|
|
2094
|
+
markClean() {
|
|
2095
|
+
this[isClean$2] = true;
|
|
2096
|
+
}
|
|
2061
2097
|
markDirty() {
|
|
2062
2098
|
if (this[isClean$2]) {
|
|
2063
2099
|
this[isClean$2] = false;
|
|
@@ -2072,23 +2108,29 @@ let Node$4 = class Node {
|
|
|
2072
2108
|
let index2 = this.parent.index(this);
|
|
2073
2109
|
return this.parent.nodes[index2 + 1];
|
|
2074
2110
|
}
|
|
2075
|
-
positionBy(opts
|
|
2111
|
+
positionBy(opts) {
|
|
2076
2112
|
let pos = this.source.start;
|
|
2077
2113
|
if (opts.index) {
|
|
2078
|
-
pos = this.positionInside(opts.index
|
|
2114
|
+
pos = this.positionInside(opts.index);
|
|
2079
2115
|
} else if (opts.word) {
|
|
2080
|
-
|
|
2116
|
+
let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
|
|
2117
|
+
let stringRepresentation = inputString.slice(
|
|
2118
|
+
sourceOffset(inputString, this.source.start),
|
|
2119
|
+
sourceOffset(inputString, this.source.end)
|
|
2120
|
+
);
|
|
2081
2121
|
let index2 = stringRepresentation.indexOf(opts.word);
|
|
2082
|
-
if (index2 !== -1) pos = this.positionInside(index2
|
|
2122
|
+
if (index2 !== -1) pos = this.positionInside(index2);
|
|
2083
2123
|
}
|
|
2084
2124
|
return pos;
|
|
2085
2125
|
}
|
|
2086
|
-
positionInside(index2
|
|
2087
|
-
let string = stringRepresentation || this.toString();
|
|
2126
|
+
positionInside(index2) {
|
|
2088
2127
|
let column = this.source.start.column;
|
|
2089
2128
|
let line = this.source.start.line;
|
|
2090
|
-
|
|
2091
|
-
|
|
2129
|
+
let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
|
|
2130
|
+
let offset = sourceOffset(inputString, this.source.start);
|
|
2131
|
+
let end = offset + index2;
|
|
2132
|
+
for (let i = offset; i < end; i++) {
|
|
2133
|
+
if (inputString[i] === "\n") {
|
|
2092
2134
|
column = 1;
|
|
2093
2135
|
line += 1;
|
|
2094
2136
|
} else {
|
|
@@ -2115,11 +2157,17 @@ let Node$4 = class Node {
|
|
|
2115
2157
|
line: start.line
|
|
2116
2158
|
};
|
|
2117
2159
|
if (opts.word) {
|
|
2118
|
-
let
|
|
2160
|
+
let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
|
|
2161
|
+
let stringRepresentation = inputString.slice(
|
|
2162
|
+
sourceOffset(inputString, this.source.start),
|
|
2163
|
+
sourceOffset(inputString, this.source.end)
|
|
2164
|
+
);
|
|
2119
2165
|
let index2 = stringRepresentation.indexOf(opts.word);
|
|
2120
2166
|
if (index2 !== -1) {
|
|
2121
|
-
start = this.positionInside(index2
|
|
2122
|
-
end = this.positionInside(
|
|
2167
|
+
start = this.positionInside(index2);
|
|
2168
|
+
end = this.positionInside(
|
|
2169
|
+
index2 + opts.word.length
|
|
2170
|
+
);
|
|
2123
2171
|
}
|
|
2124
2172
|
} else {
|
|
2125
2173
|
if (opts.start) {
|
|
@@ -2232,7 +2280,7 @@ let Node$4 = class Node {
|
|
|
2232
2280
|
}
|
|
2233
2281
|
return this.proxyCache;
|
|
2234
2282
|
}
|
|
2235
|
-
toString(stringifier2 = stringify$
|
|
2283
|
+
toString(stringifier2 = stringify$4) {
|
|
2236
2284
|
if (stringifier2.stringify) stringifier2 = stringifier2.stringify;
|
|
2237
2285
|
let result2 = "";
|
|
2238
2286
|
stringifier2(this, (i) => {
|
|
@@ -2249,10 +2297,19 @@ let Node$4 = class Node {
|
|
|
2249
2297
|
return this;
|
|
2250
2298
|
}
|
|
2251
2299
|
};
|
|
2252
|
-
var node = Node$
|
|
2253
|
-
Node$
|
|
2300
|
+
var node = Node$5;
|
|
2301
|
+
Node$5.default = Node$5;
|
|
2302
|
+
let Node$4 = node;
|
|
2303
|
+
let Comment$6 = class Comment extends Node$4 {
|
|
2304
|
+
constructor(defaults) {
|
|
2305
|
+
super(defaults);
|
|
2306
|
+
this.type = "comment";
|
|
2307
|
+
}
|
|
2308
|
+
};
|
|
2309
|
+
var comment$1 = Comment$6;
|
|
2310
|
+
Comment$6.default = Comment$6;
|
|
2254
2311
|
let Node$3 = node;
|
|
2255
|
-
let Declaration$
|
|
2312
|
+
let Declaration$5 = class Declaration extends Node$3 {
|
|
2256
2313
|
constructor(defaults) {
|
|
2257
2314
|
if (defaults && typeof defaults.value !== "undefined" && typeof defaults.value !== "string") {
|
|
2258
2315
|
defaults = { ...defaults, value: String(defaults.value) };
|
|
@@ -2264,1120 +2321,1233 @@ let Declaration$4 = class Declaration extends Node$3 {
|
|
|
2264
2321
|
return this.prop.startsWith("--") || this.prop[0] === "$";
|
|
2265
2322
|
}
|
|
2266
2323
|
};
|
|
2267
|
-
var declaration = Declaration$
|
|
2268
|
-
Declaration$
|
|
2269
|
-
let
|
|
2270
|
-
let
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2324
|
+
var declaration = Declaration$5;
|
|
2325
|
+
Declaration$5.default = Declaration$5;
|
|
2326
|
+
let Comment$5 = comment$1;
|
|
2327
|
+
let Declaration$4 = declaration;
|
|
2328
|
+
let Node$2 = node;
|
|
2329
|
+
let { isClean: isClean$1, my: my$1 } = symbols;
|
|
2330
|
+
let AtRule$5, parse$5, Root$7, Rule$5;
|
|
2331
|
+
function cleanSource(nodes) {
|
|
2332
|
+
return nodes.map((i) => {
|
|
2333
|
+
if (i.nodes) i.nodes = cleanSource(i.nodes);
|
|
2334
|
+
delete i.source;
|
|
2335
|
+
return i;
|
|
2336
|
+
});
|
|
2337
|
+
}
|
|
2338
|
+
function markTreeDirty(node2) {
|
|
2339
|
+
node2[isClean$1] = false;
|
|
2340
|
+
if (node2.proxyOf.nodes) {
|
|
2341
|
+
for (let i of node2.proxyOf.nodes) {
|
|
2342
|
+
markTreeDirty(i);
|
|
2276
2343
|
}
|
|
2277
|
-
return id;
|
|
2278
|
-
};
|
|
2279
|
-
};
|
|
2280
|
-
let nanoid$1 = (size = 21) => {
|
|
2281
|
-
let id = "";
|
|
2282
|
-
let i = size;
|
|
2283
|
-
while (i--) {
|
|
2284
|
-
id += urlAlphabet[Math.random() * 64 | 0];
|
|
2285
|
-
}
|
|
2286
|
-
return id;
|
|
2287
|
-
};
|
|
2288
|
-
var nonSecure = { nanoid: nanoid$1, customAlphabet };
|
|
2289
|
-
let { SourceMapConsumer: SourceMapConsumer$2, SourceMapGenerator: SourceMapGenerator$2 } = require$$2;
|
|
2290
|
-
let { existsSync, readFileSync } = require$$2;
|
|
2291
|
-
let { dirname: dirname$1, join } = require$$2;
|
|
2292
|
-
function fromBase64(str) {
|
|
2293
|
-
if (Buffer) {
|
|
2294
|
-
return Buffer.from(str, "base64").toString();
|
|
2295
|
-
} else {
|
|
2296
|
-
return window.atob(str);
|
|
2297
2344
|
}
|
|
2298
2345
|
}
|
|
2299
|
-
let
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
let prev = opts.map ? opts.map.prev : void 0;
|
|
2305
|
-
let text = this.loadMap(opts.from, prev);
|
|
2306
|
-
if (!this.mapFile && opts.from) {
|
|
2307
|
-
this.mapFile = opts.from;
|
|
2346
|
+
let Container$8 = class Container extends Node$2 {
|
|
2347
|
+
append(...children) {
|
|
2348
|
+
for (let child of children) {
|
|
2349
|
+
let nodes = this.normalize(child, this.last);
|
|
2350
|
+
for (let node2 of nodes) this.proxyOf.nodes.push(node2);
|
|
2308
2351
|
}
|
|
2309
|
-
|
|
2310
|
-
|
|
2352
|
+
this.markDirty();
|
|
2353
|
+
return this;
|
|
2311
2354
|
}
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2355
|
+
cleanRaws(keepBetween) {
|
|
2356
|
+
super.cleanRaws(keepBetween);
|
|
2357
|
+
if (this.nodes) {
|
|
2358
|
+
for (let node2 of this.nodes) node2.cleanRaws(keepBetween);
|
|
2315
2359
|
}
|
|
2316
|
-
return this.consumerCache;
|
|
2317
2360
|
}
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
let
|
|
2321
|
-
let
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
return fromBase64(text.substr(RegExp.lastMatch.length));
|
|
2361
|
+
each(callback) {
|
|
2362
|
+
if (!this.proxyOf.nodes) return void 0;
|
|
2363
|
+
let iterator = this.getIterator();
|
|
2364
|
+
let index2, result2;
|
|
2365
|
+
while (this.indexes[iterator] < this.proxyOf.nodes.length) {
|
|
2366
|
+
index2 = this.indexes[iterator];
|
|
2367
|
+
result2 = callback(this.proxyOf.nodes[index2], index2);
|
|
2368
|
+
if (result2 === false) break;
|
|
2369
|
+
this.indexes[iterator] += 1;
|
|
2328
2370
|
}
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
}
|
|
2332
|
-
getAnnotationURL(sourceMapString) {
|
|
2333
|
-
return sourceMapString.replace(/^\/\*\s*# sourceMappingURL=/, "").trim();
|
|
2334
|
-
}
|
|
2335
|
-
isMap(map) {
|
|
2336
|
-
if (typeof map !== "object") return false;
|
|
2337
|
-
return typeof map.mappings === "string" || typeof map._mappings === "string" || Array.isArray(map.sections);
|
|
2371
|
+
delete this.indexes[iterator];
|
|
2372
|
+
return result2;
|
|
2338
2373
|
}
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
if (!comments) return;
|
|
2342
|
-
let start = css.lastIndexOf(comments.pop());
|
|
2343
|
-
let end = css.indexOf("*/", start);
|
|
2344
|
-
if (start > -1 && end > -1) {
|
|
2345
|
-
this.annotation = this.getAnnotationURL(css.substring(start, end));
|
|
2346
|
-
}
|
|
2374
|
+
every(condition) {
|
|
2375
|
+
return this.nodes.every(condition);
|
|
2347
2376
|
}
|
|
2348
|
-
|
|
2349
|
-
this.
|
|
2350
|
-
if (
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2377
|
+
getIterator() {
|
|
2378
|
+
if (!this.lastEach) this.lastEach = 0;
|
|
2379
|
+
if (!this.indexes) this.indexes = {};
|
|
2380
|
+
this.lastEach += 1;
|
|
2381
|
+
let iterator = this.lastEach;
|
|
2382
|
+
this.indexes[iterator] = 0;
|
|
2383
|
+
return iterator;
|
|
2354
2384
|
}
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
if (
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2385
|
+
getProxyProcessor() {
|
|
2386
|
+
return {
|
|
2387
|
+
get(node2, prop) {
|
|
2388
|
+
if (prop === "proxyOf") {
|
|
2389
|
+
return node2;
|
|
2390
|
+
} else if (!node2[prop]) {
|
|
2391
|
+
return node2[prop];
|
|
2392
|
+
} else if (prop === "each" || typeof prop === "string" && prop.startsWith("walk")) {
|
|
2393
|
+
return (...args) => {
|
|
2394
|
+
return node2[prop](
|
|
2395
|
+
...args.map((i) => {
|
|
2396
|
+
if (typeof i === "function") {
|
|
2397
|
+
return (child, index2) => i(child.toProxy(), index2);
|
|
2398
|
+
} else {
|
|
2399
|
+
return i;
|
|
2400
|
+
}
|
|
2401
|
+
})
|
|
2367
2402
|
);
|
|
2368
|
-
}
|
|
2369
|
-
|
|
2403
|
+
};
|
|
2404
|
+
} else if (prop === "every" || prop === "some") {
|
|
2405
|
+
return (cb) => {
|
|
2406
|
+
return node2[prop](
|
|
2407
|
+
(child, ...other) => cb(child.toProxy(), ...other)
|
|
2408
|
+
);
|
|
2409
|
+
};
|
|
2410
|
+
} else if (prop === "root") {
|
|
2411
|
+
return () => node2.root().toProxy();
|
|
2412
|
+
} else if (prop === "nodes") {
|
|
2413
|
+
return node2.nodes.map((i) => i.toProxy());
|
|
2414
|
+
} else if (prop === "first" || prop === "last") {
|
|
2415
|
+
return node2[prop].toProxy();
|
|
2416
|
+
} else {
|
|
2417
|
+
return node2[prop];
|
|
2370
2418
|
}
|
|
2371
|
-
}
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
"Unsupported previous source map format: " + prev.toString()
|
|
2380
|
-
);
|
|
2419
|
+
},
|
|
2420
|
+
set(node2, prop, value) {
|
|
2421
|
+
if (node2[prop] === value) return true;
|
|
2422
|
+
node2[prop] = value;
|
|
2423
|
+
if (prop === "name" || prop === "params" || prop === "selector") {
|
|
2424
|
+
node2.markDirty();
|
|
2425
|
+
}
|
|
2426
|
+
return true;
|
|
2381
2427
|
}
|
|
2382
|
-
}
|
|
2383
|
-
return this.decodeInline(this.annotation);
|
|
2384
|
-
} else if (this.annotation) {
|
|
2385
|
-
let map = this.annotation;
|
|
2386
|
-
if (file) map = join(dirname$1(file), map);
|
|
2387
|
-
return this.loadFile(map);
|
|
2388
|
-
}
|
|
2428
|
+
};
|
|
2389
2429
|
}
|
|
2390
|
-
|
|
2391
|
-
if (
|
|
2392
|
-
|
|
2430
|
+
index(child) {
|
|
2431
|
+
if (typeof child === "number") return child;
|
|
2432
|
+
if (child.proxyOf) child = child.proxyOf;
|
|
2433
|
+
return this.proxyOf.nodes.indexOf(child);
|
|
2393
2434
|
}
|
|
2394
|
-
|
|
2395
|
-
|
|
2435
|
+
insertAfter(exist, add) {
|
|
2436
|
+
let existIndex = this.index(exist);
|
|
2437
|
+
let nodes = this.normalize(add, this.proxyOf.nodes[existIndex]).reverse();
|
|
2438
|
+
existIndex = this.index(exist);
|
|
2439
|
+
for (let node2 of nodes) this.proxyOf.nodes.splice(existIndex + 1, 0, node2);
|
|
2440
|
+
let index2;
|
|
2441
|
+
for (let id in this.indexes) {
|
|
2442
|
+
index2 = this.indexes[id];
|
|
2443
|
+
if (existIndex < index2) {
|
|
2444
|
+
this.indexes[id] = index2 + nodes.length;
|
|
2445
|
+
}
|
|
2446
|
+
}
|
|
2447
|
+
this.markDirty();
|
|
2448
|
+
return this;
|
|
2396
2449
|
}
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
let
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
let
|
|
2407
|
-
let
|
|
2408
|
-
let
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
throw new Error(`PostCSS received ${css} instead of CSS string`);
|
|
2450
|
+
insertBefore(exist, add) {
|
|
2451
|
+
let existIndex = this.index(exist);
|
|
2452
|
+
let type = existIndex === 0 ? "prepend" : false;
|
|
2453
|
+
let nodes = this.normalize(
|
|
2454
|
+
add,
|
|
2455
|
+
this.proxyOf.nodes[existIndex],
|
|
2456
|
+
type
|
|
2457
|
+
).reverse();
|
|
2458
|
+
existIndex = this.index(exist);
|
|
2459
|
+
for (let node2 of nodes) this.proxyOf.nodes.splice(existIndex, 0, node2);
|
|
2460
|
+
let index2;
|
|
2461
|
+
for (let id in this.indexes) {
|
|
2462
|
+
index2 = this.indexes[id];
|
|
2463
|
+
if (existIndex <= index2) {
|
|
2464
|
+
this.indexes[id] = index2 + nodes.length;
|
|
2465
|
+
}
|
|
2414
2466
|
}
|
|
2415
|
-
this.
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2467
|
+
this.markDirty();
|
|
2468
|
+
return this;
|
|
2469
|
+
}
|
|
2470
|
+
normalize(nodes, sample) {
|
|
2471
|
+
if (typeof nodes === "string") {
|
|
2472
|
+
nodes = cleanSource(parse$5(nodes).nodes);
|
|
2473
|
+
} else if (typeof nodes === "undefined") {
|
|
2474
|
+
nodes = [];
|
|
2475
|
+
} else if (Array.isArray(nodes)) {
|
|
2476
|
+
nodes = nodes.slice(0);
|
|
2477
|
+
for (let i of nodes) {
|
|
2478
|
+
if (i.parent) i.parent.removeChild(i, "ignore");
|
|
2479
|
+
}
|
|
2480
|
+
} else if (nodes.type === "root" && this.type !== "document") {
|
|
2481
|
+
nodes = nodes.nodes.slice(0);
|
|
2482
|
+
for (let i of nodes) {
|
|
2483
|
+
if (i.parent) i.parent.removeChild(i, "ignore");
|
|
2484
|
+
}
|
|
2485
|
+
} else if (nodes.type) {
|
|
2486
|
+
nodes = [nodes];
|
|
2487
|
+
} else if (nodes.prop) {
|
|
2488
|
+
if (typeof nodes.value === "undefined") {
|
|
2489
|
+
throw new Error("Value field is missed in node creation");
|
|
2490
|
+
} else if (typeof nodes.value !== "string") {
|
|
2491
|
+
nodes.value = String(nodes.value);
|
|
2492
|
+
}
|
|
2493
|
+
nodes = [new Declaration$4(nodes)];
|
|
2494
|
+
} else if (nodes.selector || nodes.selectors) {
|
|
2495
|
+
nodes = [new Rule$5(nodes)];
|
|
2496
|
+
} else if (nodes.name) {
|
|
2497
|
+
nodes = [new AtRule$5(nodes)];
|
|
2498
|
+
} else if (nodes.text) {
|
|
2499
|
+
nodes = [new Comment$5(nodes)];
|
|
2419
2500
|
} else {
|
|
2420
|
-
|
|
2501
|
+
throw new Error("Unknown node type in node creation");
|
|
2421
2502
|
}
|
|
2422
|
-
|
|
2423
|
-
if (!
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2503
|
+
let processed = nodes.map((i) => {
|
|
2504
|
+
if (!i[my$1]) Container.rebuild(i);
|
|
2505
|
+
i = i.proxyOf;
|
|
2506
|
+
if (i.parent) i.parent.removeChild(i);
|
|
2507
|
+
if (i[isClean$1]) markTreeDirty(i);
|
|
2508
|
+
if (!i.raws) i.raws = {};
|
|
2509
|
+
if (typeof i.raws.before === "undefined") {
|
|
2510
|
+
if (sample && typeof sample.raws.before !== "undefined") {
|
|
2511
|
+
i.raws.before = sample.raws.before.replace(/\S/g, "");
|
|
2512
|
+
}
|
|
2513
|
+
}
|
|
2514
|
+
i.parent = this.proxyOf;
|
|
2515
|
+
return i;
|
|
2516
|
+
});
|
|
2517
|
+
return processed;
|
|
2518
|
+
}
|
|
2519
|
+
prepend(...children) {
|
|
2520
|
+
children = children.reverse();
|
|
2521
|
+
for (let child of children) {
|
|
2522
|
+
let nodes = this.normalize(child, this.first, "prepend").reverse();
|
|
2523
|
+
for (let node2 of nodes) this.proxyOf.nodes.unshift(node2);
|
|
2524
|
+
for (let id in this.indexes) {
|
|
2525
|
+
this.indexes[id] = this.indexes[id] + nodes.length;
|
|
2427
2526
|
}
|
|
2428
2527
|
}
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2528
|
+
this.markDirty();
|
|
2529
|
+
return this;
|
|
2530
|
+
}
|
|
2531
|
+
push(child) {
|
|
2532
|
+
child.parent = this;
|
|
2533
|
+
this.proxyOf.nodes.push(child);
|
|
2534
|
+
return this;
|
|
2535
|
+
}
|
|
2536
|
+
removeAll() {
|
|
2537
|
+
for (let node2 of this.proxyOf.nodes) node2.parent = void 0;
|
|
2538
|
+
this.proxyOf.nodes = [];
|
|
2539
|
+
this.markDirty();
|
|
2540
|
+
return this;
|
|
2541
|
+
}
|
|
2542
|
+
removeChild(child) {
|
|
2543
|
+
child = this.index(child);
|
|
2544
|
+
this.proxyOf.nodes[child].parent = void 0;
|
|
2545
|
+
this.proxyOf.nodes.splice(child, 1);
|
|
2546
|
+
let index2;
|
|
2547
|
+
for (let id in this.indexes) {
|
|
2548
|
+
index2 = this.indexes[id];
|
|
2549
|
+
if (index2 >= child) {
|
|
2550
|
+
this.indexes[id] = index2 - 1;
|
|
2435
2551
|
}
|
|
2436
2552
|
}
|
|
2437
|
-
|
|
2438
|
-
|
|
2553
|
+
this.markDirty();
|
|
2554
|
+
return this;
|
|
2555
|
+
}
|
|
2556
|
+
replaceValues(pattern, opts, callback) {
|
|
2557
|
+
if (!callback) {
|
|
2558
|
+
callback = opts;
|
|
2559
|
+
opts = {};
|
|
2439
2560
|
}
|
|
2440
|
-
|
|
2561
|
+
this.walkDecls((decl2) => {
|
|
2562
|
+
if (opts.props && !opts.props.includes(decl2.prop)) return;
|
|
2563
|
+
if (opts.fast && !decl2.value.includes(opts.fast)) return;
|
|
2564
|
+
decl2.value = decl2.value.replace(pattern, callback);
|
|
2565
|
+
});
|
|
2566
|
+
this.markDirty();
|
|
2567
|
+
return this;
|
|
2441
2568
|
}
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
line = start.line;
|
|
2453
|
-
column = start.column;
|
|
2569
|
+
some(condition) {
|
|
2570
|
+
return this.nodes.some(condition);
|
|
2571
|
+
}
|
|
2572
|
+
walk(callback) {
|
|
2573
|
+
return this.each((child, i) => {
|
|
2574
|
+
let result2;
|
|
2575
|
+
try {
|
|
2576
|
+
result2 = callback(child, i);
|
|
2577
|
+
} catch (e) {
|
|
2578
|
+
throw child.addToError(e);
|
|
2454
2579
|
}
|
|
2455
|
-
if (
|
|
2456
|
-
|
|
2457
|
-
endLine = pos.line;
|
|
2458
|
-
endColumn = pos.col;
|
|
2459
|
-
} else {
|
|
2460
|
-
endLine = end.line;
|
|
2461
|
-
endColumn = end.column;
|
|
2580
|
+
if (result2 !== false && child.walk) {
|
|
2581
|
+
result2 = child.walk(callback);
|
|
2462
2582
|
}
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2583
|
+
return result2;
|
|
2584
|
+
});
|
|
2585
|
+
}
|
|
2586
|
+
walkAtRules(name, callback) {
|
|
2587
|
+
if (!callback) {
|
|
2588
|
+
callback = name;
|
|
2589
|
+
return this.walk((child, i) => {
|
|
2590
|
+
if (child.type === "atrule") {
|
|
2591
|
+
return callback(child, i);
|
|
2592
|
+
}
|
|
2593
|
+
});
|
|
2467
2594
|
}
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
origin.source,
|
|
2475
|
-
origin.file,
|
|
2476
|
-
opts.plugin
|
|
2477
|
-
);
|
|
2478
|
-
} else {
|
|
2479
|
-
result2 = new CssSyntaxError$1(
|
|
2480
|
-
message,
|
|
2481
|
-
endLine === void 0 ? line : { column, line },
|
|
2482
|
-
endLine === void 0 ? column : { column: endColumn, line: endLine },
|
|
2483
|
-
this.css,
|
|
2484
|
-
this.file,
|
|
2485
|
-
opts.plugin
|
|
2486
|
-
);
|
|
2595
|
+
if (name instanceof RegExp) {
|
|
2596
|
+
return this.walk((child, i) => {
|
|
2597
|
+
if (child.type === "atrule" && name.test(child.name)) {
|
|
2598
|
+
return callback(child, i);
|
|
2599
|
+
}
|
|
2600
|
+
});
|
|
2487
2601
|
}
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
result2.input.url = pathToFileURL$1(this.file).toString();
|
|
2602
|
+
return this.walk((child, i) => {
|
|
2603
|
+
if (child.type === "atrule" && child.name === name) {
|
|
2604
|
+
return callback(child, i);
|
|
2492
2605
|
}
|
|
2493
|
-
|
|
2494
|
-
}
|
|
2495
|
-
return result2;
|
|
2606
|
+
});
|
|
2496
2607
|
}
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
lineToIndex = new Array(lines.length);
|
|
2502
|
-
let prevIndex = 0;
|
|
2503
|
-
for (let i = 0, l = lines.length; i < l; i++) {
|
|
2504
|
-
lineToIndex[i] = prevIndex;
|
|
2505
|
-
prevIndex += lines[i].length + 1;
|
|
2608
|
+
walkComments(callback) {
|
|
2609
|
+
return this.walk((child, i) => {
|
|
2610
|
+
if (child.type === "comment") {
|
|
2611
|
+
return callback(child, i);
|
|
2506
2612
|
}
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2613
|
+
});
|
|
2614
|
+
}
|
|
2615
|
+
walkDecls(prop, callback) {
|
|
2616
|
+
if (!callback) {
|
|
2617
|
+
callback = prop;
|
|
2618
|
+
return this.walk((child, i) => {
|
|
2619
|
+
if (child.type === "decl") {
|
|
2620
|
+
return callback(child, i);
|
|
2621
|
+
}
|
|
2622
|
+
});
|
|
2510
2623
|
}
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
} else {
|
|
2516
|
-
let max = lineToIndex.length - 2;
|
|
2517
|
-
let mid;
|
|
2518
|
-
while (min < max) {
|
|
2519
|
-
mid = min + (max - min >> 1);
|
|
2520
|
-
if (offset < lineToIndex[mid]) {
|
|
2521
|
-
max = mid - 1;
|
|
2522
|
-
} else if (offset >= lineToIndex[mid + 1]) {
|
|
2523
|
-
min = mid + 1;
|
|
2524
|
-
} else {
|
|
2525
|
-
min = mid;
|
|
2526
|
-
break;
|
|
2624
|
+
if (prop instanceof RegExp) {
|
|
2625
|
+
return this.walk((child, i) => {
|
|
2626
|
+
if (child.type === "decl" && prop.test(child.prop)) {
|
|
2627
|
+
return callback(child, i);
|
|
2527
2628
|
}
|
|
2528
|
-
}
|
|
2629
|
+
});
|
|
2529
2630
|
}
|
|
2530
|
-
return {
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2631
|
+
return this.walk((child, i) => {
|
|
2632
|
+
if (child.type === "decl" && child.prop === prop) {
|
|
2633
|
+
return callback(child, i);
|
|
2634
|
+
}
|
|
2635
|
+
});
|
|
2534
2636
|
}
|
|
2535
|
-
|
|
2536
|
-
if (
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
let consumer = this.map.consumer();
|
|
2544
|
-
let from = consumer.originalPositionFor({ column, line });
|
|
2545
|
-
if (!from.source) return false;
|
|
2546
|
-
let to;
|
|
2547
|
-
if (typeof endLine === "number") {
|
|
2548
|
-
to = consumer.originalPositionFor({ column: endColumn, line: endLine });
|
|
2637
|
+
walkRules(selector, callback) {
|
|
2638
|
+
if (!callback) {
|
|
2639
|
+
callback = selector;
|
|
2640
|
+
return this.walk((child, i) => {
|
|
2641
|
+
if (child.type === "rule") {
|
|
2642
|
+
return callback(child, i);
|
|
2643
|
+
}
|
|
2644
|
+
});
|
|
2549
2645
|
}
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
this.map.consumer().sourceRoot || pathToFileURL$1(this.map.mapFile)
|
|
2557
|
-
);
|
|
2646
|
+
if (selector instanceof RegExp) {
|
|
2647
|
+
return this.walk((child, i) => {
|
|
2648
|
+
if (child.type === "rule" && selector.test(child.selector)) {
|
|
2649
|
+
return callback(child, i);
|
|
2650
|
+
}
|
|
2651
|
+
});
|
|
2558
2652
|
}
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
endLine: to && to.line,
|
|
2563
|
-
line: from.line,
|
|
2564
|
-
url: fromUrl.toString()
|
|
2565
|
-
};
|
|
2566
|
-
if (fromUrl.protocol === "file:") {
|
|
2567
|
-
if (fileURLToPath) {
|
|
2568
|
-
result2.file = fileURLToPath(fromUrl);
|
|
2569
|
-
} else {
|
|
2570
|
-
throw new Error(`file: protocol is not available in this PostCSS build`);
|
|
2653
|
+
return this.walk((child, i) => {
|
|
2654
|
+
if (child.type === "rule" && child.selector === selector) {
|
|
2655
|
+
return callback(child, i);
|
|
2571
2656
|
}
|
|
2572
|
-
}
|
|
2573
|
-
let source = consumer.sourceContentFor(from.source);
|
|
2574
|
-
if (source) result2.source = source;
|
|
2575
|
-
return result2;
|
|
2657
|
+
});
|
|
2576
2658
|
}
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
if (this[name] != null) {
|
|
2581
|
-
json[name] = this[name];
|
|
2582
|
-
}
|
|
2583
|
-
}
|
|
2584
|
-
if (this.map) {
|
|
2585
|
-
json.map = { ...this.map };
|
|
2586
|
-
if (json.map.consumerCache) {
|
|
2587
|
-
json.map.consumerCache = void 0;
|
|
2588
|
-
}
|
|
2589
|
-
}
|
|
2590
|
-
return json;
|
|
2659
|
+
get first() {
|
|
2660
|
+
if (!this.proxyOf.nodes) return void 0;
|
|
2661
|
+
return this.proxyOf.nodes[0];
|
|
2591
2662
|
}
|
|
2592
|
-
get
|
|
2593
|
-
|
|
2663
|
+
get last() {
|
|
2664
|
+
if (!this.proxyOf.nodes) return void 0;
|
|
2665
|
+
return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
|
|
2594
2666
|
}
|
|
2595
2667
|
};
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2668
|
+
Container$8.registerParse = (dependant) => {
|
|
2669
|
+
parse$5 = dependant;
|
|
2670
|
+
};
|
|
2671
|
+
Container$8.registerRule = (dependant) => {
|
|
2672
|
+
Rule$5 = dependant;
|
|
2673
|
+
};
|
|
2674
|
+
Container$8.registerAtRule = (dependant) => {
|
|
2675
|
+
AtRule$5 = dependant;
|
|
2676
|
+
};
|
|
2677
|
+
Container$8.registerRoot = (dependant) => {
|
|
2678
|
+
Root$7 = dependant;
|
|
2679
|
+
};
|
|
2680
|
+
var container = Container$8;
|
|
2681
|
+
Container$8.default = Container$8;
|
|
2682
|
+
Container$8.rebuild = (node2) => {
|
|
2683
|
+
if (node2.type === "atrule") {
|
|
2684
|
+
Object.setPrototypeOf(node2, AtRule$5.prototype);
|
|
2685
|
+
} else if (node2.type === "rule") {
|
|
2686
|
+
Object.setPrototypeOf(node2, Rule$5.prototype);
|
|
2687
|
+
} else if (node2.type === "decl") {
|
|
2688
|
+
Object.setPrototypeOf(node2, Declaration$4.prototype);
|
|
2689
|
+
} else if (node2.type === "comment") {
|
|
2690
|
+
Object.setPrototypeOf(node2, Comment$5.prototype);
|
|
2691
|
+
} else if (node2.type === "root") {
|
|
2692
|
+
Object.setPrototypeOf(node2, Root$7.prototype);
|
|
2619
2693
|
}
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
}
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2694
|
+
node2[my$1] = true;
|
|
2695
|
+
if (node2.nodes) {
|
|
2696
|
+
node2.nodes.forEach((child) => {
|
|
2697
|
+
Container$8.rebuild(child);
|
|
2698
|
+
});
|
|
2699
|
+
}
|
|
2700
|
+
};
|
|
2701
|
+
let Container$7 = container;
|
|
2702
|
+
let AtRule$4 = class AtRule extends Container$7 {
|
|
2703
|
+
constructor(defaults) {
|
|
2704
|
+
super(defaults);
|
|
2705
|
+
this.type = "atrule";
|
|
2706
|
+
}
|
|
2707
|
+
append(...children) {
|
|
2708
|
+
if (!this.proxyOf.nodes) this.nodes = [];
|
|
2709
|
+
return super.append(...children);
|
|
2710
|
+
}
|
|
2711
|
+
prepend(...children) {
|
|
2712
|
+
if (!this.proxyOf.nodes) this.nodes = [];
|
|
2713
|
+
return super.prepend(...children);
|
|
2714
|
+
}
|
|
2715
|
+
};
|
|
2716
|
+
var atRule$1 = AtRule$4;
|
|
2717
|
+
AtRule$4.default = AtRule$4;
|
|
2718
|
+
Container$7.registerAtRule(AtRule$4);
|
|
2719
|
+
let Container$6 = container;
|
|
2720
|
+
let LazyResult$4, Processor$4;
|
|
2721
|
+
let Document$4 = class Document extends Container$6 {
|
|
2722
|
+
constructor(defaults) {
|
|
2723
|
+
super({ type: "document", ...defaults });
|
|
2724
|
+
if (!this.nodes) {
|
|
2725
|
+
this.nodes = [];
|
|
2630
2726
|
}
|
|
2631
|
-
let eol = "\n";
|
|
2632
|
-
if (this.css.includes("\r\n")) eol = "\r\n";
|
|
2633
|
-
this.css += eol + "/*# sourceMappingURL=" + content + " */";
|
|
2634
2727
|
}
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2728
|
+
toResult(opts = {}) {
|
|
2729
|
+
let lazy = new LazyResult$4(new Processor$4(), this, opts);
|
|
2730
|
+
return lazy.stringify();
|
|
2731
|
+
}
|
|
2732
|
+
};
|
|
2733
|
+
Document$4.registerLazyResult = (dependant) => {
|
|
2734
|
+
LazyResult$4 = dependant;
|
|
2735
|
+
};
|
|
2736
|
+
Document$4.registerProcessor = (dependant) => {
|
|
2737
|
+
Processor$4 = dependant;
|
|
2738
|
+
};
|
|
2739
|
+
var document$2 = Document$4;
|
|
2740
|
+
Document$4.default = Document$4;
|
|
2741
|
+
let urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
2742
|
+
let customAlphabet = (alphabet, defaultSize = 21) => {
|
|
2743
|
+
return (size = defaultSize) => {
|
|
2744
|
+
let id = "";
|
|
2745
|
+
let i = size | 0;
|
|
2746
|
+
while (i--) {
|
|
2747
|
+
id += alphabet[Math.random() * alphabet.length | 0];
|
|
2649
2748
|
}
|
|
2749
|
+
return id;
|
|
2750
|
+
};
|
|
2751
|
+
};
|
|
2752
|
+
let nanoid$1 = (size = 21) => {
|
|
2753
|
+
let id = "";
|
|
2754
|
+
let i = size | 0;
|
|
2755
|
+
while (i--) {
|
|
2756
|
+
id += urlAlphabet[Math.random() * 64 | 0];
|
|
2650
2757
|
}
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2758
|
+
return id;
|
|
2759
|
+
};
|
|
2760
|
+
var nonSecure = { nanoid: nanoid$1, customAlphabet };
|
|
2761
|
+
let { existsSync, readFileSync } = require$$2;
|
|
2762
|
+
let { dirname: dirname$1, join } = require$$2;
|
|
2763
|
+
let { SourceMapConsumer: SourceMapConsumer$2, SourceMapGenerator: SourceMapGenerator$2 } = require$$2;
|
|
2764
|
+
function fromBase64(str) {
|
|
2765
|
+
if (Buffer) {
|
|
2766
|
+
return Buffer.from(str, "base64").toString();
|
|
2767
|
+
} else {
|
|
2768
|
+
return window.atob(str);
|
|
2769
|
+
}
|
|
2770
|
+
}
|
|
2771
|
+
let PreviousMap$2 = class PreviousMap {
|
|
2772
|
+
constructor(css, opts) {
|
|
2773
|
+
if (opts.map === false) return;
|
|
2774
|
+
this.loadAnnotation(css);
|
|
2775
|
+
this.inline = this.startWith(this.annotation, "data:");
|
|
2776
|
+
let prev = opts.map ? opts.map.prev : void 0;
|
|
2777
|
+
let text = this.loadMap(opts.from, prev);
|
|
2778
|
+
if (!this.mapFile && opts.from) {
|
|
2779
|
+
this.mapFile = opts.from;
|
|
2664
2780
|
}
|
|
2781
|
+
if (this.mapFile) this.root = dirname$1(this.mapFile);
|
|
2782
|
+
if (text) this.text = text;
|
|
2665
2783
|
}
|
|
2666
|
-
|
|
2667
|
-
this.
|
|
2668
|
-
|
|
2669
|
-
return this.generateMap();
|
|
2670
|
-
} else {
|
|
2671
|
-
let result2 = "";
|
|
2672
|
-
this.stringify(this.root, (i) => {
|
|
2673
|
-
result2 += i;
|
|
2674
|
-
});
|
|
2675
|
-
return [result2];
|
|
2784
|
+
consumer() {
|
|
2785
|
+
if (!this.consumerCache) {
|
|
2786
|
+
this.consumerCache = new SourceMapConsumer$2(this.text);
|
|
2676
2787
|
}
|
|
2788
|
+
return this.consumerCache;
|
|
2677
2789
|
}
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
});
|
|
2687
|
-
} else {
|
|
2688
|
-
this.map = new SourceMapGenerator({
|
|
2689
|
-
file: this.outputFile(),
|
|
2690
|
-
ignoreInvalidMapping: true
|
|
2691
|
-
});
|
|
2692
|
-
this.map.addMapping({
|
|
2693
|
-
generated: { column: 0, line: 1 },
|
|
2694
|
-
original: { column: 0, line: 1 },
|
|
2695
|
-
source: this.opts.from ? this.toUrl(this.path(this.opts.from)) : "<no source>"
|
|
2696
|
-
});
|
|
2790
|
+
decodeInline(text) {
|
|
2791
|
+
let baseCharsetUri = /^data:application\/json;charset=utf-?8;base64,/;
|
|
2792
|
+
let baseUri = /^data:application\/json;base64,/;
|
|
2793
|
+
let charsetUri = /^data:application\/json;charset=utf-?8,/;
|
|
2794
|
+
let uri = /^data:application\/json,/;
|
|
2795
|
+
let uriMatch = text.match(charsetUri) || text.match(uri);
|
|
2796
|
+
if (uriMatch) {
|
|
2797
|
+
return decodeURIComponent(text.substr(uriMatch[0].length));
|
|
2697
2798
|
}
|
|
2698
|
-
|
|
2699
|
-
if (
|
|
2700
|
-
|
|
2701
|
-
if (this.isInline()) {
|
|
2702
|
-
return [this.css];
|
|
2703
|
-
} else {
|
|
2704
|
-
return [this.css, this.map];
|
|
2799
|
+
let baseUriMatch = text.match(baseCharsetUri) || text.match(baseUri);
|
|
2800
|
+
if (baseUriMatch) {
|
|
2801
|
+
return fromBase64(text.substr(baseUriMatch[0].length));
|
|
2705
2802
|
}
|
|
2803
|
+
let encoding = text.match(/data:application\/json;([^,]+),/)[1];
|
|
2804
|
+
throw new Error("Unsupported source map encoding " + encoding);
|
|
2706
2805
|
}
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
this.map = new SourceMapGenerator({
|
|
2710
|
-
file: this.outputFile(),
|
|
2711
|
-
ignoreInvalidMapping: true
|
|
2712
|
-
});
|
|
2713
|
-
let line = 1;
|
|
2714
|
-
let column = 1;
|
|
2715
|
-
let noSource = "<no source>";
|
|
2716
|
-
let mapping = {
|
|
2717
|
-
generated: { column: 0, line: 0 },
|
|
2718
|
-
original: { column: 0, line: 0 },
|
|
2719
|
-
source: ""
|
|
2720
|
-
};
|
|
2721
|
-
let lines, last;
|
|
2722
|
-
this.stringify(this.root, (str, node2, type) => {
|
|
2723
|
-
this.css += str;
|
|
2724
|
-
if (node2 && type !== "end") {
|
|
2725
|
-
mapping.generated.line = line;
|
|
2726
|
-
mapping.generated.column = column - 1;
|
|
2727
|
-
if (node2.source && node2.source.start) {
|
|
2728
|
-
mapping.source = this.sourcePath(node2);
|
|
2729
|
-
mapping.original.line = node2.source.start.line;
|
|
2730
|
-
mapping.original.column = node2.source.start.column - 1;
|
|
2731
|
-
this.map.addMapping(mapping);
|
|
2732
|
-
} else {
|
|
2733
|
-
mapping.source = noSource;
|
|
2734
|
-
mapping.original.line = 1;
|
|
2735
|
-
mapping.original.column = 0;
|
|
2736
|
-
this.map.addMapping(mapping);
|
|
2737
|
-
}
|
|
2738
|
-
}
|
|
2739
|
-
lines = str.match(/\n/g);
|
|
2740
|
-
if (lines) {
|
|
2741
|
-
line += lines.length;
|
|
2742
|
-
last = str.lastIndexOf("\n");
|
|
2743
|
-
column = str.length - last;
|
|
2744
|
-
} else {
|
|
2745
|
-
column += str.length;
|
|
2746
|
-
}
|
|
2747
|
-
if (node2 && type !== "start") {
|
|
2748
|
-
let p = node2.parent || { raws: {} };
|
|
2749
|
-
let childless = node2.type === "decl" || node2.type === "atrule" && !node2.nodes;
|
|
2750
|
-
if (!childless || node2 !== p.last || p.raws.semicolon) {
|
|
2751
|
-
if (node2.source && node2.source.end) {
|
|
2752
|
-
mapping.source = this.sourcePath(node2);
|
|
2753
|
-
mapping.original.line = node2.source.end.line;
|
|
2754
|
-
mapping.original.column = node2.source.end.column - 1;
|
|
2755
|
-
mapping.generated.line = line;
|
|
2756
|
-
mapping.generated.column = column - 2;
|
|
2757
|
-
this.map.addMapping(mapping);
|
|
2758
|
-
} else {
|
|
2759
|
-
mapping.source = noSource;
|
|
2760
|
-
mapping.original.line = 1;
|
|
2761
|
-
mapping.original.column = 0;
|
|
2762
|
-
mapping.generated.line = line;
|
|
2763
|
-
mapping.generated.column = column - 1;
|
|
2764
|
-
this.map.addMapping(mapping);
|
|
2765
|
-
}
|
|
2766
|
-
}
|
|
2767
|
-
}
|
|
2768
|
-
});
|
|
2806
|
+
getAnnotationURL(sourceMapString) {
|
|
2807
|
+
return sourceMapString.replace(/^\/\*\s*# sourceMappingURL=/, "").trim();
|
|
2769
2808
|
}
|
|
2770
|
-
|
|
2771
|
-
if (
|
|
2772
|
-
|
|
2773
|
-
}
|
|
2774
|
-
if (typeof this.mapOpts.annotation !== "undefined") {
|
|
2775
|
-
return this.mapOpts.annotation;
|
|
2776
|
-
}
|
|
2777
|
-
if (this.previous().length) {
|
|
2778
|
-
return this.previous().some((i) => i.annotation);
|
|
2779
|
-
}
|
|
2780
|
-
return true;
|
|
2809
|
+
isMap(map) {
|
|
2810
|
+
if (typeof map !== "object") return false;
|
|
2811
|
+
return typeof map.mappings === "string" || typeof map._mappings === "string" || Array.isArray(map.sections);
|
|
2781
2812
|
}
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
let
|
|
2787
|
-
if (
|
|
2788
|
-
|
|
2789
|
-
}
|
|
2790
|
-
if (this.previous().length) {
|
|
2791
|
-
return this.previous().some((i) => i.inline);
|
|
2813
|
+
loadAnnotation(css) {
|
|
2814
|
+
let comments = css.match(/\/\*\s*# sourceMappingURL=/g);
|
|
2815
|
+
if (!comments) return;
|
|
2816
|
+
let start = css.lastIndexOf(comments.pop());
|
|
2817
|
+
let end = css.indexOf("*/", start);
|
|
2818
|
+
if (start > -1 && end > -1) {
|
|
2819
|
+
this.annotation = this.getAnnotationURL(css.substring(start, end));
|
|
2792
2820
|
}
|
|
2793
|
-
return true;
|
|
2794
2821
|
}
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2822
|
+
loadFile(path) {
|
|
2823
|
+
this.root = dirname$1(path);
|
|
2824
|
+
if (existsSync(path)) {
|
|
2825
|
+
this.mapFile = path;
|
|
2826
|
+
return readFileSync(path, "utf-8").toString().trim();
|
|
2798
2827
|
}
|
|
2799
|
-
return this.previous().length > 0;
|
|
2800
2828
|
}
|
|
2801
|
-
|
|
2802
|
-
if (
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2829
|
+
loadMap(file, prev) {
|
|
2830
|
+
if (prev === false) return false;
|
|
2831
|
+
if (prev) {
|
|
2832
|
+
if (typeof prev === "string") {
|
|
2833
|
+
return prev;
|
|
2834
|
+
} else if (typeof prev === "function") {
|
|
2835
|
+
let prevPath = prev(file);
|
|
2836
|
+
if (prevPath) {
|
|
2837
|
+
let map = this.loadFile(prevPath);
|
|
2838
|
+
if (!map) {
|
|
2839
|
+
throw new Error(
|
|
2840
|
+
"Unable to load previous source map: " + prevPath.toString()
|
|
2841
|
+
);
|
|
2842
|
+
}
|
|
2843
|
+
return map;
|
|
2844
|
+
}
|
|
2845
|
+
} else if (prev instanceof SourceMapConsumer$2) {
|
|
2846
|
+
return SourceMapGenerator$2.fromSourceMap(prev).toString();
|
|
2847
|
+
} else if (prev instanceof SourceMapGenerator$2) {
|
|
2848
|
+
return prev.toString();
|
|
2849
|
+
} else if (this.isMap(prev)) {
|
|
2850
|
+
return JSON.stringify(prev);
|
|
2851
|
+
} else {
|
|
2852
|
+
throw new Error(
|
|
2853
|
+
"Unsupported previous source map format: " + prev.toString()
|
|
2854
|
+
);
|
|
2855
|
+
}
|
|
2856
|
+
} else if (this.inline) {
|
|
2857
|
+
return this.decodeInline(this.annotation);
|
|
2858
|
+
} else if (this.annotation) {
|
|
2859
|
+
let map = this.annotation;
|
|
2860
|
+
if (file) map = join(dirname$1(file), map);
|
|
2861
|
+
return this.loadFile(map);
|
|
2807
2862
|
}
|
|
2808
|
-
return true;
|
|
2809
2863
|
}
|
|
2810
|
-
|
|
2811
|
-
if (
|
|
2812
|
-
|
|
2813
|
-
} else if (this.opts.from) {
|
|
2814
|
-
return this.path(this.opts.from);
|
|
2815
|
-
} else {
|
|
2816
|
-
return "to.css";
|
|
2817
|
-
}
|
|
2864
|
+
startWith(string, start) {
|
|
2865
|
+
if (!string) return false;
|
|
2866
|
+
return string.substr(0, start.length) === start;
|
|
2818
2867
|
}
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
if (file.charCodeAt(0) === 60) return file;
|
|
2822
|
-
if (/^\w+:\/\//.test(file)) return file;
|
|
2823
|
-
let cached = this.memoizedPaths.get(file);
|
|
2824
|
-
if (cached) return cached;
|
|
2825
|
-
let from = this.opts.to ? dirname(this.opts.to) : ".";
|
|
2826
|
-
if (typeof this.mapOpts.annotation === "string") {
|
|
2827
|
-
from = dirname(resolve(from, this.mapOpts.annotation));
|
|
2828
|
-
}
|
|
2829
|
-
let path = relative(from, file);
|
|
2830
|
-
this.memoizedPaths.set(file, path);
|
|
2831
|
-
return path;
|
|
2868
|
+
withContent() {
|
|
2869
|
+
return !!(this.consumer().sourcesContent && this.consumer().sourcesContent.length > 0);
|
|
2832
2870
|
}
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2871
|
+
};
|
|
2872
|
+
var previousMap = PreviousMap$2;
|
|
2873
|
+
PreviousMap$2.default = PreviousMap$2;
|
|
2874
|
+
let { nanoid } = nonSecure;
|
|
2875
|
+
let { isAbsolute, resolve: resolve$1 } = require$$2;
|
|
2876
|
+
let { SourceMapConsumer: SourceMapConsumer$1, SourceMapGenerator: SourceMapGenerator$1 } = require$$2;
|
|
2877
|
+
let { fileURLToPath, pathToFileURL: pathToFileURL$1 } = require$$2;
|
|
2878
|
+
let CssSyntaxError$2 = cssSyntaxError;
|
|
2879
|
+
let PreviousMap$1 = previousMap;
|
|
2880
|
+
let terminalHighlight = require$$2;
|
|
2881
|
+
let fromOffsetCache = Symbol("fromOffsetCache");
|
|
2882
|
+
let sourceMapAvailable$1 = Boolean(SourceMapConsumer$1 && SourceMapGenerator$1);
|
|
2883
|
+
let pathAvailable$1 = Boolean(resolve$1 && isAbsolute);
|
|
2884
|
+
let Input$6 = class Input {
|
|
2885
|
+
constructor(css, opts = {}) {
|
|
2886
|
+
if (css === null || typeof css === "undefined" || typeof css === "object" && !css.toString) {
|
|
2887
|
+
throw new Error(`PostCSS received ${css} instead of CSS string`);
|
|
2888
|
+
}
|
|
2889
|
+
this.css = css.toString();
|
|
2890
|
+
if (this.css[0] === "\uFEFF" || this.css[0] === "") {
|
|
2891
|
+
this.hasBOM = true;
|
|
2892
|
+
this.css = this.css.slice(1);
|
|
2893
|
+
} else {
|
|
2894
|
+
this.hasBOM = false;
|
|
2895
|
+
}
|
|
2896
|
+
this.document = this.css;
|
|
2897
|
+
if (opts.document) this.document = opts.document.toString();
|
|
2898
|
+
if (opts.from) {
|
|
2899
|
+
if (!pathAvailable$1 || /^\w+:\/\//.test(opts.from) || isAbsolute(opts.from)) {
|
|
2900
|
+
this.file = opts.from;
|
|
2845
2901
|
} else {
|
|
2846
|
-
|
|
2847
|
-
if (input2.map) this.previousMaps.push(input2.map);
|
|
2902
|
+
this.file = resolve$1(opts.from);
|
|
2848
2903
|
}
|
|
2849
2904
|
}
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
let from = node2.source.input.from;
|
|
2858
|
-
if (from && !already[from]) {
|
|
2859
|
-
already[from] = true;
|
|
2860
|
-
let fromUrl = this.usesFileUrls ? this.toFileUrl(from) : this.toUrl(this.path(from));
|
|
2861
|
-
this.map.setSourceContent(fromUrl, node2.source.input.css);
|
|
2862
|
-
}
|
|
2863
|
-
}
|
|
2864
|
-
});
|
|
2865
|
-
} else if (this.css) {
|
|
2866
|
-
let from = this.opts.from ? this.toUrl(this.path(this.opts.from)) : "<no source>";
|
|
2867
|
-
this.map.setSourceContent(from, this.css);
|
|
2905
|
+
if (pathAvailable$1 && sourceMapAvailable$1) {
|
|
2906
|
+
let map = new PreviousMap$1(this.css, opts);
|
|
2907
|
+
if (map.text) {
|
|
2908
|
+
this.map = map;
|
|
2909
|
+
let file = map.consumer().file;
|
|
2910
|
+
if (!this.file && file) this.file = this.mapResolve(file);
|
|
2911
|
+
}
|
|
2868
2912
|
}
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
if (this.mapOpts.from) {
|
|
2872
|
-
return this.toUrl(this.mapOpts.from);
|
|
2873
|
-
} else if (this.usesFileUrls) {
|
|
2874
|
-
return this.toFileUrl(node2.source.input.from);
|
|
2875
|
-
} else {
|
|
2876
|
-
return this.toUrl(this.path(node2.source.input.from));
|
|
2913
|
+
if (!this.file) {
|
|
2914
|
+
this.id = "<input css " + nanoid(6) + ">";
|
|
2877
2915
|
}
|
|
2916
|
+
if (this.map) this.map.file = this.from;
|
|
2878
2917
|
}
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2918
|
+
error(message, line, column, opts = {}) {
|
|
2919
|
+
let endColumn, endLine, result2;
|
|
2920
|
+
if (line && typeof line === "object") {
|
|
2921
|
+
let start = line;
|
|
2922
|
+
let end = column;
|
|
2923
|
+
if (typeof start.offset === "number") {
|
|
2924
|
+
let pos = this.fromOffset(start.offset);
|
|
2925
|
+
line = pos.line;
|
|
2926
|
+
column = pos.col;
|
|
2927
|
+
} else {
|
|
2928
|
+
line = start.line;
|
|
2929
|
+
column = start.column;
|
|
2930
|
+
}
|
|
2931
|
+
if (typeof end.offset === "number") {
|
|
2932
|
+
let pos = this.fromOffset(end.offset);
|
|
2933
|
+
endLine = pos.line;
|
|
2934
|
+
endColumn = pos.col;
|
|
2935
|
+
} else {
|
|
2936
|
+
endLine = end.line;
|
|
2937
|
+
endColumn = end.column;
|
|
2938
|
+
}
|
|
2939
|
+
} else if (!column) {
|
|
2940
|
+
let pos = this.fromOffset(line);
|
|
2941
|
+
line = pos.line;
|
|
2942
|
+
column = pos.col;
|
|
2884
2943
|
}
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2944
|
+
let origin = this.origin(line, column, endLine, endColumn);
|
|
2945
|
+
if (origin) {
|
|
2946
|
+
result2 = new CssSyntaxError$2(
|
|
2947
|
+
message,
|
|
2948
|
+
origin.endLine === void 0 ? origin.line : { column: origin.column, line: origin.line },
|
|
2949
|
+
origin.endLine === void 0 ? origin.column : { column: origin.endColumn, line: origin.endLine },
|
|
2950
|
+
origin.source,
|
|
2951
|
+
origin.file,
|
|
2952
|
+
opts.plugin
|
|
2953
|
+
);
|
|
2893
2954
|
} else {
|
|
2894
|
-
|
|
2895
|
-
|
|
2955
|
+
result2 = new CssSyntaxError$2(
|
|
2956
|
+
message,
|
|
2957
|
+
endLine === void 0 ? line : { column, line },
|
|
2958
|
+
endLine === void 0 ? column : { column: endColumn, line: endLine },
|
|
2959
|
+
this.css,
|
|
2960
|
+
this.file,
|
|
2961
|
+
opts.plugin
|
|
2896
2962
|
);
|
|
2897
2963
|
}
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2964
|
+
result2.input = { column, endColumn, endLine, line, source: this.css };
|
|
2965
|
+
if (this.file) {
|
|
2966
|
+
if (pathToFileURL$1) {
|
|
2967
|
+
result2.input.url = pathToFileURL$1(this.file).toString();
|
|
2968
|
+
}
|
|
2969
|
+
result2.input.file = this.file;
|
|
2904
2970
|
}
|
|
2905
|
-
|
|
2906
|
-
this.memoizedURLs.set(path, url);
|
|
2907
|
-
return url;
|
|
2908
|
-
}
|
|
2909
|
-
};
|
|
2910
|
-
var mapGenerator = MapGenerator$2;
|
|
2911
|
-
let Node$2 = node;
|
|
2912
|
-
let Comment$4 = class Comment extends Node$2 {
|
|
2913
|
-
constructor(defaults) {
|
|
2914
|
-
super(defaults);
|
|
2915
|
-
this.type = "comment";
|
|
2971
|
+
return result2;
|
|
2916
2972
|
}
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
let
|
|
2921
|
-
|
|
2922
|
-
let
|
|
2923
|
-
let
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
});
|
|
2931
|
-
}
|
|
2932
|
-
function markDirtyUp(node2) {
|
|
2933
|
-
node2[isClean$1] = false;
|
|
2934
|
-
if (node2.proxyOf.nodes) {
|
|
2935
|
-
for (let i of node2.proxyOf.nodes) {
|
|
2936
|
-
markDirtyUp(i);
|
|
2973
|
+
fromOffset(offset) {
|
|
2974
|
+
let lastLine, lineToIndex;
|
|
2975
|
+
if (!this[fromOffsetCache]) {
|
|
2976
|
+
let lines = this.css.split("\n");
|
|
2977
|
+
lineToIndex = new Array(lines.length);
|
|
2978
|
+
let prevIndex = 0;
|
|
2979
|
+
for (let i = 0, l = lines.length; i < l; i++) {
|
|
2980
|
+
lineToIndex[i] = prevIndex;
|
|
2981
|
+
prevIndex += lines[i].length + 1;
|
|
2982
|
+
}
|
|
2983
|
+
this[fromOffsetCache] = lineToIndex;
|
|
2984
|
+
} else {
|
|
2985
|
+
lineToIndex = this[fromOffsetCache];
|
|
2937
2986
|
}
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
let
|
|
2944
|
-
|
|
2987
|
+
lastLine = lineToIndex[lineToIndex.length - 1];
|
|
2988
|
+
let min = 0;
|
|
2989
|
+
if (offset >= lastLine) {
|
|
2990
|
+
min = lineToIndex.length - 1;
|
|
2991
|
+
} else {
|
|
2992
|
+
let max = lineToIndex.length - 2;
|
|
2993
|
+
let mid;
|
|
2994
|
+
while (min < max) {
|
|
2995
|
+
mid = min + (max - min >> 1);
|
|
2996
|
+
if (offset < lineToIndex[mid]) {
|
|
2997
|
+
max = mid - 1;
|
|
2998
|
+
} else if (offset >= lineToIndex[mid + 1]) {
|
|
2999
|
+
min = mid + 1;
|
|
3000
|
+
} else {
|
|
3001
|
+
min = mid;
|
|
3002
|
+
break;
|
|
3003
|
+
}
|
|
3004
|
+
}
|
|
2945
3005
|
}
|
|
2946
|
-
|
|
2947
|
-
|
|
3006
|
+
return {
|
|
3007
|
+
col: offset - lineToIndex[min] + 1,
|
|
3008
|
+
line: min + 1
|
|
3009
|
+
};
|
|
2948
3010
|
}
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
for (let node2 of this.nodes) node2.cleanRaws(keepBetween);
|
|
3011
|
+
mapResolve(file) {
|
|
3012
|
+
if (/^\w+:\/\//.test(file)) {
|
|
3013
|
+
return file;
|
|
2953
3014
|
}
|
|
3015
|
+
return resolve$1(this.map.consumer().sourceRoot || this.map.root || ".", file);
|
|
2954
3016
|
}
|
|
2955
|
-
|
|
2956
|
-
if (!this.
|
|
2957
|
-
let
|
|
2958
|
-
let
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
this.indexes[iterator] += 1;
|
|
3017
|
+
origin(line, column, endLine, endColumn) {
|
|
3018
|
+
if (!this.map) return false;
|
|
3019
|
+
let consumer = this.map.consumer();
|
|
3020
|
+
let from = consumer.originalPositionFor({ column, line });
|
|
3021
|
+
if (!from.source) return false;
|
|
3022
|
+
let to;
|
|
3023
|
+
if (typeof endLine === "number") {
|
|
3024
|
+
to = consumer.originalPositionFor({ column: endColumn, line: endLine });
|
|
2964
3025
|
}
|
|
2965
|
-
|
|
3026
|
+
let fromUrl;
|
|
3027
|
+
if (isAbsolute(from.source)) {
|
|
3028
|
+
fromUrl = pathToFileURL$1(from.source);
|
|
3029
|
+
} else {
|
|
3030
|
+
fromUrl = new URL(
|
|
3031
|
+
from.source,
|
|
3032
|
+
this.map.consumer().sourceRoot || pathToFileURL$1(this.map.mapFile)
|
|
3033
|
+
);
|
|
3034
|
+
}
|
|
3035
|
+
let result2 = {
|
|
3036
|
+
column: from.column,
|
|
3037
|
+
endColumn: to && to.column,
|
|
3038
|
+
endLine: to && to.line,
|
|
3039
|
+
line: from.line,
|
|
3040
|
+
url: fromUrl.toString()
|
|
3041
|
+
};
|
|
3042
|
+
if (fromUrl.protocol === "file:") {
|
|
3043
|
+
if (fileURLToPath) {
|
|
3044
|
+
result2.file = fileURLToPath(fromUrl);
|
|
3045
|
+
} else {
|
|
3046
|
+
throw new Error(`file: protocol is not available in this PostCSS build`);
|
|
3047
|
+
}
|
|
3048
|
+
}
|
|
3049
|
+
let source = consumer.sourceContentFor(from.source);
|
|
3050
|
+
if (source) result2.source = source;
|
|
2966
3051
|
return result2;
|
|
2967
3052
|
}
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
if (!this.indexes) this.indexes = {};
|
|
2974
|
-
this.lastEach += 1;
|
|
2975
|
-
let iterator = this.lastEach;
|
|
2976
|
-
this.indexes[iterator] = 0;
|
|
2977
|
-
return iterator;
|
|
2978
|
-
}
|
|
2979
|
-
getProxyProcessor() {
|
|
2980
|
-
return {
|
|
2981
|
-
get(node2, prop) {
|
|
2982
|
-
if (prop === "proxyOf") {
|
|
2983
|
-
return node2;
|
|
2984
|
-
} else if (!node2[prop]) {
|
|
2985
|
-
return node2[prop];
|
|
2986
|
-
} else if (prop === "each" || typeof prop === "string" && prop.startsWith("walk")) {
|
|
2987
|
-
return (...args) => {
|
|
2988
|
-
return node2[prop](
|
|
2989
|
-
...args.map((i) => {
|
|
2990
|
-
if (typeof i === "function") {
|
|
2991
|
-
return (child, index2) => i(child.toProxy(), index2);
|
|
2992
|
-
} else {
|
|
2993
|
-
return i;
|
|
2994
|
-
}
|
|
2995
|
-
})
|
|
2996
|
-
);
|
|
2997
|
-
};
|
|
2998
|
-
} else if (prop === "every" || prop === "some") {
|
|
2999
|
-
return (cb) => {
|
|
3000
|
-
return node2[prop](
|
|
3001
|
-
(child, ...other) => cb(child.toProxy(), ...other)
|
|
3002
|
-
);
|
|
3003
|
-
};
|
|
3004
|
-
} else if (prop === "root") {
|
|
3005
|
-
return () => node2.root().toProxy();
|
|
3006
|
-
} else if (prop === "nodes") {
|
|
3007
|
-
return node2.nodes.map((i) => i.toProxy());
|
|
3008
|
-
} else if (prop === "first" || prop === "last") {
|
|
3009
|
-
return node2[prop].toProxy();
|
|
3010
|
-
} else {
|
|
3011
|
-
return node2[prop];
|
|
3012
|
-
}
|
|
3013
|
-
},
|
|
3014
|
-
set(node2, prop, value) {
|
|
3015
|
-
if (node2[prop] === value) return true;
|
|
3016
|
-
node2[prop] = value;
|
|
3017
|
-
if (prop === "name" || prop === "params" || prop === "selector") {
|
|
3018
|
-
node2.markDirty();
|
|
3019
|
-
}
|
|
3020
|
-
return true;
|
|
3053
|
+
toJSON() {
|
|
3054
|
+
let json = {};
|
|
3055
|
+
for (let name of ["hasBOM", "css", "file", "id"]) {
|
|
3056
|
+
if (this[name] != null) {
|
|
3057
|
+
json[name] = this[name];
|
|
3021
3058
|
}
|
|
3022
|
-
}
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
return this.proxyOf.nodes.indexOf(child);
|
|
3028
|
-
}
|
|
3029
|
-
insertAfter(exist, add) {
|
|
3030
|
-
let existIndex = this.index(exist);
|
|
3031
|
-
let nodes = this.normalize(add, this.proxyOf.nodes[existIndex]).reverse();
|
|
3032
|
-
existIndex = this.index(exist);
|
|
3033
|
-
for (let node2 of nodes) this.proxyOf.nodes.splice(existIndex + 1, 0, node2);
|
|
3034
|
-
let index2;
|
|
3035
|
-
for (let id in this.indexes) {
|
|
3036
|
-
index2 = this.indexes[id];
|
|
3037
|
-
if (existIndex < index2) {
|
|
3038
|
-
this.indexes[id] = index2 + nodes.length;
|
|
3059
|
+
}
|
|
3060
|
+
if (this.map) {
|
|
3061
|
+
json.map = { ...this.map };
|
|
3062
|
+
if (json.map.consumerCache) {
|
|
3063
|
+
json.map.consumerCache = void 0;
|
|
3039
3064
|
}
|
|
3040
3065
|
}
|
|
3041
|
-
|
|
3042
|
-
return this;
|
|
3066
|
+
return json;
|
|
3043
3067
|
}
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3068
|
+
get from() {
|
|
3069
|
+
return this.file || this.id;
|
|
3070
|
+
}
|
|
3071
|
+
};
|
|
3072
|
+
var input = Input$6;
|
|
3073
|
+
Input$6.default = Input$6;
|
|
3074
|
+
if (terminalHighlight && terminalHighlight.registerInput) {
|
|
3075
|
+
terminalHighlight.registerInput(Input$6);
|
|
3076
|
+
}
|
|
3077
|
+
let Container$5 = container;
|
|
3078
|
+
let LazyResult$3, Processor$3;
|
|
3079
|
+
let Root$6 = class Root extends Container$5 {
|
|
3080
|
+
constructor(defaults) {
|
|
3081
|
+
super(defaults);
|
|
3082
|
+
this.type = "root";
|
|
3083
|
+
if (!this.nodes) this.nodes = [];
|
|
3084
|
+
}
|
|
3085
|
+
normalize(child, sample, type) {
|
|
3086
|
+
let nodes = super.normalize(child);
|
|
3087
|
+
if (sample) {
|
|
3088
|
+
if (type === "prepend") {
|
|
3089
|
+
if (this.nodes.length > 1) {
|
|
3090
|
+
sample.raws.before = this.nodes[1].raws.before;
|
|
3091
|
+
} else {
|
|
3092
|
+
delete sample.raws.before;
|
|
3093
|
+
}
|
|
3094
|
+
} else if (this.first !== sample) {
|
|
3095
|
+
for (let node2 of nodes) {
|
|
3096
|
+
node2.raws.before = sample.raws.before;
|
|
3097
|
+
}
|
|
3055
3098
|
}
|
|
3056
3099
|
}
|
|
3057
|
-
|
|
3058
|
-
return this;
|
|
3100
|
+
return nodes;
|
|
3059
3101
|
}
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
nodes = [];
|
|
3065
|
-
} else if (Array.isArray(nodes)) {
|
|
3066
|
-
nodes = nodes.slice(0);
|
|
3067
|
-
for (let i of nodes) {
|
|
3068
|
-
if (i.parent) i.parent.removeChild(i, "ignore");
|
|
3069
|
-
}
|
|
3070
|
-
} else if (nodes.type === "root" && this.type !== "document") {
|
|
3071
|
-
nodes = nodes.nodes.slice(0);
|
|
3072
|
-
for (let i of nodes) {
|
|
3073
|
-
if (i.parent) i.parent.removeChild(i, "ignore");
|
|
3074
|
-
}
|
|
3075
|
-
} else if (nodes.type) {
|
|
3076
|
-
nodes = [nodes];
|
|
3077
|
-
} else if (nodes.prop) {
|
|
3078
|
-
if (typeof nodes.value === "undefined") {
|
|
3079
|
-
throw new Error("Value field is missed in node creation");
|
|
3080
|
-
} else if (typeof nodes.value !== "string") {
|
|
3081
|
-
nodes.value = String(nodes.value);
|
|
3082
|
-
}
|
|
3083
|
-
nodes = [new Declaration$3(nodes)];
|
|
3084
|
-
} else if (nodes.selector) {
|
|
3085
|
-
nodes = [new Rule$4(nodes)];
|
|
3086
|
-
} else if (nodes.name) {
|
|
3087
|
-
nodes = [new AtRule$4(nodes)];
|
|
3088
|
-
} else if (nodes.text) {
|
|
3089
|
-
nodes = [new Comment$3(nodes)];
|
|
3090
|
-
} else {
|
|
3091
|
-
throw new Error("Unknown node type in node creation");
|
|
3102
|
+
removeChild(child, ignore) {
|
|
3103
|
+
let index2 = this.index(child);
|
|
3104
|
+
if (!ignore && index2 === 0 && this.nodes.length > 1) {
|
|
3105
|
+
this.nodes[1].raws.before = this.nodes[index2].raws.before;
|
|
3092
3106
|
}
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3107
|
+
return super.removeChild(child);
|
|
3108
|
+
}
|
|
3109
|
+
toResult(opts = {}) {
|
|
3110
|
+
let lazy = new LazyResult$3(new Processor$3(), this, opts);
|
|
3111
|
+
return lazy.stringify();
|
|
3112
|
+
}
|
|
3113
|
+
};
|
|
3114
|
+
Root$6.registerLazyResult = (dependant) => {
|
|
3115
|
+
LazyResult$3 = dependant;
|
|
3116
|
+
};
|
|
3117
|
+
Root$6.registerProcessor = (dependant) => {
|
|
3118
|
+
Processor$3 = dependant;
|
|
3119
|
+
};
|
|
3120
|
+
var root$1 = Root$6;
|
|
3121
|
+
Root$6.default = Root$6;
|
|
3122
|
+
Container$5.registerRoot(Root$6);
|
|
3123
|
+
let list$3 = {
|
|
3124
|
+
comma(string) {
|
|
3125
|
+
return list$3.split(string, [","], true);
|
|
3126
|
+
},
|
|
3127
|
+
space(string) {
|
|
3128
|
+
let spaces = [" ", "\n", " "];
|
|
3129
|
+
return list$3.split(string, spaces);
|
|
3130
|
+
},
|
|
3131
|
+
split(string, separators, last) {
|
|
3132
|
+
let array = [];
|
|
3133
|
+
let current = "";
|
|
3134
|
+
let split = false;
|
|
3135
|
+
let func = 0;
|
|
3136
|
+
let inQuote = false;
|
|
3137
|
+
let prevQuote = "";
|
|
3138
|
+
let escape = false;
|
|
3139
|
+
for (let letter of string) {
|
|
3140
|
+
if (escape) {
|
|
3141
|
+
escape = false;
|
|
3142
|
+
} else if (letter === "\\") {
|
|
3143
|
+
escape = true;
|
|
3144
|
+
} else if (inQuote) {
|
|
3145
|
+
if (letter === prevQuote) {
|
|
3146
|
+
inQuote = false;
|
|
3101
3147
|
}
|
|
3148
|
+
} else if (letter === '"' || letter === "'") {
|
|
3149
|
+
inQuote = true;
|
|
3150
|
+
prevQuote = letter;
|
|
3151
|
+
} else if (letter === "(") {
|
|
3152
|
+
func += 1;
|
|
3153
|
+
} else if (letter === ")") {
|
|
3154
|
+
if (func > 0) func -= 1;
|
|
3155
|
+
} else if (func === 0) {
|
|
3156
|
+
if (separators.includes(letter)) split = true;
|
|
3102
3157
|
}
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
children = children.reverse();
|
|
3110
|
-
for (let child of children) {
|
|
3111
|
-
let nodes = this.normalize(child, this.first, "prepend").reverse();
|
|
3112
|
-
for (let node2 of nodes) this.proxyOf.nodes.unshift(node2);
|
|
3113
|
-
for (let id in this.indexes) {
|
|
3114
|
-
this.indexes[id] = this.indexes[id] + nodes.length;
|
|
3158
|
+
if (split) {
|
|
3159
|
+
if (current !== "") array.push(current.trim());
|
|
3160
|
+
current = "";
|
|
3161
|
+
split = false;
|
|
3162
|
+
} else {
|
|
3163
|
+
current += letter;
|
|
3115
3164
|
}
|
|
3116
3165
|
}
|
|
3117
|
-
|
|
3118
|
-
return
|
|
3166
|
+
if (last || current !== "") array.push(current.trim());
|
|
3167
|
+
return array;
|
|
3119
3168
|
}
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3169
|
+
};
|
|
3170
|
+
var list_1 = list$3;
|
|
3171
|
+
list$3.default = list$3;
|
|
3172
|
+
let Container$4 = container;
|
|
3173
|
+
let list$2 = list_1;
|
|
3174
|
+
let Rule$4 = class Rule extends Container$4 {
|
|
3175
|
+
constructor(defaults) {
|
|
3176
|
+
super(defaults);
|
|
3177
|
+
this.type = "rule";
|
|
3178
|
+
if (!this.nodes) this.nodes = [];
|
|
3124
3179
|
}
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
this.proxyOf.nodes = [];
|
|
3128
|
-
this.markDirty();
|
|
3129
|
-
return this;
|
|
3180
|
+
get selectors() {
|
|
3181
|
+
return list$2.comma(this.selector);
|
|
3130
3182
|
}
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
this.
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3183
|
+
set selectors(values) {
|
|
3184
|
+
let match = this.selector ? this.selector.match(/,\s*/) : null;
|
|
3185
|
+
let sep2 = match ? match[0] : "," + this.raw("between", "beforeOpen");
|
|
3186
|
+
this.selector = values.join(sep2);
|
|
3187
|
+
}
|
|
3188
|
+
};
|
|
3189
|
+
var rule$1 = Rule$4;
|
|
3190
|
+
Rule$4.default = Rule$4;
|
|
3191
|
+
Container$4.registerRule(Rule$4);
|
|
3192
|
+
let AtRule$3 = atRule$1;
|
|
3193
|
+
let Comment$4 = comment$1;
|
|
3194
|
+
let Declaration$3 = declaration;
|
|
3195
|
+
let Input$5 = input;
|
|
3196
|
+
let PreviousMap2 = previousMap;
|
|
3197
|
+
let Root$5 = root$1;
|
|
3198
|
+
let Rule$3 = rule$1;
|
|
3199
|
+
function fromJSON$2(json, inputs) {
|
|
3200
|
+
if (Array.isArray(json)) return json.map((n) => fromJSON$2(n));
|
|
3201
|
+
let { inputs: ownInputs, ...defaults } = json;
|
|
3202
|
+
if (ownInputs) {
|
|
3203
|
+
inputs = [];
|
|
3204
|
+
for (let input2 of ownInputs) {
|
|
3205
|
+
let inputHydrated = { ...input2, __proto__: Input$5.prototype };
|
|
3206
|
+
if (inputHydrated.map) {
|
|
3207
|
+
inputHydrated.map = {
|
|
3208
|
+
...inputHydrated.map,
|
|
3209
|
+
__proto__: PreviousMap2.prototype
|
|
3210
|
+
};
|
|
3140
3211
|
}
|
|
3212
|
+
inputs.push(inputHydrated);
|
|
3141
3213
|
}
|
|
3142
|
-
this.markDirty();
|
|
3143
|
-
return this;
|
|
3144
3214
|
}
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3215
|
+
if (defaults.nodes) {
|
|
3216
|
+
defaults.nodes = json.nodes.map((n) => fromJSON$2(n, inputs));
|
|
3217
|
+
}
|
|
3218
|
+
if (defaults.source) {
|
|
3219
|
+
let { inputId, ...source } = defaults.source;
|
|
3220
|
+
defaults.source = source;
|
|
3221
|
+
if (inputId != null) {
|
|
3222
|
+
defaults.source.input = inputs[inputId];
|
|
3149
3223
|
}
|
|
3150
|
-
this.walkDecls((decl) => {
|
|
3151
|
-
if (opts.props && !opts.props.includes(decl.prop)) return;
|
|
3152
|
-
if (opts.fast && !decl.value.includes(opts.fast)) return;
|
|
3153
|
-
decl.value = decl.value.replace(pattern, callback);
|
|
3154
|
-
});
|
|
3155
|
-
this.markDirty();
|
|
3156
|
-
return this;
|
|
3157
3224
|
}
|
|
3158
|
-
|
|
3159
|
-
return
|
|
3225
|
+
if (defaults.type === "root") {
|
|
3226
|
+
return new Root$5(defaults);
|
|
3227
|
+
} else if (defaults.type === "decl") {
|
|
3228
|
+
return new Declaration$3(defaults);
|
|
3229
|
+
} else if (defaults.type === "rule") {
|
|
3230
|
+
return new Rule$3(defaults);
|
|
3231
|
+
} else if (defaults.type === "comment") {
|
|
3232
|
+
return new Comment$4(defaults);
|
|
3233
|
+
} else if (defaults.type === "atrule") {
|
|
3234
|
+
return new AtRule$3(defaults);
|
|
3235
|
+
} else {
|
|
3236
|
+
throw new Error("Unknown node type: " + json.type);
|
|
3160
3237
|
}
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
}
|
|
3238
|
+
}
|
|
3239
|
+
var fromJSON_1 = fromJSON$2;
|
|
3240
|
+
fromJSON$2.default = fromJSON$2;
|
|
3241
|
+
let { dirname, relative, resolve, sep } = require$$2;
|
|
3242
|
+
let { SourceMapConsumer, SourceMapGenerator } = require$$2;
|
|
3243
|
+
let { pathToFileURL } = require$$2;
|
|
3244
|
+
let Input$4 = input;
|
|
3245
|
+
let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);
|
|
3246
|
+
let pathAvailable = Boolean(dirname && resolve && relative && sep);
|
|
3247
|
+
let MapGenerator$2 = class MapGenerator {
|
|
3248
|
+
constructor(stringify2, root2, opts, cssString) {
|
|
3249
|
+
this.stringify = stringify2;
|
|
3250
|
+
this.mapOpts = opts.map || {};
|
|
3251
|
+
this.root = root2;
|
|
3252
|
+
this.opts = opts;
|
|
3253
|
+
this.css = cssString;
|
|
3254
|
+
this.originalCSS = cssString;
|
|
3255
|
+
this.usesFileUrls = !this.mapOpts.from && this.mapOpts.absolute;
|
|
3256
|
+
this.memoizedFileURLs = /* @__PURE__ */ new Map();
|
|
3257
|
+
this.memoizedPaths = /* @__PURE__ */ new Map();
|
|
3258
|
+
this.memoizedURLs = /* @__PURE__ */ new Map();
|
|
3174
3259
|
}
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3260
|
+
addAnnotation() {
|
|
3261
|
+
let content;
|
|
3262
|
+
if (this.isInline()) {
|
|
3263
|
+
content = "data:application/json;base64," + this.toBase64(this.map.toString());
|
|
3264
|
+
} else if (typeof this.mapOpts.annotation === "string") {
|
|
3265
|
+
content = this.mapOpts.annotation;
|
|
3266
|
+
} else if (typeof this.mapOpts.annotation === "function") {
|
|
3267
|
+
content = this.mapOpts.annotation(this.opts.to, this.root);
|
|
3268
|
+
} else {
|
|
3269
|
+
content = this.outputFile() + ".map";
|
|
3183
3270
|
}
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3271
|
+
let eol = "\n";
|
|
3272
|
+
if (this.css.includes("\r\n")) eol = "\r\n";
|
|
3273
|
+
this.css += eol + "/*# sourceMappingURL=" + content + " */";
|
|
3274
|
+
}
|
|
3275
|
+
applyPrevMaps() {
|
|
3276
|
+
for (let prev of this.previous()) {
|
|
3277
|
+
let from = this.toUrl(this.path(prev.file));
|
|
3278
|
+
let root2 = prev.root || dirname(prev.file);
|
|
3279
|
+
let map;
|
|
3280
|
+
if (this.mapOpts.sourcesContent === false) {
|
|
3281
|
+
map = new SourceMapConsumer(prev.text);
|
|
3282
|
+
if (map.sourcesContent) {
|
|
3283
|
+
map.sourcesContent = null;
|
|
3188
3284
|
}
|
|
3189
|
-
}
|
|
3190
|
-
|
|
3191
|
-
return this.walk((child, i) => {
|
|
3192
|
-
if (child.type === "atrule" && child.name === name) {
|
|
3193
|
-
return callback(child, i);
|
|
3285
|
+
} else {
|
|
3286
|
+
map = prev.consumer();
|
|
3194
3287
|
}
|
|
3195
|
-
|
|
3288
|
+
this.map.applySourceMap(map, from, this.toUrl(this.path(root2)));
|
|
3289
|
+
}
|
|
3196
3290
|
}
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3291
|
+
clearAnnotation() {
|
|
3292
|
+
if (this.mapOpts.annotation === false) return;
|
|
3293
|
+
if (this.root) {
|
|
3294
|
+
let node2;
|
|
3295
|
+
for (let i = this.root.nodes.length - 1; i >= 0; i--) {
|
|
3296
|
+
node2 = this.root.nodes[i];
|
|
3297
|
+
if (node2.type !== "comment") continue;
|
|
3298
|
+
if (node2.text.startsWith("# sourceMappingURL=")) {
|
|
3299
|
+
this.root.removeChild(i);
|
|
3300
|
+
}
|
|
3201
3301
|
}
|
|
3202
|
-
})
|
|
3302
|
+
} else if (this.css) {
|
|
3303
|
+
this.css = this.css.replace(/\n*\/\*#[\S\s]*?\*\/$/gm, "");
|
|
3304
|
+
}
|
|
3203
3305
|
}
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
return this.
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3306
|
+
generate() {
|
|
3307
|
+
this.clearAnnotation();
|
|
3308
|
+
if (pathAvailable && sourceMapAvailable && this.isMap()) {
|
|
3309
|
+
return this.generateMap();
|
|
3310
|
+
} else {
|
|
3311
|
+
let result2 = "";
|
|
3312
|
+
this.stringify(this.root, (i) => {
|
|
3313
|
+
result2 += i;
|
|
3211
3314
|
});
|
|
3315
|
+
return [result2];
|
|
3212
3316
|
}
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3317
|
+
}
|
|
3318
|
+
generateMap() {
|
|
3319
|
+
if (this.root) {
|
|
3320
|
+
this.generateString();
|
|
3321
|
+
} else if (this.previous().length === 1) {
|
|
3322
|
+
let prev = this.previous()[0].consumer();
|
|
3323
|
+
prev.file = this.outputFile();
|
|
3324
|
+
this.map = SourceMapGenerator.fromSourceMap(prev, {
|
|
3325
|
+
ignoreInvalidMapping: true
|
|
3326
|
+
});
|
|
3327
|
+
} else {
|
|
3328
|
+
this.map = new SourceMapGenerator({
|
|
3329
|
+
file: this.outputFile(),
|
|
3330
|
+
ignoreInvalidMapping: true
|
|
3331
|
+
});
|
|
3332
|
+
this.map.addMapping({
|
|
3333
|
+
generated: { column: 0, line: 1 },
|
|
3334
|
+
original: { column: 0, line: 1 },
|
|
3335
|
+
source: this.opts.from ? this.toUrl(this.path(this.opts.from)) : "<no source>"
|
|
3218
3336
|
});
|
|
3219
3337
|
}
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3338
|
+
if (this.isSourcesContent()) this.setSourcesContent();
|
|
3339
|
+
if (this.root && this.previous().length > 0) this.applyPrevMaps();
|
|
3340
|
+
if (this.isAnnotation()) this.addAnnotation();
|
|
3341
|
+
if (this.isInline()) {
|
|
3342
|
+
return [this.css];
|
|
3343
|
+
} else {
|
|
3344
|
+
return [this.css, this.map];
|
|
3345
|
+
}
|
|
3225
3346
|
}
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3347
|
+
generateString() {
|
|
3348
|
+
this.css = "";
|
|
3349
|
+
this.map = new SourceMapGenerator({
|
|
3350
|
+
file: this.outputFile(),
|
|
3351
|
+
ignoreInvalidMapping: true
|
|
3352
|
+
});
|
|
3353
|
+
let line = 1;
|
|
3354
|
+
let column = 1;
|
|
3355
|
+
let noSource = "<no source>";
|
|
3356
|
+
let mapping = {
|
|
3357
|
+
generated: { column: 0, line: 0 },
|
|
3358
|
+
original: { column: 0, line: 0 },
|
|
3359
|
+
source: ""
|
|
3360
|
+
};
|
|
3361
|
+
let last, lines;
|
|
3362
|
+
this.stringify(this.root, (str, node2, type) => {
|
|
3363
|
+
this.css += str;
|
|
3364
|
+
if (node2 && type !== "end") {
|
|
3365
|
+
mapping.generated.line = line;
|
|
3366
|
+
mapping.generated.column = column - 1;
|
|
3367
|
+
if (node2.source && node2.source.start) {
|
|
3368
|
+
mapping.source = this.sourcePath(node2);
|
|
3369
|
+
mapping.original.line = node2.source.start.line;
|
|
3370
|
+
mapping.original.column = node2.source.start.column - 1;
|
|
3371
|
+
this.map.addMapping(mapping);
|
|
3372
|
+
} else {
|
|
3373
|
+
mapping.source = noSource;
|
|
3374
|
+
mapping.original.line = 1;
|
|
3375
|
+
mapping.original.column = 0;
|
|
3376
|
+
this.map.addMapping(mapping);
|
|
3232
3377
|
}
|
|
3233
|
-
}
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3378
|
+
}
|
|
3379
|
+
lines = str.match(/\n/g);
|
|
3380
|
+
if (lines) {
|
|
3381
|
+
line += lines.length;
|
|
3382
|
+
last = str.lastIndexOf("\n");
|
|
3383
|
+
column = str.length - last;
|
|
3384
|
+
} else {
|
|
3385
|
+
column += str.length;
|
|
3386
|
+
}
|
|
3387
|
+
if (node2 && type !== "start") {
|
|
3388
|
+
let p = node2.parent || { raws: {} };
|
|
3389
|
+
let childless = node2.type === "decl" || node2.type === "atrule" && !node2.nodes;
|
|
3390
|
+
if (!childless || node2 !== p.last || p.raws.semicolon) {
|
|
3391
|
+
if (node2.source && node2.source.end) {
|
|
3392
|
+
mapping.source = this.sourcePath(node2);
|
|
3393
|
+
mapping.original.line = node2.source.end.line;
|
|
3394
|
+
mapping.original.column = node2.source.end.column - 1;
|
|
3395
|
+
mapping.generated.line = line;
|
|
3396
|
+
mapping.generated.column = column - 2;
|
|
3397
|
+
this.map.addMapping(mapping);
|
|
3398
|
+
} else {
|
|
3399
|
+
mapping.source = noSource;
|
|
3400
|
+
mapping.original.line = 1;
|
|
3401
|
+
mapping.original.column = 0;
|
|
3402
|
+
mapping.generated.line = line;
|
|
3403
|
+
mapping.generated.column = column - 1;
|
|
3404
|
+
this.map.addMapping(mapping);
|
|
3405
|
+
}
|
|
3239
3406
|
}
|
|
3240
|
-
});
|
|
3241
|
-
}
|
|
3242
|
-
return this.walk((child, i) => {
|
|
3243
|
-
if (child.type === "rule" && child.selector === selector) {
|
|
3244
|
-
return callback(child, i);
|
|
3245
3407
|
}
|
|
3246
3408
|
});
|
|
3247
3409
|
}
|
|
3248
|
-
|
|
3249
|
-
if (
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
|
|
3255
|
-
}
|
|
3256
|
-
};
|
|
3257
|
-
Container$7.registerParse = (dependant) => {
|
|
3258
|
-
parse$4 = dependant;
|
|
3259
|
-
};
|
|
3260
|
-
Container$7.registerRule = (dependant) => {
|
|
3261
|
-
Rule$4 = dependant;
|
|
3262
|
-
};
|
|
3263
|
-
Container$7.registerAtRule = (dependant) => {
|
|
3264
|
-
AtRule$4 = dependant;
|
|
3265
|
-
};
|
|
3266
|
-
Container$7.registerRoot = (dependant) => {
|
|
3267
|
-
Root$6 = dependant;
|
|
3268
|
-
};
|
|
3269
|
-
var container = Container$7;
|
|
3270
|
-
Container$7.default = Container$7;
|
|
3271
|
-
Container$7.rebuild = (node2) => {
|
|
3272
|
-
if (node2.type === "atrule") {
|
|
3273
|
-
Object.setPrototypeOf(node2, AtRule$4.prototype);
|
|
3274
|
-
} else if (node2.type === "rule") {
|
|
3275
|
-
Object.setPrototypeOf(node2, Rule$4.prototype);
|
|
3276
|
-
} else if (node2.type === "decl") {
|
|
3277
|
-
Object.setPrototypeOf(node2, Declaration$3.prototype);
|
|
3278
|
-
} else if (node2.type === "comment") {
|
|
3279
|
-
Object.setPrototypeOf(node2, Comment$3.prototype);
|
|
3280
|
-
} else if (node2.type === "root") {
|
|
3281
|
-
Object.setPrototypeOf(node2, Root$6.prototype);
|
|
3282
|
-
}
|
|
3283
|
-
node2[my$1] = true;
|
|
3284
|
-
if (node2.nodes) {
|
|
3285
|
-
node2.nodes.forEach((child) => {
|
|
3286
|
-
Container$7.rebuild(child);
|
|
3287
|
-
});
|
|
3288
|
-
}
|
|
3289
|
-
};
|
|
3290
|
-
let Container$6 = container;
|
|
3291
|
-
let LazyResult$4, Processor$3;
|
|
3292
|
-
let Document$3 = class Document extends Container$6 {
|
|
3293
|
-
constructor(defaults) {
|
|
3294
|
-
super({ type: "document", ...defaults });
|
|
3295
|
-
if (!this.nodes) {
|
|
3296
|
-
this.nodes = [];
|
|
3410
|
+
isAnnotation() {
|
|
3411
|
+
if (this.isInline()) {
|
|
3412
|
+
return true;
|
|
3413
|
+
}
|
|
3414
|
+
if (typeof this.mapOpts.annotation !== "undefined") {
|
|
3415
|
+
return this.mapOpts.annotation;
|
|
3297
3416
|
}
|
|
3417
|
+
if (this.previous().length) {
|
|
3418
|
+
return this.previous().some((i) => i.annotation);
|
|
3419
|
+
}
|
|
3420
|
+
return true;
|
|
3298
3421
|
}
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3422
|
+
isInline() {
|
|
3423
|
+
if (typeof this.mapOpts.inline !== "undefined") {
|
|
3424
|
+
return this.mapOpts.inline;
|
|
3425
|
+
}
|
|
3426
|
+
let annotation = this.mapOpts.annotation;
|
|
3427
|
+
if (typeof annotation !== "undefined" && annotation !== true) {
|
|
3428
|
+
return false;
|
|
3429
|
+
}
|
|
3430
|
+
if (this.previous().length) {
|
|
3431
|
+
return this.previous().some((i) => i.inline);
|
|
3432
|
+
}
|
|
3433
|
+
return true;
|
|
3302
3434
|
}
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
}
|
|
3307
|
-
|
|
3308
|
-
Processor$3 = dependant;
|
|
3309
|
-
};
|
|
3310
|
-
var document$1 = Document$3;
|
|
3311
|
-
Document$3.default = Document$3;
|
|
3312
|
-
let printed = {};
|
|
3313
|
-
var warnOnce$2 = function warnOnce(message) {
|
|
3314
|
-
if (printed[message]) return;
|
|
3315
|
-
printed[message] = true;
|
|
3316
|
-
if (typeof console !== "undefined" && console.warn) {
|
|
3317
|
-
console.warn(message);
|
|
3435
|
+
isMap() {
|
|
3436
|
+
if (typeof this.opts.map !== "undefined") {
|
|
3437
|
+
return !!this.opts.map;
|
|
3438
|
+
}
|
|
3439
|
+
return this.previous().length > 0;
|
|
3318
3440
|
}
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
this.
|
|
3324
|
-
|
|
3325
|
-
let range = opts.node.rangeBy(opts);
|
|
3326
|
-
this.line = range.start.line;
|
|
3327
|
-
this.column = range.start.column;
|
|
3328
|
-
this.endLine = range.end.line;
|
|
3329
|
-
this.endColumn = range.end.column;
|
|
3441
|
+
isSourcesContent() {
|
|
3442
|
+
if (typeof this.mapOpts.sourcesContent !== "undefined") {
|
|
3443
|
+
return this.mapOpts.sourcesContent;
|
|
3444
|
+
}
|
|
3445
|
+
if (this.previous().length) {
|
|
3446
|
+
return this.previous().some((i) => i.withContent());
|
|
3330
3447
|
}
|
|
3331
|
-
|
|
3448
|
+
return true;
|
|
3332
3449
|
}
|
|
3333
|
-
|
|
3334
|
-
if (this.
|
|
3335
|
-
return this.
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3450
|
+
outputFile() {
|
|
3451
|
+
if (this.opts.to) {
|
|
3452
|
+
return this.path(this.opts.to);
|
|
3453
|
+
} else if (this.opts.from) {
|
|
3454
|
+
return this.path(this.opts.from);
|
|
3455
|
+
} else {
|
|
3456
|
+
return "to.css";
|
|
3340
3457
|
}
|
|
3341
|
-
|
|
3342
|
-
|
|
3458
|
+
}
|
|
3459
|
+
path(file) {
|
|
3460
|
+
if (this.mapOpts.absolute) return file;
|
|
3461
|
+
if (file.charCodeAt(0) === 60) return file;
|
|
3462
|
+
if (/^\w+:\/\//.test(file)) return file;
|
|
3463
|
+
let cached = this.memoizedPaths.get(file);
|
|
3464
|
+
if (cached) return cached;
|
|
3465
|
+
let from = this.opts.to ? dirname(this.opts.to) : ".";
|
|
3466
|
+
if (typeof this.mapOpts.annotation === "string") {
|
|
3467
|
+
from = dirname(resolve(from, this.mapOpts.annotation));
|
|
3343
3468
|
}
|
|
3344
|
-
|
|
3469
|
+
let path = relative(from, file);
|
|
3470
|
+
this.memoizedPaths.set(file, path);
|
|
3471
|
+
return path;
|
|
3345
3472
|
}
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3473
|
+
previous() {
|
|
3474
|
+
if (!this.previousMaps) {
|
|
3475
|
+
this.previousMaps = [];
|
|
3476
|
+
if (this.root) {
|
|
3477
|
+
this.root.walk((node2) => {
|
|
3478
|
+
if (node2.source && node2.source.input.map) {
|
|
3479
|
+
let map = node2.source.input.map;
|
|
3480
|
+
if (!this.previousMaps.includes(map)) {
|
|
3481
|
+
this.previousMaps.push(map);
|
|
3482
|
+
}
|
|
3483
|
+
}
|
|
3484
|
+
});
|
|
3485
|
+
} else {
|
|
3486
|
+
let input2 = new Input$4(this.originalCSS, this.opts);
|
|
3487
|
+
if (input2.map) this.previousMaps.push(input2.map);
|
|
3488
|
+
}
|
|
3489
|
+
}
|
|
3490
|
+
return this.previousMaps;
|
|
3358
3491
|
}
|
|
3359
|
-
|
|
3360
|
-
|
|
3492
|
+
setSourcesContent() {
|
|
3493
|
+
let already = {};
|
|
3494
|
+
if (this.root) {
|
|
3495
|
+
this.root.walk((node2) => {
|
|
3496
|
+
if (node2.source) {
|
|
3497
|
+
let from = node2.source.input.from;
|
|
3498
|
+
if (from && !already[from]) {
|
|
3499
|
+
already[from] = true;
|
|
3500
|
+
let fromUrl = this.usesFileUrls ? this.toFileUrl(from) : this.toUrl(this.path(from));
|
|
3501
|
+
this.map.setSourceContent(fromUrl, node2.source.input.css);
|
|
3502
|
+
}
|
|
3503
|
+
}
|
|
3504
|
+
});
|
|
3505
|
+
} else if (this.css) {
|
|
3506
|
+
let from = this.opts.from ? this.toUrl(this.path(this.opts.from)) : "<no source>";
|
|
3507
|
+
this.map.setSourceContent(from, this.css);
|
|
3508
|
+
}
|
|
3361
3509
|
}
|
|
3362
|
-
|
|
3363
|
-
if (
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3510
|
+
sourcePath(node2) {
|
|
3511
|
+
if (this.mapOpts.from) {
|
|
3512
|
+
return this.toUrl(this.mapOpts.from);
|
|
3513
|
+
} else if (this.usesFileUrls) {
|
|
3514
|
+
return this.toFileUrl(node2.source.input.from);
|
|
3515
|
+
} else {
|
|
3516
|
+
return this.toUrl(this.path(node2.source.input.from));
|
|
3367
3517
|
}
|
|
3368
|
-
let warning2 = new Warning$1(text, opts);
|
|
3369
|
-
this.messages.push(warning2);
|
|
3370
|
-
return warning2;
|
|
3371
3518
|
}
|
|
3372
|
-
|
|
3373
|
-
|
|
3519
|
+
toBase64(str) {
|
|
3520
|
+
if (Buffer) {
|
|
3521
|
+
return Buffer.from(str).toString("base64");
|
|
3522
|
+
} else {
|
|
3523
|
+
return window.btoa(unescape(encodeURIComponent(str)));
|
|
3524
|
+
}
|
|
3374
3525
|
}
|
|
3375
|
-
|
|
3376
|
-
|
|
3526
|
+
toFileUrl(path) {
|
|
3527
|
+
let cached = this.memoizedFileURLs.get(path);
|
|
3528
|
+
if (cached) return cached;
|
|
3529
|
+
if (pathToFileURL) {
|
|
3530
|
+
let fileURL = pathToFileURL(path).toString();
|
|
3531
|
+
this.memoizedFileURLs.set(path, fileURL);
|
|
3532
|
+
return fileURL;
|
|
3533
|
+
} else {
|
|
3534
|
+
throw new Error(
|
|
3535
|
+
"`map.absolute` option is not available in this PostCSS build"
|
|
3536
|
+
);
|
|
3537
|
+
}
|
|
3538
|
+
}
|
|
3539
|
+
toUrl(path) {
|
|
3540
|
+
let cached = this.memoizedURLs.get(path);
|
|
3541
|
+
if (cached) return cached;
|
|
3542
|
+
if (sep === "\\") {
|
|
3543
|
+
path = path.replace(/\\/g, "/");
|
|
3544
|
+
}
|
|
3545
|
+
let url = encodeURI(path).replace(/[#?]/g, encodeURIComponent);
|
|
3546
|
+
this.memoizedURLs.set(path, url);
|
|
3547
|
+
return url;
|
|
3377
3548
|
}
|
|
3378
3549
|
};
|
|
3379
|
-
var
|
|
3380
|
-
Result$3.default = Result$3;
|
|
3550
|
+
var mapGenerator = MapGenerator$2;
|
|
3381
3551
|
const SINGLE_QUOTE = "'".charCodeAt(0);
|
|
3382
3552
|
const DOUBLE_QUOTE = '"'.charCodeAt(0);
|
|
3383
3553
|
const BACKSLASH = "\\".charCodeAt(0);
|
|
@@ -3404,8 +3574,8 @@ const RE_HEX_ESCAPE = /[\da-f]/i;
|
|
|
3404
3574
|
var tokenize = function tokenizer(input2, options = {}) {
|
|
3405
3575
|
let css = input2.css.valueOf();
|
|
3406
3576
|
let ignore = options.ignoreErrors;
|
|
3407
|
-
let code,
|
|
3408
|
-
let escaped, escapePos,
|
|
3577
|
+
let code, content, escape, next, quote;
|
|
3578
|
+
let currentToken, escaped, escapePos, n, prev;
|
|
3409
3579
|
let length = css.length;
|
|
3410
3580
|
let pos = 0;
|
|
3411
3581
|
let buffer = [];
|
|
@@ -3528,203 +3698,70 @@ var tokenize = function tokenizer(input2, options = {}) {
|
|
|
3528
3698
|
escape = true;
|
|
3529
3699
|
while (css.charCodeAt(next + 1) === BACKSLASH) {
|
|
3530
3700
|
next += 1;
|
|
3531
|
-
escape = !escape;
|
|
3532
|
-
}
|
|
3533
|
-
code = css.charCodeAt(next + 1);
|
|
3534
|
-
if (escape && code !== SLASH && code !== SPACE && code !== NEWLINE && code !== TAB && code !== CR && code !== FEED) {
|
|
3535
|
-
next += 1;
|
|
3536
|
-
if (RE_HEX_ESCAPE.test(css.charAt(next))) {
|
|
3537
|
-
while (RE_HEX_ESCAPE.test(css.charAt(next + 1))) {
|
|
3538
|
-
next += 1;
|
|
3539
|
-
}
|
|
3540
|
-
if (css.charCodeAt(next + 1) === SPACE) {
|
|
3541
|
-
next += 1;
|
|
3542
|
-
}
|
|
3543
|
-
}
|
|
3544
|
-
}
|
|
3545
|
-
currentToken = ["word", css.slice(pos, next + 1), pos, next];
|
|
3546
|
-
pos = next;
|
|
3547
|
-
break;
|
|
3548
|
-
}
|
|
3549
|
-
default: {
|
|
3550
|
-
if (code === SLASH && css.charCodeAt(pos + 1) === ASTERISK) {
|
|
3551
|
-
next = css.indexOf("*/", pos + 2) + 1;
|
|
3552
|
-
if (next === 0) {
|
|
3553
|
-
if (ignore || ignoreUnclosed) {
|
|
3554
|
-
next = css.length;
|
|
3555
|
-
} else {
|
|
3556
|
-
unclosed("comment");
|
|
3557
|
-
}
|
|
3558
|
-
}
|
|
3559
|
-
currentToken = ["comment", css.slice(pos, next + 1), pos, next];
|
|
3560
|
-
pos = next;
|
|
3561
|
-
} else {
|
|
3562
|
-
RE_WORD_END.lastIndex = pos + 1;
|
|
3563
|
-
RE_WORD_END.test(css);
|
|
3564
|
-
if (RE_WORD_END.lastIndex === 0) {
|
|
3565
|
-
next = css.length - 1;
|
|
3566
|
-
} else {
|
|
3567
|
-
next = RE_WORD_END.lastIndex - 2;
|
|
3568
|
-
}
|
|
3569
|
-
currentToken = ["word", css.slice(pos, next + 1), pos, next];
|
|
3570
|
-
buffer.push(currentToken);
|
|
3571
|
-
pos = next;
|
|
3572
|
-
}
|
|
3573
|
-
break;
|
|
3574
|
-
}
|
|
3575
|
-
}
|
|
3576
|
-
pos++;
|
|
3577
|
-
return currentToken;
|
|
3578
|
-
}
|
|
3579
|
-
function back(token) {
|
|
3580
|
-
returned.push(token);
|
|
3581
|
-
}
|
|
3582
|
-
return {
|
|
3583
|
-
back,
|
|
3584
|
-
endOfFile,
|
|
3585
|
-
nextToken,
|
|
3586
|
-
position
|
|
3587
|
-
};
|
|
3588
|
-
};
|
|
3589
|
-
let Container$5 = container;
|
|
3590
|
-
let AtRule$3 = class AtRule extends Container$5 {
|
|
3591
|
-
constructor(defaults) {
|
|
3592
|
-
super(defaults);
|
|
3593
|
-
this.type = "atrule";
|
|
3594
|
-
}
|
|
3595
|
-
append(...children) {
|
|
3596
|
-
if (!this.proxyOf.nodes) this.nodes = [];
|
|
3597
|
-
return super.append(...children);
|
|
3598
|
-
}
|
|
3599
|
-
prepend(...children) {
|
|
3600
|
-
if (!this.proxyOf.nodes) this.nodes = [];
|
|
3601
|
-
return super.prepend(...children);
|
|
3602
|
-
}
|
|
3603
|
-
};
|
|
3604
|
-
var atRule = AtRule$3;
|
|
3605
|
-
AtRule$3.default = AtRule$3;
|
|
3606
|
-
Container$5.registerAtRule(AtRule$3);
|
|
3607
|
-
let Container$4 = container;
|
|
3608
|
-
let LazyResult$3, Processor$2;
|
|
3609
|
-
let Root$5 = class Root extends Container$4 {
|
|
3610
|
-
constructor(defaults) {
|
|
3611
|
-
super(defaults);
|
|
3612
|
-
this.type = "root";
|
|
3613
|
-
if (!this.nodes) this.nodes = [];
|
|
3614
|
-
}
|
|
3615
|
-
normalize(child, sample, type) {
|
|
3616
|
-
let nodes = super.normalize(child);
|
|
3617
|
-
if (sample) {
|
|
3618
|
-
if (type === "prepend") {
|
|
3619
|
-
if (this.nodes.length > 1) {
|
|
3620
|
-
sample.raws.before = this.nodes[1].raws.before;
|
|
3621
|
-
} else {
|
|
3622
|
-
delete sample.raws.before;
|
|
3623
|
-
}
|
|
3624
|
-
} else if (this.first !== sample) {
|
|
3625
|
-
for (let node2 of nodes) {
|
|
3626
|
-
node2.raws.before = sample.raws.before;
|
|
3627
|
-
}
|
|
3628
|
-
}
|
|
3629
|
-
}
|
|
3630
|
-
return nodes;
|
|
3631
|
-
}
|
|
3632
|
-
removeChild(child, ignore) {
|
|
3633
|
-
let index2 = this.index(child);
|
|
3634
|
-
if (!ignore && index2 === 0 && this.nodes.length > 1) {
|
|
3635
|
-
this.nodes[1].raws.before = this.nodes[index2].raws.before;
|
|
3636
|
-
}
|
|
3637
|
-
return super.removeChild(child);
|
|
3638
|
-
}
|
|
3639
|
-
toResult(opts = {}) {
|
|
3640
|
-
let lazy = new LazyResult$3(new Processor$2(), this, opts);
|
|
3641
|
-
return lazy.stringify();
|
|
3642
|
-
}
|
|
3643
|
-
};
|
|
3644
|
-
Root$5.registerLazyResult = (dependant) => {
|
|
3645
|
-
LazyResult$3 = dependant;
|
|
3646
|
-
};
|
|
3647
|
-
Root$5.registerProcessor = (dependant) => {
|
|
3648
|
-
Processor$2 = dependant;
|
|
3649
|
-
};
|
|
3650
|
-
var root = Root$5;
|
|
3651
|
-
Root$5.default = Root$5;
|
|
3652
|
-
Container$4.registerRoot(Root$5);
|
|
3653
|
-
let list$2 = {
|
|
3654
|
-
comma(string) {
|
|
3655
|
-
return list$2.split(string, [","], true);
|
|
3656
|
-
},
|
|
3657
|
-
space(string) {
|
|
3658
|
-
let spaces = [" ", "\n", " "];
|
|
3659
|
-
return list$2.split(string, spaces);
|
|
3660
|
-
},
|
|
3661
|
-
split(string, separators, last) {
|
|
3662
|
-
let array = [];
|
|
3663
|
-
let current = "";
|
|
3664
|
-
let split = false;
|
|
3665
|
-
let func = 0;
|
|
3666
|
-
let inQuote = false;
|
|
3667
|
-
let prevQuote = "";
|
|
3668
|
-
let escape = false;
|
|
3669
|
-
for (let letter of string) {
|
|
3670
|
-
if (escape) {
|
|
3671
|
-
escape = false;
|
|
3672
|
-
} else if (letter === "\\") {
|
|
3673
|
-
escape = true;
|
|
3674
|
-
} else if (inQuote) {
|
|
3675
|
-
if (letter === prevQuote) {
|
|
3676
|
-
inQuote = false;
|
|
3701
|
+
escape = !escape;
|
|
3677
3702
|
}
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3703
|
+
code = css.charCodeAt(next + 1);
|
|
3704
|
+
if (escape && code !== SLASH && code !== SPACE && code !== NEWLINE && code !== TAB && code !== CR && code !== FEED) {
|
|
3705
|
+
next += 1;
|
|
3706
|
+
if (RE_HEX_ESCAPE.test(css.charAt(next))) {
|
|
3707
|
+
while (RE_HEX_ESCAPE.test(css.charAt(next + 1))) {
|
|
3708
|
+
next += 1;
|
|
3709
|
+
}
|
|
3710
|
+
if (css.charCodeAt(next + 1) === SPACE) {
|
|
3711
|
+
next += 1;
|
|
3712
|
+
}
|
|
3713
|
+
}
|
|
3714
|
+
}
|
|
3715
|
+
currentToken = ["word", css.slice(pos, next + 1), pos, next];
|
|
3716
|
+
pos = next;
|
|
3717
|
+
break;
|
|
3687
3718
|
}
|
|
3688
|
-
|
|
3689
|
-
if (
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3719
|
+
default: {
|
|
3720
|
+
if (code === SLASH && css.charCodeAt(pos + 1) === ASTERISK) {
|
|
3721
|
+
next = css.indexOf("*/", pos + 2) + 1;
|
|
3722
|
+
if (next === 0) {
|
|
3723
|
+
if (ignore || ignoreUnclosed) {
|
|
3724
|
+
next = css.length;
|
|
3725
|
+
} else {
|
|
3726
|
+
unclosed("comment");
|
|
3727
|
+
}
|
|
3728
|
+
}
|
|
3729
|
+
currentToken = ["comment", css.slice(pos, next + 1), pos, next];
|
|
3730
|
+
pos = next;
|
|
3731
|
+
} else {
|
|
3732
|
+
RE_WORD_END.lastIndex = pos + 1;
|
|
3733
|
+
RE_WORD_END.test(css);
|
|
3734
|
+
if (RE_WORD_END.lastIndex === 0) {
|
|
3735
|
+
next = css.length - 1;
|
|
3736
|
+
} else {
|
|
3737
|
+
next = RE_WORD_END.lastIndex - 2;
|
|
3738
|
+
}
|
|
3739
|
+
currentToken = ["word", css.slice(pos, next + 1), pos, next];
|
|
3740
|
+
buffer.push(currentToken);
|
|
3741
|
+
pos = next;
|
|
3742
|
+
}
|
|
3743
|
+
break;
|
|
3694
3744
|
}
|
|
3695
3745
|
}
|
|
3696
|
-
|
|
3697
|
-
return
|
|
3698
|
-
}
|
|
3699
|
-
};
|
|
3700
|
-
var list_1 = list$2;
|
|
3701
|
-
list$2.default = list$2;
|
|
3702
|
-
let Container$3 = container;
|
|
3703
|
-
let list$1 = list_1;
|
|
3704
|
-
let Rule$3 = class Rule extends Container$3 {
|
|
3705
|
-
constructor(defaults) {
|
|
3706
|
-
super(defaults);
|
|
3707
|
-
this.type = "rule";
|
|
3708
|
-
if (!this.nodes) this.nodes = [];
|
|
3709
|
-
}
|
|
3710
|
-
get selectors() {
|
|
3711
|
-
return list$1.comma(this.selector);
|
|
3746
|
+
pos++;
|
|
3747
|
+
return currentToken;
|
|
3712
3748
|
}
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
let sep2 = match ? match[0] : "," + this.raw("between", "beforeOpen");
|
|
3716
|
-
this.selector = values.join(sep2);
|
|
3749
|
+
function back(token) {
|
|
3750
|
+
returned.push(token);
|
|
3717
3751
|
}
|
|
3752
|
+
return {
|
|
3753
|
+
back,
|
|
3754
|
+
endOfFile,
|
|
3755
|
+
nextToken,
|
|
3756
|
+
position
|
|
3757
|
+
};
|
|
3718
3758
|
};
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
Container$3.registerRule(Rule$3);
|
|
3759
|
+
let AtRule$2 = atRule$1;
|
|
3760
|
+
let Comment$3 = comment$1;
|
|
3722
3761
|
let Declaration$2 = declaration;
|
|
3723
|
-
let
|
|
3724
|
-
let
|
|
3725
|
-
let
|
|
3726
|
-
let Root$4 = root;
|
|
3727
|
-
let Rule$2 = rule;
|
|
3762
|
+
let Root$4 = root$1;
|
|
3763
|
+
let Rule$2 = rule$1;
|
|
3764
|
+
let tokenizer$1 = tokenize;
|
|
3728
3765
|
const SAFE_COMMENT_NEIGHBOR = {
|
|
3729
3766
|
empty: true,
|
|
3730
3767
|
space: true
|
|
@@ -3736,7 +3773,7 @@ function findLastWithPosition(tokens) {
|
|
|
3736
3773
|
if (pos) return pos;
|
|
3737
3774
|
}
|
|
3738
3775
|
}
|
|
3739
|
-
let Parser$
|
|
3776
|
+
let Parser$2 = class Parser {
|
|
3740
3777
|
constructor(input2) {
|
|
3741
3778
|
this.input = input2;
|
|
3742
3779
|
this.root = new Root$4();
|
|
@@ -3843,7 +3880,7 @@ let Parser$1 = class Parser {
|
|
|
3843
3880
|
}
|
|
3844
3881
|
colon(tokens) {
|
|
3845
3882
|
let brackets = 0;
|
|
3846
|
-
let token, type
|
|
3883
|
+
let prev, token, type;
|
|
3847
3884
|
for (let [i, element] of tokens.entries()) {
|
|
3848
3885
|
token = element;
|
|
3849
3886
|
type = token[0];
|
|
@@ -3867,7 +3904,7 @@ let Parser$1 = class Parser {
|
|
|
3867
3904
|
return false;
|
|
3868
3905
|
}
|
|
3869
3906
|
comment(token) {
|
|
3870
|
-
let node2 = new Comment$
|
|
3907
|
+
let node2 = new Comment$3();
|
|
3871
3908
|
this.init(node2, token[2]);
|
|
3872
3909
|
node2.source.end = this.getPosition(token[3] || token[2]);
|
|
3873
3910
|
node2.source.end.offset++;
|
|
@@ -3884,7 +3921,7 @@ let Parser$1 = class Parser {
|
|
|
3884
3921
|
}
|
|
3885
3922
|
}
|
|
3886
3923
|
createTokenizer() {
|
|
3887
|
-
this.tokenizer =
|
|
3924
|
+
this.tokenizer = tokenizer$1(this.input);
|
|
3888
3925
|
}
|
|
3889
3926
|
decl(tokens, customProperty) {
|
|
3890
3927
|
let node2 = new Declaration$2();
|
|
@@ -3950,12 +3987,12 @@ let Parser$1 = class Parser {
|
|
|
3950
3987
|
let str = "";
|
|
3951
3988
|
for (let j = i; j > 0; j--) {
|
|
3952
3989
|
let type = cache[j][0];
|
|
3953
|
-
if (str.trim().
|
|
3990
|
+
if (str.trim().startsWith("!") && type !== "space") {
|
|
3954
3991
|
break;
|
|
3955
3992
|
}
|
|
3956
3993
|
str = cache.pop()[1] + str;
|
|
3957
3994
|
}
|
|
3958
|
-
if (str.trim().
|
|
3995
|
+
if (str.trim().startsWith("!")) {
|
|
3959
3996
|
node2.important = true;
|
|
3960
3997
|
node2.raws.important = str;
|
|
3961
3998
|
tokens = cache;
|
|
@@ -4243,13 +4280,13 @@ let Parser$1 = class Parser {
|
|
|
4243
4280
|
);
|
|
4244
4281
|
}
|
|
4245
4282
|
};
|
|
4246
|
-
var parser = Parser$
|
|
4247
|
-
let Container$
|
|
4248
|
-
let
|
|
4249
|
-
let
|
|
4250
|
-
function parse$
|
|
4251
|
-
let input2 = new Input$
|
|
4252
|
-
let parser2 = new
|
|
4283
|
+
var parser = Parser$2;
|
|
4284
|
+
let Container$3 = container;
|
|
4285
|
+
let Input$3 = input;
|
|
4286
|
+
let Parser$1 = parser;
|
|
4287
|
+
function parse$4(css, opts) {
|
|
4288
|
+
let input2 = new Input$3(css, opts);
|
|
4289
|
+
let parser2 = new Parser$1(input2);
|
|
4253
4290
|
try {
|
|
4254
4291
|
parser2.parse();
|
|
4255
4292
|
} catch (e) {
|
|
@@ -4268,18 +4305,87 @@ function parse$3(css, opts) {
|
|
|
4268
4305
|
}
|
|
4269
4306
|
return parser2.root;
|
|
4270
4307
|
}
|
|
4271
|
-
var parse_1 = parse$
|
|
4272
|
-
parse$
|
|
4273
|
-
Container$
|
|
4274
|
-
let
|
|
4308
|
+
var parse_1 = parse$4;
|
|
4309
|
+
parse$4.default = parse$4;
|
|
4310
|
+
Container$3.registerParse(parse$4);
|
|
4311
|
+
let Warning$3 = class Warning {
|
|
4312
|
+
constructor(text, opts = {}) {
|
|
4313
|
+
this.type = "warning";
|
|
4314
|
+
this.text = text;
|
|
4315
|
+
if (opts.node && opts.node.source) {
|
|
4316
|
+
let range = opts.node.rangeBy(opts);
|
|
4317
|
+
this.line = range.start.line;
|
|
4318
|
+
this.column = range.start.column;
|
|
4319
|
+
this.endLine = range.end.line;
|
|
4320
|
+
this.endColumn = range.end.column;
|
|
4321
|
+
}
|
|
4322
|
+
for (let opt in opts) this[opt] = opts[opt];
|
|
4323
|
+
}
|
|
4324
|
+
toString() {
|
|
4325
|
+
if (this.node) {
|
|
4326
|
+
return this.node.error(this.text, {
|
|
4327
|
+
index: this.index,
|
|
4328
|
+
plugin: this.plugin,
|
|
4329
|
+
word: this.word
|
|
4330
|
+
}).message;
|
|
4331
|
+
}
|
|
4332
|
+
if (this.plugin) {
|
|
4333
|
+
return this.plugin + ": " + this.text;
|
|
4334
|
+
}
|
|
4335
|
+
return this.text;
|
|
4336
|
+
}
|
|
4337
|
+
};
|
|
4338
|
+
var warning = Warning$3;
|
|
4339
|
+
Warning$3.default = Warning$3;
|
|
4340
|
+
let Warning$2 = warning;
|
|
4341
|
+
let Result$4 = class Result {
|
|
4342
|
+
constructor(processor2, root2, opts) {
|
|
4343
|
+
this.processor = processor2;
|
|
4344
|
+
this.messages = [];
|
|
4345
|
+
this.root = root2;
|
|
4346
|
+
this.opts = opts;
|
|
4347
|
+
this.css = void 0;
|
|
4348
|
+
this.map = void 0;
|
|
4349
|
+
}
|
|
4350
|
+
toString() {
|
|
4351
|
+
return this.css;
|
|
4352
|
+
}
|
|
4353
|
+
warn(text, opts = {}) {
|
|
4354
|
+
if (!opts.plugin) {
|
|
4355
|
+
if (this.lastPlugin && this.lastPlugin.postcssPlugin) {
|
|
4356
|
+
opts.plugin = this.lastPlugin.postcssPlugin;
|
|
4357
|
+
}
|
|
4358
|
+
}
|
|
4359
|
+
let warning2 = new Warning$2(text, opts);
|
|
4360
|
+
this.messages.push(warning2);
|
|
4361
|
+
return warning2;
|
|
4362
|
+
}
|
|
4363
|
+
warnings() {
|
|
4364
|
+
return this.messages.filter((i) => i.type === "warning");
|
|
4365
|
+
}
|
|
4366
|
+
get content() {
|
|
4367
|
+
return this.css;
|
|
4368
|
+
}
|
|
4369
|
+
};
|
|
4370
|
+
var result = Result$4;
|
|
4371
|
+
Result$4.default = Result$4;
|
|
4372
|
+
let printed = {};
|
|
4373
|
+
var warnOnce$2 = function warnOnce(message) {
|
|
4374
|
+
if (printed[message]) return;
|
|
4375
|
+
printed[message] = true;
|
|
4376
|
+
if (typeof console !== "undefined" && console.warn) {
|
|
4377
|
+
console.warn(message);
|
|
4378
|
+
}
|
|
4379
|
+
};
|
|
4380
|
+
let Container$2 = container;
|
|
4381
|
+
let Document$3 = document$2;
|
|
4275
4382
|
let MapGenerator$1 = mapGenerator;
|
|
4276
|
-
let
|
|
4277
|
-
let
|
|
4278
|
-
let
|
|
4383
|
+
let parse$3 = parse_1;
|
|
4384
|
+
let Result$3 = result;
|
|
4385
|
+
let Root$3 = root$1;
|
|
4386
|
+
let stringify$3 = stringify_1;
|
|
4387
|
+
let { isClean, my } = symbols;
|
|
4279
4388
|
let warnOnce$1 = warnOnce$2;
|
|
4280
|
-
let Result$2 = result;
|
|
4281
|
-
let parse$2 = parse_1;
|
|
4282
|
-
let Root$3 = root;
|
|
4283
4389
|
const TYPE_TO_CLASS_NAME = {
|
|
4284
4390
|
atrule: "AtRule",
|
|
4285
4391
|
comment: "Comment",
|
|
@@ -4362,7 +4468,7 @@ function cleanMarks(node2) {
|
|
|
4362
4468
|
if (node2.nodes) node2.nodes.forEach((i) => cleanMarks(i));
|
|
4363
4469
|
return node2;
|
|
4364
4470
|
}
|
|
4365
|
-
let postcss$
|
|
4471
|
+
let postcss$3 = {};
|
|
4366
4472
|
let LazyResult$2 = class LazyResult {
|
|
4367
4473
|
constructor(processor2, css, opts) {
|
|
4368
4474
|
this.stringified = false;
|
|
@@ -4370,7 +4476,7 @@ let LazyResult$2 = class LazyResult {
|
|
|
4370
4476
|
let root2;
|
|
4371
4477
|
if (typeof css === "object" && css !== null && (css.type === "root" || css.type === "document")) {
|
|
4372
4478
|
root2 = cleanMarks(css);
|
|
4373
|
-
} else if (css instanceof LazyResult || css instanceof Result$
|
|
4479
|
+
} else if (css instanceof LazyResult || css instanceof Result$3) {
|
|
4374
4480
|
root2 = cleanMarks(css.root);
|
|
4375
4481
|
if (css.map) {
|
|
4376
4482
|
if (typeof opts.map === "undefined") opts.map = {};
|
|
@@ -4378,7 +4484,7 @@ let LazyResult$2 = class LazyResult {
|
|
|
4378
4484
|
opts.map.prev = css.map;
|
|
4379
4485
|
}
|
|
4380
4486
|
} else {
|
|
4381
|
-
let parser2 = parse$
|
|
4487
|
+
let parser2 = parse$3;
|
|
4382
4488
|
if (opts.syntax) parser2 = opts.syntax.parse;
|
|
4383
4489
|
if (opts.parser) parser2 = opts.parser;
|
|
4384
4490
|
if (parser2.parse) parser2 = parser2.parse;
|
|
@@ -4389,16 +4495,16 @@ let LazyResult$2 = class LazyResult {
|
|
|
4389
4495
|
this.error = error;
|
|
4390
4496
|
}
|
|
4391
4497
|
if (root2 && !root2[my]) {
|
|
4392
|
-
Container$
|
|
4498
|
+
Container$2.rebuild(root2);
|
|
4393
4499
|
}
|
|
4394
4500
|
}
|
|
4395
|
-
this.result = new Result$
|
|
4396
|
-
this.helpers = { ...postcss$
|
|
4397
|
-
this.plugins = this.processor.plugins.map((
|
|
4398
|
-
if (typeof
|
|
4399
|
-
return { ...
|
|
4501
|
+
this.result = new Result$3(processor2, root2, opts);
|
|
4502
|
+
this.helpers = { ...postcss$3, postcss: postcss$3, result: this.result };
|
|
4503
|
+
this.plugins = this.processor.plugins.map((plugin3) => {
|
|
4504
|
+
if (typeof plugin3 === "object" && plugin3.prepare) {
|
|
4505
|
+
return { ...plugin3, ...plugin3.prepare(this.result) };
|
|
4400
4506
|
} else {
|
|
4401
|
-
return
|
|
4507
|
+
return plugin3;
|
|
4402
4508
|
}
|
|
4403
4509
|
});
|
|
4404
4510
|
}
|
|
@@ -4420,17 +4526,17 @@ let LazyResult$2 = class LazyResult {
|
|
|
4420
4526
|
throw new Error("Use process(css).then(cb) to work with async plugins");
|
|
4421
4527
|
}
|
|
4422
4528
|
handleError(error, node2) {
|
|
4423
|
-
let
|
|
4529
|
+
let plugin3 = this.result.lastPlugin;
|
|
4424
4530
|
try {
|
|
4425
4531
|
if (node2) node2.addToError(error);
|
|
4426
4532
|
this.error = error;
|
|
4427
4533
|
if (error.name === "CssSyntaxError" && !error.plugin) {
|
|
4428
|
-
error.plugin =
|
|
4534
|
+
error.plugin = plugin3.postcssPlugin;
|
|
4429
4535
|
error.setMessage();
|
|
4430
|
-
} else if (
|
|
4536
|
+
} else if (plugin3.postcssVersion) {
|
|
4431
4537
|
if (process.env.NODE_ENV !== "production") {
|
|
4432
|
-
let pluginName =
|
|
4433
|
-
let pluginVer =
|
|
4538
|
+
let pluginName = plugin3.postcssPlugin;
|
|
4539
|
+
let pluginVer = plugin3.postcssVersion;
|
|
4434
4540
|
let runtimeVer = this.result.processor.version;
|
|
4435
4541
|
let a = pluginVer.split(".");
|
|
4436
4542
|
let b = runtimeVer.split(".");
|
|
@@ -4448,33 +4554,33 @@ let LazyResult$2 = class LazyResult {
|
|
|
4448
4554
|
}
|
|
4449
4555
|
prepareVisitors() {
|
|
4450
4556
|
this.listeners = {};
|
|
4451
|
-
let add = (
|
|
4557
|
+
let add = (plugin3, type, cb) => {
|
|
4452
4558
|
if (!this.listeners[type]) this.listeners[type] = [];
|
|
4453
|
-
this.listeners[type].push([
|
|
4559
|
+
this.listeners[type].push([plugin3, cb]);
|
|
4454
4560
|
};
|
|
4455
|
-
for (let
|
|
4456
|
-
if (typeof
|
|
4457
|
-
for (let event in
|
|
4561
|
+
for (let plugin3 of this.plugins) {
|
|
4562
|
+
if (typeof plugin3 === "object") {
|
|
4563
|
+
for (let event in plugin3) {
|
|
4458
4564
|
if (!PLUGIN_PROPS[event] && /^[A-Z]/.test(event)) {
|
|
4459
4565
|
throw new Error(
|
|
4460
|
-
`Unknown event ${event} in ${
|
|
4566
|
+
`Unknown event ${event} in ${plugin3.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`
|
|
4461
4567
|
);
|
|
4462
4568
|
}
|
|
4463
4569
|
if (!NOT_VISITORS[event]) {
|
|
4464
|
-
if (typeof
|
|
4465
|
-
for (let filter in
|
|
4570
|
+
if (typeof plugin3[event] === "object") {
|
|
4571
|
+
for (let filter in plugin3[event]) {
|
|
4466
4572
|
if (filter === "*") {
|
|
4467
|
-
add(
|
|
4573
|
+
add(plugin3, event, plugin3[event][filter]);
|
|
4468
4574
|
} else {
|
|
4469
4575
|
add(
|
|
4470
|
-
|
|
4576
|
+
plugin3,
|
|
4471
4577
|
event + "-" + filter.toLowerCase(),
|
|
4472
|
-
|
|
4578
|
+
plugin3[event][filter]
|
|
4473
4579
|
);
|
|
4474
4580
|
}
|
|
4475
4581
|
}
|
|
4476
|
-
} else if (typeof
|
|
4477
|
-
add(
|
|
4582
|
+
} else if (typeof plugin3[event] === "function") {
|
|
4583
|
+
add(plugin3, event, plugin3[event]);
|
|
4478
4584
|
}
|
|
4479
4585
|
}
|
|
4480
4586
|
}
|
|
@@ -4485,8 +4591,8 @@ let LazyResult$2 = class LazyResult {
|
|
|
4485
4591
|
async runAsync() {
|
|
4486
4592
|
this.plugin = 0;
|
|
4487
4593
|
for (let i = 0; i < this.plugins.length; i++) {
|
|
4488
|
-
let
|
|
4489
|
-
let promise = this.runOnRoot(
|
|
4594
|
+
let plugin3 = this.plugins[i];
|
|
4595
|
+
let promise = this.runOnRoot(plugin3);
|
|
4490
4596
|
if (isPromise(promise)) {
|
|
4491
4597
|
try {
|
|
4492
4598
|
await promise;
|
|
@@ -4514,8 +4620,8 @@ let LazyResult$2 = class LazyResult {
|
|
|
4514
4620
|
}
|
|
4515
4621
|
}
|
|
4516
4622
|
if (this.listeners.OnceExit) {
|
|
4517
|
-
for (let [
|
|
4518
|
-
this.result.lastPlugin =
|
|
4623
|
+
for (let [plugin3, visitor] of this.listeners.OnceExit) {
|
|
4624
|
+
this.result.lastPlugin = plugin3;
|
|
4519
4625
|
try {
|
|
4520
4626
|
if (root2.type === "document") {
|
|
4521
4627
|
let roots = root2.nodes.map(
|
|
@@ -4534,22 +4640,22 @@ let LazyResult$2 = class LazyResult {
|
|
|
4534
4640
|
this.processed = true;
|
|
4535
4641
|
return this.stringify();
|
|
4536
4642
|
}
|
|
4537
|
-
runOnRoot(
|
|
4538
|
-
this.result.lastPlugin =
|
|
4643
|
+
runOnRoot(plugin3) {
|
|
4644
|
+
this.result.lastPlugin = plugin3;
|
|
4539
4645
|
try {
|
|
4540
|
-
if (typeof
|
|
4646
|
+
if (typeof plugin3 === "object" && plugin3.Once) {
|
|
4541
4647
|
if (this.result.root.type === "document") {
|
|
4542
4648
|
let roots = this.result.root.nodes.map(
|
|
4543
|
-
(root2) =>
|
|
4649
|
+
(root2) => plugin3.Once(root2, this.helpers)
|
|
4544
4650
|
);
|
|
4545
4651
|
if (isPromise(roots[0])) {
|
|
4546
4652
|
return Promise.all(roots);
|
|
4547
4653
|
}
|
|
4548
4654
|
return roots;
|
|
4549
4655
|
}
|
|
4550
|
-
return
|
|
4551
|
-
} else if (typeof
|
|
4552
|
-
return
|
|
4656
|
+
return plugin3.Once(this.result.root, this.helpers);
|
|
4657
|
+
} else if (typeof plugin3 === "function") {
|
|
4658
|
+
return plugin3(this.result.root, this.result);
|
|
4553
4659
|
}
|
|
4554
4660
|
} catch (error) {
|
|
4555
4661
|
throw this.handleError(error);
|
|
@@ -4561,7 +4667,7 @@ let LazyResult$2 = class LazyResult {
|
|
|
4561
4667
|
this.stringified = true;
|
|
4562
4668
|
this.sync();
|
|
4563
4669
|
let opts = this.result.opts;
|
|
4564
|
-
let str = stringify$
|
|
4670
|
+
let str = stringify$3;
|
|
4565
4671
|
if (opts.syntax) str = opts.syntax.stringify;
|
|
4566
4672
|
if (opts.stringifier) str = opts.stringifier;
|
|
4567
4673
|
if (str.stringify) str = str.stringify;
|
|
@@ -4578,8 +4684,8 @@ let LazyResult$2 = class LazyResult {
|
|
|
4578
4684
|
if (this.processing) {
|
|
4579
4685
|
throw this.getAsyncError();
|
|
4580
4686
|
}
|
|
4581
|
-
for (let
|
|
4582
|
-
let promise = this.runOnRoot(
|
|
4687
|
+
for (let plugin3 of this.plugins) {
|
|
4688
|
+
let promise = this.runOnRoot(plugin3);
|
|
4583
4689
|
if (isPromise(promise)) {
|
|
4584
4690
|
throw this.getAsyncError();
|
|
4585
4691
|
}
|
|
@@ -4617,8 +4723,8 @@ let LazyResult$2 = class LazyResult {
|
|
|
4617
4723
|
return this.css;
|
|
4618
4724
|
}
|
|
4619
4725
|
visitSync(visitors, node2) {
|
|
4620
|
-
for (let [
|
|
4621
|
-
this.result.lastPlugin =
|
|
4726
|
+
for (let [plugin3, visitor] of visitors) {
|
|
4727
|
+
this.result.lastPlugin = plugin3;
|
|
4622
4728
|
let promise;
|
|
4623
4729
|
try {
|
|
4624
4730
|
promise = visitor(node2, this.helpers);
|
|
@@ -4641,13 +4747,13 @@ let LazyResult$2 = class LazyResult {
|
|
|
4641
4747
|
return;
|
|
4642
4748
|
}
|
|
4643
4749
|
if (visitors.length > 0 && visit2.visitorIndex < visitors.length) {
|
|
4644
|
-
let [
|
|
4750
|
+
let [plugin3, visitor] = visitors[visit2.visitorIndex];
|
|
4645
4751
|
visit2.visitorIndex += 1;
|
|
4646
4752
|
if (visit2.visitorIndex === visitors.length) {
|
|
4647
4753
|
visit2.visitors = [];
|
|
4648
4754
|
visit2.visitorIndex = 0;
|
|
4649
4755
|
}
|
|
4650
|
-
this.result.lastPlugin =
|
|
4756
|
+
this.result.lastPlugin = plugin3;
|
|
4651
4757
|
try {
|
|
4652
4758
|
return visitor(node2.toProxy(), this.helpers);
|
|
4653
4759
|
} catch (e) {
|
|
@@ -4732,17 +4838,17 @@ let LazyResult$2 = class LazyResult {
|
|
|
4732
4838
|
}
|
|
4733
4839
|
};
|
|
4734
4840
|
LazyResult$2.registerPostcss = (dependant) => {
|
|
4735
|
-
postcss$
|
|
4841
|
+
postcss$3 = dependant;
|
|
4736
4842
|
};
|
|
4737
4843
|
var lazyResult = LazyResult$2;
|
|
4738
4844
|
LazyResult$2.default = LazyResult$2;
|
|
4739
4845
|
Root$3.registerLazyResult(LazyResult$2);
|
|
4740
|
-
Document$
|
|
4846
|
+
Document$3.registerLazyResult(LazyResult$2);
|
|
4741
4847
|
let MapGenerator2 = mapGenerator;
|
|
4742
|
-
let
|
|
4848
|
+
let parse$2 = parse_1;
|
|
4849
|
+
const Result$2 = result;
|
|
4850
|
+
let stringify$2 = stringify_1;
|
|
4743
4851
|
let warnOnce2 = warnOnce$2;
|
|
4744
|
-
let parse$1 = parse_1;
|
|
4745
|
-
const Result$1 = result;
|
|
4746
4852
|
let NoWorkResult$1 = class NoWorkResult {
|
|
4747
4853
|
constructor(processor2, css, opts) {
|
|
4748
4854
|
css = css.toString();
|
|
@@ -4752,8 +4858,8 @@ let NoWorkResult$1 = class NoWorkResult {
|
|
|
4752
4858
|
this._opts = opts;
|
|
4753
4859
|
this._map = void 0;
|
|
4754
4860
|
let root2;
|
|
4755
|
-
let str = stringify$
|
|
4756
|
-
this.result = new Result$
|
|
4861
|
+
let str = stringify$2;
|
|
4862
|
+
this.result = new Result$2(this._processor, root2, this._opts);
|
|
4757
4863
|
this.result.css = css;
|
|
4758
4864
|
let self = this;
|
|
4759
4865
|
Object.defineProperty(this.result, "root", {
|
|
@@ -4828,7 +4934,7 @@ let NoWorkResult$1 = class NoWorkResult {
|
|
|
4828
4934
|
return this._root;
|
|
4829
4935
|
}
|
|
4830
4936
|
let root2;
|
|
4831
|
-
let parser2 = parse$
|
|
4937
|
+
let parser2 = parse$2;
|
|
4832
4938
|
try {
|
|
4833
4939
|
root2 = parser2(this._css, this._opts);
|
|
4834
4940
|
} catch (error) {
|
|
@@ -4847,13 +4953,13 @@ let NoWorkResult$1 = class NoWorkResult {
|
|
|
4847
4953
|
};
|
|
4848
4954
|
var noWorkResult = NoWorkResult$1;
|
|
4849
4955
|
NoWorkResult$1.default = NoWorkResult$1;
|
|
4850
|
-
let
|
|
4956
|
+
let Document$2 = document$2;
|
|
4851
4957
|
let LazyResult$1 = lazyResult;
|
|
4852
|
-
let
|
|
4853
|
-
let Root$2 = root;
|
|
4854
|
-
let Processor$
|
|
4958
|
+
let NoWorkResult2 = noWorkResult;
|
|
4959
|
+
let Root$2 = root$1;
|
|
4960
|
+
let Processor$2 = class Processor {
|
|
4855
4961
|
constructor(plugins = []) {
|
|
4856
|
-
this.version = "8.
|
|
4962
|
+
this.version = "8.5.1";
|
|
4857
4963
|
this.plugins = this.normalize(plugins);
|
|
4858
4964
|
}
|
|
4859
4965
|
normalize(plugins) {
|
|
@@ -4889,89 +4995,40 @@ let Processor$1 = class Processor {
|
|
|
4889
4995
|
return new LazyResult$1(this, css, opts);
|
|
4890
4996
|
}
|
|
4891
4997
|
}
|
|
4892
|
-
use(
|
|
4893
|
-
this.plugins = this.plugins.concat(this.normalize([
|
|
4998
|
+
use(plugin3) {
|
|
4999
|
+
this.plugins = this.plugins.concat(this.normalize([plugin3]));
|
|
4894
5000
|
return this;
|
|
4895
5001
|
}
|
|
4896
5002
|
};
|
|
4897
|
-
var processor = Processor$
|
|
4898
|
-
Processor$
|
|
4899
|
-
Root$2.registerProcessor(Processor$
|
|
4900
|
-
Document$
|
|
5003
|
+
var processor = Processor$2;
|
|
5004
|
+
Processor$2.default = Processor$2;
|
|
5005
|
+
Root$2.registerProcessor(Processor$2);
|
|
5006
|
+
Document$2.registerProcessor(Processor$2);
|
|
5007
|
+
let AtRule$1 = atRule$1;
|
|
5008
|
+
let Comment$2 = comment$1;
|
|
5009
|
+
let Container$1 = container;
|
|
5010
|
+
let CssSyntaxError$1 = cssSyntaxError;
|
|
4901
5011
|
let Declaration$1 = declaration;
|
|
4902
|
-
let
|
|
4903
|
-
let
|
|
4904
|
-
let
|
|
4905
|
-
let Input$1 = input;
|
|
4906
|
-
let Root$1 = root;
|
|
4907
|
-
let Rule$1 = rule;
|
|
4908
|
-
function fromJSON$1(json, inputs) {
|
|
4909
|
-
if (Array.isArray(json)) return json.map((n) => fromJSON$1(n));
|
|
4910
|
-
let { inputs: ownInputs, ...defaults } = json;
|
|
4911
|
-
if (ownInputs) {
|
|
4912
|
-
inputs = [];
|
|
4913
|
-
for (let input2 of ownInputs) {
|
|
4914
|
-
let inputHydrated = { ...input2, __proto__: Input$1.prototype };
|
|
4915
|
-
if (inputHydrated.map) {
|
|
4916
|
-
inputHydrated.map = {
|
|
4917
|
-
...inputHydrated.map,
|
|
4918
|
-
__proto__: PreviousMap2.prototype
|
|
4919
|
-
};
|
|
4920
|
-
}
|
|
4921
|
-
inputs.push(inputHydrated);
|
|
4922
|
-
}
|
|
4923
|
-
}
|
|
4924
|
-
if (defaults.nodes) {
|
|
4925
|
-
defaults.nodes = json.nodes.map((n) => fromJSON$1(n, inputs));
|
|
4926
|
-
}
|
|
4927
|
-
if (defaults.source) {
|
|
4928
|
-
let { inputId, ...source } = defaults.source;
|
|
4929
|
-
defaults.source = source;
|
|
4930
|
-
if (inputId != null) {
|
|
4931
|
-
defaults.source.input = inputs[inputId];
|
|
4932
|
-
}
|
|
4933
|
-
}
|
|
4934
|
-
if (defaults.type === "root") {
|
|
4935
|
-
return new Root$1(defaults);
|
|
4936
|
-
} else if (defaults.type === "decl") {
|
|
4937
|
-
return new Declaration$1(defaults);
|
|
4938
|
-
} else if (defaults.type === "rule") {
|
|
4939
|
-
return new Rule$1(defaults);
|
|
4940
|
-
} else if (defaults.type === "comment") {
|
|
4941
|
-
return new Comment$1(defaults);
|
|
4942
|
-
} else if (defaults.type === "atrule") {
|
|
4943
|
-
return new AtRule$1(defaults);
|
|
4944
|
-
} else {
|
|
4945
|
-
throw new Error("Unknown node type: " + json.type);
|
|
4946
|
-
}
|
|
4947
|
-
}
|
|
4948
|
-
var fromJSON_1 = fromJSON$1;
|
|
4949
|
-
fromJSON$1.default = fromJSON$1;
|
|
4950
|
-
let CssSyntaxError2 = cssSyntaxError;
|
|
4951
|
-
let Declaration2 = declaration;
|
|
5012
|
+
let Document$1 = document$2;
|
|
5013
|
+
let fromJSON$1 = fromJSON_1;
|
|
5014
|
+
let Input$2 = input;
|
|
4952
5015
|
let LazyResult2 = lazyResult;
|
|
4953
|
-
let
|
|
4954
|
-
let
|
|
4955
|
-
let
|
|
4956
|
-
let
|
|
4957
|
-
let
|
|
4958
|
-
let
|
|
4959
|
-
let
|
|
4960
|
-
let
|
|
4961
|
-
let
|
|
4962
|
-
|
|
4963
|
-
let parse = parse_1;
|
|
4964
|
-
let list = list_1;
|
|
4965
|
-
let Rule2 = rule;
|
|
4966
|
-
let Root2 = root;
|
|
4967
|
-
let Node2 = node;
|
|
4968
|
-
function postcss(...plugins) {
|
|
5016
|
+
let list$1 = list_1;
|
|
5017
|
+
let Node$1 = node;
|
|
5018
|
+
let parse$1 = parse_1;
|
|
5019
|
+
let Processor$1 = processor;
|
|
5020
|
+
let Result$1 = result;
|
|
5021
|
+
let Root$1 = root$1;
|
|
5022
|
+
let Rule$1 = rule$1;
|
|
5023
|
+
let stringify$1 = stringify_1;
|
|
5024
|
+
let Warning$1 = warning;
|
|
5025
|
+
function postcss$1(...plugins) {
|
|
4969
5026
|
if (plugins.length === 1 && Array.isArray(plugins[0])) {
|
|
4970
5027
|
plugins = plugins[0];
|
|
4971
5028
|
}
|
|
4972
|
-
return new
|
|
5029
|
+
return new Processor$1(plugins);
|
|
4973
5030
|
}
|
|
4974
|
-
postcss.plugin = function plugin(name, initializer) {
|
|
5031
|
+
postcss$1.plugin = function plugin(name, initializer) {
|
|
4975
5032
|
let warningPrinted = false;
|
|
4976
5033
|
function creator(...args) {
|
|
4977
5034
|
if (console && console.warn && !warningPrinted) {
|
|
@@ -4987,7 +5044,7 @@ postcss.plugin = function plugin(name, initializer) {
|
|
|
4987
5044
|
}
|
|
4988
5045
|
let transformer = initializer(...args);
|
|
4989
5046
|
transformer.postcssPlugin = name;
|
|
4990
|
-
transformer.postcssVersion = new
|
|
5047
|
+
transformer.postcssVersion = new Processor$1().version;
|
|
4991
5048
|
return transformer;
|
|
4992
5049
|
}
|
|
4993
5050
|
let cache;
|
|
@@ -4998,61 +5055,181 @@ postcss.plugin = function plugin(name, initializer) {
|
|
|
4998
5055
|
}
|
|
4999
5056
|
});
|
|
5000
5057
|
creator.process = function(css, processOpts, pluginOpts) {
|
|
5001
|
-
return postcss([creator(pluginOpts)]).process(css, processOpts);
|
|
5058
|
+
return postcss$1([creator(pluginOpts)]).process(css, processOpts);
|
|
5002
5059
|
};
|
|
5003
5060
|
return creator;
|
|
5004
5061
|
};
|
|
5005
|
-
postcss.stringify = stringify;
|
|
5006
|
-
postcss.parse = parse;
|
|
5007
|
-
postcss.fromJSON = fromJSON;
|
|
5008
|
-
postcss.list = list;
|
|
5009
|
-
postcss.comment = (defaults) => new
|
|
5010
|
-
postcss.atRule = (defaults) => new
|
|
5011
|
-
postcss.decl = (defaults) => new
|
|
5012
|
-
postcss.rule = (defaults) => new
|
|
5013
|
-
postcss.root = (defaults) => new
|
|
5014
|
-
postcss.document = (defaults) => new
|
|
5015
|
-
postcss.CssSyntaxError =
|
|
5016
|
-
postcss.Declaration =
|
|
5017
|
-
postcss.Container =
|
|
5018
|
-
postcss.Processor =
|
|
5019
|
-
postcss.Document =
|
|
5020
|
-
postcss.Comment =
|
|
5021
|
-
postcss.Warning =
|
|
5022
|
-
postcss.AtRule =
|
|
5023
|
-
postcss.Result =
|
|
5024
|
-
postcss.Input =
|
|
5025
|
-
postcss.Rule =
|
|
5026
|
-
postcss.Root =
|
|
5027
|
-
postcss.Node =
|
|
5028
|
-
LazyResult2.registerPostcss(postcss);
|
|
5029
|
-
var postcss_1 = postcss;
|
|
5030
|
-
postcss.default = postcss;
|
|
5031
|
-
const postcss$
|
|
5032
|
-
postcss$
|
|
5033
|
-
postcss$
|
|
5034
|
-
postcss$
|
|
5035
|
-
postcss$
|
|
5036
|
-
postcss$
|
|
5037
|
-
postcss$
|
|
5038
|
-
postcss$
|
|
5039
|
-
postcss$
|
|
5040
|
-
postcss$
|
|
5041
|
-
postcss$
|
|
5042
|
-
postcss$
|
|
5043
|
-
postcss$
|
|
5044
|
-
postcss$
|
|
5045
|
-
postcss$
|
|
5046
|
-
postcss$
|
|
5047
|
-
postcss$
|
|
5048
|
-
postcss$
|
|
5049
|
-
postcss$
|
|
5050
|
-
postcss$
|
|
5051
|
-
postcss$
|
|
5052
|
-
postcss$
|
|
5053
|
-
postcss$
|
|
5054
|
-
postcss$
|
|
5055
|
-
postcss$
|
|
5062
|
+
postcss$1.stringify = stringify$1;
|
|
5063
|
+
postcss$1.parse = parse$1;
|
|
5064
|
+
postcss$1.fromJSON = fromJSON$1;
|
|
5065
|
+
postcss$1.list = list$1;
|
|
5066
|
+
postcss$1.comment = (defaults) => new Comment$2(defaults);
|
|
5067
|
+
postcss$1.atRule = (defaults) => new AtRule$1(defaults);
|
|
5068
|
+
postcss$1.decl = (defaults) => new Declaration$1(defaults);
|
|
5069
|
+
postcss$1.rule = (defaults) => new Rule$1(defaults);
|
|
5070
|
+
postcss$1.root = (defaults) => new Root$1(defaults);
|
|
5071
|
+
postcss$1.document = (defaults) => new Document$1(defaults);
|
|
5072
|
+
postcss$1.CssSyntaxError = CssSyntaxError$1;
|
|
5073
|
+
postcss$1.Declaration = Declaration$1;
|
|
5074
|
+
postcss$1.Container = Container$1;
|
|
5075
|
+
postcss$1.Processor = Processor$1;
|
|
5076
|
+
postcss$1.Document = Document$1;
|
|
5077
|
+
postcss$1.Comment = Comment$2;
|
|
5078
|
+
postcss$1.Warning = Warning$1;
|
|
5079
|
+
postcss$1.AtRule = AtRule$1;
|
|
5080
|
+
postcss$1.Result = Result$1;
|
|
5081
|
+
postcss$1.Input = Input$2;
|
|
5082
|
+
postcss$1.Rule = Rule$1;
|
|
5083
|
+
postcss$1.Root = Root$1;
|
|
5084
|
+
postcss$1.Node = Node$1;
|
|
5085
|
+
LazyResult2.registerPostcss(postcss$1);
|
|
5086
|
+
var postcss_1 = postcss$1;
|
|
5087
|
+
postcss$1.default = postcss$1;
|
|
5088
|
+
const postcss$2 = /* @__PURE__ */ getDefaultExportFromCjs(postcss_1);
|
|
5089
|
+
const stringify = postcss$2.stringify;
|
|
5090
|
+
const fromJSON = postcss$2.fromJSON;
|
|
5091
|
+
const plugin2 = postcss$2.plugin;
|
|
5092
|
+
const parse = postcss$2.parse;
|
|
5093
|
+
const list = postcss$2.list;
|
|
5094
|
+
const document$1 = postcss$2.document;
|
|
5095
|
+
const comment = postcss$2.comment;
|
|
5096
|
+
const atRule = postcss$2.atRule;
|
|
5097
|
+
const rule = postcss$2.rule;
|
|
5098
|
+
const decl = postcss$2.decl;
|
|
5099
|
+
const root = postcss$2.root;
|
|
5100
|
+
const CssSyntaxError2 = postcss$2.CssSyntaxError;
|
|
5101
|
+
const Declaration2 = postcss$2.Declaration;
|
|
5102
|
+
const Container2 = postcss$2.Container;
|
|
5103
|
+
const Processor2 = postcss$2.Processor;
|
|
5104
|
+
const Document2 = postcss$2.Document;
|
|
5105
|
+
const Comment$1 = postcss$2.Comment;
|
|
5106
|
+
const Warning2 = postcss$2.Warning;
|
|
5107
|
+
const AtRule2 = postcss$2.AtRule;
|
|
5108
|
+
const Result2 = postcss$2.Result;
|
|
5109
|
+
const Input$1 = postcss$2.Input;
|
|
5110
|
+
const Rule2 = postcss$2.Rule;
|
|
5111
|
+
const Root2 = postcss$2.Root;
|
|
5112
|
+
const Node2 = postcss$2.Node;
|
|
5113
|
+
const postcss = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
5114
|
+
__proto__: null,
|
|
5115
|
+
AtRule: AtRule2,
|
|
5116
|
+
Comment: Comment$1,
|
|
5117
|
+
Container: Container2,
|
|
5118
|
+
CssSyntaxError: CssSyntaxError2,
|
|
5119
|
+
Declaration: Declaration2,
|
|
5120
|
+
Document: Document2,
|
|
5121
|
+
Input: Input$1,
|
|
5122
|
+
Node: Node2,
|
|
5123
|
+
Processor: Processor2,
|
|
5124
|
+
Result: Result2,
|
|
5125
|
+
Root: Root2,
|
|
5126
|
+
Rule: Rule2,
|
|
5127
|
+
Warning: Warning2,
|
|
5128
|
+
atRule,
|
|
5129
|
+
comment,
|
|
5130
|
+
decl,
|
|
5131
|
+
default: postcss$2,
|
|
5132
|
+
document: document$1,
|
|
5133
|
+
fromJSON,
|
|
5134
|
+
list,
|
|
5135
|
+
parse,
|
|
5136
|
+
plugin: plugin2,
|
|
5137
|
+
root,
|
|
5138
|
+
rule,
|
|
5139
|
+
stringify
|
|
5140
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
5141
|
+
const require$$0 = /* @__PURE__ */ getAugmentedNamespace(postcss);
|
|
5142
|
+
let Comment2 = comment$1;
|
|
5143
|
+
let Parser2 = parser;
|
|
5144
|
+
let tokenizer2 = tokenize;
|
|
5145
|
+
let SafeParser$1 = class SafeParser extends Parser2 {
|
|
5146
|
+
checkMissedSemicolon() {
|
|
5147
|
+
}
|
|
5148
|
+
comment(token) {
|
|
5149
|
+
let node2 = new Comment2();
|
|
5150
|
+
this.init(node2, token[2]);
|
|
5151
|
+
let pos = this.input.fromOffset(token[3]) || this.input.fromOffset(this.input.css.length - 1);
|
|
5152
|
+
node2.source.end = {
|
|
5153
|
+
column: pos.col,
|
|
5154
|
+
line: pos.line,
|
|
5155
|
+
offset: token[3] + 1
|
|
5156
|
+
};
|
|
5157
|
+
let text = token[1].slice(2);
|
|
5158
|
+
if (text.slice(-2) === "*/") text = text.slice(0, -2);
|
|
5159
|
+
if (/^\s*$/.test(text)) {
|
|
5160
|
+
node2.text = "";
|
|
5161
|
+
node2.raws.left = text;
|
|
5162
|
+
node2.raws.right = "";
|
|
5163
|
+
} else {
|
|
5164
|
+
let match = text.match(/^(\s*)([^]*\S)(\s*)$/);
|
|
5165
|
+
node2.text = match[2];
|
|
5166
|
+
node2.raws.left = match[1];
|
|
5167
|
+
node2.raws.right = match[3];
|
|
5168
|
+
}
|
|
5169
|
+
}
|
|
5170
|
+
createTokenizer() {
|
|
5171
|
+
this.tokenizer = tokenizer2(this.input, { ignoreErrors: true });
|
|
5172
|
+
}
|
|
5173
|
+
decl(tokens) {
|
|
5174
|
+
if (tokens.length > 1 && tokens.some((i) => i[0] === "word")) {
|
|
5175
|
+
super.decl(tokens);
|
|
5176
|
+
}
|
|
5177
|
+
}
|
|
5178
|
+
doubleColon() {
|
|
5179
|
+
}
|
|
5180
|
+
endFile() {
|
|
5181
|
+
if (this.current.nodes && this.current.nodes.length) {
|
|
5182
|
+
this.current.raws.semicolon = this.semicolon;
|
|
5183
|
+
}
|
|
5184
|
+
this.current.raws.after = (this.current.raws.after || "") + this.spaces;
|
|
5185
|
+
while (this.current.parent) {
|
|
5186
|
+
this.current = this.current.parent;
|
|
5187
|
+
this.current.raws.after = "";
|
|
5188
|
+
}
|
|
5189
|
+
this.root.source.end = this.getPosition(this.tokenizer.position());
|
|
5190
|
+
}
|
|
5191
|
+
precheckMissedSemicolon(tokens) {
|
|
5192
|
+
let colon = this.colon(tokens);
|
|
5193
|
+
if (colon === false) return;
|
|
5194
|
+
let nextStart, prevEnd;
|
|
5195
|
+
for (nextStart = colon - 1; nextStart >= 0; nextStart--) {
|
|
5196
|
+
if (tokens[nextStart][0] === "word") break;
|
|
5197
|
+
}
|
|
5198
|
+
if (nextStart === 0 || nextStart < 0) return;
|
|
5199
|
+
for (prevEnd = nextStart - 1; prevEnd >= 0; prevEnd--) {
|
|
5200
|
+
if (tokens[prevEnd][0] !== "space") {
|
|
5201
|
+
prevEnd += 1;
|
|
5202
|
+
break;
|
|
5203
|
+
}
|
|
5204
|
+
}
|
|
5205
|
+
let other = tokens.slice(nextStart);
|
|
5206
|
+
let spaces = tokens.slice(prevEnd, nextStart);
|
|
5207
|
+
tokens.splice(prevEnd, tokens.length - prevEnd);
|
|
5208
|
+
this.spaces = spaces.map((i) => i[1]).join("");
|
|
5209
|
+
this.decl(other);
|
|
5210
|
+
}
|
|
5211
|
+
unclosedBracket() {
|
|
5212
|
+
}
|
|
5213
|
+
unexpectedClose() {
|
|
5214
|
+
this.current.raws.after += "}";
|
|
5215
|
+
}
|
|
5216
|
+
unknownWord(tokens) {
|
|
5217
|
+
this.spaces += tokens.map((i) => i[1]).join("");
|
|
5218
|
+
}
|
|
5219
|
+
unnamedAtrule(node2) {
|
|
5220
|
+
node2.name = "";
|
|
5221
|
+
}
|
|
5222
|
+
};
|
|
5223
|
+
var safeParser$1 = SafeParser$1;
|
|
5224
|
+
let { Input: Input2 } = require$$0;
|
|
5225
|
+
let SafeParser2 = safeParser$1;
|
|
5226
|
+
var safeParse = function safeParse2(css, opts) {
|
|
5227
|
+
let input2 = new Input2(css, opts);
|
|
5228
|
+
let parser2 = new SafeParser2(input2);
|
|
5229
|
+
parser2.parse();
|
|
5230
|
+
return parser2.root;
|
|
5231
|
+
};
|
|
5232
|
+
const safeParser = /* @__PURE__ */ getDefaultExportFromCjs(safeParse);
|
|
5056
5233
|
const tagMap = {
|
|
5057
5234
|
script: "noscript",
|
|
5058
5235
|
// camel case svg element tag names
|
|
@@ -5103,11 +5280,16 @@ function getTagName(n) {
|
|
|
5103
5280
|
function adaptCssForReplay(cssText, cache) {
|
|
5104
5281
|
const cachedStyle = cache == null ? void 0 : cache.stylesWithHoverClass.get(cssText);
|
|
5105
5282
|
if (cachedStyle) return cachedStyle;
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5283
|
+
let result2 = cssText;
|
|
5284
|
+
try {
|
|
5285
|
+
const ast = postcss$2([
|
|
5286
|
+
mediaSelectorPlugin,
|
|
5287
|
+
pseudoClassPlugin
|
|
5288
|
+
]).process(cssText, { parser: safeParser });
|
|
5289
|
+
result2 = ast.css;
|
|
5290
|
+
} catch (error) {
|
|
5291
|
+
console.warn("Failed to adapt css for replay", error);
|
|
5292
|
+
}
|
|
5111
5293
|
cache == null ? void 0 : cache.stylesWithHoverClass.set(cssText, result2);
|
|
5112
5294
|
return result2;
|
|
5113
5295
|
}
|