@everymatrix/general-footer-template 1.55.0 → 1.56.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/custom-clock.cjs.entry.js +2 -2
- package/dist/cjs/custom-content-section.cjs.entry.js +1418 -1564
- package/dist/cjs/general-footer-template.cjs.entry.js +1 -1
- package/dist/cjs/general-footer-template.cjs.js +2 -2
- package/dist/cjs/image-list.cjs.entry.js +1 -1
- package/dist/cjs/{index-d85e54c5.js → index-a7f717fa.js} +8 -42
- package/dist/cjs/link-section-list.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/esm/custom-clock.entry.js +2 -2
- package/dist/esm/custom-content-section.entry.js +1418 -1564
- package/dist/esm/general-footer-template.entry.js +1 -1
- package/dist/esm/general-footer-template.js +3 -3
- package/dist/esm/image-list.entry.js +1 -1
- package/dist/esm/{index-7f32a4a7.js → index-e6e68604.js} +8 -42
- package/dist/esm/link-section-list.entry.js +1 -1
- package/dist/esm/loader.js +2 -2
- package/dist/general-footer-template/general-footer-template.esm.js +1 -1
- package/dist/general-footer-template/{p-9aeab1ea.entry.js → p-076550c8.entry.js} +1 -1
- package/dist/general-footer-template/p-16bd4237.js +2 -0
- package/dist/general-footer-template/{p-122e0353.entry.js → p-2879096a.entry.js} +1 -1
- package/dist/general-footer-template/{p-cd14a119.entry.js → p-5f13c34b.entry.js} +2 -2
- package/dist/general-footer-template/{p-a6279430.entry.js → p-d7132f51.entry.js} +1 -1
- package/dist/general-footer-template/{p-f5a17365.entry.js → p-f12f5263.entry.js} +1 -1
- package/dist/types/stencil-public-runtime.d.ts +0 -6
- package/package.json +1 -1
- package/dist/general-footer-template/p-905acd21.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as registerInstance, h } from './index-
|
|
1
|
+
import { r as registerInstance, h } from './index-e6e68604.js';
|
|
2
2
|
import { c as commonjsGlobal, g as getAugmentedNamespace } from './_commonjsHelpers-57e89916.js';
|
|
3
3
|
|
|
4
4
|
var decode = {};
|
|
@@ -4005,7 +4005,7 @@ const esm = /*#__PURE__*/Object.freeze({
|
|
|
4005
4005
|
DomUtils: index
|
|
4006
4006
|
});
|
|
4007
4007
|
|
|
4008
|
-
const require$$0
|
|
4008
|
+
const require$$0 = /*@__PURE__*/getAugmentedNamespace(esm);
|
|
4009
4009
|
|
|
4010
4010
|
var escapeStringRegexp$1 = string => {
|
|
4011
4011
|
if (typeof string !== 'string') {
|
|
@@ -4588,70 +4588,37 @@ class CssSyntaxError$3 extends Error {
|
|
|
4588
4588
|
|
|
4589
4589
|
let css = this.source;
|
|
4590
4590
|
if (color == null) color = pico.isColorSupported;
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
let mark = text => text;
|
|
4594
|
-
let highlight = text => text;
|
|
4595
|
-
if (color) {
|
|
4596
|
-
let { bold, gray, red } = pico.createColors(true);
|
|
4597
|
-
mark = text => bold(red(text));
|
|
4598
|
-
aside = text => gray(text);
|
|
4599
|
-
if (terminalHighlight$1) {
|
|
4600
|
-
highlight = text => terminalHighlight$1(text);
|
|
4601
|
-
}
|
|
4591
|
+
if (terminalHighlight$1) {
|
|
4592
|
+
if (color) css = terminalHighlight$1(css);
|
|
4602
4593
|
}
|
|
4603
4594
|
|
|
4604
4595
|
let lines = css.split(/\r?\n/);
|
|
4605
4596
|
let start = Math.max(this.line - 3, 0);
|
|
4606
4597
|
let end = Math.min(this.line + 2, lines.length);
|
|
4598
|
+
|
|
4607
4599
|
let maxWidth = String(end).length;
|
|
4608
4600
|
|
|
4601
|
+
let mark, aside;
|
|
4602
|
+
if (color) {
|
|
4603
|
+
let { bold, gray, red } = pico.createColors(true);
|
|
4604
|
+
mark = text => bold(red(text));
|
|
4605
|
+
aside = text => gray(text);
|
|
4606
|
+
} else {
|
|
4607
|
+
mark = aside = str => str;
|
|
4608
|
+
}
|
|
4609
|
+
|
|
4609
4610
|
return lines
|
|
4610
4611
|
.slice(start, end)
|
|
4611
4612
|
.map((line, index) => {
|
|
4612
4613
|
let number = start + 1 + index;
|
|
4613
4614
|
let gutter = ' ' + (' ' + number).slice(-maxWidth) + ' | ';
|
|
4614
4615
|
if (number === this.line) {
|
|
4615
|
-
if (line.length > 160) {
|
|
4616
|
-
let padding = 20;
|
|
4617
|
-
let subLineStart = Math.max(0, this.column - padding);
|
|
4618
|
-
let subLineEnd = Math.max(
|
|
4619
|
-
this.column + padding,
|
|
4620
|
-
this.endColumn + padding
|
|
4621
|
-
);
|
|
4622
|
-
let subLine = line.slice(subLineStart, subLineEnd);
|
|
4623
|
-
|
|
4624
|
-
let spacing =
|
|
4625
|
-
aside(gutter.replace(/\d/g, ' ')) +
|
|
4626
|
-
line
|
|
4627
|
-
.slice(0, Math.min(this.column - 1, padding - 1))
|
|
4628
|
-
.replace(/[^\t]/g, ' ');
|
|
4629
|
-
|
|
4630
|
-
return (
|
|
4631
|
-
mark('>') +
|
|
4632
|
-
aside(gutter) +
|
|
4633
|
-
highlight(subLine) +
|
|
4634
|
-
'\n ' +
|
|
4635
|
-
spacing +
|
|
4636
|
-
mark('^')
|
|
4637
|
-
)
|
|
4638
|
-
}
|
|
4639
|
-
|
|
4640
4616
|
let spacing =
|
|
4641
4617
|
aside(gutter.replace(/\d/g, ' ')) +
|
|
4642
4618
|
line.slice(0, this.column - 1).replace(/[^\t]/g, ' ');
|
|
4643
|
-
|
|
4644
|
-
return (
|
|
4645
|
-
mark('>') +
|
|
4646
|
-
aside(gutter) +
|
|
4647
|
-
highlight(line) +
|
|
4648
|
-
'\n ' +
|
|
4649
|
-
spacing +
|
|
4650
|
-
mark('^')
|
|
4651
|
-
)
|
|
4619
|
+
return mark('>') + aside(gutter) + line + '\n ' + spacing + mark('^')
|
|
4652
4620
|
}
|
|
4653
|
-
|
|
4654
|
-
return ' ' + aside(gutter) + highlight(line)
|
|
4621
|
+
return ' ' + aside(gutter) + line
|
|
4655
4622
|
})
|
|
4656
4623
|
.join('\n')
|
|
4657
4624
|
}
|
|
@@ -4668,6 +4635,12 @@ class CssSyntaxError$3 extends Error {
|
|
|
4668
4635
|
var cssSyntaxError = CssSyntaxError$3;
|
|
4669
4636
|
CssSyntaxError$3.default = CssSyntaxError$3;
|
|
4670
4637
|
|
|
4638
|
+
var symbols = {};
|
|
4639
|
+
|
|
4640
|
+
symbols.isClean = Symbol('isClean');
|
|
4641
|
+
|
|
4642
|
+
symbols.my = Symbol('my');
|
|
4643
|
+
|
|
4671
4644
|
const DEFAULT_RAW = {
|
|
4672
4645
|
after: '\n',
|
|
4673
4646
|
beforeClose: '\n',
|
|
@@ -5030,16 +5003,10 @@ function stringify$4(node, builder) {
|
|
|
5030
5003
|
var stringify_1 = stringify$4;
|
|
5031
5004
|
stringify$4.default = stringify$4;
|
|
5032
5005
|
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
symbols.isClean = Symbol('isClean');
|
|
5036
|
-
|
|
5037
|
-
symbols.my = Symbol('my');
|
|
5038
|
-
|
|
5006
|
+
let { isClean: isClean$2, my: my$2 } = symbols;
|
|
5039
5007
|
let CssSyntaxError$2 = cssSyntaxError;
|
|
5040
5008
|
let Stringifier = stringifier;
|
|
5041
5009
|
let stringify$3 = stringify_1;
|
|
5042
|
-
let { isClean: isClean$2, my: my$2 } = symbols;
|
|
5043
5010
|
|
|
5044
5011
|
function cloneNode(obj, parent) {
|
|
5045
5012
|
let cloned = new obj.constructor();
|
|
@@ -5068,36 +5035,6 @@ function cloneNode(obj, parent) {
|
|
|
5068
5035
|
return cloned
|
|
5069
5036
|
}
|
|
5070
5037
|
|
|
5071
|
-
function sourceOffset(inputCSS, position) {
|
|
5072
|
-
// Not all custom syntaxes support `offset` in `source.start` and `source.end`
|
|
5073
|
-
if (
|
|
5074
|
-
position &&
|
|
5075
|
-
typeof position.offset !== 'undefined'
|
|
5076
|
-
) {
|
|
5077
|
-
return position.offset;
|
|
5078
|
-
}
|
|
5079
|
-
|
|
5080
|
-
let column = 1;
|
|
5081
|
-
let line = 1;
|
|
5082
|
-
let offset = 0;
|
|
5083
|
-
|
|
5084
|
-
for (let i = 0; i < inputCSS.length; i++) {
|
|
5085
|
-
if (line === position.line && column === position.column) {
|
|
5086
|
-
offset = i;
|
|
5087
|
-
break
|
|
5088
|
-
}
|
|
5089
|
-
|
|
5090
|
-
if (inputCSS[i] === '\n') {
|
|
5091
|
-
column = 1;
|
|
5092
|
-
line += 1;
|
|
5093
|
-
} else {
|
|
5094
|
-
column += 1;
|
|
5095
|
-
}
|
|
5096
|
-
}
|
|
5097
|
-
|
|
5098
|
-
return offset
|
|
5099
|
-
}
|
|
5100
|
-
|
|
5101
5038
|
class Node$4 {
|
|
5102
5039
|
constructor(defaults = {}) {
|
|
5103
5040
|
this.raws = {};
|
|
@@ -5219,11 +5156,6 @@ class Node$4 {
|
|
|
5219
5156
|
}
|
|
5220
5157
|
}
|
|
5221
5158
|
|
|
5222
|
-
/* c8 ignore next 3 */
|
|
5223
|
-
markClean() {
|
|
5224
|
-
this[isClean$2] = true;
|
|
5225
|
-
}
|
|
5226
|
-
|
|
5227
5159
|
markDirty() {
|
|
5228
5160
|
if (this[isClean$2]) {
|
|
5229
5161
|
this[isClean$2] = false;
|
|
@@ -5240,29 +5172,25 @@ class Node$4 {
|
|
|
5240
5172
|
return this.parent.nodes[index + 1]
|
|
5241
5173
|
}
|
|
5242
5174
|
|
|
5243
|
-
positionBy(opts) {
|
|
5175
|
+
positionBy(opts, stringRepresentation) {
|
|
5244
5176
|
let pos = this.source.start;
|
|
5245
5177
|
if (opts.index) {
|
|
5246
|
-
pos = this.positionInside(opts.index);
|
|
5178
|
+
pos = this.positionInside(opts.index, stringRepresentation);
|
|
5247
5179
|
} else if (opts.word) {
|
|
5248
|
-
|
|
5249
|
-
sourceOffset(this.source.input.css, this.source.start),
|
|
5250
|
-
sourceOffset(this.source.input.css, this.source.end)
|
|
5251
|
-
);
|
|
5180
|
+
stringRepresentation = this.toString();
|
|
5252
5181
|
let index = stringRepresentation.indexOf(opts.word);
|
|
5253
|
-
if (index !== -1) pos = this.positionInside(index);
|
|
5182
|
+
if (index !== -1) pos = this.positionInside(index, stringRepresentation);
|
|
5254
5183
|
}
|
|
5255
5184
|
return pos
|
|
5256
5185
|
}
|
|
5257
5186
|
|
|
5258
|
-
positionInside(index) {
|
|
5187
|
+
positionInside(index, stringRepresentation) {
|
|
5188
|
+
let string = stringRepresentation || this.toString();
|
|
5259
5189
|
let column = this.source.start.column;
|
|
5260
5190
|
let line = this.source.start.line;
|
|
5261
|
-
let offset = sourceOffset(this.source.input.css, this.source.start);
|
|
5262
|
-
let end = offset + index;
|
|
5263
5191
|
|
|
5264
|
-
for (let i =
|
|
5265
|
-
if (
|
|
5192
|
+
for (let i = 0; i < index; i++) {
|
|
5193
|
+
if (string[i] === '\n') {
|
|
5266
5194
|
column = 1;
|
|
5267
5195
|
line += 1;
|
|
5268
5196
|
} else {
|
|
@@ -5286,25 +5214,20 @@ class Node$4 {
|
|
|
5286
5214
|
};
|
|
5287
5215
|
let end = this.source.end
|
|
5288
5216
|
? {
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5217
|
+
column: this.source.end.column + 1,
|
|
5218
|
+
line: this.source.end.line
|
|
5219
|
+
}
|
|
5292
5220
|
: {
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
|
|
5221
|
+
column: start.column + 1,
|
|
5222
|
+
line: start.line
|
|
5223
|
+
};
|
|
5296
5224
|
|
|
5297
5225
|
if (opts.word) {
|
|
5298
|
-
let stringRepresentation = this.
|
|
5299
|
-
sourceOffset(this.source.input.css, this.source.start),
|
|
5300
|
-
sourceOffset(this.source.input.css, this.source.end)
|
|
5301
|
-
);
|
|
5226
|
+
let stringRepresentation = this.toString();
|
|
5302
5227
|
let index = stringRepresentation.indexOf(opts.word);
|
|
5303
5228
|
if (index !== -1) {
|
|
5304
|
-
start = this.positionInside(index);
|
|
5305
|
-
end = this.positionInside(
|
|
5306
|
-
index + opts.word.length,
|
|
5307
|
-
);
|
|
5229
|
+
start = this.positionInside(index, stringRepresentation);
|
|
5230
|
+
end = this.positionInside(index + opts.word.length, stringRepresentation);
|
|
5308
5231
|
}
|
|
5309
5232
|
} else {
|
|
5310
5233
|
if (opts.start) {
|
|
@@ -5321,7 +5244,7 @@ class Node$4 {
|
|
|
5321
5244
|
column: opts.end.column,
|
|
5322
5245
|
line: opts.end.line
|
|
5323
5246
|
};
|
|
5324
|
-
} else if (
|
|
5247
|
+
} else if (opts.endIndex) {
|
|
5325
5248
|
end = this.positionInside(opts.endIndex);
|
|
5326
5249
|
} else if (opts.index) {
|
|
5327
5250
|
end = this.positionInside(opts.index + 1);
|
|
@@ -5462,19 +5385,7 @@ Node$4.default = Node$4;
|
|
|
5462
5385
|
|
|
5463
5386
|
let Node$3 = node_1;
|
|
5464
5387
|
|
|
5465
|
-
class
|
|
5466
|
-
constructor(defaults) {
|
|
5467
|
-
super(defaults);
|
|
5468
|
-
this.type = 'comment';
|
|
5469
|
-
}
|
|
5470
|
-
}
|
|
5471
|
-
|
|
5472
|
-
var comment = Comment$4;
|
|
5473
|
-
Comment$4.default = Comment$4;
|
|
5474
|
-
|
|
5475
|
-
let Node$2 = node_1;
|
|
5476
|
-
|
|
5477
|
-
class Declaration$4 extends Node$2 {
|
|
5388
|
+
class Declaration$4 extends Node$3 {
|
|
5478
5389
|
constructor(defaults) {
|
|
5479
5390
|
if (
|
|
5480
5391
|
defaults &&
|
|
@@ -5495,1488 +5406,1353 @@ class Declaration$4 extends Node$2 {
|
|
|
5495
5406
|
var declaration = Declaration$4;
|
|
5496
5407
|
Declaration$4.default = Declaration$4;
|
|
5497
5408
|
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
5409
|
+
// This alphabet uses `A-Za-z0-9_-` symbols.
|
|
5410
|
+
// The order of characters is optimized for better gzip and brotli compression.
|
|
5411
|
+
// References to the same file (works both for gzip and brotli):
|
|
5412
|
+
// `'use`, `andom`, and `rict'`
|
|
5413
|
+
// References to the brotli default dictionary:
|
|
5414
|
+
// `-26T`, `1983`, `40px`, `75px`, `bush`, `jack`, `mind`, `very`, and `wolf`
|
|
5415
|
+
let urlAlphabet =
|
|
5416
|
+
'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';
|
|
5502
5417
|
|
|
5503
|
-
let
|
|
5418
|
+
let customAlphabet = (alphabet, defaultSize = 21) => {
|
|
5419
|
+
return (size = defaultSize) => {
|
|
5420
|
+
let id = '';
|
|
5421
|
+
// A compact alternative for `for (var i = 0; i < step; i++)`.
|
|
5422
|
+
let i = size | 0;
|
|
5423
|
+
while (i--) {
|
|
5424
|
+
// `| 0` is more compact and faster than `Math.floor()`.
|
|
5425
|
+
id += alphabet[(Math.random() * alphabet.length) | 0];
|
|
5426
|
+
}
|
|
5427
|
+
return id
|
|
5428
|
+
}
|
|
5429
|
+
};
|
|
5504
5430
|
|
|
5505
|
-
|
|
5506
|
-
|
|
5507
|
-
|
|
5508
|
-
|
|
5509
|
-
|
|
5510
|
-
|
|
5511
|
-
|
|
5431
|
+
let nanoid$1 = (size = 21) => {
|
|
5432
|
+
let id = '';
|
|
5433
|
+
// A compact alternative for `for (var i = 0; i < step; i++)`.
|
|
5434
|
+
let i = size | 0;
|
|
5435
|
+
while (i--) {
|
|
5436
|
+
// `| 0` is more compact and faster than `Math.floor()`.
|
|
5437
|
+
id += urlAlphabet[(Math.random() * 64) | 0];
|
|
5438
|
+
}
|
|
5439
|
+
return id
|
|
5440
|
+
};
|
|
5512
5441
|
|
|
5513
|
-
|
|
5514
|
-
|
|
5515
|
-
|
|
5516
|
-
|
|
5517
|
-
|
|
5518
|
-
|
|
5442
|
+
const nonSecure = /*#__PURE__*/Object.freeze({
|
|
5443
|
+
__proto__: null,
|
|
5444
|
+
nanoid: nanoid$1,
|
|
5445
|
+
customAlphabet: customAlphabet
|
|
5446
|
+
});
|
|
5447
|
+
|
|
5448
|
+
const require$$3 = /*@__PURE__*/getAugmentedNamespace(nonSecure);
|
|
5449
|
+
|
|
5450
|
+
let { SourceMapConsumer: SourceMapConsumer$2, SourceMapGenerator: SourceMapGenerator$2 } = require$$2;
|
|
5451
|
+
let { existsSync, readFileSync } = require$$2;
|
|
5452
|
+
let { dirname: dirname$1, join } = require$$2;
|
|
5453
|
+
|
|
5454
|
+
function fromBase64(str) {
|
|
5455
|
+
if (Buffer) {
|
|
5456
|
+
return Buffer.from(str, 'base64').toString()
|
|
5457
|
+
} else {
|
|
5458
|
+
/* c8 ignore next 2 */
|
|
5459
|
+
return window.atob(str)
|
|
5519
5460
|
}
|
|
5520
5461
|
}
|
|
5521
5462
|
|
|
5522
|
-
class
|
|
5523
|
-
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
}
|
|
5528
|
-
|
|
5529
|
-
this.markDirty();
|
|
5463
|
+
class PreviousMap$2 {
|
|
5464
|
+
constructor(css, opts) {
|
|
5465
|
+
if (opts.map === false) return
|
|
5466
|
+
this.loadAnnotation(css);
|
|
5467
|
+
this.inline = this.startWith(this.annotation, 'data:');
|
|
5530
5468
|
|
|
5531
|
-
|
|
5469
|
+
let prev = opts.map ? opts.map.prev : undefined;
|
|
5470
|
+
let text = this.loadMap(opts.from, prev);
|
|
5471
|
+
if (!this.mapFile && opts.from) {
|
|
5472
|
+
this.mapFile = opts.from;
|
|
5473
|
+
}
|
|
5474
|
+
if (this.mapFile) this.root = dirname$1(this.mapFile);
|
|
5475
|
+
if (text) this.text = text;
|
|
5532
5476
|
}
|
|
5533
5477
|
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
for (let node of this.nodes) node.cleanRaws(keepBetween);
|
|
5478
|
+
consumer() {
|
|
5479
|
+
if (!this.consumerCache) {
|
|
5480
|
+
this.consumerCache = new SourceMapConsumer$2(this.text);
|
|
5538
5481
|
}
|
|
5482
|
+
return this.consumerCache
|
|
5539
5483
|
}
|
|
5540
5484
|
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
let
|
|
5485
|
+
decodeInline(text) {
|
|
5486
|
+
let baseCharsetUri = /^data:application\/json;charset=utf-?8;base64,/;
|
|
5487
|
+
let baseUri = /^data:application\/json;base64,/;
|
|
5488
|
+
let charsetUri = /^data:application\/json;charset=utf-?8,/;
|
|
5489
|
+
let uri = /^data:application\/json,/;
|
|
5544
5490
|
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
result = callback(this.proxyOf.nodes[index], index);
|
|
5549
|
-
if (result === false) break
|
|
5491
|
+
if (charsetUri.test(text) || uri.test(text)) {
|
|
5492
|
+
return decodeURIComponent(text.substr(RegExp.lastMatch.length))
|
|
5493
|
+
}
|
|
5550
5494
|
|
|
5551
|
-
|
|
5495
|
+
if (baseCharsetUri.test(text) || baseUri.test(text)) {
|
|
5496
|
+
return fromBase64(text.substr(RegExp.lastMatch.length))
|
|
5552
5497
|
}
|
|
5553
5498
|
|
|
5554
|
-
|
|
5555
|
-
|
|
5499
|
+
let encoding = text.match(/data:application\/json;([^,]+),/)[1];
|
|
5500
|
+
throw new Error('Unsupported source map encoding ' + encoding)
|
|
5556
5501
|
}
|
|
5557
5502
|
|
|
5558
|
-
|
|
5559
|
-
return
|
|
5503
|
+
getAnnotationURL(sourceMapString) {
|
|
5504
|
+
return sourceMapString.replace(/^\/\*\s*# sourceMappingURL=/, '').trim()
|
|
5560
5505
|
}
|
|
5561
5506
|
|
|
5562
|
-
|
|
5563
|
-
if (
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
return iterator
|
|
5507
|
+
isMap(map) {
|
|
5508
|
+
if (typeof map !== 'object') return false
|
|
5509
|
+
return (
|
|
5510
|
+
typeof map.mappings === 'string' ||
|
|
5511
|
+
typeof map._mappings === 'string' ||
|
|
5512
|
+
Array.isArray(map.sections)
|
|
5513
|
+
)
|
|
5571
5514
|
}
|
|
5572
5515
|
|
|
5573
|
-
|
|
5574
|
-
|
|
5575
|
-
|
|
5576
|
-
if (prop === 'proxyOf') {
|
|
5577
|
-
return node
|
|
5578
|
-
} else if (!node[prop]) {
|
|
5579
|
-
return node[prop]
|
|
5580
|
-
} else if (
|
|
5581
|
-
prop === 'each' ||
|
|
5582
|
-
(typeof prop === 'string' && prop.startsWith('walk'))
|
|
5583
|
-
) {
|
|
5584
|
-
return (...args) => {
|
|
5585
|
-
return node[prop](
|
|
5586
|
-
...args.map(i => {
|
|
5587
|
-
if (typeof i === 'function') {
|
|
5588
|
-
return (child, index) => i(child.toProxy(), index)
|
|
5589
|
-
} else {
|
|
5590
|
-
return i
|
|
5591
|
-
}
|
|
5592
|
-
})
|
|
5593
|
-
)
|
|
5594
|
-
}
|
|
5595
|
-
} else if (prop === 'every' || prop === 'some') {
|
|
5596
|
-
return cb => {
|
|
5597
|
-
return node[prop]((child, ...other) =>
|
|
5598
|
-
cb(child.toProxy(), ...other)
|
|
5599
|
-
)
|
|
5600
|
-
}
|
|
5601
|
-
} else if (prop === 'root') {
|
|
5602
|
-
return () => node.root().toProxy()
|
|
5603
|
-
} else if (prop === 'nodes') {
|
|
5604
|
-
return node.nodes.map(i => i.toProxy())
|
|
5605
|
-
} else if (prop === 'first' || prop === 'last') {
|
|
5606
|
-
return node[prop].toProxy()
|
|
5607
|
-
} else {
|
|
5608
|
-
return node[prop]
|
|
5609
|
-
}
|
|
5610
|
-
},
|
|
5516
|
+
loadAnnotation(css) {
|
|
5517
|
+
let comments = css.match(/\/\*\s*# sourceMappingURL=/gm);
|
|
5518
|
+
if (!comments) return
|
|
5611
5519
|
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
5618
|
-
|
|
5619
|
-
}
|
|
5520
|
+
// sourceMappingURLs from comments, strings, etc.
|
|
5521
|
+
let start = css.lastIndexOf(comments.pop());
|
|
5522
|
+
let end = css.indexOf('*/', start);
|
|
5523
|
+
|
|
5524
|
+
if (start > -1 && end > -1) {
|
|
5525
|
+
// Locate the last sourceMappingURL to avoid pickin
|
|
5526
|
+
this.annotation = this.getAnnotationURL(css.substring(start, end));
|
|
5620
5527
|
}
|
|
5621
5528
|
}
|
|
5622
5529
|
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
if (
|
|
5626
|
-
|
|
5530
|
+
loadFile(path) {
|
|
5531
|
+
this.root = dirname$1(path);
|
|
5532
|
+
if (existsSync(path)) {
|
|
5533
|
+
this.mapFile = path;
|
|
5534
|
+
return readFileSync(path, 'utf-8').toString().trim()
|
|
5535
|
+
}
|
|
5627
5536
|
}
|
|
5628
5537
|
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
let nodes = this.normalize(add, this.proxyOf.nodes[existIndex]).reverse();
|
|
5632
|
-
existIndex = this.index(exist);
|
|
5633
|
-
for (let node of nodes) this.proxyOf.nodes.splice(existIndex + 1, 0, node);
|
|
5538
|
+
loadMap(file, prev) {
|
|
5539
|
+
if (prev === false) return false
|
|
5634
5540
|
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
|
|
5638
|
-
if (
|
|
5639
|
-
|
|
5640
|
-
|
|
5641
|
-
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
|
|
5645
|
-
|
|
5646
|
-
|
|
5647
|
-
|
|
5648
|
-
insertBefore(exist, add) {
|
|
5649
|
-
let existIndex = this.index(exist);
|
|
5650
|
-
let type = existIndex === 0 ? 'prepend' : false;
|
|
5651
|
-
let nodes = this.normalize(
|
|
5652
|
-
add,
|
|
5653
|
-
this.proxyOf.nodes[existIndex],
|
|
5654
|
-
type
|
|
5655
|
-
).reverse();
|
|
5656
|
-
existIndex = this.index(exist);
|
|
5657
|
-
for (let node of nodes) this.proxyOf.nodes.splice(existIndex, 0, node);
|
|
5658
|
-
|
|
5659
|
-
let index;
|
|
5660
|
-
for (let id in this.indexes) {
|
|
5661
|
-
index = this.indexes[id];
|
|
5662
|
-
if (existIndex <= index) {
|
|
5663
|
-
this.indexes[id] = index + nodes.length;
|
|
5664
|
-
}
|
|
5665
|
-
}
|
|
5666
|
-
|
|
5667
|
-
this.markDirty();
|
|
5668
|
-
|
|
5669
|
-
return this
|
|
5670
|
-
}
|
|
5671
|
-
|
|
5672
|
-
normalize(nodes, sample) {
|
|
5673
|
-
if (typeof nodes === 'string') {
|
|
5674
|
-
nodes = cleanSource(parse$4(nodes).nodes);
|
|
5675
|
-
} else if (typeof nodes === 'undefined') {
|
|
5676
|
-
nodes = [];
|
|
5677
|
-
} else if (Array.isArray(nodes)) {
|
|
5678
|
-
nodes = nodes.slice(0);
|
|
5679
|
-
for (let i of nodes) {
|
|
5680
|
-
if (i.parent) i.parent.removeChild(i, 'ignore');
|
|
5681
|
-
}
|
|
5682
|
-
} else if (nodes.type === 'root' && this.type !== 'document') {
|
|
5683
|
-
nodes = nodes.nodes.slice(0);
|
|
5684
|
-
for (let i of nodes) {
|
|
5685
|
-
if (i.parent) i.parent.removeChild(i, 'ignore');
|
|
5686
|
-
}
|
|
5687
|
-
} else if (nodes.type) {
|
|
5688
|
-
nodes = [nodes];
|
|
5689
|
-
} else if (nodes.prop) {
|
|
5690
|
-
if (typeof nodes.value === 'undefined') {
|
|
5691
|
-
throw new Error('Value field is missed in node creation')
|
|
5692
|
-
} else if (typeof nodes.value !== 'string') {
|
|
5693
|
-
nodes.value = String(nodes.value);
|
|
5694
|
-
}
|
|
5695
|
-
nodes = [new Declaration$3(nodes)];
|
|
5696
|
-
} else if (nodes.selector || nodes.selectors) {
|
|
5697
|
-
nodes = [new Rule$4(nodes)];
|
|
5698
|
-
} else if (nodes.name) {
|
|
5699
|
-
nodes = [new AtRule$4(nodes)];
|
|
5700
|
-
} else if (nodes.text) {
|
|
5701
|
-
nodes = [new Comment$3(nodes)];
|
|
5702
|
-
} else {
|
|
5703
|
-
throw new Error('Unknown node type in node creation')
|
|
5704
|
-
}
|
|
5705
|
-
|
|
5706
|
-
let processed = nodes.map(i => {
|
|
5707
|
-
/* c8 ignore next */
|
|
5708
|
-
if (!i[my$1]) Container$7.rebuild(i);
|
|
5709
|
-
i = i.proxyOf;
|
|
5710
|
-
if (i.parent) i.parent.removeChild(i);
|
|
5711
|
-
if (i[isClean$1]) markTreeDirty(i);
|
|
5712
|
-
|
|
5713
|
-
if (!i.raws) i.raws = {};
|
|
5714
|
-
if (typeof i.raws.before === 'undefined') {
|
|
5715
|
-
if (sample && typeof sample.raws.before !== 'undefined') {
|
|
5716
|
-
i.raws.before = sample.raws.before.replace(/\S/g, '');
|
|
5717
|
-
}
|
|
5718
|
-
}
|
|
5719
|
-
i.parent = this.proxyOf;
|
|
5720
|
-
return i
|
|
5721
|
-
});
|
|
5722
|
-
|
|
5723
|
-
return processed
|
|
5724
|
-
}
|
|
5725
|
-
|
|
5726
|
-
prepend(...children) {
|
|
5727
|
-
children = children.reverse();
|
|
5728
|
-
for (let child of children) {
|
|
5729
|
-
let nodes = this.normalize(child, this.first, 'prepend').reverse();
|
|
5730
|
-
for (let node of nodes) this.proxyOf.nodes.unshift(node);
|
|
5731
|
-
for (let id in this.indexes) {
|
|
5732
|
-
this.indexes[id] = this.indexes[id] + nodes.length;
|
|
5733
|
-
}
|
|
5734
|
-
}
|
|
5735
|
-
|
|
5736
|
-
this.markDirty();
|
|
5737
|
-
|
|
5738
|
-
return this
|
|
5739
|
-
}
|
|
5740
|
-
|
|
5741
|
-
push(child) {
|
|
5742
|
-
child.parent = this;
|
|
5743
|
-
this.proxyOf.nodes.push(child);
|
|
5744
|
-
return this
|
|
5745
|
-
}
|
|
5746
|
-
|
|
5747
|
-
removeAll() {
|
|
5748
|
-
for (let node of this.proxyOf.nodes) node.parent = undefined;
|
|
5749
|
-
this.proxyOf.nodes = [];
|
|
5750
|
-
|
|
5751
|
-
this.markDirty();
|
|
5752
|
-
|
|
5753
|
-
return this
|
|
5754
|
-
}
|
|
5755
|
-
|
|
5756
|
-
removeChild(child) {
|
|
5757
|
-
child = this.index(child);
|
|
5758
|
-
this.proxyOf.nodes[child].parent = undefined;
|
|
5759
|
-
this.proxyOf.nodes.splice(child, 1);
|
|
5760
|
-
|
|
5761
|
-
let index;
|
|
5762
|
-
for (let id in this.indexes) {
|
|
5763
|
-
index = this.indexes[id];
|
|
5764
|
-
if (index >= child) {
|
|
5765
|
-
this.indexes[id] = index - 1;
|
|
5766
|
-
}
|
|
5767
|
-
}
|
|
5768
|
-
|
|
5769
|
-
this.markDirty();
|
|
5770
|
-
|
|
5771
|
-
return this
|
|
5772
|
-
}
|
|
5773
|
-
|
|
5774
|
-
replaceValues(pattern, opts, callback) {
|
|
5775
|
-
if (!callback) {
|
|
5776
|
-
callback = opts;
|
|
5777
|
-
opts = {};
|
|
5778
|
-
}
|
|
5779
|
-
|
|
5780
|
-
this.walkDecls(decl => {
|
|
5781
|
-
if (opts.props && !opts.props.includes(decl.prop)) return
|
|
5782
|
-
if (opts.fast && !decl.value.includes(opts.fast)) return
|
|
5783
|
-
|
|
5784
|
-
decl.value = decl.value.replace(pattern, callback);
|
|
5785
|
-
});
|
|
5786
|
-
|
|
5787
|
-
this.markDirty();
|
|
5788
|
-
|
|
5789
|
-
return this
|
|
5790
|
-
}
|
|
5791
|
-
|
|
5792
|
-
some(condition) {
|
|
5793
|
-
return this.nodes.some(condition)
|
|
5794
|
-
}
|
|
5795
|
-
|
|
5796
|
-
walk(callback) {
|
|
5797
|
-
return this.each((child, i) => {
|
|
5798
|
-
let result;
|
|
5799
|
-
try {
|
|
5800
|
-
result = callback(child, i);
|
|
5801
|
-
} catch (e) {
|
|
5802
|
-
throw child.addToError(e)
|
|
5803
|
-
}
|
|
5804
|
-
if (result !== false && child.walk) {
|
|
5805
|
-
result = child.walk(callback);
|
|
5806
|
-
}
|
|
5807
|
-
|
|
5808
|
-
return result
|
|
5809
|
-
})
|
|
5810
|
-
}
|
|
5811
|
-
|
|
5812
|
-
walkAtRules(name, callback) {
|
|
5813
|
-
if (!callback) {
|
|
5814
|
-
callback = name;
|
|
5815
|
-
return this.walk((child, i) => {
|
|
5816
|
-
if (child.type === 'atrule') {
|
|
5817
|
-
return callback(child, i)
|
|
5818
|
-
}
|
|
5819
|
-
})
|
|
5820
|
-
}
|
|
5821
|
-
if (name instanceof RegExp) {
|
|
5822
|
-
return this.walk((child, i) => {
|
|
5823
|
-
if (child.type === 'atrule' && name.test(child.name)) {
|
|
5824
|
-
return callback(child, i)
|
|
5825
|
-
}
|
|
5826
|
-
})
|
|
5827
|
-
}
|
|
5828
|
-
return this.walk((child, i) => {
|
|
5829
|
-
if (child.type === 'atrule' && child.name === name) {
|
|
5830
|
-
return callback(child, i)
|
|
5831
|
-
}
|
|
5832
|
-
})
|
|
5833
|
-
}
|
|
5834
|
-
|
|
5835
|
-
walkComments(callback) {
|
|
5836
|
-
return this.walk((child, i) => {
|
|
5837
|
-
if (child.type === 'comment') {
|
|
5838
|
-
return callback(child, i)
|
|
5839
|
-
}
|
|
5840
|
-
})
|
|
5841
|
-
}
|
|
5842
|
-
|
|
5843
|
-
walkDecls(prop, callback) {
|
|
5844
|
-
if (!callback) {
|
|
5845
|
-
callback = prop;
|
|
5846
|
-
return this.walk((child, i) => {
|
|
5847
|
-
if (child.type === 'decl') {
|
|
5848
|
-
return callback(child, i)
|
|
5849
|
-
}
|
|
5850
|
-
})
|
|
5851
|
-
}
|
|
5852
|
-
if (prop instanceof RegExp) {
|
|
5853
|
-
return this.walk((child, i) => {
|
|
5854
|
-
if (child.type === 'decl' && prop.test(child.prop)) {
|
|
5855
|
-
return callback(child, i)
|
|
5541
|
+
if (prev) {
|
|
5542
|
+
if (typeof prev === 'string') {
|
|
5543
|
+
return prev
|
|
5544
|
+
} else if (typeof prev === 'function') {
|
|
5545
|
+
let prevPath = prev(file);
|
|
5546
|
+
if (prevPath) {
|
|
5547
|
+
let map = this.loadFile(prevPath);
|
|
5548
|
+
if (!map) {
|
|
5549
|
+
throw new Error(
|
|
5550
|
+
'Unable to load previous source map: ' + prevPath.toString()
|
|
5551
|
+
)
|
|
5552
|
+
}
|
|
5553
|
+
return map
|
|
5856
5554
|
}
|
|
5857
|
-
})
|
|
5858
|
-
|
|
5859
|
-
|
|
5860
|
-
|
|
5861
|
-
|
|
5555
|
+
} else if (prev instanceof SourceMapConsumer$2) {
|
|
5556
|
+
return SourceMapGenerator$2.fromSourceMap(prev).toString()
|
|
5557
|
+
} else if (prev instanceof SourceMapGenerator$2) {
|
|
5558
|
+
return prev.toString()
|
|
5559
|
+
} else if (this.isMap(prev)) {
|
|
5560
|
+
return JSON.stringify(prev)
|
|
5561
|
+
} else {
|
|
5562
|
+
throw new Error(
|
|
5563
|
+
'Unsupported previous source map format: ' + prev.toString()
|
|
5564
|
+
)
|
|
5862
5565
|
}
|
|
5863
|
-
})
|
|
5864
|
-
|
|
5865
|
-
|
|
5866
|
-
|
|
5867
|
-
|
|
5868
|
-
|
|
5869
|
-
|
|
5870
|
-
return this.walk((child, i) => {
|
|
5871
|
-
if (child.type === 'rule') {
|
|
5872
|
-
return callback(child, i)
|
|
5873
|
-
}
|
|
5874
|
-
})
|
|
5875
|
-
}
|
|
5876
|
-
if (selector instanceof RegExp) {
|
|
5877
|
-
return this.walk((child, i) => {
|
|
5878
|
-
if (child.type === 'rule' && selector.test(child.selector)) {
|
|
5879
|
-
return callback(child, i)
|
|
5880
|
-
}
|
|
5881
|
-
})
|
|
5566
|
+
} else if (this.inline) {
|
|
5567
|
+
return this.decodeInline(this.annotation)
|
|
5568
|
+
} else if (this.annotation) {
|
|
5569
|
+
let map = this.annotation;
|
|
5570
|
+
if (file) map = join(dirname$1(file), map);
|
|
5571
|
+
return this.loadFile(map)
|
|
5882
5572
|
}
|
|
5883
|
-
return this.walk((child, i) => {
|
|
5884
|
-
if (child.type === 'rule' && child.selector === selector) {
|
|
5885
|
-
return callback(child, i)
|
|
5886
|
-
}
|
|
5887
|
-
})
|
|
5888
5573
|
}
|
|
5889
5574
|
|
|
5890
|
-
|
|
5891
|
-
if (!
|
|
5892
|
-
return
|
|
5575
|
+
startWith(string, start) {
|
|
5576
|
+
if (!string) return false
|
|
5577
|
+
return string.substr(0, start.length) === start
|
|
5893
5578
|
}
|
|
5894
5579
|
|
|
5895
|
-
|
|
5896
|
-
|
|
5897
|
-
|
|
5580
|
+
withContent() {
|
|
5581
|
+
return !!(
|
|
5582
|
+
this.consumer().sourcesContent &&
|
|
5583
|
+
this.consumer().sourcesContent.length > 0
|
|
5584
|
+
)
|
|
5898
5585
|
}
|
|
5899
5586
|
}
|
|
5900
5587
|
|
|
5901
|
-
|
|
5902
|
-
|
|
5903
|
-
};
|
|
5904
|
-
|
|
5905
|
-
Container$7.registerRule = dependant => {
|
|
5906
|
-
Rule$4 = dependant;
|
|
5907
|
-
};
|
|
5908
|
-
|
|
5909
|
-
Container$7.registerAtRule = dependant => {
|
|
5910
|
-
AtRule$4 = dependant;
|
|
5911
|
-
};
|
|
5912
|
-
|
|
5913
|
-
Container$7.registerRoot = dependant => {
|
|
5914
|
-
Root$6 = dependant;
|
|
5915
|
-
};
|
|
5916
|
-
|
|
5917
|
-
var container = Container$7;
|
|
5918
|
-
Container$7.default = Container$7;
|
|
5919
|
-
|
|
5920
|
-
/* c8 ignore start */
|
|
5921
|
-
Container$7.rebuild = node => {
|
|
5922
|
-
if (node.type === 'atrule') {
|
|
5923
|
-
Object.setPrototypeOf(node, AtRule$4.prototype);
|
|
5924
|
-
} else if (node.type === 'rule') {
|
|
5925
|
-
Object.setPrototypeOf(node, Rule$4.prototype);
|
|
5926
|
-
} else if (node.type === 'decl') {
|
|
5927
|
-
Object.setPrototypeOf(node, Declaration$3.prototype);
|
|
5928
|
-
} else if (node.type === 'comment') {
|
|
5929
|
-
Object.setPrototypeOf(node, Comment$3.prototype);
|
|
5930
|
-
} else if (node.type === 'root') {
|
|
5931
|
-
Object.setPrototypeOf(node, Root$6.prototype);
|
|
5932
|
-
}
|
|
5933
|
-
|
|
5934
|
-
node[my$1] = true;
|
|
5935
|
-
|
|
5936
|
-
if (node.nodes) {
|
|
5937
|
-
node.nodes.forEach(child => {
|
|
5938
|
-
Container$7.rebuild(child);
|
|
5939
|
-
});
|
|
5940
|
-
}
|
|
5941
|
-
};
|
|
5942
|
-
|
|
5943
|
-
let Container$6 = container;
|
|
5944
|
-
|
|
5945
|
-
class AtRule$3 extends Container$6 {
|
|
5946
|
-
constructor(defaults) {
|
|
5947
|
-
super(defaults);
|
|
5948
|
-
this.type = 'atrule';
|
|
5949
|
-
}
|
|
5588
|
+
var previousMap = PreviousMap$2;
|
|
5589
|
+
PreviousMap$2.default = PreviousMap$2;
|
|
5950
5590
|
|
|
5951
|
-
|
|
5952
|
-
|
|
5953
|
-
|
|
5954
|
-
|
|
5591
|
+
let { SourceMapConsumer: SourceMapConsumer$1, SourceMapGenerator: SourceMapGenerator$1 } = require$$2;
|
|
5592
|
+
let { fileURLToPath, pathToFileURL: pathToFileURL$1 } = require$$2;
|
|
5593
|
+
let { isAbsolute, resolve: resolve$1 } = require$$2;
|
|
5594
|
+
let { nanoid } = require$$3;
|
|
5955
5595
|
|
|
5956
|
-
|
|
5957
|
-
|
|
5958
|
-
|
|
5959
|
-
}
|
|
5960
|
-
}
|
|
5596
|
+
let terminalHighlight = require$$2;
|
|
5597
|
+
let CssSyntaxError$1 = cssSyntaxError;
|
|
5598
|
+
let PreviousMap$1 = previousMap;
|
|
5961
5599
|
|
|
5962
|
-
|
|
5963
|
-
AtRule$3.default = AtRule$3;
|
|
5600
|
+
let fromOffsetCache = Symbol('fromOffsetCache');
|
|
5964
5601
|
|
|
5965
|
-
|
|
5602
|
+
let sourceMapAvailable$1 = Boolean(SourceMapConsumer$1 && SourceMapGenerator$1);
|
|
5603
|
+
let pathAvailable$1 = Boolean(resolve$1 && isAbsolute);
|
|
5966
5604
|
|
|
5967
|
-
|
|
5605
|
+
class Input$4 {
|
|
5606
|
+
constructor(css, opts = {}) {
|
|
5607
|
+
if (
|
|
5608
|
+
css === null ||
|
|
5609
|
+
typeof css === 'undefined' ||
|
|
5610
|
+
(typeof css === 'object' && !css.toString)
|
|
5611
|
+
) {
|
|
5612
|
+
throw new Error(`PostCSS received ${css} instead of CSS string`)
|
|
5613
|
+
}
|
|
5968
5614
|
|
|
5969
|
-
|
|
5615
|
+
this.css = css.toString();
|
|
5970
5616
|
|
|
5971
|
-
|
|
5972
|
-
|
|
5973
|
-
|
|
5974
|
-
|
|
5617
|
+
if (this.css[0] === '\uFEFF' || this.css[0] === '\uFFFE') {
|
|
5618
|
+
this.hasBOM = true;
|
|
5619
|
+
this.css = this.css.slice(1);
|
|
5620
|
+
} else {
|
|
5621
|
+
this.hasBOM = false;
|
|
5622
|
+
}
|
|
5975
5623
|
|
|
5976
|
-
if (
|
|
5977
|
-
|
|
5624
|
+
if (opts.from) {
|
|
5625
|
+
if (
|
|
5626
|
+
!pathAvailable$1 ||
|
|
5627
|
+
/^\w+:\/\//.test(opts.from) ||
|
|
5628
|
+
isAbsolute(opts.from)
|
|
5629
|
+
) {
|
|
5630
|
+
this.file = opts.from;
|
|
5631
|
+
} else {
|
|
5632
|
+
this.file = resolve$1(opts.from);
|
|
5633
|
+
}
|
|
5978
5634
|
}
|
|
5979
|
-
}
|
|
5980
5635
|
|
|
5981
|
-
|
|
5982
|
-
|
|
5636
|
+
if (pathAvailable$1 && sourceMapAvailable$1) {
|
|
5637
|
+
let map = new PreviousMap$1(this.css, opts);
|
|
5638
|
+
if (map.text) {
|
|
5639
|
+
this.map = map;
|
|
5640
|
+
let file = map.consumer().file;
|
|
5641
|
+
if (!this.file && file) this.file = this.mapResolve(file);
|
|
5642
|
+
}
|
|
5643
|
+
}
|
|
5983
5644
|
|
|
5984
|
-
|
|
5645
|
+
if (!this.file) {
|
|
5646
|
+
this.id = '<input css ' + nanoid(6) + '>';
|
|
5647
|
+
}
|
|
5648
|
+
if (this.map) this.map.file = this.from;
|
|
5985
5649
|
}
|
|
5986
|
-
}
|
|
5987
5650
|
|
|
5988
|
-
|
|
5989
|
-
|
|
5990
|
-
};
|
|
5651
|
+
error(message, line, column, opts = {}) {
|
|
5652
|
+
let result, endLine, endColumn;
|
|
5991
5653
|
|
|
5992
|
-
|
|
5993
|
-
|
|
5994
|
-
|
|
5654
|
+
if (line && typeof line === 'object') {
|
|
5655
|
+
let start = line;
|
|
5656
|
+
let end = column;
|
|
5657
|
+
if (typeof start.offset === 'number') {
|
|
5658
|
+
let pos = this.fromOffset(start.offset);
|
|
5659
|
+
line = pos.line;
|
|
5660
|
+
column = pos.col;
|
|
5661
|
+
} else {
|
|
5662
|
+
line = start.line;
|
|
5663
|
+
column = start.column;
|
|
5664
|
+
}
|
|
5665
|
+
if (typeof end.offset === 'number') {
|
|
5666
|
+
let pos = this.fromOffset(end.offset);
|
|
5667
|
+
endLine = pos.line;
|
|
5668
|
+
endColumn = pos.col;
|
|
5669
|
+
} else {
|
|
5670
|
+
endLine = end.line;
|
|
5671
|
+
endColumn = end.column;
|
|
5672
|
+
}
|
|
5673
|
+
} else if (!column) {
|
|
5674
|
+
let pos = this.fromOffset(line);
|
|
5675
|
+
line = pos.line;
|
|
5676
|
+
column = pos.col;
|
|
5677
|
+
}
|
|
5995
5678
|
|
|
5996
|
-
|
|
5997
|
-
|
|
5679
|
+
let origin = this.origin(line, column, endLine, endColumn);
|
|
5680
|
+
if (origin) {
|
|
5681
|
+
result = new CssSyntaxError$1(
|
|
5682
|
+
message,
|
|
5683
|
+
origin.endLine === undefined
|
|
5684
|
+
? origin.line
|
|
5685
|
+
: { column: origin.column, line: origin.line },
|
|
5686
|
+
origin.endLine === undefined
|
|
5687
|
+
? origin.column
|
|
5688
|
+
: { column: origin.endColumn, line: origin.endLine },
|
|
5689
|
+
origin.source,
|
|
5690
|
+
origin.file,
|
|
5691
|
+
opts.plugin
|
|
5692
|
+
);
|
|
5693
|
+
} else {
|
|
5694
|
+
result = new CssSyntaxError$1(
|
|
5695
|
+
message,
|
|
5696
|
+
endLine === undefined ? line : { column, line },
|
|
5697
|
+
endLine === undefined ? column : { column: endColumn, line: endLine },
|
|
5698
|
+
this.css,
|
|
5699
|
+
this.file,
|
|
5700
|
+
opts.plugin
|
|
5701
|
+
);
|
|
5702
|
+
}
|
|
5998
5703
|
|
|
5999
|
-
|
|
6000
|
-
|
|
6001
|
-
|
|
6002
|
-
|
|
6003
|
-
|
|
6004
|
-
|
|
6005
|
-
while (i--) {
|
|
6006
|
-
id += alphabet[(Math.random() * alphabet.length) | 0];
|
|
5704
|
+
result.input = { column, endColumn, endLine, line, source: this.css };
|
|
5705
|
+
if (this.file) {
|
|
5706
|
+
if (pathToFileURL$1) {
|
|
5707
|
+
result.input.url = pathToFileURL$1(this.file).toString();
|
|
5708
|
+
}
|
|
5709
|
+
result.input.file = this.file;
|
|
6007
5710
|
}
|
|
6008
|
-
|
|
6009
|
-
|
|
6010
|
-
};
|
|
6011
|
-
let nanoid$1 = (size = 21) => {
|
|
6012
|
-
let id = '';
|
|
6013
|
-
let i = size;
|
|
6014
|
-
while (i--) {
|
|
6015
|
-
id += urlAlphabet[(Math.random() * 64) | 0];
|
|
5711
|
+
|
|
5712
|
+
return result
|
|
6016
5713
|
}
|
|
6017
|
-
return id
|
|
6018
|
-
};
|
|
6019
5714
|
|
|
6020
|
-
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
|
|
5715
|
+
fromOffset(offset) {
|
|
5716
|
+
let lastLine, lineToIndex;
|
|
5717
|
+
if (!this[fromOffsetCache]) {
|
|
5718
|
+
let lines = this.css.split('\n');
|
|
5719
|
+
lineToIndex = new Array(lines.length);
|
|
5720
|
+
let prevIndex = 0;
|
|
6025
5721
|
|
|
6026
|
-
|
|
5722
|
+
for (let i = 0, l = lines.length; i < l; i++) {
|
|
5723
|
+
lineToIndex[i] = prevIndex;
|
|
5724
|
+
prevIndex += lines[i].length + 1;
|
|
5725
|
+
}
|
|
6027
5726
|
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
|
|
5727
|
+
this[fromOffsetCache] = lineToIndex;
|
|
5728
|
+
} else {
|
|
5729
|
+
lineToIndex = this[fromOffsetCache];
|
|
5730
|
+
}
|
|
5731
|
+
lastLine = lineToIndex[lineToIndex.length - 1];
|
|
6031
5732
|
|
|
6032
|
-
|
|
6033
|
-
|
|
6034
|
-
|
|
6035
|
-
|
|
6036
|
-
|
|
6037
|
-
|
|
5733
|
+
let min = 0;
|
|
5734
|
+
if (offset >= lastLine) {
|
|
5735
|
+
min = lineToIndex.length - 1;
|
|
5736
|
+
} else {
|
|
5737
|
+
let max = lineToIndex.length - 2;
|
|
5738
|
+
let mid;
|
|
5739
|
+
while (min < max) {
|
|
5740
|
+
mid = min + ((max - min) >> 1);
|
|
5741
|
+
if (offset < lineToIndex[mid]) {
|
|
5742
|
+
max = mid - 1;
|
|
5743
|
+
} else if (offset >= lineToIndex[mid + 1]) {
|
|
5744
|
+
min = mid + 1;
|
|
5745
|
+
} else {
|
|
5746
|
+
min = mid;
|
|
5747
|
+
break
|
|
5748
|
+
}
|
|
5749
|
+
}
|
|
5750
|
+
}
|
|
5751
|
+
return {
|
|
5752
|
+
col: offset - lineToIndex[min] + 1,
|
|
5753
|
+
line: min + 1
|
|
5754
|
+
}
|
|
6038
5755
|
}
|
|
6039
|
-
}
|
|
6040
|
-
|
|
6041
|
-
class PreviousMap$2 {
|
|
6042
|
-
constructor(css, opts) {
|
|
6043
|
-
if (opts.map === false) return
|
|
6044
|
-
this.loadAnnotation(css);
|
|
6045
|
-
this.inline = this.startWith(this.annotation, 'data:');
|
|
6046
5756
|
|
|
6047
|
-
|
|
6048
|
-
|
|
6049
|
-
|
|
6050
|
-
this.mapFile = opts.from;
|
|
5757
|
+
mapResolve(file) {
|
|
5758
|
+
if (/^\w+:\/\//.test(file)) {
|
|
5759
|
+
return file
|
|
6051
5760
|
}
|
|
6052
|
-
|
|
6053
|
-
if (text) this.text = text;
|
|
5761
|
+
return resolve$1(this.map.consumer().sourceRoot || this.map.root || '.', file)
|
|
6054
5762
|
}
|
|
6055
5763
|
|
|
6056
|
-
|
|
6057
|
-
if (!this.
|
|
6058
|
-
|
|
5764
|
+
origin(line, column, endLine, endColumn) {
|
|
5765
|
+
if (!this.map) return false
|
|
5766
|
+
let consumer = this.map.consumer();
|
|
5767
|
+
|
|
5768
|
+
let from = consumer.originalPositionFor({ column, line });
|
|
5769
|
+
if (!from.source) return false
|
|
5770
|
+
|
|
5771
|
+
let to;
|
|
5772
|
+
if (typeof endLine === 'number') {
|
|
5773
|
+
to = consumer.originalPositionFor({ column: endColumn, line: endLine });
|
|
6059
5774
|
}
|
|
6060
|
-
return this.consumerCache
|
|
6061
|
-
}
|
|
6062
5775
|
|
|
6063
|
-
|
|
6064
|
-
let baseCharsetUri = /^data:application\/json;charset=utf-?8;base64,/;
|
|
6065
|
-
let baseUri = /^data:application\/json;base64,/;
|
|
6066
|
-
let charsetUri = /^data:application\/json;charset=utf-?8,/;
|
|
6067
|
-
let uri = /^data:application\/json,/;
|
|
5776
|
+
let fromUrl;
|
|
6068
5777
|
|
|
6069
|
-
|
|
6070
|
-
|
|
6071
|
-
|
|
5778
|
+
if (isAbsolute(from.source)) {
|
|
5779
|
+
fromUrl = pathToFileURL$1(from.source);
|
|
5780
|
+
} else {
|
|
5781
|
+
fromUrl = new URL(
|
|
5782
|
+
from.source,
|
|
5783
|
+
this.map.consumer().sourceRoot || pathToFileURL$1(this.map.mapFile)
|
|
5784
|
+
);
|
|
6072
5785
|
}
|
|
6073
5786
|
|
|
6074
|
-
let
|
|
6075
|
-
|
|
6076
|
-
|
|
5787
|
+
let result = {
|
|
5788
|
+
column: from.column,
|
|
5789
|
+
endColumn: to && to.column,
|
|
5790
|
+
endLine: to && to.line,
|
|
5791
|
+
line: from.line,
|
|
5792
|
+
url: fromUrl.toString()
|
|
5793
|
+
};
|
|
5794
|
+
|
|
5795
|
+
if (fromUrl.protocol === 'file:') {
|
|
5796
|
+
if (fileURLToPath) {
|
|
5797
|
+
result.file = fileURLToPath(fromUrl);
|
|
5798
|
+
} else {
|
|
5799
|
+
/* c8 ignore next 2 */
|
|
5800
|
+
throw new Error(`file: protocol is not available in this PostCSS build`)
|
|
5801
|
+
}
|
|
6077
5802
|
}
|
|
6078
5803
|
|
|
6079
|
-
let
|
|
6080
|
-
|
|
5804
|
+
let source = consumer.sourceContentFor(from.source);
|
|
5805
|
+
if (source) result.source = source;
|
|
5806
|
+
|
|
5807
|
+
return result
|
|
5808
|
+
}
|
|
5809
|
+
|
|
5810
|
+
toJSON() {
|
|
5811
|
+
let json = {};
|
|
5812
|
+
for (let name of ['hasBOM', 'css', 'file', 'id']) {
|
|
5813
|
+
if (this[name] != null) {
|
|
5814
|
+
json[name] = this[name];
|
|
5815
|
+
}
|
|
5816
|
+
}
|
|
5817
|
+
if (this.map) {
|
|
5818
|
+
json.map = { ...this.map };
|
|
5819
|
+
if (json.map.consumerCache) {
|
|
5820
|
+
json.map.consumerCache = undefined;
|
|
5821
|
+
}
|
|
5822
|
+
}
|
|
5823
|
+
return json
|
|
6081
5824
|
}
|
|
6082
5825
|
|
|
6083
|
-
|
|
6084
|
-
return
|
|
5826
|
+
get from() {
|
|
5827
|
+
return this.file || this.id
|
|
6085
5828
|
}
|
|
5829
|
+
}
|
|
6086
5830
|
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
return (
|
|
6090
|
-
typeof map.mappings === 'string' ||
|
|
6091
|
-
typeof map._mappings === 'string' ||
|
|
6092
|
-
Array.isArray(map.sections)
|
|
6093
|
-
)
|
|
6094
|
-
}
|
|
5831
|
+
var input = Input$4;
|
|
5832
|
+
Input$4.default = Input$4;
|
|
6095
5833
|
|
|
6096
|
-
|
|
6097
|
-
|
|
6098
|
-
|
|
5834
|
+
if (terminalHighlight && terminalHighlight.registerInput) {
|
|
5835
|
+
terminalHighlight.registerInput(Input$4);
|
|
5836
|
+
}
|
|
6099
5837
|
|
|
6100
|
-
|
|
6101
|
-
|
|
6102
|
-
|
|
5838
|
+
let { SourceMapConsumer, SourceMapGenerator } = require$$2;
|
|
5839
|
+
let { dirname, relative, resolve, sep } = require$$2;
|
|
5840
|
+
let { pathToFileURL } = require$$2;
|
|
6103
5841
|
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
5842
|
+
let Input$3 = input;
|
|
5843
|
+
|
|
5844
|
+
let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);
|
|
5845
|
+
let pathAvailable = Boolean(dirname && resolve && relative && sep);
|
|
5846
|
+
|
|
5847
|
+
class MapGenerator$2 {
|
|
5848
|
+
constructor(stringify, root, opts, cssString) {
|
|
5849
|
+
this.stringify = stringify;
|
|
5850
|
+
this.mapOpts = opts.map || {};
|
|
5851
|
+
this.root = root;
|
|
5852
|
+
this.opts = opts;
|
|
5853
|
+
this.css = cssString;
|
|
5854
|
+
this.originalCSS = cssString;
|
|
5855
|
+
this.usesFileUrls = !this.mapOpts.from && this.mapOpts.absolute;
|
|
5856
|
+
|
|
5857
|
+
this.memoizedFileURLs = new Map();
|
|
5858
|
+
this.memoizedPaths = new Map();
|
|
5859
|
+
this.memoizedURLs = new Map();
|
|
6108
5860
|
}
|
|
6109
5861
|
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
|
|
5862
|
+
addAnnotation() {
|
|
5863
|
+
let content;
|
|
5864
|
+
|
|
5865
|
+
if (this.isInline()) {
|
|
5866
|
+
content =
|
|
5867
|
+
'data:application/json;base64,' + this.toBase64(this.map.toString());
|
|
5868
|
+
} else if (typeof this.mapOpts.annotation === 'string') {
|
|
5869
|
+
content = this.mapOpts.annotation;
|
|
5870
|
+
} else if (typeof this.mapOpts.annotation === 'function') {
|
|
5871
|
+
content = this.mapOpts.annotation(this.opts.to, this.root);
|
|
5872
|
+
} else {
|
|
5873
|
+
content = this.outputFile() + '.map';
|
|
6115
5874
|
}
|
|
5875
|
+
let eol = '\n';
|
|
5876
|
+
if (this.css.includes('\r\n')) eol = '\r\n';
|
|
5877
|
+
|
|
5878
|
+
this.css += eol + '/*# sourceMappingURL=' + content + ' */';
|
|
6116
5879
|
}
|
|
6117
5880
|
|
|
6118
|
-
|
|
6119
|
-
|
|
5881
|
+
applyPrevMaps() {
|
|
5882
|
+
for (let prev of this.previous()) {
|
|
5883
|
+
let from = this.toUrl(this.path(prev.file));
|
|
5884
|
+
let root = prev.root || dirname(prev.file);
|
|
5885
|
+
let map;
|
|
6120
5886
|
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
let prevPath = prev(file);
|
|
6126
|
-
if (prevPath) {
|
|
6127
|
-
let map = this.loadFile(prevPath);
|
|
6128
|
-
if (!map) {
|
|
6129
|
-
throw new Error(
|
|
6130
|
-
'Unable to load previous source map: ' + prevPath.toString()
|
|
6131
|
-
)
|
|
6132
|
-
}
|
|
6133
|
-
return map
|
|
5887
|
+
if (this.mapOpts.sourcesContent === false) {
|
|
5888
|
+
map = new SourceMapConsumer(prev.text);
|
|
5889
|
+
if (map.sourcesContent) {
|
|
5890
|
+
map.sourcesContent = null;
|
|
6134
5891
|
}
|
|
6135
|
-
} else if (prev instanceof SourceMapConsumer$2) {
|
|
6136
|
-
return SourceMapGenerator$2.fromSourceMap(prev).toString()
|
|
6137
|
-
} else if (prev instanceof SourceMapGenerator$2) {
|
|
6138
|
-
return prev.toString()
|
|
6139
|
-
} else if (this.isMap(prev)) {
|
|
6140
|
-
return JSON.stringify(prev)
|
|
6141
5892
|
} else {
|
|
6142
|
-
|
|
6143
|
-
'Unsupported previous source map format: ' + prev.toString()
|
|
6144
|
-
)
|
|
5893
|
+
map = prev.consumer();
|
|
6145
5894
|
}
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
} else if (this.annotation) {
|
|
6149
|
-
let map = this.annotation;
|
|
6150
|
-
if (file) map = join(dirname$1(file), map);
|
|
6151
|
-
return this.loadFile(map)
|
|
5895
|
+
|
|
5896
|
+
this.map.applySourceMap(map, from, this.toUrl(this.path(root)));
|
|
6152
5897
|
}
|
|
6153
5898
|
}
|
|
6154
5899
|
|
|
6155
|
-
|
|
6156
|
-
if (
|
|
6157
|
-
|
|
5900
|
+
clearAnnotation() {
|
|
5901
|
+
if (this.mapOpts.annotation === false) return
|
|
5902
|
+
|
|
5903
|
+
if (this.root) {
|
|
5904
|
+
let node;
|
|
5905
|
+
for (let i = this.root.nodes.length - 1; i >= 0; i--) {
|
|
5906
|
+
node = this.root.nodes[i];
|
|
5907
|
+
if (node.type !== 'comment') continue
|
|
5908
|
+
if (node.text.indexOf('# sourceMappingURL=') === 0) {
|
|
5909
|
+
this.root.removeChild(i);
|
|
5910
|
+
}
|
|
5911
|
+
}
|
|
5912
|
+
} else if (this.css) {
|
|
5913
|
+
this.css = this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm, '');
|
|
5914
|
+
}
|
|
6158
5915
|
}
|
|
6159
5916
|
|
|
6160
|
-
|
|
6161
|
-
|
|
6162
|
-
|
|
6163
|
-
this.
|
|
6164
|
-
|
|
5917
|
+
generate() {
|
|
5918
|
+
this.clearAnnotation();
|
|
5919
|
+
if (pathAvailable && sourceMapAvailable && this.isMap()) {
|
|
5920
|
+
return this.generateMap()
|
|
5921
|
+
} else {
|
|
5922
|
+
let result = '';
|
|
5923
|
+
this.stringify(this.root, i => {
|
|
5924
|
+
result += i;
|
|
5925
|
+
});
|
|
5926
|
+
return [result]
|
|
5927
|
+
}
|
|
6165
5928
|
}
|
|
6166
|
-
}
|
|
6167
5929
|
|
|
6168
|
-
|
|
6169
|
-
|
|
5930
|
+
generateMap() {
|
|
5931
|
+
if (this.root) {
|
|
5932
|
+
this.generateString();
|
|
5933
|
+
} else if (this.previous().length === 1) {
|
|
5934
|
+
let prev = this.previous()[0].consumer();
|
|
5935
|
+
prev.file = this.outputFile();
|
|
5936
|
+
this.map = SourceMapGenerator.fromSourceMap(prev);
|
|
5937
|
+
} else {
|
|
5938
|
+
this.map = new SourceMapGenerator({ file: this.outputFile() });
|
|
5939
|
+
this.map.addMapping({
|
|
5940
|
+
generated: { column: 0, line: 1 },
|
|
5941
|
+
original: { column: 0, line: 1 },
|
|
5942
|
+
source: this.opts.from
|
|
5943
|
+
? this.toUrl(this.path(this.opts.from))
|
|
5944
|
+
: '<no source>'
|
|
5945
|
+
});
|
|
5946
|
+
}
|
|
6170
5947
|
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
let { fileURLToPath, pathToFileURL: pathToFileURL$1 } = require$$2;
|
|
5948
|
+
if (this.isSourcesContent()) this.setSourcesContent();
|
|
5949
|
+
if (this.root && this.previous().length > 0) this.applyPrevMaps();
|
|
5950
|
+
if (this.isAnnotation()) this.addAnnotation();
|
|
6175
5951
|
|
|
6176
|
-
|
|
6177
|
-
|
|
6178
|
-
|
|
5952
|
+
if (this.isInline()) {
|
|
5953
|
+
return [this.css]
|
|
5954
|
+
} else {
|
|
5955
|
+
return [this.css, this.map]
|
|
5956
|
+
}
|
|
5957
|
+
}
|
|
6179
5958
|
|
|
6180
|
-
|
|
5959
|
+
generateString() {
|
|
5960
|
+
this.css = '';
|
|
5961
|
+
this.map = new SourceMapGenerator({ file: this.outputFile() });
|
|
6181
5962
|
|
|
6182
|
-
let
|
|
6183
|
-
let
|
|
5963
|
+
let line = 1;
|
|
5964
|
+
let column = 1;
|
|
6184
5965
|
|
|
6185
|
-
|
|
6186
|
-
|
|
6187
|
-
|
|
6188
|
-
|
|
6189
|
-
|
|
6190
|
-
|
|
6191
|
-
) {
|
|
6192
|
-
throw new Error(`PostCSS received ${css} instead of CSS string`)
|
|
6193
|
-
}
|
|
5966
|
+
let noSource = '<no source>';
|
|
5967
|
+
let mapping = {
|
|
5968
|
+
generated: { column: 0, line: 0 },
|
|
5969
|
+
original: { column: 0, line: 0 },
|
|
5970
|
+
source: ''
|
|
5971
|
+
};
|
|
6194
5972
|
|
|
6195
|
-
|
|
5973
|
+
let lines, last;
|
|
5974
|
+
this.stringify(this.root, (str, node, type) => {
|
|
5975
|
+
this.css += str;
|
|
6196
5976
|
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
|
|
5977
|
+
if (node && type !== 'end') {
|
|
5978
|
+
mapping.generated.line = line;
|
|
5979
|
+
mapping.generated.column = column - 1;
|
|
5980
|
+
if (node.source && node.source.start) {
|
|
5981
|
+
mapping.source = this.sourcePath(node);
|
|
5982
|
+
mapping.original.line = node.source.start.line;
|
|
5983
|
+
mapping.original.column = node.source.start.column - 1;
|
|
5984
|
+
this.map.addMapping(mapping);
|
|
5985
|
+
} else {
|
|
5986
|
+
mapping.source = noSource;
|
|
5987
|
+
mapping.original.line = 1;
|
|
5988
|
+
mapping.original.column = 0;
|
|
5989
|
+
this.map.addMapping(mapping);
|
|
5990
|
+
}
|
|
5991
|
+
}
|
|
6203
5992
|
|
|
6204
|
-
|
|
6205
|
-
if (
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
) {
|
|
6210
|
-
this.file = opts.from;
|
|
5993
|
+
lines = str.match(/\n/g);
|
|
5994
|
+
if (lines) {
|
|
5995
|
+
line += lines.length;
|
|
5996
|
+
last = str.lastIndexOf('\n');
|
|
5997
|
+
column = str.length - last;
|
|
6211
5998
|
} else {
|
|
6212
|
-
|
|
5999
|
+
column += str.length;
|
|
6000
|
+
}
|
|
6001
|
+
|
|
6002
|
+
if (node && type !== 'start') {
|
|
6003
|
+
let p = node.parent || { raws: {} };
|
|
6004
|
+
let childless =
|
|
6005
|
+
node.type === 'decl' || (node.type === 'atrule' && !node.nodes);
|
|
6006
|
+
if (!childless || node !== p.last || p.raws.semicolon) {
|
|
6007
|
+
if (node.source && node.source.end) {
|
|
6008
|
+
mapping.source = this.sourcePath(node);
|
|
6009
|
+
mapping.original.line = node.source.end.line;
|
|
6010
|
+
mapping.original.column = node.source.end.column - 1;
|
|
6011
|
+
mapping.generated.line = line;
|
|
6012
|
+
mapping.generated.column = column - 2;
|
|
6013
|
+
this.map.addMapping(mapping);
|
|
6014
|
+
} else {
|
|
6015
|
+
mapping.source = noSource;
|
|
6016
|
+
mapping.original.line = 1;
|
|
6017
|
+
mapping.original.column = 0;
|
|
6018
|
+
mapping.generated.line = line;
|
|
6019
|
+
mapping.generated.column = column - 1;
|
|
6020
|
+
this.map.addMapping(mapping);
|
|
6021
|
+
}
|
|
6022
|
+
}
|
|
6213
6023
|
}
|
|
6214
|
-
}
|
|
6024
|
+
});
|
|
6025
|
+
}
|
|
6215
6026
|
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
this.map = map;
|
|
6220
|
-
let file = map.consumer().file;
|
|
6221
|
-
if (!this.file && file) this.file = this.mapResolve(file);
|
|
6222
|
-
}
|
|
6027
|
+
isAnnotation() {
|
|
6028
|
+
if (this.isInline()) {
|
|
6029
|
+
return true
|
|
6223
6030
|
}
|
|
6224
|
-
|
|
6225
|
-
|
|
6226
|
-
this.id = '<input css ' + nanoid(6) + '>';
|
|
6031
|
+
if (typeof this.mapOpts.annotation !== 'undefined') {
|
|
6032
|
+
return this.mapOpts.annotation
|
|
6227
6033
|
}
|
|
6228
|
-
if (this.
|
|
6034
|
+
if (this.previous().length) {
|
|
6035
|
+
return this.previous().some(i => i.annotation)
|
|
6036
|
+
}
|
|
6037
|
+
return true
|
|
6229
6038
|
}
|
|
6230
6039
|
|
|
6231
|
-
|
|
6232
|
-
|
|
6233
|
-
|
|
6234
|
-
if (line && typeof line === 'object') {
|
|
6235
|
-
let start = line;
|
|
6236
|
-
let end = column;
|
|
6237
|
-
if (typeof start.offset === 'number') {
|
|
6238
|
-
let pos = this.fromOffset(start.offset);
|
|
6239
|
-
line = pos.line;
|
|
6240
|
-
column = pos.col;
|
|
6241
|
-
} else {
|
|
6242
|
-
line = start.line;
|
|
6243
|
-
column = start.column;
|
|
6244
|
-
}
|
|
6245
|
-
if (typeof end.offset === 'number') {
|
|
6246
|
-
let pos = this.fromOffset(end.offset);
|
|
6247
|
-
endLine = pos.line;
|
|
6248
|
-
endColumn = pos.col;
|
|
6249
|
-
} else {
|
|
6250
|
-
endLine = end.line;
|
|
6251
|
-
endColumn = end.column;
|
|
6252
|
-
}
|
|
6253
|
-
} else if (!column) {
|
|
6254
|
-
let pos = this.fromOffset(line);
|
|
6255
|
-
line = pos.line;
|
|
6256
|
-
column = pos.col;
|
|
6040
|
+
isInline() {
|
|
6041
|
+
if (typeof this.mapOpts.inline !== 'undefined') {
|
|
6042
|
+
return this.mapOpts.inline
|
|
6257
6043
|
}
|
|
6258
6044
|
|
|
6259
|
-
let
|
|
6260
|
-
if (
|
|
6261
|
-
|
|
6262
|
-
message,
|
|
6263
|
-
origin.endLine === undefined
|
|
6264
|
-
? origin.line
|
|
6265
|
-
: { column: origin.column, line: origin.line },
|
|
6266
|
-
origin.endLine === undefined
|
|
6267
|
-
? origin.column
|
|
6268
|
-
: { column: origin.endColumn, line: origin.endLine },
|
|
6269
|
-
origin.source,
|
|
6270
|
-
origin.file,
|
|
6271
|
-
opts.plugin
|
|
6272
|
-
);
|
|
6273
|
-
} else {
|
|
6274
|
-
result = new CssSyntaxError$1(
|
|
6275
|
-
message,
|
|
6276
|
-
endLine === undefined ? line : { column, line },
|
|
6277
|
-
endLine === undefined ? column : { column: endColumn, line: endLine },
|
|
6278
|
-
this.css,
|
|
6279
|
-
this.file,
|
|
6280
|
-
opts.plugin
|
|
6281
|
-
);
|
|
6045
|
+
let annotation = this.mapOpts.annotation;
|
|
6046
|
+
if (typeof annotation !== 'undefined' && annotation !== true) {
|
|
6047
|
+
return false
|
|
6282
6048
|
}
|
|
6283
6049
|
|
|
6284
|
-
|
|
6285
|
-
|
|
6286
|
-
if (pathToFileURL$1) {
|
|
6287
|
-
result.input.url = pathToFileURL$1(this.file).toString();
|
|
6288
|
-
}
|
|
6289
|
-
result.input.file = this.file;
|
|
6050
|
+
if (this.previous().length) {
|
|
6051
|
+
return this.previous().some(i => i.inline)
|
|
6290
6052
|
}
|
|
6291
|
-
|
|
6292
|
-
return result
|
|
6053
|
+
return true
|
|
6293
6054
|
}
|
|
6294
6055
|
|
|
6295
|
-
|
|
6296
|
-
|
|
6297
|
-
|
|
6298
|
-
let lines = this.css.split('\n');
|
|
6299
|
-
lineToIndex = new Array(lines.length);
|
|
6300
|
-
let prevIndex = 0;
|
|
6301
|
-
|
|
6302
|
-
for (let i = 0, l = lines.length; i < l; i++) {
|
|
6303
|
-
lineToIndex[i] = prevIndex;
|
|
6304
|
-
prevIndex += lines[i].length + 1;
|
|
6305
|
-
}
|
|
6306
|
-
|
|
6307
|
-
this[fromOffsetCache] = lineToIndex;
|
|
6308
|
-
} else {
|
|
6309
|
-
lineToIndex = this[fromOffsetCache];
|
|
6056
|
+
isMap() {
|
|
6057
|
+
if (typeof this.opts.map !== 'undefined') {
|
|
6058
|
+
return !!this.opts.map
|
|
6310
6059
|
}
|
|
6311
|
-
|
|
6060
|
+
return this.previous().length > 0
|
|
6061
|
+
}
|
|
6312
6062
|
|
|
6313
|
-
|
|
6314
|
-
if (
|
|
6315
|
-
|
|
6316
|
-
} else {
|
|
6317
|
-
let max = lineToIndex.length - 2;
|
|
6318
|
-
let mid;
|
|
6319
|
-
while (min < max) {
|
|
6320
|
-
mid = min + ((max - min) >> 1);
|
|
6321
|
-
if (offset < lineToIndex[mid]) {
|
|
6322
|
-
max = mid - 1;
|
|
6323
|
-
} else if (offset >= lineToIndex[mid + 1]) {
|
|
6324
|
-
min = mid + 1;
|
|
6325
|
-
} else {
|
|
6326
|
-
min = mid;
|
|
6327
|
-
break
|
|
6328
|
-
}
|
|
6329
|
-
}
|
|
6063
|
+
isSourcesContent() {
|
|
6064
|
+
if (typeof this.mapOpts.sourcesContent !== 'undefined') {
|
|
6065
|
+
return this.mapOpts.sourcesContent
|
|
6330
6066
|
}
|
|
6331
|
-
|
|
6332
|
-
|
|
6333
|
-
line: min + 1
|
|
6067
|
+
if (this.previous().length) {
|
|
6068
|
+
return this.previous().some(i => i.withContent())
|
|
6334
6069
|
}
|
|
6070
|
+
return true
|
|
6335
6071
|
}
|
|
6336
6072
|
|
|
6337
|
-
|
|
6338
|
-
if (
|
|
6339
|
-
return
|
|
6073
|
+
outputFile() {
|
|
6074
|
+
if (this.opts.to) {
|
|
6075
|
+
return this.path(this.opts.to)
|
|
6076
|
+
} else if (this.opts.from) {
|
|
6077
|
+
return this.path(this.opts.from)
|
|
6078
|
+
} else {
|
|
6079
|
+
return 'to.css'
|
|
6340
6080
|
}
|
|
6341
|
-
return resolve$1(this.map.consumer().sourceRoot || this.map.root || '.', file)
|
|
6342
6081
|
}
|
|
6343
6082
|
|
|
6344
|
-
|
|
6345
|
-
if (
|
|
6346
|
-
|
|
6083
|
+
path(file) {
|
|
6084
|
+
if (this.mapOpts.absolute) return file
|
|
6085
|
+
if (file.charCodeAt(0) === 60 /* `<` */) return file
|
|
6086
|
+
if (/^\w+:\/\//.test(file)) return file
|
|
6087
|
+
let cached = this.memoizedPaths.get(file);
|
|
6088
|
+
if (cached) return cached
|
|
6347
6089
|
|
|
6348
|
-
let from =
|
|
6349
|
-
if (!from.source) return false
|
|
6090
|
+
let from = this.opts.to ? dirname(this.opts.to) : '.';
|
|
6350
6091
|
|
|
6351
|
-
|
|
6352
|
-
|
|
6353
|
-
to = consumer.originalPositionFor({ column: endColumn, line: endLine });
|
|
6092
|
+
if (typeof this.mapOpts.annotation === 'string') {
|
|
6093
|
+
from = dirname(resolve(from, this.mapOpts.annotation));
|
|
6354
6094
|
}
|
|
6355
6095
|
|
|
6356
|
-
let
|
|
6357
|
-
|
|
6358
|
-
if (isAbsolute(from.source)) {
|
|
6359
|
-
fromUrl = pathToFileURL$1(from.source);
|
|
6360
|
-
} else {
|
|
6361
|
-
fromUrl = new URL(
|
|
6362
|
-
from.source,
|
|
6363
|
-
this.map.consumer().sourceRoot || pathToFileURL$1(this.map.mapFile)
|
|
6364
|
-
);
|
|
6365
|
-
}
|
|
6096
|
+
let path = relative(from, file);
|
|
6097
|
+
this.memoizedPaths.set(file, path);
|
|
6366
6098
|
|
|
6367
|
-
|
|
6368
|
-
|
|
6369
|
-
endColumn: to && to.column,
|
|
6370
|
-
endLine: to && to.line,
|
|
6371
|
-
line: from.line,
|
|
6372
|
-
url: fromUrl.toString()
|
|
6373
|
-
};
|
|
6099
|
+
return path
|
|
6100
|
+
}
|
|
6374
6101
|
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
|
|
6102
|
+
previous() {
|
|
6103
|
+
if (!this.previousMaps) {
|
|
6104
|
+
this.previousMaps = [];
|
|
6105
|
+
if (this.root) {
|
|
6106
|
+
this.root.walk(node => {
|
|
6107
|
+
if (node.source && node.source.input.map) {
|
|
6108
|
+
let map = node.source.input.map;
|
|
6109
|
+
if (!this.previousMaps.includes(map)) {
|
|
6110
|
+
this.previousMaps.push(map);
|
|
6111
|
+
}
|
|
6112
|
+
}
|
|
6113
|
+
});
|
|
6378
6114
|
} else {
|
|
6379
|
-
|
|
6380
|
-
|
|
6115
|
+
let input = new Input$3(this.originalCSS, this.opts);
|
|
6116
|
+
if (input.map) this.previousMaps.push(input.map);
|
|
6381
6117
|
}
|
|
6382
6118
|
}
|
|
6383
6119
|
|
|
6384
|
-
|
|
6385
|
-
|
|
6120
|
+
return this.previousMaps
|
|
6121
|
+
}
|
|
6386
6122
|
|
|
6387
|
-
|
|
6123
|
+
setSourcesContent() {
|
|
6124
|
+
let already = {};
|
|
6125
|
+
if (this.root) {
|
|
6126
|
+
this.root.walk(node => {
|
|
6127
|
+
if (node.source) {
|
|
6128
|
+
let from = node.source.input.from;
|
|
6129
|
+
if (from && !already[from]) {
|
|
6130
|
+
already[from] = true;
|
|
6131
|
+
let fromUrl = this.usesFileUrls
|
|
6132
|
+
? this.toFileUrl(from)
|
|
6133
|
+
: this.toUrl(this.path(from));
|
|
6134
|
+
this.map.setSourceContent(fromUrl, node.source.input.css);
|
|
6135
|
+
}
|
|
6136
|
+
}
|
|
6137
|
+
});
|
|
6138
|
+
} else if (this.css) {
|
|
6139
|
+
let from = this.opts.from
|
|
6140
|
+
? this.toUrl(this.path(this.opts.from))
|
|
6141
|
+
: '<no source>';
|
|
6142
|
+
this.map.setSourceContent(from, this.css);
|
|
6143
|
+
}
|
|
6388
6144
|
}
|
|
6389
6145
|
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
|
|
6393
|
-
|
|
6394
|
-
|
|
6395
|
-
|
|
6146
|
+
sourcePath(node) {
|
|
6147
|
+
if (this.mapOpts.from) {
|
|
6148
|
+
return this.toUrl(this.mapOpts.from)
|
|
6149
|
+
} else if (this.usesFileUrls) {
|
|
6150
|
+
return this.toFileUrl(node.source.input.from)
|
|
6151
|
+
} else {
|
|
6152
|
+
return this.toUrl(this.path(node.source.input.from))
|
|
6396
6153
|
}
|
|
6397
|
-
|
|
6398
|
-
|
|
6399
|
-
|
|
6400
|
-
|
|
6401
|
-
|
|
6154
|
+
}
|
|
6155
|
+
|
|
6156
|
+
toBase64(str) {
|
|
6157
|
+
if (Buffer) {
|
|
6158
|
+
return Buffer.from(str).toString('base64')
|
|
6159
|
+
} else {
|
|
6160
|
+
return window.btoa(unescape(encodeURIComponent(str)))
|
|
6402
6161
|
}
|
|
6403
|
-
return json
|
|
6404
|
-
}
|
|
6405
|
-
|
|
6406
|
-
get from() {
|
|
6407
|
-
return this.file || this.id
|
|
6408
6162
|
}
|
|
6409
|
-
}
|
|
6410
|
-
|
|
6411
|
-
var input = Input$4;
|
|
6412
|
-
Input$4.default = Input$4;
|
|
6413
|
-
|
|
6414
|
-
if (terminalHighlight && terminalHighlight.registerInput) {
|
|
6415
|
-
terminalHighlight.registerInput(Input$4);
|
|
6416
|
-
}
|
|
6417
6163
|
|
|
6418
|
-
|
|
6164
|
+
toFileUrl(path) {
|
|
6165
|
+
let cached = this.memoizedFileURLs.get(path);
|
|
6166
|
+
if (cached) return cached
|
|
6419
6167
|
|
|
6420
|
-
|
|
6168
|
+
if (pathToFileURL) {
|
|
6169
|
+
let fileURL = pathToFileURL(path).toString();
|
|
6170
|
+
this.memoizedFileURLs.set(path, fileURL);
|
|
6421
6171
|
|
|
6422
|
-
|
|
6423
|
-
|
|
6424
|
-
|
|
6425
|
-
|
|
6426
|
-
|
|
6172
|
+
return fileURL
|
|
6173
|
+
} else {
|
|
6174
|
+
throw new Error(
|
|
6175
|
+
'`map.absolute` option is not available in this PostCSS build'
|
|
6176
|
+
)
|
|
6177
|
+
}
|
|
6427
6178
|
}
|
|
6428
6179
|
|
|
6429
|
-
|
|
6430
|
-
let
|
|
6180
|
+
toUrl(path) {
|
|
6181
|
+
let cached = this.memoizedURLs.get(path);
|
|
6182
|
+
if (cached) return cached
|
|
6431
6183
|
|
|
6432
|
-
if (
|
|
6433
|
-
|
|
6434
|
-
if (this.nodes.length > 1) {
|
|
6435
|
-
sample.raws.before = this.nodes[1].raws.before;
|
|
6436
|
-
} else {
|
|
6437
|
-
delete sample.raws.before;
|
|
6438
|
-
}
|
|
6439
|
-
} else if (this.first !== sample) {
|
|
6440
|
-
for (let node of nodes) {
|
|
6441
|
-
node.raws.before = sample.raws.before;
|
|
6442
|
-
}
|
|
6443
|
-
}
|
|
6184
|
+
if (sep === '\\') {
|
|
6185
|
+
path = path.replace(/\\/g, '/');
|
|
6444
6186
|
}
|
|
6445
6187
|
|
|
6446
|
-
|
|
6447
|
-
|
|
6188
|
+
let url = encodeURI(path).replace(/[#?]/g, encodeURIComponent);
|
|
6189
|
+
this.memoizedURLs.set(path, url);
|
|
6448
6190
|
|
|
6449
|
-
|
|
6450
|
-
|
|
6191
|
+
return url
|
|
6192
|
+
}
|
|
6193
|
+
}
|
|
6451
6194
|
|
|
6452
|
-
|
|
6453
|
-
this.nodes[1].raws.before = this.nodes[index].raws.before;
|
|
6454
|
-
}
|
|
6195
|
+
var mapGenerator = MapGenerator$2;
|
|
6455
6196
|
|
|
6456
|
-
|
|
6457
|
-
}
|
|
6197
|
+
let Node$2 = node_1;
|
|
6458
6198
|
|
|
6459
|
-
|
|
6460
|
-
|
|
6461
|
-
|
|
6199
|
+
class Comment$4 extends Node$2 {
|
|
6200
|
+
constructor(defaults) {
|
|
6201
|
+
super(defaults);
|
|
6202
|
+
this.type = 'comment';
|
|
6462
6203
|
}
|
|
6463
6204
|
}
|
|
6464
6205
|
|
|
6465
|
-
|
|
6466
|
-
|
|
6467
|
-
};
|
|
6468
|
-
|
|
6469
|
-
Root$5.registerProcessor = dependant => {
|
|
6470
|
-
Processor$2 = dependant;
|
|
6471
|
-
};
|
|
6206
|
+
var comment = Comment$4;
|
|
6207
|
+
Comment$4.default = Comment$4;
|
|
6472
6208
|
|
|
6473
|
-
|
|
6474
|
-
|
|
6209
|
+
let { isClean: isClean$1, my: my$1 } = symbols;
|
|
6210
|
+
let Declaration$3 = declaration;
|
|
6211
|
+
let Comment$3 = comment;
|
|
6212
|
+
let Node$1 = node_1;
|
|
6475
6213
|
|
|
6476
|
-
|
|
6214
|
+
let parse$4, Rule$4, AtRule$4, Root$6;
|
|
6477
6215
|
|
|
6478
|
-
|
|
6479
|
-
|
|
6480
|
-
|
|
6481
|
-
|
|
6216
|
+
function cleanSource(nodes) {
|
|
6217
|
+
return nodes.map(i => {
|
|
6218
|
+
if (i.nodes) i.nodes = cleanSource(i.nodes);
|
|
6219
|
+
delete i.source;
|
|
6220
|
+
return i
|
|
6221
|
+
})
|
|
6222
|
+
}
|
|
6482
6223
|
|
|
6483
|
-
|
|
6484
|
-
|
|
6485
|
-
|
|
6486
|
-
|
|
6224
|
+
function markDirtyUp(node) {
|
|
6225
|
+
node[isClean$1] = false;
|
|
6226
|
+
if (node.proxyOf.nodes) {
|
|
6227
|
+
for (let i of node.proxyOf.nodes) {
|
|
6228
|
+
markDirtyUp(i);
|
|
6229
|
+
}
|
|
6230
|
+
}
|
|
6231
|
+
}
|
|
6487
6232
|
|
|
6488
|
-
|
|
6489
|
-
|
|
6490
|
-
let
|
|
6491
|
-
|
|
6233
|
+
class Container$7 extends Node$1 {
|
|
6234
|
+
append(...children) {
|
|
6235
|
+
for (let child of children) {
|
|
6236
|
+
let nodes = this.normalize(child, this.last);
|
|
6237
|
+
for (let node of nodes) this.proxyOf.nodes.push(node);
|
|
6238
|
+
}
|
|
6492
6239
|
|
|
6493
|
-
|
|
6494
|
-
let inQuote = false;
|
|
6495
|
-
let prevQuote = '';
|
|
6496
|
-
let escape = false;
|
|
6240
|
+
this.markDirty();
|
|
6497
6241
|
|
|
6498
|
-
|
|
6499
|
-
|
|
6500
|
-
escape = false;
|
|
6501
|
-
} else if (letter === '\\') {
|
|
6502
|
-
escape = true;
|
|
6503
|
-
} else if (inQuote) {
|
|
6504
|
-
if (letter === prevQuote) {
|
|
6505
|
-
inQuote = false;
|
|
6506
|
-
}
|
|
6507
|
-
} else if (letter === '"' || letter === "'") {
|
|
6508
|
-
inQuote = true;
|
|
6509
|
-
prevQuote = letter;
|
|
6510
|
-
} else if (letter === '(') {
|
|
6511
|
-
func += 1;
|
|
6512
|
-
} else if (letter === ')') {
|
|
6513
|
-
if (func > 0) func -= 1;
|
|
6514
|
-
} else if (func === 0) {
|
|
6515
|
-
if (separators.includes(letter)) split = true;
|
|
6516
|
-
}
|
|
6242
|
+
return this
|
|
6243
|
+
}
|
|
6517
6244
|
|
|
6518
|
-
|
|
6519
|
-
|
|
6520
|
-
|
|
6521
|
-
|
|
6522
|
-
} else {
|
|
6523
|
-
current += letter;
|
|
6524
|
-
}
|
|
6245
|
+
cleanRaws(keepBetween) {
|
|
6246
|
+
super.cleanRaws(keepBetween);
|
|
6247
|
+
if (this.nodes) {
|
|
6248
|
+
for (let node of this.nodes) node.cleanRaws(keepBetween);
|
|
6525
6249
|
}
|
|
6526
|
-
|
|
6527
|
-
if (last || current !== '') array.push(current.trim());
|
|
6528
|
-
return array
|
|
6529
6250
|
}
|
|
6530
|
-
};
|
|
6531
6251
|
|
|
6532
|
-
|
|
6533
|
-
|
|
6252
|
+
each(callback) {
|
|
6253
|
+
if (!this.proxyOf.nodes) return undefined
|
|
6254
|
+
let iterator = this.getIterator();
|
|
6534
6255
|
|
|
6535
|
-
let
|
|
6536
|
-
|
|
6256
|
+
let index, result;
|
|
6257
|
+
while (this.indexes[iterator] < this.proxyOf.nodes.length) {
|
|
6258
|
+
index = this.indexes[iterator];
|
|
6259
|
+
result = callback(this.proxyOf.nodes[index], index);
|
|
6260
|
+
if (result === false) break
|
|
6537
6261
|
|
|
6538
|
-
|
|
6539
|
-
|
|
6540
|
-
super(defaults);
|
|
6541
|
-
this.type = 'rule';
|
|
6542
|
-
if (!this.nodes) this.nodes = [];
|
|
6543
|
-
}
|
|
6262
|
+
this.indexes[iterator] += 1;
|
|
6263
|
+
}
|
|
6544
6264
|
|
|
6545
|
-
|
|
6546
|
-
return
|
|
6265
|
+
delete this.indexes[iterator];
|
|
6266
|
+
return result
|
|
6547
6267
|
}
|
|
6548
6268
|
|
|
6549
|
-
|
|
6550
|
-
|
|
6551
|
-
let sep = match ? match[0] : ',' + this.raw('between', 'beforeOpen');
|
|
6552
|
-
this.selector = values.join(sep);
|
|
6269
|
+
every(condition) {
|
|
6270
|
+
return this.nodes.every(condition)
|
|
6553
6271
|
}
|
|
6554
|
-
}
|
|
6555
6272
|
|
|
6556
|
-
|
|
6557
|
-
|
|
6558
|
-
|
|
6559
|
-
Container$3.registerRule(Rule$3);
|
|
6273
|
+
getIterator() {
|
|
6274
|
+
if (!this.lastEach) this.lastEach = 0;
|
|
6275
|
+
if (!this.indexes) this.indexes = {};
|
|
6560
6276
|
|
|
6561
|
-
|
|
6562
|
-
let
|
|
6563
|
-
|
|
6564
|
-
let Input$3 = input;
|
|
6565
|
-
let PreviousMap = previousMap;
|
|
6566
|
-
let Root$4 = root;
|
|
6567
|
-
let Rule$2 = rule;
|
|
6277
|
+
this.lastEach += 1;
|
|
6278
|
+
let iterator = this.lastEach;
|
|
6279
|
+
this.indexes[iterator] = 0;
|
|
6568
6280
|
|
|
6569
|
-
|
|
6570
|
-
|
|
6281
|
+
return iterator
|
|
6282
|
+
}
|
|
6571
6283
|
|
|
6572
|
-
|
|
6573
|
-
|
|
6574
|
-
|
|
6575
|
-
|
|
6576
|
-
|
|
6577
|
-
|
|
6578
|
-
|
|
6579
|
-
|
|
6580
|
-
|
|
6581
|
-
|
|
6284
|
+
getProxyProcessor() {
|
|
6285
|
+
return {
|
|
6286
|
+
get(node, prop) {
|
|
6287
|
+
if (prop === 'proxyOf') {
|
|
6288
|
+
return node
|
|
6289
|
+
} else if (!node[prop]) {
|
|
6290
|
+
return node[prop]
|
|
6291
|
+
} else if (
|
|
6292
|
+
prop === 'each' ||
|
|
6293
|
+
(typeof prop === 'string' && prop.startsWith('walk'))
|
|
6294
|
+
) {
|
|
6295
|
+
return (...args) => {
|
|
6296
|
+
return node[prop](
|
|
6297
|
+
...args.map(i => {
|
|
6298
|
+
if (typeof i === 'function') {
|
|
6299
|
+
return (child, index) => i(child.toProxy(), index)
|
|
6300
|
+
} else {
|
|
6301
|
+
return i
|
|
6302
|
+
}
|
|
6303
|
+
})
|
|
6304
|
+
)
|
|
6305
|
+
}
|
|
6306
|
+
} else if (prop === 'every' || prop === 'some') {
|
|
6307
|
+
return cb => {
|
|
6308
|
+
return node[prop]((child, ...other) =>
|
|
6309
|
+
cb(child.toProxy(), ...other)
|
|
6310
|
+
)
|
|
6311
|
+
}
|
|
6312
|
+
} else if (prop === 'root') {
|
|
6313
|
+
return () => node.root().toProxy()
|
|
6314
|
+
} else if (prop === 'nodes') {
|
|
6315
|
+
return node.nodes.map(i => i.toProxy())
|
|
6316
|
+
} else if (prop === 'first' || prop === 'last') {
|
|
6317
|
+
return node[prop].toProxy()
|
|
6318
|
+
} else {
|
|
6319
|
+
return node[prop]
|
|
6320
|
+
}
|
|
6321
|
+
},
|
|
6322
|
+
|
|
6323
|
+
set(node, prop, value) {
|
|
6324
|
+
if (node[prop] === value) return true
|
|
6325
|
+
node[prop] = value;
|
|
6326
|
+
if (prop === 'name' || prop === 'params' || prop === 'selector') {
|
|
6327
|
+
node.markDirty();
|
|
6328
|
+
}
|
|
6329
|
+
return true
|
|
6582
6330
|
}
|
|
6583
|
-
inputs.push(inputHydrated);
|
|
6584
|
-
}
|
|
6585
|
-
}
|
|
6586
|
-
if (defaults.nodes) {
|
|
6587
|
-
defaults.nodes = json.nodes.map(n => fromJSON$1(n, inputs));
|
|
6588
|
-
}
|
|
6589
|
-
if (defaults.source) {
|
|
6590
|
-
let { inputId, ...source } = defaults.source;
|
|
6591
|
-
defaults.source = source;
|
|
6592
|
-
if (inputId != null) {
|
|
6593
|
-
defaults.source.input = inputs[inputId];
|
|
6594
6331
|
}
|
|
6595
6332
|
}
|
|
6596
|
-
if (defaults.type === 'root') {
|
|
6597
|
-
return new Root$4(defaults)
|
|
6598
|
-
} else if (defaults.type === 'decl') {
|
|
6599
|
-
return new Declaration$2(defaults)
|
|
6600
|
-
} else if (defaults.type === 'rule') {
|
|
6601
|
-
return new Rule$2(defaults)
|
|
6602
|
-
} else if (defaults.type === 'comment') {
|
|
6603
|
-
return new Comment$2(defaults)
|
|
6604
|
-
} else if (defaults.type === 'atrule') {
|
|
6605
|
-
return new AtRule$2(defaults)
|
|
6606
|
-
} else {
|
|
6607
|
-
throw new Error('Unknown node type: ' + json.type)
|
|
6608
|
-
}
|
|
6609
|
-
}
|
|
6610
6333
|
|
|
6611
|
-
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
|
|
6615
|
-
|
|
6616
|
-
let { pathToFileURL } = require$$2;
|
|
6334
|
+
index(child) {
|
|
6335
|
+
if (typeof child === 'number') return child
|
|
6336
|
+
if (child.proxyOf) child = child.proxyOf;
|
|
6337
|
+
return this.proxyOf.nodes.indexOf(child)
|
|
6338
|
+
}
|
|
6617
6339
|
|
|
6618
|
-
|
|
6340
|
+
insertAfter(exist, add) {
|
|
6341
|
+
let existIndex = this.index(exist);
|
|
6342
|
+
let nodes = this.normalize(add, this.proxyOf.nodes[existIndex]).reverse();
|
|
6343
|
+
existIndex = this.index(exist);
|
|
6344
|
+
for (let node of nodes) this.proxyOf.nodes.splice(existIndex + 1, 0, node);
|
|
6619
6345
|
|
|
6620
|
-
let
|
|
6621
|
-
|
|
6346
|
+
let index;
|
|
6347
|
+
for (let id in this.indexes) {
|
|
6348
|
+
index = this.indexes[id];
|
|
6349
|
+
if (existIndex < index) {
|
|
6350
|
+
this.indexes[id] = index + nodes.length;
|
|
6351
|
+
}
|
|
6352
|
+
}
|
|
6622
6353
|
|
|
6623
|
-
|
|
6624
|
-
constructor(stringify, root, opts, cssString) {
|
|
6625
|
-
this.stringify = stringify;
|
|
6626
|
-
this.mapOpts = opts.map || {};
|
|
6627
|
-
this.root = root;
|
|
6628
|
-
this.opts = opts;
|
|
6629
|
-
this.css = cssString;
|
|
6630
|
-
this.originalCSS = cssString;
|
|
6631
|
-
this.usesFileUrls = !this.mapOpts.from && this.mapOpts.absolute;
|
|
6354
|
+
this.markDirty();
|
|
6632
6355
|
|
|
6633
|
-
this
|
|
6634
|
-
this.memoizedPaths = new Map();
|
|
6635
|
-
this.memoizedURLs = new Map();
|
|
6356
|
+
return this
|
|
6636
6357
|
}
|
|
6637
6358
|
|
|
6638
|
-
|
|
6639
|
-
let
|
|
6359
|
+
insertBefore(exist, add) {
|
|
6360
|
+
let existIndex = this.index(exist);
|
|
6361
|
+
let type = existIndex === 0 ? 'prepend' : false;
|
|
6362
|
+
let nodes = this.normalize(add, this.proxyOf.nodes[existIndex], type).reverse();
|
|
6363
|
+
existIndex = this.index(exist);
|
|
6364
|
+
for (let node of nodes) this.proxyOf.nodes.splice(existIndex, 0, node);
|
|
6640
6365
|
|
|
6641
|
-
|
|
6642
|
-
|
|
6643
|
-
|
|
6644
|
-
|
|
6645
|
-
|
|
6646
|
-
|
|
6647
|
-
content = this.mapOpts.annotation(this.opts.to, this.root);
|
|
6648
|
-
} else {
|
|
6649
|
-
content = this.outputFile() + '.map';
|
|
6366
|
+
let index;
|
|
6367
|
+
for (let id in this.indexes) {
|
|
6368
|
+
index = this.indexes[id];
|
|
6369
|
+
if (existIndex <= index) {
|
|
6370
|
+
this.indexes[id] = index + nodes.length;
|
|
6371
|
+
}
|
|
6650
6372
|
}
|
|
6651
|
-
let eol = '\n';
|
|
6652
|
-
if (this.css.includes('\r\n')) eol = '\r\n';
|
|
6653
6373
|
|
|
6654
|
-
this.
|
|
6374
|
+
this.markDirty();
|
|
6375
|
+
|
|
6376
|
+
return this
|
|
6655
6377
|
}
|
|
6656
6378
|
|
|
6657
|
-
|
|
6658
|
-
|
|
6659
|
-
|
|
6660
|
-
|
|
6661
|
-
|
|
6379
|
+
normalize(nodes, sample) {
|
|
6380
|
+
if (typeof nodes === 'string') {
|
|
6381
|
+
nodes = cleanSource(parse$4(nodes).nodes);
|
|
6382
|
+
} else if (typeof nodes === 'undefined') {
|
|
6383
|
+
nodes = [];
|
|
6384
|
+
} else if (Array.isArray(nodes)) {
|
|
6385
|
+
nodes = nodes.slice(0);
|
|
6386
|
+
for (let i of nodes) {
|
|
6387
|
+
if (i.parent) i.parent.removeChild(i, 'ignore');
|
|
6388
|
+
}
|
|
6389
|
+
} else if (nodes.type === 'root' && this.type !== 'document') {
|
|
6390
|
+
nodes = nodes.nodes.slice(0);
|
|
6391
|
+
for (let i of nodes) {
|
|
6392
|
+
if (i.parent) i.parent.removeChild(i, 'ignore');
|
|
6393
|
+
}
|
|
6394
|
+
} else if (nodes.type) {
|
|
6395
|
+
nodes = [nodes];
|
|
6396
|
+
} else if (nodes.prop) {
|
|
6397
|
+
if (typeof nodes.value === 'undefined') {
|
|
6398
|
+
throw new Error('Value field is missed in node creation')
|
|
6399
|
+
} else if (typeof nodes.value !== 'string') {
|
|
6400
|
+
nodes.value = String(nodes.value);
|
|
6401
|
+
}
|
|
6402
|
+
nodes = [new Declaration$3(nodes)];
|
|
6403
|
+
} else if (nodes.selector) {
|
|
6404
|
+
nodes = [new Rule$4(nodes)];
|
|
6405
|
+
} else if (nodes.name) {
|
|
6406
|
+
nodes = [new AtRule$4(nodes)];
|
|
6407
|
+
} else if (nodes.text) {
|
|
6408
|
+
nodes = [new Comment$3(nodes)];
|
|
6409
|
+
} else {
|
|
6410
|
+
throw new Error('Unknown node type in node creation')
|
|
6411
|
+
}
|
|
6662
6412
|
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6413
|
+
let processed = nodes.map(i => {
|
|
6414
|
+
/* c8 ignore next */
|
|
6415
|
+
if (!i[my$1]) Container$7.rebuild(i);
|
|
6416
|
+
i = i.proxyOf;
|
|
6417
|
+
if (i.parent) i.parent.removeChild(i);
|
|
6418
|
+
if (i[isClean$1]) markDirtyUp(i);
|
|
6419
|
+
if (typeof i.raws.before === 'undefined') {
|
|
6420
|
+
if (sample && typeof sample.raws.before !== 'undefined') {
|
|
6421
|
+
i.raws.before = sample.raws.before.replace(/\S/g, '');
|
|
6667
6422
|
}
|
|
6668
|
-
} else {
|
|
6669
|
-
map = prev.consumer();
|
|
6670
6423
|
}
|
|
6424
|
+
i.parent = this.proxyOf;
|
|
6425
|
+
return i
|
|
6426
|
+
});
|
|
6671
6427
|
|
|
6672
|
-
|
|
6673
|
-
}
|
|
6428
|
+
return processed
|
|
6674
6429
|
}
|
|
6675
6430
|
|
|
6676
|
-
|
|
6677
|
-
|
|
6678
|
-
|
|
6679
|
-
|
|
6680
|
-
let node;
|
|
6681
|
-
for (let
|
|
6682
|
-
|
|
6683
|
-
if (node.type !== 'comment') continue
|
|
6684
|
-
if (node.text.startsWith('# sourceMappingURL=')) {
|
|
6685
|
-
this.root.removeChild(i);
|
|
6686
|
-
}
|
|
6431
|
+
prepend(...children) {
|
|
6432
|
+
children = children.reverse();
|
|
6433
|
+
for (let child of children) {
|
|
6434
|
+
let nodes = this.normalize(child, this.first, 'prepend').reverse();
|
|
6435
|
+
for (let node of nodes) this.proxyOf.nodes.unshift(node);
|
|
6436
|
+
for (let id in this.indexes) {
|
|
6437
|
+
this.indexes[id] = this.indexes[id] + nodes.length;
|
|
6687
6438
|
}
|
|
6688
|
-
} else if (this.css) {
|
|
6689
|
-
this.css = this.css.replace(/\n*\/\*#[\S\s]*?\*\/$/gm, '');
|
|
6690
6439
|
}
|
|
6440
|
+
|
|
6441
|
+
this.markDirty();
|
|
6442
|
+
|
|
6443
|
+
return this
|
|
6691
6444
|
}
|
|
6692
6445
|
|
|
6693
|
-
|
|
6694
|
-
this
|
|
6695
|
-
|
|
6696
|
-
|
|
6697
|
-
} else {
|
|
6698
|
-
let result = '';
|
|
6699
|
-
this.stringify(this.root, i => {
|
|
6700
|
-
result += i;
|
|
6701
|
-
});
|
|
6702
|
-
return [result]
|
|
6703
|
-
}
|
|
6446
|
+
push(child) {
|
|
6447
|
+
child.parent = this;
|
|
6448
|
+
this.proxyOf.nodes.push(child);
|
|
6449
|
+
return this
|
|
6704
6450
|
}
|
|
6705
6451
|
|
|
6706
|
-
|
|
6707
|
-
|
|
6708
|
-
|
|
6709
|
-
} else if (this.previous().length === 1) {
|
|
6710
|
-
let prev = this.previous()[0].consumer();
|
|
6711
|
-
prev.file = this.outputFile();
|
|
6712
|
-
this.map = SourceMapGenerator.fromSourceMap(prev, {
|
|
6713
|
-
ignoreInvalidMapping: true
|
|
6714
|
-
});
|
|
6715
|
-
} else {
|
|
6716
|
-
this.map = new SourceMapGenerator({
|
|
6717
|
-
file: this.outputFile(),
|
|
6718
|
-
ignoreInvalidMapping: true
|
|
6719
|
-
});
|
|
6720
|
-
this.map.addMapping({
|
|
6721
|
-
generated: { column: 0, line: 1 },
|
|
6722
|
-
original: { column: 0, line: 1 },
|
|
6723
|
-
source: this.opts.from
|
|
6724
|
-
? this.toUrl(this.path(this.opts.from))
|
|
6725
|
-
: '<no source>'
|
|
6726
|
-
});
|
|
6727
|
-
}
|
|
6452
|
+
removeAll() {
|
|
6453
|
+
for (let node of this.proxyOf.nodes) node.parent = undefined;
|
|
6454
|
+
this.proxyOf.nodes = [];
|
|
6728
6455
|
|
|
6729
|
-
|
|
6730
|
-
if (this.root && this.previous().length > 0) this.applyPrevMaps();
|
|
6731
|
-
if (this.isAnnotation()) this.addAnnotation();
|
|
6456
|
+
this.markDirty();
|
|
6732
6457
|
|
|
6733
|
-
|
|
6734
|
-
|
|
6735
|
-
|
|
6736
|
-
|
|
6458
|
+
return this
|
|
6459
|
+
}
|
|
6460
|
+
|
|
6461
|
+
removeChild(child) {
|
|
6462
|
+
child = this.index(child);
|
|
6463
|
+
this.proxyOf.nodes[child].parent = undefined;
|
|
6464
|
+
this.proxyOf.nodes.splice(child, 1);
|
|
6465
|
+
|
|
6466
|
+
let index;
|
|
6467
|
+
for (let id in this.indexes) {
|
|
6468
|
+
index = this.indexes[id];
|
|
6469
|
+
if (index >= child) {
|
|
6470
|
+
this.indexes[id] = index - 1;
|
|
6471
|
+
}
|
|
6737
6472
|
}
|
|
6473
|
+
|
|
6474
|
+
this.markDirty();
|
|
6475
|
+
|
|
6476
|
+
return this
|
|
6738
6477
|
}
|
|
6739
6478
|
|
|
6740
|
-
|
|
6741
|
-
|
|
6742
|
-
|
|
6743
|
-
|
|
6744
|
-
|
|
6745
|
-
});
|
|
6479
|
+
replaceValues(pattern, opts, callback) {
|
|
6480
|
+
if (!callback) {
|
|
6481
|
+
callback = opts;
|
|
6482
|
+
opts = {};
|
|
6483
|
+
}
|
|
6746
6484
|
|
|
6747
|
-
|
|
6748
|
-
|
|
6485
|
+
this.walkDecls(decl => {
|
|
6486
|
+
if (opts.props && !opts.props.includes(decl.prop)) return
|
|
6487
|
+
if (opts.fast && !decl.value.includes(opts.fast)) return
|
|
6488
|
+
|
|
6489
|
+
decl.value = decl.value.replace(pattern, callback);
|
|
6490
|
+
});
|
|
6749
6491
|
|
|
6750
|
-
|
|
6751
|
-
let mapping = {
|
|
6752
|
-
generated: { column: 0, line: 0 },
|
|
6753
|
-
original: { column: 0, line: 0 },
|
|
6754
|
-
source: ''
|
|
6755
|
-
};
|
|
6492
|
+
this.markDirty();
|
|
6756
6493
|
|
|
6757
|
-
|
|
6758
|
-
|
|
6759
|
-
this.css += str;
|
|
6494
|
+
return this
|
|
6495
|
+
}
|
|
6760
6496
|
|
|
6761
|
-
|
|
6762
|
-
|
|
6763
|
-
|
|
6764
|
-
if (node.source && node.source.start) {
|
|
6765
|
-
mapping.source = this.sourcePath(node);
|
|
6766
|
-
mapping.original.line = node.source.start.line;
|
|
6767
|
-
mapping.original.column = node.source.start.column - 1;
|
|
6768
|
-
this.map.addMapping(mapping);
|
|
6769
|
-
} else {
|
|
6770
|
-
mapping.source = noSource;
|
|
6771
|
-
mapping.original.line = 1;
|
|
6772
|
-
mapping.original.column = 0;
|
|
6773
|
-
this.map.addMapping(mapping);
|
|
6774
|
-
}
|
|
6775
|
-
}
|
|
6497
|
+
some(condition) {
|
|
6498
|
+
return this.nodes.some(condition)
|
|
6499
|
+
}
|
|
6776
6500
|
|
|
6777
|
-
|
|
6778
|
-
|
|
6779
|
-
|
|
6780
|
-
|
|
6781
|
-
|
|
6782
|
-
}
|
|
6783
|
-
|
|
6501
|
+
walk(callback) {
|
|
6502
|
+
return this.each((child, i) => {
|
|
6503
|
+
let result;
|
|
6504
|
+
try {
|
|
6505
|
+
result = callback(child, i);
|
|
6506
|
+
} catch (e) {
|
|
6507
|
+
throw child.addToError(e)
|
|
6784
6508
|
}
|
|
6785
|
-
|
|
6786
|
-
|
|
6787
|
-
let p = node.parent || { raws: {} };
|
|
6788
|
-
let childless =
|
|
6789
|
-
node.type === 'decl' || (node.type === 'atrule' && !node.nodes);
|
|
6790
|
-
if (!childless || node !== p.last || p.raws.semicolon) {
|
|
6791
|
-
if (node.source && node.source.end) {
|
|
6792
|
-
mapping.source = this.sourcePath(node);
|
|
6793
|
-
mapping.original.line = node.source.end.line;
|
|
6794
|
-
mapping.original.column = node.source.end.column - 1;
|
|
6795
|
-
mapping.generated.line = line;
|
|
6796
|
-
mapping.generated.column = column - 2;
|
|
6797
|
-
this.map.addMapping(mapping);
|
|
6798
|
-
} else {
|
|
6799
|
-
mapping.source = noSource;
|
|
6800
|
-
mapping.original.line = 1;
|
|
6801
|
-
mapping.original.column = 0;
|
|
6802
|
-
mapping.generated.line = line;
|
|
6803
|
-
mapping.generated.column = column - 1;
|
|
6804
|
-
this.map.addMapping(mapping);
|
|
6805
|
-
}
|
|
6806
|
-
}
|
|
6509
|
+
if (result !== false && child.walk) {
|
|
6510
|
+
result = child.walk(callback);
|
|
6807
6511
|
}
|
|
6808
|
-
|
|
6512
|
+
|
|
6513
|
+
return result
|
|
6514
|
+
})
|
|
6809
6515
|
}
|
|
6810
6516
|
|
|
6811
|
-
|
|
6812
|
-
if (
|
|
6813
|
-
|
|
6814
|
-
|
|
6815
|
-
|
|
6816
|
-
|
|
6517
|
+
walkAtRules(name, callback) {
|
|
6518
|
+
if (!callback) {
|
|
6519
|
+
callback = name;
|
|
6520
|
+
return this.walk((child, i) => {
|
|
6521
|
+
if (child.type === 'atrule') {
|
|
6522
|
+
return callback(child, i)
|
|
6523
|
+
}
|
|
6524
|
+
})
|
|
6817
6525
|
}
|
|
6818
|
-
if (
|
|
6819
|
-
return this.
|
|
6526
|
+
if (name instanceof RegExp) {
|
|
6527
|
+
return this.walk((child, i) => {
|
|
6528
|
+
if (child.type === 'atrule' && name.test(child.name)) {
|
|
6529
|
+
return callback(child, i)
|
|
6530
|
+
}
|
|
6531
|
+
})
|
|
6820
6532
|
}
|
|
6821
|
-
return
|
|
6533
|
+
return this.walk((child, i) => {
|
|
6534
|
+
if (child.type === 'atrule' && child.name === name) {
|
|
6535
|
+
return callback(child, i)
|
|
6536
|
+
}
|
|
6537
|
+
})
|
|
6822
6538
|
}
|
|
6823
6539
|
|
|
6824
|
-
|
|
6825
|
-
|
|
6826
|
-
|
|
6827
|
-
|
|
6540
|
+
walkComments(callback) {
|
|
6541
|
+
return this.walk((child, i) => {
|
|
6542
|
+
if (child.type === 'comment') {
|
|
6543
|
+
return callback(child, i)
|
|
6544
|
+
}
|
|
6545
|
+
})
|
|
6546
|
+
}
|
|
6828
6547
|
|
|
6829
|
-
|
|
6830
|
-
if (
|
|
6831
|
-
|
|
6548
|
+
walkDecls(prop, callback) {
|
|
6549
|
+
if (!callback) {
|
|
6550
|
+
callback = prop;
|
|
6551
|
+
return this.walk((child, i) => {
|
|
6552
|
+
if (child.type === 'decl') {
|
|
6553
|
+
return callback(child, i)
|
|
6554
|
+
}
|
|
6555
|
+
})
|
|
6832
6556
|
}
|
|
6833
|
-
|
|
6834
|
-
|
|
6835
|
-
|
|
6557
|
+
if (prop instanceof RegExp) {
|
|
6558
|
+
return this.walk((child, i) => {
|
|
6559
|
+
if (child.type === 'decl' && prop.test(child.prop)) {
|
|
6560
|
+
return callback(child, i)
|
|
6561
|
+
}
|
|
6562
|
+
})
|
|
6836
6563
|
}
|
|
6837
|
-
return
|
|
6564
|
+
return this.walk((child, i) => {
|
|
6565
|
+
if (child.type === 'decl' && child.prop === prop) {
|
|
6566
|
+
return callback(child, i)
|
|
6567
|
+
}
|
|
6568
|
+
})
|
|
6838
6569
|
}
|
|
6839
6570
|
|
|
6840
|
-
|
|
6841
|
-
if (
|
|
6842
|
-
|
|
6843
|
-
}
|
|
6844
|
-
return this.previous().length > 0
|
|
6845
|
-
}
|
|
6571
|
+
walkRules(selector, callback) {
|
|
6572
|
+
if (!callback) {
|
|
6573
|
+
callback = selector;
|
|
6846
6574
|
|
|
6847
|
-
|
|
6848
|
-
|
|
6849
|
-
|
|
6575
|
+
return this.walk((child, i) => {
|
|
6576
|
+
if (child.type === 'rule') {
|
|
6577
|
+
return callback(child, i)
|
|
6578
|
+
}
|
|
6579
|
+
})
|
|
6850
6580
|
}
|
|
6851
|
-
if (
|
|
6852
|
-
return this.
|
|
6581
|
+
if (selector instanceof RegExp) {
|
|
6582
|
+
return this.walk((child, i) => {
|
|
6583
|
+
if (child.type === 'rule' && selector.test(child.selector)) {
|
|
6584
|
+
return callback(child, i)
|
|
6585
|
+
}
|
|
6586
|
+
})
|
|
6853
6587
|
}
|
|
6854
|
-
return
|
|
6588
|
+
return this.walk((child, i) => {
|
|
6589
|
+
if (child.type === 'rule' && child.selector === selector) {
|
|
6590
|
+
return callback(child, i)
|
|
6591
|
+
}
|
|
6592
|
+
})
|
|
6855
6593
|
}
|
|
6856
6594
|
|
|
6857
|
-
|
|
6858
|
-
if (this.
|
|
6859
|
-
|
|
6860
|
-
} else if (this.opts.from) {
|
|
6861
|
-
return this.path(this.opts.from)
|
|
6862
|
-
} else {
|
|
6863
|
-
return 'to.css'
|
|
6864
|
-
}
|
|
6595
|
+
get first() {
|
|
6596
|
+
if (!this.proxyOf.nodes) return undefined
|
|
6597
|
+
return this.proxyOf.nodes[0]
|
|
6865
6598
|
}
|
|
6866
6599
|
|
|
6867
|
-
|
|
6868
|
-
if (this.
|
|
6869
|
-
|
|
6870
|
-
|
|
6871
|
-
|
|
6872
|
-
if (cached) return cached
|
|
6600
|
+
get last() {
|
|
6601
|
+
if (!this.proxyOf.nodes) return undefined
|
|
6602
|
+
return this.proxyOf.nodes[this.proxyOf.nodes.length - 1]
|
|
6603
|
+
}
|
|
6604
|
+
}
|
|
6873
6605
|
|
|
6874
|
-
|
|
6606
|
+
Container$7.registerParse = dependant => {
|
|
6607
|
+
parse$4 = dependant;
|
|
6608
|
+
};
|
|
6875
6609
|
|
|
6876
|
-
|
|
6877
|
-
|
|
6878
|
-
|
|
6610
|
+
Container$7.registerRule = dependant => {
|
|
6611
|
+
Rule$4 = dependant;
|
|
6612
|
+
};
|
|
6879
6613
|
|
|
6880
|
-
|
|
6881
|
-
|
|
6614
|
+
Container$7.registerAtRule = dependant => {
|
|
6615
|
+
AtRule$4 = dependant;
|
|
6616
|
+
};
|
|
6882
6617
|
|
|
6883
|
-
|
|
6618
|
+
Container$7.registerRoot = dependant => {
|
|
6619
|
+
Root$6 = dependant;
|
|
6620
|
+
};
|
|
6621
|
+
|
|
6622
|
+
var container = Container$7;
|
|
6623
|
+
Container$7.default = Container$7;
|
|
6624
|
+
|
|
6625
|
+
/* c8 ignore start */
|
|
6626
|
+
Container$7.rebuild = node => {
|
|
6627
|
+
if (node.type === 'atrule') {
|
|
6628
|
+
Object.setPrototypeOf(node, AtRule$4.prototype);
|
|
6629
|
+
} else if (node.type === 'rule') {
|
|
6630
|
+
Object.setPrototypeOf(node, Rule$4.prototype);
|
|
6631
|
+
} else if (node.type === 'decl') {
|
|
6632
|
+
Object.setPrototypeOf(node, Declaration$3.prototype);
|
|
6633
|
+
} else if (node.type === 'comment') {
|
|
6634
|
+
Object.setPrototypeOf(node, Comment$3.prototype);
|
|
6635
|
+
} else if (node.type === 'root') {
|
|
6636
|
+
Object.setPrototypeOf(node, Root$6.prototype);
|
|
6884
6637
|
}
|
|
6885
6638
|
|
|
6886
|
-
|
|
6887
|
-
|
|
6888
|
-
|
|
6889
|
-
|
|
6890
|
-
|
|
6891
|
-
|
|
6892
|
-
|
|
6893
|
-
|
|
6894
|
-
|
|
6895
|
-
|
|
6896
|
-
|
|
6897
|
-
|
|
6898
|
-
|
|
6899
|
-
|
|
6900
|
-
|
|
6901
|
-
|
|
6639
|
+
node[my$1] = true;
|
|
6640
|
+
|
|
6641
|
+
if (node.nodes) {
|
|
6642
|
+
node.nodes.forEach(child => {
|
|
6643
|
+
Container$7.rebuild(child);
|
|
6644
|
+
});
|
|
6645
|
+
}
|
|
6646
|
+
};
|
|
6647
|
+
|
|
6648
|
+
let Container$6 = container;
|
|
6649
|
+
|
|
6650
|
+
let LazyResult$4, Processor$3;
|
|
6651
|
+
|
|
6652
|
+
class Document$3 extends Container$6 {
|
|
6653
|
+
constructor(defaults) {
|
|
6654
|
+
// type needs to be passed to super, otherwise child roots won't be normalized correctly
|
|
6655
|
+
super({ type: 'document', ...defaults });
|
|
6656
|
+
|
|
6657
|
+
if (!this.nodes) {
|
|
6658
|
+
this.nodes = [];
|
|
6902
6659
|
}
|
|
6660
|
+
}
|
|
6903
6661
|
|
|
6904
|
-
|
|
6662
|
+
toResult(opts = {}) {
|
|
6663
|
+
let lazy = new LazyResult$4(new Processor$3(), this, opts);
|
|
6664
|
+
|
|
6665
|
+
return lazy.stringify()
|
|
6905
6666
|
}
|
|
6667
|
+
}
|
|
6906
6668
|
|
|
6907
|
-
|
|
6908
|
-
|
|
6909
|
-
|
|
6910
|
-
|
|
6911
|
-
|
|
6912
|
-
|
|
6913
|
-
|
|
6914
|
-
|
|
6915
|
-
|
|
6916
|
-
|
|
6917
|
-
|
|
6918
|
-
|
|
6919
|
-
|
|
6920
|
-
|
|
6921
|
-
|
|
6922
|
-
|
|
6923
|
-
|
|
6924
|
-
|
|
6925
|
-
|
|
6926
|
-
this.
|
|
6669
|
+
Document$3.registerLazyResult = dependant => {
|
|
6670
|
+
LazyResult$4 = dependant;
|
|
6671
|
+
};
|
|
6672
|
+
|
|
6673
|
+
Document$3.registerProcessor = dependant => {
|
|
6674
|
+
Processor$3 = dependant;
|
|
6675
|
+
};
|
|
6676
|
+
|
|
6677
|
+
var document = Document$3;
|
|
6678
|
+
Document$3.default = Document$3;
|
|
6679
|
+
|
|
6680
|
+
class Warning$2 {
|
|
6681
|
+
constructor(text, opts = {}) {
|
|
6682
|
+
this.type = 'warning';
|
|
6683
|
+
this.text = text;
|
|
6684
|
+
|
|
6685
|
+
if (opts.node && opts.node.source) {
|
|
6686
|
+
let range = opts.node.rangeBy(opts);
|
|
6687
|
+
this.line = range.start.line;
|
|
6688
|
+
this.column = range.start.column;
|
|
6689
|
+
this.endLine = range.end.line;
|
|
6690
|
+
this.endColumn = range.end.column;
|
|
6927
6691
|
}
|
|
6692
|
+
|
|
6693
|
+
for (let opt in opts) this[opt] = opts[opt];
|
|
6928
6694
|
}
|
|
6929
6695
|
|
|
6930
|
-
|
|
6931
|
-
if (this.
|
|
6932
|
-
return this.
|
|
6933
|
-
|
|
6934
|
-
|
|
6935
|
-
|
|
6936
|
-
|
|
6696
|
+
toString() {
|
|
6697
|
+
if (this.node) {
|
|
6698
|
+
return this.node.error(this.text, {
|
|
6699
|
+
index: this.index,
|
|
6700
|
+
plugin: this.plugin,
|
|
6701
|
+
word: this.word
|
|
6702
|
+
}).message
|
|
6937
6703
|
}
|
|
6938
|
-
}
|
|
6939
6704
|
|
|
6940
|
-
|
|
6941
|
-
|
|
6942
|
-
return Buffer.from(str).toString('base64')
|
|
6943
|
-
} else {
|
|
6944
|
-
return window.btoa(unescape(encodeURIComponent(str)))
|
|
6705
|
+
if (this.plugin) {
|
|
6706
|
+
return this.plugin + ': ' + this.text
|
|
6945
6707
|
}
|
|
6708
|
+
|
|
6709
|
+
return this.text
|
|
6946
6710
|
}
|
|
6711
|
+
}
|
|
6947
6712
|
|
|
6948
|
-
|
|
6949
|
-
|
|
6950
|
-
if (cached) return cached
|
|
6713
|
+
var warning = Warning$2;
|
|
6714
|
+
Warning$2.default = Warning$2;
|
|
6951
6715
|
|
|
6952
|
-
|
|
6953
|
-
let fileURL = pathToFileURL(path).toString();
|
|
6954
|
-
this.memoizedFileURLs.set(path, fileURL);
|
|
6716
|
+
let Warning$1 = warning;
|
|
6955
6717
|
|
|
6956
|
-
|
|
6957
|
-
|
|
6958
|
-
|
|
6959
|
-
|
|
6960
|
-
|
|
6961
|
-
|
|
6718
|
+
class Result$3 {
|
|
6719
|
+
constructor(processor, root, opts) {
|
|
6720
|
+
this.processor = processor;
|
|
6721
|
+
this.messages = [];
|
|
6722
|
+
this.root = root;
|
|
6723
|
+
this.opts = opts;
|
|
6724
|
+
this.css = undefined;
|
|
6725
|
+
this.map = undefined;
|
|
6962
6726
|
}
|
|
6963
6727
|
|
|
6964
|
-
|
|
6965
|
-
|
|
6966
|
-
|
|
6728
|
+
toString() {
|
|
6729
|
+
return this.css
|
|
6730
|
+
}
|
|
6967
6731
|
|
|
6968
|
-
|
|
6969
|
-
|
|
6732
|
+
warn(text, opts = {}) {
|
|
6733
|
+
if (!opts.plugin) {
|
|
6734
|
+
if (this.lastPlugin && this.lastPlugin.postcssPlugin) {
|
|
6735
|
+
opts.plugin = this.lastPlugin.postcssPlugin;
|
|
6736
|
+
}
|
|
6970
6737
|
}
|
|
6971
6738
|
|
|
6972
|
-
let
|
|
6973
|
-
this.
|
|
6739
|
+
let warning = new Warning$1(text, opts);
|
|
6740
|
+
this.messages.push(warning);
|
|
6974
6741
|
|
|
6975
|
-
return
|
|
6742
|
+
return warning
|
|
6743
|
+
}
|
|
6744
|
+
|
|
6745
|
+
warnings() {
|
|
6746
|
+
return this.messages.filter(i => i.type === 'warning')
|
|
6747
|
+
}
|
|
6748
|
+
|
|
6749
|
+
get content() {
|
|
6750
|
+
return this.css
|
|
6976
6751
|
}
|
|
6977
6752
|
}
|
|
6978
6753
|
|
|
6979
|
-
var
|
|
6754
|
+
var result = Result$3;
|
|
6755
|
+
Result$3.default = Result$3;
|
|
6980
6756
|
|
|
6981
6757
|
const SINGLE_QUOTE = "'".charCodeAt(0);
|
|
6982
6758
|
const DOUBLE_QUOTE = '"'.charCodeAt(0);
|
|
@@ -7007,8 +6783,8 @@ var tokenize = function tokenizer(input, options = {}) {
|
|
|
7007
6783
|
let css = input.css.valueOf();
|
|
7008
6784
|
let ignore = options.ignoreErrors;
|
|
7009
6785
|
|
|
7010
|
-
let code,
|
|
7011
|
-
let
|
|
6786
|
+
let code, next, quote, content, escape;
|
|
6787
|
+
let escaped, escapePos, prev, n, currentToken;
|
|
7012
6788
|
|
|
7013
6789
|
let length = css.length;
|
|
7014
6790
|
let pos = 0;
|
|
@@ -7223,32 +6999,199 @@ var tokenize = function tokenizer(input, options = {}) {
|
|
|
7223
6999
|
pos = next;
|
|
7224
7000
|
}
|
|
7225
7001
|
|
|
7226
|
-
break
|
|
7002
|
+
break
|
|
7003
|
+
}
|
|
7004
|
+
}
|
|
7005
|
+
|
|
7006
|
+
pos++;
|
|
7007
|
+
return currentToken
|
|
7008
|
+
}
|
|
7009
|
+
|
|
7010
|
+
function back(token) {
|
|
7011
|
+
returned.push(token);
|
|
7012
|
+
}
|
|
7013
|
+
|
|
7014
|
+
return {
|
|
7015
|
+
back,
|
|
7016
|
+
endOfFile,
|
|
7017
|
+
nextToken,
|
|
7018
|
+
position
|
|
7019
|
+
}
|
|
7020
|
+
};
|
|
7021
|
+
|
|
7022
|
+
let Container$5 = container;
|
|
7023
|
+
|
|
7024
|
+
class AtRule$3 extends Container$5 {
|
|
7025
|
+
constructor(defaults) {
|
|
7026
|
+
super(defaults);
|
|
7027
|
+
this.type = 'atrule';
|
|
7028
|
+
}
|
|
7029
|
+
|
|
7030
|
+
append(...children) {
|
|
7031
|
+
if (!this.proxyOf.nodes) this.nodes = [];
|
|
7032
|
+
return super.append(...children)
|
|
7033
|
+
}
|
|
7034
|
+
|
|
7035
|
+
prepend(...children) {
|
|
7036
|
+
if (!this.proxyOf.nodes) this.nodes = [];
|
|
7037
|
+
return super.prepend(...children)
|
|
7038
|
+
}
|
|
7039
|
+
}
|
|
7040
|
+
|
|
7041
|
+
var atRule = AtRule$3;
|
|
7042
|
+
AtRule$3.default = AtRule$3;
|
|
7043
|
+
|
|
7044
|
+
Container$5.registerAtRule(AtRule$3);
|
|
7045
|
+
|
|
7046
|
+
let Container$4 = container;
|
|
7047
|
+
|
|
7048
|
+
let LazyResult$3, Processor$2;
|
|
7049
|
+
|
|
7050
|
+
class Root$5 extends Container$4 {
|
|
7051
|
+
constructor(defaults) {
|
|
7052
|
+
super(defaults);
|
|
7053
|
+
this.type = 'root';
|
|
7054
|
+
if (!this.nodes) this.nodes = [];
|
|
7055
|
+
}
|
|
7056
|
+
|
|
7057
|
+
normalize(child, sample, type) {
|
|
7058
|
+
let nodes = super.normalize(child);
|
|
7059
|
+
|
|
7060
|
+
if (sample) {
|
|
7061
|
+
if (type === 'prepend') {
|
|
7062
|
+
if (this.nodes.length > 1) {
|
|
7063
|
+
sample.raws.before = this.nodes[1].raws.before;
|
|
7064
|
+
} else {
|
|
7065
|
+
delete sample.raws.before;
|
|
7066
|
+
}
|
|
7067
|
+
} else if (this.first !== sample) {
|
|
7068
|
+
for (let node of nodes) {
|
|
7069
|
+
node.raws.before = sample.raws.before;
|
|
7070
|
+
}
|
|
7071
|
+
}
|
|
7072
|
+
}
|
|
7073
|
+
|
|
7074
|
+
return nodes
|
|
7075
|
+
}
|
|
7076
|
+
|
|
7077
|
+
removeChild(child, ignore) {
|
|
7078
|
+
let index = this.index(child);
|
|
7079
|
+
|
|
7080
|
+
if (!ignore && index === 0 && this.nodes.length > 1) {
|
|
7081
|
+
this.nodes[1].raws.before = this.nodes[index].raws.before;
|
|
7082
|
+
}
|
|
7083
|
+
|
|
7084
|
+
return super.removeChild(child)
|
|
7085
|
+
}
|
|
7086
|
+
|
|
7087
|
+
toResult(opts = {}) {
|
|
7088
|
+
let lazy = new LazyResult$3(new Processor$2(), this, opts);
|
|
7089
|
+
return lazy.stringify()
|
|
7090
|
+
}
|
|
7091
|
+
}
|
|
7092
|
+
|
|
7093
|
+
Root$5.registerLazyResult = dependant => {
|
|
7094
|
+
LazyResult$3 = dependant;
|
|
7095
|
+
};
|
|
7096
|
+
|
|
7097
|
+
Root$5.registerProcessor = dependant => {
|
|
7098
|
+
Processor$2 = dependant;
|
|
7099
|
+
};
|
|
7100
|
+
|
|
7101
|
+
var root = Root$5;
|
|
7102
|
+
Root$5.default = Root$5;
|
|
7103
|
+
|
|
7104
|
+
Container$4.registerRoot(Root$5);
|
|
7105
|
+
|
|
7106
|
+
let list$2 = {
|
|
7107
|
+
comma(string) {
|
|
7108
|
+
return list$2.split(string, [','], true)
|
|
7109
|
+
},
|
|
7110
|
+
|
|
7111
|
+
space(string) {
|
|
7112
|
+
let spaces = [' ', '\n', '\t'];
|
|
7113
|
+
return list$2.split(string, spaces)
|
|
7114
|
+
},
|
|
7115
|
+
|
|
7116
|
+
split(string, separators, last) {
|
|
7117
|
+
let array = [];
|
|
7118
|
+
let current = '';
|
|
7119
|
+
let split = false;
|
|
7120
|
+
|
|
7121
|
+
let func = 0;
|
|
7122
|
+
let inQuote = false;
|
|
7123
|
+
let prevQuote = '';
|
|
7124
|
+
let escape = false;
|
|
7125
|
+
|
|
7126
|
+
for (let letter of string) {
|
|
7127
|
+
if (escape) {
|
|
7128
|
+
escape = false;
|
|
7129
|
+
} else if (letter === '\\') {
|
|
7130
|
+
escape = true;
|
|
7131
|
+
} else if (inQuote) {
|
|
7132
|
+
if (letter === prevQuote) {
|
|
7133
|
+
inQuote = false;
|
|
7134
|
+
}
|
|
7135
|
+
} else if (letter === '"' || letter === "'") {
|
|
7136
|
+
inQuote = true;
|
|
7137
|
+
prevQuote = letter;
|
|
7138
|
+
} else if (letter === '(') {
|
|
7139
|
+
func += 1;
|
|
7140
|
+
} else if (letter === ')') {
|
|
7141
|
+
if (func > 0) func -= 1;
|
|
7142
|
+
} else if (func === 0) {
|
|
7143
|
+
if (separators.includes(letter)) split = true;
|
|
7144
|
+
}
|
|
7145
|
+
|
|
7146
|
+
if (split) {
|
|
7147
|
+
if (current !== '') array.push(current.trim());
|
|
7148
|
+
current = '';
|
|
7149
|
+
split = false;
|
|
7150
|
+
} else {
|
|
7151
|
+
current += letter;
|
|
7227
7152
|
}
|
|
7228
7153
|
}
|
|
7229
7154
|
|
|
7230
|
-
|
|
7231
|
-
return
|
|
7155
|
+
if (last || current !== '') array.push(current.trim());
|
|
7156
|
+
return array
|
|
7232
7157
|
}
|
|
7158
|
+
};
|
|
7233
7159
|
|
|
7234
|
-
|
|
7235
|
-
|
|
7160
|
+
var list_1 = list$2;
|
|
7161
|
+
list$2.default = list$2;
|
|
7162
|
+
|
|
7163
|
+
let Container$3 = container;
|
|
7164
|
+
let list$1 = list_1;
|
|
7165
|
+
|
|
7166
|
+
class Rule$3 extends Container$3 {
|
|
7167
|
+
constructor(defaults) {
|
|
7168
|
+
super(defaults);
|
|
7169
|
+
this.type = 'rule';
|
|
7170
|
+
if (!this.nodes) this.nodes = [];
|
|
7236
7171
|
}
|
|
7237
7172
|
|
|
7238
|
-
|
|
7239
|
-
|
|
7240
|
-
endOfFile,
|
|
7241
|
-
nextToken,
|
|
7242
|
-
position
|
|
7173
|
+
get selectors() {
|
|
7174
|
+
return list$1.comma(this.selector)
|
|
7243
7175
|
}
|
|
7244
|
-
};
|
|
7245
7176
|
|
|
7246
|
-
|
|
7247
|
-
let
|
|
7248
|
-
let
|
|
7249
|
-
|
|
7250
|
-
|
|
7177
|
+
set selectors(values) {
|
|
7178
|
+
let match = this.selector ? this.selector.match(/,\s*/) : null;
|
|
7179
|
+
let sep = match ? match[0] : ',' + this.raw('between', 'beforeOpen');
|
|
7180
|
+
this.selector = values.join(sep);
|
|
7181
|
+
}
|
|
7182
|
+
}
|
|
7183
|
+
|
|
7184
|
+
var rule = Rule$3;
|
|
7185
|
+
Rule$3.default = Rule$3;
|
|
7186
|
+
|
|
7187
|
+
Container$3.registerRule(Rule$3);
|
|
7188
|
+
|
|
7189
|
+
let Declaration$2 = declaration;
|
|
7251
7190
|
let tokenizer = tokenize;
|
|
7191
|
+
let Comment$2 = comment;
|
|
7192
|
+
let AtRule$2 = atRule;
|
|
7193
|
+
let Root$4 = root;
|
|
7194
|
+
let Rule$2 = rule;
|
|
7252
7195
|
|
|
7253
7196
|
const SAFE_COMMENT_NEIGHBOR = {
|
|
7254
7197
|
empty: true,
|
|
@@ -7267,7 +7210,7 @@ class Parser$1 {
|
|
|
7267
7210
|
constructor(input) {
|
|
7268
7211
|
this.input = input;
|
|
7269
7212
|
|
|
7270
|
-
this.root = new Root$
|
|
7213
|
+
this.root = new Root$4();
|
|
7271
7214
|
this.current = this.root;
|
|
7272
7215
|
this.spaces = '';
|
|
7273
7216
|
this.semicolon = false;
|
|
@@ -7277,7 +7220,7 @@ class Parser$1 {
|
|
|
7277
7220
|
}
|
|
7278
7221
|
|
|
7279
7222
|
atrule(token) {
|
|
7280
|
-
let node = new AtRule$
|
|
7223
|
+
let node = new AtRule$2();
|
|
7281
7224
|
node.name = token[1].slice(1);
|
|
7282
7225
|
if (node.name === '') {
|
|
7283
7226
|
this.unnamedAtrule(node, token);
|
|
@@ -7386,7 +7329,7 @@ class Parser$1 {
|
|
|
7386
7329
|
|
|
7387
7330
|
colon(tokens) {
|
|
7388
7331
|
let brackets = 0;
|
|
7389
|
-
let
|
|
7332
|
+
let token, type, prev;
|
|
7390
7333
|
for (let [i, element] of tokens.entries()) {
|
|
7391
7334
|
token = element;
|
|
7392
7335
|
type = token[0];
|
|
@@ -7413,7 +7356,7 @@ class Parser$1 {
|
|
|
7413
7356
|
}
|
|
7414
7357
|
|
|
7415
7358
|
comment(token) {
|
|
7416
|
-
let node = new Comment$
|
|
7359
|
+
let node = new Comment$2();
|
|
7417
7360
|
this.init(node, token[2]);
|
|
7418
7361
|
node.source.end = this.getPosition(token[3] || token[2]);
|
|
7419
7362
|
node.source.end.offset++;
|
|
@@ -7436,7 +7379,7 @@ class Parser$1 {
|
|
|
7436
7379
|
}
|
|
7437
7380
|
|
|
7438
7381
|
decl(tokens, customProperty) {
|
|
7439
|
-
let node = new Declaration$
|
|
7382
|
+
let node = new Declaration$2();
|
|
7440
7383
|
this.init(node, tokens[0][2]);
|
|
7441
7384
|
|
|
7442
7385
|
let last = tokens[tokens.length - 1];
|
|
@@ -7510,12 +7453,12 @@ class Parser$1 {
|
|
|
7510
7453
|
let str = '';
|
|
7511
7454
|
for (let j = i; j > 0; j--) {
|
|
7512
7455
|
let type = cache[j][0];
|
|
7513
|
-
if (str.trim().
|
|
7456
|
+
if (str.trim().indexOf('!') === 0 && type !== 'space') {
|
|
7514
7457
|
break
|
|
7515
7458
|
}
|
|
7516
7459
|
str = cache.pop()[1] + str;
|
|
7517
7460
|
}
|
|
7518
|
-
if (str.trim().
|
|
7461
|
+
if (str.trim().indexOf('!') === 0) {
|
|
7519
7462
|
node.important = true;
|
|
7520
7463
|
node.raws.important = str;
|
|
7521
7464
|
tokens = cache;
|
|
@@ -7549,7 +7492,7 @@ class Parser$1 {
|
|
|
7549
7492
|
}
|
|
7550
7493
|
|
|
7551
7494
|
emptyRule(token) {
|
|
7552
|
-
let node = new Rule$
|
|
7495
|
+
let node = new Rule$2();
|
|
7553
7496
|
this.init(node, token[2]);
|
|
7554
7497
|
node.selector = '';
|
|
7555
7498
|
node.raws.between = '';
|
|
@@ -7759,7 +7702,7 @@ class Parser$1 {
|
|
|
7759
7702
|
rule(tokens) {
|
|
7760
7703
|
tokens.pop();
|
|
7761
7704
|
|
|
7762
|
-
let node = new Rule$
|
|
7705
|
+
let node = new Rule$2();
|
|
7763
7706
|
this.init(node, tokens[0][2]);
|
|
7764
7707
|
|
|
7765
7708
|
node.raws.between = this.spacesAndCommentsFromEnd(tokens);
|
|
@@ -7852,11 +7795,11 @@ class Parser$1 {
|
|
|
7852
7795
|
var parser = Parser$1;
|
|
7853
7796
|
|
|
7854
7797
|
let Container$2 = container;
|
|
7855
|
-
let Input$1 = input;
|
|
7856
7798
|
let Parser = parser;
|
|
7799
|
+
let Input$2 = input;
|
|
7857
7800
|
|
|
7858
7801
|
function parse$3(css, opts) {
|
|
7859
|
-
let input = new Input$
|
|
7802
|
+
let input = new Input$2(css, opts);
|
|
7860
7803
|
let parser = new Parser(input);
|
|
7861
7804
|
try {
|
|
7862
7805
|
parser.parse();
|
|
@@ -7872,91 +7815,14 @@ parse$3.default = parse$3;
|
|
|
7872
7815
|
|
|
7873
7816
|
Container$2.registerParse(parse$3);
|
|
7874
7817
|
|
|
7875
|
-
|
|
7876
|
-
|
|
7877
|
-
|
|
7878
|
-
this.text = text;
|
|
7879
|
-
|
|
7880
|
-
if (opts.node && opts.node.source) {
|
|
7881
|
-
let range = opts.node.rangeBy(opts);
|
|
7882
|
-
this.line = range.start.line;
|
|
7883
|
-
this.column = range.start.column;
|
|
7884
|
-
this.endLine = range.end.line;
|
|
7885
|
-
this.endColumn = range.end.column;
|
|
7886
|
-
}
|
|
7887
|
-
|
|
7888
|
-
for (let opt in opts) this[opt] = opts[opt];
|
|
7889
|
-
}
|
|
7890
|
-
|
|
7891
|
-
toString() {
|
|
7892
|
-
if (this.node) {
|
|
7893
|
-
return this.node.error(this.text, {
|
|
7894
|
-
index: this.index,
|
|
7895
|
-
plugin: this.plugin,
|
|
7896
|
-
word: this.word
|
|
7897
|
-
}).message
|
|
7898
|
-
}
|
|
7899
|
-
|
|
7900
|
-
if (this.plugin) {
|
|
7901
|
-
return this.plugin + ': ' + this.text
|
|
7902
|
-
}
|
|
7903
|
-
|
|
7904
|
-
return this.text
|
|
7905
|
-
}
|
|
7906
|
-
}
|
|
7907
|
-
|
|
7908
|
-
var warning = Warning$2;
|
|
7909
|
-
Warning$2.default = Warning$2;
|
|
7910
|
-
|
|
7911
|
-
let Warning$1 = warning;
|
|
7912
|
-
|
|
7913
|
-
class Result$3 {
|
|
7914
|
-
constructor(processor, root, opts) {
|
|
7915
|
-
this.processor = processor;
|
|
7916
|
-
this.messages = [];
|
|
7917
|
-
this.root = root;
|
|
7918
|
-
this.opts = opts;
|
|
7919
|
-
this.css = undefined;
|
|
7920
|
-
this.map = undefined;
|
|
7921
|
-
}
|
|
7922
|
-
|
|
7923
|
-
toString() {
|
|
7924
|
-
return this.css
|
|
7925
|
-
}
|
|
7926
|
-
|
|
7927
|
-
warn(text, opts = {}) {
|
|
7928
|
-
if (!opts.plugin) {
|
|
7929
|
-
if (this.lastPlugin && this.lastPlugin.postcssPlugin) {
|
|
7930
|
-
opts.plugin = this.lastPlugin.postcssPlugin;
|
|
7931
|
-
}
|
|
7932
|
-
}
|
|
7933
|
-
|
|
7934
|
-
let warning = new Warning$1(text, opts);
|
|
7935
|
-
this.messages.push(warning);
|
|
7936
|
-
|
|
7937
|
-
return warning
|
|
7938
|
-
}
|
|
7939
|
-
|
|
7940
|
-
warnings() {
|
|
7941
|
-
return this.messages.filter(i => i.type === 'warning')
|
|
7942
|
-
}
|
|
7943
|
-
|
|
7944
|
-
get content() {
|
|
7945
|
-
return this.css
|
|
7946
|
-
}
|
|
7947
|
-
}
|
|
7948
|
-
|
|
7949
|
-
var result = Result$3;
|
|
7950
|
-
Result$3.default = Result$3;
|
|
7951
|
-
|
|
7818
|
+
let { isClean, my } = symbols;
|
|
7819
|
+
let MapGenerator$1 = mapGenerator;
|
|
7820
|
+
let stringify$2 = stringify_1;
|
|
7952
7821
|
let Container$1 = container;
|
|
7953
7822
|
let Document$2 = document;
|
|
7954
|
-
let MapGenerator$1 = mapGenerator;
|
|
7955
|
-
let parse$2 = parse_1;
|
|
7956
7823
|
let Result$2 = result;
|
|
7957
|
-
let
|
|
7958
|
-
let
|
|
7959
|
-
let { isClean, my } = symbols;
|
|
7824
|
+
let parse$2 = parse_1;
|
|
7825
|
+
let Root$3 = root;
|
|
7960
7826
|
|
|
7961
7827
|
const TYPE_TO_CLASS_NAME = {
|
|
7962
7828
|
atrule: 'AtRule',
|
|
@@ -8463,13 +8329,13 @@ LazyResult$2.registerPostcss = dependant => {
|
|
|
8463
8329
|
var lazyResult = LazyResult$2;
|
|
8464
8330
|
LazyResult$2.default = LazyResult$2;
|
|
8465
8331
|
|
|
8466
|
-
Root$
|
|
8332
|
+
Root$3.registerLazyResult(LazyResult$2);
|
|
8467
8333
|
Document$2.registerLazyResult(LazyResult$2);
|
|
8468
8334
|
|
|
8469
8335
|
let MapGenerator = mapGenerator;
|
|
8336
|
+
let stringify$1 = stringify_1;
|
|
8470
8337
|
let parse$1 = parse_1;
|
|
8471
8338
|
const Result$1 = result;
|
|
8472
|
-
let stringify$1 = stringify_1;
|
|
8473
8339
|
|
|
8474
8340
|
class NoWorkResult$1 {
|
|
8475
8341
|
constructor(processor, css, opts) {
|
|
@@ -8593,14 +8459,14 @@ class NoWorkResult$1 {
|
|
|
8593
8459
|
var noWorkResult = NoWorkResult$1;
|
|
8594
8460
|
NoWorkResult$1.default = NoWorkResult$1;
|
|
8595
8461
|
|
|
8596
|
-
let Document$1 = document;
|
|
8597
|
-
let LazyResult$1 = lazyResult;
|
|
8598
8462
|
let NoWorkResult = noWorkResult;
|
|
8599
|
-
let
|
|
8463
|
+
let LazyResult$1 = lazyResult;
|
|
8464
|
+
let Document$1 = document;
|
|
8465
|
+
let Root$2 = root;
|
|
8600
8466
|
|
|
8601
8467
|
class Processor$1 {
|
|
8602
8468
|
constructor(plugins = []) {
|
|
8603
|
-
this.version = '8.4.
|
|
8469
|
+
this.version = '8.4.35';
|
|
8604
8470
|
this.plugins = this.normalize(plugins);
|
|
8605
8471
|
}
|
|
8606
8472
|
|
|
@@ -8648,27 +8514,80 @@ class Processor$1 {
|
|
|
8648
8514
|
var processor = Processor$1;
|
|
8649
8515
|
Processor$1.default = Processor$1;
|
|
8650
8516
|
|
|
8651
|
-
Root$
|
|
8517
|
+
Root$2.registerProcessor(Processor$1);
|
|
8652
8518
|
Document$1.registerProcessor(Processor$1);
|
|
8653
8519
|
|
|
8654
|
-
let
|
|
8655
|
-
let
|
|
8656
|
-
let
|
|
8520
|
+
let Declaration$1 = declaration;
|
|
8521
|
+
let PreviousMap = previousMap;
|
|
8522
|
+
let Comment$1 = comment;
|
|
8523
|
+
let AtRule$1 = atRule;
|
|
8524
|
+
let Input$1 = input;
|
|
8525
|
+
let Root$1 = root;
|
|
8526
|
+
let Rule$1 = rule;
|
|
8527
|
+
|
|
8528
|
+
function fromJSON$1(json, inputs) {
|
|
8529
|
+
if (Array.isArray(json)) return json.map(n => fromJSON$1(n))
|
|
8530
|
+
|
|
8531
|
+
let { inputs: ownInputs, ...defaults } = json;
|
|
8532
|
+
if (ownInputs) {
|
|
8533
|
+
inputs = [];
|
|
8534
|
+
for (let input of ownInputs) {
|
|
8535
|
+
let inputHydrated = { ...input, __proto__: Input$1.prototype };
|
|
8536
|
+
if (inputHydrated.map) {
|
|
8537
|
+
inputHydrated.map = {
|
|
8538
|
+
...inputHydrated.map,
|
|
8539
|
+
__proto__: PreviousMap.prototype
|
|
8540
|
+
};
|
|
8541
|
+
}
|
|
8542
|
+
inputs.push(inputHydrated);
|
|
8543
|
+
}
|
|
8544
|
+
}
|
|
8545
|
+
if (defaults.nodes) {
|
|
8546
|
+
defaults.nodes = json.nodes.map(n => fromJSON$1(n, inputs));
|
|
8547
|
+
}
|
|
8548
|
+
if (defaults.source) {
|
|
8549
|
+
let { inputId, ...source } = defaults.source;
|
|
8550
|
+
defaults.source = source;
|
|
8551
|
+
if (inputId != null) {
|
|
8552
|
+
defaults.source.input = inputs[inputId];
|
|
8553
|
+
}
|
|
8554
|
+
}
|
|
8555
|
+
if (defaults.type === 'root') {
|
|
8556
|
+
return new Root$1(defaults)
|
|
8557
|
+
} else if (defaults.type === 'decl') {
|
|
8558
|
+
return new Declaration$1(defaults)
|
|
8559
|
+
} else if (defaults.type === 'rule') {
|
|
8560
|
+
return new Rule$1(defaults)
|
|
8561
|
+
} else if (defaults.type === 'comment') {
|
|
8562
|
+
return new Comment$1(defaults)
|
|
8563
|
+
} else if (defaults.type === 'atrule') {
|
|
8564
|
+
return new AtRule$1(defaults)
|
|
8565
|
+
} else {
|
|
8566
|
+
throw new Error('Unknown node type: ' + json.type)
|
|
8567
|
+
}
|
|
8568
|
+
}
|
|
8569
|
+
|
|
8570
|
+
var fromJSON_1 = fromJSON$1;
|
|
8571
|
+
fromJSON$1.default = fromJSON$1;
|
|
8572
|
+
|
|
8657
8573
|
let CssSyntaxError = cssSyntaxError;
|
|
8658
8574
|
let Declaration = declaration;
|
|
8659
|
-
let Document = document;
|
|
8660
|
-
let fromJSON = fromJSON_1;
|
|
8661
|
-
let Input = input;
|
|
8662
8575
|
let LazyResult = lazyResult;
|
|
8663
|
-
let
|
|
8664
|
-
let Node = node_1;
|
|
8665
|
-
let parse = parse_1;
|
|
8576
|
+
let Container = container;
|
|
8666
8577
|
let Processor = processor;
|
|
8667
|
-
let Result = result;
|
|
8668
|
-
let Root = root;
|
|
8669
|
-
let Rule = rule;
|
|
8670
8578
|
let stringify = stringify_1;
|
|
8579
|
+
let fromJSON = fromJSON_1;
|
|
8580
|
+
let Document = document;
|
|
8671
8581
|
let Warning = warning;
|
|
8582
|
+
let Comment = comment;
|
|
8583
|
+
let AtRule = atRule;
|
|
8584
|
+
let Result = result;
|
|
8585
|
+
let Input = input;
|
|
8586
|
+
let parse = parse_1;
|
|
8587
|
+
let list = list_1;
|
|
8588
|
+
let Rule = rule;
|
|
8589
|
+
let Root = root;
|
|
8590
|
+
let Node = node_1;
|
|
8672
8591
|
|
|
8673
8592
|
function postcss(...plugins) {
|
|
8674
8593
|
if (plugins.length === 1 && Array.isArray(plugins[0])) {
|
|
@@ -8751,7 +8670,7 @@ LazyResult.registerPostcss(postcss);
|
|
|
8751
8670
|
var postcss_1 = postcss;
|
|
8752
8671
|
postcss.default = postcss;
|
|
8753
8672
|
|
|
8754
|
-
const htmlparser = require$$0
|
|
8673
|
+
const htmlparser = require$$0;
|
|
8755
8674
|
const escapeStringRegexp = escapeStringRegexp$1;
|
|
8756
8675
|
const { isPlainObject } = require$$2$1;
|
|
8757
8676
|
const deepmerge = cjs;
|
|
@@ -8923,24 +8842,20 @@ function sanitizeHtml(html, options, _recursing) {
|
|
|
8923
8842
|
allowedAttributesMap[tag].push('class');
|
|
8924
8843
|
}
|
|
8925
8844
|
|
|
8926
|
-
allowedClassesMap[tag] =
|
|
8927
|
-
|
|
8928
|
-
|
|
8929
|
-
|
|
8930
|
-
|
|
8931
|
-
|
|
8932
|
-
|
|
8933
|
-
|
|
8934
|
-
|
|
8935
|
-
|
|
8936
|
-
allowedClassesRegexMap[tag].push(obj);
|
|
8937
|
-
} else {
|
|
8938
|
-
allowedClassesMap[tag].push(obj);
|
|
8939
|
-
}
|
|
8940
|
-
});
|
|
8941
|
-
if (globRegex.length) {
|
|
8942
|
-
allowedClassesGlobMap[tag] = new RegExp('^(' + globRegex.join('|') + ')$');
|
|
8845
|
+
allowedClassesMap[tag] = [];
|
|
8846
|
+
allowedClassesRegexMap[tag] = [];
|
|
8847
|
+
const globRegex = [];
|
|
8848
|
+
classes.forEach(function(obj) {
|
|
8849
|
+
if (typeof obj === 'string' && obj.indexOf('*') >= 0) {
|
|
8850
|
+
globRegex.push(escapeStringRegexp(obj).replace(/\\\*/g, '.*'));
|
|
8851
|
+
} else if (obj instanceof RegExp) {
|
|
8852
|
+
allowedClassesRegexMap[tag].push(obj);
|
|
8853
|
+
} else {
|
|
8854
|
+
allowedClassesMap[tag].push(obj);
|
|
8943
8855
|
}
|
|
8856
|
+
});
|
|
8857
|
+
if (globRegex.length) {
|
|
8858
|
+
allowedClassesGlobMap[tag] = new RegExp('^(' + globRegex.join('|') + ')$');
|
|
8944
8859
|
}
|
|
8945
8860
|
});
|
|
8946
8861
|
|
|
@@ -9015,7 +8930,7 @@ function sanitizeHtml(html, options, _recursing) {
|
|
|
9015
8930
|
if (!tagAllowed(name) || (options.disallowedTagsMode === 'recursiveEscape' && !isEmptyObject(skipMap)) || (options.nestingLimit != null && depth >= options.nestingLimit)) {
|
|
9016
8931
|
skip = true;
|
|
9017
8932
|
skipMap[depth] = true;
|
|
9018
|
-
if (options.disallowedTagsMode === 'discard'
|
|
8933
|
+
if (options.disallowedTagsMode === 'discard') {
|
|
9019
8934
|
if (nonTextTagsArray.indexOf(name) !== -1) {
|
|
9020
8935
|
skipText = true;
|
|
9021
8936
|
skipTextDepth = 1;
|
|
@@ -9025,7 +8940,7 @@ function sanitizeHtml(html, options, _recursing) {
|
|
|
9025
8940
|
}
|
|
9026
8941
|
depth++;
|
|
9027
8942
|
if (skip) {
|
|
9028
|
-
if (options.disallowedTagsMode === 'discard'
|
|
8943
|
+
if (options.disallowedTagsMode === 'discard') {
|
|
9029
8944
|
// We want the contents but not this tag
|
|
9030
8945
|
return;
|
|
9031
8946
|
}
|
|
@@ -9048,14 +8963,6 @@ function sanitizeHtml(html, options, _recursing) {
|
|
|
9048
8963
|
delete frame.attribs[a];
|
|
9049
8964
|
return;
|
|
9050
8965
|
}
|
|
9051
|
-
// If the value is empty, check if the attribute is in the allowedEmptyAttributes array.
|
|
9052
|
-
// If it is not in the allowedEmptyAttributes array, and it is a known non-boolean attribute, delete it
|
|
9053
|
-
// List taken from https://html.spec.whatwg.org/multipage/indices.html#attributes-3
|
|
9054
|
-
if (value === '' && (!options.allowedEmptyAttributes.includes(a)) &&
|
|
9055
|
-
(options.nonBooleanAttributes.includes(a) || options.nonBooleanAttributes.includes('*'))) {
|
|
9056
|
-
delete frame.attribs[a];
|
|
9057
|
-
return;
|
|
9058
|
-
}
|
|
9059
8966
|
// check allowedAttributesMap for the element and attribute and modify the value
|
|
9060
8967
|
// as necessary if there are specific values defined.
|
|
9061
8968
|
let passedAllowedAttributesMapCheck = false;
|
|
@@ -9184,13 +9091,12 @@ function sanitizeHtml(html, options, _recursing) {
|
|
|
9184
9091
|
const allowedWildcardClasses = allowedClassesMap['*'];
|
|
9185
9092
|
const allowedSpecificClassesGlob = allowedClassesGlobMap[name];
|
|
9186
9093
|
const allowedSpecificClassesRegex = allowedClassesRegexMap[name];
|
|
9187
|
-
const allowedWildcardClassesRegex = allowedClassesRegexMap['*'];
|
|
9188
9094
|
const allowedWildcardClassesGlob = allowedClassesGlobMap['*'];
|
|
9189
9095
|
const allowedClassesGlobs = [
|
|
9190
9096
|
allowedSpecificClassesGlob,
|
|
9191
9097
|
allowedWildcardClassesGlob
|
|
9192
9098
|
]
|
|
9193
|
-
.concat(allowedSpecificClassesRegex
|
|
9099
|
+
.concat(allowedSpecificClassesRegex)
|
|
9194
9100
|
.filter(function (t) {
|
|
9195
9101
|
return t;
|
|
9196
9102
|
});
|
|
@@ -9207,7 +9113,7 @@ function sanitizeHtml(html, options, _recursing) {
|
|
|
9207
9113
|
if (a === 'style') {
|
|
9208
9114
|
if (options.parseStyleAttributes) {
|
|
9209
9115
|
try {
|
|
9210
|
-
const abstractSyntaxTree = postcssParse(name + ' {' + value + '}'
|
|
9116
|
+
const abstractSyntaxTree = postcssParse(name + ' {' + value + '}');
|
|
9211
9117
|
const filteredAST = filterCss(abstractSyntaxTree, options.allowedStyles);
|
|
9212
9118
|
|
|
9213
9119
|
value = stringifyStyleAttributes(filteredAST);
|
|
@@ -9217,9 +9123,7 @@ function sanitizeHtml(html, options, _recursing) {
|
|
|
9217
9123
|
return;
|
|
9218
9124
|
}
|
|
9219
9125
|
} catch (e) {
|
|
9220
|
-
|
|
9221
|
-
console.warn('Failed to parse "' + name + ' {' + value + '}' + '", If you\'re running this in a browser, we recommend to disable style parsing: options.parseStyleAttributes: false, since this only works in a node environment due to a postcss dependency, More info: https://github.com/apostrophecms/sanitize-html/issues/547');
|
|
9222
|
-
}
|
|
9126
|
+
console.warn('Failed to parse "' + name + ' {' + value + '}' + '", If you\'re running this in a browser, we recommend to disable style parsing: options.parseStyleAttributes: false, since this only works in a node environment due to a postcss dependency, More info: https://github.com/apostrophecms/sanitize-html/issues/547');
|
|
9223
9127
|
delete frame.attribs[a];
|
|
9224
9128
|
return;
|
|
9225
9129
|
}
|
|
@@ -9230,8 +9134,6 @@ function sanitizeHtml(html, options, _recursing) {
|
|
|
9230
9134
|
result += ' ' + a;
|
|
9231
9135
|
if (value && value.length) {
|
|
9232
9136
|
result += '="' + escapeHtml(value, true) + '"';
|
|
9233
|
-
} else if (options.allowedEmptyAttributes.includes(a)) {
|
|
9234
|
-
result += '=""';
|
|
9235
9137
|
}
|
|
9236
9138
|
} else {
|
|
9237
9139
|
delete frame.attribs[a];
|
|
@@ -9265,9 +9167,7 @@ function sanitizeHtml(html, options, _recursing) {
|
|
|
9265
9167
|
text = lastFrame.innerText !== undefined ? lastFrame.innerText : text;
|
|
9266
9168
|
}
|
|
9267
9169
|
|
|
9268
|
-
if (options.disallowedTagsMode === '
|
|
9269
|
-
text = '';
|
|
9270
|
-
} else if ((options.disallowedTagsMode === 'discard' || options.disallowedTagsMode === 'completelyDiscard') && ((tag === 'script') || (tag === 'style'))) {
|
|
9170
|
+
if (options.disallowedTagsMode === 'discard' && ((tag === 'script') || (tag === 'style'))) {
|
|
9271
9171
|
// htmlparser2 gives us these as-is. Escaping them ruins the content. Allowing
|
|
9272
9172
|
// script tags is, by definition, game over for XSS protection, so if that's
|
|
9273
9173
|
// your concern, don't allow them. The same is essentially true for style tags
|
|
@@ -9315,7 +9215,7 @@ function sanitizeHtml(html, options, _recursing) {
|
|
|
9315
9215
|
const skip = skipMap[depth];
|
|
9316
9216
|
if (skip) {
|
|
9317
9217
|
delete skipMap[depth];
|
|
9318
|
-
if (options.disallowedTagsMode === 'discard'
|
|
9218
|
+
if (options.disallowedTagsMode === 'discard') {
|
|
9319
9219
|
frame.updateParentNodeText();
|
|
9320
9220
|
return;
|
|
9321
9221
|
}
|
|
@@ -9586,49 +9486,6 @@ sanitizeHtml.defaults = {
|
|
|
9586
9486
|
'caption', 'col', 'colgroup', 'table', 'tbody', 'td', 'tfoot', 'th',
|
|
9587
9487
|
'thead', 'tr'
|
|
9588
9488
|
],
|
|
9589
|
-
// Tags that cannot be boolean
|
|
9590
|
-
nonBooleanAttributes: [
|
|
9591
|
-
'abbr', 'accept', 'accept-charset', 'accesskey', 'action',
|
|
9592
|
-
'allow', 'alt', 'as', 'autocapitalize', 'autocomplete',
|
|
9593
|
-
'blocking', 'charset', 'cite', 'class', 'color', 'cols',
|
|
9594
|
-
'colspan', 'content', 'contenteditable', 'coords', 'crossorigin',
|
|
9595
|
-
'data', 'datetime', 'decoding', 'dir', 'dirname', 'download',
|
|
9596
|
-
'draggable', 'enctype', 'enterkeyhint', 'fetchpriority', 'for',
|
|
9597
|
-
'form', 'formaction', 'formenctype', 'formmethod', 'formtarget',
|
|
9598
|
-
'headers', 'height', 'hidden', 'high', 'href', 'hreflang',
|
|
9599
|
-
'http-equiv', 'id', 'imagesizes', 'imagesrcset', 'inputmode',
|
|
9600
|
-
'integrity', 'is', 'itemid', 'itemprop', 'itemref', 'itemtype',
|
|
9601
|
-
'kind', 'label', 'lang', 'list', 'loading', 'low', 'max',
|
|
9602
|
-
'maxlength', 'media', 'method', 'min', 'minlength', 'name',
|
|
9603
|
-
'nonce', 'optimum', 'pattern', 'ping', 'placeholder', 'popover',
|
|
9604
|
-
'popovertarget', 'popovertargetaction', 'poster', 'preload',
|
|
9605
|
-
'referrerpolicy', 'rel', 'rows', 'rowspan', 'sandbox', 'scope',
|
|
9606
|
-
'shape', 'size', 'sizes', 'slot', 'span', 'spellcheck', 'src',
|
|
9607
|
-
'srcdoc', 'srclang', 'srcset', 'start', 'step', 'style',
|
|
9608
|
-
'tabindex', 'target', 'title', 'translate', 'type', 'usemap',
|
|
9609
|
-
'value', 'width', 'wrap',
|
|
9610
|
-
// Event handlers
|
|
9611
|
-
'onauxclick', 'onafterprint', 'onbeforematch', 'onbeforeprint',
|
|
9612
|
-
'onbeforeunload', 'onbeforetoggle', 'onblur', 'oncancel',
|
|
9613
|
-
'oncanplay', 'oncanplaythrough', 'onchange', 'onclick', 'onclose',
|
|
9614
|
-
'oncontextlost', 'oncontextmenu', 'oncontextrestored', 'oncopy',
|
|
9615
|
-
'oncuechange', 'oncut', 'ondblclick', 'ondrag', 'ondragend',
|
|
9616
|
-
'ondragenter', 'ondragleave', 'ondragover', 'ondragstart',
|
|
9617
|
-
'ondrop', 'ondurationchange', 'onemptied', 'onended',
|
|
9618
|
-
'onerror', 'onfocus', 'onformdata', 'onhashchange', 'oninput',
|
|
9619
|
-
'oninvalid', 'onkeydown', 'onkeypress', 'onkeyup',
|
|
9620
|
-
'onlanguagechange', 'onload', 'onloadeddata', 'onloadedmetadata',
|
|
9621
|
-
'onloadstart', 'onmessage', 'onmessageerror', 'onmousedown',
|
|
9622
|
-
'onmouseenter', 'onmouseleave', 'onmousemove', 'onmouseout',
|
|
9623
|
-
'onmouseover', 'onmouseup', 'onoffline', 'ononline', 'onpagehide',
|
|
9624
|
-
'onpageshow', 'onpaste', 'onpause', 'onplay', 'onplaying',
|
|
9625
|
-
'onpopstate', 'onprogress', 'onratechange', 'onreset', 'onresize',
|
|
9626
|
-
'onrejectionhandled', 'onscroll', 'onscrollend',
|
|
9627
|
-
'onsecuritypolicyviolation', 'onseeked', 'onseeking', 'onselect',
|
|
9628
|
-
'onslotchange', 'onstalled', 'onstorage', 'onsubmit', 'onsuspend',
|
|
9629
|
-
'ontimeupdate', 'ontoggle', 'onunhandledrejection', 'onunload',
|
|
9630
|
-
'onvolumechange', 'onwaiting', 'onwheel'
|
|
9631
|
-
],
|
|
9632
9489
|
disallowedTagsMode: 'discard',
|
|
9633
9490
|
allowedAttributes: {
|
|
9634
9491
|
a: [ 'href', 'name', 'target' ],
|
|
@@ -9636,9 +9493,6 @@ sanitizeHtml.defaults = {
|
|
|
9636
9493
|
// these attributes would make sense if we did.
|
|
9637
9494
|
img: [ 'src', 'srcset', 'alt', 'title', 'width', 'height', 'loading' ]
|
|
9638
9495
|
},
|
|
9639
|
-
allowedEmptyAttributes: [
|
|
9640
|
-
'alt'
|
|
9641
|
-
],
|
|
9642
9496
|
// Lots of these won't come up by default because we don't allow them
|
|
9643
9497
|
selfClosing: [ 'img', 'br', 'hr', 'area', 'base', 'basefont', 'input', 'link', 'meta' ],
|
|
9644
9498
|
// URL schemes we permit
|