@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
|
@@ -1581,7 +1581,7 @@ function getAugmentedNamespace(n) {
|
|
|
1581
1581
|
var picocolors_browser = { exports: {} };
|
|
1582
1582
|
var x = String;
|
|
1583
1583
|
var create = function() {
|
|
1584
|
-
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 };
|
|
1584
|
+
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 };
|
|
1585
1585
|
};
|
|
1586
1586
|
picocolors_browser.exports = create();
|
|
1587
1587
|
picocolors_browser.exports.createColors = create;
|
|
@@ -1594,8 +1594,8 @@ const __viteBrowserExternal$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Ob
|
|
|
1594
1594
|
const require$$2 = /* @__PURE__ */ getAugmentedNamespace(__viteBrowserExternal$1);
|
|
1595
1595
|
let pico = picocolors_browserExports;
|
|
1596
1596
|
let terminalHighlight$1 = require$$2;
|
|
1597
|
-
let CssSyntaxError$
|
|
1598
|
-
constructor(message, line, column, source, file,
|
|
1597
|
+
let CssSyntaxError$4 = class CssSyntaxError extends Error {
|
|
1598
|
+
constructor(message, line, column, source, file, plugin3) {
|
|
1599
1599
|
super(message);
|
|
1600
1600
|
this.name = "CssSyntaxError";
|
|
1601
1601
|
this.reason = message;
|
|
@@ -1605,8 +1605,8 @@ let CssSyntaxError$3 = class CssSyntaxError extends Error {
|
|
|
1605
1605
|
if (source) {
|
|
1606
1606
|
this.source = source;
|
|
1607
1607
|
}
|
|
1608
|
-
if (
|
|
1609
|
-
this.plugin =
|
|
1608
|
+
if (plugin3) {
|
|
1609
|
+
this.plugin = plugin3;
|
|
1610
1610
|
}
|
|
1611
1611
|
if (typeof line !== "undefined" && typeof column !== "undefined") {
|
|
1612
1612
|
if (typeof line === "number") {
|
|
@@ -1636,29 +1636,40 @@ let CssSyntaxError$3 = class CssSyntaxError extends Error {
|
|
|
1636
1636
|
if (!this.source) return "";
|
|
1637
1637
|
let css = this.source;
|
|
1638
1638
|
if (color == null) color = pico.isColorSupported;
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
let lines = css.split(/\r?\n/);
|
|
1643
|
-
let start = Math.max(this.line - 3, 0);
|
|
1644
|
-
let end = Math.min(this.line + 2, lines.length);
|
|
1645
|
-
let maxWidth = String(end).length;
|
|
1646
|
-
let mark, aside;
|
|
1639
|
+
let aside = (text) => text;
|
|
1640
|
+
let mark = (text) => text;
|
|
1641
|
+
let highlight = (text) => text;
|
|
1647
1642
|
if (color) {
|
|
1648
1643
|
let { bold, gray, red } = pico.createColors(true);
|
|
1649
1644
|
mark = (text) => bold(red(text));
|
|
1650
1645
|
aside = (text) => gray(text);
|
|
1651
|
-
|
|
1652
|
-
|
|
1646
|
+
if (terminalHighlight$1) {
|
|
1647
|
+
highlight = (text) => terminalHighlight$1(text);
|
|
1648
|
+
}
|
|
1653
1649
|
}
|
|
1650
|
+
let lines = css.split(/\r?\n/);
|
|
1651
|
+
let start = Math.max(this.line - 3, 0);
|
|
1652
|
+
let end = Math.min(this.line + 2, lines.length);
|
|
1653
|
+
let maxWidth = String(end).length;
|
|
1654
1654
|
return lines.slice(start, end).map((line, index2) => {
|
|
1655
1655
|
let number = start + 1 + index2;
|
|
1656
1656
|
let gutter = " " + (" " + number).slice(-maxWidth) + " | ";
|
|
1657
1657
|
if (number === this.line) {
|
|
1658
|
+
if (line.length > 160) {
|
|
1659
|
+
let padding = 20;
|
|
1660
|
+
let subLineStart = Math.max(0, this.column - padding);
|
|
1661
|
+
let subLineEnd = Math.max(
|
|
1662
|
+
this.column + padding,
|
|
1663
|
+
this.endColumn + padding
|
|
1664
|
+
);
|
|
1665
|
+
let subLine = line.slice(subLineStart, subLineEnd);
|
|
1666
|
+
let spacing2 = aside(gutter.replace(/\d/g, " ")) + line.slice(0, Math.min(this.column - 1, padding - 1)).replace(/[^\t]/g, " ");
|
|
1667
|
+
return mark(">") + aside(gutter) + highlight(subLine) + "\n " + spacing2 + mark("^");
|
|
1668
|
+
}
|
|
1658
1669
|
let spacing = aside(gutter.replace(/\d/g, " ")) + line.slice(0, this.column - 1).replace(/[^\t]/g, " ");
|
|
1659
|
-
return mark(">") + aside(gutter) + line + "\n " + spacing + mark("^");
|
|
1670
|
+
return mark(">") + aside(gutter) + highlight(line) + "\n " + spacing + mark("^");
|
|
1660
1671
|
}
|
|
1661
|
-
return " " + aside(gutter) + line;
|
|
1672
|
+
return " " + aside(gutter) + highlight(line);
|
|
1662
1673
|
}).join("\n");
|
|
1663
1674
|
}
|
|
1664
1675
|
toString() {
|
|
@@ -1669,11 +1680,8 @@ let CssSyntaxError$3 = class CssSyntaxError extends Error {
|
|
|
1669
1680
|
return this.name + ": " + this.message + code;
|
|
1670
1681
|
}
|
|
1671
1682
|
};
|
|
1672
|
-
var cssSyntaxError = CssSyntaxError$
|
|
1673
|
-
CssSyntaxError$
|
|
1674
|
-
var symbols = {};
|
|
1675
|
-
symbols.isClean = Symbol("isClean");
|
|
1676
|
-
symbols.my = Symbol("my");
|
|
1683
|
+
var cssSyntaxError = CssSyntaxError$4;
|
|
1684
|
+
CssSyntaxError$4.default = CssSyntaxError$4;
|
|
1677
1685
|
const DEFAULT_RAW = {
|
|
1678
1686
|
after: "\n",
|
|
1679
1687
|
beforeClose: "\n",
|
|
@@ -1972,16 +1980,19 @@ let Stringifier$2 = class Stringifier {
|
|
|
1972
1980
|
var stringifier = Stringifier$2;
|
|
1973
1981
|
Stringifier$2.default = Stringifier$2;
|
|
1974
1982
|
let Stringifier$1 = stringifier;
|
|
1975
|
-
function stringify$
|
|
1983
|
+
function stringify$5(node2, builder) {
|
|
1976
1984
|
let str = new Stringifier$1(builder);
|
|
1977
1985
|
str.stringify(node2);
|
|
1978
1986
|
}
|
|
1979
|
-
var stringify_1 = stringify$
|
|
1980
|
-
stringify$
|
|
1981
|
-
|
|
1982
|
-
|
|
1987
|
+
var stringify_1 = stringify$5;
|
|
1988
|
+
stringify$5.default = stringify$5;
|
|
1989
|
+
var symbols = {};
|
|
1990
|
+
symbols.isClean = Symbol("isClean");
|
|
1991
|
+
symbols.my = Symbol("my");
|
|
1992
|
+
let CssSyntaxError$3 = cssSyntaxError;
|
|
1983
1993
|
let Stringifier2 = stringifier;
|
|
1984
|
-
let stringify$
|
|
1994
|
+
let stringify$4 = stringify_1;
|
|
1995
|
+
let { isClean: isClean$2, my: my$2 } = symbols;
|
|
1985
1996
|
function cloneNode(obj, parent) {
|
|
1986
1997
|
let cloned = new obj.constructor();
|
|
1987
1998
|
for (let i in obj) {
|
|
@@ -2004,7 +2015,28 @@ function cloneNode(obj, parent) {
|
|
|
2004
2015
|
}
|
|
2005
2016
|
return cloned;
|
|
2006
2017
|
}
|
|
2007
|
-
|
|
2018
|
+
function sourceOffset(inputCSS, position) {
|
|
2019
|
+
if (position && typeof position.offset !== "undefined") {
|
|
2020
|
+
return position.offset;
|
|
2021
|
+
}
|
|
2022
|
+
let column = 1;
|
|
2023
|
+
let line = 1;
|
|
2024
|
+
let offset = 0;
|
|
2025
|
+
for (let i = 0; i < inputCSS.length; i++) {
|
|
2026
|
+
if (line === position.line && column === position.column) {
|
|
2027
|
+
offset = i;
|
|
2028
|
+
break;
|
|
2029
|
+
}
|
|
2030
|
+
if (inputCSS[i] === "\n") {
|
|
2031
|
+
column = 1;
|
|
2032
|
+
line += 1;
|
|
2033
|
+
} else {
|
|
2034
|
+
column += 1;
|
|
2035
|
+
}
|
|
2036
|
+
}
|
|
2037
|
+
return offset;
|
|
2038
|
+
}
|
|
2039
|
+
let Node$5 = class Node {
|
|
2008
2040
|
constructor(defaults = {}) {
|
|
2009
2041
|
this.raws = {};
|
|
2010
2042
|
this[isClean$2] = false;
|
|
@@ -2081,7 +2113,7 @@ let Node$4 = class Node {
|
|
|
2081
2113
|
opts
|
|
2082
2114
|
);
|
|
2083
2115
|
}
|
|
2084
|
-
return new CssSyntaxError$
|
|
2116
|
+
return new CssSyntaxError$3(message);
|
|
2085
2117
|
}
|
|
2086
2118
|
getProxyProcessor() {
|
|
2087
2119
|
return {
|
|
@@ -2105,6 +2137,10 @@ let Node$4 = class Node {
|
|
|
2105
2137
|
}
|
|
2106
2138
|
};
|
|
2107
2139
|
}
|
|
2140
|
+
/* c8 ignore next 3 */
|
|
2141
|
+
markClean() {
|
|
2142
|
+
this[isClean$2] = true;
|
|
2143
|
+
}
|
|
2108
2144
|
markDirty() {
|
|
2109
2145
|
if (this[isClean$2]) {
|
|
2110
2146
|
this[isClean$2] = false;
|
|
@@ -2119,23 +2155,29 @@ let Node$4 = class Node {
|
|
|
2119
2155
|
let index2 = this.parent.index(this);
|
|
2120
2156
|
return this.parent.nodes[index2 + 1];
|
|
2121
2157
|
}
|
|
2122
|
-
positionBy(opts
|
|
2158
|
+
positionBy(opts) {
|
|
2123
2159
|
let pos = this.source.start;
|
|
2124
2160
|
if (opts.index) {
|
|
2125
|
-
pos = this.positionInside(opts.index
|
|
2161
|
+
pos = this.positionInside(opts.index);
|
|
2126
2162
|
} else if (opts.word) {
|
|
2127
|
-
|
|
2163
|
+
let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
|
|
2164
|
+
let stringRepresentation = inputString.slice(
|
|
2165
|
+
sourceOffset(inputString, this.source.start),
|
|
2166
|
+
sourceOffset(inputString, this.source.end)
|
|
2167
|
+
);
|
|
2128
2168
|
let index2 = stringRepresentation.indexOf(opts.word);
|
|
2129
|
-
if (index2 !== -1) pos = this.positionInside(index2
|
|
2169
|
+
if (index2 !== -1) pos = this.positionInside(index2);
|
|
2130
2170
|
}
|
|
2131
2171
|
return pos;
|
|
2132
2172
|
}
|
|
2133
|
-
positionInside(index2
|
|
2134
|
-
let string = stringRepresentation || this.toString();
|
|
2173
|
+
positionInside(index2) {
|
|
2135
2174
|
let column = this.source.start.column;
|
|
2136
2175
|
let line = this.source.start.line;
|
|
2137
|
-
|
|
2138
|
-
|
|
2176
|
+
let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
|
|
2177
|
+
let offset = sourceOffset(inputString, this.source.start);
|
|
2178
|
+
let end = offset + index2;
|
|
2179
|
+
for (let i = offset; i < end; i++) {
|
|
2180
|
+
if (inputString[i] === "\n") {
|
|
2139
2181
|
column = 1;
|
|
2140
2182
|
line += 1;
|
|
2141
2183
|
} else {
|
|
@@ -2162,11 +2204,17 @@ let Node$4 = class Node {
|
|
|
2162
2204
|
line: start.line
|
|
2163
2205
|
};
|
|
2164
2206
|
if (opts.word) {
|
|
2165
|
-
let
|
|
2207
|
+
let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
|
|
2208
|
+
let stringRepresentation = inputString.slice(
|
|
2209
|
+
sourceOffset(inputString, this.source.start),
|
|
2210
|
+
sourceOffset(inputString, this.source.end)
|
|
2211
|
+
);
|
|
2166
2212
|
let index2 = stringRepresentation.indexOf(opts.word);
|
|
2167
2213
|
if (index2 !== -1) {
|
|
2168
|
-
start = this.positionInside(index2
|
|
2169
|
-
end = this.positionInside(
|
|
2214
|
+
start = this.positionInside(index2);
|
|
2215
|
+
end = this.positionInside(
|
|
2216
|
+
index2 + opts.word.length
|
|
2217
|
+
);
|
|
2170
2218
|
}
|
|
2171
2219
|
} else {
|
|
2172
2220
|
if (opts.start) {
|
|
@@ -2279,7 +2327,7 @@ let Node$4 = class Node {
|
|
|
2279
2327
|
}
|
|
2280
2328
|
return this.proxyCache;
|
|
2281
2329
|
}
|
|
2282
|
-
toString(stringifier2 = stringify$
|
|
2330
|
+
toString(stringifier2 = stringify$4) {
|
|
2283
2331
|
if (stringifier2.stringify) stringifier2 = stringifier2.stringify;
|
|
2284
2332
|
let result2 = "";
|
|
2285
2333
|
stringifier2(this, (i) => {
|
|
@@ -2296,10 +2344,19 @@ let Node$4 = class Node {
|
|
|
2296
2344
|
return this;
|
|
2297
2345
|
}
|
|
2298
2346
|
};
|
|
2299
|
-
var node = Node$
|
|
2300
|
-
Node$
|
|
2347
|
+
var node = Node$5;
|
|
2348
|
+
Node$5.default = Node$5;
|
|
2349
|
+
let Node$4 = node;
|
|
2350
|
+
let Comment$6 = class Comment extends Node$4 {
|
|
2351
|
+
constructor(defaults) {
|
|
2352
|
+
super(defaults);
|
|
2353
|
+
this.type = "comment";
|
|
2354
|
+
}
|
|
2355
|
+
};
|
|
2356
|
+
var comment$1 = Comment$6;
|
|
2357
|
+
Comment$6.default = Comment$6;
|
|
2301
2358
|
let Node$3 = node;
|
|
2302
|
-
let Declaration$
|
|
2359
|
+
let Declaration$5 = class Declaration extends Node$3 {
|
|
2303
2360
|
constructor(defaults) {
|
|
2304
2361
|
if (defaults && typeof defaults.value !== "undefined" && typeof defaults.value !== "string") {
|
|
2305
2362
|
defaults = __spreadProps(__spreadValues({}, defaults), { value: String(defaults.value) });
|
|
@@ -2311,1124 +2368,1237 @@ let Declaration$4 = class Declaration extends Node$3 {
|
|
|
2311
2368
|
return this.prop.startsWith("--") || this.prop[0] === "$";
|
|
2312
2369
|
}
|
|
2313
2370
|
};
|
|
2314
|
-
var declaration = Declaration$
|
|
2315
|
-
Declaration$
|
|
2316
|
-
let
|
|
2317
|
-
let
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2371
|
+
var declaration = Declaration$5;
|
|
2372
|
+
Declaration$5.default = Declaration$5;
|
|
2373
|
+
let Comment$5 = comment$1;
|
|
2374
|
+
let Declaration$4 = declaration;
|
|
2375
|
+
let Node$2 = node;
|
|
2376
|
+
let { isClean: isClean$1, my: my$1 } = symbols;
|
|
2377
|
+
let AtRule$5;
|
|
2378
|
+
let parse$5;
|
|
2379
|
+
let Root$7;
|
|
2380
|
+
let Rule$5;
|
|
2381
|
+
function cleanSource(nodes) {
|
|
2382
|
+
return nodes.map((i) => {
|
|
2383
|
+
if (i.nodes) i.nodes = cleanSource(i.nodes);
|
|
2384
|
+
delete i.source;
|
|
2385
|
+
return i;
|
|
2386
|
+
});
|
|
2387
|
+
}
|
|
2388
|
+
function markTreeDirty(node2) {
|
|
2389
|
+
node2[isClean$1] = false;
|
|
2390
|
+
if (node2.proxyOf.nodes) {
|
|
2391
|
+
for (let i of node2.proxyOf.nodes) {
|
|
2392
|
+
markTreeDirty(i);
|
|
2323
2393
|
}
|
|
2324
|
-
return id;
|
|
2325
|
-
};
|
|
2326
|
-
};
|
|
2327
|
-
let nanoid$1 = (size = 21) => {
|
|
2328
|
-
let id = "";
|
|
2329
|
-
let i = size;
|
|
2330
|
-
while (i--) {
|
|
2331
|
-
id += urlAlphabet[Math.random() * 64 | 0];
|
|
2332
|
-
}
|
|
2333
|
-
return id;
|
|
2334
|
-
};
|
|
2335
|
-
var nonSecure = { nanoid: nanoid$1, customAlphabet };
|
|
2336
|
-
let { SourceMapConsumer: SourceMapConsumer$2, SourceMapGenerator: SourceMapGenerator$2 } = require$$2;
|
|
2337
|
-
let { existsSync, readFileSync } = require$$2;
|
|
2338
|
-
let { dirname: dirname$1, join } = require$$2;
|
|
2339
|
-
function fromBase64(str) {
|
|
2340
|
-
if (Buffer) {
|
|
2341
|
-
return Buffer.from(str, "base64").toString();
|
|
2342
|
-
} else {
|
|
2343
|
-
return window.atob(str);
|
|
2344
2394
|
}
|
|
2345
2395
|
}
|
|
2346
|
-
let
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
let prev = opts.map ? opts.map.prev : void 0;
|
|
2352
|
-
let text = this.loadMap(opts.from, prev);
|
|
2353
|
-
if (!this.mapFile && opts.from) {
|
|
2354
|
-
this.mapFile = opts.from;
|
|
2396
|
+
let Container$8 = class Container extends Node$2 {
|
|
2397
|
+
append(...children) {
|
|
2398
|
+
for (let child of children) {
|
|
2399
|
+
let nodes = this.normalize(child, this.last);
|
|
2400
|
+
for (let node2 of nodes) this.proxyOf.nodes.push(node2);
|
|
2355
2401
|
}
|
|
2356
|
-
|
|
2357
|
-
|
|
2402
|
+
this.markDirty();
|
|
2403
|
+
return this;
|
|
2358
2404
|
}
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2405
|
+
cleanRaws(keepBetween) {
|
|
2406
|
+
super.cleanRaws(keepBetween);
|
|
2407
|
+
if (this.nodes) {
|
|
2408
|
+
for (let node2 of this.nodes) node2.cleanRaws(keepBetween);
|
|
2362
2409
|
}
|
|
2363
|
-
return this.consumerCache;
|
|
2364
2410
|
}
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
let
|
|
2368
|
-
let
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
return fromBase64(text.substr(RegExp.lastMatch.length));
|
|
2411
|
+
each(callback) {
|
|
2412
|
+
if (!this.proxyOf.nodes) return void 0;
|
|
2413
|
+
let iterator = this.getIterator();
|
|
2414
|
+
let index2, result2;
|
|
2415
|
+
while (this.indexes[iterator] < this.proxyOf.nodes.length) {
|
|
2416
|
+
index2 = this.indexes[iterator];
|
|
2417
|
+
result2 = callback(this.proxyOf.nodes[index2], index2);
|
|
2418
|
+
if (result2 === false) break;
|
|
2419
|
+
this.indexes[iterator] += 1;
|
|
2375
2420
|
}
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
}
|
|
2379
|
-
getAnnotationURL(sourceMapString) {
|
|
2380
|
-
return sourceMapString.replace(/^\/\*\s*# sourceMappingURL=/, "").trim();
|
|
2381
|
-
}
|
|
2382
|
-
isMap(map) {
|
|
2383
|
-
if (typeof map !== "object") return false;
|
|
2384
|
-
return typeof map.mappings === "string" || typeof map._mappings === "string" || Array.isArray(map.sections);
|
|
2421
|
+
delete this.indexes[iterator];
|
|
2422
|
+
return result2;
|
|
2385
2423
|
}
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
if (!comments) return;
|
|
2389
|
-
let start = css.lastIndexOf(comments.pop());
|
|
2390
|
-
let end = css.indexOf("*/", start);
|
|
2391
|
-
if (start > -1 && end > -1) {
|
|
2392
|
-
this.annotation = this.getAnnotationURL(css.substring(start, end));
|
|
2393
|
-
}
|
|
2424
|
+
every(condition) {
|
|
2425
|
+
return this.nodes.every(condition);
|
|
2394
2426
|
}
|
|
2395
|
-
|
|
2396
|
-
this.
|
|
2397
|
-
if (
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2427
|
+
getIterator() {
|
|
2428
|
+
if (!this.lastEach) this.lastEach = 0;
|
|
2429
|
+
if (!this.indexes) this.indexes = {};
|
|
2430
|
+
this.lastEach += 1;
|
|
2431
|
+
let iterator = this.lastEach;
|
|
2432
|
+
this.indexes[iterator] = 0;
|
|
2433
|
+
return iterator;
|
|
2401
2434
|
}
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
if (
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2435
|
+
getProxyProcessor() {
|
|
2436
|
+
return {
|
|
2437
|
+
get(node2, prop) {
|
|
2438
|
+
if (prop === "proxyOf") {
|
|
2439
|
+
return node2;
|
|
2440
|
+
} else if (!node2[prop]) {
|
|
2441
|
+
return node2[prop];
|
|
2442
|
+
} else if (prop === "each" || typeof prop === "string" && prop.startsWith("walk")) {
|
|
2443
|
+
return (...args) => {
|
|
2444
|
+
return node2[prop](
|
|
2445
|
+
...args.map((i) => {
|
|
2446
|
+
if (typeof i === "function") {
|
|
2447
|
+
return (child, index2) => i(child.toProxy(), index2);
|
|
2448
|
+
} else {
|
|
2449
|
+
return i;
|
|
2450
|
+
}
|
|
2451
|
+
})
|
|
2414
2452
|
);
|
|
2415
|
-
}
|
|
2416
|
-
|
|
2453
|
+
};
|
|
2454
|
+
} else if (prop === "every" || prop === "some") {
|
|
2455
|
+
return (cb) => {
|
|
2456
|
+
return node2[prop](
|
|
2457
|
+
(child, ...other) => cb(child.toProxy(), ...other)
|
|
2458
|
+
);
|
|
2459
|
+
};
|
|
2460
|
+
} else if (prop === "root") {
|
|
2461
|
+
return () => node2.root().toProxy();
|
|
2462
|
+
} else if (prop === "nodes") {
|
|
2463
|
+
return node2.nodes.map((i) => i.toProxy());
|
|
2464
|
+
} else if (prop === "first" || prop === "last") {
|
|
2465
|
+
return node2[prop].toProxy();
|
|
2466
|
+
} else {
|
|
2467
|
+
return node2[prop];
|
|
2417
2468
|
}
|
|
2418
|
-
}
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
"Unsupported previous source map format: " + prev.toString()
|
|
2427
|
-
);
|
|
2469
|
+
},
|
|
2470
|
+
set(node2, prop, value) {
|
|
2471
|
+
if (node2[prop] === value) return true;
|
|
2472
|
+
node2[prop] = value;
|
|
2473
|
+
if (prop === "name" || prop === "params" || prop === "selector") {
|
|
2474
|
+
node2.markDirty();
|
|
2475
|
+
}
|
|
2476
|
+
return true;
|
|
2428
2477
|
}
|
|
2429
|
-
}
|
|
2430
|
-
return this.decodeInline(this.annotation);
|
|
2431
|
-
} else if (this.annotation) {
|
|
2432
|
-
let map = this.annotation;
|
|
2433
|
-
if (file) map = join(dirname$1(file), map);
|
|
2434
|
-
return this.loadFile(map);
|
|
2435
|
-
}
|
|
2478
|
+
};
|
|
2436
2479
|
}
|
|
2437
|
-
|
|
2438
|
-
if (
|
|
2439
|
-
|
|
2480
|
+
index(child) {
|
|
2481
|
+
if (typeof child === "number") return child;
|
|
2482
|
+
if (child.proxyOf) child = child.proxyOf;
|
|
2483
|
+
return this.proxyOf.nodes.indexOf(child);
|
|
2440
2484
|
}
|
|
2441
|
-
|
|
2442
|
-
|
|
2485
|
+
insertAfter(exist, add) {
|
|
2486
|
+
let existIndex = this.index(exist);
|
|
2487
|
+
let nodes = this.normalize(add, this.proxyOf.nodes[existIndex]).reverse();
|
|
2488
|
+
existIndex = this.index(exist);
|
|
2489
|
+
for (let node2 of nodes) this.proxyOf.nodes.splice(existIndex + 1, 0, node2);
|
|
2490
|
+
let index2;
|
|
2491
|
+
for (let id in this.indexes) {
|
|
2492
|
+
index2 = this.indexes[id];
|
|
2493
|
+
if (existIndex < index2) {
|
|
2494
|
+
this.indexes[id] = index2 + nodes.length;
|
|
2495
|
+
}
|
|
2496
|
+
}
|
|
2497
|
+
this.markDirty();
|
|
2498
|
+
return this;
|
|
2443
2499
|
}
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
let
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
let
|
|
2454
|
-
let
|
|
2455
|
-
let
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
throw new Error(`PostCSS received ${css} instead of CSS string`);
|
|
2500
|
+
insertBefore(exist, add) {
|
|
2501
|
+
let existIndex = this.index(exist);
|
|
2502
|
+
let type = existIndex === 0 ? "prepend" : false;
|
|
2503
|
+
let nodes = this.normalize(
|
|
2504
|
+
add,
|
|
2505
|
+
this.proxyOf.nodes[existIndex],
|
|
2506
|
+
type
|
|
2507
|
+
).reverse();
|
|
2508
|
+
existIndex = this.index(exist);
|
|
2509
|
+
for (let node2 of nodes) this.proxyOf.nodes.splice(existIndex, 0, node2);
|
|
2510
|
+
let index2;
|
|
2511
|
+
for (let id in this.indexes) {
|
|
2512
|
+
index2 = this.indexes[id];
|
|
2513
|
+
if (existIndex <= index2) {
|
|
2514
|
+
this.indexes[id] = index2 + nodes.length;
|
|
2515
|
+
}
|
|
2461
2516
|
}
|
|
2462
|
-
this.
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2517
|
+
this.markDirty();
|
|
2518
|
+
return this;
|
|
2519
|
+
}
|
|
2520
|
+
normalize(nodes, sample) {
|
|
2521
|
+
if (typeof nodes === "string") {
|
|
2522
|
+
nodes = cleanSource(parse$5(nodes).nodes);
|
|
2523
|
+
} else if (typeof nodes === "undefined") {
|
|
2524
|
+
nodes = [];
|
|
2525
|
+
} else if (Array.isArray(nodes)) {
|
|
2526
|
+
nodes = nodes.slice(0);
|
|
2527
|
+
for (let i of nodes) {
|
|
2528
|
+
if (i.parent) i.parent.removeChild(i, "ignore");
|
|
2529
|
+
}
|
|
2530
|
+
} else if (nodes.type === "root" && this.type !== "document") {
|
|
2531
|
+
nodes = nodes.nodes.slice(0);
|
|
2532
|
+
for (let i of nodes) {
|
|
2533
|
+
if (i.parent) i.parent.removeChild(i, "ignore");
|
|
2534
|
+
}
|
|
2535
|
+
} else if (nodes.type) {
|
|
2536
|
+
nodes = [nodes];
|
|
2537
|
+
} else if (nodes.prop) {
|
|
2538
|
+
if (typeof nodes.value === "undefined") {
|
|
2539
|
+
throw new Error("Value field is missed in node creation");
|
|
2540
|
+
} else if (typeof nodes.value !== "string") {
|
|
2541
|
+
nodes.value = String(nodes.value);
|
|
2542
|
+
}
|
|
2543
|
+
nodes = [new Declaration$4(nodes)];
|
|
2544
|
+
} else if (nodes.selector || nodes.selectors) {
|
|
2545
|
+
nodes = [new Rule$5(nodes)];
|
|
2546
|
+
} else if (nodes.name) {
|
|
2547
|
+
nodes = [new AtRule$5(nodes)];
|
|
2548
|
+
} else if (nodes.text) {
|
|
2549
|
+
nodes = [new Comment$5(nodes)];
|
|
2466
2550
|
} else {
|
|
2467
|
-
|
|
2551
|
+
throw new Error("Unknown node type in node creation");
|
|
2468
2552
|
}
|
|
2469
|
-
|
|
2470
|
-
if (!
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2553
|
+
let processed = nodes.map((i) => {
|
|
2554
|
+
if (!i[my$1]) Container.rebuild(i);
|
|
2555
|
+
i = i.proxyOf;
|
|
2556
|
+
if (i.parent) i.parent.removeChild(i);
|
|
2557
|
+
if (i[isClean$1]) markTreeDirty(i);
|
|
2558
|
+
if (!i.raws) i.raws = {};
|
|
2559
|
+
if (typeof i.raws.before === "undefined") {
|
|
2560
|
+
if (sample && typeof sample.raws.before !== "undefined") {
|
|
2561
|
+
i.raws.before = sample.raws.before.replace(/\S/g, "");
|
|
2562
|
+
}
|
|
2563
|
+
}
|
|
2564
|
+
i.parent = this.proxyOf;
|
|
2565
|
+
return i;
|
|
2566
|
+
});
|
|
2567
|
+
return processed;
|
|
2568
|
+
}
|
|
2569
|
+
prepend(...children) {
|
|
2570
|
+
children = children.reverse();
|
|
2571
|
+
for (let child of children) {
|
|
2572
|
+
let nodes = this.normalize(child, this.first, "prepend").reverse();
|
|
2573
|
+
for (let node2 of nodes) this.proxyOf.nodes.unshift(node2);
|
|
2574
|
+
for (let id in this.indexes) {
|
|
2575
|
+
this.indexes[id] = this.indexes[id] + nodes.length;
|
|
2474
2576
|
}
|
|
2475
2577
|
}
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2578
|
+
this.markDirty();
|
|
2579
|
+
return this;
|
|
2580
|
+
}
|
|
2581
|
+
push(child) {
|
|
2582
|
+
child.parent = this;
|
|
2583
|
+
this.proxyOf.nodes.push(child);
|
|
2584
|
+
return this;
|
|
2585
|
+
}
|
|
2586
|
+
removeAll() {
|
|
2587
|
+
for (let node2 of this.proxyOf.nodes) node2.parent = void 0;
|
|
2588
|
+
this.proxyOf.nodes = [];
|
|
2589
|
+
this.markDirty();
|
|
2590
|
+
return this;
|
|
2591
|
+
}
|
|
2592
|
+
removeChild(child) {
|
|
2593
|
+
child = this.index(child);
|
|
2594
|
+
this.proxyOf.nodes[child].parent = void 0;
|
|
2595
|
+
this.proxyOf.nodes.splice(child, 1);
|
|
2596
|
+
let index2;
|
|
2597
|
+
for (let id in this.indexes) {
|
|
2598
|
+
index2 = this.indexes[id];
|
|
2599
|
+
if (index2 >= child) {
|
|
2600
|
+
this.indexes[id] = index2 - 1;
|
|
2482
2601
|
}
|
|
2483
2602
|
}
|
|
2484
|
-
|
|
2485
|
-
|
|
2603
|
+
this.markDirty();
|
|
2604
|
+
return this;
|
|
2605
|
+
}
|
|
2606
|
+
replaceValues(pattern, opts, callback) {
|
|
2607
|
+
if (!callback) {
|
|
2608
|
+
callback = opts;
|
|
2609
|
+
opts = {};
|
|
2486
2610
|
}
|
|
2487
|
-
|
|
2611
|
+
this.walkDecls((decl2) => {
|
|
2612
|
+
if (opts.props && !opts.props.includes(decl2.prop)) return;
|
|
2613
|
+
if (opts.fast && !decl2.value.includes(opts.fast)) return;
|
|
2614
|
+
decl2.value = decl2.value.replace(pattern, callback);
|
|
2615
|
+
});
|
|
2616
|
+
this.markDirty();
|
|
2617
|
+
return this;
|
|
2488
2618
|
}
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
line = start.line;
|
|
2500
|
-
column = start.column;
|
|
2619
|
+
some(condition) {
|
|
2620
|
+
return this.nodes.some(condition);
|
|
2621
|
+
}
|
|
2622
|
+
walk(callback) {
|
|
2623
|
+
return this.each((child, i) => {
|
|
2624
|
+
let result2;
|
|
2625
|
+
try {
|
|
2626
|
+
result2 = callback(child, i);
|
|
2627
|
+
} catch (e) {
|
|
2628
|
+
throw child.addToError(e);
|
|
2501
2629
|
}
|
|
2502
|
-
if (
|
|
2503
|
-
|
|
2504
|
-
endLine = pos.line;
|
|
2505
|
-
endColumn = pos.col;
|
|
2506
|
-
} else {
|
|
2507
|
-
endLine = end.line;
|
|
2508
|
-
endColumn = end.column;
|
|
2630
|
+
if (result2 !== false && child.walk) {
|
|
2631
|
+
result2 = child.walk(callback);
|
|
2509
2632
|
}
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2633
|
+
return result2;
|
|
2634
|
+
});
|
|
2635
|
+
}
|
|
2636
|
+
walkAtRules(name, callback) {
|
|
2637
|
+
if (!callback) {
|
|
2638
|
+
callback = name;
|
|
2639
|
+
return this.walk((child, i) => {
|
|
2640
|
+
if (child.type === "atrule") {
|
|
2641
|
+
return callback(child, i);
|
|
2642
|
+
}
|
|
2643
|
+
});
|
|
2514
2644
|
}
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
origin.source,
|
|
2522
|
-
origin.file,
|
|
2523
|
-
opts.plugin
|
|
2524
|
-
);
|
|
2525
|
-
} else {
|
|
2526
|
-
result2 = new CssSyntaxError$1(
|
|
2527
|
-
message,
|
|
2528
|
-
endLine === void 0 ? line : { column, line },
|
|
2529
|
-
endLine === void 0 ? column : { column: endColumn, line: endLine },
|
|
2530
|
-
this.css,
|
|
2531
|
-
this.file,
|
|
2532
|
-
opts.plugin
|
|
2533
|
-
);
|
|
2645
|
+
if (name instanceof RegExp) {
|
|
2646
|
+
return this.walk((child, i) => {
|
|
2647
|
+
if (child.type === "atrule" && name.test(child.name)) {
|
|
2648
|
+
return callback(child, i);
|
|
2649
|
+
}
|
|
2650
|
+
});
|
|
2534
2651
|
}
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
result2.input.url = pathToFileURL$1(this.file).toString();
|
|
2652
|
+
return this.walk((child, i) => {
|
|
2653
|
+
if (child.type === "atrule" && child.name === name) {
|
|
2654
|
+
return callback(child, i);
|
|
2539
2655
|
}
|
|
2540
|
-
|
|
2541
|
-
}
|
|
2542
|
-
return result2;
|
|
2656
|
+
});
|
|
2543
2657
|
}
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
lineToIndex = new Array(lines.length);
|
|
2549
|
-
let prevIndex = 0;
|
|
2550
|
-
for (let i = 0, l = lines.length; i < l; i++) {
|
|
2551
|
-
lineToIndex[i] = prevIndex;
|
|
2552
|
-
prevIndex += lines[i].length + 1;
|
|
2658
|
+
walkComments(callback) {
|
|
2659
|
+
return this.walk((child, i) => {
|
|
2660
|
+
if (child.type === "comment") {
|
|
2661
|
+
return callback(child, i);
|
|
2553
2662
|
}
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2663
|
+
});
|
|
2664
|
+
}
|
|
2665
|
+
walkDecls(prop, callback) {
|
|
2666
|
+
if (!callback) {
|
|
2667
|
+
callback = prop;
|
|
2668
|
+
return this.walk((child, i) => {
|
|
2669
|
+
if (child.type === "decl") {
|
|
2670
|
+
return callback(child, i);
|
|
2671
|
+
}
|
|
2672
|
+
});
|
|
2557
2673
|
}
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
} else {
|
|
2563
|
-
let max = lineToIndex.length - 2;
|
|
2564
|
-
let mid;
|
|
2565
|
-
while (min < max) {
|
|
2566
|
-
mid = min + (max - min >> 1);
|
|
2567
|
-
if (offset < lineToIndex[mid]) {
|
|
2568
|
-
max = mid - 1;
|
|
2569
|
-
} else if (offset >= lineToIndex[mid + 1]) {
|
|
2570
|
-
min = mid + 1;
|
|
2571
|
-
} else {
|
|
2572
|
-
min = mid;
|
|
2573
|
-
break;
|
|
2674
|
+
if (prop instanceof RegExp) {
|
|
2675
|
+
return this.walk((child, i) => {
|
|
2676
|
+
if (child.type === "decl" && prop.test(child.prop)) {
|
|
2677
|
+
return callback(child, i);
|
|
2574
2678
|
}
|
|
2575
|
-
}
|
|
2679
|
+
});
|
|
2576
2680
|
}
|
|
2577
|
-
return {
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2681
|
+
return this.walk((child, i) => {
|
|
2682
|
+
if (child.type === "decl" && child.prop === prop) {
|
|
2683
|
+
return callback(child, i);
|
|
2684
|
+
}
|
|
2685
|
+
});
|
|
2581
2686
|
}
|
|
2582
|
-
|
|
2583
|
-
if (
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
let consumer = this.map.consumer();
|
|
2591
|
-
let from = consumer.originalPositionFor({ column, line });
|
|
2592
|
-
if (!from.source) return false;
|
|
2593
|
-
let to;
|
|
2594
|
-
if (typeof endLine === "number") {
|
|
2595
|
-
to = consumer.originalPositionFor({ column: endColumn, line: endLine });
|
|
2687
|
+
walkRules(selector, callback) {
|
|
2688
|
+
if (!callback) {
|
|
2689
|
+
callback = selector;
|
|
2690
|
+
return this.walk((child, i) => {
|
|
2691
|
+
if (child.type === "rule") {
|
|
2692
|
+
return callback(child, i);
|
|
2693
|
+
}
|
|
2694
|
+
});
|
|
2596
2695
|
}
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
this.map.consumer().sourceRoot || pathToFileURL$1(this.map.mapFile)
|
|
2604
|
-
);
|
|
2696
|
+
if (selector instanceof RegExp) {
|
|
2697
|
+
return this.walk((child, i) => {
|
|
2698
|
+
if (child.type === "rule" && selector.test(child.selector)) {
|
|
2699
|
+
return callback(child, i);
|
|
2700
|
+
}
|
|
2701
|
+
});
|
|
2605
2702
|
}
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
endLine: to && to.line,
|
|
2610
|
-
line: from.line,
|
|
2611
|
-
url: fromUrl.toString()
|
|
2612
|
-
};
|
|
2613
|
-
if (fromUrl.protocol === "file:") {
|
|
2614
|
-
if (fileURLToPath) {
|
|
2615
|
-
result2.file = fileURLToPath(fromUrl);
|
|
2616
|
-
} else {
|
|
2617
|
-
throw new Error(`file: protocol is not available in this PostCSS build`);
|
|
2703
|
+
return this.walk((child, i) => {
|
|
2704
|
+
if (child.type === "rule" && child.selector === selector) {
|
|
2705
|
+
return callback(child, i);
|
|
2618
2706
|
}
|
|
2619
|
-
}
|
|
2620
|
-
let source = consumer.sourceContentFor(from.source);
|
|
2621
|
-
if (source) result2.source = source;
|
|
2622
|
-
return result2;
|
|
2707
|
+
});
|
|
2623
2708
|
}
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
if (this[name] != null) {
|
|
2628
|
-
json[name] = this[name];
|
|
2629
|
-
}
|
|
2630
|
-
}
|
|
2631
|
-
if (this.map) {
|
|
2632
|
-
json.map = __spreadValues({}, this.map);
|
|
2633
|
-
if (json.map.consumerCache) {
|
|
2634
|
-
json.map.consumerCache = void 0;
|
|
2635
|
-
}
|
|
2636
|
-
}
|
|
2637
|
-
return json;
|
|
2709
|
+
get first() {
|
|
2710
|
+
if (!this.proxyOf.nodes) return void 0;
|
|
2711
|
+
return this.proxyOf.nodes[0];
|
|
2638
2712
|
}
|
|
2639
|
-
get
|
|
2640
|
-
|
|
2713
|
+
get last() {
|
|
2714
|
+
if (!this.proxyOf.nodes) return void 0;
|
|
2715
|
+
return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
|
|
2641
2716
|
}
|
|
2642
2717
|
};
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2718
|
+
Container$8.registerParse = (dependant) => {
|
|
2719
|
+
parse$5 = dependant;
|
|
2720
|
+
};
|
|
2721
|
+
Container$8.registerRule = (dependant) => {
|
|
2722
|
+
Rule$5 = dependant;
|
|
2723
|
+
};
|
|
2724
|
+
Container$8.registerAtRule = (dependant) => {
|
|
2725
|
+
AtRule$5 = dependant;
|
|
2726
|
+
};
|
|
2727
|
+
Container$8.registerRoot = (dependant) => {
|
|
2728
|
+
Root$7 = dependant;
|
|
2729
|
+
};
|
|
2730
|
+
var container = Container$8;
|
|
2731
|
+
Container$8.default = Container$8;
|
|
2732
|
+
Container$8.rebuild = (node2) => {
|
|
2733
|
+
if (node2.type === "atrule") {
|
|
2734
|
+
Object.setPrototypeOf(node2, AtRule$5.prototype);
|
|
2735
|
+
} else if (node2.type === "rule") {
|
|
2736
|
+
Object.setPrototypeOf(node2, Rule$5.prototype);
|
|
2737
|
+
} else if (node2.type === "decl") {
|
|
2738
|
+
Object.setPrototypeOf(node2, Declaration$4.prototype);
|
|
2739
|
+
} else if (node2.type === "comment") {
|
|
2740
|
+
Object.setPrototypeOf(node2, Comment$5.prototype);
|
|
2741
|
+
} else if (node2.type === "root") {
|
|
2742
|
+
Object.setPrototypeOf(node2, Root$7.prototype);
|
|
2666
2743
|
}
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
}
|
|
2672
|
-
content = this.mapOpts.annotation;
|
|
2673
|
-
} else if (typeof this.mapOpts.annotation === "function") {
|
|
2674
|
-
content = this.mapOpts.annotation(this.opts.to, this.root);
|
|
2675
|
-
} else {
|
|
2676
|
-
content = this.outputFile() + ".map";
|
|
2677
|
-
}
|
|
2678
|
-
let eol = "\n";
|
|
2679
|
-
if (this.css.includes("\r\n")) eol = "\r\n";
|
|
2680
|
-
this.css += eol + "/*# sourceMappingURL=" + content + " */";
|
|
2744
|
+
node2[my$1] = true;
|
|
2745
|
+
if (node2.nodes) {
|
|
2746
|
+
node2.nodes.forEach((child) => {
|
|
2747
|
+
Container$8.rebuild(child);
|
|
2748
|
+
});
|
|
2681
2749
|
}
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
map = new SourceMapConsumer(prev.text);
|
|
2689
|
-
if (map.sourcesContent) {
|
|
2690
|
-
map.sourcesContent = null;
|
|
2691
|
-
}
|
|
2692
|
-
} else {
|
|
2693
|
-
map = prev.consumer();
|
|
2694
|
-
}
|
|
2695
|
-
this.map.applySourceMap(map, from, this.toUrl(this.path(root2)));
|
|
2696
|
-
}
|
|
2750
|
+
};
|
|
2751
|
+
let Container$7 = container;
|
|
2752
|
+
let AtRule$4 = class AtRule extends Container$7 {
|
|
2753
|
+
constructor(defaults) {
|
|
2754
|
+
super(defaults);
|
|
2755
|
+
this.type = "atrule";
|
|
2697
2756
|
}
|
|
2698
|
-
|
|
2699
|
-
if (this.
|
|
2700
|
-
|
|
2701
|
-
let node2;
|
|
2702
|
-
for (let i = this.root.nodes.length - 1; i >= 0; i--) {
|
|
2703
|
-
node2 = this.root.nodes[i];
|
|
2704
|
-
if (node2.type !== "comment") continue;
|
|
2705
|
-
if (node2.text.indexOf("# sourceMappingURL=") === 0) {
|
|
2706
|
-
this.root.removeChild(i);
|
|
2707
|
-
}
|
|
2708
|
-
}
|
|
2709
|
-
} else if (this.css) {
|
|
2710
|
-
this.css = this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm, "");
|
|
2711
|
-
}
|
|
2757
|
+
append(...children) {
|
|
2758
|
+
if (!this.proxyOf.nodes) this.nodes = [];
|
|
2759
|
+
return super.append(...children);
|
|
2712
2760
|
}
|
|
2713
|
-
|
|
2714
|
-
this.
|
|
2715
|
-
|
|
2716
|
-
return this.generateMap();
|
|
2717
|
-
} else {
|
|
2718
|
-
let result2 = "";
|
|
2719
|
-
this.stringify(this.root, (i) => {
|
|
2720
|
-
result2 += i;
|
|
2721
|
-
});
|
|
2722
|
-
return [result2];
|
|
2723
|
-
}
|
|
2761
|
+
prepend(...children) {
|
|
2762
|
+
if (!this.proxyOf.nodes) this.nodes = [];
|
|
2763
|
+
return super.prepend(...children);
|
|
2724
2764
|
}
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
}
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
ignoreInvalidMapping: true
|
|
2738
|
-
});
|
|
2739
|
-
this.map.addMapping({
|
|
2740
|
-
generated: { column: 0, line: 1 },
|
|
2741
|
-
original: { column: 0, line: 1 },
|
|
2742
|
-
source: this.opts.from ? this.toUrl(this.path(this.opts.from)) : "<no source>"
|
|
2743
|
-
});
|
|
2744
|
-
}
|
|
2745
|
-
if (this.isSourcesContent()) this.setSourcesContent();
|
|
2746
|
-
if (this.root && this.previous().length > 0) this.applyPrevMaps();
|
|
2747
|
-
if (this.isAnnotation()) this.addAnnotation();
|
|
2748
|
-
if (this.isInline()) {
|
|
2749
|
-
return [this.css];
|
|
2750
|
-
} else {
|
|
2751
|
-
return [this.css, this.map];
|
|
2765
|
+
};
|
|
2766
|
+
var atRule$1 = AtRule$4;
|
|
2767
|
+
AtRule$4.default = AtRule$4;
|
|
2768
|
+
Container$7.registerAtRule(AtRule$4);
|
|
2769
|
+
let Container$6 = container;
|
|
2770
|
+
let LazyResult$4;
|
|
2771
|
+
let Processor$4;
|
|
2772
|
+
let Document$4 = class Document extends Container$6 {
|
|
2773
|
+
constructor(defaults) {
|
|
2774
|
+
super(__spreadValues({ type: "document" }, defaults));
|
|
2775
|
+
if (!this.nodes) {
|
|
2776
|
+
this.nodes = [];
|
|
2752
2777
|
}
|
|
2753
2778
|
}
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
file: this.outputFile(),
|
|
2758
|
-
ignoreInvalidMapping: true
|
|
2759
|
-
});
|
|
2760
|
-
let line = 1;
|
|
2761
|
-
let column = 1;
|
|
2762
|
-
let noSource = "<no source>";
|
|
2763
|
-
let mapping = {
|
|
2764
|
-
generated: { column: 0, line: 0 },
|
|
2765
|
-
original: { column: 0, line: 0 },
|
|
2766
|
-
source: ""
|
|
2767
|
-
};
|
|
2768
|
-
let lines, last;
|
|
2769
|
-
this.stringify(this.root, (str, node2, type) => {
|
|
2770
|
-
this.css += str;
|
|
2771
|
-
if (node2 && type !== "end") {
|
|
2772
|
-
mapping.generated.line = line;
|
|
2773
|
-
mapping.generated.column = column - 1;
|
|
2774
|
-
if (node2.source && node2.source.start) {
|
|
2775
|
-
mapping.source = this.sourcePath(node2);
|
|
2776
|
-
mapping.original.line = node2.source.start.line;
|
|
2777
|
-
mapping.original.column = node2.source.start.column - 1;
|
|
2778
|
-
this.map.addMapping(mapping);
|
|
2779
|
-
} else {
|
|
2780
|
-
mapping.source = noSource;
|
|
2781
|
-
mapping.original.line = 1;
|
|
2782
|
-
mapping.original.column = 0;
|
|
2783
|
-
this.map.addMapping(mapping);
|
|
2784
|
-
}
|
|
2785
|
-
}
|
|
2786
|
-
lines = str.match(/\n/g);
|
|
2787
|
-
if (lines) {
|
|
2788
|
-
line += lines.length;
|
|
2789
|
-
last = str.lastIndexOf("\n");
|
|
2790
|
-
column = str.length - last;
|
|
2791
|
-
} else {
|
|
2792
|
-
column += str.length;
|
|
2793
|
-
}
|
|
2794
|
-
if (node2 && type !== "start") {
|
|
2795
|
-
let p = node2.parent || { raws: {} };
|
|
2796
|
-
let childless = node2.type === "decl" || node2.type === "atrule" && !node2.nodes;
|
|
2797
|
-
if (!childless || node2 !== p.last || p.raws.semicolon) {
|
|
2798
|
-
if (node2.source && node2.source.end) {
|
|
2799
|
-
mapping.source = this.sourcePath(node2);
|
|
2800
|
-
mapping.original.line = node2.source.end.line;
|
|
2801
|
-
mapping.original.column = node2.source.end.column - 1;
|
|
2802
|
-
mapping.generated.line = line;
|
|
2803
|
-
mapping.generated.column = column - 2;
|
|
2804
|
-
this.map.addMapping(mapping);
|
|
2805
|
-
} else {
|
|
2806
|
-
mapping.source = noSource;
|
|
2807
|
-
mapping.original.line = 1;
|
|
2808
|
-
mapping.original.column = 0;
|
|
2809
|
-
mapping.generated.line = line;
|
|
2810
|
-
mapping.generated.column = column - 1;
|
|
2811
|
-
this.map.addMapping(mapping);
|
|
2812
|
-
}
|
|
2813
|
-
}
|
|
2814
|
-
}
|
|
2815
|
-
});
|
|
2779
|
+
toResult(opts = {}) {
|
|
2780
|
+
let lazy = new LazyResult$4(new Processor$4(), this, opts);
|
|
2781
|
+
return lazy.stringify();
|
|
2816
2782
|
}
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2783
|
+
};
|
|
2784
|
+
Document$4.registerLazyResult = (dependant) => {
|
|
2785
|
+
LazyResult$4 = dependant;
|
|
2786
|
+
};
|
|
2787
|
+
Document$4.registerProcessor = (dependant) => {
|
|
2788
|
+
Processor$4 = dependant;
|
|
2789
|
+
};
|
|
2790
|
+
var document$2 = Document$4;
|
|
2791
|
+
Document$4.default = Document$4;
|
|
2792
|
+
let urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
2793
|
+
let customAlphabet = (alphabet, defaultSize = 21) => {
|
|
2794
|
+
return (size = defaultSize) => {
|
|
2795
|
+
let id = "";
|
|
2796
|
+
let i = size | 0;
|
|
2797
|
+
while (i--) {
|
|
2798
|
+
id += alphabet[Math.random() * alphabet.length | 0];
|
|
2826
2799
|
}
|
|
2827
|
-
return
|
|
2800
|
+
return id;
|
|
2801
|
+
};
|
|
2802
|
+
};
|
|
2803
|
+
let nanoid$1 = (size = 21) => {
|
|
2804
|
+
let id = "";
|
|
2805
|
+
let i = size | 0;
|
|
2806
|
+
while (i--) {
|
|
2807
|
+
id += urlAlphabet[Math.random() * 64 | 0];
|
|
2828
2808
|
}
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2809
|
+
return id;
|
|
2810
|
+
};
|
|
2811
|
+
var nonSecure = { nanoid: nanoid$1, customAlphabet };
|
|
2812
|
+
let { existsSync, readFileSync } = require$$2;
|
|
2813
|
+
let { dirname: dirname$1, join } = require$$2;
|
|
2814
|
+
let { SourceMapConsumer: SourceMapConsumer$2, SourceMapGenerator: SourceMapGenerator$2 } = require$$2;
|
|
2815
|
+
function fromBase64(str) {
|
|
2816
|
+
if (Buffer) {
|
|
2817
|
+
return Buffer.from(str, "base64").toString();
|
|
2818
|
+
} else {
|
|
2819
|
+
return window.atob(str);
|
|
2820
|
+
}
|
|
2821
|
+
}
|
|
2822
|
+
let PreviousMap$2 = class PreviousMap {
|
|
2823
|
+
constructor(css, opts) {
|
|
2824
|
+
if (opts.map === false) return;
|
|
2825
|
+
this.loadAnnotation(css);
|
|
2826
|
+
this.inline = this.startWith(this.annotation, "data:");
|
|
2827
|
+
let prev = opts.map ? opts.map.prev : void 0;
|
|
2828
|
+
let text = this.loadMap(opts.from, prev);
|
|
2829
|
+
if (!this.mapFile && opts.from) {
|
|
2830
|
+
this.mapFile = opts.from;
|
|
2839
2831
|
}
|
|
2840
|
-
|
|
2832
|
+
if (this.mapFile) this.root = dirname$1(this.mapFile);
|
|
2833
|
+
if (text) this.text = text;
|
|
2841
2834
|
}
|
|
2842
|
-
|
|
2843
|
-
if (
|
|
2844
|
-
|
|
2835
|
+
consumer() {
|
|
2836
|
+
if (!this.consumerCache) {
|
|
2837
|
+
this.consumerCache = new SourceMapConsumer$2(this.text);
|
|
2845
2838
|
}
|
|
2846
|
-
return this.
|
|
2839
|
+
return this.consumerCache;
|
|
2847
2840
|
}
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2841
|
+
decodeInline(text) {
|
|
2842
|
+
let baseCharsetUri = /^data:application\/json;charset=utf-?8;base64,/;
|
|
2843
|
+
let baseUri = /^data:application\/json;base64,/;
|
|
2844
|
+
let charsetUri = /^data:application\/json;charset=utf-?8,/;
|
|
2845
|
+
let uri = /^data:application\/json,/;
|
|
2846
|
+
let uriMatch = text.match(charsetUri) || text.match(uri);
|
|
2847
|
+
if (uriMatch) {
|
|
2848
|
+
return decodeURIComponent(text.substr(uriMatch[0].length));
|
|
2851
2849
|
}
|
|
2852
|
-
|
|
2853
|
-
|
|
2850
|
+
let baseUriMatch = text.match(baseCharsetUri) || text.match(baseUri);
|
|
2851
|
+
if (baseUriMatch) {
|
|
2852
|
+
return fromBase64(text.substr(baseUriMatch[0].length));
|
|
2854
2853
|
}
|
|
2855
|
-
|
|
2854
|
+
let encoding = text.match(/data:application\/json;([^,]+),/)[1];
|
|
2855
|
+
throw new Error("Unsupported source map encoding " + encoding);
|
|
2856
2856
|
}
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2857
|
+
getAnnotationURL(sourceMapString) {
|
|
2858
|
+
return sourceMapString.replace(/^\/\*\s*# sourceMappingURL=/, "").trim();
|
|
2859
|
+
}
|
|
2860
|
+
isMap(map) {
|
|
2861
|
+
if (typeof map !== "object") return false;
|
|
2862
|
+
return typeof map.mappings === "string" || typeof map._mappings === "string" || Array.isArray(map.sections);
|
|
2863
|
+
}
|
|
2864
|
+
loadAnnotation(css) {
|
|
2865
|
+
let comments = css.match(/\/\*\s*# sourceMappingURL=/g);
|
|
2866
|
+
if (!comments) return;
|
|
2867
|
+
let start = css.lastIndexOf(comments.pop());
|
|
2868
|
+
let end = css.indexOf("*/", start);
|
|
2869
|
+
if (start > -1 && end > -1) {
|
|
2870
|
+
this.annotation = this.getAnnotationURL(css.substring(start, end));
|
|
2864
2871
|
}
|
|
2865
2872
|
}
|
|
2866
|
-
path
|
|
2867
|
-
|
|
2868
|
-
if (
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
if (cached) return cached;
|
|
2872
|
-
let from = this.opts.to ? dirname(this.opts.to) : ".";
|
|
2873
|
-
if (typeof this.mapOpts.annotation === "string") {
|
|
2874
|
-
from = dirname(resolve(from, this.mapOpts.annotation));
|
|
2873
|
+
loadFile(path) {
|
|
2874
|
+
this.root = dirname$1(path);
|
|
2875
|
+
if (existsSync(path)) {
|
|
2876
|
+
this.mapFile = path;
|
|
2877
|
+
return readFileSync(path, "utf-8").toString().trim();
|
|
2875
2878
|
}
|
|
2876
|
-
let path = relative(from, file);
|
|
2877
|
-
this.memoizedPaths.set(file, path);
|
|
2878
|
-
return path;
|
|
2879
2879
|
}
|
|
2880
|
-
|
|
2881
|
-
if (
|
|
2882
|
-
|
|
2883
|
-
if (
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2880
|
+
loadMap(file, prev) {
|
|
2881
|
+
if (prev === false) return false;
|
|
2882
|
+
if (prev) {
|
|
2883
|
+
if (typeof prev === "string") {
|
|
2884
|
+
return prev;
|
|
2885
|
+
} else if (typeof prev === "function") {
|
|
2886
|
+
let prevPath = prev(file);
|
|
2887
|
+
if (prevPath) {
|
|
2888
|
+
let map = this.loadFile(prevPath);
|
|
2889
|
+
if (!map) {
|
|
2890
|
+
throw new Error(
|
|
2891
|
+
"Unable to load previous source map: " + prevPath.toString()
|
|
2892
|
+
);
|
|
2890
2893
|
}
|
|
2891
|
-
|
|
2894
|
+
return map;
|
|
2895
|
+
}
|
|
2896
|
+
} else if (prev instanceof SourceMapConsumer$2) {
|
|
2897
|
+
return SourceMapGenerator$2.fromSourceMap(prev).toString();
|
|
2898
|
+
} else if (prev instanceof SourceMapGenerator$2) {
|
|
2899
|
+
return prev.toString();
|
|
2900
|
+
} else if (this.isMap(prev)) {
|
|
2901
|
+
return JSON.stringify(prev);
|
|
2892
2902
|
} else {
|
|
2893
|
-
|
|
2894
|
-
|
|
2903
|
+
throw new Error(
|
|
2904
|
+
"Unsupported previous source map format: " + prev.toString()
|
|
2905
|
+
);
|
|
2895
2906
|
}
|
|
2907
|
+
} else if (this.inline) {
|
|
2908
|
+
return this.decodeInline(this.annotation);
|
|
2909
|
+
} else if (this.annotation) {
|
|
2910
|
+
let map = this.annotation;
|
|
2911
|
+
if (file) map = join(dirname$1(file), map);
|
|
2912
|
+
return this.loadFile(map);
|
|
2896
2913
|
}
|
|
2897
|
-
return this.previousMaps;
|
|
2898
2914
|
}
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
+
startWith(string, start) {
|
|
2916
|
+
if (!string) return false;
|
|
2917
|
+
return string.substr(0, start.length) === start;
|
|
2918
|
+
}
|
|
2919
|
+
withContent() {
|
|
2920
|
+
return !!(this.consumer().sourcesContent && this.consumer().sourcesContent.length > 0);
|
|
2921
|
+
}
|
|
2922
|
+
};
|
|
2923
|
+
var previousMap = PreviousMap$2;
|
|
2924
|
+
PreviousMap$2.default = PreviousMap$2;
|
|
2925
|
+
let { nanoid } = nonSecure;
|
|
2926
|
+
let { isAbsolute, resolve: resolve$1 } = require$$2;
|
|
2927
|
+
let { SourceMapConsumer: SourceMapConsumer$1, SourceMapGenerator: SourceMapGenerator$1 } = require$$2;
|
|
2928
|
+
let { fileURLToPath, pathToFileURL: pathToFileURL$1 } = require$$2;
|
|
2929
|
+
let CssSyntaxError$2 = cssSyntaxError;
|
|
2930
|
+
let PreviousMap$1 = previousMap;
|
|
2931
|
+
let terminalHighlight = require$$2;
|
|
2932
|
+
let fromOffsetCache = Symbol("fromOffsetCache");
|
|
2933
|
+
let sourceMapAvailable$1 = Boolean(SourceMapConsumer$1 && SourceMapGenerator$1);
|
|
2934
|
+
let pathAvailable$1 = Boolean(resolve$1 && isAbsolute);
|
|
2935
|
+
let Input$6 = class Input {
|
|
2936
|
+
constructor(css, opts = {}) {
|
|
2937
|
+
if (css === null || typeof css === "undefined" || typeof css === "object" && !css.toString) {
|
|
2938
|
+
throw new Error(`PostCSS received ${css} instead of CSS string`);
|
|
2939
|
+
}
|
|
2940
|
+
this.css = css.toString();
|
|
2941
|
+
if (this.css[0] === "\uFEFF" || this.css[0] === "\uFFFE") {
|
|
2942
|
+
this.hasBOM = true;
|
|
2943
|
+
this.css = this.css.slice(1);
|
|
2944
|
+
} else {
|
|
2945
|
+
this.hasBOM = false;
|
|
2946
|
+
}
|
|
2947
|
+
this.document = this.css;
|
|
2948
|
+
if (opts.document) this.document = opts.document.toString();
|
|
2949
|
+
if (opts.from) {
|
|
2950
|
+
if (!pathAvailable$1 || /^\w+:\/\//.test(opts.from) || isAbsolute(opts.from)) {
|
|
2951
|
+
this.file = opts.from;
|
|
2952
|
+
} else {
|
|
2953
|
+
this.file = resolve$1(opts.from);
|
|
2954
|
+
}
|
|
2955
|
+
}
|
|
2956
|
+
if (pathAvailable$1 && sourceMapAvailable$1) {
|
|
2957
|
+
let map = new PreviousMap$1(this.css, opts);
|
|
2958
|
+
if (map.text) {
|
|
2959
|
+
this.map = map;
|
|
2960
|
+
let file = map.consumer().file;
|
|
2961
|
+
if (!this.file && file) this.file = this.mapResolve(file);
|
|
2962
|
+
}
|
|
2963
|
+
}
|
|
2964
|
+
if (!this.file) {
|
|
2965
|
+
this.id = "<input css " + nanoid(6) + ">";
|
|
2966
|
+
}
|
|
2967
|
+
if (this.map) this.map.file = this.from;
|
|
2968
|
+
}
|
|
2969
|
+
error(message, line, column, opts = {}) {
|
|
2970
|
+
let endColumn, endLine, result2;
|
|
2971
|
+
if (line && typeof line === "object") {
|
|
2972
|
+
let start = line;
|
|
2973
|
+
let end = column;
|
|
2974
|
+
if (typeof start.offset === "number") {
|
|
2975
|
+
let pos = this.fromOffset(start.offset);
|
|
2976
|
+
line = pos.line;
|
|
2977
|
+
column = pos.col;
|
|
2978
|
+
} else {
|
|
2979
|
+
line = start.line;
|
|
2980
|
+
column = start.column;
|
|
2981
|
+
}
|
|
2982
|
+
if (typeof end.offset === "number") {
|
|
2983
|
+
let pos = this.fromOffset(end.offset);
|
|
2984
|
+
endLine = pos.line;
|
|
2985
|
+
endColumn = pos.col;
|
|
2986
|
+
} else {
|
|
2987
|
+
endLine = end.line;
|
|
2988
|
+
endColumn = end.column;
|
|
2989
|
+
}
|
|
2990
|
+
} else if (!column) {
|
|
2991
|
+
let pos = this.fromOffset(line);
|
|
2992
|
+
line = pos.line;
|
|
2993
|
+
column = pos.col;
|
|
2915
2994
|
}
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2995
|
+
let origin = this.origin(line, column, endLine, endColumn);
|
|
2996
|
+
if (origin) {
|
|
2997
|
+
result2 = new CssSyntaxError$2(
|
|
2998
|
+
message,
|
|
2999
|
+
origin.endLine === void 0 ? origin.line : { column: origin.column, line: origin.line },
|
|
3000
|
+
origin.endLine === void 0 ? origin.column : { column: origin.endColumn, line: origin.endLine },
|
|
3001
|
+
origin.source,
|
|
3002
|
+
origin.file,
|
|
3003
|
+
opts.plugin
|
|
3004
|
+
);
|
|
2922
3005
|
} else {
|
|
2923
|
-
|
|
3006
|
+
result2 = new CssSyntaxError$2(
|
|
3007
|
+
message,
|
|
3008
|
+
endLine === void 0 ? line : { column, line },
|
|
3009
|
+
endLine === void 0 ? column : { column: endColumn, line: endLine },
|
|
3010
|
+
this.css,
|
|
3011
|
+
this.file,
|
|
3012
|
+
opts.plugin
|
|
3013
|
+
);
|
|
3014
|
+
}
|
|
3015
|
+
result2.input = { column, endColumn, endLine, line, source: this.css };
|
|
3016
|
+
if (this.file) {
|
|
3017
|
+
if (pathToFileURL$1) {
|
|
3018
|
+
result2.input.url = pathToFileURL$1(this.file).toString();
|
|
3019
|
+
}
|
|
3020
|
+
result2.input.file = this.file;
|
|
2924
3021
|
}
|
|
3022
|
+
return result2;
|
|
2925
3023
|
}
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
3024
|
+
fromOffset(offset) {
|
|
3025
|
+
let lastLine, lineToIndex;
|
|
3026
|
+
if (!this[fromOffsetCache]) {
|
|
3027
|
+
let lines = this.css.split("\n");
|
|
3028
|
+
lineToIndex = new Array(lines.length);
|
|
3029
|
+
let prevIndex = 0;
|
|
3030
|
+
for (let i = 0, l = lines.length; i < l; i++) {
|
|
3031
|
+
lineToIndex[i] = prevIndex;
|
|
3032
|
+
prevIndex += lines[i].length + 1;
|
|
3033
|
+
}
|
|
3034
|
+
this[fromOffsetCache] = lineToIndex;
|
|
2929
3035
|
} else {
|
|
2930
|
-
|
|
3036
|
+
lineToIndex = this[fromOffsetCache];
|
|
2931
3037
|
}
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
if (pathToFileURL) {
|
|
2937
|
-
let fileURL = pathToFileURL(path).toString();
|
|
2938
|
-
this.memoizedFileURLs.set(path, fileURL);
|
|
2939
|
-
return fileURL;
|
|
3038
|
+
lastLine = lineToIndex[lineToIndex.length - 1];
|
|
3039
|
+
let min = 0;
|
|
3040
|
+
if (offset >= lastLine) {
|
|
3041
|
+
min = lineToIndex.length - 1;
|
|
2940
3042
|
} else {
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
)
|
|
3043
|
+
let max = lineToIndex.length - 2;
|
|
3044
|
+
let mid;
|
|
3045
|
+
while (min < max) {
|
|
3046
|
+
mid = min + (max - min >> 1);
|
|
3047
|
+
if (offset < lineToIndex[mid]) {
|
|
3048
|
+
max = mid - 1;
|
|
3049
|
+
} else if (offset >= lineToIndex[mid + 1]) {
|
|
3050
|
+
min = mid + 1;
|
|
3051
|
+
} else {
|
|
3052
|
+
min = mid;
|
|
3053
|
+
break;
|
|
3054
|
+
}
|
|
3055
|
+
}
|
|
2944
3056
|
}
|
|
3057
|
+
return {
|
|
3058
|
+
col: offset - lineToIndex[min] + 1,
|
|
3059
|
+
line: min + 1
|
|
3060
|
+
};
|
|
2945
3061
|
}
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
if (sep === "\\") {
|
|
2950
|
-
path = path.replace(/\\/g, "/");
|
|
3062
|
+
mapResolve(file) {
|
|
3063
|
+
if (/^\w+:\/\//.test(file)) {
|
|
3064
|
+
return file;
|
|
2951
3065
|
}
|
|
2952
|
-
|
|
2953
|
-
this.memoizedURLs.set(path, url);
|
|
2954
|
-
return url;
|
|
2955
|
-
}
|
|
2956
|
-
};
|
|
2957
|
-
var mapGenerator = MapGenerator$2;
|
|
2958
|
-
let Node$2 = node;
|
|
2959
|
-
let Comment$4 = class Comment extends Node$2 {
|
|
2960
|
-
constructor(defaults) {
|
|
2961
|
-
super(defaults);
|
|
2962
|
-
this.type = "comment";
|
|
3066
|
+
return resolve$1(this.map.consumer().sourceRoot || this.map.root || ".", file);
|
|
2963
3067
|
}
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
let {
|
|
2968
|
-
|
|
2969
|
-
let
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
let Rule$4;
|
|
2973
|
-
let AtRule$4;
|
|
2974
|
-
let Root$6;
|
|
2975
|
-
function cleanSource(nodes) {
|
|
2976
|
-
return nodes.map((i) => {
|
|
2977
|
-
if (i.nodes) i.nodes = cleanSource(i.nodes);
|
|
2978
|
-
delete i.source;
|
|
2979
|
-
return i;
|
|
2980
|
-
});
|
|
2981
|
-
}
|
|
2982
|
-
function markDirtyUp(node2) {
|
|
2983
|
-
node2[isClean$1] = false;
|
|
2984
|
-
if (node2.proxyOf.nodes) {
|
|
2985
|
-
for (let i of node2.proxyOf.nodes) {
|
|
2986
|
-
markDirtyUp(i);
|
|
3068
|
+
origin(line, column, endLine, endColumn) {
|
|
3069
|
+
if (!this.map) return false;
|
|
3070
|
+
let consumer = this.map.consumer();
|
|
3071
|
+
let from = consumer.originalPositionFor({ column, line });
|
|
3072
|
+
if (!from.source) return false;
|
|
3073
|
+
let to;
|
|
3074
|
+
if (typeof endLine === "number") {
|
|
3075
|
+
to = consumer.originalPositionFor({ column: endColumn, line: endLine });
|
|
2987
3076
|
}
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
3077
|
+
let fromUrl;
|
|
3078
|
+
if (isAbsolute(from.source)) {
|
|
3079
|
+
fromUrl = pathToFileURL$1(from.source);
|
|
3080
|
+
} else {
|
|
3081
|
+
fromUrl = new URL(
|
|
3082
|
+
from.source,
|
|
3083
|
+
this.map.consumer().sourceRoot || pathToFileURL$1(this.map.mapFile)
|
|
3084
|
+
);
|
|
2995
3085
|
}
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3086
|
+
let result2 = {
|
|
3087
|
+
column: from.column,
|
|
3088
|
+
endColumn: to && to.column,
|
|
3089
|
+
endLine: to && to.line,
|
|
3090
|
+
line: from.line,
|
|
3091
|
+
url: fromUrl.toString()
|
|
3092
|
+
};
|
|
3093
|
+
if (fromUrl.protocol === "file:") {
|
|
3094
|
+
if (fileURLToPath) {
|
|
3095
|
+
result2.file = fileURLToPath(fromUrl);
|
|
3096
|
+
} else {
|
|
3097
|
+
throw new Error(`file: protocol is not available in this PostCSS build`);
|
|
3098
|
+
}
|
|
3003
3099
|
}
|
|
3100
|
+
let source = consumer.sourceContentFor(from.source);
|
|
3101
|
+
if (source) result2.source = source;
|
|
3102
|
+
return result2;
|
|
3004
3103
|
}
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
let
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
result2 = callback(this.proxyOf.nodes[index2], index2);
|
|
3012
|
-
if (result2 === false) break;
|
|
3013
|
-
this.indexes[iterator] += 1;
|
|
3104
|
+
toJSON() {
|
|
3105
|
+
let json = {};
|
|
3106
|
+
for (let name of ["hasBOM", "css", "file", "id"]) {
|
|
3107
|
+
if (this[name] != null) {
|
|
3108
|
+
json[name] = this[name];
|
|
3109
|
+
}
|
|
3014
3110
|
}
|
|
3015
|
-
|
|
3016
|
-
|
|
3111
|
+
if (this.map) {
|
|
3112
|
+
json.map = __spreadValues({}, this.map);
|
|
3113
|
+
if (json.map.consumerCache) {
|
|
3114
|
+
json.map.consumerCache = void 0;
|
|
3115
|
+
}
|
|
3116
|
+
}
|
|
3117
|
+
return json;
|
|
3017
3118
|
}
|
|
3018
|
-
|
|
3019
|
-
return this.
|
|
3119
|
+
get from() {
|
|
3120
|
+
return this.file || this.id;
|
|
3020
3121
|
}
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3122
|
+
};
|
|
3123
|
+
var input = Input$6;
|
|
3124
|
+
Input$6.default = Input$6;
|
|
3125
|
+
if (terminalHighlight && terminalHighlight.registerInput) {
|
|
3126
|
+
terminalHighlight.registerInput(Input$6);
|
|
3127
|
+
}
|
|
3128
|
+
let Container$5 = container;
|
|
3129
|
+
let LazyResult$3;
|
|
3130
|
+
let Processor$3;
|
|
3131
|
+
let Root$6 = class Root extends Container$5 {
|
|
3132
|
+
constructor(defaults) {
|
|
3133
|
+
super(defaults);
|
|
3134
|
+
this.type = "root";
|
|
3135
|
+
if (!this.nodes) this.nodes = [];
|
|
3028
3136
|
}
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
return node2[prop];
|
|
3036
|
-
} else if (prop === "each" || typeof prop === "string" && prop.startsWith("walk")) {
|
|
3037
|
-
return (...args) => {
|
|
3038
|
-
return node2[prop](
|
|
3039
|
-
...args.map((i) => {
|
|
3040
|
-
if (typeof i === "function") {
|
|
3041
|
-
return (child, index2) => i(child.toProxy(), index2);
|
|
3042
|
-
} else {
|
|
3043
|
-
return i;
|
|
3044
|
-
}
|
|
3045
|
-
})
|
|
3046
|
-
);
|
|
3047
|
-
};
|
|
3048
|
-
} else if (prop === "every" || prop === "some") {
|
|
3049
|
-
return (cb) => {
|
|
3050
|
-
return node2[prop](
|
|
3051
|
-
(child, ...other) => cb(child.toProxy(), ...other)
|
|
3052
|
-
);
|
|
3053
|
-
};
|
|
3054
|
-
} else if (prop === "root") {
|
|
3055
|
-
return () => node2.root().toProxy();
|
|
3056
|
-
} else if (prop === "nodes") {
|
|
3057
|
-
return node2.nodes.map((i) => i.toProxy());
|
|
3058
|
-
} else if (prop === "first" || prop === "last") {
|
|
3059
|
-
return node2[prop].toProxy();
|
|
3137
|
+
normalize(child, sample, type) {
|
|
3138
|
+
let nodes = super.normalize(child);
|
|
3139
|
+
if (sample) {
|
|
3140
|
+
if (type === "prepend") {
|
|
3141
|
+
if (this.nodes.length > 1) {
|
|
3142
|
+
sample.raws.before = this.nodes[1].raws.before;
|
|
3060
3143
|
} else {
|
|
3061
|
-
|
|
3144
|
+
delete sample.raws.before;
|
|
3062
3145
|
}
|
|
3063
|
-
}
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
node2[prop] = value;
|
|
3067
|
-
if (prop === "name" || prop === "params" || prop === "selector") {
|
|
3068
|
-
node2.markDirty();
|
|
3146
|
+
} else if (this.first !== sample) {
|
|
3147
|
+
for (let node2 of nodes) {
|
|
3148
|
+
node2.raws.before = sample.raws.before;
|
|
3069
3149
|
}
|
|
3070
|
-
return true;
|
|
3071
|
-
}
|
|
3072
|
-
};
|
|
3073
|
-
}
|
|
3074
|
-
index(child) {
|
|
3075
|
-
if (typeof child === "number") return child;
|
|
3076
|
-
if (child.proxyOf) child = child.proxyOf;
|
|
3077
|
-
return this.proxyOf.nodes.indexOf(child);
|
|
3078
|
-
}
|
|
3079
|
-
insertAfter(exist, add) {
|
|
3080
|
-
let existIndex = this.index(exist);
|
|
3081
|
-
let nodes = this.normalize(add, this.proxyOf.nodes[existIndex]).reverse();
|
|
3082
|
-
existIndex = this.index(exist);
|
|
3083
|
-
for (let node2 of nodes) this.proxyOf.nodes.splice(existIndex + 1, 0, node2);
|
|
3084
|
-
let index2;
|
|
3085
|
-
for (let id in this.indexes) {
|
|
3086
|
-
index2 = this.indexes[id];
|
|
3087
|
-
if (existIndex < index2) {
|
|
3088
|
-
this.indexes[id] = index2 + nodes.length;
|
|
3089
3150
|
}
|
|
3090
3151
|
}
|
|
3091
|
-
|
|
3092
|
-
return this;
|
|
3152
|
+
return nodes;
|
|
3093
3153
|
}
|
|
3094
|
-
|
|
3095
|
-
let
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
existIndex = this.index(exist);
|
|
3099
|
-
for (let node2 of nodes) this.proxyOf.nodes.splice(existIndex, 0, node2);
|
|
3100
|
-
let index2;
|
|
3101
|
-
for (let id in this.indexes) {
|
|
3102
|
-
index2 = this.indexes[id];
|
|
3103
|
-
if (existIndex <= index2) {
|
|
3104
|
-
this.indexes[id] = index2 + nodes.length;
|
|
3105
|
-
}
|
|
3154
|
+
removeChild(child, ignore) {
|
|
3155
|
+
let index2 = this.index(child);
|
|
3156
|
+
if (!ignore && index2 === 0 && this.nodes.length > 1) {
|
|
3157
|
+
this.nodes[1].raws.before = this.nodes[index2].raws.before;
|
|
3106
3158
|
}
|
|
3107
|
-
|
|
3108
|
-
return this;
|
|
3159
|
+
return super.removeChild(child);
|
|
3109
3160
|
}
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
if (typeof i.raws.before === "undefined") {
|
|
3149
|
-
if (sample && typeof sample.raws.before !== "undefined") {
|
|
3150
|
-
i.raws.before = sample.raws.before.replace(/\S/g, "");
|
|
3161
|
+
toResult(opts = {}) {
|
|
3162
|
+
let lazy = new LazyResult$3(new Processor$3(), this, opts);
|
|
3163
|
+
return lazy.stringify();
|
|
3164
|
+
}
|
|
3165
|
+
};
|
|
3166
|
+
Root$6.registerLazyResult = (dependant) => {
|
|
3167
|
+
LazyResult$3 = dependant;
|
|
3168
|
+
};
|
|
3169
|
+
Root$6.registerProcessor = (dependant) => {
|
|
3170
|
+
Processor$3 = dependant;
|
|
3171
|
+
};
|
|
3172
|
+
var root$1 = Root$6;
|
|
3173
|
+
Root$6.default = Root$6;
|
|
3174
|
+
Container$5.registerRoot(Root$6);
|
|
3175
|
+
let list$3 = {
|
|
3176
|
+
comma(string) {
|
|
3177
|
+
return list$3.split(string, [","], true);
|
|
3178
|
+
},
|
|
3179
|
+
space(string) {
|
|
3180
|
+
let spaces = [" ", "\n", " "];
|
|
3181
|
+
return list$3.split(string, spaces);
|
|
3182
|
+
},
|
|
3183
|
+
split(string, separators, last) {
|
|
3184
|
+
let array = [];
|
|
3185
|
+
let current = "";
|
|
3186
|
+
let split = false;
|
|
3187
|
+
let func = 0;
|
|
3188
|
+
let inQuote = false;
|
|
3189
|
+
let prevQuote = "";
|
|
3190
|
+
let escape = false;
|
|
3191
|
+
for (let letter of string) {
|
|
3192
|
+
if (escape) {
|
|
3193
|
+
escape = false;
|
|
3194
|
+
} else if (letter === "\\") {
|
|
3195
|
+
escape = true;
|
|
3196
|
+
} else if (inQuote) {
|
|
3197
|
+
if (letter === prevQuote) {
|
|
3198
|
+
inQuote = false;
|
|
3151
3199
|
}
|
|
3200
|
+
} else if (letter === '"' || letter === "'") {
|
|
3201
|
+
inQuote = true;
|
|
3202
|
+
prevQuote = letter;
|
|
3203
|
+
} else if (letter === "(") {
|
|
3204
|
+
func += 1;
|
|
3205
|
+
} else if (letter === ")") {
|
|
3206
|
+
if (func > 0) func -= 1;
|
|
3207
|
+
} else if (func === 0) {
|
|
3208
|
+
if (separators.includes(letter)) split = true;
|
|
3152
3209
|
}
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
children = children.reverse();
|
|
3160
|
-
for (let child of children) {
|
|
3161
|
-
let nodes = this.normalize(child, this.first, "prepend").reverse();
|
|
3162
|
-
for (let node2 of nodes) this.proxyOf.nodes.unshift(node2);
|
|
3163
|
-
for (let id in this.indexes) {
|
|
3164
|
-
this.indexes[id] = this.indexes[id] + nodes.length;
|
|
3210
|
+
if (split) {
|
|
3211
|
+
if (current !== "") array.push(current.trim());
|
|
3212
|
+
current = "";
|
|
3213
|
+
split = false;
|
|
3214
|
+
} else {
|
|
3215
|
+
current += letter;
|
|
3165
3216
|
}
|
|
3166
3217
|
}
|
|
3167
|
-
|
|
3168
|
-
return
|
|
3218
|
+
if (last || current !== "") array.push(current.trim());
|
|
3219
|
+
return array;
|
|
3169
3220
|
}
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3221
|
+
};
|
|
3222
|
+
var list_1 = list$3;
|
|
3223
|
+
list$3.default = list$3;
|
|
3224
|
+
let Container$4 = container;
|
|
3225
|
+
let list$2 = list_1;
|
|
3226
|
+
let Rule$4 = class Rule extends Container$4 {
|
|
3227
|
+
constructor(defaults) {
|
|
3228
|
+
super(defaults);
|
|
3229
|
+
this.type = "rule";
|
|
3230
|
+
if (!this.nodes) this.nodes = [];
|
|
3174
3231
|
}
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
this.proxyOf.nodes = [];
|
|
3178
|
-
this.markDirty();
|
|
3179
|
-
return this;
|
|
3232
|
+
get selectors() {
|
|
3233
|
+
return list$2.comma(this.selector);
|
|
3180
3234
|
}
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
this.
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3235
|
+
set selectors(values) {
|
|
3236
|
+
let match = this.selector ? this.selector.match(/,\s*/) : null;
|
|
3237
|
+
let sep2 = match ? match[0] : "," + this.raw("between", "beforeOpen");
|
|
3238
|
+
this.selector = values.join(sep2);
|
|
3239
|
+
}
|
|
3240
|
+
};
|
|
3241
|
+
var rule$1 = Rule$4;
|
|
3242
|
+
Rule$4.default = Rule$4;
|
|
3243
|
+
Container$4.registerRule(Rule$4);
|
|
3244
|
+
let AtRule$3 = atRule$1;
|
|
3245
|
+
let Comment$4 = comment$1;
|
|
3246
|
+
let Declaration$3 = declaration;
|
|
3247
|
+
let Input$5 = input;
|
|
3248
|
+
let PreviousMap2 = previousMap;
|
|
3249
|
+
let Root$5 = root$1;
|
|
3250
|
+
let Rule$3 = rule$1;
|
|
3251
|
+
function fromJSON$2(json, inputs) {
|
|
3252
|
+
if (Array.isArray(json)) return json.map((n) => fromJSON$2(n));
|
|
3253
|
+
let _a = json, { inputs: ownInputs } = _a, defaults = __objRest(_a, ["inputs"]);
|
|
3254
|
+
if (ownInputs) {
|
|
3255
|
+
inputs = [];
|
|
3256
|
+
for (let input2 of ownInputs) {
|
|
3257
|
+
let inputHydrated = __spreadProps(__spreadValues({}, input2), { __proto__: Input$5.prototype });
|
|
3258
|
+
if (inputHydrated.map) {
|
|
3259
|
+
inputHydrated.map = __spreadProps(__spreadValues({}, inputHydrated.map), {
|
|
3260
|
+
__proto__: PreviousMap2.prototype
|
|
3261
|
+
});
|
|
3190
3262
|
}
|
|
3263
|
+
inputs.push(inputHydrated);
|
|
3191
3264
|
}
|
|
3192
|
-
this.markDirty();
|
|
3193
|
-
return this;
|
|
3194
3265
|
}
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3266
|
+
if (defaults.nodes) {
|
|
3267
|
+
defaults.nodes = json.nodes.map((n) => fromJSON$2(n, inputs));
|
|
3268
|
+
}
|
|
3269
|
+
if (defaults.source) {
|
|
3270
|
+
let _b = defaults.source, { inputId } = _b, source = __objRest(_b, ["inputId"]);
|
|
3271
|
+
defaults.source = source;
|
|
3272
|
+
if (inputId != null) {
|
|
3273
|
+
defaults.source.input = inputs[inputId];
|
|
3199
3274
|
}
|
|
3200
|
-
this.walkDecls((decl) => {
|
|
3201
|
-
if (opts.props && !opts.props.includes(decl.prop)) return;
|
|
3202
|
-
if (opts.fast && !decl.value.includes(opts.fast)) return;
|
|
3203
|
-
decl.value = decl.value.replace(pattern, callback);
|
|
3204
|
-
});
|
|
3205
|
-
this.markDirty();
|
|
3206
|
-
return this;
|
|
3207
3275
|
}
|
|
3208
|
-
|
|
3209
|
-
return
|
|
3276
|
+
if (defaults.type === "root") {
|
|
3277
|
+
return new Root$5(defaults);
|
|
3278
|
+
} else if (defaults.type === "decl") {
|
|
3279
|
+
return new Declaration$3(defaults);
|
|
3280
|
+
} else if (defaults.type === "rule") {
|
|
3281
|
+
return new Rule$3(defaults);
|
|
3282
|
+
} else if (defaults.type === "comment") {
|
|
3283
|
+
return new Comment$4(defaults);
|
|
3284
|
+
} else if (defaults.type === "atrule") {
|
|
3285
|
+
return new AtRule$3(defaults);
|
|
3286
|
+
} else {
|
|
3287
|
+
throw new Error("Unknown node type: " + json.type);
|
|
3210
3288
|
}
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3289
|
+
}
|
|
3290
|
+
var fromJSON_1 = fromJSON$2;
|
|
3291
|
+
fromJSON$2.default = fromJSON$2;
|
|
3292
|
+
let { dirname, relative, resolve, sep } = require$$2;
|
|
3293
|
+
let { SourceMapConsumer, SourceMapGenerator } = require$$2;
|
|
3294
|
+
let { pathToFileURL } = require$$2;
|
|
3295
|
+
let Input$4 = input;
|
|
3296
|
+
let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);
|
|
3297
|
+
let pathAvailable = Boolean(dirname && resolve && relative && sep);
|
|
3298
|
+
let MapGenerator$2 = class MapGenerator {
|
|
3299
|
+
constructor(stringify2, root2, opts, cssString) {
|
|
3300
|
+
this.stringify = stringify2;
|
|
3301
|
+
this.mapOpts = opts.map || {};
|
|
3302
|
+
this.root = root2;
|
|
3303
|
+
this.opts = opts;
|
|
3304
|
+
this.css = cssString;
|
|
3305
|
+
this.originalCSS = cssString;
|
|
3306
|
+
this.usesFileUrls = !this.mapOpts.from && this.mapOpts.absolute;
|
|
3307
|
+
this.memoizedFileURLs = /* @__PURE__ */ new Map();
|
|
3308
|
+
this.memoizedPaths = /* @__PURE__ */ new Map();
|
|
3309
|
+
this.memoizedURLs = /* @__PURE__ */ new Map();
|
|
3310
|
+
}
|
|
3311
|
+
addAnnotation() {
|
|
3312
|
+
let content;
|
|
3313
|
+
if (this.isInline()) {
|
|
3314
|
+
content = "data:application/json;base64," + this.toBase64(this.map.toString());
|
|
3315
|
+
} else if (typeof this.mapOpts.annotation === "string") {
|
|
3316
|
+
content = this.mapOpts.annotation;
|
|
3317
|
+
} else if (typeof this.mapOpts.annotation === "function") {
|
|
3318
|
+
content = this.mapOpts.annotation(this.opts.to, this.root);
|
|
3319
|
+
} else {
|
|
3320
|
+
content = this.outputFile() + ".map";
|
|
3321
|
+
}
|
|
3322
|
+
let eol = "\n";
|
|
3323
|
+
if (this.css.includes("\r\n")) eol = "\r\n";
|
|
3324
|
+
this.css += eol + "/*# sourceMappingURL=" + content + " */";
|
|
3325
|
+
}
|
|
3326
|
+
applyPrevMaps() {
|
|
3327
|
+
for (let prev of this.previous()) {
|
|
3328
|
+
let from = this.toUrl(this.path(prev.file));
|
|
3329
|
+
let root2 = prev.root || dirname(prev.file);
|
|
3330
|
+
let map;
|
|
3331
|
+
if (this.mapOpts.sourcesContent === false) {
|
|
3332
|
+
map = new SourceMapConsumer(prev.text);
|
|
3333
|
+
if (map.sourcesContent) {
|
|
3334
|
+
map.sourcesContent = null;
|
|
3335
|
+
}
|
|
3336
|
+
} else {
|
|
3337
|
+
map = prev.consumer();
|
|
3221
3338
|
}
|
|
3222
|
-
|
|
3223
|
-
}
|
|
3339
|
+
this.map.applySourceMap(map, from, this.toUrl(this.path(root2)));
|
|
3340
|
+
}
|
|
3224
3341
|
}
|
|
3225
|
-
|
|
3226
|
-
if (
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3342
|
+
clearAnnotation() {
|
|
3343
|
+
if (this.mapOpts.annotation === false) return;
|
|
3344
|
+
if (this.root) {
|
|
3345
|
+
let node2;
|
|
3346
|
+
for (let i = this.root.nodes.length - 1; i >= 0; i--) {
|
|
3347
|
+
node2 = this.root.nodes[i];
|
|
3348
|
+
if (node2.type !== "comment") continue;
|
|
3349
|
+
if (node2.text.startsWith("# sourceMappingURL=")) {
|
|
3350
|
+
this.root.removeChild(i);
|
|
3231
3351
|
}
|
|
3232
|
-
}
|
|
3352
|
+
}
|
|
3353
|
+
} else if (this.css) {
|
|
3354
|
+
this.css = this.css.replace(/\n*\/\*#[\S\s]*?\*\/$/gm, "");
|
|
3233
3355
|
}
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3356
|
+
}
|
|
3357
|
+
generate() {
|
|
3358
|
+
this.clearAnnotation();
|
|
3359
|
+
if (pathAvailable && sourceMapAvailable && this.isMap()) {
|
|
3360
|
+
return this.generateMap();
|
|
3361
|
+
} else {
|
|
3362
|
+
let result2 = "";
|
|
3363
|
+
this.stringify(this.root, (i) => {
|
|
3364
|
+
result2 += i;
|
|
3239
3365
|
});
|
|
3366
|
+
return [result2];
|
|
3240
3367
|
}
|
|
3241
|
-
return this.walk((child, i) => {
|
|
3242
|
-
if (child.type === "atrule" && child.name === name) {
|
|
3243
|
-
return callback(child, i);
|
|
3244
|
-
}
|
|
3245
|
-
});
|
|
3246
|
-
}
|
|
3247
|
-
walkComments(callback) {
|
|
3248
|
-
return this.walk((child, i) => {
|
|
3249
|
-
if (child.type === "comment") {
|
|
3250
|
-
return callback(child, i);
|
|
3251
|
-
}
|
|
3252
|
-
});
|
|
3253
3368
|
}
|
|
3254
|
-
|
|
3255
|
-
if (
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3369
|
+
generateMap() {
|
|
3370
|
+
if (this.root) {
|
|
3371
|
+
this.generateString();
|
|
3372
|
+
} else if (this.previous().length === 1) {
|
|
3373
|
+
let prev = this.previous()[0].consumer();
|
|
3374
|
+
prev.file = this.outputFile();
|
|
3375
|
+
this.map = SourceMapGenerator.fromSourceMap(prev, {
|
|
3376
|
+
ignoreInvalidMapping: true
|
|
3261
3377
|
});
|
|
3262
|
-
}
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3378
|
+
} else {
|
|
3379
|
+
this.map = new SourceMapGenerator({
|
|
3380
|
+
file: this.outputFile(),
|
|
3381
|
+
ignoreInvalidMapping: true
|
|
3382
|
+
});
|
|
3383
|
+
this.map.addMapping({
|
|
3384
|
+
generated: { column: 0, line: 1 },
|
|
3385
|
+
original: { column: 0, line: 1 },
|
|
3386
|
+
source: this.opts.from ? this.toUrl(this.path(this.opts.from)) : "<no source>"
|
|
3268
3387
|
});
|
|
3269
3388
|
}
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3389
|
+
if (this.isSourcesContent()) this.setSourcesContent();
|
|
3390
|
+
if (this.root && this.previous().length > 0) this.applyPrevMaps();
|
|
3391
|
+
if (this.isAnnotation()) this.addAnnotation();
|
|
3392
|
+
if (this.isInline()) {
|
|
3393
|
+
return [this.css];
|
|
3394
|
+
} else {
|
|
3395
|
+
return [this.css, this.map];
|
|
3396
|
+
}
|
|
3275
3397
|
}
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3398
|
+
generateString() {
|
|
3399
|
+
this.css = "";
|
|
3400
|
+
this.map = new SourceMapGenerator({
|
|
3401
|
+
file: this.outputFile(),
|
|
3402
|
+
ignoreInvalidMapping: true
|
|
3403
|
+
});
|
|
3404
|
+
let line = 1;
|
|
3405
|
+
let column = 1;
|
|
3406
|
+
let noSource = "<no source>";
|
|
3407
|
+
let mapping = {
|
|
3408
|
+
generated: { column: 0, line: 0 },
|
|
3409
|
+
original: { column: 0, line: 0 },
|
|
3410
|
+
source: ""
|
|
3411
|
+
};
|
|
3412
|
+
let last, lines;
|
|
3413
|
+
this.stringify(this.root, (str, node2, type) => {
|
|
3414
|
+
this.css += str;
|
|
3415
|
+
if (node2 && type !== "end") {
|
|
3416
|
+
mapping.generated.line = line;
|
|
3417
|
+
mapping.generated.column = column - 1;
|
|
3418
|
+
if (node2.source && node2.source.start) {
|
|
3419
|
+
mapping.source = this.sourcePath(node2);
|
|
3420
|
+
mapping.original.line = node2.source.start.line;
|
|
3421
|
+
mapping.original.column = node2.source.start.column - 1;
|
|
3422
|
+
this.map.addMapping(mapping);
|
|
3423
|
+
} else {
|
|
3424
|
+
mapping.source = noSource;
|
|
3425
|
+
mapping.original.line = 1;
|
|
3426
|
+
mapping.original.column = 0;
|
|
3427
|
+
this.map.addMapping(mapping);
|
|
3282
3428
|
}
|
|
3283
|
-
}
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3429
|
+
}
|
|
3430
|
+
lines = str.match(/\n/g);
|
|
3431
|
+
if (lines) {
|
|
3432
|
+
line += lines.length;
|
|
3433
|
+
last = str.lastIndexOf("\n");
|
|
3434
|
+
column = str.length - last;
|
|
3435
|
+
} else {
|
|
3436
|
+
column += str.length;
|
|
3437
|
+
}
|
|
3438
|
+
if (node2 && type !== "start") {
|
|
3439
|
+
let p = node2.parent || { raws: {} };
|
|
3440
|
+
let childless = node2.type === "decl" || node2.type === "atrule" && !node2.nodes;
|
|
3441
|
+
if (!childless || node2 !== p.last || p.raws.semicolon) {
|
|
3442
|
+
if (node2.source && node2.source.end) {
|
|
3443
|
+
mapping.source = this.sourcePath(node2);
|
|
3444
|
+
mapping.original.line = node2.source.end.line;
|
|
3445
|
+
mapping.original.column = node2.source.end.column - 1;
|
|
3446
|
+
mapping.generated.line = line;
|
|
3447
|
+
mapping.generated.column = column - 2;
|
|
3448
|
+
this.map.addMapping(mapping);
|
|
3449
|
+
} else {
|
|
3450
|
+
mapping.source = noSource;
|
|
3451
|
+
mapping.original.line = 1;
|
|
3452
|
+
mapping.original.column = 0;
|
|
3453
|
+
mapping.generated.line = line;
|
|
3454
|
+
mapping.generated.column = column - 1;
|
|
3455
|
+
this.map.addMapping(mapping);
|
|
3456
|
+
}
|
|
3289
3457
|
}
|
|
3290
|
-
});
|
|
3291
|
-
}
|
|
3292
|
-
return this.walk((child, i) => {
|
|
3293
|
-
if (child.type === "rule" && child.selector === selector) {
|
|
3294
|
-
return callback(child, i);
|
|
3295
3458
|
}
|
|
3296
3459
|
});
|
|
3297
3460
|
}
|
|
3298
|
-
|
|
3299
|
-
if (
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
Container$7.registerParse = (dependant) => {
|
|
3308
|
-
parse$4 = dependant;
|
|
3309
|
-
};
|
|
3310
|
-
Container$7.registerRule = (dependant) => {
|
|
3311
|
-
Rule$4 = dependant;
|
|
3312
|
-
};
|
|
3313
|
-
Container$7.registerAtRule = (dependant) => {
|
|
3314
|
-
AtRule$4 = dependant;
|
|
3315
|
-
};
|
|
3316
|
-
Container$7.registerRoot = (dependant) => {
|
|
3317
|
-
Root$6 = dependant;
|
|
3318
|
-
};
|
|
3319
|
-
var container = Container$7;
|
|
3320
|
-
Container$7.default = Container$7;
|
|
3321
|
-
Container$7.rebuild = (node2) => {
|
|
3322
|
-
if (node2.type === "atrule") {
|
|
3323
|
-
Object.setPrototypeOf(node2, AtRule$4.prototype);
|
|
3324
|
-
} else if (node2.type === "rule") {
|
|
3325
|
-
Object.setPrototypeOf(node2, Rule$4.prototype);
|
|
3326
|
-
} else if (node2.type === "decl") {
|
|
3327
|
-
Object.setPrototypeOf(node2, Declaration$3.prototype);
|
|
3328
|
-
} else if (node2.type === "comment") {
|
|
3329
|
-
Object.setPrototypeOf(node2, Comment$3.prototype);
|
|
3330
|
-
} else if (node2.type === "root") {
|
|
3331
|
-
Object.setPrototypeOf(node2, Root$6.prototype);
|
|
3332
|
-
}
|
|
3333
|
-
node2[my$1] = true;
|
|
3334
|
-
if (node2.nodes) {
|
|
3335
|
-
node2.nodes.forEach((child) => {
|
|
3336
|
-
Container$7.rebuild(child);
|
|
3337
|
-
});
|
|
3338
|
-
}
|
|
3339
|
-
};
|
|
3340
|
-
let Container$6 = container;
|
|
3341
|
-
let LazyResult$4;
|
|
3342
|
-
let Processor$3;
|
|
3343
|
-
let Document$3 = class Document extends Container$6 {
|
|
3344
|
-
constructor(defaults) {
|
|
3345
|
-
super(__spreadValues({ type: "document" }, defaults));
|
|
3346
|
-
if (!this.nodes) {
|
|
3347
|
-
this.nodes = [];
|
|
3461
|
+
isAnnotation() {
|
|
3462
|
+
if (this.isInline()) {
|
|
3463
|
+
return true;
|
|
3464
|
+
}
|
|
3465
|
+
if (typeof this.mapOpts.annotation !== "undefined") {
|
|
3466
|
+
return this.mapOpts.annotation;
|
|
3467
|
+
}
|
|
3468
|
+
if (this.previous().length) {
|
|
3469
|
+
return this.previous().some((i) => i.annotation);
|
|
3348
3470
|
}
|
|
3471
|
+
return true;
|
|
3349
3472
|
}
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3473
|
+
isInline() {
|
|
3474
|
+
if (typeof this.mapOpts.inline !== "undefined") {
|
|
3475
|
+
return this.mapOpts.inline;
|
|
3476
|
+
}
|
|
3477
|
+
let annotation = this.mapOpts.annotation;
|
|
3478
|
+
if (typeof annotation !== "undefined" && annotation !== true) {
|
|
3479
|
+
return false;
|
|
3480
|
+
}
|
|
3481
|
+
if (this.previous().length) {
|
|
3482
|
+
return this.previous().some((i) => i.inline);
|
|
3483
|
+
}
|
|
3484
|
+
return true;
|
|
3353
3485
|
}
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
}
|
|
3358
|
-
|
|
3359
|
-
Processor$3 = dependant;
|
|
3360
|
-
};
|
|
3361
|
-
var document$1 = Document$3;
|
|
3362
|
-
Document$3.default = Document$3;
|
|
3363
|
-
let printed = {};
|
|
3364
|
-
var warnOnce$2 = function warnOnce(message) {
|
|
3365
|
-
if (printed[message]) return;
|
|
3366
|
-
printed[message] = true;
|
|
3367
|
-
if (typeof console !== "undefined" && console.warn) {
|
|
3368
|
-
console.warn(message);
|
|
3486
|
+
isMap() {
|
|
3487
|
+
if (typeof this.opts.map !== "undefined") {
|
|
3488
|
+
return !!this.opts.map;
|
|
3489
|
+
}
|
|
3490
|
+
return this.previous().length > 0;
|
|
3369
3491
|
}
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
this.
|
|
3375
|
-
|
|
3376
|
-
let range = opts.node.rangeBy(opts);
|
|
3377
|
-
this.line = range.start.line;
|
|
3378
|
-
this.column = range.start.column;
|
|
3379
|
-
this.endLine = range.end.line;
|
|
3380
|
-
this.endColumn = range.end.column;
|
|
3492
|
+
isSourcesContent() {
|
|
3493
|
+
if (typeof this.mapOpts.sourcesContent !== "undefined") {
|
|
3494
|
+
return this.mapOpts.sourcesContent;
|
|
3495
|
+
}
|
|
3496
|
+
if (this.previous().length) {
|
|
3497
|
+
return this.previous().some((i) => i.withContent());
|
|
3381
3498
|
}
|
|
3382
|
-
|
|
3499
|
+
return true;
|
|
3383
3500
|
}
|
|
3384
|
-
|
|
3385
|
-
if (this.
|
|
3386
|
-
return this.
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3501
|
+
outputFile() {
|
|
3502
|
+
if (this.opts.to) {
|
|
3503
|
+
return this.path(this.opts.to);
|
|
3504
|
+
} else if (this.opts.from) {
|
|
3505
|
+
return this.path(this.opts.from);
|
|
3506
|
+
} else {
|
|
3507
|
+
return "to.css";
|
|
3391
3508
|
}
|
|
3392
|
-
|
|
3393
|
-
|
|
3509
|
+
}
|
|
3510
|
+
path(file) {
|
|
3511
|
+
if (this.mapOpts.absolute) return file;
|
|
3512
|
+
if (file.charCodeAt(0) === 60) return file;
|
|
3513
|
+
if (/^\w+:\/\//.test(file)) return file;
|
|
3514
|
+
let cached = this.memoizedPaths.get(file);
|
|
3515
|
+
if (cached) return cached;
|
|
3516
|
+
let from = this.opts.to ? dirname(this.opts.to) : ".";
|
|
3517
|
+
if (typeof this.mapOpts.annotation === "string") {
|
|
3518
|
+
from = dirname(resolve(from, this.mapOpts.annotation));
|
|
3394
3519
|
}
|
|
3395
|
-
|
|
3520
|
+
let path = relative(from, file);
|
|
3521
|
+
this.memoizedPaths.set(file, path);
|
|
3522
|
+
return path;
|
|
3396
3523
|
}
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3524
|
+
previous() {
|
|
3525
|
+
if (!this.previousMaps) {
|
|
3526
|
+
this.previousMaps = [];
|
|
3527
|
+
if (this.root) {
|
|
3528
|
+
this.root.walk((node2) => {
|
|
3529
|
+
if (node2.source && node2.source.input.map) {
|
|
3530
|
+
let map = node2.source.input.map;
|
|
3531
|
+
if (!this.previousMaps.includes(map)) {
|
|
3532
|
+
this.previousMaps.push(map);
|
|
3533
|
+
}
|
|
3534
|
+
}
|
|
3535
|
+
});
|
|
3536
|
+
} else {
|
|
3537
|
+
let input2 = new Input$4(this.originalCSS, this.opts);
|
|
3538
|
+
if (input2.map) this.previousMaps.push(input2.map);
|
|
3539
|
+
}
|
|
3540
|
+
}
|
|
3541
|
+
return this.previousMaps;
|
|
3409
3542
|
}
|
|
3410
|
-
|
|
3411
|
-
|
|
3543
|
+
setSourcesContent() {
|
|
3544
|
+
let already = {};
|
|
3545
|
+
if (this.root) {
|
|
3546
|
+
this.root.walk((node2) => {
|
|
3547
|
+
if (node2.source) {
|
|
3548
|
+
let from = node2.source.input.from;
|
|
3549
|
+
if (from && !already[from]) {
|
|
3550
|
+
already[from] = true;
|
|
3551
|
+
let fromUrl = this.usesFileUrls ? this.toFileUrl(from) : this.toUrl(this.path(from));
|
|
3552
|
+
this.map.setSourceContent(fromUrl, node2.source.input.css);
|
|
3553
|
+
}
|
|
3554
|
+
}
|
|
3555
|
+
});
|
|
3556
|
+
} else if (this.css) {
|
|
3557
|
+
let from = this.opts.from ? this.toUrl(this.path(this.opts.from)) : "<no source>";
|
|
3558
|
+
this.map.setSourceContent(from, this.css);
|
|
3559
|
+
}
|
|
3412
3560
|
}
|
|
3413
|
-
|
|
3414
|
-
if (
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3561
|
+
sourcePath(node2) {
|
|
3562
|
+
if (this.mapOpts.from) {
|
|
3563
|
+
return this.toUrl(this.mapOpts.from);
|
|
3564
|
+
} else if (this.usesFileUrls) {
|
|
3565
|
+
return this.toFileUrl(node2.source.input.from);
|
|
3566
|
+
} else {
|
|
3567
|
+
return this.toUrl(this.path(node2.source.input.from));
|
|
3418
3568
|
}
|
|
3419
|
-
let warning2 = new Warning$1(text, opts);
|
|
3420
|
-
this.messages.push(warning2);
|
|
3421
|
-
return warning2;
|
|
3422
3569
|
}
|
|
3423
|
-
|
|
3424
|
-
|
|
3570
|
+
toBase64(str) {
|
|
3571
|
+
if (Buffer) {
|
|
3572
|
+
return Buffer.from(str).toString("base64");
|
|
3573
|
+
} else {
|
|
3574
|
+
return window.btoa(unescape(encodeURIComponent(str)));
|
|
3575
|
+
}
|
|
3425
3576
|
}
|
|
3426
|
-
|
|
3427
|
-
|
|
3577
|
+
toFileUrl(path) {
|
|
3578
|
+
let cached = this.memoizedFileURLs.get(path);
|
|
3579
|
+
if (cached) return cached;
|
|
3580
|
+
if (pathToFileURL) {
|
|
3581
|
+
let fileURL = pathToFileURL(path).toString();
|
|
3582
|
+
this.memoizedFileURLs.set(path, fileURL);
|
|
3583
|
+
return fileURL;
|
|
3584
|
+
} else {
|
|
3585
|
+
throw new Error(
|
|
3586
|
+
"`map.absolute` option is not available in this PostCSS build"
|
|
3587
|
+
);
|
|
3588
|
+
}
|
|
3589
|
+
}
|
|
3590
|
+
toUrl(path) {
|
|
3591
|
+
let cached = this.memoizedURLs.get(path);
|
|
3592
|
+
if (cached) return cached;
|
|
3593
|
+
if (sep === "\\") {
|
|
3594
|
+
path = path.replace(/\\/g, "/");
|
|
3595
|
+
}
|
|
3596
|
+
let url = encodeURI(path).replace(/[#?]/g, encodeURIComponent);
|
|
3597
|
+
this.memoizedURLs.set(path, url);
|
|
3598
|
+
return url;
|
|
3428
3599
|
}
|
|
3429
3600
|
};
|
|
3430
|
-
var
|
|
3431
|
-
Result$3.default = Result$3;
|
|
3601
|
+
var mapGenerator = MapGenerator$2;
|
|
3432
3602
|
const SINGLE_QUOTE = "'".charCodeAt(0);
|
|
3433
3603
|
const DOUBLE_QUOTE = '"'.charCodeAt(0);
|
|
3434
3604
|
const BACKSLASH = "\\".charCodeAt(0);
|
|
@@ -3455,8 +3625,8 @@ const RE_HEX_ESCAPE = /[\da-f]/i;
|
|
|
3455
3625
|
var tokenize = function tokenizer(input2, options = {}) {
|
|
3456
3626
|
let css = input2.css.valueOf();
|
|
3457
3627
|
let ignore = options.ignoreErrors;
|
|
3458
|
-
let code,
|
|
3459
|
-
let escaped, escapePos,
|
|
3628
|
+
let code, content, escape, next, quote;
|
|
3629
|
+
let currentToken, escaped, escapePos, n, prev;
|
|
3460
3630
|
let length = css.length;
|
|
3461
3631
|
let pos = 0;
|
|
3462
3632
|
let buffer = [];
|
|
@@ -3578,205 +3748,71 @@ var tokenize = function tokenizer(input2, options = {}) {
|
|
|
3578
3748
|
next = pos;
|
|
3579
3749
|
escape = true;
|
|
3580
3750
|
while (css.charCodeAt(next + 1) === BACKSLASH) {
|
|
3581
|
-
next += 1;
|
|
3582
|
-
escape = !escape;
|
|
3583
|
-
}
|
|
3584
|
-
code = css.charCodeAt(next + 1);
|
|
3585
|
-
if (escape && code !== SLASH && code !== SPACE && code !== NEWLINE && code !== TAB && code !== CR && code !== FEED) {
|
|
3586
|
-
next += 1;
|
|
3587
|
-
if (RE_HEX_ESCAPE.test(css.charAt(next))) {
|
|
3588
|
-
while (RE_HEX_ESCAPE.test(css.charAt(next + 1))) {
|
|
3589
|
-
next += 1;
|
|
3590
|
-
}
|
|
3591
|
-
if (css.charCodeAt(next + 1) === SPACE) {
|
|
3592
|
-
next += 1;
|
|
3593
|
-
}
|
|
3594
|
-
}
|
|
3595
|
-
}
|
|
3596
|
-
currentToken = ["word", css.slice(pos, next + 1), pos, next];
|
|
3597
|
-
pos = next;
|
|
3598
|
-
break;
|
|
3599
|
-
}
|
|
3600
|
-
default: {
|
|
3601
|
-
if (code === SLASH && css.charCodeAt(pos + 1) === ASTERISK) {
|
|
3602
|
-
next = css.indexOf("*/", pos + 2) + 1;
|
|
3603
|
-
if (next === 0) {
|
|
3604
|
-
if (ignore || ignoreUnclosed) {
|
|
3605
|
-
next = css.length;
|
|
3606
|
-
} else {
|
|
3607
|
-
unclosed("comment");
|
|
3608
|
-
}
|
|
3609
|
-
}
|
|
3610
|
-
currentToken = ["comment", css.slice(pos, next + 1), pos, next];
|
|
3611
|
-
pos = next;
|
|
3612
|
-
} else {
|
|
3613
|
-
RE_WORD_END.lastIndex = pos + 1;
|
|
3614
|
-
RE_WORD_END.test(css);
|
|
3615
|
-
if (RE_WORD_END.lastIndex === 0) {
|
|
3616
|
-
next = css.length - 1;
|
|
3617
|
-
} else {
|
|
3618
|
-
next = RE_WORD_END.lastIndex - 2;
|
|
3619
|
-
}
|
|
3620
|
-
currentToken = ["word", css.slice(pos, next + 1), pos, next];
|
|
3621
|
-
buffer.push(currentToken);
|
|
3622
|
-
pos = next;
|
|
3623
|
-
}
|
|
3624
|
-
break;
|
|
3625
|
-
}
|
|
3626
|
-
}
|
|
3627
|
-
pos++;
|
|
3628
|
-
return currentToken;
|
|
3629
|
-
}
|
|
3630
|
-
function back(token) {
|
|
3631
|
-
returned.push(token);
|
|
3632
|
-
}
|
|
3633
|
-
return {
|
|
3634
|
-
back,
|
|
3635
|
-
endOfFile,
|
|
3636
|
-
nextToken,
|
|
3637
|
-
position
|
|
3638
|
-
};
|
|
3639
|
-
};
|
|
3640
|
-
let Container$5 = container;
|
|
3641
|
-
let AtRule$3 = class AtRule extends Container$5 {
|
|
3642
|
-
constructor(defaults) {
|
|
3643
|
-
super(defaults);
|
|
3644
|
-
this.type = "atrule";
|
|
3645
|
-
}
|
|
3646
|
-
append(...children) {
|
|
3647
|
-
if (!this.proxyOf.nodes) this.nodes = [];
|
|
3648
|
-
return super.append(...children);
|
|
3649
|
-
}
|
|
3650
|
-
prepend(...children) {
|
|
3651
|
-
if (!this.proxyOf.nodes) this.nodes = [];
|
|
3652
|
-
return super.prepend(...children);
|
|
3653
|
-
}
|
|
3654
|
-
};
|
|
3655
|
-
var atRule = AtRule$3;
|
|
3656
|
-
AtRule$3.default = AtRule$3;
|
|
3657
|
-
Container$5.registerAtRule(AtRule$3);
|
|
3658
|
-
let Container$4 = container;
|
|
3659
|
-
let LazyResult$3;
|
|
3660
|
-
let Processor$2;
|
|
3661
|
-
let Root$5 = class Root extends Container$4 {
|
|
3662
|
-
constructor(defaults) {
|
|
3663
|
-
super(defaults);
|
|
3664
|
-
this.type = "root";
|
|
3665
|
-
if (!this.nodes) this.nodes = [];
|
|
3666
|
-
}
|
|
3667
|
-
normalize(child, sample, type) {
|
|
3668
|
-
let nodes = super.normalize(child);
|
|
3669
|
-
if (sample) {
|
|
3670
|
-
if (type === "prepend") {
|
|
3671
|
-
if (this.nodes.length > 1) {
|
|
3672
|
-
sample.raws.before = this.nodes[1].raws.before;
|
|
3673
|
-
} else {
|
|
3674
|
-
delete sample.raws.before;
|
|
3675
|
-
}
|
|
3676
|
-
} else if (this.first !== sample) {
|
|
3677
|
-
for (let node2 of nodes) {
|
|
3678
|
-
node2.raws.before = sample.raws.before;
|
|
3679
|
-
}
|
|
3680
|
-
}
|
|
3681
|
-
}
|
|
3682
|
-
return nodes;
|
|
3683
|
-
}
|
|
3684
|
-
removeChild(child, ignore) {
|
|
3685
|
-
let index2 = this.index(child);
|
|
3686
|
-
if (!ignore && index2 === 0 && this.nodes.length > 1) {
|
|
3687
|
-
this.nodes[1].raws.before = this.nodes[index2].raws.before;
|
|
3688
|
-
}
|
|
3689
|
-
return super.removeChild(child);
|
|
3690
|
-
}
|
|
3691
|
-
toResult(opts = {}) {
|
|
3692
|
-
let lazy = new LazyResult$3(new Processor$2(), this, opts);
|
|
3693
|
-
return lazy.stringify();
|
|
3694
|
-
}
|
|
3695
|
-
};
|
|
3696
|
-
Root$5.registerLazyResult = (dependant) => {
|
|
3697
|
-
LazyResult$3 = dependant;
|
|
3698
|
-
};
|
|
3699
|
-
Root$5.registerProcessor = (dependant) => {
|
|
3700
|
-
Processor$2 = dependant;
|
|
3701
|
-
};
|
|
3702
|
-
var root = Root$5;
|
|
3703
|
-
Root$5.default = Root$5;
|
|
3704
|
-
Container$4.registerRoot(Root$5);
|
|
3705
|
-
let list$2 = {
|
|
3706
|
-
comma(string) {
|
|
3707
|
-
return list$2.split(string, [","], true);
|
|
3708
|
-
},
|
|
3709
|
-
space(string) {
|
|
3710
|
-
let spaces = [" ", "\n", " "];
|
|
3711
|
-
return list$2.split(string, spaces);
|
|
3712
|
-
},
|
|
3713
|
-
split(string, separators, last) {
|
|
3714
|
-
let array = [];
|
|
3715
|
-
let current = "";
|
|
3716
|
-
let split = false;
|
|
3717
|
-
let func = 0;
|
|
3718
|
-
let inQuote = false;
|
|
3719
|
-
let prevQuote = "";
|
|
3720
|
-
let escape = false;
|
|
3721
|
-
for (let letter of string) {
|
|
3722
|
-
if (escape) {
|
|
3723
|
-
escape = false;
|
|
3724
|
-
} else if (letter === "\\") {
|
|
3725
|
-
escape = true;
|
|
3726
|
-
} else if (inQuote) {
|
|
3727
|
-
if (letter === prevQuote) {
|
|
3728
|
-
inQuote = false;
|
|
3751
|
+
next += 1;
|
|
3752
|
+
escape = !escape;
|
|
3729
3753
|
}
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3754
|
+
code = css.charCodeAt(next + 1);
|
|
3755
|
+
if (escape && code !== SLASH && code !== SPACE && code !== NEWLINE && code !== TAB && code !== CR && code !== FEED) {
|
|
3756
|
+
next += 1;
|
|
3757
|
+
if (RE_HEX_ESCAPE.test(css.charAt(next))) {
|
|
3758
|
+
while (RE_HEX_ESCAPE.test(css.charAt(next + 1))) {
|
|
3759
|
+
next += 1;
|
|
3760
|
+
}
|
|
3761
|
+
if (css.charCodeAt(next + 1) === SPACE) {
|
|
3762
|
+
next += 1;
|
|
3763
|
+
}
|
|
3764
|
+
}
|
|
3765
|
+
}
|
|
3766
|
+
currentToken = ["word", css.slice(pos, next + 1), pos, next];
|
|
3767
|
+
pos = next;
|
|
3768
|
+
break;
|
|
3739
3769
|
}
|
|
3740
|
-
|
|
3741
|
-
if (
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3770
|
+
default: {
|
|
3771
|
+
if (code === SLASH && css.charCodeAt(pos + 1) === ASTERISK) {
|
|
3772
|
+
next = css.indexOf("*/", pos + 2) + 1;
|
|
3773
|
+
if (next === 0) {
|
|
3774
|
+
if (ignore || ignoreUnclosed) {
|
|
3775
|
+
next = css.length;
|
|
3776
|
+
} else {
|
|
3777
|
+
unclosed("comment");
|
|
3778
|
+
}
|
|
3779
|
+
}
|
|
3780
|
+
currentToken = ["comment", css.slice(pos, next + 1), pos, next];
|
|
3781
|
+
pos = next;
|
|
3782
|
+
} else {
|
|
3783
|
+
RE_WORD_END.lastIndex = pos + 1;
|
|
3784
|
+
RE_WORD_END.test(css);
|
|
3785
|
+
if (RE_WORD_END.lastIndex === 0) {
|
|
3786
|
+
next = css.length - 1;
|
|
3787
|
+
} else {
|
|
3788
|
+
next = RE_WORD_END.lastIndex - 2;
|
|
3789
|
+
}
|
|
3790
|
+
currentToken = ["word", css.slice(pos, next + 1), pos, next];
|
|
3791
|
+
buffer.push(currentToken);
|
|
3792
|
+
pos = next;
|
|
3793
|
+
}
|
|
3794
|
+
break;
|
|
3746
3795
|
}
|
|
3747
3796
|
}
|
|
3748
|
-
|
|
3749
|
-
return
|
|
3750
|
-
}
|
|
3751
|
-
};
|
|
3752
|
-
var list_1 = list$2;
|
|
3753
|
-
list$2.default = list$2;
|
|
3754
|
-
let Container$3 = container;
|
|
3755
|
-
let list$1 = list_1;
|
|
3756
|
-
let Rule$3 = class Rule extends Container$3 {
|
|
3757
|
-
constructor(defaults) {
|
|
3758
|
-
super(defaults);
|
|
3759
|
-
this.type = "rule";
|
|
3760
|
-
if (!this.nodes) this.nodes = [];
|
|
3761
|
-
}
|
|
3762
|
-
get selectors() {
|
|
3763
|
-
return list$1.comma(this.selector);
|
|
3797
|
+
pos++;
|
|
3798
|
+
return currentToken;
|
|
3764
3799
|
}
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
let sep2 = match ? match[0] : "," + this.raw("between", "beforeOpen");
|
|
3768
|
-
this.selector = values.join(sep2);
|
|
3800
|
+
function back(token) {
|
|
3801
|
+
returned.push(token);
|
|
3769
3802
|
}
|
|
3803
|
+
return {
|
|
3804
|
+
back,
|
|
3805
|
+
endOfFile,
|
|
3806
|
+
nextToken,
|
|
3807
|
+
position
|
|
3808
|
+
};
|
|
3770
3809
|
};
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
Container$3.registerRule(Rule$3);
|
|
3810
|
+
let AtRule$2 = atRule$1;
|
|
3811
|
+
let Comment$3 = comment$1;
|
|
3774
3812
|
let Declaration$2 = declaration;
|
|
3775
|
-
let
|
|
3776
|
-
let
|
|
3777
|
-
let
|
|
3778
|
-
let Root$4 = root;
|
|
3779
|
-
let Rule$2 = rule;
|
|
3813
|
+
let Root$4 = root$1;
|
|
3814
|
+
let Rule$2 = rule$1;
|
|
3815
|
+
let tokenizer$1 = tokenize;
|
|
3780
3816
|
const SAFE_COMMENT_NEIGHBOR = {
|
|
3781
3817
|
empty: true,
|
|
3782
3818
|
space: true
|
|
@@ -3788,7 +3824,7 @@ function findLastWithPosition(tokens) {
|
|
|
3788
3824
|
if (pos) return pos;
|
|
3789
3825
|
}
|
|
3790
3826
|
}
|
|
3791
|
-
let Parser$
|
|
3827
|
+
let Parser$2 = class Parser {
|
|
3792
3828
|
constructor(input2) {
|
|
3793
3829
|
this.input = input2;
|
|
3794
3830
|
this.root = new Root$4();
|
|
@@ -3895,7 +3931,7 @@ let Parser$1 = class Parser {
|
|
|
3895
3931
|
}
|
|
3896
3932
|
colon(tokens) {
|
|
3897
3933
|
let brackets = 0;
|
|
3898
|
-
let token, type
|
|
3934
|
+
let prev, token, type;
|
|
3899
3935
|
for (let [i, element] of tokens.entries()) {
|
|
3900
3936
|
token = element;
|
|
3901
3937
|
type = token[0];
|
|
@@ -3919,7 +3955,7 @@ let Parser$1 = class Parser {
|
|
|
3919
3955
|
return false;
|
|
3920
3956
|
}
|
|
3921
3957
|
comment(token) {
|
|
3922
|
-
let node2 = new Comment$
|
|
3958
|
+
let node2 = new Comment$3();
|
|
3923
3959
|
this.init(node2, token[2]);
|
|
3924
3960
|
node2.source.end = this.getPosition(token[3] || token[2]);
|
|
3925
3961
|
node2.source.end.offset++;
|
|
@@ -3936,7 +3972,7 @@ let Parser$1 = class Parser {
|
|
|
3936
3972
|
}
|
|
3937
3973
|
}
|
|
3938
3974
|
createTokenizer() {
|
|
3939
|
-
this.tokenizer =
|
|
3975
|
+
this.tokenizer = tokenizer$1(this.input);
|
|
3940
3976
|
}
|
|
3941
3977
|
decl(tokens, customProperty) {
|
|
3942
3978
|
let node2 = new Declaration$2();
|
|
@@ -4002,12 +4038,12 @@ let Parser$1 = class Parser {
|
|
|
4002
4038
|
let str = "";
|
|
4003
4039
|
for (let j = i; j > 0; j--) {
|
|
4004
4040
|
let type = cache[j][0];
|
|
4005
|
-
if (str.trim().
|
|
4041
|
+
if (str.trim().startsWith("!") && type !== "space") {
|
|
4006
4042
|
break;
|
|
4007
4043
|
}
|
|
4008
4044
|
str = cache.pop()[1] + str;
|
|
4009
4045
|
}
|
|
4010
|
-
if (str.trim().
|
|
4046
|
+
if (str.trim().startsWith("!")) {
|
|
4011
4047
|
node2.important = true;
|
|
4012
4048
|
node2.raws.important = str;
|
|
4013
4049
|
tokens = cache;
|
|
@@ -4295,13 +4331,13 @@ let Parser$1 = class Parser {
|
|
|
4295
4331
|
);
|
|
4296
4332
|
}
|
|
4297
4333
|
};
|
|
4298
|
-
var parser = Parser$
|
|
4299
|
-
let Container$
|
|
4300
|
-
let
|
|
4301
|
-
let
|
|
4302
|
-
function parse$
|
|
4303
|
-
let input2 = new Input$
|
|
4304
|
-
let parser2 = new
|
|
4334
|
+
var parser = Parser$2;
|
|
4335
|
+
let Container$3 = container;
|
|
4336
|
+
let Input$3 = input;
|
|
4337
|
+
let Parser$1 = parser;
|
|
4338
|
+
function parse$4(css, opts) {
|
|
4339
|
+
let input2 = new Input$3(css, opts);
|
|
4340
|
+
let parser2 = new Parser$1(input2);
|
|
4305
4341
|
try {
|
|
4306
4342
|
parser2.parse();
|
|
4307
4343
|
} catch (e) {
|
|
@@ -4320,18 +4356,87 @@ function parse$3(css, opts) {
|
|
|
4320
4356
|
}
|
|
4321
4357
|
return parser2.root;
|
|
4322
4358
|
}
|
|
4323
|
-
var parse_1 = parse$
|
|
4324
|
-
parse$
|
|
4325
|
-
Container$
|
|
4326
|
-
let
|
|
4359
|
+
var parse_1 = parse$4;
|
|
4360
|
+
parse$4.default = parse$4;
|
|
4361
|
+
Container$3.registerParse(parse$4);
|
|
4362
|
+
let Warning$3 = class Warning {
|
|
4363
|
+
constructor(text, opts = {}) {
|
|
4364
|
+
this.type = "warning";
|
|
4365
|
+
this.text = text;
|
|
4366
|
+
if (opts.node && opts.node.source) {
|
|
4367
|
+
let range = opts.node.rangeBy(opts);
|
|
4368
|
+
this.line = range.start.line;
|
|
4369
|
+
this.column = range.start.column;
|
|
4370
|
+
this.endLine = range.end.line;
|
|
4371
|
+
this.endColumn = range.end.column;
|
|
4372
|
+
}
|
|
4373
|
+
for (let opt in opts) this[opt] = opts[opt];
|
|
4374
|
+
}
|
|
4375
|
+
toString() {
|
|
4376
|
+
if (this.node) {
|
|
4377
|
+
return this.node.error(this.text, {
|
|
4378
|
+
index: this.index,
|
|
4379
|
+
plugin: this.plugin,
|
|
4380
|
+
word: this.word
|
|
4381
|
+
}).message;
|
|
4382
|
+
}
|
|
4383
|
+
if (this.plugin) {
|
|
4384
|
+
return this.plugin + ": " + this.text;
|
|
4385
|
+
}
|
|
4386
|
+
return this.text;
|
|
4387
|
+
}
|
|
4388
|
+
};
|
|
4389
|
+
var warning = Warning$3;
|
|
4390
|
+
Warning$3.default = Warning$3;
|
|
4391
|
+
let Warning$2 = warning;
|
|
4392
|
+
let Result$4 = class Result {
|
|
4393
|
+
constructor(processor2, root2, opts) {
|
|
4394
|
+
this.processor = processor2;
|
|
4395
|
+
this.messages = [];
|
|
4396
|
+
this.root = root2;
|
|
4397
|
+
this.opts = opts;
|
|
4398
|
+
this.css = void 0;
|
|
4399
|
+
this.map = void 0;
|
|
4400
|
+
}
|
|
4401
|
+
toString() {
|
|
4402
|
+
return this.css;
|
|
4403
|
+
}
|
|
4404
|
+
warn(text, opts = {}) {
|
|
4405
|
+
if (!opts.plugin) {
|
|
4406
|
+
if (this.lastPlugin && this.lastPlugin.postcssPlugin) {
|
|
4407
|
+
opts.plugin = this.lastPlugin.postcssPlugin;
|
|
4408
|
+
}
|
|
4409
|
+
}
|
|
4410
|
+
let warning2 = new Warning$2(text, opts);
|
|
4411
|
+
this.messages.push(warning2);
|
|
4412
|
+
return warning2;
|
|
4413
|
+
}
|
|
4414
|
+
warnings() {
|
|
4415
|
+
return this.messages.filter((i) => i.type === "warning");
|
|
4416
|
+
}
|
|
4417
|
+
get content() {
|
|
4418
|
+
return this.css;
|
|
4419
|
+
}
|
|
4420
|
+
};
|
|
4421
|
+
var result = Result$4;
|
|
4422
|
+
Result$4.default = Result$4;
|
|
4423
|
+
let printed = {};
|
|
4424
|
+
var warnOnce$2 = function warnOnce(message) {
|
|
4425
|
+
if (printed[message]) return;
|
|
4426
|
+
printed[message] = true;
|
|
4427
|
+
if (typeof console !== "undefined" && console.warn) {
|
|
4428
|
+
console.warn(message);
|
|
4429
|
+
}
|
|
4430
|
+
};
|
|
4431
|
+
let Container$2 = container;
|
|
4432
|
+
let Document$3 = document$2;
|
|
4327
4433
|
let MapGenerator$1 = mapGenerator;
|
|
4328
|
-
let
|
|
4329
|
-
let
|
|
4330
|
-
let
|
|
4434
|
+
let parse$3 = parse_1;
|
|
4435
|
+
let Result$3 = result;
|
|
4436
|
+
let Root$3 = root$1;
|
|
4437
|
+
let stringify$3 = stringify_1;
|
|
4438
|
+
let { isClean, my } = symbols;
|
|
4331
4439
|
let warnOnce$1 = warnOnce$2;
|
|
4332
|
-
let Result$2 = result;
|
|
4333
|
-
let parse$2 = parse_1;
|
|
4334
|
-
let Root$3 = root;
|
|
4335
4440
|
const TYPE_TO_CLASS_NAME = {
|
|
4336
4441
|
atrule: "AtRule",
|
|
4337
4442
|
comment: "Comment",
|
|
@@ -4414,7 +4519,7 @@ function cleanMarks(node2) {
|
|
|
4414
4519
|
if (node2.nodes) node2.nodes.forEach((i) => cleanMarks(i));
|
|
4415
4520
|
return node2;
|
|
4416
4521
|
}
|
|
4417
|
-
let postcss$
|
|
4522
|
+
let postcss$3 = {};
|
|
4418
4523
|
let LazyResult$2 = class LazyResult {
|
|
4419
4524
|
constructor(processor2, css, opts) {
|
|
4420
4525
|
this.stringified = false;
|
|
@@ -4422,7 +4527,7 @@ let LazyResult$2 = class LazyResult {
|
|
|
4422
4527
|
let root2;
|
|
4423
4528
|
if (typeof css === "object" && css !== null && (css.type === "root" || css.type === "document")) {
|
|
4424
4529
|
root2 = cleanMarks(css);
|
|
4425
|
-
} else if (css instanceof LazyResult || css instanceof Result$
|
|
4530
|
+
} else if (css instanceof LazyResult || css instanceof Result$3) {
|
|
4426
4531
|
root2 = cleanMarks(css.root);
|
|
4427
4532
|
if (css.map) {
|
|
4428
4533
|
if (typeof opts.map === "undefined") opts.map = {};
|
|
@@ -4430,7 +4535,7 @@ let LazyResult$2 = class LazyResult {
|
|
|
4430
4535
|
opts.map.prev = css.map;
|
|
4431
4536
|
}
|
|
4432
4537
|
} else {
|
|
4433
|
-
let parser2 = parse$
|
|
4538
|
+
let parser2 = parse$3;
|
|
4434
4539
|
if (opts.syntax) parser2 = opts.syntax.parse;
|
|
4435
4540
|
if (opts.parser) parser2 = opts.parser;
|
|
4436
4541
|
if (parser2.parse) parser2 = parser2.parse;
|
|
@@ -4441,16 +4546,16 @@ let LazyResult$2 = class LazyResult {
|
|
|
4441
4546
|
this.error = error;
|
|
4442
4547
|
}
|
|
4443
4548
|
if (root2 && !root2[my]) {
|
|
4444
|
-
Container$
|
|
4549
|
+
Container$2.rebuild(root2);
|
|
4445
4550
|
}
|
|
4446
4551
|
}
|
|
4447
|
-
this.result = new Result$
|
|
4448
|
-
this.helpers = __spreadProps(__spreadValues({}, postcss$
|
|
4449
|
-
this.plugins = this.processor.plugins.map((
|
|
4450
|
-
if (typeof
|
|
4451
|
-
return __spreadValues(__spreadValues({},
|
|
4552
|
+
this.result = new Result$3(processor2, root2, opts);
|
|
4553
|
+
this.helpers = __spreadProps(__spreadValues({}, postcss$3), { postcss: postcss$3, result: this.result });
|
|
4554
|
+
this.plugins = this.processor.plugins.map((plugin3) => {
|
|
4555
|
+
if (typeof plugin3 === "object" && plugin3.prepare) {
|
|
4556
|
+
return __spreadValues(__spreadValues({}, plugin3), plugin3.prepare(this.result));
|
|
4452
4557
|
} else {
|
|
4453
|
-
return
|
|
4558
|
+
return plugin3;
|
|
4454
4559
|
}
|
|
4455
4560
|
});
|
|
4456
4561
|
}
|
|
@@ -4472,17 +4577,17 @@ let LazyResult$2 = class LazyResult {
|
|
|
4472
4577
|
throw new Error("Use process(css).then(cb) to work with async plugins");
|
|
4473
4578
|
}
|
|
4474
4579
|
handleError(error, node2) {
|
|
4475
|
-
let
|
|
4580
|
+
let plugin3 = this.result.lastPlugin;
|
|
4476
4581
|
try {
|
|
4477
4582
|
if (node2) node2.addToError(error);
|
|
4478
4583
|
this.error = error;
|
|
4479
4584
|
if (error.name === "CssSyntaxError" && !error.plugin) {
|
|
4480
|
-
error.plugin =
|
|
4585
|
+
error.plugin = plugin3.postcssPlugin;
|
|
4481
4586
|
error.setMessage();
|
|
4482
|
-
} else if (
|
|
4587
|
+
} else if (plugin3.postcssVersion) {
|
|
4483
4588
|
if (true) {
|
|
4484
|
-
let pluginName =
|
|
4485
|
-
let pluginVer =
|
|
4589
|
+
let pluginName = plugin3.postcssPlugin;
|
|
4590
|
+
let pluginVer = plugin3.postcssVersion;
|
|
4486
4591
|
let runtimeVer = this.result.processor.version;
|
|
4487
4592
|
let a = pluginVer.split(".");
|
|
4488
4593
|
let b = runtimeVer.split(".");
|
|
@@ -4500,33 +4605,33 @@ let LazyResult$2 = class LazyResult {
|
|
|
4500
4605
|
}
|
|
4501
4606
|
prepareVisitors() {
|
|
4502
4607
|
this.listeners = {};
|
|
4503
|
-
let add = (
|
|
4608
|
+
let add = (plugin3, type, cb) => {
|
|
4504
4609
|
if (!this.listeners[type]) this.listeners[type] = [];
|
|
4505
|
-
this.listeners[type].push([
|
|
4610
|
+
this.listeners[type].push([plugin3, cb]);
|
|
4506
4611
|
};
|
|
4507
|
-
for (let
|
|
4508
|
-
if (typeof
|
|
4509
|
-
for (let event in
|
|
4612
|
+
for (let plugin3 of this.plugins) {
|
|
4613
|
+
if (typeof plugin3 === "object") {
|
|
4614
|
+
for (let event in plugin3) {
|
|
4510
4615
|
if (!PLUGIN_PROPS[event] && /^[A-Z]/.test(event)) {
|
|
4511
4616
|
throw new Error(
|
|
4512
|
-
`Unknown event ${event} in ${
|
|
4617
|
+
`Unknown event ${event} in ${plugin3.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`
|
|
4513
4618
|
);
|
|
4514
4619
|
}
|
|
4515
4620
|
if (!NOT_VISITORS[event]) {
|
|
4516
|
-
if (typeof
|
|
4517
|
-
for (let filter in
|
|
4621
|
+
if (typeof plugin3[event] === "object") {
|
|
4622
|
+
for (let filter in plugin3[event]) {
|
|
4518
4623
|
if (filter === "*") {
|
|
4519
|
-
add(
|
|
4624
|
+
add(plugin3, event, plugin3[event][filter]);
|
|
4520
4625
|
} else {
|
|
4521
4626
|
add(
|
|
4522
|
-
|
|
4627
|
+
plugin3,
|
|
4523
4628
|
event + "-" + filter.toLowerCase(),
|
|
4524
|
-
|
|
4629
|
+
plugin3[event][filter]
|
|
4525
4630
|
);
|
|
4526
4631
|
}
|
|
4527
4632
|
}
|
|
4528
|
-
} else if (typeof
|
|
4529
|
-
add(
|
|
4633
|
+
} else if (typeof plugin3[event] === "function") {
|
|
4634
|
+
add(plugin3, event, plugin3[event]);
|
|
4530
4635
|
}
|
|
4531
4636
|
}
|
|
4532
4637
|
}
|
|
@@ -4537,8 +4642,8 @@ let LazyResult$2 = class LazyResult {
|
|
|
4537
4642
|
async runAsync() {
|
|
4538
4643
|
this.plugin = 0;
|
|
4539
4644
|
for (let i = 0; i < this.plugins.length; i++) {
|
|
4540
|
-
let
|
|
4541
|
-
let promise = this.runOnRoot(
|
|
4645
|
+
let plugin3 = this.plugins[i];
|
|
4646
|
+
let promise = this.runOnRoot(plugin3);
|
|
4542
4647
|
if (isPromise(promise)) {
|
|
4543
4648
|
try {
|
|
4544
4649
|
await promise;
|
|
@@ -4566,8 +4671,8 @@ let LazyResult$2 = class LazyResult {
|
|
|
4566
4671
|
}
|
|
4567
4672
|
}
|
|
4568
4673
|
if (this.listeners.OnceExit) {
|
|
4569
|
-
for (let [
|
|
4570
|
-
this.result.lastPlugin =
|
|
4674
|
+
for (let [plugin3, visitor] of this.listeners.OnceExit) {
|
|
4675
|
+
this.result.lastPlugin = plugin3;
|
|
4571
4676
|
try {
|
|
4572
4677
|
if (root2.type === "document") {
|
|
4573
4678
|
let roots = root2.nodes.map(
|
|
@@ -4586,22 +4691,22 @@ let LazyResult$2 = class LazyResult {
|
|
|
4586
4691
|
this.processed = true;
|
|
4587
4692
|
return this.stringify();
|
|
4588
4693
|
}
|
|
4589
|
-
runOnRoot(
|
|
4590
|
-
this.result.lastPlugin =
|
|
4694
|
+
runOnRoot(plugin3) {
|
|
4695
|
+
this.result.lastPlugin = plugin3;
|
|
4591
4696
|
try {
|
|
4592
|
-
if (typeof
|
|
4697
|
+
if (typeof plugin3 === "object" && plugin3.Once) {
|
|
4593
4698
|
if (this.result.root.type === "document") {
|
|
4594
4699
|
let roots = this.result.root.nodes.map(
|
|
4595
|
-
(root2) =>
|
|
4700
|
+
(root2) => plugin3.Once(root2, this.helpers)
|
|
4596
4701
|
);
|
|
4597
4702
|
if (isPromise(roots[0])) {
|
|
4598
4703
|
return Promise.all(roots);
|
|
4599
4704
|
}
|
|
4600
4705
|
return roots;
|
|
4601
4706
|
}
|
|
4602
|
-
return
|
|
4603
|
-
} else if (typeof
|
|
4604
|
-
return
|
|
4707
|
+
return plugin3.Once(this.result.root, this.helpers);
|
|
4708
|
+
} else if (typeof plugin3 === "function") {
|
|
4709
|
+
return plugin3(this.result.root, this.result);
|
|
4605
4710
|
}
|
|
4606
4711
|
} catch (error) {
|
|
4607
4712
|
throw this.handleError(error);
|
|
@@ -4613,7 +4718,7 @@ let LazyResult$2 = class LazyResult {
|
|
|
4613
4718
|
this.stringified = true;
|
|
4614
4719
|
this.sync();
|
|
4615
4720
|
let opts = this.result.opts;
|
|
4616
|
-
let str = stringify$
|
|
4721
|
+
let str = stringify$3;
|
|
4617
4722
|
if (opts.syntax) str = opts.syntax.stringify;
|
|
4618
4723
|
if (opts.stringifier) str = opts.stringifier;
|
|
4619
4724
|
if (str.stringify) str = str.stringify;
|
|
@@ -4630,8 +4735,8 @@ let LazyResult$2 = class LazyResult {
|
|
|
4630
4735
|
if (this.processing) {
|
|
4631
4736
|
throw this.getAsyncError();
|
|
4632
4737
|
}
|
|
4633
|
-
for (let
|
|
4634
|
-
let promise = this.runOnRoot(
|
|
4738
|
+
for (let plugin3 of this.plugins) {
|
|
4739
|
+
let promise = this.runOnRoot(plugin3);
|
|
4635
4740
|
if (isPromise(promise)) {
|
|
4636
4741
|
throw this.getAsyncError();
|
|
4637
4742
|
}
|
|
@@ -4669,8 +4774,8 @@ let LazyResult$2 = class LazyResult {
|
|
|
4669
4774
|
return this.css;
|
|
4670
4775
|
}
|
|
4671
4776
|
visitSync(visitors, node2) {
|
|
4672
|
-
for (let [
|
|
4673
|
-
this.result.lastPlugin =
|
|
4777
|
+
for (let [plugin3, visitor] of visitors) {
|
|
4778
|
+
this.result.lastPlugin = plugin3;
|
|
4674
4779
|
let promise;
|
|
4675
4780
|
try {
|
|
4676
4781
|
promise = visitor(node2, this.helpers);
|
|
@@ -4693,13 +4798,13 @@ let LazyResult$2 = class LazyResult {
|
|
|
4693
4798
|
return;
|
|
4694
4799
|
}
|
|
4695
4800
|
if (visitors.length > 0 && visit2.visitorIndex < visitors.length) {
|
|
4696
|
-
let [
|
|
4801
|
+
let [plugin3, visitor] = visitors[visit2.visitorIndex];
|
|
4697
4802
|
visit2.visitorIndex += 1;
|
|
4698
4803
|
if (visit2.visitorIndex === visitors.length) {
|
|
4699
4804
|
visit2.visitors = [];
|
|
4700
4805
|
visit2.visitorIndex = 0;
|
|
4701
4806
|
}
|
|
4702
|
-
this.result.lastPlugin =
|
|
4807
|
+
this.result.lastPlugin = plugin3;
|
|
4703
4808
|
try {
|
|
4704
4809
|
return visitor(node2.toProxy(), this.helpers);
|
|
4705
4810
|
} catch (e) {
|
|
@@ -4784,17 +4889,17 @@ let LazyResult$2 = class LazyResult {
|
|
|
4784
4889
|
}
|
|
4785
4890
|
};
|
|
4786
4891
|
LazyResult$2.registerPostcss = (dependant) => {
|
|
4787
|
-
postcss$
|
|
4892
|
+
postcss$3 = dependant;
|
|
4788
4893
|
};
|
|
4789
4894
|
var lazyResult = LazyResult$2;
|
|
4790
4895
|
LazyResult$2.default = LazyResult$2;
|
|
4791
4896
|
Root$3.registerLazyResult(LazyResult$2);
|
|
4792
|
-
Document$
|
|
4897
|
+
Document$3.registerLazyResult(LazyResult$2);
|
|
4793
4898
|
let MapGenerator2 = mapGenerator;
|
|
4794
|
-
let
|
|
4899
|
+
let parse$2 = parse_1;
|
|
4900
|
+
const Result$2 = result;
|
|
4901
|
+
let stringify$2 = stringify_1;
|
|
4795
4902
|
let warnOnce2 = warnOnce$2;
|
|
4796
|
-
let parse$1 = parse_1;
|
|
4797
|
-
const Result$1 = result;
|
|
4798
4903
|
let NoWorkResult$1 = class NoWorkResult {
|
|
4799
4904
|
constructor(processor2, css, opts) {
|
|
4800
4905
|
css = css.toString();
|
|
@@ -4804,8 +4909,8 @@ let NoWorkResult$1 = class NoWorkResult {
|
|
|
4804
4909
|
this._opts = opts;
|
|
4805
4910
|
this._map = void 0;
|
|
4806
4911
|
let root2;
|
|
4807
|
-
let str = stringify$
|
|
4808
|
-
this.result = new Result$
|
|
4912
|
+
let str = stringify$2;
|
|
4913
|
+
this.result = new Result$2(this._processor, root2, this._opts);
|
|
4809
4914
|
this.result.css = css;
|
|
4810
4915
|
let self = this;
|
|
4811
4916
|
Object.defineProperty(this.result, "root", {
|
|
@@ -4880,7 +4985,7 @@ let NoWorkResult$1 = class NoWorkResult {
|
|
|
4880
4985
|
return this._root;
|
|
4881
4986
|
}
|
|
4882
4987
|
let root2;
|
|
4883
|
-
let parser2 = parse$
|
|
4988
|
+
let parser2 = parse$2;
|
|
4884
4989
|
try {
|
|
4885
4990
|
root2 = parser2(this._css, this._opts);
|
|
4886
4991
|
} catch (error) {
|
|
@@ -4899,13 +5004,13 @@ let NoWorkResult$1 = class NoWorkResult {
|
|
|
4899
5004
|
};
|
|
4900
5005
|
var noWorkResult = NoWorkResult$1;
|
|
4901
5006
|
NoWorkResult$1.default = NoWorkResult$1;
|
|
4902
|
-
let
|
|
5007
|
+
let Document$2 = document$2;
|
|
4903
5008
|
let LazyResult$1 = lazyResult;
|
|
4904
|
-
let
|
|
4905
|
-
let Root$2 = root;
|
|
4906
|
-
let Processor$
|
|
5009
|
+
let NoWorkResult2 = noWorkResult;
|
|
5010
|
+
let Root$2 = root$1;
|
|
5011
|
+
let Processor$2 = class Processor {
|
|
4907
5012
|
constructor(plugins = []) {
|
|
4908
|
-
this.version = "8.
|
|
5013
|
+
this.version = "8.5.1";
|
|
4909
5014
|
this.plugins = this.normalize(plugins);
|
|
4910
5015
|
}
|
|
4911
5016
|
normalize(plugins) {
|
|
@@ -4941,88 +5046,40 @@ let Processor$1 = class Processor {
|
|
|
4941
5046
|
return new LazyResult$1(this, css, opts);
|
|
4942
5047
|
}
|
|
4943
5048
|
}
|
|
4944
|
-
use(
|
|
4945
|
-
this.plugins = this.plugins.concat(this.normalize([
|
|
5049
|
+
use(plugin3) {
|
|
5050
|
+
this.plugins = this.plugins.concat(this.normalize([plugin3]));
|
|
4946
5051
|
return this;
|
|
4947
5052
|
}
|
|
4948
5053
|
};
|
|
4949
|
-
var processor = Processor$
|
|
4950
|
-
Processor$
|
|
4951
|
-
Root$2.registerProcessor(Processor$
|
|
4952
|
-
Document$
|
|
5054
|
+
var processor = Processor$2;
|
|
5055
|
+
Processor$2.default = Processor$2;
|
|
5056
|
+
Root$2.registerProcessor(Processor$2);
|
|
5057
|
+
Document$2.registerProcessor(Processor$2);
|
|
5058
|
+
let AtRule$1 = atRule$1;
|
|
5059
|
+
let Comment$2 = comment$1;
|
|
5060
|
+
let Container$1 = container;
|
|
5061
|
+
let CssSyntaxError$1 = cssSyntaxError;
|
|
4953
5062
|
let Declaration$1 = declaration;
|
|
4954
|
-
let
|
|
4955
|
-
let
|
|
4956
|
-
let
|
|
4957
|
-
let Input$1 = input;
|
|
4958
|
-
let Root$1 = root;
|
|
4959
|
-
let Rule$1 = rule;
|
|
4960
|
-
function fromJSON$1(json, inputs) {
|
|
4961
|
-
if (Array.isArray(json)) return json.map((n) => fromJSON$1(n));
|
|
4962
|
-
let _a = json, { inputs: ownInputs } = _a, defaults = __objRest(_a, ["inputs"]);
|
|
4963
|
-
if (ownInputs) {
|
|
4964
|
-
inputs = [];
|
|
4965
|
-
for (let input2 of ownInputs) {
|
|
4966
|
-
let inputHydrated = __spreadProps(__spreadValues({}, input2), { __proto__: Input$1.prototype });
|
|
4967
|
-
if (inputHydrated.map) {
|
|
4968
|
-
inputHydrated.map = __spreadProps(__spreadValues({}, inputHydrated.map), {
|
|
4969
|
-
__proto__: PreviousMap2.prototype
|
|
4970
|
-
});
|
|
4971
|
-
}
|
|
4972
|
-
inputs.push(inputHydrated);
|
|
4973
|
-
}
|
|
4974
|
-
}
|
|
4975
|
-
if (defaults.nodes) {
|
|
4976
|
-
defaults.nodes = json.nodes.map((n) => fromJSON$1(n, inputs));
|
|
4977
|
-
}
|
|
4978
|
-
if (defaults.source) {
|
|
4979
|
-
let _b = defaults.source, { inputId } = _b, source = __objRest(_b, ["inputId"]);
|
|
4980
|
-
defaults.source = source;
|
|
4981
|
-
if (inputId != null) {
|
|
4982
|
-
defaults.source.input = inputs[inputId];
|
|
4983
|
-
}
|
|
4984
|
-
}
|
|
4985
|
-
if (defaults.type === "root") {
|
|
4986
|
-
return new Root$1(defaults);
|
|
4987
|
-
} else if (defaults.type === "decl") {
|
|
4988
|
-
return new Declaration$1(defaults);
|
|
4989
|
-
} else if (defaults.type === "rule") {
|
|
4990
|
-
return new Rule$1(defaults);
|
|
4991
|
-
} else if (defaults.type === "comment") {
|
|
4992
|
-
return new Comment$1(defaults);
|
|
4993
|
-
} else if (defaults.type === "atrule") {
|
|
4994
|
-
return new AtRule$1(defaults);
|
|
4995
|
-
} else {
|
|
4996
|
-
throw new Error("Unknown node type: " + json.type);
|
|
4997
|
-
}
|
|
4998
|
-
}
|
|
4999
|
-
var fromJSON_1 = fromJSON$1;
|
|
5000
|
-
fromJSON$1.default = fromJSON$1;
|
|
5001
|
-
let CssSyntaxError2 = cssSyntaxError;
|
|
5002
|
-
let Declaration2 = declaration;
|
|
5063
|
+
let Document$1 = document$2;
|
|
5064
|
+
let fromJSON$1 = fromJSON_1;
|
|
5065
|
+
let Input$2 = input;
|
|
5003
5066
|
let LazyResult2 = lazyResult;
|
|
5004
|
-
let
|
|
5005
|
-
let
|
|
5006
|
-
let
|
|
5007
|
-
let
|
|
5008
|
-
let
|
|
5009
|
-
let
|
|
5010
|
-
let
|
|
5011
|
-
let
|
|
5012
|
-
let
|
|
5013
|
-
|
|
5014
|
-
let parse = parse_1;
|
|
5015
|
-
let list = list_1;
|
|
5016
|
-
let Rule2 = rule;
|
|
5017
|
-
let Root2 = root;
|
|
5018
|
-
let Node2 = node;
|
|
5019
|
-
function postcss(...plugins) {
|
|
5067
|
+
let list$1 = list_1;
|
|
5068
|
+
let Node$1 = node;
|
|
5069
|
+
let parse$1 = parse_1;
|
|
5070
|
+
let Processor$1 = processor;
|
|
5071
|
+
let Result$1 = result;
|
|
5072
|
+
let Root$1 = root$1;
|
|
5073
|
+
let Rule$1 = rule$1;
|
|
5074
|
+
let stringify$1 = stringify_1;
|
|
5075
|
+
let Warning$1 = warning;
|
|
5076
|
+
function postcss$1(...plugins) {
|
|
5020
5077
|
if (plugins.length === 1 && Array.isArray(plugins[0])) {
|
|
5021
5078
|
plugins = plugins[0];
|
|
5022
5079
|
}
|
|
5023
|
-
return new
|
|
5080
|
+
return new Processor$1(plugins);
|
|
5024
5081
|
}
|
|
5025
|
-
postcss.plugin = function plugin(name, initializer) {
|
|
5082
|
+
postcss$1.plugin = function plugin(name, initializer) {
|
|
5026
5083
|
let warningPrinted = false;
|
|
5027
5084
|
function creator(...args) {
|
|
5028
5085
|
if (console && console.warn && !warningPrinted) {
|
|
@@ -5038,7 +5095,7 @@ postcss.plugin = function plugin(name, initializer) {
|
|
|
5038
5095
|
}
|
|
5039
5096
|
let transformer = initializer(...args);
|
|
5040
5097
|
transformer.postcssPlugin = name;
|
|
5041
|
-
transformer.postcssVersion = new
|
|
5098
|
+
transformer.postcssVersion = new Processor$1().version;
|
|
5042
5099
|
return transformer;
|
|
5043
5100
|
}
|
|
5044
5101
|
let cache;
|
|
@@ -5049,61 +5106,181 @@ postcss.plugin = function plugin(name, initializer) {
|
|
|
5049
5106
|
}
|
|
5050
5107
|
});
|
|
5051
5108
|
creator.process = function(css, processOpts, pluginOpts) {
|
|
5052
|
-
return postcss([creator(pluginOpts)]).process(css, processOpts);
|
|
5109
|
+
return postcss$1([creator(pluginOpts)]).process(css, processOpts);
|
|
5053
5110
|
};
|
|
5054
5111
|
return creator;
|
|
5055
5112
|
};
|
|
5056
|
-
postcss.stringify = stringify;
|
|
5057
|
-
postcss.parse = parse;
|
|
5058
|
-
postcss.fromJSON = fromJSON;
|
|
5059
|
-
postcss.list = list;
|
|
5060
|
-
postcss.comment = (defaults) => new
|
|
5061
|
-
postcss.atRule = (defaults) => new
|
|
5062
|
-
postcss.decl = (defaults) => new
|
|
5063
|
-
postcss.rule = (defaults) => new
|
|
5064
|
-
postcss.root = (defaults) => new
|
|
5065
|
-
postcss.document = (defaults) => new
|
|
5066
|
-
postcss.CssSyntaxError =
|
|
5067
|
-
postcss.Declaration =
|
|
5068
|
-
postcss.Container =
|
|
5069
|
-
postcss.Processor =
|
|
5070
|
-
postcss.Document =
|
|
5071
|
-
postcss.Comment =
|
|
5072
|
-
postcss.Warning =
|
|
5073
|
-
postcss.AtRule =
|
|
5074
|
-
postcss.Result =
|
|
5075
|
-
postcss.Input =
|
|
5076
|
-
postcss.Rule =
|
|
5077
|
-
postcss.Root =
|
|
5078
|
-
postcss.Node =
|
|
5079
|
-
LazyResult2.registerPostcss(postcss);
|
|
5080
|
-
var postcss_1 = postcss;
|
|
5081
|
-
postcss.default = postcss;
|
|
5082
|
-
const postcss$
|
|
5083
|
-
postcss$
|
|
5084
|
-
postcss$
|
|
5085
|
-
postcss$
|
|
5086
|
-
postcss$
|
|
5087
|
-
postcss$
|
|
5088
|
-
postcss$
|
|
5089
|
-
postcss$
|
|
5090
|
-
postcss$
|
|
5091
|
-
postcss$
|
|
5092
|
-
postcss$
|
|
5093
|
-
postcss$
|
|
5094
|
-
postcss$
|
|
5095
|
-
postcss$
|
|
5096
|
-
postcss$
|
|
5097
|
-
postcss$
|
|
5098
|
-
postcss$
|
|
5099
|
-
postcss$
|
|
5100
|
-
postcss$
|
|
5101
|
-
postcss$
|
|
5102
|
-
postcss$
|
|
5103
|
-
postcss$
|
|
5104
|
-
postcss$
|
|
5105
|
-
postcss$
|
|
5106
|
-
postcss$
|
|
5113
|
+
postcss$1.stringify = stringify$1;
|
|
5114
|
+
postcss$1.parse = parse$1;
|
|
5115
|
+
postcss$1.fromJSON = fromJSON$1;
|
|
5116
|
+
postcss$1.list = list$1;
|
|
5117
|
+
postcss$1.comment = (defaults) => new Comment$2(defaults);
|
|
5118
|
+
postcss$1.atRule = (defaults) => new AtRule$1(defaults);
|
|
5119
|
+
postcss$1.decl = (defaults) => new Declaration$1(defaults);
|
|
5120
|
+
postcss$1.rule = (defaults) => new Rule$1(defaults);
|
|
5121
|
+
postcss$1.root = (defaults) => new Root$1(defaults);
|
|
5122
|
+
postcss$1.document = (defaults) => new Document$1(defaults);
|
|
5123
|
+
postcss$1.CssSyntaxError = CssSyntaxError$1;
|
|
5124
|
+
postcss$1.Declaration = Declaration$1;
|
|
5125
|
+
postcss$1.Container = Container$1;
|
|
5126
|
+
postcss$1.Processor = Processor$1;
|
|
5127
|
+
postcss$1.Document = Document$1;
|
|
5128
|
+
postcss$1.Comment = Comment$2;
|
|
5129
|
+
postcss$1.Warning = Warning$1;
|
|
5130
|
+
postcss$1.AtRule = AtRule$1;
|
|
5131
|
+
postcss$1.Result = Result$1;
|
|
5132
|
+
postcss$1.Input = Input$2;
|
|
5133
|
+
postcss$1.Rule = Rule$1;
|
|
5134
|
+
postcss$1.Root = Root$1;
|
|
5135
|
+
postcss$1.Node = Node$1;
|
|
5136
|
+
LazyResult2.registerPostcss(postcss$1);
|
|
5137
|
+
var postcss_1 = postcss$1;
|
|
5138
|
+
postcss$1.default = postcss$1;
|
|
5139
|
+
const postcss$2 = /* @__PURE__ */ getDefaultExportFromCjs(postcss_1);
|
|
5140
|
+
const stringify = postcss$2.stringify;
|
|
5141
|
+
const fromJSON = postcss$2.fromJSON;
|
|
5142
|
+
const plugin2 = postcss$2.plugin;
|
|
5143
|
+
const parse = postcss$2.parse;
|
|
5144
|
+
const list = postcss$2.list;
|
|
5145
|
+
const document$1 = postcss$2.document;
|
|
5146
|
+
const comment = postcss$2.comment;
|
|
5147
|
+
const atRule = postcss$2.atRule;
|
|
5148
|
+
const rule = postcss$2.rule;
|
|
5149
|
+
const decl = postcss$2.decl;
|
|
5150
|
+
const root = postcss$2.root;
|
|
5151
|
+
const CssSyntaxError2 = postcss$2.CssSyntaxError;
|
|
5152
|
+
const Declaration2 = postcss$2.Declaration;
|
|
5153
|
+
const Container2 = postcss$2.Container;
|
|
5154
|
+
const Processor2 = postcss$2.Processor;
|
|
5155
|
+
const Document2 = postcss$2.Document;
|
|
5156
|
+
const Comment$1 = postcss$2.Comment;
|
|
5157
|
+
const Warning2 = postcss$2.Warning;
|
|
5158
|
+
const AtRule2 = postcss$2.AtRule;
|
|
5159
|
+
const Result2 = postcss$2.Result;
|
|
5160
|
+
const Input$1 = postcss$2.Input;
|
|
5161
|
+
const Rule2 = postcss$2.Rule;
|
|
5162
|
+
const Root2 = postcss$2.Root;
|
|
5163
|
+
const Node2 = postcss$2.Node;
|
|
5164
|
+
const postcss = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
5165
|
+
__proto__: null,
|
|
5166
|
+
AtRule: AtRule2,
|
|
5167
|
+
Comment: Comment$1,
|
|
5168
|
+
Container: Container2,
|
|
5169
|
+
CssSyntaxError: CssSyntaxError2,
|
|
5170
|
+
Declaration: Declaration2,
|
|
5171
|
+
Document: Document2,
|
|
5172
|
+
Input: Input$1,
|
|
5173
|
+
Node: Node2,
|
|
5174
|
+
Processor: Processor2,
|
|
5175
|
+
Result: Result2,
|
|
5176
|
+
Root: Root2,
|
|
5177
|
+
Rule: Rule2,
|
|
5178
|
+
Warning: Warning2,
|
|
5179
|
+
atRule,
|
|
5180
|
+
comment,
|
|
5181
|
+
decl,
|
|
5182
|
+
default: postcss$2,
|
|
5183
|
+
document: document$1,
|
|
5184
|
+
fromJSON,
|
|
5185
|
+
list,
|
|
5186
|
+
parse,
|
|
5187
|
+
plugin: plugin2,
|
|
5188
|
+
root,
|
|
5189
|
+
rule,
|
|
5190
|
+
stringify
|
|
5191
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
5192
|
+
const require$$0 = /* @__PURE__ */ getAugmentedNamespace(postcss);
|
|
5193
|
+
let Comment2 = comment$1;
|
|
5194
|
+
let Parser2 = parser;
|
|
5195
|
+
let tokenizer2 = tokenize;
|
|
5196
|
+
let SafeParser$1 = class SafeParser extends Parser2 {
|
|
5197
|
+
checkMissedSemicolon() {
|
|
5198
|
+
}
|
|
5199
|
+
comment(token) {
|
|
5200
|
+
let node2 = new Comment2();
|
|
5201
|
+
this.init(node2, token[2]);
|
|
5202
|
+
let pos = this.input.fromOffset(token[3]) || this.input.fromOffset(this.input.css.length - 1);
|
|
5203
|
+
node2.source.end = {
|
|
5204
|
+
column: pos.col,
|
|
5205
|
+
line: pos.line,
|
|
5206
|
+
offset: token[3] + 1
|
|
5207
|
+
};
|
|
5208
|
+
let text = token[1].slice(2);
|
|
5209
|
+
if (text.slice(-2) === "*/") text = text.slice(0, -2);
|
|
5210
|
+
if (/^\s*$/.test(text)) {
|
|
5211
|
+
node2.text = "";
|
|
5212
|
+
node2.raws.left = text;
|
|
5213
|
+
node2.raws.right = "";
|
|
5214
|
+
} else {
|
|
5215
|
+
let match = text.match(/^(\s*)([^]*\S)(\s*)$/);
|
|
5216
|
+
node2.text = match[2];
|
|
5217
|
+
node2.raws.left = match[1];
|
|
5218
|
+
node2.raws.right = match[3];
|
|
5219
|
+
}
|
|
5220
|
+
}
|
|
5221
|
+
createTokenizer() {
|
|
5222
|
+
this.tokenizer = tokenizer2(this.input, { ignoreErrors: true });
|
|
5223
|
+
}
|
|
5224
|
+
decl(tokens) {
|
|
5225
|
+
if (tokens.length > 1 && tokens.some((i) => i[0] === "word")) {
|
|
5226
|
+
super.decl(tokens);
|
|
5227
|
+
}
|
|
5228
|
+
}
|
|
5229
|
+
doubleColon() {
|
|
5230
|
+
}
|
|
5231
|
+
endFile() {
|
|
5232
|
+
if (this.current.nodes && this.current.nodes.length) {
|
|
5233
|
+
this.current.raws.semicolon = this.semicolon;
|
|
5234
|
+
}
|
|
5235
|
+
this.current.raws.after = (this.current.raws.after || "") + this.spaces;
|
|
5236
|
+
while (this.current.parent) {
|
|
5237
|
+
this.current = this.current.parent;
|
|
5238
|
+
this.current.raws.after = "";
|
|
5239
|
+
}
|
|
5240
|
+
this.root.source.end = this.getPosition(this.tokenizer.position());
|
|
5241
|
+
}
|
|
5242
|
+
precheckMissedSemicolon(tokens) {
|
|
5243
|
+
let colon = this.colon(tokens);
|
|
5244
|
+
if (colon === false) return;
|
|
5245
|
+
let nextStart, prevEnd;
|
|
5246
|
+
for (nextStart = colon - 1; nextStart >= 0; nextStart--) {
|
|
5247
|
+
if (tokens[nextStart][0] === "word") break;
|
|
5248
|
+
}
|
|
5249
|
+
if (nextStart === 0 || nextStart < 0) return;
|
|
5250
|
+
for (prevEnd = nextStart - 1; prevEnd >= 0; prevEnd--) {
|
|
5251
|
+
if (tokens[prevEnd][0] !== "space") {
|
|
5252
|
+
prevEnd += 1;
|
|
5253
|
+
break;
|
|
5254
|
+
}
|
|
5255
|
+
}
|
|
5256
|
+
let other = tokens.slice(nextStart);
|
|
5257
|
+
let spaces = tokens.slice(prevEnd, nextStart);
|
|
5258
|
+
tokens.splice(prevEnd, tokens.length - prevEnd);
|
|
5259
|
+
this.spaces = spaces.map((i) => i[1]).join("");
|
|
5260
|
+
this.decl(other);
|
|
5261
|
+
}
|
|
5262
|
+
unclosedBracket() {
|
|
5263
|
+
}
|
|
5264
|
+
unexpectedClose() {
|
|
5265
|
+
this.current.raws.after += "}";
|
|
5266
|
+
}
|
|
5267
|
+
unknownWord(tokens) {
|
|
5268
|
+
this.spaces += tokens.map((i) => i[1]).join("");
|
|
5269
|
+
}
|
|
5270
|
+
unnamedAtrule(node2) {
|
|
5271
|
+
node2.name = "";
|
|
5272
|
+
}
|
|
5273
|
+
};
|
|
5274
|
+
var safeParser$1 = SafeParser$1;
|
|
5275
|
+
let { Input: Input2 } = require$$0;
|
|
5276
|
+
let SafeParser2 = safeParser$1;
|
|
5277
|
+
var safeParse = function safeParse2(css, opts) {
|
|
5278
|
+
let input2 = new Input2(css, opts);
|
|
5279
|
+
let parser2 = new SafeParser2(input2);
|
|
5280
|
+
parser2.parse();
|
|
5281
|
+
return parser2.root;
|
|
5282
|
+
};
|
|
5283
|
+
const safeParser = /* @__PURE__ */ getDefaultExportFromCjs(safeParse);
|
|
5107
5284
|
const tagMap = {
|
|
5108
5285
|
script: "noscript",
|
|
5109
5286
|
// camel case svg element tag names
|
|
@@ -5154,11 +5331,16 @@ function getTagName(n) {
|
|
|
5154
5331
|
function adaptCssForReplay(cssText, cache) {
|
|
5155
5332
|
const cachedStyle = cache == null ? void 0 : cache.stylesWithHoverClass.get(cssText);
|
|
5156
5333
|
if (cachedStyle) return cachedStyle;
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5334
|
+
let result2 = cssText;
|
|
5335
|
+
try {
|
|
5336
|
+
const ast = postcss$2([
|
|
5337
|
+
mediaSelectorPlugin,
|
|
5338
|
+
pseudoClassPlugin
|
|
5339
|
+
]).process(cssText, { parser: safeParser });
|
|
5340
|
+
result2 = ast.css;
|
|
5341
|
+
} catch (error) {
|
|
5342
|
+
console.warn("Failed to adapt css for replay", error);
|
|
5343
|
+
}
|
|
5162
5344
|
cache == null ? void 0 : cache.stylesWithHoverClass.set(cssText, result2);
|
|
5163
5345
|
return result2;
|
|
5164
5346
|
}
|