@pi-r/chrome 0.3.7 → 0.3.9
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/index.js +197 -200
- package/package.json +5 -5
package/index.js
CHANGED
|
@@ -32,7 +32,7 @@ const [REGEXP_NTHCHILD, REGEXP_NTHCHILD_UNSAFE, REGEXP_REPLACECSS] = (function (
|
|
|
32
32
|
return [
|
|
33
33
|
new RegExp(`\\(${PATTERN_STRING_SOME}([+-])?(?:(\\d*)[nN]|(0))?${PATTERN_STRING_SOME}([+-])?${PATTERN_STRING_SOME}(\\d*)(?:${PATTERN_STRING_MANY}[oO][fF]${PATTERN_STRING_MANY}(${parenthesis})${PATTERN_STRING_SOME}\\)|${PATTERN_STRING_SOME}\\))`, 'g'),
|
|
34
34
|
new RegExp(`\\(\\s*([+-])?(?:(\\d*)[nN]|(0))?\\s*([+-])?\\s*(\\d*)(?:\\s+[oO][fF]\\s+(${parenthesis})\\s*\\)|\\s*\\))`, 'g'),
|
|
35
|
-
new RegExp(`^@import\\s+(?:url\\((?:[^)]|(?<=\\\\)\\))+\\)|"(?:[^"]|(?<=\\\\)")+"|'(?:[^']|(?<=\\\\)')+')(\\s*layer(
|
|
35
|
+
new RegExp(`^@import\\s+(?:url\\((?:[^)]|(?<=\\\\)\\))+\\)|"(?:[^"]|(?<=\\\\)")+"|'(?:[^']|(?<=\\\\)')+')(\\s*layer(\\([^)]*\\))?)?(?:\\s*supports\\((${parenthesis})\\))?(.*)$`, 'si')
|
|
36
36
|
];
|
|
37
37
|
})();
|
|
38
38
|
const REGEXP_COMMENT = new RegExp(dom_1.DomWriter.PATTERN_COMMENT, 'g');
|
|
@@ -190,7 +190,7 @@ function hasCondition(data, condition) {
|
|
|
190
190
|
if (items.length && !isSpace(match[0][0])) {
|
|
191
191
|
return false;
|
|
192
192
|
}
|
|
193
|
-
items.push([match[1], trimQuote(match[2]), trimQuote(match[3])]);
|
|
193
|
+
items.push([match[1], trimQuote(match[2]), match[3] ? trimQuote(match[3]) : '']);
|
|
194
194
|
}
|
|
195
195
|
REGEXP_TEMPLATECOMPARISON.lastIndex = 0;
|
|
196
196
|
const length = items.length;
|
|
@@ -201,18 +201,13 @@ function hasCondition(data, condition) {
|
|
|
201
201
|
if (!isNaN(+value)) {
|
|
202
202
|
return +value;
|
|
203
203
|
}
|
|
204
|
-
if (match = /^(["'])([\S\s]*)\1$/.exec(value)) {
|
|
205
|
-
return match[2];
|
|
206
|
-
}
|
|
207
204
|
return getObjectValue(data, value);
|
|
208
205
|
};
|
|
209
206
|
for (let i = 0; i < length; ++i) {
|
|
210
|
-
const
|
|
211
|
-
|
|
212
|
-
const arg2 = item[2];
|
|
213
|
-
let valid;
|
|
207
|
+
const [cmp, arg1, arg2] = items[i];
|
|
208
|
+
let valid = false;
|
|
214
209
|
if (arg2) {
|
|
215
|
-
switch (
|
|
210
|
+
switch (cmp) {
|
|
216
211
|
case 'eq':
|
|
217
212
|
valid = parseArg(arg1) == parseArg(arg2);
|
|
218
213
|
break;
|
|
@@ -235,7 +230,7 @@ function hasCondition(data, condition) {
|
|
|
235
230
|
return false;
|
|
236
231
|
}
|
|
237
232
|
}
|
|
238
|
-
else if (
|
|
233
|
+
else if (cmp) {
|
|
239
234
|
return false;
|
|
240
235
|
}
|
|
241
236
|
else {
|
|
@@ -384,9 +379,9 @@ function transformURL(host, parent, type, source, importFile) {
|
|
|
384
379
|
var _a;
|
|
385
380
|
const related = [];
|
|
386
381
|
const baseHref = getBaseURLs(importFile || parent, this.baseUrl);
|
|
387
|
-
const isHtml = type === 'html';
|
|
382
|
+
const isHtml = type === 'html' || type === 'svg';
|
|
388
383
|
const isJs = type === 'js';
|
|
389
|
-
const pattern = isJs ? /\bimport\(/g :
|
|
384
|
+
const pattern = isJs ? /\bimport\(/g : !isHtml ? /\burl\(|@import\s+(["'])/gi : /(?:\burl\(|@import\s+(["'])|\b(href)\s*=)/gi;
|
|
390
385
|
let length = source.length, modified, match;
|
|
391
386
|
while (match = pattern.exec(source)) {
|
|
392
387
|
const isText = !!match[1];
|
|
@@ -394,227 +389,229 @@ function transformURL(host, parent, type, source, importFile) {
|
|
|
394
389
|
const isUrl = !isText && !isHref;
|
|
395
390
|
const startIndex = match.index;
|
|
396
391
|
let quote = match[1], content = '', trailing = '', closed = -1, i = startIndex + match[0].length;
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
if (
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
}
|
|
406
|
-
if (source[i - 1] !== '\\') {
|
|
407
|
-
if (isText) {
|
|
392
|
+
pass: {
|
|
393
|
+
for (let j = -1; i < length; ++i) {
|
|
394
|
+
const ch = source[i];
|
|
395
|
+
if (quote && ch === quote) {
|
|
396
|
+
if (!isText) {
|
|
397
|
+
content += ch;
|
|
398
|
+
}
|
|
399
|
+
if (isHref) {
|
|
408
400
|
break;
|
|
409
401
|
}
|
|
410
|
-
if (
|
|
411
|
-
|
|
402
|
+
if (source[i - 1] !== '\\') {
|
|
403
|
+
if (isText) {
|
|
404
|
+
break;
|
|
405
|
+
}
|
|
406
|
+
if (closed === -1) {
|
|
407
|
+
closed = i + 1;
|
|
408
|
+
}
|
|
412
409
|
}
|
|
410
|
+
j = i + 1;
|
|
411
|
+
continue;
|
|
413
412
|
}
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
break;
|
|
413
|
+
if (!quote && (ch === '"' || ch === "'" || ch === '`' && isJs) && (isHref || !content.trim())) {
|
|
414
|
+
quote = ch;
|
|
415
|
+
}
|
|
416
|
+
else if (isHref && (ch === '#' || !quote && isSpace(ch)) && content.trim()) {
|
|
417
|
+
break pass;
|
|
418
|
+
}
|
|
419
|
+
else if (ch === ')') {
|
|
420
|
+
if (isUrl) {
|
|
421
|
+
if (quote && closed !== -1 || !quote && (isJs || source[i - 1] !== '\\')) {
|
|
422
|
+
break;
|
|
423
|
+
}
|
|
424
|
+
j = i;
|
|
427
425
|
}
|
|
428
|
-
j = i;
|
|
429
426
|
}
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
427
|
+
else if (j !== -1 && (ch === '\n' ||
|
|
428
|
+
isText && (ch === ';' || ch === '{') ||
|
|
429
|
+
isHref && (ch === '=' || ch === '>') ||
|
|
430
|
+
isUrl && (ch === ';' ||
|
|
431
|
+
!isJs && (!isHtml && (ch === ':' && !isJs || ch === '}') ||
|
|
432
|
+
isHtml && (ch === '"' || ch === "'" || ch === ':' || ch === '>'))))) {
|
|
433
|
+
if (closed !== -1) {
|
|
434
|
+
i = closed;
|
|
435
|
+
}
|
|
436
|
+
else {
|
|
437
|
+
content = content.substring(0, i = j);
|
|
438
|
+
}
|
|
439
|
+
break;
|
|
439
440
|
}
|
|
440
|
-
|
|
441
|
-
content
|
|
441
|
+
if (closed === -1) {
|
|
442
|
+
content += ch;
|
|
442
443
|
}
|
|
443
|
-
break;
|
|
444
|
-
}
|
|
445
|
-
if (closed === -1) {
|
|
446
|
-
content += ch;
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
const setOutputURL = (value, asset) => {
|
|
450
|
-
var _a;
|
|
451
|
-
if (!value) {
|
|
452
|
-
return;
|
|
453
444
|
}
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
445
|
+
const setOutputURL = (value, asset) => {
|
|
446
|
+
var _a;
|
|
447
|
+
if (!value) {
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
450
|
+
if (asset) {
|
|
451
|
+
if (!asset.inlineBase64) {
|
|
452
|
+
if ((_a = host.Cloud) === null || _a === void 0 ? void 0 : _a.getStorage('upload', asset.cloudStorage)) {
|
|
453
|
+
const inlineUrlCloud = asset.inlineUrlCloud || (asset.inlineUrlCloud = (0, types_1.generateUUID)());
|
|
454
|
+
(parent.inlineUrlCloudMap || (parent.inlineUrlCloudMap = {}))[inlineUrlCloud] = value;
|
|
455
|
+
value = inlineUrlCloud;
|
|
456
|
+
}
|
|
457
|
+
else if (asset.hash && this.productionRelease) {
|
|
458
|
+
const inlineUrl = asset.inlineUrl || (asset.inlineUrl = (0, types_1.generateUUID)());
|
|
459
|
+
(parent.inlineUrlMap || (parent.inlineUrlMap = {}))[inlineUrl] = value;
|
|
460
|
+
value = inlineUrl;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
const font = findFont(asset.format);
|
|
464
|
+
if (font) {
|
|
465
|
+
found: {
|
|
466
|
+
for (let k = i + 1; k < length; ++k) {
|
|
467
|
+
switch (source[k]) {
|
|
468
|
+
case ')': {
|
|
469
|
+
const component = source.substring(i + 1, k + 1);
|
|
470
|
+
const format = /\s+format\([^)]+\)$/i.exec(component);
|
|
471
|
+
if (format) {
|
|
472
|
+
trailing = component.replace(format[0], ` format("${font}")`);
|
|
473
|
+
i = k;
|
|
474
|
+
break found;
|
|
475
|
+
}
|
|
476
|
+
break;
|
|
479
477
|
}
|
|
480
|
-
|
|
478
|
+
case ',':
|
|
479
|
+
case ';':
|
|
480
|
+
case ':':
|
|
481
|
+
case '}':
|
|
482
|
+
break found;
|
|
481
483
|
}
|
|
482
|
-
case ',':
|
|
483
|
-
case ';':
|
|
484
|
-
case ':':
|
|
485
|
-
case '}':
|
|
486
|
-
break found;
|
|
487
484
|
}
|
|
488
485
|
}
|
|
489
486
|
}
|
|
487
|
+
if (asset.initialValue && !asset.initialValue.cacheable) {
|
|
488
|
+
parent.flags |= 16;
|
|
489
|
+
}
|
|
490
|
+
related.push(asset);
|
|
490
491
|
}
|
|
491
|
-
if (
|
|
492
|
-
|
|
492
|
+
if (!quote && !isHtml && !isJs) {
|
|
493
|
+
if (value.indexOf('"') === -1) {
|
|
494
|
+
quote = '"';
|
|
495
|
+
}
|
|
496
|
+
else if (value.indexOf("'") === -1) {
|
|
497
|
+
quote = "'";
|
|
498
|
+
}
|
|
493
499
|
}
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
500
|
+
if (isUrl) {
|
|
501
|
+
const index = value.indexOf('#');
|
|
502
|
+
if (index !== -1) {
|
|
503
|
+
value = value.substring(0, index);
|
|
504
|
+
}
|
|
499
505
|
}
|
|
500
|
-
|
|
501
|
-
|
|
506
|
+
if (quote) {
|
|
507
|
+
value = quote + value + quote;
|
|
502
508
|
}
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
509
|
+
const revised = isJs ? 'import(' + value + trailing + ')' : isHref ? 'href=' + value : (isText ? '@import ' + value : `url(${value})`) + trailing;
|
|
510
|
+
source = spliceString(source, startIndex, i + 1, revised);
|
|
511
|
+
length = source.length;
|
|
512
|
+
pattern.lastIndex = startIndex + revised.length;
|
|
513
|
+
modified = true;
|
|
514
|
+
};
|
|
515
|
+
let url;
|
|
516
|
+
if (isJs) {
|
|
517
|
+
if (!quote) {
|
|
518
|
+
continue;
|
|
519
|
+
}
|
|
520
|
+
const file = new RegExp('^\\s*(' + quote + '((?:[^' + quote + ']|(?<=\\\\)' + quote + ')+)' + quote + ')\\s*(,.+)$').exec(content);
|
|
521
|
+
if (file) {
|
|
522
|
+
url = file[1].trim();
|
|
523
|
+
trailing = file[2].trim();
|
|
524
|
+
}
|
|
525
|
+
else {
|
|
526
|
+
url = trimQuote(content);
|
|
508
527
|
}
|
|
509
|
-
}
|
|
510
|
-
if (quote) {
|
|
511
|
-
value = quote + value + quote;
|
|
512
|
-
}
|
|
513
|
-
const revised = isJs ? 'import(' + value + trailing + ')' : isHref ? 'href=' + value : (isText ? '@import ' + value : `url(${value})`) + trailing;
|
|
514
|
-
source = spliceString(source, startIndex, i + 1, revised);
|
|
515
|
-
length = source.length;
|
|
516
|
-
pattern.lastIndex = startIndex + revised.length;
|
|
517
|
-
modified = true;
|
|
518
|
-
};
|
|
519
|
-
let url;
|
|
520
|
-
if (isJs) {
|
|
521
|
-
if (!quote) {
|
|
522
|
-
continue;
|
|
523
|
-
}
|
|
524
|
-
const file = new RegExp('^\\s*(' + quote + '((?:[^' + quote + ']|(?<=\\\\)' + quote + ')+)' + quote + ')\\s*(,.+)$').exec(content);
|
|
525
|
-
if (file) {
|
|
526
|
-
url = file[1].trim();
|
|
527
|
-
trailing = file[2].trim();
|
|
528
528
|
}
|
|
529
529
|
else {
|
|
530
530
|
url = trimQuote(content);
|
|
531
531
|
}
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
if (item.base64 === base64) {
|
|
541
|
-
setOutputURL(getSrcURL.call(this, parent, item)[0], item);
|
|
542
|
-
break;
|
|
532
|
+
if (url.startsWith('data:')) {
|
|
533
|
+
const base64 = (_a = url.split(',')[1]) === null || _a === void 0 ? void 0 : _a.trim();
|
|
534
|
+
if (base64) {
|
|
535
|
+
for (const item of this.assets) {
|
|
536
|
+
if (item.base64 === base64) {
|
|
537
|
+
setOutputURL(getSrcURL.call(this, parent, item)[0], item);
|
|
538
|
+
break;
|
|
539
|
+
}
|
|
543
540
|
}
|
|
544
541
|
}
|
|
545
542
|
}
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
543
|
+
else if (baseHref.length) {
|
|
544
|
+
let fullUrl, asset;
|
|
545
|
+
for (const parentUrl of baseHref) {
|
|
546
|
+
if (asset = host.findAsset(fullUrl = resolvePath(url, parentUrl), { replaced: true }) || (this.related.has(parent) ? host.findAsset(fullUrl, { assets: Array.from(this.related.get(parent)), replaced: true }) : undefined)) {
|
|
547
|
+
break;
|
|
548
|
+
}
|
|
552
549
|
}
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
valid = source.substring(k = j - 6, j + 1) === '@import';
|
|
562
|
-
}
|
|
563
|
-
else {
|
|
564
|
-
k = startIndex;
|
|
565
|
-
valid = true;
|
|
566
|
-
}
|
|
567
|
-
if (valid) {
|
|
568
|
-
let l = i, revised = transform_1.SourceMap.removeSourceMappingURL(host.getUTF8String(asset))[0];
|
|
569
|
-
for (let ch; l < length; ++l) {
|
|
570
|
-
if ((ch = source[l]) === ';' || ch === '\n') {
|
|
571
|
-
break;
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
const layer = this.replaceContent(revised, source.substring(k, l + 1), 'text/css');
|
|
575
|
-
if (layer) {
|
|
576
|
-
revised = layer;
|
|
577
|
-
}
|
|
578
|
-
source = spliceString(source, k, l + 1, revised = transformURL.call(this, host, parent, type, this.removeServerRoot(revised), asset) || revised);
|
|
579
|
-
length = source.length;
|
|
580
|
-
pattern.lastIndex = k + revised.length;
|
|
581
|
-
if (!parent.watch) {
|
|
582
|
-
host.deleteFile(asset.localUri, { ignorePermission: true, emptyDir: true, all: true, id: asset.id });
|
|
583
|
-
asset.invalid = true;
|
|
550
|
+
if (asset && asset !== importFile) {
|
|
551
|
+
if (!(0, util_1.hasValue)(asset.format, 'base64')) {
|
|
552
|
+
if (asset.bundleReplace) {
|
|
553
|
+
let k, valid;
|
|
554
|
+
if (!isText) {
|
|
555
|
+
let j = startIndex;
|
|
556
|
+
while (isSpace(source[--j])) { }
|
|
557
|
+
valid = source.substring(k = j - 6, j + 1).toLowerCase() === '@import';
|
|
584
558
|
}
|
|
585
559
|
else {
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
560
|
+
k = startIndex;
|
|
561
|
+
valid = true;
|
|
562
|
+
}
|
|
563
|
+
if (valid) {
|
|
564
|
+
let l = i, revised = transform_1.SourceMap.removeSourceMappingURL(host.getUTF8String(asset))[0];
|
|
565
|
+
for (let ch; l < length; ++l) {
|
|
566
|
+
if ((ch = source[l]) === ';' || ch === '\n') {
|
|
567
|
+
break;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
const layer = this.replaceContent(revised, source.substring(k, l + 1), 'text/css');
|
|
571
|
+
if (layer) {
|
|
572
|
+
revised = layer;
|
|
573
|
+
}
|
|
574
|
+
source = spliceString(source, k, l + 1, revised = transformURL.call(this, host, parent, type, this.removeServerRoot(revised), asset) || revised);
|
|
575
|
+
length = source.length;
|
|
576
|
+
pattern.lastIndex = k + revised.length;
|
|
577
|
+
if (!parent.watch) {
|
|
578
|
+
host.deleteFile(asset.localUri, { ignorePermission: true, emptyDir: true, all: true, id: asset.id });
|
|
579
|
+
asset.invalid = true;
|
|
580
|
+
}
|
|
581
|
+
else {
|
|
582
|
+
related.push(asset);
|
|
583
|
+
if (!(0, types_1.existsFlag)(asset.flags)) {
|
|
584
|
+
asset.flags |= 8;
|
|
585
|
+
}
|
|
589
586
|
}
|
|
587
|
+
modified = true;
|
|
588
|
+
continue;
|
|
590
589
|
}
|
|
591
|
-
modified = true;
|
|
592
|
-
continue;
|
|
593
590
|
}
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
591
|
+
if (hasSameOrigin(asset.url || fullUrl, ...baseHref)) {
|
|
592
|
+
let sameDir;
|
|
593
|
+
[fullUrl, sameDir] = getSrcURL.call(this, parent, asset);
|
|
594
|
+
if (sameDir && isJs) {
|
|
595
|
+
fullUrl = './' + fullUrl;
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
else {
|
|
599
|
+
const pathname = parent.pathname;
|
|
600
|
+
const count = pathname && pathname !== '/' && pathname !== '\\' ? pathname.split(/[\\/]/).length : 0;
|
|
601
|
+
fullUrl = (count ? '../'.repeat(count) : '') + asset.relativeUrl;
|
|
600
602
|
}
|
|
601
603
|
}
|
|
602
|
-
else {
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
604
|
+
else if (!asset.invalid) {
|
|
605
|
+
fullUrl = asset.inlineBase64 || (asset.inlineBase64 = (0, types_1.generateUUID)());
|
|
606
|
+
}
|
|
607
|
+
if (url !== fullUrl) {
|
|
608
|
+
setOutputURL(fullUrl, asset);
|
|
606
609
|
}
|
|
607
610
|
}
|
|
608
|
-
else if (
|
|
609
|
-
fullUrl
|
|
610
|
-
}
|
|
611
|
-
if (url !== fullUrl) {
|
|
612
|
-
setOutputURL(fullUrl, asset);
|
|
611
|
+
else if (importFile && url !== fullUrl) {
|
|
612
|
+
setOutputURL(fullUrl);
|
|
613
613
|
}
|
|
614
614
|
}
|
|
615
|
-
else if (importFile && url !== fullUrl) {
|
|
616
|
-
setOutputURL(fullUrl);
|
|
617
|
-
}
|
|
618
615
|
}
|
|
619
616
|
}
|
|
620
617
|
if (modified) {
|
|
@@ -1655,14 +1652,14 @@ class ChromeDocument extends Document {
|
|
|
1655
1652
|
}
|
|
1656
1653
|
}
|
|
1657
1654
|
replaceContent(source, statement, mimeType) {
|
|
1658
|
-
var _a;
|
|
1655
|
+
var _a, _b;
|
|
1659
1656
|
switch (mimeType) {
|
|
1660
1657
|
case 'text/css': {
|
|
1661
1658
|
const match = REGEXP_REPLACECSS.exec((typeof statement === 'string' ? statement : statement[0]).trim());
|
|
1662
1659
|
if (match) {
|
|
1663
1660
|
const layer = match[1];
|
|
1664
1661
|
const supports = (_a = match[3]) === null || _a === void 0 ? void 0 : _a.trim();
|
|
1665
|
-
const query = match[4].trim();
|
|
1662
|
+
const query = match[4].trim().replace(/;+$/, '');
|
|
1666
1663
|
if (layer || supports || query) {
|
|
1667
1664
|
const newline = (0, util_1.getNewline)(source);
|
|
1668
1665
|
let result = supports ? `@supports (${supports}) {` + newline : '';
|
|
@@ -1670,8 +1667,8 @@ class ChromeDocument extends Document {
|
|
|
1670
1667
|
result += `@media ${query} {` + newline;
|
|
1671
1668
|
}
|
|
1672
1669
|
if (layer) {
|
|
1673
|
-
|
|
1674
|
-
result += '@layer ' + (name
|
|
1670
|
+
const name = (_b = match[2]) === null || _b === void 0 ? void 0 : _b.replace(/\s+/g, '');
|
|
1671
|
+
result += '@layer ' + (name ? name.slice(1, -1) + ' ' : '') + `{${newline + source + newline}}` + (query ? newline + '}' : '');
|
|
1675
1672
|
}
|
|
1676
1673
|
else if (query) {
|
|
1677
1674
|
result += source + newline + '}';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-r/chrome",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.9",
|
|
4
4
|
"description": "Chrome document constructor for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"homepage": "https://github.com/anpham6/pi-r#readme",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@e-mc/cloud": "^0.6.
|
|
24
|
-
"@e-mc/core": "^0.6.
|
|
25
|
-
"@e-mc/document": "^0.6.
|
|
26
|
-
"@e-mc/types": "^0.6.
|
|
23
|
+
"@e-mc/cloud": "^0.6.21",
|
|
24
|
+
"@e-mc/core": "^0.6.21",
|
|
25
|
+
"@e-mc/document": "^0.6.21",
|
|
26
|
+
"@e-mc/types": "^0.6.21"
|
|
27
27
|
}
|
|
28
28
|
}
|