vite 3.2.3 → 4.0.0-alpha.0

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.
@@ -1,7 +1,7 @@
1
1
  import require$$0 from 'path';
2
2
  import resolve$2 from 'resolve';
3
3
  import require$$0__default from 'fs';
4
- import { l as lib } from './dep-07a79996.js';
4
+ import { l as lib } from './dep-c423598f.js';
5
5
 
6
6
  import { fileURLToPath as __cjs_fileURLToPath } from 'node:url';
7
7
  import { dirname as __cjs_dirname } from 'node:path';
@@ -871,7 +871,7 @@ var postcssImport = AtImport;
871
871
 
872
872
  var index = /*#__PURE__*/_mergeNamespaces({
873
873
  __proto__: null,
874
- 'default': postcssImport
874
+ default: postcssImport
875
875
  }, [postcssImport]);
876
876
 
877
877
  export { index as i };
@@ -1,10 +1,10 @@
1
1
  import require$$0$1 from 'postcss';
2
- import { A as commonjsGlobal } from './dep-51c4f80a.js';
2
+ import { A as commonjsGlobal } from './dep-f991744a.js';
3
3
  import require$$0 from 'path';
4
4
  import require$$5 from 'crypto';
5
5
  import require$$0__default from 'fs';
6
6
  import require$$0$2 from 'util';
7
- import { l as lib$1 } from './dep-07a79996.js';
7
+ import { l as lib$1 } from './dep-c423598f.js';
8
8
 
9
9
  import { fileURLToPath as __cjs_fileURLToPath } from 'node:url';
10
10
  import { dirname as __cjs_dirname } from 'node:path';
@@ -7527,7 +7527,7 @@ var postcss = build.exports.postcss = true;
7527
7527
  var index = /*#__PURE__*/_mergeNamespaces({
7528
7528
  __proto__: null,
7529
7529
  postcss: postcss,
7530
- 'default': build.exports
7530
+ default: build.exports
7531
7531
  }, [build.exports]);
7532
7532
 
7533
7533
  export { index as i };
@@ -222,7 +222,7 @@ function alias$1(options = {}) {
222
222
  replace: (node: BaseNode) => void;
223
223
  }} WalkerContext */
224
224
 
225
- class WalkerBase$1 {
225
+ let WalkerBase$1 = class WalkerBase {
226
226
  constructor() {
227
227
  /** @type {boolean} */
228
228
  this.should_skip = false;
@@ -273,7 +273,7 @@ class WalkerBase$1 {
273
273
  }
274
274
  }
275
275
  }
276
- }
276
+ };
277
277
 
278
278
  // @ts-check
279
279
 
@@ -288,7 +288,7 @@ class WalkerBase$1 {
288
288
  * index: number
289
289
  * ) => void} SyncHandler */
290
290
 
