vite 2.9.0-beta.0 → 2.9.0-beta.11
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.
Potentially problematic release.
This version of vite might be problematic. Click here for more details.
- package/LICENSE.md +1 -1
- package/dist/client/client.mjs +18 -9
- package/dist/client/client.mjs.map +1 -1
- package/dist/node/chunks/{dep-026034b4.js → dep-3a0ad60c.js} +1 -1
- package/dist/node/chunks/{dep-229a03bb.js → dep-76a88ec8.js} +3 -3
- package/dist/node/chunks/{dep-429629d5.js → dep-7765b27c.js} +34116 -29724
- package/dist/node/chunks/{dep-5f1b3f27.js → dep-7ef2e58a.js} +116 -8
- package/dist/node/chunks/{dep-ec2e68f4.js → dep-bcc0af00.js} +103 -25
- package/dist/node/cli.js +6 -6
- package/dist/node/index.d.ts +154 -52
- package/dist/node/index.js +3 -2
- package/dist/node/terser.js +90 -15
- package/package.json +23 -22
- package/src/client/client.ts +34 -36
- package/types/customEvent.d.ts +16 -5
- package/types/hot.d.ts +25 -0
- package/types/importMeta.d.ts +1 -40
- package/types/ws.d.ts +54 -29
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./dep-
|
|
3
|
+
var index = require('./dep-7765b27c.js');
|
|
4
4
|
var require$$1 = require('crypto');
|
|
5
5
|
require('fs');
|
|
6
6
|
require('path');
|
|
@@ -19,9 +19,9 @@ require('https');
|
|
|
19
19
|
require('zlib');
|
|
20
20
|
require('tls');
|
|
21
21
|
require('assert');
|
|
22
|
+
require('esbuild');
|
|
22
23
|
require('buffer');
|
|
23
24
|
require('querystring');
|
|
24
|
-
require('esbuild');
|
|
25
25
|
require('child_process');
|
|
26
26
|
require('worker_threads');
|
|
27
27
|
require('readline');
|
|
@@ -2936,6 +2936,10 @@ _IN('1.3.14.3.2.29', 'sha1WithRSASignature');
|
|
|
2936
2936
|
_IN('2.16.840.1.101.3.4.2.1', 'sha256');
|
|
2937
2937
|
_IN('2.16.840.1.101.3.4.2.2', 'sha384');
|
|
2938
2938
|
_IN('2.16.840.1.101.3.4.2.3', 'sha512');
|
|
2939
|
+
_IN('2.16.840.1.101.3.4.2.4', 'sha224');
|
|
2940
|
+
_IN('2.16.840.1.101.3.4.2.5', 'sha512-224');
|
|
2941
|
+
_IN('2.16.840.1.101.3.4.2.6', 'sha512-256');
|
|
2942
|
+
_IN('1.2.840.113549.2.2', 'md2');
|
|
2939
2943
|
_IN('1.2.840.113549.2.5', 'md5');
|
|
2940
2944
|
|
|
2941
2945
|
// pkcs#7 content types
|
|
@@ -3477,6 +3481,8 @@ var _getValueLength = function(bytes, remaining) {
|
|
|
3477
3481
|
* @param [options] object with options or boolean strict flag
|
|
3478
3482
|
* [strict] true to be strict when checking value lengths, false to
|
|
3479
3483
|
* allow truncated values (default: true).
|
|
3484
|
+
* [parseAllBytes] true to ensure all bytes are parsed
|
|
3485
|
+
* (default: true)
|
|
3480
3486
|
* [decodeBitStrings] true to attempt to decode the content of
|
|
3481
3487
|
* BIT STRINGs (not OCTET STRINGs) using strict mode. Note that
|
|
3482
3488
|
* without schema support to understand the data context this can
|
|
@@ -3484,24 +3490,31 @@ var _getValueLength = function(bytes, remaining) {
|
|
|
3484
3490
|
* flag will be deprecated or removed as soon as schema support is
|
|
3485
3491
|
* available. (default: true)
|
|
3486
3492
|
*
|
|
3493
|
+
* @throws Will throw an error for various malformed input conditions.
|
|
3494
|
+
*
|
|
3487
3495
|
* @return the parsed asn1 object.
|
|
3488
3496
|
*/
|
|
3489
3497
|
asn1$6.fromDer = function(bytes, options) {
|
|
3490
3498
|
if(options === undefined) {
|
|
3491
3499
|
options = {
|
|
3492
3500
|
strict: true,
|
|
3501
|
+
parseAllBytes: true,
|
|
3493
3502
|
decodeBitStrings: true
|
|
3494
3503
|
};
|
|
3495
3504
|
}
|
|
3496
3505
|
if(typeof options === 'boolean') {
|
|
3497
3506
|
options = {
|
|
3498
3507
|
strict: options,
|
|
3508
|
+
parseAllBytes: true,
|
|
3499
3509
|
decodeBitStrings: true
|
|
3500
3510
|
};
|
|
3501
3511
|
}
|
|
3502
3512
|
if(!('strict' in options)) {
|
|
3503
3513
|
options.strict = true;
|
|
3504
3514
|
}
|
|
3515
|
+
if(!('parseAllBytes' in options)) {
|
|
3516
|
+
options.parseAllBytes = true;
|
|
3517
|
+
}
|
|
3505
3518
|
if(!('decodeBitStrings' in options)) {
|
|
3506
3519
|
options.decodeBitStrings = true;
|
|
3507
3520
|
}
|
|
@@ -3511,7 +3524,15 @@ asn1$6.fromDer = function(bytes, options) {
|
|
|
3511
3524
|
bytes = forge$p.util.createBuffer(bytes);
|
|
3512
3525
|
}
|
|
3513
3526
|
|
|
3514
|
-
|
|
3527
|
+
var byteCount = bytes.length();
|
|
3528
|
+
var value = _fromDer(bytes, bytes.length(), 0, options);
|
|
3529
|
+
if(options.parseAllBytes && bytes.length() !== 0) {
|
|
3530
|
+
var error = new Error('Unparsed DER bytes remain after ASN.1 parsing.');
|
|
3531
|
+
error.byteCount = byteCount;
|
|
3532
|
+
error.remaining = bytes.length();
|
|
3533
|
+
throw error;
|
|
3534
|
+
}
|
|
3535
|
+
return value;
|
|
3515
3536
|
};
|
|
3516
3537
|
|
|
3517
3538
|
/**
|
|
@@ -3632,7 +3653,6 @@ function _fromDer(bytes, remaining, depth, options) {
|
|
|
3632
3653
|
start = bytes.length();
|
|
3633
3654
|
var subOptions = {
|
|
3634
3655
|
// enforce strict mode to avoid parsing ASN.1 from plain data
|
|
3635
|
-
verbose: options.verbose,
|
|
3636
3656
|
strict: true,
|
|
3637
3657
|
decodeBitStrings: true
|
|
3638
3658
|
};
|
|
@@ -3681,6 +3701,7 @@ function _fromDer(bytes, remaining, depth, options) {
|
|
|
3681
3701
|
}
|
|
3682
3702
|
} else {
|
|
3683
3703
|
value = bytes.getBytes(length);
|
|
3704
|
+
remaining -= length;
|
|
3684
3705
|
}
|
|
3685
3706
|
}
|
|
3686
3707
|
|
|
@@ -4456,7 +4477,16 @@ asn1$6.prettyPrint = function(obj, level, indentation) {
|
|
|
4456
4477
|
}
|
|
4457
4478
|
rval += '0x' + forge$p.util.bytesToHex(obj.value);
|
|
4458
4479
|
} else if(obj.type === asn1$6.Type.UTF8) {
|
|
4459
|
-
|
|
4480
|
+
try {
|
|
4481
|
+
rval += forge$p.util.decodeUtf8(obj.value);
|
|
4482
|
+
} catch(e) {
|
|
4483
|
+
if(e.message === 'URI malformed') {
|
|
4484
|
+
rval +=
|
|
4485
|
+
'0x' + forge$p.util.bytesToHex(obj.value) + ' (malformed UTF8)';
|
|
4486
|
+
} else {
|
|
4487
|
+
throw e;
|
|
4488
|
+
}
|
|
4489
|
+
}
|
|
4460
4490
|
} else if(obj.type === asn1$6.Type.PRINTABLESTRING ||
|
|
4461
4491
|
obj.type === asn1$6.Type.IA5String) {
|
|
4462
4492
|
rval += obj.value;
|
|
@@ -11668,6 +11698,40 @@ var publicKeyValidator$1 = forge$8.pki.rsa.publicKeyValidator = {
|
|
|
11668
11698
|
}]
|
|
11669
11699
|
};
|
|
11670
11700
|
|
|
11701
|
+
// validator for a DigestInfo structure
|
|
11702
|
+
var digestInfoValidator = {
|
|
11703
|
+
name: 'DigestInfo',
|
|
11704
|
+
tagClass: asn1$5.Class.UNIVERSAL,
|
|
11705
|
+
type: asn1$5.Type.SEQUENCE,
|
|
11706
|
+
constructed: true,
|
|
11707
|
+
value: [{
|
|
11708
|
+
name: 'DigestInfo.DigestAlgorithm',
|
|
11709
|
+
tagClass: asn1$5.Class.UNIVERSAL,
|
|
11710
|
+
type: asn1$5.Type.SEQUENCE,
|
|
11711
|
+
constructed: true,
|
|
11712
|
+
value: [{
|
|
11713
|
+
name: 'DigestInfo.DigestAlgorithm.algorithmIdentifier',
|
|
11714
|
+
tagClass: asn1$5.Class.UNIVERSAL,
|
|
11715
|
+
type: asn1$5.Type.OID,
|
|
11716
|
+
constructed: false,
|
|
11717
|
+
capture: 'algorithmIdentifier'
|
|
11718
|
+
}, {
|
|
11719
|
+
// NULL paramters
|
|
11720
|
+
name: 'DigestInfo.DigestAlgorithm.parameters',
|
|
11721
|
+
tagClass: asn1$5.Class.UNIVERSAL,
|
|
11722
|
+
type: asn1$5.Type.NULL,
|
|
11723
|
+
constructed: false
|
|
11724
|
+
}]
|
|
11725
|
+
}, {
|
|
11726
|
+
// digest
|
|
11727
|
+
name: 'DigestInfo.digest',
|
|
11728
|
+
tagClass: asn1$5.Class.UNIVERSAL,
|
|
11729
|
+
type: asn1$5.Type.OCTETSTRING,
|
|
11730
|
+
constructed: false,
|
|
11731
|
+
capture: 'digest'
|
|
11732
|
+
}]
|
|
11733
|
+
};
|
|
11734
|
+
|
|
11671
11735
|
/**
|
|
11672
11736
|
* Wrap digest in DigestInfo object.
|
|
11673
11737
|
*
|
|
@@ -12496,15 +12560,27 @@ pki$4.setRsaPublicKey = pki$4.rsa.setPublicKey = function(n, e) {
|
|
|
12496
12560
|
* a Forge PSS object for RSASSA-PSS,
|
|
12497
12561
|
* 'NONE' or null for none, DigestInfo will not be expected, but
|
|
12498
12562
|
* PKCS#1 v1.5 padding will still be used.
|
|
12563
|
+
* @param options optional verify options
|
|
12564
|
+
* _parseAllDigestBytes testing flag to control parsing of all
|
|
12565
|
+
* digest bytes. Unsupported and not for general usage.
|
|
12566
|
+
* (default: true)
|
|
12499
12567
|
*
|
|
12500
12568
|
* @return true if the signature was verified, false if not.
|
|
12501
12569
|
*/
|
|
12502
|
-
key.verify = function(digest, signature, scheme) {
|
|
12570
|
+
key.verify = function(digest, signature, scheme, options) {
|
|
12503
12571
|
if(typeof scheme === 'string') {
|
|
12504
12572
|
scheme = scheme.toUpperCase();
|
|
12505
12573
|
} else if(scheme === undefined) {
|
|
12506
12574
|
scheme = 'RSASSA-PKCS1-V1_5';
|
|
12507
12575
|
}
|
|
12576
|
+
if(options === undefined) {
|
|
12577
|
+
options = {
|
|
12578
|
+
_parseAllDigestBytes: true
|
|
12579
|
+
};
|
|
12580
|
+
}
|
|
12581
|
+
if(!('_parseAllDigestBytes' in options)) {
|
|
12582
|
+
options._parseAllDigestBytes = true;
|
|
12583
|
+
}
|
|
12508
12584
|
|
|
12509
12585
|
if(scheme === 'RSASSA-PKCS1-V1_5') {
|
|
12510
12586
|
scheme = {
|
|
@@ -12512,9 +12588,41 @@ pki$4.setRsaPublicKey = pki$4.rsa.setPublicKey = function(n, e) {
|
|
|
12512
12588
|
// remove padding
|
|
12513
12589
|
d = _decodePkcs1_v1_5(d, key, true);
|
|
12514
12590
|
// d is ASN.1 BER-encoded DigestInfo
|
|
12515
|
-
var obj = asn1$5.fromDer(d
|
|
12591
|
+
var obj = asn1$5.fromDer(d, {
|
|
12592
|
+
parseAllBytes: options._parseAllDigestBytes
|
|
12593
|
+
});
|
|
12594
|
+
|
|
12595
|
+
// validate DigestInfo
|
|
12596
|
+
var capture = {};
|
|
12597
|
+
var errors = [];
|
|
12598
|
+
if(!asn1$5.validate(obj, digestInfoValidator, capture, errors)) {
|
|
12599
|
+
var error = new Error(
|
|
12600
|
+
'ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 ' +
|
|
12601
|
+
'DigestInfo value.');
|
|
12602
|
+
error.errors = errors;
|
|
12603
|
+
throw error;
|
|
12604
|
+
}
|
|
12605
|
+
// check hash algorithm identifier
|
|
12606
|
+
// see PKCS1-v1-5DigestAlgorithms in RFC 8017
|
|
12607
|
+
// FIXME: add support to vaidator for strict value choices
|
|
12608
|
+
var oid = asn1$5.derToOid(capture.algorithmIdentifier);
|
|
12609
|
+
if(!(oid === forge$8.oids.md2 ||
|
|
12610
|
+
oid === forge$8.oids.md5 ||
|
|
12611
|
+
oid === forge$8.oids.sha1 ||
|
|
12612
|
+
oid === forge$8.oids.sha224 ||
|
|
12613
|
+
oid === forge$8.oids.sha256 ||
|
|
12614
|
+
oid === forge$8.oids.sha384 ||
|
|
12615
|
+
oid === forge$8.oids.sha512 ||
|
|
12616
|
+
oid === forge$8.oids['sha512-224'] ||
|
|
12617
|
+
oid === forge$8.oids['sha512-256'])) {
|
|
12618
|
+
var error = new Error(
|
|
12619
|
+
'Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.');
|
|
12620
|
+
error.oid = oid;
|
|
12621
|
+
throw error;
|
|
12622
|
+
}
|
|
12623
|
+
|
|
12516
12624
|
// compare the given digest to the decrypted one
|
|
12517
|
-
return digest ===
|
|
12625
|
+
return digest === capture.digest;
|
|
12518
12626
|
}
|
|
12519
12627
|
};
|
|
12520
12628
|
} else if(scheme === 'NONE' || scheme === 'NULL' || scheme === null) {
|
|
@@ -39,6 +39,14 @@ var joinMedia$1 = function (parentMedia, childMedia) {
|
|
|
39
39
|
return media
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
+
var joinLayer$1 = function (parentLayer, childLayer) {
|
|
43
|
+
if (!parentLayer.length && childLayer.length) return childLayer
|
|
44
|
+
if (parentLayer.length && !childLayer.length) return parentLayer
|
|
45
|
+
if (!parentLayer.length && !childLayer.length) return []
|
|
46
|
+
|
|
47
|
+
return parentLayer.concat(childLayer)
|
|
48
|
+
};
|
|
49
|
+
|
|
42
50
|
// external tooling
|
|
43
51
|
const resolve$1 = resolve__default;
|
|
44
52
|
|
|
@@ -330,6 +338,7 @@ var parseStatements$1 = function (result, styles) {
|
|
|
330
338
|
type: "nodes",
|
|
331
339
|
nodes,
|
|
332
340
|
media: [],
|
|
341
|
+
layer: [],
|
|
333
342
|
});
|
|
334
343
|
nodes = [];
|
|
335
344
|
}
|
|
@@ -342,6 +351,7 @@ var parseStatements$1 = function (result, styles) {
|
|
|
342
351
|
type: "nodes",
|
|
343
352
|
nodes,
|
|
344
353
|
media: [],
|
|
354
|
+
layer: [],
|
|
345
355
|
});
|
|
346
356
|
}
|
|
347
357
|
|
|
@@ -354,6 +364,7 @@ function parseMedia(result, atRule) {
|
|
|
354
364
|
type: "media",
|
|
355
365
|
node: atRule,
|
|
356
366
|
media: split(params, 0),
|
|
367
|
+
layer: [],
|
|
357
368
|
}
|
|
358
369
|
}
|
|
359
370
|
|
|
@@ -367,6 +378,7 @@ function parseCharset(result, atRule) {
|
|
|
367
378
|
type: "charset",
|
|
368
379
|
node: atRule,
|
|
369
380
|
media: [],
|
|
381
|
+
layer: [],
|
|
370
382
|
}
|
|
371
383
|
}
|
|
372
384
|
|
|
@@ -377,10 +389,12 @@ function parseImport(result, atRule) {
|
|
|
377
389
|
if (
|
|
378
390
|
prev.type !== "comment" &&
|
|
379
391
|
(prev.type !== "atrule" ||
|
|
380
|
-
(prev.name !== "import" &&
|
|
392
|
+
(prev.name !== "import" &&
|
|
393
|
+
prev.name !== "charset" &&
|
|
394
|
+
!(prev.name === "layer" && !prev.nodes)))
|
|
381
395
|
) {
|
|
382
396
|
return result.warn(
|
|
383
|
-
"@import must precede all other statements (besides @charset)",
|
|
397
|
+
"@import must precede all other statements (besides @charset or empty @layer)",
|
|
384
398
|
{ node: atRule }
|
|
385
399
|
)
|
|
386
400
|
}
|
|
@@ -401,6 +415,7 @@ function parseImport(result, atRule) {
|
|
|
401
415
|
type: "import",
|
|
402
416
|
node: atRule,
|
|
403
417
|
media: [],
|
|
418
|
+
layer: [],
|
|
404
419
|
};
|
|
405
420
|
|
|
406
421
|
// prettier-ignore
|
|
@@ -426,11 +441,31 @@ function parseImport(result, atRule) {
|
|
|
426
441
|
else stmt.uri = params[0].nodes[0].value;
|
|
427
442
|
stmt.fullUri = stringify(params[0]);
|
|
428
443
|
|
|
429
|
-
|
|
430
|
-
|
|
444
|
+
let remainder = params;
|
|
445
|
+
if (remainder.length > 2) {
|
|
446
|
+
if (
|
|
447
|
+
(remainder[2].type === "word" || remainder[2].type === "function") &&
|
|
448
|
+
remainder[2].value === "layer"
|
|
449
|
+
) {
|
|
450
|
+
if (remainder[1].type !== "space") {
|
|
451
|
+
return result.warn("Invalid import layer statement", { node: atRule })
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
if (remainder[2].nodes) {
|
|
455
|
+
stmt.layer = [stringify(remainder[2].nodes)];
|
|
456
|
+
} else {
|
|
457
|
+
stmt.layer = [""];
|
|
458
|
+
}
|
|
459
|
+
remainder = remainder.slice(2);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
if (remainder.length > 2) {
|
|
464
|
+
if (remainder[1].type !== "space") {
|
|
431
465
|
return result.warn("Invalid import media statement", { node: atRule })
|
|
432
466
|
}
|
|
433
|
-
|
|
467
|
+
|
|
468
|
+
stmt.media = split(remainder, 2);
|
|
434
469
|
}
|
|
435
470
|
|
|
436
471
|
return stmt
|
|
@@ -441,6 +476,7 @@ const path = path__default;
|
|
|
441
476
|
|
|
442
477
|
// internal tooling
|
|
443
478
|
const joinMedia = joinMedia$1;
|
|
479
|
+
const joinLayer = joinLayer$1;
|
|
444
480
|
const resolveId = resolveId$1;
|
|
445
481
|
const loadContent = loadContent$1;
|
|
446
482
|
const processContent = processContent$1;
|
|
@@ -483,11 +519,13 @@ function AtImport(options) {
|
|
|
483
519
|
throw new Error("plugins option must be an array")
|
|
484
520
|
}
|
|
485
521
|
|
|
486
|
-
return parseStyles(result, styles, options, state, []).then(
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
522
|
+
return parseStyles(result, styles, options, state, [], []).then(
|
|
523
|
+
bundle => {
|
|
524
|
+
applyRaws(bundle);
|
|
525
|
+
applyMedia(bundle);
|
|
526
|
+
applyStyles(bundle, styles);
|
|
527
|
+
}
|
|
528
|
+
)
|
|
491
529
|
|
|
492
530
|
function applyRaws(bundle) {
|
|
493
531
|
bundle.forEach((stmt, index) => {
|
|
@@ -505,21 +543,60 @@ function AtImport(options) {
|
|
|
505
543
|
|
|
506
544
|
function applyMedia(bundle) {
|
|
507
545
|
bundle.forEach(stmt => {
|
|
508
|
-
if (
|
|
546
|
+
if (
|
|
547
|
+
(!stmt.media.length && !stmt.layer.length) ||
|
|
548
|
+
stmt.type === "charset"
|
|
549
|
+
) {
|
|
550
|
+
return
|
|
551
|
+
}
|
|
552
|
+
|
|
509
553
|
if (stmt.type === "import") {
|
|
510
554
|
stmt.node.params = `${stmt.fullUri} ${stmt.media.join(", ")}`;
|
|
511
|
-
} else if (stmt.type === "media")
|
|
555
|
+
} else if (stmt.type === "media") {
|
|
512
556
|
stmt.node.params = stmt.media.join(", ");
|
|
513
|
-
else {
|
|
557
|
+
} else {
|
|
514
558
|
const { nodes } = stmt;
|
|
515
559
|
const { parent } = nodes[0];
|
|
516
|
-
const mediaNode = atRule({
|
|
517
|
-
name: "media",
|
|
518
|
-
params: stmt.media.join(", "),
|
|
519
|
-
source: parent.source,
|
|
520
|
-
});
|
|
521
560
|
|
|
522
|
-
|
|
561
|
+
let outerAtRule;
|
|
562
|
+
let innerAtRule;
|
|
563
|
+
if (stmt.media.length && stmt.layer.length) {
|
|
564
|
+
const mediaNode = atRule({
|
|
565
|
+
name: "media",
|
|
566
|
+
params: stmt.media.join(", "),
|
|
567
|
+
source: parent.source,
|
|
568
|
+
});
|
|
569
|
+
|
|
570
|
+
const layerNode = atRule({
|
|
571
|
+
name: "layer",
|
|
572
|
+
params: stmt.layer.filter(layer => layer !== "").join("."),
|
|
573
|
+
source: parent.source,
|
|
574
|
+
});
|
|
575
|
+
|
|
576
|
+
mediaNode.append(layerNode);
|
|
577
|
+
innerAtRule = layerNode;
|
|
578
|
+
outerAtRule = mediaNode;
|
|
579
|
+
} else if (stmt.media.length) {
|
|
580
|
+
const mediaNode = atRule({
|
|
581
|
+
name: "media",
|
|
582
|
+
params: stmt.media.join(", "),
|
|
583
|
+
source: parent.source,
|
|
584
|
+
});
|
|
585
|
+
|
|
586
|
+
innerAtRule = mediaNode;
|
|
587
|
+
outerAtRule = mediaNode;
|
|
588
|
+
} else if (stmt.layer.length) {
|
|
589
|
+
const layerNode = atRule({
|
|
590
|
+
name: "layer",
|
|
591
|
+
params: stmt.layer.filter(layer => layer !== "").join("."),
|
|
592
|
+
source: parent.source,
|
|
593
|
+
});
|
|
594
|
+
|
|
595
|
+
innerAtRule = layerNode;
|
|
596
|
+
outerAtRule = layerNode;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
parent.insertBefore(nodes[0], outerAtRule);
|
|
523
600
|
|
|
524
601
|
// remove nodes
|
|
525
602
|
nodes.forEach(node => {
|
|
@@ -529,11 +606,11 @@ function AtImport(options) {
|
|
|
529
606
|
// better output
|
|
530
607
|
nodes[0].raws.before = nodes[0].raws.before || "\n";
|
|
531
608
|
|
|
532
|
-
// wrap new rules with media query
|
|
533
|
-
|
|
609
|
+
// wrap new rules with media query and/or layer at rule
|
|
610
|
+
innerAtRule.append(nodes);
|
|
534
611
|
|
|
535
612
|
stmt.type = "media";
|
|
536
|
-
stmt.node =
|
|
613
|
+
stmt.node = outerAtRule;
|
|
537
614
|
delete stmt.nodes;
|
|
538
615
|
}
|
|
539
616
|
});
|
|
@@ -556,7 +633,7 @@ function AtImport(options) {
|
|
|
556
633
|
});
|
|
557
634
|
}
|
|
558
635
|
|
|
559
|
-
function parseStyles(result, styles, options, state, media) {
|
|
636
|
+
function parseStyles(result, styles, options, state, media, layer) {
|
|
560
637
|
const statements = parseStatements(result, styles);
|
|
561
638
|
|
|
562
639
|
return Promise.resolve(statements)
|
|
@@ -565,6 +642,7 @@ function AtImport(options) {
|
|
|
565
642
|
return stmts.reduce((promise, stmt) => {
|
|
566
643
|
return promise.then(() => {
|
|
567
644
|
stmt.media = joinMedia(media, stmt.media || []);
|
|
645
|
+
stmt.layer = joinLayer(layer, stmt.layer || []);
|
|
568
646
|
|
|
569
647
|
// skip protocol base uri (protocol://url) or protocol-relative
|
|
570
648
|
if (
|
|
@@ -676,7 +754,7 @@ function AtImport(options) {
|
|
|
676
754
|
|
|
677
755
|
function loadImportContent(result, stmt, filename, options, state) {
|
|
678
756
|
const atRule = stmt.node;
|
|
679
|
-
const { media } = stmt;
|
|
757
|
+
const { media, layer } = stmt;
|
|
680
758
|
if (options.skipDuplicates) {
|
|
681
759
|
// skip files already imported at the same scope
|
|
682
760
|
if (
|
|
@@ -724,7 +802,7 @@ function AtImport(options) {
|
|
|
724
802
|
}
|
|
725
803
|
|
|
726
804
|
// recursion: import @import from imported file
|
|
727
|
-
return parseStyles(result, styles, options, state, media)
|
|
805
|
+
return parseStyles(result, styles, options, state, media, layer)
|
|
728
806
|
})
|
|
729
807
|
}
|
|
730
808
|
)
|
package/dist/node/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var require$$0 = require('events');
|
|
4
|
-
var index = require('./chunks/dep-
|
|
4
|
+
var index = require('./chunks/dep-7765b27c.js');
|
|
5
5
|
var perf_hooks = require('perf_hooks');
|
|
6
6
|
require('fs');
|
|
7
7
|
require('path');
|
|
@@ -19,9 +19,9 @@ require('zlib');
|
|
|
19
19
|
require('crypto');
|
|
20
20
|
require('tls');
|
|
21
21
|
require('assert');
|
|
22
|
+
require('esbuild');
|
|
22
23
|
require('buffer');
|
|
23
24
|
require('querystring');
|
|
24
|
-
require('esbuild');
|
|
25
25
|
require('child_process');
|
|
26
26
|
require('worker_threads');
|
|
27
27
|
require('readline');
|
|
@@ -683,7 +683,7 @@ cli
|
|
|
683
683
|
.action(async (root, options) => {
|
|
684
684
|
// output structure is preserved even after bundling so require()
|
|
685
685
|
// is ok here
|
|
686
|
-
const { createServer } = await Promise.resolve().then(function () { return require('./chunks/dep-
|
|
686
|
+
const { createServer } = await Promise.resolve().then(function () { return require('./chunks/dep-7765b27c.js'); }).then(function (n) { return n.index$1; });
|
|
687
687
|
try {
|
|
688
688
|
const server = await createServer({
|
|
689
689
|
root,
|
|
@@ -732,7 +732,7 @@ cli
|
|
|
732
732
|
.option('--emptyOutDir', `[boolean] force empty outDir when it's outside of root`)
|
|
733
733
|
.option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
|
|
734
734
|
.action(async (root, options) => {
|
|
735
|
-
const { build } = await Promise.resolve().then(function () { return require('./chunks/dep-
|
|
735
|
+
const { build } = await Promise.resolve().then(function () { return require('./chunks/dep-7765b27c.js'); }).then(function (n) { return n.build$1; });
|
|
736
736
|
const buildOptions = cleanOptions(options);
|
|
737
737
|
try {
|
|
738
738
|
await build({
|
|
@@ -755,7 +755,7 @@ cli
|
|
|
755
755
|
.command('optimize [root]', 'pre-bundle dependencies')
|
|
756
756
|
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
|
757
757
|
.action(async (root, options) => {
|
|
758
|
-
const { optimizeDeps } = await Promise.resolve().then(function () { return require('./chunks/dep-
|
|
758
|
+
const { optimizeDeps } = await Promise.resolve().then(function () { return require('./chunks/dep-7765b27c.js'); }).then(function (n) { return n.index; });
|
|
759
759
|
try {
|
|
760
760
|
const config = await index.resolveConfig({
|
|
761
761
|
root,
|
|
@@ -778,7 +778,7 @@ cli
|
|
|
778
778
|
.option('--https', `[boolean] use TLS + HTTP/2`)
|
|
779
779
|
.option('--open [path]', `[boolean | string] open browser on startup`)
|
|
780
780
|
.action(async (root, options) => {
|
|
781
|
-
const { preview } = await Promise.resolve().then(function () { return require('./chunks/dep-
|
|
781
|
+
const { preview } = await Promise.resolve().then(function () { return require('./chunks/dep-7765b27c.js'); }).then(function (n) { return n.preview$1; });
|
|
782
782
|
try {
|
|
783
783
|
const server = await preview({
|
|
784
784
|
root,
|