vite 3.0.0-alpha.8 → 3.0.0-alpha.9

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,4 +1,4 @@
1
- import { w as commonjsGlobal } from './dep-8250f392.js';
1
+ import { w as commonjsGlobal } from './dep-8df7bfd6.js';
2
2
  import require$$1 from 'crypto';
3
3
  import 'fs';
4
4
  import 'path';
@@ -1,5 +1,5 @@
1
1
  import require$$0 from 'postcss';
2
- import { w as commonjsGlobal } from './dep-8250f392.js';
2
+ import { w as commonjsGlobal } from './dep-8df7bfd6.js';
3
3
  import path$2 from 'path';
4
4
  import require$$1 from 'crypto';
5
5
  import fs__default from 'fs';
@@ -1,4 +1,4 @@
1
- import { x as getAugmentedNamespace, y as getDefaultExportFromCjs } from './dep-8250f392.js';
1
+ import { x as getAugmentedNamespace, y as getDefaultExportFromCjs } from './dep-8df7bfd6.js';
2
2
 
3
3
  import { fileURLToPath as __cjs_fileURLToPath } from 'url';
4
4
  import { dirname as __cjs_dirname } from 'path';
@@ -15045,7 +15045,17 @@ function tryNodeResolve(id, importer, options, targetWeb, depsOptimizer, ssr, ex
15045
15045
  return resolved;
15046
15046
  }
15047
15047
  const resolvedExt = path$p.extname(resolved.id);
15048
- const resolvedId = isDeepImport && path$p.extname(id) !== resolvedExt ? id + resolvedExt : id;
15048
+ let resolvedId = id;
15049
+ if (isDeepImport) {
15050
+ // check ext before externalizing - only externalize
15051
+ // extension-less imports and explicit .js imports
15052
+ if (resolvedExt && !resolved.id.match(/(.js|.mjs|.cjs)$/)) {
15053
+ return;
15054
+ }
15055
+ if (!pkg?.data.exports && path$p.extname(id) !== resolvedExt) {
15056
+ resolvedId += resolvedExt;
15057
+ }
15058
+ }
15049
15059
  return { ...resolved, id: resolvedId, external: true };
15050
15060
  };
15051
15061
  // link id to pkg for browser field mapping check
