vite 2.5.8 → 2.5.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.

Potentially problematic release.


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

package/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## [2.5.9](https://github.com/vitejs/vite/compare/v2.5.8...v2.5.9) (2021-09-18)
2
+
3
+
4
+ ### Features
5
+
6
+ * export transformWithEsbuild ([#4882](https://github.com/vitejs/vite/issues/4882)) ([930d9db](https://github.com/vitejs/vite/commit/930d9db7b7b48abd4e812930be4e79f22659b50e))
7
+
8
+
9
+
1
10
  ## [2.5.8](https://github.com/vitejs/vite/compare/v2.5.7...v2.5.8) (2021-09-17)
2
11
 
3
12
 
@@ -34157,7 +34157,7 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
34157
34157
  replacer: urlReplacer
34158
34158
  }));
34159
34159
  if (isModule) {
34160
- postcssPlugins.unshift((await Promise.resolve().then(function () { return require('./dep-3ec0104c.js'); }).then(function (n) { return n.index; })).default({
34160
+ postcssPlugins.unshift((await Promise.resolve().then(function () { return require('./dep-58243dfd.js'); }).then(function (n) { return n.index; })).default({
34161
34161
  ...modulesOptions,
34162
34162
  getJSON(cssFileName, _modules, outputFileName) {
34163
34163
  modules = _modules;
@@ -35101,7 +35101,7 @@ const assetAttrsConfig = {
35101
35101
  };
35102
35102
  async function traverseHtml(html, filePath, visitor) {
35103
35103
  // lazy load compiler
35104
- const { parse, transform } = await Promise.resolve().then(function () { return require('./dep-3536ae33.js'); }).then(function (n) { return n.compilerDom_cjs; });
35104
+ const { parse, transform } = await Promise.resolve().then(function () { return require('./dep-499befab.js'); }).then(function (n) { return n.compilerDom_cjs; });
35105
35105
  // @vue/compiler-core doesn't like lowercase doctypes
35106
35106
  html = html.replace(/<!doctype\s/i, '<!DOCTYPE ');
35107
35107
  try {
@@ -35605,45 +35605,63 @@ var stripJsonComments = (jsonString, options = {}) => {
35605
35605
  const debug$d = createDebugger('vite:esbuild');
35606
35606
  async function transformWithEsbuild(code, filename, options, inMap) {
35607
35607
  var _a, _b, _c;
35608
- // if the id ends with a valid ext, use it (e.g. vue blocks)
35609
- // otherwise, cleanup the query before checking the ext
35610
- const ext = path__default.extname(/\.\w+$/.test(filename) ? filename : cleanUrl(filename));
35611
- let loader = ext.slice(1);
35612
- if (loader === 'cjs' || loader === 'mjs') {
35613
- loader = 'js';
35614
- }
35615
- // these fields would affect the compilation result
35616
- // https://esbuild.github.io/content-types/#tsconfig-json
35617
- const meaningfulFields = [
35618
- 'jsxFactory',
35619
- 'jsxFragmentFactory',
35620
- 'useDefineForClassFields',
35621
- 'importsNotUsedAsValues'
35622
- ];
35623
- const compilerOptionsForFile = {};
35624
- if (loader === 'ts' || loader === 'tsx') {
35625
- const loadedTsconfig = await loadTsconfigJsonForFile(filename);
35626
- const loadedCompilerOptions = (_a = loadedTsconfig.compilerOptions) !== null && _a !== void 0 ? _a : {};
35627
- for (const field of meaningfulFields) {
35628
- if (field in loadedCompilerOptions) {
35629
- // @ts-ignore TypeScript can't tell they are of the same type
35630
- compilerOptionsForFile[field] = loadedCompilerOptions[field];
35631
- }
35608
+ let loader = options === null || options === void 0 ? void 0 : options.loader;
35609
+ if (!loader) {
35610
+ // if the id ends with a valid ext, use it (e.g. vue blocks)
35611
+ // otherwise, cleanup the query before checking the ext
35612
+ const ext = path__default
35613
+ .extname(/\.\w+$/.test(filename) ? filename : cleanUrl(filename))
35614
+ .slice(1);
35615
+ if (ext === 'cjs' || ext === 'mjs') {
35616
+ loader = 'js';
35632
35617
  }
35633
- // align with TypeScript 4.3
35634
- // https://github.com/microsoft/TypeScript/pull/42663
35635
- if (((_b = loadedCompilerOptions.target) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'esnext') {
35636
- compilerOptionsForFile.useDefineForClassFields =
35637
- (_c = loadedCompilerOptions.useDefineForClassFields) !== null && _c !== void 0 ? _c : true;
35618
+ else {
35619
+ loader = ext;
35620
+ }
35621
+ }
35622
+ let tsconfigRaw = options === null || options === void 0 ? void 0 : options.tsconfigRaw;
35623
+ // if options provide tsconfigraw in string, it takes highest precedence
35624
+ if (typeof tsconfigRaw !== 'string') {
35625
+ // these fields would affect the compilation result
35626
+ // https://esbuild.github.io/content-types/#tsconfig-json
35627
+ const meaningfulFields = [
35628
+ 'jsxFactory',
35629
+ 'jsxFragmentFactory',
35630
+ 'useDefineForClassFields',
35631
+ 'importsNotUsedAsValues'
35632
+ ];
35633
+ const compilerOptionsForFile = {};
35634
+ if (loader === 'ts' || loader === 'tsx') {
35635
+ const loadedTsconfig = await loadTsconfigJsonForFile(filename);
35636
+ const loadedCompilerOptions = (_a = loadedTsconfig.compilerOptions) !== null && _a !== void 0 ? _a : {};
35637
+ for (const field of meaningfulFields) {
35638
+ if (field in loadedCompilerOptions) {
35639
+ // @ts-ignore TypeScript can't tell they are of the same type
35640
+ compilerOptionsForFile[field] = loadedCompilerOptions[field];
35641
+ }
35642
+ }
35643
+ // align with TypeScript 4.3
35644
+ // https://github.com/microsoft/TypeScript/pull/42663
35645
+ if (((_b = loadedCompilerOptions.target) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'esnext') {
35646
+ compilerOptionsForFile.useDefineForClassFields =
35647
+ (_c = loadedCompilerOptions.useDefineForClassFields) !== null && _c !== void 0 ? _c : true;
35648
+ }
35638
35649
  }
35650
+ tsconfigRaw = {
35651
+ ...tsconfigRaw,
35652
+ compilerOptions: {
35653
+ ...compilerOptionsForFile,
35654
+ ...tsconfigRaw === null || tsconfigRaw === void 0 ? void 0 : tsconfigRaw.compilerOptions
35655
+ }
35656
+ };
35639
35657
  }
35640
35658
  const resolvedOptions = {
35641
- loader: loader,
35642
35659
  sourcemap: true,
35643
35660
  // ensure source file name contains full query
35644
35661
  sourcefile: filename,
35645
- tsconfigRaw: { compilerOptions: compilerOptionsForFile },
35646
- ...options
35662
+ ...options,
35663
+ loader,
35664
+ tsconfigRaw
35647
35665
  };
35648
35666
  delete resolvedOptions.include;
35649
35667
  delete resolvedOptions.exclude;
@@ -57637,7 +57655,7 @@ function readFileIfExists(value) {
57637
57655
  * https://github.com/webpack/webpack-dev-server/blob/master/LICENSE
57638
57656
  */
57639
57657
  async function createCertificate() {
57640
- const { generate } = await Promise.resolve().then(function () { return require('./dep-713b08c9.js'); }).then(function (n) { return n.index; });
57658
+ const { generate } = await Promise.resolve().then(function () { return require('./dep-fcb82982.js'); }).then(function (n) { return n.index; });
57641
57659
  const pems = generate(null, {
57642
57660
  algorithm: 'sha256',
57643
57661
  days: 30,
@@ -77363,5 +77381,6 @@ exports.send = send$1;
77363
77381
  exports.sirv = sirv;
77364
77382
  exports.sortUserPlugins = sortUserPlugins;
77365
77383
  exports.source = source;
77384
+ exports.transformWithEsbuild = transformWithEsbuild;
77366
77385
  exports.vary = vary$1;
77367
- //# sourceMappingURL=dep-874085d4.js.map
77386
+ //# sourceMappingURL=dep-05fcddd5.js.map