vite 2.9.12 → 3.0.0-alpha.10

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,33 +1,34 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var index = require('./chunks/dep-8f5c9290.js');
6
- require('fs');
7
- require('path');
8
- require('url');
9
- require('perf_hooks');
10
- require('tty');
11
- require('os');
12
- require('esbuild');
13
- require('events');
14
- require('assert');
15
- require('resolve');
16
- require('util');
17
- require('stream');
18
- require('net');
19
- require('http');
20
- require('child_process');
21
- require('module');
22
- require('crypto');
23
- require('buffer');
24
- require('querystring');
25
- require('zlib');
26
- require('https');
27
- require('tls');
28
- require('worker_threads');
29
- require('readline');
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-134b43f1.js';
2
+ export { VERSION as version } from './constants.js';
3
+ import 'fs';
4
+ import 'path';
5
+ import 'url';
6
+ import 'perf_hooks';
7
+ import 'module';
8
+ import 'tty';
9
+ import 'esbuild';
10
+ import 'events';
11
+ import 'assert';
12
+ import 'resolve';
13
+ import 'util';
14
+ import 'net';
15
+ import 'http';
16
+ import 'stream';
17
+ import 'os';
18
+ import 'child_process';
19
+ import 'crypto';
20
+ import 'buffer';
21
+ import 'querystring';
22
+ import 'zlib';
23
+ import 'https';
24
+ import 'tls';
25
+ import 'worker_threads';
26
+ import 'readline';
30
27
 
28
+ // This file will be built for both ESM and CJS. Avoid relying on other modules as possible.
29
+ const cssLangs = `\\.(css|less|sass|scss|styl|stylus|pcss|postcss)($|\\?)`;
30
+ const cssLangRE = new RegExp(cssLangs);
31
+ const isCSSRequest = (request) => cssLangRE.test(request);
31
32
  // Use splitVendorChunkPlugin() to get the same manualChunks strategy as Vite 2.7
32
33
  // We don't recommend using this strategy as a general solution moving forward
33
34
  // splitVendorChunk is a simple index/vendor strategy that was used in Vite
@@ -44,11 +45,10 @@ class SplitVendorChunkCache {
44
45
  }
45
46
  }
46
47
  function splitVendorChunk(options = {}) {
47
- var _a;
48
- const cache = (_a = options.cache) !== null && _a !== void 0 ? _a : new SplitVendorChunkCache();
48
+ const cache = options.cache ?? new SplitVendorChunkCache();
49
49
  return (id, { getModuleInfo }) => {
50
50
  if (id.includes('node_modules') &&
51
- !index.isCSSRequest(id) &&
51
+ !isCSSRequest(id) &&
52
52
  staticImportedByEntry(id, getModuleInfo, cache.cache)) {
53
53
  return 'vendor';
54
54
  }
@@ -79,11 +79,10 @@ function staticImportedByEntry(id, getModuleInfo, cache, importStack = []) {
79
79
  function splitVendorChunkPlugin() {
80
80
  const caches = [];
81
81
  function createSplitVendorChunk(output, config) {
82
- var _a;
83
82
  const cache = new SplitVendorChunkCache();
84
83
  caches.push(cache);
85
- const build = (_a = config.build) !== null && _a !== void 0 ? _a : {};
86
- const format = output === null || output === void 0 ? void 0 : output.format;
84
+ const build = config.build ?? {};
85
+ const format = output?.format;
87
86
  if (!build.ssr && !build.lib && format !== 'umd' && format !== 'iife') {
88
87
  return splitVendorChunk({ cache });
89
88
  }
@@ -91,8 +90,7 @@ function splitVendorChunkPlugin() {
91
90
  return {
92
91
  name: 'vite:split-vendor-chunk',
93
92
  config(config) {
94
- var _a, _b;
95
- let outputs = (_b = (_a = config === null || config === void 0 ? void 0 : config.build) === null || _a === void 0 ? void 0 : _a.rollupOptions) === null || _b === void 0 ? void 0 : _b.output;
93
+ let outputs = config?.build?.rollupOptions?.output;
96
94
  if (outputs) {
97
95
  outputs = Array.isArray(outputs) ? outputs : [outputs];
98
96
  for (const output of outputs) {
@@ -102,8 +100,7 @@ function splitVendorChunkPlugin() {
102
100
  if (typeof output.manualChunks === 'function') {
103
101
  const userManualChunks = output.manualChunks;
104
102
  output.manualChunks = (id, api) => {
105
- var _a;
106
- return (_a = userManualChunks(id, api)) !== null && _a !== void 0 ? _a : viteManualChunks(id, api);
103
+ return userManualChunks(id, api) ?? viteManualChunks(id, api);
107
104
  };
108
105
  }
109
106
  // else, leave the object form of manualChunks untouched, as
@@ -133,25 +130,4 @@ function splitVendorChunkPlugin() {
133
130
  };
134
131
  }
135
132
 
136
- exports.build = index.build;
137
- exports.createLogger = index.createLogger;
138
- exports.createServer = index.createServer;
139
- exports.defineConfig = index.defineConfig;
140
- exports.formatPostcssSourceMap = index.formatPostcssSourceMap;
141
- exports.loadConfigFromFile = index.loadConfigFromFile;
142
- exports.loadEnv = index.loadEnv;
143
- exports.mergeConfig = index.mergeConfig;
144
- exports.normalizePath = index.normalizePath;
145
- exports.optimizeDeps = index.optimizeDeps;
146
- exports.preview = index.preview;
147
- exports.printHttpServerUrls = index.printHttpServerUrls;
148
- exports.resolveConfig = index.resolveConfig;
149
- exports.resolveEnvPrefix = index.resolveEnvPrefix;
150
- exports.resolvePackageData = index.resolvePackageData;
151
- exports.resolvePackageEntry = index.resolvePackageEntry;
152
- exports.searchForWorkspaceRoot = index.searchForWorkspaceRoot;
153
- exports.send = index.send;
154
- exports.sortUserPlugins = index.sortUserPlugins;
155
- exports.transformWithEsbuild = index.transformWithEsbuild;
156
- exports.splitVendorChunk = splitVendorChunk;
157
- exports.splitVendorChunkPlugin = splitVendorChunkPlugin;
133
+ export { splitVendorChunk, splitVendorChunkPlugin };