@@ -26000,7 +26010,7 @@ async function createPluginContainer({ plugins, logger, root, build: { rollupOpt
26000
26010
  (await plugin.options.call(minimalContext, options)) || options;
26001
26011
  }
26002
26012
  if (options.acornInjectPlugins) {
26003
- parser = Parser.extend(options.acornInjectPlugins);
26013
+ parser = Parser.extend(...arraify(options.acornInjectPlugins));
26004
26014
  }
26005
26015
  return {
26006
26016
  acorn,
@@ -35904,7 +35914,7 @@ const assetAttrsConfig = {
35904
35914
  const isAsyncScriptMap = new WeakMap();
35905
35915
  async function traverseHtml(html, filePath, visitor) {
35906
35916
  // lazy load compiler
35907
- const { parse, transform } = await import('./dep-cfa39351.js').then(function (n) { return n.c; });
35917
+ const { parse, transform } = await import('./dep-523c8a1b.js').then(function (n) { return n.c; });
35908
35918
  // @vue/compiler-core doesn't like lowercase doctypes
35909
35919
  html = html.replace(/<!doctype\s/i, '<!DOCTYPE ');
35910
35920
  try {
@@ -37009,7 +37019,7 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
37009
37019
  logger: config.logger
37010
37020
  }));
37011
37021
  if (isModule) {
37012
- postcssPlugins.unshift((await import('./dep-6b269949.js').then(function (n) { return n.i; })).default({
37022
+ postcssPlugins.unshift((await import('./dep-3165073f.js').then(function (n) { return n.i; })).default({
37013
37023
  ...modulesOptions,
37014
37024
  getJSON(cssFileName, _modules, outputFileName) {
37015
37025
  modules = _modules;
@@ -38099,21 +38109,12 @@ function createIsSsrExternal(config) {
38099
38109
  isProduction: false,
38100
38110
  isBuild: true
38101
38111
  };
38102
- const isPackageEntry = (id) => {
38112
+ const isValidPackageEntry = (id) => {
38103
38113
  if (!bareImportRE.test(id) || id.includes('\0')) {
38104
38114
  return false;
38105
38115
  }
38106
- if (tryNodeResolve(id, undefined, resolveOptions, ssr?.target === 'webworker', undefined, true)) {
38107
- return true;
38108
- }
38109
- try {
38110
- // no main entry, but deep imports may be allowed
38111
- if (resolveFrom(`${id}/package.json`, root)) {
38112
- return true;
38113
- }
38114
- }
38115
- catch { }
38116
- return false;
38116
+ return !!tryNodeResolve(id, undefined, resolveOptions, ssr?.target === 'webworker', undefined, true, true // try to externalize, will return undefined if not possible
38117
+ );
38117
38118
  };
38118
38119
  return (id) => {
38119
38120
  if (processedIds.has(id)) {
@@ -38121,7 +38122,7 @@ function createIsSsrExternal(config) {
38121
38122
  }
38122
38123
  const external = !id.startsWith('.') &&
38123
38124
  !path$p.isAbsolute(id) &&
38124
- (isBuiltin(id) || (isConfiguredAsExternal(id) && isPackageEntry(id)));
38125
+ (isBuiltin(id) || (isConfiguredAsExternal(id) && isValidPackageEntry(id)));
38125
38126
  processedIds.set(id, external);
38126
38127
  return external;
38127
38128
  };
@@ -41140,6 +41141,13 @@ async function doBuild(inlineConfig = {}) {
41140
41141
  };
41141
41142
  try {
41142
41143
  const buildOutputOptions = (output = {}) => {
41144
+ // See https://github.com/vitejs/vite/issues/5812#issuecomment-984345618
41145
+ // @ts-ignore
41146
+ if (output.output) {
41147
+ config.logger.warn(`You've set "rollupOptions.output.output" in your config. ` +
41148
+ `This is deprecated and will override all Vite.js default output options. ` +
41149
+ `Please use "rollupOptions.output" instead.`);
41150
+ }
41143
41151
  const cjsSsrBuild = ssr && config.ssr?.format === 'cjs';
41144
41152
  const format = output.format || (cjsSsrBuild ? 'cjs' : 'es');
41145
41153
  const jsExt = (ssr && config.ssr?.target !== 'webworker') || libOptions
@@ -47756,7 +47764,7 @@ async function getCertificate(cacheDir) {
47756
47764
  return content;
47757
47765
  }
47758
47766
  catch {
47759
- const content = (await import('./dep-8259d5f4.js')).createCertificate();
47767
+ const content = (await import('./dep-08f2a2be.js')).createCertificate();
47760
47768
  promises
47761
47769
  .mkdir(cacheDir, { recursive: true })
47762
47770
  .then(() => promises.writeFile(cachePath, content))
package/dist/node/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { performance } from 'perf_hooks';
2
2
  import { EventEmitter } from 'events';
3
- import { v as colors, j as createLogger, e as resolveConfig } from './chunks/dep-8250f392.js';
3
+ import { v as colors, j as createLogger, e as resolveConfig } from './chunks/dep-8df7bfd6.js';
4
4
  import { VERSION } from './constants.js';
5
5
  import 'fs';
6
6
  import 'path';
@@ -682,7 +682,7 @@ cli
682
682
  .action(async (root, options) => {
683
683
  // output structure is preserved even after bundling so require()
684
684
  // is ok here
685
- const { createServer } = await import('./chunks/dep-8250f392.js').then(function (n) { return n.B; });
685
+ const { createServer } = await import('./chunks/dep-8df7bfd6.js').then(function (n) { return n.B; });
686
686
  try {
687
687
  const server = await createServer({
688
688
  root,
@@ -728,7 +728,7 @@ cli
728
728
  .option('--emptyOutDir', `[boolean] force empty outDir when it's outside of root`)
729
729
  .option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
730
730
  .action(async (root, options) => {
731
- const { build } = await import('./chunks/dep-8250f392.js').then(function (n) { return n.A; });
731
+ const { build } = await import('./chunks/dep-8df7bfd6.js').then(function (n) { return n.A; });
732
732
  const buildOptions = cleanOptions(options);
733
733
  try {
734
734
  await build({
@@ -752,7 +752,7 @@ cli
752
752
  .command('optimize [root]', 'pre-bundle dependencies')
753
753
  .option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
754
754
  .action(async (root, options) => {
755
- const { optimizeDeps } = await import('./chunks/dep-8250f392.js').then(function (n) { return n.z; });
755
+ const { optimizeDeps } = await import('./chunks/dep-8df7bfd6.js').then(function (n) { return n.z; });
756
756
  try {
757
757
  const config = await resolveConfig({
758
758
  root,
@@ -775,7 +775,7 @@ cli
775
775
  .option('--https', `[boolean] use TLS + HTTP/2`)
776
776
  .option('--open [path]', `[boolean | string] open browser on startup`)
777
777
  .action(async (root, options) => {
778
- const { preview } = await import('./chunks/dep-8250f392.js').then(function (n) { return n.C; });
778
+ const { preview } = await import('./chunks/dep-8df7bfd6.js').then(function (n) { return n.C; });
779
779
  try {
780
780
  const server = await preview({
781
781
  root,
@@ -1,7 +1,7 @@
1
1
  import path, { resolve } from 'path';
2
2
  import { fileURLToPath } from 'url';
3
3
 
4
- var version = "3.0.0-alpha.8";
4
+ var version = "3.0.0-alpha.9";
5
5
 
6
6
  const VERSION = version;
7
7
  const DEFAULT_MAIN_FIELDS = [
@@ -1,4 +1,4 @@
1
- export { b as build, j as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, i as isDepsOptimizerEnabled, l as loadConfigFromFile, q as loadEnv, g as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, p as preview, e as resolveConfig, u as resolveEnvPrefix, a as resolvePackageData, r as resolvePackageEntry, k as searchForWorkspaceRoot, h as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-8250f392.js';
1
+ export { b as build, j as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, i as isDepsOptimizerEnabled, l as loadConfigFromFile, q as loadEnv, g as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, p as preview, e as resolveConfig, u as resolveEnvPrefix, a as resolvePackageData, r as resolvePackageEntry, k as searchForWorkspaceRoot, h as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-8df7bfd6.js';
2
2
  import 'fs';
3
3
  import 'path';
4
4
  import 'url';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "3.0.0-alpha.8",
3
+ "version": "3.0.0-alpha.9",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",