vite 4.4.7 → 4.4.8

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.

@@ -6080,7 +6080,7 @@ var globExports = requireGlob();
6080
6080
  var glob$1 = /*@__PURE__*/getDefaultExportFromCjs(globExports);
6081
6081
 
6082
6082
  const comma$1 = ','.charCodeAt(0);
6083
- const semicolon$1 = ';'.charCodeAt(0);
6083
+ const semicolon = ';'.charCodeAt(0);
6084
6084
  const chars$2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
6085
6085
  const intToChar$1 = new Uint8Array(64); // 64 possible chars.
6086
6086
  const charToInt$1 = new Uint8Array(128); // z is 122 in ASCII
@@ -6090,7 +6090,7 @@ for (let i = 0; i < chars$2.length; i++) {
6090
6090
  charToInt$1[c] = i;
6091
6091
  }
6092
6092
  // Provide a fallback for older environments.
6093
- const td$1 = typeof TextDecoder !== 'undefined'
6093
+ const td = typeof TextDecoder !== 'undefined'
6094
6094
  ? /* #__PURE__ */ new TextDecoder()
6095
6095
  : typeof Buffer !== 'undefined'
6096
6096
  ? {
@@ -6108,81 +6108,7 @@ const td$1 = typeof TextDecoder !== 'undefined'
6108
6108
  return out;
6109
6109
  },
6110
6110
  };
