vite 4.3.4 → 4.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of vite might be problematic. Click here for more details.

@@ -1,4 +1,4 @@
1
- import { E as getDefaultExportFromCjs } from './dep-f7d05e3f.js';
1
+ import { E as getDefaultExportFromCjs } from './dep-934dbc7c.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-f7d05e3f.js';
1
+ import { F as commonjsGlobal, E as getDefaultExportFromCjs } from './dep-934dbc7c.js';
2
2
  import require$$0__default from 'fs';
3
3
  import require$$0 from 'postcss';
4
4
  import require$$0$1 from 'path';
@@ -11876,7 +11876,7 @@ function createDebugger(namespace, options = {}) {
11876
11876
  }
11877
11877
  if (enabled) {
11878
11878
  return (...args) => {
11879
- if (!filter || args.some((a) => a?.includes(filter))) {
11879
+ if (!filter || args.some((a) => a?.includes?.(filter))) {
11880
11880
  log(...args);
11881
11881
  }
11882
11882
  };
@@ -38574,8 +38574,8 @@ function createCachedImport(imp) {
38574
38574
  return cached;
38575
38575
  };
38576
38576
  }
38577
- const importPostcssImport = createCachedImport(() => import('./dep-524177e3.js').then(function (n) { return n.i; }));
38578
- const importPostcssModules = createCachedImport(() => import('./dep-53740c38.js').then(function (n) { return n.i; }));
38577
+ const importPostcssImport = createCachedImport(() => import('./dep-5673ffe5.js').then(function (n) { return n.i; }));
38578
+ const importPostcssModules = createCachedImport(() => import('./dep-8989cf2a.js').then(function (n) { return n.i; }));
38579
38579
  const importPostcss = createCachedImport(() => import('postcss'));
38580
38580
  /**
38581
38581
  * @experimental
@@ -38875,6 +38875,7 @@ function cleanScssBugUrl(url) {
38875
38875
  if (
38876
38876
  // check bug via `window` and `location` global
38877
38877
  typeof window !== 'undefined' &&
38878
+ typeof location !== 'undefined' &&
38878
38879
  typeof location?.href === 'string') {
38879
38880
  const prefix = location.href.replace(/\/$/, '');
38880
38881
  return url.replace(prefix, '');
@@ -41811,7 +41812,12 @@ function assetImportMetaUrlPlugin(config) {
41811
41812
  s = new MagicString(code);
41812
41813
  // potential dynamic template string
41813
41814
  if (rawUrl[0] === '`' && rawUrl.includes('${')) {
41814
- const ast = this.parse(rawUrl);
41815
+ let [pureUrl, queryString = ''] = rawUrl.split('?');
41816
+ if (queryString) {
41817
+ pureUrl += '`';
41818
+ queryString = '?' + queryString.slice(0, -1);
41819
+ }
41820
+ const ast = this.parse(pureUrl);
41815
41821
  const templateLiteral = ast.body[0].expression;
41816
41822
  if (templateLiteral.expressions.length) {
41817
41823
  const pattern = buildGlobPattern(templateLiteral);
@@ -41820,11 +41826,17 @@ function assetImportMetaUrlPlugin(config) {
41820
41826
  // because users won't intend to do that in most cases
41821
41827
  continue;
41822
41828
  }
41829
+ const globOptions = {
41830
+ eager: true,
41831
+ import: 'default',
41832
+ // A hack to allow 'as' & 'query' exist at the same time
41833
+ query: injectQuery(queryString, 'url'),
41834
+ };
41823
41835
  // Note: native import.meta.url is not supported in the baseline
41824
41836
  // target so we use the global location here. It can be
41825
41837
  // window.location or self.location in case it is used in a Web Worker.
41826
41838
  // @see https://developer.mozilla.org/en-US/docs/Web/API/Window/self
41827
- s.update(index, index + exp.length, `new URL((import.meta.glob(${JSON.stringify(pattern)}, { eager: true, import: 'default', as: 'url' }))[${rawUrl}], self.location)`);
41839
+ s.update(index, index + exp.length, `new URL((import.meta.glob(${JSON.stringify(pattern)}, ${JSON.stringify(globOptions)}))[${pureUrl}], self.location)`);
41828
41840
  continue;
41829
41841
  }
41830
41842
  }
@@ -42538,7 +42550,7 @@ async function createPluginContainer(config, moduleGraph, watcher) {
42538
42550
  }
42539
42551
  async load(options) {
42540
42552
  // We may not have added this to our module graph yet, so ensure it exists
42541
- await moduleGraph?.ensureEntryFromUrl(options.id);
42553
+ await moduleGraph?.ensureEntryFromUrl(unwrapId(options.id), this.ssr);
42542
42554
  // Not all options passed to this function make sense in the context of loading individual files,
42543
42555
  // but we can at least update the module info properties we support
42544
42556
  updateModuleInfo(options.id, options);
@@ -43081,8 +43093,7 @@ function globEntries(pattern, config) {
43081
43093
  suppressErrors: true, // suppress EACCES errors
43082
43094
  });
43083
43095
  }
43084
- const scriptModuleRE = /(<script\b[^>]+type\s*=\s*(?:"module"|'module')[^>]*>)(.*?)<\/script>/gis;
43085
- const scriptRE = /(<script(?:\s[^>]*>|>))(.*?)<\/script>/gis;
43096
+ const scriptRE = /(<script(?:\s+[a-z_:][-\w:]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^"'<>=\s]+))?)*\s*>)(.*?)<\/script>/gis;
43086
43097
  const commentRE = /<!--.*?-->/gs;
43087
43098
  const srcRE = /\bsrc\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s'">]+))/i;
43088
43099
  const typeRE = /\btype\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s'">]+))/i;
@@ -43172,17 +43183,20 @@ function esbuildScanPlugin(config, container, depImports, missing, entries) {
43172
43183
  // Avoid matching the content of the comment
43173
43184
  raw = raw.replace(commentRE, '<!---->');
43174
43185
  const isHtml = path.endsWith('.html');
43175
- const regex = isHtml ? scriptModuleRE : scriptRE;
43176
- regex.lastIndex = 0;
43186
+ scriptRE.lastIndex = 0;
43177
43187
  let js = '';
43178
43188
  let scriptId = 0;
43179
43189
  let match;
43180
- while ((match = regex.exec(raw))) {
43190
+ while ((match = scriptRE.exec(raw))) {
43181
43191
  const [, openTag, content] = match;
43182
43192
  const typeMatch = openTag.match(typeRE);
43183
43193
  const type = typeMatch && (typeMatch[1] || typeMatch[2] || typeMatch[3]);
43184
43194
  const langMatch = openTag.match(langRE);
43185
43195
  const lang = langMatch && (langMatch[1] || langMatch[2] || langMatch[3]);
43196
+ // skip non type module script
43197
+ if (isHtml && type !== 'module') {
43198
+ continue;
43199
+ }
43186
43200
  // skip type="application/ld+json" and other non-JS types
43187
43201
  if (type &&
43188
43202
  !(type.includes('javascript') ||
@@ -54318,7 +54332,7 @@ async function instantiateModule(url, server, context = { global }, urlStack = [
54318
54332
  };
54319
54333
  function ssrExportAll(sourceModule) {
54320
54334
  for (const key in sourceModule) {
54321
- if (key !== 'default') {
54335
+ if (key !== 'default' && key !== '__esModule') {
54322
54336
  Object.defineProperty(ssrModule, key, {
54323
54337
  enumerable: true,
54324
54338
  configurable: true,
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-f7d05e3f.js';
5
+ import { C as colors, D as bindShortcuts, x as createLogger, h as resolveConfig } from './chunks/dep-934dbc7c.js';
6
6
  import { VERSION } from './constants.js';
7
7
  import 'node:fs/promises';
8
8
  import 'node:url';
@@ -728,7 +728,7 @@ cli
728
728
  filterDuplicateOptions(options);
729
729
  // output structure is preserved even after bundling so require()
730
730
  // is ok here
731
- const { createServer } = await import('./chunks/dep-f7d05e3f.js').then(function (n) { return n.I; });
731
+ const { createServer } = await import('./chunks/dep-934dbc7c.js').then(function (n) { return n.I; });
732
732
  try {
733
733
  const server = await createServer({
734
734
  root,
@@ -806,7 +806,7 @@ cli
806
806
  .option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
807
807
  .action(async (root, options) => {
808
808
  filterDuplicateOptions(options);
809
- const { build } = await import('./chunks/dep-f7d05e3f.js').then(function (n) { return n.H; });
809
+ const { build } = await import('./chunks/dep-934dbc7c.js').then(function (n) { return n.H; });
810
810
  const buildOptions = cleanOptions(options);
811
811
  try {
812
812
  await build({
@@ -834,7 +834,7 @@ cli
834
834
  .option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
835
835
  .action(async (root, options) => {
836
836
  filterDuplicateOptions(options);
837
- const { optimizeDeps } = await import('./chunks/dep-f7d05e3f.js').then(function (n) { return n.G; });
837
+ const { optimizeDeps } = await import('./chunks/dep-934dbc7c.js').then(function (n) { return n.G; });
838
838
  try {
839
839
  const config = await resolveConfig({
840
840
  root,
@@ -860,7 +860,7 @@ cli
860
860
  .option('--outDir <dir>', `[string] output directory (default: dist)`)
861
861
  .action(async (root, options) => {
862
862
  filterDuplicateOptions(options);
863
- const { preview } = await import('./chunks/dep-f7d05e3f.js').then(function (n) { return n.J; });
863
+ const { preview } = await import('./chunks/dep-934dbc7c.js').then(function (n) { return n.J; });
864
864
  try {
865
865
  const server = await preview({
866
866
  root,
@@ -1,5 +1,5 @@
1
- import { i as isInNodeModules } from './chunks/dep-f7d05e3f.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-f7d05e3f.js';
1
+ import { i as isInNodeModules } from './chunks/dep-934dbc7c.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-934dbc7c.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';
@@ -3306,7 +3306,7 @@ function createDebugger(namespace, options = {}) {
3306
3306
  }
3307
3307
  if (enabled) {
3308
3308
  return (...args) => {
3309
- if (!filter || args.some((a) => a?.includes(filter))) {
3309
+ if (!filter || args.some((a) => a?.includes?.(filter))) {
3310
3310
  log(...args);
3311
3311
  }
3312
3312
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "4.3.4",
3
+ "version": "4.3.5",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",