291
- class SyncWalker$1 extends WalkerBase$1 {
291
+ let SyncWalker$1 = class SyncWalker extends WalkerBase$1 {
292
292
  /**
293
293
  *
294
294
  * @param {SyncHandler} enter
@@ -391,7 +391,7 @@ class SyncWalker$1 extends WalkerBase$1 {
391
391
 
392
392
  return node;
393
393
  }
394
- }
394
+ };
395
395
 
396
396
  // @ts-check
397
397
 
@@ -2521,7 +2521,7 @@ const blockDeclarations = {
2521
2521
  const: true,
2522
2522
  let: true
2523
2523
  };
2524
- class Scope$1 {
2524
+ let Scope$1 = class Scope {
2525
2525
  constructor(options = {}) {
2526
2526
  this.parent = options.parent;
2527
2527
  this.isBlockScope = !!options.block;
@@ -2549,7 +2549,7 @@ class Scope$1 {
2549
2549
  contains(name) {
2550
2550
  return this.declarations[name] || (this.parent ? this.parent.contains(name) : false);
2551
2551
  }
2552
- }
2552
+ };
2553
2553
  const attachScopes = function attachScopes(ast, propertyName = 'scope') {
2554
2554
  let scope = new Scope$1();
2555
2555
  walk$3(ast, {
@@ -3533,7 +3533,7 @@ minimatch$1.match = (list, pattern, options = {}) => {
3533
3533
  const globUnescape = s => s.replace(/\\(.)/g, '$1');
3534
3534
  const regExpEscape = s => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
3535
3535
 
3536
- class Minimatch$1 {
3536
+ let Minimatch$1 = class Minimatch {
3537
3537
  constructor (pattern, options) {
3538
3538
  assertValidPattern(pattern);
3539
3539
 
@@ -4265,7 +4265,7 @@ class Minimatch$1 {
4265
4265
  static defaults (def) {
4266
4266
  return minimatch$1.defaults(def).Minimatch
4267
4267
  }
4268
- }
4268
+ };
4269
4269
 
4270
4270
  minimatch$1.Minimatch = Minimatch$1;
4271
4271
 
@@ -6216,7 +6216,7 @@ function getBtoa () {
6216
6216
 
6217
6217
  const btoa$1 = /*#__PURE__*/ getBtoa();
6218
6218
 
6219
- class SourceMap$1 {
6219
+ let SourceMap$1 = class SourceMap {
6220
6220
  constructor(properties) {
6221
6221
  this.version = 3;
6222
6222
  this.file = properties.file;
@@ -6233,7 +6233,7 @@ class SourceMap$1 {
6233
6233
  toUrl() {
6234
6234
  return 'data:application/json;charset=utf-8;base64,' + btoa$1(this.toString());
6235
6235
  }
6236
- }
6236
+ };
6237
6237
 
6238
6238
  function guessIndent(code) {
6239
6239
  const lines = code.split('\n');
@@ -12496,6 +12496,17 @@ function joinUrlSegments(a, b) {
12496
12496
  }
12497
12497
  return a + b;
12498
12498
  }
12499
+ function arrayEqual(a, b) {
12500
+ if (a === b)
12501
+ return true;
12502
+ if (a.length !== b.length)
12503
+ return false;
12504
+ for (let i = 0; i < a.length; i++) {
12505
+ if (a[i] !== b[i])
12506
+ return false;
12507
+ }
12508
+ return true;
12509
+ }
12499
12510
 
12500
12511
  /* eslint no-console: 0 */
12501
12512
  const LogLevels = {
@@ -13851,7 +13862,7 @@ var fs$h = {};
13851
13862
 
13852
13863
  Object.defineProperty(fs$h, "__esModule", { value: true });
13853
13864
  fs$h.createDirentFromStats = void 0;
13854
- class DirentFromStats$1 {
13865
+ let DirentFromStats$1 = class DirentFromStats {
13855
13866
  constructor(name, stats) {
13856
13867
  this.name = name;
13857
13868
  this.isBlockDevice = stats.isBlockDevice.bind(stats);
@@ -13862,7 +13873,7 @@ class DirentFromStats$1 {
13862
13873
  this.isSocket = stats.isSocket.bind(stats);
13863
13874
  this.isSymbolicLink = stats.isSymbolicLink.bind(stats);
13864
13875
  }
13865
- }
13876
+ };
13866
13877
  function createDirentFromStats$1(name, stats) {
13867
13878
  return new DirentFromStats$1(name, stats);
13868
13879
  }
@@ -16573,7 +16584,7 @@ var fs$f = {};
16573
16584
 
16574
16585
  Object.defineProperty(settings$3, "__esModule", { value: true });
16575
16586
  const fs$e = fs$f;
16576
- class Settings$2 {
16587
+ let Settings$2 = class Settings {
16577
16588
  constructor(_options = {}) {
16578
16589
  this._options = _options;
16579
16590
  this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
@@ -16584,7 +16595,7 @@ class Settings$2 {
16584
16595
  _getValue(option, value) {
16585
16596
  return option !== null && option !== void 0 ? option : value;
16586
16597
  }
16587
- }
16598
+ };
16588
16599
  settings$3.default = Settings$2;
16589
16600
 
16590
16601
  Object.defineProperty(out$1, "__esModule", { value: true });
@@ -16928,7 +16939,7 @@ Object.defineProperty(settings$2, "__esModule", { value: true });
16928
16939
  const path$d = require$$0$4;
16929
16940
  const fsStat$3 = out$1;
16930
16941
  const fs$a = fs$b;
16931
- class Settings$1 {
16942
+ let Settings$1 = class Settings {
16932
16943
  constructor(_options = {}) {
16933
16944
  this._options = _options;
16934
16945
  this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
@@ -16945,7 +16956,7 @@ class Settings$1 {
16945
16956
  _getValue(option, value) {
16946
16957
  return option !== null && option !== void 0 ? option : value;
16947
16958
  }
16948
- }
16959
+ };
16949
16960
  settings$2.default = Settings$1;
16950
16961
 
16951
16962
  Object.defineProperty(out$2, "__esModule", { value: true });
@@ -17327,13 +17338,13 @@ var reader$1 = {};
17327
17338
 
17328
17339
  Object.defineProperty(reader$1, "__esModule", { value: true });
17329
17340
  const common$6 = common$7;
17330
- class Reader$1 {
17341
+ let Reader$1 = class Reader {
17331
17342
  constructor(_root, _settings) {
17332
17343
  this._root = _root;
17333
17344
  this._settings = _settings;
17334
17345
  this._root = common$6.replacePathSegmentSeparator(_root, _settings.pathSegmentSeparator);
17335
17346
  }
17336
- }
17347
+ };
17337
17348
  reader$1.default = Reader$1;
17338
17349
 
17339
17350
  Object.defineProperty(async$4, "__esModule", { value: true });
@@ -24826,7 +24837,7 @@ function fixFlowSeqItems(fc) {
24826
24837
  * }
24827
24838
  * ```
24828
24839
  */
24829
- class Parser$1 {
24840
+ let Parser$1 = class Parser {
24830
24841
  /**
24831
24842
  * @param onNewLine - If defined, called separately with the start position of
24832
24843
  * each new line (in `parse()`, including the start of input).
@@ -25654,7 +25665,7 @@ class Parser$1 {
25654
25665
  yield* this.pop();
25655
25666
  }
25656
25667
  }
25657
- }
25668
+ };
25658
25669
 
25659
25670
  function parseOptions(options) {
25660
25671
  const prettyErrors = options.prettyErrors !== false;
@@ -25784,7 +25795,7 @@ var YAML = {
25784
25795
 
25785
25796
  var browser$1 = {
25786
25797
  __proto__: null,
25787
- 'default': YAML,
25798
+ default: YAML,
25788
25799
  Composer: Composer,
25789
25800
  Document: Document,
25790
25801
  Schema: Schema,
@@ -32614,8 +32625,7 @@ async function fileToBuiltUrl(id, config, pluginContext, skipPublicCheck = false
32614
32625
  name,
32615
32626
  fileName: map.get(contentHash),
32616
32627
  type: 'asset',
32617
- source: content,
32618
- isAsset: true
32628
+ source: content
32619
32629
  });
32620
32630
  }
32621
32631
  url = `__VITE_ASSET__${contentHash}__${postfix ? `$_${postfix}__` : ``}`; // TODO_BASE
@@ -39596,7 +39606,7 @@ async function resolvePlugins(config, prePlugins, normalPlugins, postPlugins) {
39596
39606
  const isBuild = config.command === 'build';
39597
39607
  const isWatch = isBuild && !!config.build.watch;
39598
39608
  const buildPlugins = isBuild
39599
- ? (await Promise.resolve().then(function () { return build$1; })).resolveBuildPlugins(config)
39609
+ ? await (await Promise.resolve().then(function () { return build$1; })).resolveBuildPlugins(config)
39600
39610
  : { pre: [], post: [] };
39601
39611
  const { modulePreload } = config.build;
39602
39612
  return [
@@ -39915,6 +39925,7 @@ async function createPluginContainer(config, moduleGraph, watcher) {
39915
39925
  skip.add(this._activePlugin);
39916
39926
  }
39917
39927
  let out = await container.resolveId(id, importer, {
39928
+ assertions: options?.assertions,
39918
39929
  custom: options?.custom,
39919
39930
  isEntry: !!options?.isEntry,
39920
39931
  skip,
@@ -40150,6 +40161,7 @@ async function createPluginContainer(config, moduleGraph, watcher) {
40150
40161
  ? plugin.resolveId.handler
40151
40162
  : plugin.resolveId;
40152
40163
  const result = await handler.call(ctx, rawId, importer, {
40164
+ assertions: options?.assertions ?? {},
40153
40165
  custom: options?.custom,
40154
40166
  isEntry: !!options?.isEntry,
40155
40167
  ssr,
@@ -42535,7 +42547,7 @@ function traverseNodes(node, visitor) {
42535
42547
  }
42536
42548
  async function traverseHtml(html, filePath, visitor) {
42537
42549
  // lazy load compiler
42538
- const { parse } = await import('./dep-19c40c50.js');
42550
+ const { parse } = await import('./dep-adb60dd8.js');
42539
42551
  const ast = parse(html, {
42540
42552
  sourceCodeLocationInfo: true,
42541
42553
  onParseError: (e) => {
@@ -43533,7 +43545,7 @@ function cssPostPlugin(config) {
43533
43545
  if (config.build.cssCodeSplit) {
43534
43546
  if (isPureCssChunk) {
43535
43547
  // this is a shared CSS-only chunk that is empty.
43536
- pureCssChunks.add(chunk.fileName);
43548
+ pureCssChunks.add(chunk);
43537
43549
  }
43538
43550
  if (opts.format === 'es' || opts.format === 'cjs') {
43539
43551
  const cssAssetName = chunk.facadeModuleId
@@ -43600,7 +43612,21 @@ function cssPostPlugin(config) {
43600
43612
  }
43601
43613
  // remove empty css chunks and their imports
43602
43614
  if (pureCssChunks.size) {
43603
- const emptyChunkFiles = [...pureCssChunks]
43615
+ // map each pure css chunk (rendered chunk) to it's corresponding bundle
43616
+ // chunk. we check that by comparing the `moduleIds` as they have different
43617
+ // filenames (rendered chunk has the !~{XXX}~ placeholder)
43618
+ const pureCssChunkNames = [];
43619
+ for (const pureCssChunk of pureCssChunks) {
43620
+ for (const key in bundle) {
43621
+ const bundleChunk = bundle[key];
43622
+ if (bundleChunk.type === 'chunk' &&
43623
+ arrayEqual(bundleChunk.moduleIds, pureCssChunk.moduleIds)) {
43624
+ pureCssChunkNames.push(key);
43625
+ break;
43626
+ }
43627
+ }
43628
+ }
43629
+ const emptyChunkFiles = pureCssChunkNames
43604
43630
  .map((file) => path$o.basename(file))
43605
43631
  .join('|')
43606
43632
  .replace(/\./g, '\\.');
@@ -43614,7 +43640,7 @@ function cssPostPlugin(config) {
43614
43640
  // and also register the emitted CSS files under the importer
43615
43641
  // chunks instead.
43616
43642
  chunk.imports = chunk.imports.filter((file) => {
43617
- if (pureCssChunks.has(file)) {
43643
+ if (pureCssChunkNames.includes(file)) {
43618
43644
  const { viteMetadata: { importedCss } } = bundle[file];
43619
43645
  importedCss.forEach((file) => chunk.viteMetadata.importedCss.add(file));
43620
43646
  return false;
@@ -43627,7 +43653,7 @@ function cssPostPlugin(config) {
43627
43653
  }
43628
43654
  }
43629
43655
  const removedPureCssFiles = removedPureCssFilesCache.get(config);
43630
- pureCssChunks.forEach((fileName) => {
43656
+ pureCssChunkNames.forEach((fileName) => {
43631
43657
  removedPureCssFiles.set(fileName, bundle[fileName]);
43632
43658
  delete bundle[fileName];
43633
43659
  });
@@ -43758,7 +43784,7 @@ async function compileCSS(id, code, config, urlReplacer) {
43758
43784
  }
43759
43785
  const postcssPlugins = postcssConfig && postcssConfig.plugins ? postcssConfig.plugins.slice() : [];
43760
43786
  if (needInlineImport) {
43761
- postcssPlugins.unshift((await import('./dep-9deb2354.js').then(function (n) { return n.i; })).default({
43787
+ postcssPlugins.unshift((await import('./dep-4ec4968a.js').then(function (n) { return n.i; })).default({
43762
43788
  async resolve(id, basedir) {
43763
43789
  const publicFile = checkPublicFile(id, config);
43764
43790
  if (publicFile) {
@@ -43782,7 +43808,7 @@ async function compileCSS(id, code, config, urlReplacer) {
43782
43808
  }));
43783
43809
  }
43784
43810
  if (isModule) {
43785
- postcssPlugins.unshift((await import('./dep-7591464a.js').then(function (n) { return n.i; })).default({
43811
+ postcssPlugins.unshift((await import('./dep-cb778398.js').then(function (n) { return n.i; })).default({
43786
43812
  ...modulesOptions,
43787
43813
  // TODO: convert null to undefined (`null` should be removed from `CSSModulesOptions.localsConvention`)
43788
43814
  localsConvention: modulesOptions?.localsConvention ?? undefined,
@@ -45188,11 +45214,12 @@ function resolveBuildOptions(raw, logger) {
45188
45214
  }
45189
45215
  return resolved;
45190
45216
  }
45191
- function resolveBuildPlugins(config) {
45217
+ async function resolveBuildPlugins(config) {
45192
45218
  const options = config.build;
45193
45219
  const { commonjsOptions } = options;
45194
45220
  const usePluginCommonjs = !Array.isArray(commonjsOptions?.include) ||
45195
45221
  commonjsOptions?.include.length !== 0;
45222
+ const rollupOptionsPlugins = options.rollupOptions.plugins;
45196
45223
  return {
45197
45224
  pre: [
45198
45225
  completeSystemWrapPlugin(),
@@ -45200,9 +45227,9 @@ function resolveBuildPlugins(config) {
45200
45227
  watchPackageDataPlugin(config),
45201
45228
  ...(usePluginCommonjs ? [commonjs(options.commonjsOptions)] : []),
45202
45229
  dataURIPlugin(),
45203
- ...(options.rollupOptions.plugins
45204
- ? options.rollupOptions.plugins.filter(Boolean)
45205
- : [])
45230
+ ...(await asyncFlatten(Array.isArray(rollupOptionsPlugins)
45231
+ ? rollupOptionsPlugins
45232
+ : [rollupOptionsPlugins])).filter(Boolean)
45206
45233
  ],
45207
45234
  post: [
45208
45235
  buildImportAnalysisPlugin(config),
@@ -45515,11 +45542,11 @@ const dynamicImportWarningIgnoreList = [
45515
45542
  ];
45516
45543
  function onRollupWarning(warning, warn, config) {
45517
45544
  if (warning.code === 'UNRESOLVED_IMPORT') {
45518
- const id = warning.source;
45519
- const importer = warning.importer;
45545
+ const id = warning.id;
45546
+ const exporter = warning.exporter;
45520
45547
  // throw unless it's commonjs external...
45521
- if (!importer || !/\?commonjs-external$/.test(importer)) {
45522
- throw new Error(`[vite]: Rollup failed to resolve import "${id}" from "${importer}".\n` +
45548
+ if (!id || !/\?commonjs-external$/.test(id)) {
45549
+ throw new Error(`[vite]: Rollup failed to resolve import "${exporter}" from "${id}".\n` +
45523
45550
  `This is most likely unintended because it can break your application at runtime.\n` +
45524
45551
  `If you do want to externalize this module explicitly add it to\n` +
45525
45552
  `\`build.rollupOptions.external\``);
@@ -49602,7 +49629,7 @@ const setFsWatchFileListener = (path, fullPath, options, handlers) => {
49602
49629
  /**
49603
49630
  * @mixin
49604
49631
  */
49605
- class NodeFsHandler$1 {
49632
+ let NodeFsHandler$1 = class NodeFsHandler {
49606
49633
 
49607
49634
  /**
49608
49635
  * @param {import("../index").FSWatcher} fsW
@@ -49958,7 +49985,7 @@ async _addToNodeFs(path, initialAdd, priorWh, depth, target) {
49958
49985
  }
49959
49986
  }
49960
49987
 
49961
- }
49988
+ };
49962
49989
 
49963
49990
  var nodefsHandler = NodeFsHandler$1;
49964
49991
 
@@ -50176,7 +50203,7 @@ const sameTypes = (info, stats) => (
50176
50203
  /**
50177
50204
  * @mixin
50178
50205
  */
50179
- class FsEventsHandler$1 {
50206
+ let FsEventsHandler$1 = class FsEventsHandler {
50180
50207
 
50181
50208
  /**
50182
50209
  * @param {import('../index').FSWatcher} fsw
@@ -50482,7 +50509,7 @@ async _addToFsEvents(path, transform, forceAdd, priorDepth) {
50482
50509
  }
50483
50510
  }
50484
50511
 
50485
- }
50512
+ };
50486
50513
 
50487
50514
  fseventsHandler.exports = FsEventsHandler$1;
50488
50515
  fseventsHandler.exports.canUse = canUse;
@@ -53309,7 +53336,7 @@ const kRun = Symbol('kRun');
53309
53336
  * A very simple job queue with adjustable concurrency. Adapted from
53310
53337
  * https://github.com/STRML/async-limiter
53311
53338
  */
53312
- class Limiter$1 {
53339
+ let Limiter$1 = class Limiter {
53313
53340
  /**
53314
53341
  * Creates a new `Limiter`.
53315
53342
  *
@@ -53352,7 +53379,7 @@ class Limiter$1 {
53352
53379
  job(this[kDone]);
53353
53380
  }
53354
53381
  }
53355
- }
53382
+ };
53356
53383
 
53357
53384
  var limiter = Limiter$1;
53358
53385
 
@@ -53381,7 +53408,7 @@ let zlibLimiter;
53381
53408
  /**
53382
53409
  * permessage-deflate implementation.
53383
53410
  */
53384
- class PerMessageDeflate$4 {
53411
+ let PerMessageDeflate$4 = class PerMessageDeflate {
53385
53412
  /**
53386
53413
  * Creates a PerMessageDeflate instance.
53387
53414
  *
@@ -53811,7 +53838,7 @@ class PerMessageDeflate$4 {
53811
53838
  callback(null, data);
53812
53839
  });
53813
53840
  }
53814
- }
53841
+ };
53815
53842
 
53816
53843
  var permessageDeflate = PerMessageDeflate$4;
53817
53844
 
@@ -54016,7 +54043,7 @@ const INFLATING = 5;
54016
54043
  *
54017
54044
  * @extends Writable
54018
54045
  */
54019
- class Receiver$1 extends Writable$1 {
54046
+ let Receiver$1 = class Receiver extends Writable$1 {
54020
54047
  /**
54021
54048
  * Creates a Receiver instance.
54022
54049
  *
@@ -54582,7 +54609,7 @@ class Receiver$1 extends Writable$1 {
54582
54609
 
54583
54610
  this._state = GET_INFO;
54584
54611
  }
54585
- }
54612
+ };
54586
54613
 
54587
54614
  var receiver = Receiver$1;
54588
54615
 
@@ -54623,7 +54650,7 @@ const maskBuffer = Buffer.alloc(4);
54623
54650
  /**
54624
54651
  * HyBi Sender implementation.
54625
54652
  */
54626
- class Sender$1 {
54653
+ let Sender$1 = class Sender {
54627
54654
  /**
54628
54655
  * Creates a Sender instance.
54629
54656
  *
@@ -55079,7 +55106,7 @@ class Sender$1 {
55079
55106
  this._socket.write(list[0], cb);
55080
55107
  }
55081
55108
  }
55082
- }
55109
+ };
55083
55110
 
55084
55111
  var sender = Sender$1;
55085
55112
 
@@ -55590,7 +55617,7 @@ const subprotocolRegex = /^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;
55590
55617
  *
55591
55618
  * @extends EventEmitter
55592
55619
  */
55593
- class WebSocket$1 extends EventEmitter$1 {
55620
+ let WebSocket$1 = class WebSocket extends EventEmitter$1 {
55594
55621
  /**
55595
55622
  * Create a new `WebSocket`.
55596
55623
  *
@@ -56034,7 +56061,7 @@ class WebSocket$1 extends EventEmitter$1 {
56034
56061
  this._socket.destroy();
56035
56062
  }
56036
56063
  }
56037
- }
56064
+ };
56038
56065
 
56039
56066
  /**
56040
56067
  * @constant {Number} CONNECTING
@@ -62473,7 +62500,10 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development')
62473
62500
  ]
62474
62501
  }));
62475
62502
  }
62476
- return (await container.resolveId(id, importer, { ssr, scan: options?.scan }))?.id;
62503
+ return (await container.resolveId(id, importer, {
62504
+ ssr,
62505
+ scan: options?.scan
62506
+ }))?.id;
62477
62507
  };
62478
62508
  };
62479
62509
  const { publicDir } = config;
package/dist/node/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { performance } from 'node:perf_hooks';
2
2
  import { EventEmitter } from 'events';
3
- import { z as picocolors, v as createLogger, g as resolveConfig } from './chunks/dep-51c4f80a.js';
3
+ import { z as picocolors, v as createLogger, g as resolveConfig } from './chunks/dep-f991744a.js';
4
4
  import { VERSION } from './constants.js';
5
5
  import 'node:fs';
6
6
  import 'node:path';
@@ -702,7 +702,7 @@ cli
702
702
  filterDuplicateOptions(options);
703
703
  // output structure is preserved even after bundling so require()
704
704
  // is ok here
705
- const { createServer } = await import('./chunks/dep-51c4f80a.js').then(function (n) { return n.D; });
705
+ const { createServer } = await import('./chunks/dep-f991744a.js').then(function (n) { return n.D; });
706
706
  try {
707
707
  const server = await createServer({
708
708
  root,
@@ -750,7 +750,7 @@ cli
750
750
  .option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
751
751
  .action(async (root, options) => {
752
752
  filterDuplicateOptions(options);
753
- const { build } = await import('./chunks/dep-51c4f80a.js').then(function (n) { return n.C; });
753
+ const { build } = await import('./chunks/dep-f991744a.js').then(function (n) { return n.C; });
754
754
  const buildOptions = cleanOptions(options);
755
755
  try {
756
756
  await build({
@@ -775,7 +775,7 @@ cli
775
775
  .option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
776
776
  .action(async (root, options) => {
777
777
  filterDuplicateOptions(options);
778
- const { optimizeDeps } = await import('./chunks/dep-51c4f80a.js').then(function (n) { return n.B; });
778
+ const { optimizeDeps } = await import('./chunks/dep-f991744a.js').then(function (n) { return n.B; });
779
779
  try {
780
780
  const config = await resolveConfig({
781
781
  root,
@@ -800,7 +800,7 @@ cli
800
800
  .option('--outDir <dir>', `[string] output directory (default: dist)`)
801
801
  .action(async (root, options) => {
802
802
  filterDuplicateOptions(options);
803
- const { preview } = await import('./chunks/dep-51c4f80a.js').then(function (n) { return n.E; });
803
+ const { preview } = await import('./chunks/dep-f991744a.js').then(function (n) { return n.E; });
804
804
  try {
805
805
  const server = await preview({
806
806
  root,
@@ -1,8 +1,8 @@
1
1
  import path, { resolve } from 'node:path';
2
2
  import { fileURLToPath } from 'node:url';
3
+ import { readFileSync } from 'node:fs';
3
4
 
4
- var version = "3.2.3";
5
-
5
+ const { version } = JSON.parse(readFileSync(new URL('../../package.json', import.meta.url)).toString());
6
6
  const VERSION = version;
7
7
  const DEFAULT_MAIN_FIELDS = [
8
8
  'module',
@@ -1493,6 +1493,7 @@ declare interface Plugin_2 extends Plugin_3 {
1493
1493
  * extend hooks with ssr flag
1494
1494
  */
1495
1495
  resolveId?: ObjectHook<(this: PluginContext, source: string, importer: string | undefined, options: {
1496
+ assertions: Record<string, string>;
1496
1497
  custom?: CustomPluginOptions;
1497
1498
  ssr?: boolean;
1498
1499
  /* Excluded from this release type: scan */
@@ -1512,6 +1513,7 @@ export declare interface PluginContainer {
1512
1513
  getModuleInfo(id: string): ModuleInfo | null;
1513
1514
  buildStart(options: InputOptions): Promise<void>;
1514
1515
  resolveId(id: string, importer?: string, options?: {
1516
+ assertions?: Record<string, string>;
1515
1517
  custom?: CustomPluginOptions;
1516
1518
  skip?: Set<Plugin_2>;
1517
1519
  ssr?: boolean;
@@ -1,4 +1,4 @@
1
- export { b as build, q as createFilter, v as createLogger, c as createServer, e as defineConfig, f as formatPostcssSourceMap, i as getDepOptimizationConfig, j as isDepsOptimizerEnabled, l as loadConfigFromFile, x as loadEnv, k as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, h as resolveBaseUrl, g as resolveConfig, y as resolveEnvPrefix, d as resolvePackageData, r as resolvePackageEntry, w as searchForWorkspaceRoot, u as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-51c4f80a.js';
1
+ export { b as build, q as createFilter, v as createLogger, c as createServer, e as defineConfig, f as formatPostcssSourceMap, i as getDepOptimizationConfig, j as isDepsOptimizerEnabled, l as loadConfigFromFile, x as loadEnv, k as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, h as resolveBaseUrl, g as resolveConfig, y as resolveEnvPrefix, d as resolvePackageData, r as resolvePackageEntry, w as searchForWorkspaceRoot, u as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-f991744a.js';
2
2
  export { VERSION as version } from './constants.js';
3
3
  export { version as esbuildVersion } from 'esbuild';
4
4
  export { VERSION as rollupVersion } from 'rollup';
@@ -1,12 +1,10 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var path$3 = require('node:path');
6
4
  var node_url = require('node:url');
5
+ var fs$1 = require('node:fs');
7
6
  var esbuild = require('esbuild');
8
7
  var rollup = require('rollup');
9
- var fs$1 = require('node:fs');
10
8
  var os$1 = require('node:os');
11
9
  var node_util = require('node:util');
12
10
  var node_module = require('node:module');
@@ -18,28 +16,14 @@ var require$$1$1 = require('fs');
18
16
  var readline = require('node:readline');
19
17
  var require$$2 = require('os');
20
18
 
21
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; }
22
-
23
- var path__default = /*#__PURE__*/_interopDefaultLegacy(path$3);
24
- var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs$1);
25
- var os__default = /*#__PURE__*/_interopDefaultLegacy(os$1);
26
- var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0);
27
- var require$$1__default = /*#__PURE__*/_interopDefaultLegacy(require$$1);
28
- var require$$0__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$0$1);
29
- var require$$0__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$0$2);
30
- var require$$1__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$1$1);
31
- var readline__default = /*#__PURE__*/_interopDefaultLegacy(readline);
32
- var require$$2__default = /*#__PURE__*/_interopDefaultLegacy(require$$2);
33
-
34
- var version = "3.2.3";
35
-
19
+ const { version } = JSON.parse(fs$1.readFileSync(new URL('../../package.json', (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('node-cjs/publicUtils.cjs', document.baseURI).href)))).toString());
36
20
  const VERSION = version;
37
21
  const VITE_PACKAGE_DIR = path$3.resolve(
38
22
  // import.meta.url is `dist/node/constants.js` after bundle
39
23
  node_url.fileURLToPath((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('node-cjs/publicUtils.cjs', document.baseURI).href))), '../../..');
40
24
  const CLIENT_ENTRY = path$3.resolve(VITE_PACKAGE_DIR, 'dist/client/client.mjs');
41
25
  path$3.resolve(VITE_PACKAGE_DIR, 'dist/client/env.mjs');
42
- path__default.dirname(CLIENT_ENTRY);
26
+ path$3.dirname(CLIENT_ENTRY);
43
27
 
44
28
  // This file will be built for both ESM and CJS. Avoid relying on other modules as possible.
45
29
  const cssLangs = `\\.(css|less|sass|scss|styl|stylus|pcss|postcss)($|\\?)`;
@@ -173,7 +157,7 @@ function getDefaultExportFromCjs (x) {
173
157
 
174
158
  var picocolors = {exports: {}};
175
159
 
176
- let tty = require$$0__default;
160
+ let tty = require$$0;
177
161
 
178
162
  let isColorSupported =
179
163
  !("NO_COLOR" in process.env || process.argv.includes("--no-color")) &&
@@ -980,8 +964,8 @@ function requireNode () {
980
964
  if (hasRequiredNode) return node.exports;
981
965
  hasRequiredNode = 1;
982
966
  (function (module, exports) {
983
- const tty = require$$0__default;
984
- const util = require$$1__default;
967
+ const tty = require$$0;
968
+ const util = require$$1;
985
969
 
986
970
  /**
987
971
  * This is the Node.js implementation of `debug()`.
@@ -1262,7 +1246,7 @@ var picomatch$1 = {exports: {}};
1262
1246
 
1263
1247
  var utils$3 = {};
1264
1248
 
1265
- const path$2 = require$$0__default$1;
1249
+ const path$2 = require$$0$1;
1266
1250
  const WIN_SLASH = '\\\\/';
1267
1251
  const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
1268
1252
 
@@ -1442,7 +1426,7 @@ var constants$2 = {
1442
1426
 
1443
1427
  (function (exports) {
1444
1428
 
1445
- const path = require$$0__default$1;
1429
+ const path = require$$0$1;
1446
1430
  const win32 = process.platform === 'win32';
1447
1431
  const {
1448
1432
  REGEX_BACKSLASH,
@@ -2979,7 +2963,7 @@ parse$2.fastpaths = (input, options) => {
2979
2963
 
2980
2964
  var parse_1 = parse$2;
2981
2965
 
2982
- const path$1 = require$$0__default$1;
2966
+ const path$1 = require$$0$1;
2983
2967
  const scan = scan_1;
2984
2968
  const parse$1 = parse_1;
2985
2969
  const utils = utils$3;
@@ -3428,33 +3412,33 @@ function testCaseInsensitiveFS() {
3428
3412
  if (!CLIENT_ENTRY.endsWith('client.mjs')) {
3429
3413
  throw new Error(`cannot test case insensitive FS, CLIENT_ENTRY const doesn't contain client.mjs`);
3430
3414
  }
3431
- if (!fs__default.existsSync(CLIENT_ENTRY)) {
3415
+ if (!fs$1.existsSync(CLIENT_ENTRY)) {
3432
3416
  throw new Error('cannot test case insensitive FS, CLIENT_ENTRY does not point to an existing file: ' +
3433
3417
  CLIENT_ENTRY);
3434
3418
  }
3435
- return fs__default.existsSync(CLIENT_ENTRY.replace('client.mjs', 'cLiEnT.mjs'));
3419
+ return fs$1.existsSync(CLIENT_ENTRY.replace('client.mjs', 'cLiEnT.mjs'));
3436
3420
  }
3437
3421
  testCaseInsensitiveFS();
3438
- const isWindows = os__default.platform() === 'win32';
3422
+ const isWindows = os$1.platform() === 'win32';
3439
3423
  function normalizePath(id) {
3440
- return path__default.posix.normalize(isWindows ? slash(id) : id);
3424
+ return path$3.posix.normalize(isWindows ? slash(id) : id);
3441
3425
  }
3442
3426
  function isObject(value) {
3443
3427
  return Object.prototype.toString.call(value) === '[object Object]';
3444
3428
  }
3445
3429
  function lookupFile(dir, formats, options) {
3446
3430
  for (const format of formats) {
3447
- const fullPath = path__default.join(dir, format);
3448
- if (fs__default.existsSync(fullPath) && fs__default.statSync(fullPath).isFile()) {
3431
+ const fullPath = path$3.join(dir, format);
3432
+ if (fs$1.existsSync(fullPath) && fs$1.statSync(fullPath).isFile()) {
3449
3433
  const result = options?.pathOnly
3450
3434
  ? fullPath
3451
- : fs__default.readFileSync(fullPath, 'utf-8');
3435
+ : fs$1.readFileSync(fullPath, 'utf-8');
3452
3436
  if (!options?.predicate || options.predicate(result)) {
3453
3437
  return result;
3454
3438
  }
3455
3439
  }
3456
3440
  }
3457
- const parentDir = path__default.dirname(dir);
3441
+ const parentDir = path$3.dirname(dir);
3458
3442
  if (parentDir !== dir &&
3459
3443
  (!options?.rootDir || parentDir.startsWith(options?.rootDir))) {
3460
3444
  return lookupFile(parentDir, formats, options);
@@ -3468,7 +3452,7 @@ function lookupFile(dir, formats, options) {
3468
3452
  */
3469
3453
  function isFileReadable(filename) {
3470
3454
  try {
3471
- const stat = fs__default.statSync(filename, { throwIfNoEntry: false });
3455
+ const stat = fs$1.statSync(filename, { throwIfNoEntry: false });
3472
3456
  return !!stat;
3473
3457
  }
3474
3458
  catch {
@@ -3478,9 +3462,9 @@ function isFileReadable(filename) {
3478
3462
  isWindows
3479
3463
  ? node_util.promisify(gracefulRemoveDir)
3480
3464
  : function removeDirSync(dir) {
3481
- fs__default.rmSync(dir, { recursive: true, force: true });
3465
+ fs$1.rmSync(dir, { recursive: true, force: true });
3482
3466
  };
3483
- isWindows ? node_util.promisify(gracefulRename) : fs__default.renameSync;
3467
+ isWindows ? node_util.promisify(gracefulRename) : fs$1.renameSync;
3484
3468
  function arraify(target) {
3485
3469
  return Array.isArray(target) ? target : [target];
3486
3470
  }
@@ -3510,14 +3494,14 @@ const GRACEFUL_RENAME_TIMEOUT = 5000;
3510
3494
  function gracefulRename(from, to, cb) {
3511
3495
  const start = Date.now();
3512
3496
  let backoff = 0;
3513
- fs__default.rename(from, to, function CB(er) {
3497
+ fs$1.rename(from, to, function CB(er) {
3514
3498
  if (er &&
3515
3499
  (er.code === 'EACCES' || er.code === 'EPERM') &&
3516
3500
  Date.now() - start < GRACEFUL_RENAME_TIMEOUT) {
3517
3501
  setTimeout(function () {
3518
- fs__default.stat(to, function (stater, st) {
3502
+ fs$1.stat(to, function (stater, st) {
3519
3503
  if (stater && stater.code === 'ENOENT')
3520
- fs__default.rename(from, to, CB);
3504
+ fs$1.rename(from, to, CB);
3521
3505
  else
3522
3506
  CB(er);
3523
3507
  });
@@ -3534,14 +3518,14 @@ const GRACEFUL_REMOVE_DIR_TIMEOUT = 5000;
3534
3518
  function gracefulRemoveDir(dir, cb) {
3535
3519
  const start = Date.now();
3536
3520
  let backoff = 0;
3537
- fs__default.rm(dir, { recursive: true }, function CB(er) {
3521
+ fs$1.rm(dir, { recursive: true }, function CB(er) {
3538
3522
  if (er) {
3539
3523
  if ((er.code === 'ENOTEMPTY' ||
3540
3524
  er.code === 'EACCES' ||
3541
3525
  er.code === 'EPERM') &&
3542
3526
  Date.now() - start < GRACEFUL_REMOVE_DIR_TIMEOUT) {
3543
3527
  setTimeout(function () {
3544
- fs__default.rm(dir, { recursive: true }, CB);
3528
+ fs$1.rm(dir, { recursive: true }, CB);
3545
3529
  }, backoff);
3546
3530
  if (backoff < 100)
3547
3531
  backoff += 10;
@@ -3654,8 +3638,8 @@ var etag_1 = etag;
3654
3638
  * @private
3655
3639
  */
3656
3640
 
3657
- var crypto = require$$0__default$2;
3658
- var Stats = require$$1__default$1.Stats;
3641
+ var crypto = require$$0$2;
3642
+ var Stats = require$$1$1.Stats;
3659
3643
 
3660
3644
  /**
3661
3645
  * Module variables.
@@ -3838,8 +3822,8 @@ function clearScreen() {
3838
3822
  const repeatCount = process.stdout.rows - 2;
3839
3823
  const blank = repeatCount > 0 ? '\n'.repeat(repeatCount) : '';
3840
3824
  console.log(blank);
3841
- readline__default.cursorTo(process.stdout, 0, 0);
3842
- readline__default.clearScreenDown(process.stdout);
3825
+ readline.cursorTo(process.stdout, 0, 0);
3826
+ readline.clearScreenDown(process.stdout);
3843
3827
  }
3844
3828
  function createLogger(level = 'info', options = {}) {
3845
3829
  if (options.customLogger) {
@@ -3943,15 +3927,15 @@ function hasWorkspacePackageJSON(root) {
3943
3927
  if (!isFileReadable(path)) {
3944
3928
  return false;
3945
3929
  }
3946
- const content = JSON.parse(fs__default.readFileSync(path, 'utf-8')) || {};
3930
+ const content = JSON.parse(fs$1.readFileSync(path, 'utf-8')) || {};
3947
3931
  return !!content.workspaces;
3948
3932
  }
3949
3933
  function hasRootFile(root) {
3950
- return ROOT_FILES.some((file) => fs__default.existsSync(path$3.join(root, file)));
3934
+ return ROOT_FILES.some((file) => fs$1.existsSync(path$3.join(root, file)));
3951
3935
  }
3952
3936
  function hasPackageJSON(root) {
3953
3937
  const path = path$3.join(root, 'package.json');
3954
- return fs__default.existsSync(path);
3938
+ return fs$1.existsSync(path);
3955
3939
  }
3956
3940
  /**
3957
3941
  * Search up for the nearest `package.json`
@@ -3982,9 +3966,9 @@ function searchForWorkspaceRoot(current, root = searchForPackageRoot(current)) {
3982
3966
 
3983
3967
  var main$1 = {exports: {}};
3984
3968
 
3985
- const fs = require$$1__default$1;
3986
- const path = require$$0__default$1;
3987
- const os = require$$2__default;
3969
+ const fs = require$$1$1;
3970
+ const path = require$$0$1;
3971
+ const os = require$$2;
3988
3972
 
3989
3973
  function log (message) {
3990
3974
  console.log(`[dotenv][DEBUG] ${message}`);
@@ -4190,7 +4174,7 @@ function loadEnv(mode, envDir, prefixes = 'VITE_') {
4190
4174
  });
4191
4175
  if (!path)
4192
4176
  return [];
4193
- return Object.entries(main$1.exports.parse(fs__default.readFileSync(path), {
4177
+ return Object.entries(main$1.exports.parse(fs$1.readFileSync(path), {
4194
4178
  debug: process.env.DEBUG?.includes('vite:dotenv')
4195
4179
  }));
4196
4180
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "3.2.3",
3
+ "version": "4.0.0-alpha.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -61,7 +61,7 @@
61
61
  "esbuild": "^0.15.9",
62
62
  "postcss": "^8.4.18",
63
63
  "resolve": "^1.22.1",
64
- "rollup": "^2.79.1"
64
+ "rollup": "~3.2.3"
65
65
  },
66
66
  "optionalDependencies": {
67
67
  "fsevents": "~2.3.2"