vite 2.9.0-beta.3 → 2.9.0-beta.7

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.

@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./dep-19d0f55f.js');
3
+ var index = require('./dep-0e100549.js');
4
4
  var require$$1 = require('crypto');
5
5
  require('fs');
6
6
  require('path');
@@ -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
- return _fromDer(bytes, bytes.length(), 0, options);
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
- rval += forge$p.util.decodeUtf8(obj.value);
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 === obj.value[1].value;
12625
+ return digest === capture.digest;
12518
12626
  }
12519
12627
  };
12520
12628
  } else if(scheme === 'NONE' || scheme === 'NULL' || scheme === null) {
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var require$$0 = require('postcss');
4
- var index$1 = require('./dep-19d0f55f.js');
4
+ var index$1 = require('./dep-0e100549.js');
5
5
  var path$2 = require('path');
6
6
  var require$$1 = require('crypto');
7
7
  var fs = require('fs');
@@ -7304,8 +7304,8 @@ function getDefaultPlugins({
7304
7304
  const scope = (0, _postcssModulesScope2.default)({ generateScopedName, exportGlobals });
7305
7305
 
7306
7306
  const plugins = {
7307
- [behaviours.LOCAL]: [_postcssModulesValues2.default, _postcssModulesLocalByDefault2.default, _postcssModulesExtractImports2.default, scope],
7308
- [behaviours.GLOBAL]: [_postcssModulesValues2.default, _postcssModulesExtractImports2.default, scope]
7307
+ [behaviours.LOCAL]: [_postcssModulesValues2.default, (0, _postcssModulesLocalByDefault2.default)({ mode: 'local' }), _postcssModulesExtractImports2.default, scope],
7308
+ [behaviours.GLOBAL]: [_postcssModulesValues2.default, (0, _postcssModulesLocalByDefault2.default)({ mode: 'global' }), _postcssModulesExtractImports2.default, scope]
7309
7309
  };
7310
7310
 
7311
7311
  return plugins[behaviour];
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./dep-19d0f55f.js');
3
+ var index = require('./dep-0e100549.js');
4
4
 
5
5
  function _mergeNamespaces(n, m) {
6
6
  for (var i = 0; i < m.length; i++) {
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-19d0f55f.js');
4
+ var index = require('./chunks/dep-0e100549.js');
5
5
  var perf_hooks = require('perf_hooks');
6
6
  require('fs');
7
7
  require('path');
@@ -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-19d0f55f.js'); }).then(function (n) { return n.index$1; });
686
+ const { createServer } = await Promise.resolve().then(function () { return require('./chunks/dep-0e100549.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-19d0f55f.js'); }).then(function (n) { return n.build$1; });
735
+ const { build } = await Promise.resolve().then(function () { return require('./chunks/dep-0e100549.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-19d0f55f.js'); }).then(function (n) { return n.index; });
758
+ const { optimizeDeps } = await Promise.resolve().then(function () { return require('./chunks/dep-0e100549.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-19d0f55f.js'); }).then(function (n) { return n.preview$1; });
781
+ const { preview } = await Promise.resolve().then(function () { return require('./chunks/dep-0e100549.js'); }).then(function (n) { return n.preview$1; });
782
782
  try {
783
783
  const server = await preview({
784
784
  root,
@@ -10,6 +10,7 @@ import type { DuplexOptions } from 'stream';
10
10
  import { TransformOptions as EsbuildTransformOptions } from 'esbuild';
11
11
  import { EventEmitter } from 'events';
12
12
  import * as events from 'events';
13
+ import type { ExistingRawSourceMap } from 'rollup';
13
14
  import type * as fs from 'fs';
14
15
  import type { GetManualChunk } from 'rollup';
15
16
  import * as http from 'http';
@@ -516,10 +517,18 @@ export declare interface DepOptimizationMetadata {
516
517
  * Metadata for each already optimized dependency
517
518
  */
518
519
  optimized: Record<string, OptimizedDepInfo>;
520
+ /**
521
+ * Metadata for non-entry optimized chunks and dynamic imports
522
+ */
523
+ chunks: Record<string, OptimizedDepInfo>;
519
524
  /**
520
525
  * Metadata for each newly discovered dependency after processing
521
526
  */
522
527
  discovered: Record<string, OptimizedDepInfo>;
528
+ /**
529
+ * OptimizedDepInfo list
530
+ */
531
+ depInfoList: OptimizedDepInfo[];
523
532
  }
524
533
 
525
534
  export declare interface DepOptimizationOptions {
@@ -579,17 +588,11 @@ export declare interface DepOptimizationProcessing {
579
588
  }
580
589
 
581
590
  export declare interface DepOptimizationResult {
582
- /**
583
- * After a re-optimization, the internal bundled chunks may change
584
- * and a full page reload is required if that is the case
585
- * If the files are stable, we can avoid the reload that is expensive
586
- * for large applications
587
- */
588
- alteredFiles: boolean;
591
+ metadata: DepOptimizationMetadata;
589
592
  /**
590
593
  * When doing a re-run, if there are newly discovered dependendencies
591
- * the page reload will be delayed until the next rerun so the
592
- * result will be discarded
594
+ * the page reload will be delayed until the next rerun so we need
595
+ * to be able to discard the result
593
596
  */
594
597
  commit: () => void;
595
598
  cancel: () => void;
@@ -654,6 +657,8 @@ export declare interface FileSystemServeOptions {
654
657
  deny?: string[];
655
658
  }
656
659
 
660
+ export declare function formatPostcssSourceMap(rawMap: ExistingRawSourceMap, file: string): ExistingRawSourceMap;
661
+
657
662
  export declare class FSWatcher extends EventEmitter implements fs.FSWatcher {
658
663
  options: WatchOptions
659
664
 
@@ -1042,6 +1047,7 @@ export declare interface InternalResolveOptions extends ResolveOptions {
1042
1047
  isRequire?: boolean;
1043
1048
  isFromTsImporter?: boolean;
1044
1049
  tryEsmOnly?: boolean;
1050
+ scan?: boolean;
1045
1051
  }
1046
1052
 
1047
1053
  export declare interface JsonOptions {
@@ -1173,8 +1179,9 @@ export declare class ModuleNode {
1173
1179
  export declare function normalizePath(id: string): string;
1174
1180
 
1175
1181
  export declare interface OptimizedDepInfo {
1182
+ id: string;
1176
1183
  file: string;
1177
- src: string;
1184
+ src?: string;
1178
1185
  needsInterop?: boolean;
1179
1186
  browserHash?: string;
1180
1187
  fileHash?: string;
@@ -1182,14 +1189,19 @@ export declare interface OptimizedDepInfo {
1182
1189
  * During optimization, ids can still be resolved to their final location
1183
1190
  * but the bundles may not yet be saved to disk
1184
1191
  */
1185
- processing: Promise<void>;
1192
+ processing?: Promise<void>;
1193
+ }
1194
+
1195
+ export declare interface OptimizedDeps {
1196
+ metadata: DepOptimizationMetadata;
1197
+ scanProcessing?: Promise<void>;
1198
+ registerMissingImport: (id: string, resolved: string) => OptimizedDepInfo;
1186
1199
  }
1187
1200
 
1188
1201
  /**
1189
1202
  * Used by Vite CLI when running `vite optimize`
1190
1203
  */
1191
- export declare function optimizeDeps(config: ResolvedConfig, force?: boolean | undefined, asCommand?: boolean, newDeps?: Record<string, OptimizedDepInfo>, // missing imports encountered after server has started
1192
- ssr?: boolean): Promise<DepOptimizationMetadata>;
1204
+ export declare function optimizeDeps(config: ResolvedConfig, force?: boolean | undefined, asCommand?: boolean): Promise<DepOptimizationMetadata>;
1193
1205
 
1194
1206
  /** Cache for package.json resolution and package.json contents */
1195
1207
  export declare type PackageCache = Map<string, PackageData>;
@@ -1312,6 +1324,7 @@ export declare interface Plugin extends Plugin_2 {
1312
1324
  resolveId?(this: PluginContext, source: string, importer: string | undefined, options: {
1313
1325
  custom?: CustomPluginOptions;
1314
1326
  ssr?: boolean;
1327
+ /* Excluded from this release type: scan */
1315
1328
  }): Promise<ResolveIdResult> | ResolveIdResult;
1316
1329
  load?(this: PluginContext, id: string, options?: {
1317
1330
  ssr?: boolean;
@@ -1328,6 +1341,7 @@ export declare interface PluginContainer {
1328
1341
  resolveId(id: string, importer?: string, options?: {
1329
1342
  skip?: Set<Plugin>;
1330
1343
  ssr?: boolean;
1344
+ /* Excluded from this release type: scan */
1331
1345
  }): Promise<PartialResolvedId | null>;
1332
1346
  transform(code: string, id: string, options?: {
1333
1347
  inMap?: SourceDescription['map'];
@@ -2188,12 +2202,11 @@ export declare interface ViteDevServer {
2188
2202
  * @param forceOptimize - force the optimizer to re-bundle, same as --force cli flag
2189
2203
  */
2190
2204
  restart(forceOptimize?: boolean): Promise<void>;
2191
- /* Excluded from this release type: _optimizeDepsMetadata */
2205
+ /* Excluded from this release type: _optimizedDeps */
2192
2206
  /* Excluded from this release type: _ssrExternals */
2193
2207
  /* Excluded from this release type: _globImporters */
2194
2208
  /* Excluded from this release type: _restartPromise */
2195
2209
  /* Excluded from this release type: _forceOptimizeOnRestart */
2196
- /* Excluded from this release type: _registerMissingImport */
2197
2210
  /* Excluded from this release type: _pendingRequests */
2198
2211
  }
2199
2212
 
@@ -2312,6 +2325,8 @@ export declare class WebSocket extends EventEmitter {
2312
2325
  binaryType: 'nodebuffer' | 'arraybuffer' | 'fragments'
2313
2326
  readonly bufferedAmount: number
2314
2327
  readonly extensions: string
2328
+ /** Indicates whether the websocket is paused */
2329
+ readonly isPaused: boolean
2315
2330
  readonly protocol: string
2316
2331
  /** The current state of the connection */
2317
2332
  readonly readyState:
@@ -2330,11 +2345,12 @@ export declare class WebSocket extends EventEmitter {
2330
2345
  /** The connection is closed. */
2331
2346
  readonly CLOSED: 3
2332
2347
 
2333
- onopen: (event: WebSocket.Event) => void
2334
- onerror: (event: WebSocket.ErrorEvent) => void
2335
- onclose: (event: WebSocket.CloseEvent) => void
2336
- onmessage: (event: WebSocket.MessageEvent) => void
2348
+ onopen: ((event: WebSocket.Event) => void) | null
2349
+ onerror: ((event: WebSocket.ErrorEvent) => void) | null
2350
+ onclose: ((event: WebSocket.CloseEvent) => void) | null
2351
+ onmessage: ((event: WebSocket.MessageEvent) => void) | null
2337
2352
 
2353
+ constructor(address: null)
2338
2354
  constructor(
2339
2355
  address: string | URL_2,
2340
2356
  options?: WebSocket.ClientOptions | ClientRequestArgs
@@ -2361,6 +2377,18 @@ export declare class WebSocket extends EventEmitter {
2361
2377
  ): void
2362
2378
  terminate(): void
2363
2379
 
2380
+ /**
2381
+ * Pause the websocket causing it to stop emitting events. Some events can still be
2382
+ * emitted after this is called, until all buffered data is consumed. This method
2383
+ * is a noop if the ready state is `CONNECTING` or `CLOSED`.
2384
+ */
2385
+ pause(): void
2386
+ /**
2387
+ * Make a paused socket resume emitting events. This method is a noop if the ready
2388
+ * state is `CONNECTING` or `CLOSED`.
2389
+ */
2390
+ resume(): void
2391
+
2364
2392
  // HTML5 WebSocket events
2365
2393
  addEventListener(
2366
2394
  method: 'message',
@@ -2597,6 +2625,7 @@ export declare namespace WebSocket {
2597
2625
  export interface ClientOptions extends SecureContextOptions {
2598
2626
  protocol?: string | undefined
2599
2627
  followRedirects?: boolean | undefined
2628
+ generateMask?(mask: Buffer): void
2600
2629
  handshakeTimeout?: number | undefined
2601
2630
  maxRedirects?: number | undefined
2602
2631
  perMessageDeflate?: boolean | PerMessageDeflateOptions | undefined
@@ -2610,6 +2639,7 @@ export declare namespace WebSocket {
2610
2639
  checkServerIdentity?(servername: string, cert: CertMeta): boolean
2611
2640
  rejectUnauthorized?: boolean | undefined
2612
2641
  maxPayload?: number | undefined
2642
+ skipUTF8Validation?: boolean | undefined
2613
2643
  }
2614
2644
 
2615
2645
  export interface PerMessageDeflateOptions {
@@ -2684,6 +2714,7 @@ export declare namespace WebSocket {
2684
2714
  perMessageDeflate?: boolean | PerMessageDeflateOptions | undefined
2685
2715
  maxPayload?: number | undefined
2686
2716
  skipUTF8Validation?: boolean | undefined
2717
+ WebSocket?: typeof WebSocket.WebSocket | undefined
2687
2718
  }
2688
2719
 
2689
2720
  export interface AddressInfo {
@@ -2693,10 +2724,10 @@ export declare namespace WebSocket {
2693
2724
  }
2694
2725
 
2695
2726
  // WebSocket Server
2696
- export class Server extends EventEmitter {
2727
+ export class Server<T extends WebSocket = WebSocket> extends EventEmitter {
2697
2728
  options: ServerOptions
2698
2729
  path: string
2699
- clients: Set<WebSocket>
2730
+ clients: Set<T>
2700
2731
 
2701
2732
  constructor(options?: ServerOptions, callback?: () => void)
2702
2733
 
@@ -2706,56 +2737,59 @@ export declare namespace WebSocket {
2706
2737
  request: IncomingMessage,
2707
2738
  socket: Duplex,
2708
2739
  upgradeHead: Buffer,
2709
- callback: (client: WebSocket, request: IncomingMessage) => void
2740
+ callback: (client: T, request: IncomingMessage) => void
2710
2741
  ): void
2711
2742
  shouldHandle(request: IncomingMessage): boolean | Promise<boolean>
2712
2743
 
2713
2744
  // Events
2714
2745
  on(
2715
2746
  event: 'connection',
2716
- cb: (this: Server, socket: WebSocket, request: IncomingMessage) => void
2747
+ cb: (this: Server<T>, socket: T, request: IncomingMessage) => void
2717
2748
  ): this
2718
- on(event: 'error', cb: (this: Server, error: Error) => void): this
2749
+ on(event: 'error', cb: (this: Server<T>, error: Error) => void): this
2719
2750
  on(
2720
2751
  event: 'headers',
2721
- cb: (this: Server, headers: string[], request: IncomingMessage) => void
2752
+ cb: (this: Server<T>, headers: string[], request: IncomingMessage) => void
2722
2753
  ): this
2723
- on(event: 'close' | 'listening', cb: (this: Server) => void): this
2754
+ on(event: 'close' | 'listening', cb: (this: Server<T>) => void): this
2724
2755
  on(
2725
2756
  event: string | symbol,
2726
- listener: (this: Server, ...args: any[]) => void
2757
+ listener: (this: Server<T>, ...args: any[]) => void
2727
2758
  ): this
2728
2759
 
2729
2760
  once(
2730
2761
  event: 'connection',
2731
- cb: (this: Server, socket: WebSocket, request: IncomingMessage) => void
2762
+ cb: (this: Server<T>, socket: T, request: IncomingMessage) => void
2732
2763
  ): this
2733
- once(event: 'error', cb: (this: Server, error: Error) => void): this
2764
+ once(event: 'error', cb: (this: Server<T>, error: Error) => void): this
2734
2765
  once(
2735
2766
  event: 'headers',
2736
- cb: (this: Server, headers: string[], request: IncomingMessage) => void
2767
+ cb: (this: Server<T>, headers: string[], request: IncomingMessage) => void
2768
+ ): this
2769
+ once(event: 'close' | 'listening', cb: (this: Server<T>) => void): this
2770
+ once(
2771
+ event: string | symbol,
2772
+ listener: (this: Server<T>, ...args: any[]) => void
2737
2773
  ): this
2738
- once(event: 'close' | 'listening', cb: (this: Server) => void): this
2739
- once(event: string | symbol, listener: (...args: any[]) => void): this
2740
2774
 
2741
2775
  off(
2742
2776
  event: 'connection',
2743
- cb: (this: Server, socket: WebSocket, request: IncomingMessage) => void
2777
+ cb: (this: Server<T>, socket: T, request: IncomingMessage) => void
2744
2778
  ): this
2745
- off(event: 'error', cb: (this: Server, error: Error) => void): this
2779
+ off(event: 'error', cb: (this: Server<T>, error: Error) => void): this
2746
2780
  off(
2747
2781
  event: 'headers',
2748
- cb: (this: Server, headers: string[], request: IncomingMessage) => void
2782
+ cb: (this: Server<T>, headers: string[], request: IncomingMessage) => void
2749
2783
  ): this
2750
- off(event: 'close' | 'listening', cb: (this: Server) => void): this
2784
+ off(event: 'close' | 'listening', cb: (this: Server<T>) => void): this
2751
2785
  off(
2752
2786
  event: string | symbol,
2753
- listener: (this: Server, ...args: any[]) => void
2787
+ listener: (this: Server<T>, ...args: any[]) => void
2754
2788
  ): this
2755
2789
 
2756
2790
  addListener(
2757
2791
  event: 'connection',
2758
- cb: (client: WebSocket, request: IncomingMessage) => void
2792
+ cb: (client: T, request: IncomingMessage) => void
2759
2793
  ): this
2760
2794
  addListener(event: 'error', cb: (err: Error) => void): this
2761
2795
  addListener(
@@ -2768,7 +2802,7 @@ export declare namespace WebSocket {
2768
2802
  listener: (...args: any[]) => void
2769
2803
  ): this
2770
2804
 
2771
- removeListener(event: 'connection', cb: (client: WebSocket) => void): this
2805
+ removeListener(event: 'connection', cb: (client: T) => void): this
2772
2806
  removeListener(event: 'error', cb: (err: Error) => void): this
2773
2807
  removeListener(
2774
2808
  event: 'headers',
@@ -2782,9 +2816,9 @@ export declare namespace WebSocket {
2782
2816
  }
2783
2817
 
2784
2818
  const WebSocketServer: typeof Server
2785
- export type WebSocketServer = Server
2819
+ export interface WebSocketServer extends Server {} // tslint:disable-line no-empty-interface
2786
2820
  const WebSocket: typeof WebSocketAlias
2787
- export type WebSocket = WebSocketAlias
2821
+ export interface WebSocket extends WebSocketAlias {} // tslint:disable-line no-empty-interface
2788
2822
 
2789
2823
  // WebSocket stream
2790
2824
  export function createWebSocketStream(
@@ -2795,7 +2829,7 @@ export declare namespace WebSocket {
2795
2829
 
2796
2830
  export declare const WebSocketAlias: typeof WebSocket;
2797
2831
 
2798
- export declare type WebSocketAlias = WebSocket
2832
+ export declare interface WebSocketAlias extends WebSocket {}
2799
2833
 
2800
2834
  export declare interface WebSocketServer {
2801
2835
  on: WebSocket.Server['on'];
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('./chunks/dep-19d0f55f.js');
5
+ var index = require('./chunks/dep-0e100549.js');
6
6
  require('fs');
7
7
  require('path');
8
8
  require('tty');
@@ -137,6 +137,7 @@ exports.build = index.build;
137
137
  exports.createLogger = index.createLogger;
138
138
  exports.createServer = index.createServer;
139
139
  exports.defineConfig = index.defineConfig;
140
+ exports.formatPostcssSourceMap = index.formatPostcssSourceMap;
140
141
  exports.loadConfigFromFile = index.loadConfigFromFile;
141
142
  exports.loadEnv = index.loadEnv;
142
143
  exports.mergeConfig = index.mergeConfig;