6111
- function decode(mappings) {
6112
- const state = new Int32Array(5);
6113
- const decoded = [];
6114
- let index = 0;
6115
- do {
6116
- const semi = indexOf(mappings, index);
6117
- const line = [];
6118
- let sorted = true;
6119
- let lastCol = 0;
6120
- state[0] = 0;
6121
- for (let i = index; i < semi; i++) {
6122
- let seg;
6123
- i = decodeInteger(mappings, i, state, 0); // genColumn
6124
- const col = state[0];
6125
- if (col < lastCol)
6126
- sorted = false;
6127
- lastCol = col;
6128
- if (hasMoreVlq(mappings, i, semi)) {
6129
- i = decodeInteger(mappings, i, state, 1); // sourcesIndex
6130
- i = decodeInteger(mappings, i, state, 2); // sourceLine
6131
- i = decodeInteger(mappings, i, state, 3); // sourceColumn
6132
- if (hasMoreVlq(mappings, i, semi)) {
6133
- i = decodeInteger(mappings, i, state, 4); // namesIndex
6134
- seg = [col, state[1], state[2], state[3], state[4]];
6135
- }
6136
- else {
6137
- seg = [col, state[1], state[2], state[3]];
6138
- }
6139
- }
6140
- else {
6141
- seg = [col];
6142
- }
6143
- line.push(seg);
6144
- }
6145
- if (!sorted)
6146
- sort(line);
6147
- decoded.push(line);
6148
- index = semi + 1;
6149
- } while (index <= mappings.length);
6150
- return decoded;
6151
- }
6152
- function indexOf(mappings, index) {
6153
- const idx = mappings.indexOf(';', index);
6154
- return idx === -1 ? mappings.length : idx;
6155
- }
6156
- function decodeInteger(mappings, pos, state, j) {
6157
- let value = 0;
6158
- let shift = 0;
6159
- let integer = 0;
6160
- do {
6161
- const c = mappings.charCodeAt(pos++);
6162
- integer = charToInt$1[c];
6163
- value |= (integer & 31) << shift;
6164
- shift += 5;
6165
- } while (integer & 32);
6166
- const shouldNegate = value & 1;
6167
- value >>>= 1;
6168
- if (shouldNegate) {
6169
- value = -0x80000000 | -value;
6170
- }
6171
- state[j] += value;
6172
- return pos;
6173
- }
6174
- function hasMoreVlq(mappings, i, length) {
6175
- if (i >= length)
6176
- return false;
6177
- return mappings.charCodeAt(i) !== comma$1;
6178
- }
6179
- function sort(line) {
6180
- line.sort(sortComparator$1);
6181
- }
6182
- function sortComparator$1(a, b) {
6183
- return a[0] - b[0];
6184
- }
6185
- function encode$2(decoded) {
6111
+ function encode$1(decoded) {
6186
6112
  const state = new Int32Array(5);
6187
6113
  const bufLength = 1024 * 16;
6188
6114
  const subLength = bufLength - 36;
@@ -6194,10 +6120,10 @@ function encode$2(decoded) {
6194
6120
  const line = decoded[i];
6195
6121
  if (i > 0) {
6196
6122
  if (pos === bufLength) {
6197
- out += td$1.decode(buf);
6123
+ out += td.decode(buf);
6198
6124
  pos = 0;
6199
6125
  }
6200
- buf[pos++] = semicolon$1;
6126
+ buf[pos++] = semicolon;
6201
6127
  }
6202
6128
  if (line.length === 0)
6203
6129
  continue;
@@ -6207,26 +6133,26 @@ function encode$2(decoded) {
6207
6133
  // We can push up to 5 ints, each int can take at most 7 chars, and we
6208
6134
  // may push a comma.
6209
6135
  if (pos > subLength) {
6210
- out += td$1.decode(sub);
6136
+ out += td.decode(sub);
6211
6137
  buf.copyWithin(0, subLength, pos);
6212
6138
  pos -= subLength;
6213
6139
  }
6214
6140
  if (j > 0)
6215
6141
  buf[pos++] = comma$1;
6216
- pos = encodeInteger$1(buf, pos, state, segment, 0); // genColumn
6142
+ pos = encodeInteger(buf, pos, state, segment, 0); // genColumn
6217
6143
  if (segment.length === 1)
6218
6144
  continue;
6219
- pos = encodeInteger$1(buf, pos, state, segment, 1); // sourcesIndex
6220
- pos = encodeInteger$1(buf, pos, state, segment, 2); // sourceLine
6221
- pos = encodeInteger$1(buf, pos, state, segment, 3); // sourceColumn
6145
+ pos = encodeInteger(buf, pos, state, segment, 1); // sourcesIndex
6146
+ pos = encodeInteger(buf, pos, state, segment, 2); // sourceLine
6147
+ pos = encodeInteger(buf, pos, state, segment, 3); // sourceColumn
6222
6148
  if (segment.length === 4)
6223
6149
  continue;
6224
- pos = encodeInteger$1(buf, pos, state, segment, 4); // namesIndex
6150
+ pos = encodeInteger(buf, pos, state, segment, 4); // namesIndex
6225
6151
  }
6226
6152
  }
6227
- return out + td$1.decode(buf.subarray(0, pos));
6153
+ return out + td.decode(buf.subarray(0, pos));
6228
6154
  }
6229
- function encodeInteger$1(buf, pos, state, segment, j) {
6155
+ function encodeInteger(buf, pos, state, segment, j) {
6230
6156
  const next = segment[j];
6231
6157
  let num = next - state[j];
6232
6158
  state[j] = next;
@@ -6430,7 +6356,7 @@ let SourceMap$2 = class SourceMap {
6430
6356
  this.sources = properties.sources;
6431
6357
  this.sourcesContent = properties.sourcesContent;
6432
6358
  this.names = properties.names;
6433
- this.mappings = encode$2(properties.mappings);
6359
+ this.mappings = encode$1(properties.mappings);
6434
6360
  }
6435
6361
 
6436
6362
  toString() {
@@ -9665,6 +9591,90 @@ function commonjs(options = {}) {
9665
9591
  };
9666
9592
  }
9667
9593
 
9594
+ const comma = ','.charCodeAt(0);
9595
+ const chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
9596
+ const intToChar = new Uint8Array(64); // 64 possible chars.
9597
+ const charToInt = new Uint8Array(128); // z is 122 in ASCII
9598
+ for (let i = 0; i < chars$1.length; i++) {
9599
+ const c = chars$1.charCodeAt(i);
9600
+ intToChar[i] = c;
9601
+ charToInt[c] = i;
9602
+ }
9603
+ function decode(mappings) {
9604
+ const state = new Int32Array(5);
9605
+ const decoded = [];
9606
+ let index = 0;
9607
+ do {
9608
+ const semi = indexOf(mappings, index);
9609
+ const line = [];
9610
+ let sorted = true;
9611
+ let lastCol = 0;
9612
+ state[0] = 0;
9613
+ for (let i = index; i < semi; i++) {
9614
+ let seg;
9615
+ i = decodeInteger(mappings, i, state, 0); // genColumn
9616
+ const col = state[0];
9617
+ if (col < lastCol)
9618
+ sorted = false;
9619
+ lastCol = col;
9620
+ if (hasMoreVlq(mappings, i, semi)) {
9621
+ i = decodeInteger(mappings, i, state, 1); // sourcesIndex
9622
+ i = decodeInteger(mappings, i, state, 2); // sourceLine
9623
+ i = decodeInteger(mappings, i, state, 3); // sourceColumn
9624
+ if (hasMoreVlq(mappings, i, semi)) {
9625
+ i = decodeInteger(mappings, i, state, 4); // namesIndex
9626
+ seg = [col, state[1], state[2], state[3], state[4]];
9627
+ }
9628
+ else {
9629
+ seg = [col, state[1], state[2], state[3]];
9630
+ }
9631
+ }
9632
+ else {
9633
+ seg = [col];
9634
+ }
9635
+ line.push(seg);
9636
+ }
9637
+ if (!sorted)
9638
+ sort(line);
9639
+ decoded.push(line);
9640
+ index = semi + 1;
9641
+ } while (index <= mappings.length);
9642
+ return decoded;
9643
+ }
9644
+ function indexOf(mappings, index) {
9645
+ const idx = mappings.indexOf(';', index);
9646
+ return idx === -1 ? mappings.length : idx;
9647
+ }
9648
+ function decodeInteger(mappings, pos, state, j) {
9649
+ let value = 0;
9650
+ let shift = 0;
9651
+ let integer = 0;
9652
+ do {
9653
+ const c = mappings.charCodeAt(pos++);
9654
+ integer = charToInt[c];
9655
+ value |= (integer & 31) << shift;
9656
+ shift += 5;
9657
+ } while (integer & 32);
9658
+ const shouldNegate = value & 1;
9659
+ value >>>= 1;
9660
+ if (shouldNegate) {
9661
+ value = -0x80000000 | -value;
9662
+ }
9663
+ state[j] += value;
9664
+ return pos;
9665
+ }
9666
+ function hasMoreVlq(mappings, i, length) {
9667
+ if (i >= length)
9668
+ return false;
9669
+ return mappings.charCodeAt(i) !== comma;
9670
+ }
9671
+ function sort(line) {
9672
+ line.sort(sortComparator$1);
9673
+ }
9674
+ function sortComparator$1(a, b) {
9675
+ return a[0] - b[0];
9676
+ }
9677
+
9668
9678
  // Matches the scheme of a URL, eg "http://"
9669
9679
  const schemeRegex = /^[\w+.-]+:\/\//;
9670
9680
  /**
@@ -10183,94 +10193,6 @@ class SetArray {
10183
10193
  };
10184
10194
  })();
10185
10195
 
10186
- const comma = ','.charCodeAt(0);
10187
- const semicolon = ';'.charCodeAt(0);
10188
- const chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
10189
- const intToChar = new Uint8Array(64); // 64 possible chars.
10190
- const charToInt = new Uint8Array(128); // z is 122 in ASCII
10191
- for (let i = 0; i < chars$1.length; i++) {
10192
- const c = chars$1.charCodeAt(i);
10193
- intToChar[i] = c;
10194
- charToInt[c] = i;
10195
- }
10196
- // Provide a fallback for older environments.
10197
- const td = typeof TextDecoder !== 'undefined'
10198
- ? /* #__PURE__ */ new TextDecoder()
10199
- : typeof Buffer !== 'undefined'
10200
- ? {
10201
- decode(buf) {
10202
- const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
10203
- return out.toString();
10204
- },
10205
- }
10206
- : {
10207
- decode(buf) {
10208
- let out = '';
10209
- for (let i = 0; i < buf.length; i++) {
10210
- out += String.fromCharCode(buf[i]);
10211
- }
10212
- return out;
10213
- },
10214
- };
10215
- function encode$1(decoded) {
10216
- const state = new Int32Array(5);
10217
- const bufLength = 1024 * 16;
10218
- const subLength = bufLength - 36;
10219
- const buf = new Uint8Array(bufLength);
10220
- const sub = buf.subarray(0, subLength);
10221
- let pos = 0;
10222
- let out = '';
10223
- for (let i = 0; i < decoded.length; i++) {
10224
- const line = decoded[i];
10225
- if (i > 0) {
10226
- if (pos === bufLength) {
10227
- out += td.decode(buf);
10228
- pos = 0;
10229
- }
10230
- buf[pos++] = semicolon;
10231
- }
10232
- if (line.length === 0)
10233
- continue;
10234
- state[0] = 0;
10235
- for (let j = 0; j < line.length; j++) {
10236
- const segment = line[j];
10237
- // We can push up to 5 ints, each int can take at most 7 chars, and we
10238
- // may push a comma.
10239
- if (pos > subLength) {
10240
- out += td.decode(sub);
10241
- buf.copyWithin(0, subLength, pos);
10242
- pos -= subLength;
10243
- }
10244
- if (j > 0)
10245
- buf[pos++] = comma;
10246
- pos = encodeInteger(buf, pos, state, segment, 0); // genColumn
10247
- if (segment.length === 1)
10248
- continue;
10249
- pos = encodeInteger(buf, pos, state, segment, 1); // sourcesIndex
10250
- pos = encodeInteger(buf, pos, state, segment, 2); // sourceLine
10251
- pos = encodeInteger(buf, pos, state, segment, 3); // sourceColumn
10252
- if (segment.length === 4)
10253
- continue;
10254
- pos = encodeInteger(buf, pos, state, segment, 4); // namesIndex
10255
- }
10256
- }
10257
- return out + td.decode(buf.subarray(0, pos));
10258
- }
10259
- function encodeInteger(buf, pos, state, segment, j) {
10260
- const next = segment[j];
10261
- let num = next - state[j];
10262
- state[j] = next;
10263
- num = num < 0 ? (-num << 1) | 1 : num << 1;
10264
- do {
10265
- let clamped = num & 0b011111;
10266
- num >>>= 5;
10267
- if (num > 0)
10268
- clamped |= 0b100000;
10269
- buf[pos++] = intToChar[clamped];
10270
- } while (num > 0);
10271
- return pos;
10272
- }
10273
-
10274
10196
  const COLUMN = 0;
10275
10197
  const SOURCES_INDEX = 1;
10276
10198
  const SOURCE_LINE = 2;
@@ -12736,7 +12658,7 @@ function transformStableResult(s, id, config) {
12736
12658
  return {
12737
12659
  code: s.toString(),
12738
12660
  map: config.command === 'build' && config.build.sourcemap
12739
- ? s.generateMap({ hires: true, source: id })
12661
+ ? s.generateMap({ hires: 'boundary', source: id })
12740
12662
  : null,
12741
12663
  };
12742
12664
  }
@@ -12841,6 +12763,23 @@ const escapeRegexRE = /[-/\\^$*+?.()|[\]{}]/g;
12841
12763
  function escapeRegex(str) {
12842
12764
  return str.replace(escapeRegexRE, '\\$&');
12843
12765
  }
12766
+ function getPackageManagerCommand(type = 'install') {
12767
+ const packageManager = process.env.npm_config_user_agent?.split(' ')[0].split('/')[0] || 'npm';
12768
+ switch (type) {
12769
+ case 'install':
12770
+ return packageManager === 'npm' ? 'npm install' : `${packageManager} add`;
12771
+ case 'uninstall':
12772
+ return packageManager === 'npm'
12773
+ ? 'npm uninstall'
12774
+ : `${packageManager} remove`;
12775
+ case 'update':
12776
+ return packageManager === 'yarn'
12777
+ ? 'yarn upgrade'
12778
+ : `${packageManager} update`;
12779
+ default:
12780
+ throw new TypeError(`Unknown command type: ${type}`);
12781
+ }
12782
+ }
12844
12783
 
12845
12784
  /* eslint no-console: 0 */
12846
12785
  const LogLevels = {
@@ -12863,6 +12802,11 @@ function createLogger(level = 'info', options = {}) {
12863
12802
  if (options.customLogger) {
12864
12803
  return options.customLogger;
12865
12804
  }
12805
+ const timeFormatter = new Intl.DateTimeFormat(undefined, {
12806
+ hour: 'numeric',
12807
+ minute: 'numeric',
12808
+ second: 'numeric',
12809
+ });
12866
12810
  const loggedErrors = new WeakSet();
12867
12811
  const { prefix = '[vite]', allowClearScreen = true } = options;
12868
12812
  const thresh = LogLevels[level];
@@ -12878,7 +12822,7 @@ function createLogger(level = 'info', options = {}) {
12878
12822
  : type === 'warn'
12879
12823
  ? colors$1.yellow(colors$1.bold(prefix))
12880
12824
  : colors$1.red(colors$1.bold(prefix));
12881
- return `${colors$1.dim(new Date().toLocaleTimeString())} ${tag} ${msg}`;
12825
+ return `${colors$1.dim(timeFormatter.format(new Date()))} ${tag} ${msg}`;
12882
12826
  }
12883
12827
  else {
12884
12828
  return msg;
@@ -12964,6 +12908,13 @@ const COMPRESSIBLE_ASSETS_RE = /\.(?:html|json|svg|txt|xml|xhtml)$/;
12964
12908
  function buildReporterPlugin(config) {
12965
12909
  const compress = promisify$4(gzip);
12966
12910
  const chunkLimit = config.build.chunkSizeWarningLimit;
12911
+ const numberFormatter = new Intl.NumberFormat('en', {
12912
+ maximumFractionDigits: 2,
12913
+ minimumFractionDigits: 2,
12914
+ });
12915
+ const displaySize = (bytes) => {
12916
+ return `${numberFormatter.format(bytes / 1000)} kB`;
12917
+ };
12967
12918
  const tty = process.stdout.isTTY && !process.env.CI;
12968
12919
  const shouldLogInfo = LogLevels[config.logLevel || 'info'] >= LogLevels.info;
12969
12920
  let hasTransformed = false;
@@ -13047,11 +12998,7 @@ function buildReporterPlugin(config) {
13047
12998
  // dynamic import here.
13048
12999
  const detectedIneffectiveDynamicImport = module.dynamicImporters.some((id) => !isInNodeModules(id) && chunk.moduleIds.includes(id));
13049
13000
  if (detectedIneffectiveDynamicImport) {
13050
- this.warn(`\n(!) ${module.id} is dynamically imported by ${module.dynamicImporters
13051
- .map((m) => m)
13052
- .join(', ')} but also statically imported by ${module.importers
13053
- .map((m) => m)
13054
- .join(', ')}, dynamic import will not move module into another chunk.\n`);
13001
+ this.warn(`\n(!) ${module.id} is dynamically imported by ${module.dynamicImporters.join(', ')} but also statically imported by ${module.importers.join(', ')}, dynamic import will not move module into another chunk.\n`);
13055
13002
  }
13056
13003
  }
13057
13004
  }
@@ -13200,12 +13147,6 @@ function throttle(fn) {
13200
13147
  }, 100);
13201
13148
  };
13202
13149
  }
13203
- function displaySize(bytes) {
13204
- return `${(bytes / 1000).toLocaleString('en', {
13205
- maximumFractionDigits: 2,
13206
- minimumFractionDigits: 2,
13207
- })} kB`;
13208
- }
13209
13150
  function displayTime(time) {
13210
13151
  // display: {X}ms
13211
13152
  if (time < 1000) {
@@ -13875,6 +13816,7 @@ async function transformWithEsbuild(code, filename, options, inMap) {
13875
13816
  }
13876
13817
  }
13877
13818
  let tsconfigRaw = options?.tsconfigRaw;
13819
+ const fallbackSupported = {};
13878
13820
  // if options provide tsconfigRaw in string, it takes highest precedence
13879
13821
  if (typeof tsconfigRaw !== 'string') {
13880
13822
  // these fields would affect the compilation result
@@ -13921,6 +13863,14 @@ async function transformWithEsbuild(code, filename, options, inMap) {
13921
13863
  if (compilerOptions.experimentalDecorators === undefined) {
13922
13864
  compilerOptions.experimentalDecorators = true;
13923
13865
  }
13866
+ // Compat with esbuild 0.17 where static properties are transpiled to
13867
+ // static blocks when `useDefineForClassFields` is false. Its support
13868
+ // is not great yet, so temporarily disable it for now.
13869
+ // TODO: Remove this in Vite 5, don't pass hardcoded `esnext` target
13870
+ // to `transformWithEsbuild` in the esbuild plugin.
13871
+ if (compilerOptions.useDefineForClassFields !== true) {
13872
+ fallbackSupported['class-static-blocks'] = false;
13873
+ }
13924
13874
  // esbuild uses tsconfig fields when both the normal options and tsconfig was set
13925
13875
  // but we want to prioritize the normal options
13926
13876
  if (options) {
@@ -13941,6 +13891,10 @@ async function transformWithEsbuild(code, filename, options, inMap) {
13941
13891
  ...options,
13942
13892
  loader,
13943
13893
  tsconfigRaw,
13894
+ supported: {
13895
+ ...fallbackSupported,
13896
+ ...options?.supported,
13897
+ },
13944
13898
  };
13945
13899
  // Some projects in the ecosystem are calling this function with an ESBuildOptions
13946
13900
  // object and esbuild throws an error for extra fields
@@ -15086,7 +15040,7 @@ class Chunk {
15086
15040
  }
15087
15041
  }
15088
15042
 
15089
- function getBtoa () {
15043
+ function getBtoa() {
15090
15044
  if (typeof window !== 'undefined' && typeof window.btoa === 'function') {
15091
15045
  return (str) => window.btoa(unescape(encodeURIComponent(str)));
15092
15046
  } else if (typeof Buffer === 'function') {
@@ -15199,6 +15153,8 @@ function getLocator(source) {
15199
15153
  };
15200
15154
  }
15201
15155
 
15156
+ const wordRegex = /\w/;
15157
+
15202
15158
  class Mappings {
15203
15159
  constructor(hires) {
15204
15160
  this.hires = hires;
@@ -15227,10 +15183,29 @@ class Mappings {
15227
15183
  addUneditedChunk(sourceIndex, chunk, original, loc, sourcemapLocations) {
15228
15184
  let originalCharIndex = chunk.start;
15229
15185
  let first = true;
15186
+ // when iterating each char, check if it's in a word boundary
15187
+ let charInHiresBoundary = false;
15230
15188
 
15231
15189
  while (originalCharIndex < chunk.end) {
15232
15190
  if (this.hires || first || sourcemapLocations.has(originalCharIndex)) {
15233
- this.rawSegments.push([this.generatedCodeColumn, sourceIndex, loc.line, loc.column]);
15191
+ const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
15192
+
15193
+ if (this.hires === 'boundary') {
15194
+ // in hires "boundary", group segments per word boundary than per char
15195
+ if (wordRegex.test(original[originalCharIndex])) {
15196
+ // for first char in the boundary found, start the boundary by pushing a segment
15197
+ if (!charInHiresBoundary) {
15198
+ this.rawSegments.push(segment);
15199
+ charInHiresBoundary = true;
15200
+ }
15201
+ } else {
15202
+ // for non-word char, end the boundary by pushing a segment
15203
+ this.rawSegments.push(segment);
15204
+ charInHiresBoundary = false;
15205
+ }
15206
+ } else {
15207
+ this.rawSegments.push(segment);
15208
+ }
15234
15209
  }
15235
15210
 
15236
15211
  if (original[originalCharIndex] === '\n') {
@@ -15403,7 +15378,7 @@ class MagicString {
15403
15378
  sourceIndex,
15404
15379
  chunk.content,
15405
15380
  loc,
15406
- chunk.storeName ? names.indexOf(chunk.original) : -1
15381
+ chunk.storeName ? names.indexOf(chunk.original) : -1,
15407
15382
  );
15408
15383
  } else {
15409
15384
  mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sourcemapLocations);
@@ -15414,11 +15389,13 @@ class MagicString {
15414
15389
 
15415
15390
  return {
15416
15391
  file: options.file ? options.file.split(/[/\\]/).pop() : undefined,
15417
- sources: [options.source ? getRelativePath(options.file || '', options.source) : (options.file || '')],
15392
+ sources: [
15393
+ options.source ? getRelativePath(options.file || '', options.source) : options.file || '',
15394
+ ],
15418
15395
  sourcesContent: options.includeContent ? [this.original] : undefined,
15419
15396
  names,
15420
15397
  mappings: mappings.raw,
15421
- x_google_ignoreList: this.ignoreList ? [sourceIndex] : undefined
15398
+ x_google_ignoreList: this.ignoreList ? [sourceIndex] : undefined,
15422
15399
  };
15423
15400
  }
15424
15401
 
@@ -15532,14 +15509,14 @@ class MagicString {
15532
15509
 
15533
15510
  insert() {
15534
15511
  throw new Error(
15535
- 'magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)'
15512
+ 'magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)',
15536
15513
  );
15537
15514
  }
15538
15515
 
15539
15516
  insertLeft(index, content) {
15540
15517
  if (!warned.insertLeft) {
15541
15518
  console.warn(
15542
- 'magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead'
15519
+ 'magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead',
15543
15520
  ); // eslint-disable-line no-console
15544
15521
  warned.insertLeft = true;
15545
15522
  }
@@ -15550,7 +15527,7 @@ class MagicString {
15550
15527
  insertRight(index, content) {
15551
15528
  if (!warned.insertRight) {
15552
15529
  console.warn(
15553
- 'magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead'
15530
+ 'magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead',
15554
15531
  ); // eslint-disable-line no-console
15555
15532
  warned.insertRight = true;
15556
15533
  }
@@ -15609,7 +15586,7 @@ class MagicString {
15609
15586
  if (end > this.original.length) throw new Error('end is out of bounds');
15610
15587
  if (start === end)
15611
15588
  throw new Error(
15612
- 'Cannot overwrite a zero-length range – use appendLeft or prependRight instead'
15589
+ 'Cannot overwrite a zero-length range – use appendLeft or prependRight instead',
15613
15590
  );
15614
15591
 
15615
15592
  this._split(start);
@@ -15618,7 +15595,7 @@ class MagicString {
15618
15595
  if (options === true) {
15619
15596
  if (!warned.storeName) {
15620
15597
  console.warn(
15621
- 'The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string'
15598
+ 'The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string',
15622
15599
  ); // eslint-disable-line no-console
15623
15600
  warned.storeName = true;
15624
15601
  }
@@ -15840,7 +15817,7 @@ class MagicString {
15840
15817
  // zero-length edited chunks are a special case (overlapping replacements)
15841
15818
  const loc = getLocator(this.original)(index);
15842
15819
  throw new Error(
15843
- `Cannot split a chunk that has already been edited (${loc.line}:${loc.column} – "${chunk.original}")`
15820
+ `Cannot split a chunk that has already been edited (${loc.line}:${loc.column} – "${chunk.original}")`,
15844
15821
  );
15845
15822
  }
15846
15823
 
@@ -15999,7 +15976,7 @@ class MagicString {
15999
15976
  this.overwrite(
16000
15977
  match.index,
16001
15978
  match.index + match[0].length,
16002
- getReplacement(match, this.original)
15979
+ getReplacement(match, this.original),
16003
15980
  );
16004
15981
  });
16005
15982
  } else {
@@ -16008,7 +15985,7 @@ class MagicString {
16008
15985
  this.overwrite(
16009
15986
  match.index,
16010
15987
  match.index + match[0].length,
16011
- getReplacement(match, this.original)
15988
+ getReplacement(match, this.original),
16012
15989
  );
16013
15990
  }
16014
15991
  return this;
@@ -16054,7 +16031,7 @@ class MagicString {
16054
16031
 
16055
16032
  if (!searchValue.global) {
16056
16033
  throw new TypeError(
16057
- 'MagicString.prototype.replaceAll called with a non-global RegExp argument'
16034
+ 'MagicString.prototype.replaceAll called with a non-global RegExp argument',
16058
16035
  );
16059
16036
  }
16060
16037
 
@@ -16165,7 +16142,9 @@ function assetPlugin(config) {
16165
16142
  if (s) {
16166
16143
  return {
16167
16144
  code: s.toString(),
16168
- map: config.build.sourcemap ? s.generateMap({ hires: true }) : null,
16145
+ map: config.build.sourcemap
16146
+ ? s.generateMap({ hires: 'boundary' })
16147
+ : null,
16169
16148
  };
16170
16149
  }
16171
16150
  else {
@@ -37696,12 +37675,14 @@ function buildHtmlPlugin(config) {
37696
37675
  processedHtml.set(id, s.toString());
37697
37676
  // inject module preload polyfill only when configured and needed
37698
37677
  const { modulePreload } = config.build;
37699
- if ((modulePreload === true ||
37700
- (typeof modulePreload === 'object' && modulePreload.polyfill)) &&
37678
+ if (modulePreload !== false &&
37679
+ modulePreload.polyfill &&
37701
37680
  (someScriptsAreAsync || someScriptsAreDefer)) {
37702
37681
  js = `import "${modulePreloadPolyfillId}";\n${js}`;
37703
37682
  }
37704
- return js;
37683
+ // Force rollup to keep this module from being shared between other entry points.
37684
+ // If the resulting chunk is empty, it will be removed in generateBundle.
37685
+ return { code: js, moduleSideEffects: 'no-treeshake' };
37705
37686
  }
37706
37687
  },
37707
37688
  async generateBundle(options, bundle) {
@@ -38545,7 +38526,7 @@ function cssPostPlugin(config) {
38545
38526
  // resolve public URL from CSS paths, we need to use absolute paths
38546
38527
  return {
38547
38528
  code: s.toString(),
38548
- map: s.generateMap({ hires: true }),
38529
+ map: s.generateMap({ hires: 'boundary' }),
38549
38530
  };
38550
38531
  }
38551
38532
  else {
@@ -38931,8 +38912,8 @@ function createCachedImport(imp) {
38931
38912
  return cached;
38932
38913
  };
38933
38914
  }
38934
- const importPostcssImport = createCachedImport(() => import('./dep-ebfb454b.js').then(function (n) { return n.i; }));
38935
- const importPostcssModules = createCachedImport(() => import('./dep-bcdce950.js').then(function (n) { return n.i; }));
38915
+ const importPostcssImport = createCachedImport(() => import('./dep-d502c17d.js').then(function (n) { return n.i; }));
38916
+ const importPostcssModules = createCachedImport(() => import('./dep-def3b363.js').then(function (n) { return n.i; }));
38936
38917
  const importPostcss = createCachedImport(() => import('postcss'));
38937
38918
  /**
38938
38919
  * @experimental
@@ -39237,7 +39218,8 @@ function loadPreprocessor(lang, root) {
39237
39218
  }
39238
39219
  catch (e) {
39239
39220
  if (e.code === 'MODULE_NOT_FOUND') {
39240
- throw new Error(`Preprocessor dependency "${lang}" not found. Did you install it?`);
39221
+ const installCommand = getPackageManagerCommand('install');
39222
+ throw new Error(`Preprocessor dependency "${lang}" not found. Did you install it? Try \`${installCommand} -D ${lang}\`.`);
39241
39223
  }
39242
39224
  else {
39243
39225
  const message = new Error(`Preprocessor dependency "${lang}" failed to load:\n${e.message}`);
@@ -39561,7 +39543,7 @@ async function getSource(source, filename, additionalData, enableSourcemap, sep
39561
39543
  const ms = new MagicString(source);
39562
39544
  ms.appendLeft(0, sep);
39563
39545
  ms.appendLeft(0, additionalData);
39564
- const map = ms.generateMap({ hires: true });
39546
+ const map = ms.generateMap({ hires: 'boundary' });
39565
39547
  map.file = filename;
39566
39548
  map.sources = [filename];
39567
39549
  return {
@@ -40753,7 +40735,9 @@ const { isMatch: isMatch$1, scan } = micromatch$2;
40753
40735
  function getAffectedGlobModules(file, server) {
40754
40736
  const modules = [];
40755
40737
  for (const [id, allGlobs] of server._importGlobMap) {
40756
- if (allGlobs.some((glob) => isMatch$1(file, glob)))
40738
+ // (glob1 || glob2) && !glob3 && !glob4...
40739
+ if (allGlobs.some(({ affirmed, negated }) => (!affirmed.length || affirmed.some((glob) => isMatch$1(file, glob))) &&
40740
+ (!negated.length || negated.every((glob) => isMatch$1(file, glob)))))
40757
40741
  modules.push(...(server.moduleGraph.getModulesByFile(id) || []));
40758
40742
  }
40759
40743
  modules.forEach((i) => {
@@ -40777,7 +40761,14 @@ function importGlobPlugin(config) {
40777
40761
  if (result) {
40778
40762
  if (server) {
40779
40763
  const allGlobs = result.matches.map((i) => i.globsResolved);
40780
- server._importGlobMap.set(id, allGlobs);
40764
+ server._importGlobMap.set(id, allGlobs.map((globs) => {
40765
+ const affirmed = [];
40766
+ const negated = [];
40767
+ for (const glob of globs) {
40768
+ (glob[0] === '!' ? negated : affirmed).push(glob);
40769
+ }
40770
+ return { affirmed, negated };
40771
+ }));
40781
40772
  }
40782
40773
  return transformStableResult(result.s, id, config);
40783
40774
  }
@@ -41132,7 +41123,7 @@ async function toAbsoluteGlob(glob, root, importer, resolveId) {
41132
41123
  return pre + posix$1.join(dir, glob);
41133
41124
  if (glob.startsWith('**'))
41134
41125
  return pre + glob;
41135
- const isSubImportsPattern = glob.startsWith('#') && glob.includes('*');
41126
+ const isSubImportsPattern = glob[0] === '#' && glob.includes('*');
41136
41127
  const resolved = normalizePath$3((await resolveId(glob, importer, {
41137
41128
  custom: { 'vite:import-glob': { isSubImportsPattern } },
41138
41129
  })) || glob);
@@ -41926,7 +41917,9 @@ function importAnalysisPlugin(config) {
41926
41917
  }
41927
41918
  }
41928
41919
  // record as safe modules
41929
- server?.moduleGraph.safeModulesPath.add(fsPathFromUrl(url));
41920
+ // safeModulesPath should not include the base prefix.
41921
+ // See https://github.com/vitejs/vite/issues/9438#issuecomment-1465270409
41922
+ server?.moduleGraph.safeModulesPath.add(fsPathFromUrl(stripBase(url, base)));
41930
41923
  if (url !== specifier) {
41931
41924
  let rewriteDone = false;
41932
41925
  if (depsOptimizer?.isOptimizedDepFile(resolvedId) &&
@@ -42648,7 +42641,9 @@ function webWorkerPlugin(config) {
42648
42641
  const result = () => {
42649
42642
  return (s && {
42650
42643
  code: s.toString(),
42651
- map: config.build.sourcemap ? s.generateMap({ hires: true }) : null,
42644
+ map: config.build.sourcemap
42645
+ ? s.generateMap({ hires: 'boundary' })
42646
+ : null,
42652
42647
  });
42653
42648
  };
42654
42649
  if (code.match(workerAssetUrlRE)) {
@@ -43132,7 +43127,7 @@ function assetImportMetaUrlPlugin(config) {
43132
43127
  preferRelative: true,
43133
43128
  }));
43134
43129
  file = await assetResolver(url, id);
43135
- file ?? (file = url.startsWith('/')
43130
+ file ?? (file = url[0] === '/'
43136
43131
  ? slash$1(path$o.join(config.publicDir, url))
43137
43132
  : slash$1(path$o.resolve(path$o.dirname(id), url)));
43138
43133
  }
@@ -43531,8 +43526,7 @@ async function resolvePlugins(config, prePlugins, normalPlugins, postPlugins) {
43531
43526
  preAliasPlugin(config),
43532
43527
  alias$1({ entries: config.resolve.alias }),
43533
43528
  ...prePlugins,
43534
- modulePreload === true ||
43535
- (typeof modulePreload === 'object' && modulePreload.polyfill)
43529
+ modulePreload !== false && modulePreload.polyfill
43536
43530
  ? modulePreloadPolyfillPlugin(config)
43537
43531
  : null,
43538
43532
  resolvePlugin({
@@ -44090,7 +44084,7 @@ async function createPluginContainer(config, moduleGraph, watcher) {
44090
44084
  return createIfNull
44091
44085
  ? new MagicString(this.originalCode).generateMap({
44092
44086
  includeContent: true,
44093
- hires: true,
44087
+ hires: 'boundary',
44094
44088
  source: cleanUrl(this.filename),
44095
44089
  })
44096
44090
  : null;
@@ -44428,15 +44422,7 @@ async function prepareEsbuildScanner(config, entries, deps, missing, scanContext
44428
44422
  logLevel: 'silent',
44429
44423
  plugins: [...plugins, plugin],
44430
44424
  tsconfig,
44431
- tsconfigRaw: tsconfig || typeof tsconfigRaw === 'string'
44432
- ? tsconfigRaw
44433
- : {
44434
- ...tsconfigRaw,
44435
- compilerOptions: {
44436
- experimentalDecorators: true,
44437
- ...tsconfigRaw?.compilerOptions,
44438
- },
44439
- },
44425
+ tsconfigRaw: resolveTsconfigRaw(tsconfig, tsconfigRaw),
44440
44426
  ...esbuildOptions,
44441
44427
  });
44442
44428
  }
@@ -44787,6 +44773,21 @@ function shouldExternalizeDep(resolvedId, rawId) {
44787
44773
  function isScannable(id) {
44788
44774
  return JS_TYPES_RE.test(id) || htmlTypesRE.test(id);
44789
44775
  }
44776
+ // esbuild v0.18 only transforms decorators when `experimentalDecorators` is set to `true`.
44777
+ // To preserve compat with the esbuild breaking change, we set `experimentalDecorators` to
44778
+ // `true` by default if it's unset.
44779
+ // TODO: Remove this in Vite 5 and check https://github.com/vitejs/vite/pull/13805#issuecomment-1633612320
44780
+ function resolveTsconfigRaw(tsconfig, tsconfigRaw) {
44781
+ return tsconfig || typeof tsconfigRaw === 'string'
44782
+ ? tsconfigRaw
44783
+ : {
44784
+ ...tsconfigRaw,
44785
+ compilerOptions: {
44786
+ experimentalDecorators: true,
44787
+ ...tsconfigRaw?.compilerOptions,
44788
+ },
44789
+ };
44790
+ }
44790
44791
 
44791
44792
  function createOptimizeDepsIncludeResolver(config, ssr) {
44792
44793
  const resolve = config.createResolver({
@@ -45366,7 +45367,7 @@ async function createDepsOptimizer(config, server) {
45366
45367
  // Await for the scan+optimize step running in the background
45367
45368
  // It normally should be over by the time crawling of user code ended
45368
45369
  await depsOptimizer.scanProcessing;
45369
- if (!isBuild && optimizationResult) {
45370
+ if (!isBuild && optimizationResult && !config.optimizeDeps.noDiscovery) {
45370
45371
  const result = await optimizationResult.result;
45371
45372
  optimizationResult = undefined;
45372
45373
  currentlyProcessing = false;
@@ -45864,7 +45865,7 @@ async function prepareEsbuildOptimizerRun(resolvedConfig, depsInfo, ssr, process
45864
45865
  const flatIdDeps = {};
45865
45866
  const idToExports = {};
45866
45867
  const optimizeDeps = getDepOptimizationConfig(config, ssr);
45867
- const { plugins: pluginsFromConfig = [], ...esbuildOptions } = optimizeDeps?.esbuildOptions ?? {};
45868
+ const { plugins: pluginsFromConfig = [], tsconfig, tsconfigRaw, ...esbuildOptions } = optimizeDeps?.esbuildOptions ?? {};
45868
45869
  await Promise.all(Object.keys(depsInfo).map(async (id) => {
45869
45870
  const src = depsInfo[id].src;
45870
45871
  const exportsData = await (depsInfo[id].exportsData ??
@@ -45940,6 +45941,8 @@ async function prepareEsbuildOptimizerRun(resolvedConfig, depsInfo, ssr, process
45940
45941
  metafile: true,
45941
45942
  plugins,
45942
45943
  charset: 'utf8',
45944
+ tsconfig,
45945
+ tsconfigRaw: resolveTsconfigRaw(tsconfig, tsconfigRaw),
45943
45946
  ...esbuildOptions,
45944
45947
  supported: {
45945
45948
  'dynamic-import': true,
@@ -46474,10 +46477,7 @@ function preload(baseModule, deps, importerUrl) {
46474
46477
  function buildImportAnalysisPlugin(config) {
46475
46478
  const ssr = !!config.build.ssr;
46476
46479
  const isWorker = config.isWorker;
46477
- const insertPreload = !(ssr ||
46478
- !!config.build.lib ||
46479
- isWorker ||
46480
- config.build.modulePreload === false);
46480
+ const insertPreload = !(ssr || !!config.build.lib || isWorker);
46481
46481
  const resolveModulePreloadDependencies = config.build.modulePreload && config.build.modulePreload.resolveDependencies;
46482
46482
  const renderBuiltUrl = config.experimental.renderBuiltUrl;
46483
46483
  const customModulePreloadPaths = !!(resolveModulePreloadDependencies || renderBuiltUrl);
@@ -46659,7 +46659,9 @@ function buildImportAnalysisPlugin(config) {
46659
46659
  if (s) {
46660
46660
  return {
46661
46661
  code: s.toString(),
46662
- map: config.build.sourcemap ? s.generateMap({ hires: true }) : null,
46662
+ map: config.build.sourcemap
46663
+ ? s.generateMap({ hires: 'boundary' })
46664
+ : null,
46663
46665
  };
46664
46666
  }
46665
46667
  },
@@ -46676,7 +46678,7 @@ function buildImportAnalysisPlugin(config) {
46676
46678
  }
46677
46679
  return {
46678
46680
  code: s.toString(),
46679
- map: s.generateMap({ hires: true }),
46681
+ map: s.generateMap({ hires: 'boundary' }),
46680
46682
  };
46681
46683
  }
46682
46684
  else {
@@ -46686,10 +46688,7 @@ function buildImportAnalysisPlugin(config) {
46686
46688
  return null;
46687
46689
  },
46688
46690
  generateBundle({ format }, bundle) {
46689
- if (format !== 'es' ||
46690
- ssr ||
46691
- isWorker ||
46692
- config.build.modulePreload === false) {
46691
+ if (format !== 'es' || ssr || isWorker) {
46693
46692
  return;
46694
46693
  }
46695
46694
  for (const file in bundle) {
@@ -46777,12 +46776,18 @@ function buildImportAnalysisPlugin(config) {
46777
46776
  const depsArray = deps.size > 1 ||
46778
46777
  // main chunk is removed
46779
46778
  (hasRemovedPureCssChunk && deps.size > 0)
46780
- ? [...deps]
46779
+ ? modulePreload === false
46780
+ ? // CSS deps use the same mechanism as module preloads, so even if disabled,
46781
+ // we still need to pass these deps to the preload helper in dynamic imports.
46782
+ [...deps].filter((d) => d.endsWith('.css'))
46783
+ : [...deps]
46781
46784
  : [];
46782
46785
  let renderedDeps;
46783
46786
  if (normalizedFile && customModulePreloadPaths) {
46784
46787
  const { modulePreload } = config.build;
46785
- const resolveDependencies = modulePreload && modulePreload.resolveDependencies;
46788
+ const resolveDependencies = modulePreload
46789
+ ? modulePreload.resolveDependencies
46790
+ : undefined;
46786
46791
  let resolvedDeps;
46787
46792
  if (resolveDependencies) {
46788
46793
  // We can't let the user remove css deps as these aren't really preloads, they are just using
@@ -46838,7 +46843,7 @@ function buildImportAnalysisPlugin(config) {
46838
46843
  if (config.build.sourcemap && chunk.map) {
46839
46844
  const nextMap = s.generateMap({
46840
46845
  source: chunk.fileName,
46841
- hires: true,
46846
+ hires: 'boundary',
46842
46847
  });
46843
46848
  const map = combineSourcemaps(chunk.fileName, [
46844
46849
  nextMap,
@@ -47545,7 +47550,7 @@ function serveStaticMiddleware(dir, server) {
47545
47550
  isInternalRequest(req.url)) {
47546
47551
  return next();
47547
47552
  }
47548
- const url = new URL(req.url.replace(/^\/+/, '/'), 'http://example.com');
47553
+ const url = new URL(req.url.replace(/^\/{2,}/, '/'), 'http://example.com');
47549
47554
  const pathname = decodeURI(url.pathname);
47550
47555
  // apply aliases to static requests as well
47551
47556
  let redirectedPathname;
@@ -47584,7 +47589,7 @@ function serveRawFsMiddleware(server) {
47584
47589
  const serveFromRoot = sirv('/', sirvOptions({ headers: server.config.server.headers }));
47585
47590
  // Keep the named function. The name is visible in debug logs via `DEBUG=connect:dispatcher ...`
47586
47591
  return function viteServeRawFsMiddleware(req, res, next) {
47587
- const url = new URL(req.url.replace(/^\/+/, '/'), 'http://example.com');
47592
+ const url = new URL(req.url.replace(/^\/{2,}/, '/'), 'http://example.com');
47588
47593
  // In some cases (e.g. linked monorepos) files outside of root will
47589
47594
  // reference assets that are also out of served root. In such cases
47590
47595
  // the paths are rewritten to `/@fs/` prefixed paths and must be served by
@@ -55445,7 +55450,7 @@ async function ssrTransformScript(code, inMap, url, originalCode) {
55445
55450
  }
55446
55451
  },
55447
55452
  });
55448
- let map = s.generateMap({ hires: true });
55453
+ let map = s.generateMap({ hires: 'boundary' });
55449
55454
  if (inMap && inMap.mappings && inMap.sources.length > 0) {
55450
55455
  map = combineSourcemaps(url, [
55451
55456
  {
@@ -64459,7 +64464,7 @@ const devHtmlHook = async (html, { path: htmlPath, filename, server, originalUrl
64459
64464
  if (proxyModulePath[0] !== '\0') {
64460
64465
  map = new MagicString(html)
64461
64466
  .snip(contentNode.sourceCodeLocation.startOffset, contentNode.sourceCodeLocation.endOffset)
64462
- .generateMap({ hires: true });
64467
+ .generateMap({ hires: 'boundary' });
64463
64468
  map.sources = [filename];
64464
64469
  map.file = filename;
64465
64470
  }
@@ -1,4 +1,4 @@
1
- import { E as getDefaultExportFromCjs } from './dep-3b8eb186.js';
1
+ import { E as getDefaultExportFromCjs } from './dep-75f53616.js';
2
2
  import require$$0 from 'path';
3
3
  import require$$0__default from 'fs';
4
4
  import { l as lib } from './dep-c423598f.js';
@@ -1,4 +1,4 @@
1
- import { F as commonjsGlobal, E as getDefaultExportFromCjs } from './dep-3b8eb186.js';
1
+ import { F as commonjsGlobal, E as getDefaultExportFromCjs } from './dep-75f53616.js';
2
2
  import require$$0__default from 'fs';
3
3
  import require$$0 from 'postcss';
4
4
  import require$$0$1 from 'path';
package/dist/node/cli.js CHANGED
@@ -2,7 +2,7 @@ import path from 'node:path';
2
2
  import fs from 'node:fs';
3
3
  import { performance } from 'node:perf_hooks';
4
4
  import { EventEmitter } from 'events';
5
- import { C as colors, D as bindShortcuts, x as createLogger, h as resolveConfig } from './chunks/dep-3b8eb186.js';
5
+ import { C as colors, D as bindShortcuts, x as createLogger, h as resolveConfig } from './chunks/dep-75f53616.js';
6
6
  import { VERSION } from './constants.js';
7
7
  import 'node:fs/promises';
8
8
  import 'node:url';
@@ -738,7 +738,7 @@ cli
738
738
  filterDuplicateOptions(options);
739
739
  // output structure is preserved even after bundling so require()
740
740
  // is ok here
741
- const { createServer } = await import('./chunks/dep-3b8eb186.js').then(function (n) { return n.I; });
741
+ const { createServer } = await import('./chunks/dep-75f53616.js').then(function (n) { return n.I; });
742
742
  try {
743
743
  const server = await createServer({
744
744
  root,
@@ -816,7 +816,7 @@ cli
816
816
  .option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
817
817
  .action(async (root, options) => {
818
818
  filterDuplicateOptions(options);
819
- const { build } = await import('./chunks/dep-3b8eb186.js').then(function (n) { return n.H; });
819
+ const { build } = await import('./chunks/dep-75f53616.js').then(function (n) { return n.H; });
820
820
  const buildOptions = cleanOptions(options);
821
821
  try {
822
822
  await build({
@@ -844,7 +844,7 @@ cli
844
844
  .option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
845
845
  .action(async (root, options) => {
846
846
  filterDuplicateOptions(options);
847
- const { optimizeDeps } = await import('./chunks/dep-3b8eb186.js').then(function (n) { return n.G; });
847
+ const { optimizeDeps } = await import('./chunks/dep-75f53616.js').then(function (n) { return n.G; });
848
848
  try {
849
849
  const config = await resolveConfig({
850
850
  root,
@@ -871,7 +871,7 @@ cli
871
871
  .option('--outDir <dir>', `[string] output directory (default: dist)`)
872
872
  .action(async (root, options) => {
873
873
  filterDuplicateOptions(options);
874
- const { preview } = await import('./chunks/dep-3b8eb186.js').then(function (n) { return n.J; });
874
+ const { preview } = await import('./chunks/dep-75f53616.js').then(function (n) { return n.J; });
875
875
  try {
876
876
  const server = await preview({
877
877
  root,
@@ -2,36 +2,36 @@
2
2
 
3
3
  import type { Agent } from 'node:http';
4
4
  import type { BuildOptions as BuildOptions_2 } from 'esbuild';
5
- import { ChunkMetadata } from "../../types/metadata";
5
+ import { ChunkMetadata } from "../../types/metadata.js";
6
6
  import type { ClientRequest } from 'node:http';
7
7
  import type { ClientRequestArgs } from 'node:http';
8
- import { ConnectedPayload } from "../../types/hmrPayload";
9
- import { CustomEventMap } from "../../types/customEvent";
10
- import { CustomPayload } from "../../types/hmrPayload";
8
+ import { ConnectedPayload } from "../../types/hmrPayload.js";
9
+ import { CustomEventMap } from "../../types/customEvent.js";
10
+ import { CustomPayload } from "../../types/hmrPayload.js";
11
11
  import type { CustomPluginOptions } from 'rollup';
12
12
  import type { Duplex } from 'node:stream';
13
13
  import type { DuplexOptions } from 'node:stream';
14
- import { ErrorPayload } from "../../types/hmrPayload";
14
+ import { ErrorPayload } from "../../types/hmrPayload.js";
15
15
  import { TransformOptions as EsbuildTransformOptions } from 'esbuild';
16
16
  import { version as esbuildVersion } from 'esbuild';
17
17
  import { EventEmitter } from 'node:events';
18
18
  import * as events from 'node:events';
19
19
  import type { ExistingRawSourceMap } from 'rollup';
20
20
  import type * as fs from 'node:fs';
21
- import { FullReloadPayload } from "../../types/hmrPayload";
22
- import { GeneralImportGlobOptions } from "../../types/importGlob";
21
+ import { FullReloadPayload } from "../../types/hmrPayload.js";
22
+ import { GeneralImportGlobOptions } from "../../types/importGlob.js";
23
23
  import type { GetManualChunk } from 'rollup';
24
- import { HMRPayload } from "../../types/hmrPayload";
24
+ import { HMRPayload } from "../../types/hmrPayload.js";
25
25
  import * as http from 'node:http';
26
- import { ImportGlobEagerFunction } from "../../types/importGlob";
27
- import { ImportGlobFunction } from "../../types/importGlob";
28
- import { ImportGlobOptions } from "../../types/importGlob";
26
+ import { ImportGlobEagerFunction } from "../../types/importGlob.js";
27
+ import { ImportGlobFunction } from "../../types/importGlob.js";
28
+ import { ImportGlobOptions } from "../../types/importGlob.js";
29
29
  import type { IncomingMessage } from 'node:http';
30
- import { InferCustomEventPayload } from "../../types/customEvent";
30
+ import { InferCustomEventPayload } from "../../types/customEvent.js";
31
31
  import type { InputOption } from 'rollup';
32
32
  import type { InputOptions } from 'rollup';
33
- import { InvalidatePayload } from "../../types/customEvent";
34
- import { KnownAsTypeMap } from "../../types/importGlob";
33
+ import { InvalidatePayload } from "../../types/customEvent.js";
34
+ import { KnownAsTypeMap } from "../../types/importGlob.js";
35
35
  import type { LoadResult } from 'rollup';
36
36
 
37
37
  import type { ModuleFormat } from 'rollup';
@@ -46,7 +46,7 @@ import type { Plugin as Plugin_3 } from 'rollup';
46
46
  import type { PluginContext } from 'rollup';
47
47
  import type { PluginHooks } from 'rollup';
48
48
  import type * as PostCSS from 'postcss';
49
- import { PrunePayload } from "../../types/hmrPayload";
49
+ import { PrunePayload } from "../../types/hmrPayload.js";
50
50
  import type { ResolveIdResult } from 'rollup';
51
51
  import type * as Rollup from 'rollup';
52
52
  import type { RollupError } from 'rollup';
@@ -66,8 +66,8 @@ import type * as stream from 'node:stream';
66
66
  import type { TransformPluginContext } from 'rollup';
67
67
  import type { TransformResult as TransformResult_2 } from 'rollup';
68
68
  import type { TransformResult as TransformResult_3 } from 'esbuild';
69
- import { Update } from "../../types/hmrPayload";
70
- import { UpdatePayload } from "../../types/hmrPayload";
69
+ import { Update } from "../../types/hmrPayload.js";
70
+ import { UpdatePayload } from "../../types/hmrPayload.js";
71
71
  import type * as url from 'node:url';
72
72
  import type { URL as URL_2 } from 'node:url';
73
73
  import type { WatcherOptions } from 'rollup';
@@ -574,6 +574,8 @@ export declare function defineConfig(config: UserConfig): UserConfig;
574
574
 
575
575
  export declare function defineConfig(config: Promise<UserConfig>): Promise<UserConfig>;
576
576
 
577
+ export declare function defineConfig(config: UserConfigFnObject): UserConfigFnObject;
578
+
577
579
  export declare function defineConfig(config: UserConfigExport): UserConfigExport;
578
580
 
579
581
  export declare interface DepOptimizationConfig {
@@ -1783,7 +1785,7 @@ export declare interface ResolvedBuildOptions extends Required<Omit<BuildOptions
1783
1785
  modulePreload: false | ResolvedModulePreloadOptions;
1784
1786
  }
1785
1787
 
1786
- export declare type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'css' | 'assetsInclude' | 'optimizeDeps' | 'worker'> & {
1788
+ export declare type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'css' | 'assetsInclude' | 'optimizeDeps' | 'worker' | 'build'> & {
1787
1789
  configFile: string | undefined;
1788
1790
  configFileDependencies: string[];
1789
1791
  inlineConfig: InlineConfig;
@@ -1,5 +1,5 @@
1
- import { i as isInNodeModules } from './chunks/dep-3b8eb186.js';
2
- export { b as build, e as buildErrorMessage, v as createFilter, x as createLogger, c as createServer, g as defineConfig, f as formatPostcssSourceMap, k as getDepOptimizationConfig, m as isDepsOptimizerEnabled, z as isFileServingAllowed, l as loadConfigFromFile, A as loadEnv, u as mergeAlias, q as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, j as resolveBaseUrl, h as resolveConfig, B as resolveEnvPrefix, d as resolvePackageData, r as resolvePackageEntry, y as searchForWorkspaceRoot, w as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-3b8eb186.js';
1
+ import { i as isInNodeModules } from './chunks/dep-75f53616.js';
2
+ export { b as build, e as buildErrorMessage, v as createFilter, x as createLogger, c as createServer, g as defineConfig, f as formatPostcssSourceMap, k as getDepOptimizationConfig, m as isDepsOptimizerEnabled, z as isFileServingAllowed, l as loadConfigFromFile, A as loadEnv, u as mergeAlias, q as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, j as resolveBaseUrl, h as resolveConfig, B as resolveEnvPrefix, d as resolvePackageData, r as resolvePackageEntry, y as searchForWorkspaceRoot, w as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-75f53616.js';
3
3
  export { VERSION as version } from './constants.js';
4
4
  export { version as esbuildVersion } from 'esbuild';
5
5
  export { VERSION as rollupVersion } from 'rollup';
@@ -3825,6 +3825,11 @@ function createLogger(level = 'info', options = {}) {
3825
3825
  if (options.customLogger) {
3826
3826
  return options.customLogger;
3827
3827
  }
3828
+ const timeFormatter = new Intl.DateTimeFormat(undefined, {
3829
+ hour: 'numeric',
3830
+ minute: 'numeric',
3831
+ second: 'numeric',
3832
+ });
3828
3833
  const loggedErrors = new WeakSet();
3829
3834
  const { prefix = '[vite]', allowClearScreen = true } = options;
3830
3835
  const thresh = LogLevels[level];
@@ -3840,7 +3845,7 @@ function createLogger(level = 'info', options = {}) {
3840
3845
  : type === 'warn'
3841
3846
  ? colors.yellow(colors.bold(prefix))
3842
3847
  : colors.red(colors.bold(prefix));
3843
- return `${colors.dim(new Date().toLocaleTimeString())} ${tag} ${msg}`;
3848
+ return `${colors.dim(timeFormatter.format(new Date()))} ${tag} ${msg}`;
3844
3849
  }
3845
3850
  else {
3846
3851
  return msg;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "4.4.7",
3
+ "version": "4.4.8",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -86,8 +86,8 @@
86
86
  "@rollup/plugin-node-resolve": "15.1.0",
87
87
  "@rollup/plugin-typescript": "^11.1.2",
88
88
  "@rollup/pluginutils": "^5.0.2",
89
- "@types/pnpapi": "^0.0.2",
90
89
  "@types/escape-html": "^1.0.2",
90
+ "@types/pnpapi": "^0.0.2",
91
91
  "acorn": "^8.10.0",
92
92
  "acorn-walk": "^8.2.0",
93
93
  "cac": "^6.7.14",
@@ -110,7 +110,7 @@
110
110
  "json-stable-stringify": "^1.0.2",
111
111
  "launch-editor-middleware": "^2.6.0",
112
112
  "lightningcss": "^1.21.5",
113
- "magic-string": "^0.30.1",
113
+ "magic-string": "^0.30.2",
114
114
  "micromatch": "^4.0.5",
115
115
  "mlly": "^1.4.0",
116
116
  "mrmime": "^1.0.1",
@@ -138,10 +138,10 @@
138
138
  "peerDependencies": {
139
139
  "@types/node": ">= 14",
140
140
  "less": "*",
141
+ "lightningcss": "^1.21.0",
141
142
  "sass": "*",
142
143
  "stylus": "*",
143
144
  "sugarss": "*",
144
- "lightningcss": "^1.21.0",
145
145
  "terser": "^5.4.0"
146
146
  },
147
147
  "peerDependenciesMeta": {