vite 3.0.3 → 3.0.4

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,5 +1,5 @@
1
1
  import require$$0$1 from 'postcss';
2
- import { z as commonjsGlobal } from './dep-c6273c7a.js';
2
+ import { z as commonjsGlobal } from './dep-71eb12cb.js';
3
3
  import require$$0 from 'path';
4
4
  import require$$5 from 'crypto';
5
5
  import require$$0__default from 'fs';
@@ -27484,10 +27484,10 @@ function getLineInfo(input, offset) {
27484
27484
  var defaultOptions = {
27485
27485
  // `ecmaVersion` indicates the ECMAScript version to parse. Must be
27486
27486
  // either 3, 5, 6 (or 2015), 7 (2016), 8 (2017), 9 (2018), 10
27487
- // (2019), 11 (2020), 12 (2021), 13 (2022), or `"latest"` (the
27488
- // latest version the library supports). This influences support
27489
- // for strict mode, the set of reserved words, and support for
27490
- // new syntax features.
27487
+ // (2019), 11 (2020), 12 (2021), 13 (2022), 14 (2023), or `"latest"`
27488
+ // (the latest version the library supports). This influences
27489
+ // support for strict mode, the set of reserved words, and support
27490
+ // for new syntax features.
27491
27491
  ecmaVersion: null,
27492
27492
  // `sourceType` indicates the mode the code should be parsed in.
27493
27493
  // Can be either `"script"` or `"module"`. This influences global
@@ -27521,8 +27521,9 @@ var defaultOptions = {
27521
27521
  // When enabled, super identifiers are not constrained to
27522
27522
  // appearing in methods and do not raise an error when they appear elsewhere.
27523
27523
  allowSuperOutsideMethod: null,
27524
- // When enabled, hashbang directive in the beginning of file
27525
- // is allowed and treated as a line comment.
27524
+ // When enabled, hashbang directive in the beginning of file is
27525
+ // allowed and treated as a line comment. Enabled by default when
27526
+ // `ecmaVersion` >= 2023.
27526
27527
  allowHashBang: false,
27527
27528
  // When `locations` is on, `loc` properties holding objects with
27528
27529
  // `start` and `end` properties in `{line, column}` form (with
@@ -27597,6 +27598,9 @@ function getOptions(opts) {
27597
27598
  if (options.allowReserved == null)
27598
27599
  { options.allowReserved = options.ecmaVersion < 5; }
27599
27600
 
27601
+ if (opts.allowHashBang == null)
27602
+ { options.allowHashBang = options.ecmaVersion >= 14; }
27603
+
27600
27604
  if (isArray(options.onToken)) {
27601
27605
  var tokens = options.onToken;
27602
27606
  options.onToken = function (token) { return tokens.push(token); };
@@ -27927,7 +27931,7 @@ pp$9.checkPatternErrors = function(refDestructuringErrors, isAssign) {
27927
27931
  if (refDestructuringErrors.trailingComma > -1)
27928
27932
  { this.raiseRecoverable(refDestructuringErrors.trailingComma, "Comma is not permitted after the rest element"); }
27929
27933
  var parens = isAssign ? refDestructuringErrors.parenthesizedAssign : refDestructuringErrors.parenthesizedBind;
27930
- if (parens > -1) { this.raiseRecoverable(parens, "Parenthesized pattern"); }
27934
+ if (parens > -1) { this.raiseRecoverable(parens, isAssign ? "Assigning to rvalue" : "Parenthesized pattern"); }
27931
27935
  };
27932
27936
 
27933
27937
  pp$9.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
@@ -29023,6 +29027,7 @@ pp$8.adaptDirectivePrologue = function(statements) {
29023
29027
  };
29024
29028
  pp$8.isDirectiveCandidate = function(statement) {
29025
29029
  return (
29030
+ this.options.ecmaVersion >= 5 &&
29026
29031
  statement.type === "ExpressionStatement" &&
29027
29032
  statement.expression.type === "Literal" &&
29028
29033
  typeof statement.expression.value === "string" &&
@@ -29433,7 +29438,8 @@ pp$6.updateContext = function(prevType) {
29433
29438
  { this.exprAllowed = type.beforeExpr; }
29434
29439
  };
29435
29440
 
29436
- // Used to handle egde case when token context could not be inferred correctly in tokenize phase
29441
+ // Used to handle egde cases when token context could not be inferred correctly during tokenization phase
29442
+
29437
29443
  pp$6.overrideContext = function(tokenCtx) {
29438
29444
  if (this.curContext() !== tokenCtx) {
29439
29445
  this.context[this.context.length - 1] = tokenCtx;
@@ -30249,15 +30255,6 @@ pp$5.parseProperty = function(isPattern, refDestructuringErrors) {
30249
30255
  }
30250
30256
  return this.finishNode(prop, "RestElement")
30251
30257
  }
30252
- // To disallow parenthesized identifier via `this.toAssignable()`.
30253
- if (this.type === types$1.parenL && refDestructuringErrors) {
30254
- if (refDestructuringErrors.parenthesizedAssign < 0) {
30255
- refDestructuringErrors.parenthesizedAssign = this.start;
30256
- }
30257
- if (refDestructuringErrors.parenthesizedBind < 0) {
30258
- refDestructuringErrors.parenthesizedBind = this.start;
30259
- }
30260
- }
30261
30258
  // Parse argument.
30262
30259
  prop.argument = this.parseMaybeAssign(false, refDestructuringErrors);
30263
30260
  // To disallow trailing comma via `this.toAssignable()`.
@@ -32687,7 +32684,7 @@ pp.readWord = function() {
32687
32684
 
32688
32685
  // Acorn is a tiny, fast JavaScript parser written in JavaScript.
32689
32686
 
32690
- var version = "8.7.1";
32687
+ var version = "8.8.0";
32691
32688
 
32692
32689
  Parser.acorn = {
32693
32690
  Parser: Parser,
@@ -33408,6 +33405,9 @@ function fileToDevUrl(id, config) {
33408
33405
  function getAssetFilename(hash, config) {
33409
33406
  return assetHashToFilenameMap.get(config)?.get(hash);
33410
33407
  }
33408
+ function getPublicAssetFilename(hash, config) {
33409
+ return publicAssetUrlCache.get(config)?.get(hash);
33410
+ }
33411
33411
  function resolveAssetFileNames(config) {
33412
33412
  const output = config.build?.rollupOptions?.output;
33413
33413
  const defaultAssetFileNames = path$n.posix.join(config.build.assetsDir, '[name].[hash][extname]');
@@ -35390,10 +35390,6 @@ function importGlobPlugin(config) {
35390
35390
  if (server) {
35391
35391
  const allGlobs = result.matches.map((i) => i.globsResolved);
35392
35392
  server._importGlobMap.set(id, allGlobs);
35393
- result.files.forEach((file) => {
35394
- // update watcher
35395
- server.watcher.add(dirname(file));
35396
- });
35397
35393
  }
35398
35394
  return transformStableResult(result.s, id, config);
35399
35395
  }
@@ -35472,24 +35468,31 @@ async function parseImportGlob(code, importer, root, resolveId) {
35472
35468
  const arg1 = ast.arguments[0];
35473
35469
  const arg2 = ast.arguments[1];
35474
35470
  const globs = [];
35475
- if (arg1.type === 'ArrayExpression') {
35476
- for (const element of arg1.elements) {
35477
- if (!element)
35478
- continue;
35479
- if (element.type !== 'Literal')
35480
- throw err('Could only use literals');
35471
+ const validateLiteral = (element) => {
35472
+ if (!element)
35473
+ return;
35474
+ if (element.type === 'Literal') {
35481
35475
  if (typeof element.value !== 'string')
35482
35476
  throw err(`Expected glob to be a string, but got "${typeof element.value}"`);
35483
35477
  globs.push(element.value);
35484
35478
  }
35485
- }
35486
- else if (arg1.type === 'Literal') {
35487
- if (typeof arg1.value !== 'string')
35488
- throw err(`Expected glob to be a string, but got "${typeof arg1.value}"`);
35489
- globs.push(arg1.value);
35479
+ else if (element.type === 'TemplateLiteral') {
35480
+ if (element.expressions.length !== 0) {
35481
+ throw err(`Expected glob to be a string, but got dynamic template literal`);
35482
+ }
35483
+ globs.push(element.quasis[0].value.raw);
35484
+ }
35485
+ else {
35486
+ throw err('Could only use literals');
35487
+ }
35488
+ };
35489
+ if (arg1.type === 'ArrayExpression') {
35490
+ for (const element of arg1.elements) {
35491
+ validateLiteral(element);
35492
+ }
35490
35493
  }
35491
35494
  else {
35492
- throw err('Could only use literals');
35495
+ validateLiteral(arg1);
35493
35496
  }
35494
35497
  // arg2
35495
35498
  const options = {};
@@ -38006,13 +38009,19 @@ function createIsConfiguredAsSsrExternal(config) {
38006
38009
  if (!bareImportRE.test(id) || id.includes('\0')) {
38007
38010
  return false;
38008
38011
  }
38009
- return !!tryNodeResolve(id, undefined, resolveOptions, ssr?.target === 'webworker', undefined, true,
38010
- // try to externalize, will return undefined or an object without
38011
- // a external flag if it isn't externalizable
38012
- true,
38013
- // Allow linked packages to be externalized if they are explicitly
38014
- // configured as external
38015
- !!configuredAsExternal)?.external;
38012
+ try {
38013
+ return !!tryNodeResolve(id, undefined, resolveOptions, ssr?.target === 'webworker', undefined, true,
38014
+ // try to externalize, will return undefined or an object without
38015
+ // a external flag if it isn't externalizable
38016
+ true,
38017
+ // Allow linked packages to be externalized if they are explicitly
38018
+ // configured as external
38019
+ !!configuredAsExternal)?.external;
38020
+ }
38021
+ catch (e) {
38022
+ // may be an invalid import that's resolved by a plugin
38023
+ return false;
38024
+ }
38016
38025
  };
38017
38026
  // Returns true if it is configured as external, false if it is filtered
38018
38027
  // by noExternal and undefined if it isn't affected by the explicit config
@@ -41090,7 +41099,7 @@ const assetAttrsConfig = {
41090
41099
  const isAsyncScriptMap = new WeakMap();
41091
41100
  async function traverseHtml(html, filePath, visitor) {
41092
41101
  // lazy load compiler
41093
- const { parse, transform } = await import('./dep-7f3e64a3.js').then(function (n) { return n.c; });
41102
+ const { parse, transform } = await import('./dep-f135d593.js').then(function (n) { return n.c; });
41094
41103
  // @vue/compiler-core doesn't like lowercase doctypes
41095
41104
  html = html.replace(/<!doctype\s/i, '<!DOCTYPE ');
41096
41105
  try {
@@ -41252,7 +41261,10 @@ function buildHtmlPlugin(config) {
41252
41261
  // assetsUrl may be encodeURI
41253
41262
  const url = decodeURI(p.value.content);
41254
41263
  if (!isExcludedUrl(url)) {
41255
- if (node.tag === 'link' && isCSSRequest(url)) {
41264
+ if (node.tag === 'link' &&
41265
+ isCSSRequest(url) &&
41266
+ // should not be converted if following attributes are present (#6748)
41267
+ !node.props.some((p) => p.name === 'media' || p.name === 'disabled')) {
41256
41268
  // CSS references, convert to import
41257
41269
  const importExpression = `\nimport ${JSON.stringify(url)}`;
41258
41270
  styleUrls.push({
@@ -41436,14 +41448,16 @@ function buildHtmlPlugin(config) {
41436
41448
  for (const [id, html] of processedHtml) {
41437
41449
  const relativeUrlPath = path$n.posix.relative(config.root, id);
41438
41450
  const assetsBase = getBaseInHTML(relativeUrlPath, config);
41439
- const toOutputAssetFilePath = (filename) => {
41451
+ const toOutputFilePath = (filename, type) => {
41440
41452
  if (isExternalUrl(filename)) {
41441
41453
  return filename;
41442
41454
  }
41443
41455
  else {
41444
- return toOutputFilePathInHtml(filename, 'asset', relativeUrlPath, 'html', config, (filename, importer) => assetsBase + filename);
41456
+ return toOutputFilePathInHtml(filename, type, relativeUrlPath, 'html', config, (filename, importer) => assetsBase + filename);
41445
41457
  }
41446
41458
  };
41459
+ const toOutputAssetFilePath = (filename) => toOutputFilePath(filename, 'asset');
41460
+ const toOutputPublicAssetFilePath = (filename) => toOutputFilePath(filename, 'public');
41447
41461
  const isAsync = isAsyncScriptMap.get(config).get(id);
41448
41462
  let result = html;
41449
41463
  // find corresponding entry chunk
@@ -41508,6 +41522,9 @@ function buildHtmlPlugin(config) {
41508
41522
  result = result.replace(assetUrlRE, (_, fileHash, postfix = '') => {
41509
41523
  return (toOutputAssetFilePath(getAssetFilename(fileHash, config)) + postfix);
41510
41524
  });
41525
+ result = result.replace(publicAssetUrlRE, (_, fileHash) => {
41526
+ return normalizePath$3(toOutputPublicAssetFilePath(getPublicAssetFilename(fileHash, config)));
41527
+ });
41511
41528
  if (chunk && canInlineEntry) {
41512
41529
  // all imports from entry have been inlined to html, prevent rollup from outputting it
41513
41530
  delete bundle[chunk.fileName];
@@ -41990,7 +42007,7 @@ function cssPostPlugin(config) {
41990
42007
  return chunkCSS;
41991
42008
  }
41992
42009
  function ensureFileExt(name, ext) {
41993
- return path$n.format({ ...path$n.parse(name), base: undefined, ext });
42010
+ return normalizePath$3(path$n.format({ ...path$n.parse(name), base: undefined, ext }));
41994
42011
  }
41995
42012
  if (config.build.cssCodeSplit) {
41996
42013
  if (isPureCssChunk) {
@@ -42220,7 +42237,7 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
42220
42237
  logger: config.logger
42221
42238
  }));
42222
42239
  if (isModule) {
42223
- postcssPlugins.unshift((await import('./dep-676c6c22.js').then(function (n) { return n.i; })).default({
42240
+ postcssPlugins.unshift((await import('./dep-3811dadb.js').then(function (n) { return n.i; })).default({
42224
42241
  ...modulesOptions,
42225
42242
  getJSON(cssFileName, _modules, outputFileName) {
42226
42243
  modules = _modules;
@@ -43156,7 +43173,7 @@ function assetImportMetaUrlPlugin(config) {
43156
43173
  // target so we use the global location here. It can be
43157
43174
  // window.location or self.location in case it is used in a Web Worker.
43158
43175
  // @see https://developer.mozilla.org/en-US/docs/Web/API/Window/self
43159
- s.overwrite(index, index + exp.length, `new URL((import.meta.glob(${pattern}, { eager: true, import: 'default' }))[${rawUrl}], self.location)`, { contentOnly: true });
43176
+ s.overwrite(index, index + exp.length, `new URL((import.meta.glob(${pattern}, { eager: true, import: 'default', as: 'url' }))[${rawUrl}], self.location)`, { contentOnly: true });
43160
43177
  continue;
43161
43178
  }
43162
43179
  }
@@ -43401,10 +43418,11 @@ async function doBuild(inlineConfig = {}) {
43401
43418
  `This is deprecated and will override all Vite.js default output options. ` +
43402
43419
  `Please use "rollupOptions.output" instead.`);
43403
43420
  }
43404
- const ssrWorkerBuild = ssr && config.ssr?.target !== 'webworker';
43405
- const cjsSsrBuild = ssr && config.ssr?.format === 'cjs';
43421
+ const ssrNodeBuild = ssr && config.ssr.target === 'node';
43422
+ const ssrWorkerBuild = ssr && config.ssr.target === 'webworker';
43423
+ const cjsSsrBuild = ssr && config.ssr.format === 'cjs';
43406
43424
  const format = output.format || (cjsSsrBuild ? 'cjs' : 'es');
43407
- const jsExt = ssrWorkerBuild || libOptions
43425
+ const jsExt = ssrNodeBuild || libOptions
43408
43426
  ? resolveOutputJsExtension(format, getPkgJson(config.root)?.type)
43409
43427
  : 'js';
43410
43428
  return {
@@ -1,4 +1,4 @@
1
- import { A as getAugmentedNamespace, B as getDefaultExportFromCjs } from './dep-c6273c7a.js';
1
+ import { A as getAugmentedNamespace, B as getDefaultExportFromCjs } from './dep-71eb12cb.js';
2
2
 
3
3
  import { fileURLToPath as __cjs_fileURLToPath } from 'node:url';
4
4
  import { dirname as __cjs_dirname } from 'node:path';
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 { y as picocolors, u as createLogger, e as resolveConfig } from './chunks/dep-c6273c7a.js';
3
+ import { y as picocolors, u as createLogger, e as resolveConfig } from './chunks/dep-71eb12cb.js';
4
4
  import { VERSION } from './constants.js';
5
5
  import 'node:fs';
6
6
  import 'node:path';
@@ -694,7 +694,7 @@ cli
694
694
  .action(async (root, options) => {
695
695
  // output structure is preserved even after bundling so require()
696
696
  // is ok here
697
- const { createServer } = await import('./chunks/dep-c6273c7a.js').then(function (n) { return n.E; });
697
+ const { createServer } = await import('./chunks/dep-71eb12cb.js').then(function (n) { return n.E; });
698
698
  try {
699
699
  const server = await createServer({
700
700
  root,
@@ -741,7 +741,7 @@ cli
741
741
  .option('--emptyOutDir', `[boolean] force empty outDir when it's outside of root`)
742
742
  .option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
743
743
  .action(async (root, options) => {
744
- const { build } = await import('./chunks/dep-c6273c7a.js').then(function (n) { return n.D; });
744
+ const { build } = await import('./chunks/dep-71eb12cb.js').then(function (n) { return n.D; });
745
745
  const buildOptions = cleanOptions(options);
746
746
  try {
747
747
  await build({
@@ -765,7 +765,7 @@ cli
765
765
  .command('optimize [root]', 'pre-bundle dependencies')
766
766
  .option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
767
767
  .action(async (root, options) => {
768
- const { optimizeDeps } = await import('./chunks/dep-c6273c7a.js').then(function (n) { return n.C; });
768
+ const { optimizeDeps } = await import('./chunks/dep-71eb12cb.js').then(function (n) { return n.C; });
769
769
  try {
770
770
  const config = await resolveConfig({
771
771
  root,
@@ -788,7 +788,7 @@ cli
788
788
  .option('--https', `[boolean] use TLS + HTTP/2`)
789
789
  .option('--open [path]', `[boolean | string] open browser on startup`)
790
790
  .action(async (root, options) => {
791
- const { preview } = await import('./chunks/dep-c6273c7a.js').then(function (n) { return n.F; });
791
+ const { preview } = await import('./chunks/dep-71eb12cb.js').then(function (n) { return n.F; });
792
792
  try {
793
793
  const server = await preview({
794
794
  root,
@@ -1,7 +1,7 @@
1
1
  import path, { resolve } from 'node:path';
2
2
  import { fileURLToPath } from 'node:url';
3
3
 
4
- var version = "3.0.3";
4
+ var version = "3.0.4";
5
5
 
6
6
  const VERSION = version;
7
7
  const DEFAULT_MAIN_FIELDS = [
@@ -1,4 +1,4 @@
1
- export { b as build, k as createFilter, u as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, h as getDepOptimizationConfig, i as isDepsOptimizerEnabled, l as loadConfigFromFile, w as loadEnv, j as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, p as preview, g as resolveBaseUrl, e as resolveConfig, x as resolveEnvPrefix, a as resolvePackageData, r as resolvePackageEntry, v as searchForWorkspaceRoot, q as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-c6273c7a.js';
1
+ export { b as build, k as createFilter, u as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, h as getDepOptimizationConfig, i as isDepsOptimizerEnabled, l as loadConfigFromFile, w as loadEnv, j as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, p as preview, g as resolveBaseUrl, e as resolveConfig, x as resolveEnvPrefix, a as resolvePackageData, r as resolvePackageEntry, v as searchForWorkspaceRoot, q as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-71eb12cb.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';
@@ -31,7 +31,7 @@ var require$$1__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$1$1);
31
31
  var readline__default = /*#__PURE__*/_interopDefaultLegacy(readline);
32
32
  var require$$2__default = /*#__PURE__*/_interopDefaultLegacy(require$$2);
33
33
 
34
- var version = "3.0.3";
34
+ var version = "3.0.4";
35
35
 
36
36
  const VERSION = version;
37
37
  const VITE_PACKAGE_DIR = path$3.resolve(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "3.0.3",
3
+ "version": "3.0.4",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -79,7 +79,7 @@
79
79
  "@rollup/plugin-typescript": "^8.3.3",
80
80
  "@rollup/pluginutils": "^4.2.1",
81
81
  "@vue/compiler-dom": "^3.2.37",
82
- "acorn": "^8.7.1",
82
+ "acorn": "^8.8.0",
83
83
  "cac": "^6.7.12",
84
84
  "chokidar": "^3.5.3",
85
85
  "connect": "^3.7.0",
@@ -99,7 +99,7 @@
99
99
  "launch-editor-middleware": "^2.4.0",
100
100
  "magic-string": "^0.26.2",
101
101
  "micromatch": "^4.0.5",
102
- "mlly": "^0.5.4",
102
+ "mlly": "^0.5.5",
103
103
  "mrmime": "^1.0.1",
104
104
  "okie": "^1.0.1",
105
105
  "open": "^8.4.0",