Socket
Socket
Sign inDemoInstall

vite

Package Overview
Dependencies
33
Maintainers
1
Versions
552
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.11.5 to 0.12.0

11

CHANGELOG.md

@@ -0,1 +1,12 @@

# [0.12.0](https://github.com/vuejs/vite/compare/v0.11.5...v0.12.0) (2020-05-07)
### Bug Fixes
* fix index resolving double append ([4c5a31e](https://github.com/vuejs/vite/commit/4c5a31e7b32e63ffb219cf75d8c69ce482a5753d))
* fix vue resolving without local install ([29099ae](https://github.com/vuejs/vite/commit/29099ae214d9ad8d8bfe3b930a509087450f3e38))
* only bust vue cache on non-vue file change if it is a src import ([cd8794c](https://github.com/vuejs/vite/commit/cd8794c380559aae45908a64708214b2d0778c93))
## [0.11.5](https://github.com/vuejs/vite/compare/v0.11.4...v0.11.5) (2020-05-07)

@@ -2,0 +13,0 @@

2

dist/build/buildPluginResolve.d.ts
import { Plugin } from 'rollup';
import { InternalResolver } from '../resolver';
export declare const createBuildResolvePlugin: (root: string, cdn: boolean, srcRoots: string[], resolver: InternalResolver) => Plugin;
export declare const createBuildResolvePlugin: (root: string, cdn: boolean, resolver: InternalResolver) => Plugin;
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const fs_extra_1 = __importDefault(require("fs-extra"));
const serverPluginHmr_1 = require("../server/serverPluginHmr");

@@ -7,3 +11,3 @@ const resolveVue_1 = require("../utils/resolveVue");

const debug = require('debug')('vite:build:resolve');
exports.createBuildResolvePlugin = (root, cdn, srcRoots, resolver) => {
exports.createBuildResolvePlugin = (root, cdn, resolver) => {
return {

@@ -16,20 +20,19 @@ name: 'vite:resolve',

else if (id.startsWith('/')) {
// if id starts with any of the src root directories, it's a file request
if (srcRoots.some((root) => id.startsWith(root))) {
return;
const resolved = resolver.requestToFile(id);
if (await fs_extra_1.default.pathExists(resolved)) {
debug(id, `-->`, resolved);
return resolved;
}
const resolved = resolver.requestToFile(id);
debug(id, `-->`, resolved);
return resolved;
}
else if (id === 'vue') {
if (!cdn) {
return resolveVue_1.resolveVue(root).runtime;
}
else {
else if (id === 'vue' || id.startsWith('@vue/')) {
const vuePaths = resolveVue_1.resolveVue(root);
if (id === 'vue' && cdn) {
return {
id: resolveVue_1.resolveVue(root).cdnLink,
id: vuePaths.cdnLink,
external: true
};
}
else if (id in vuePaths) {
return vuePaths[id];
}
}

@@ -36,0 +39,0 @@ else if (!id.startsWith('.')) {

@@ -41,8 +41,2 @@ import { InputOptions, OutputOptions, RollupOutput } from 'rollup';

/**
* List files that are included in the build, but not inside project root.
* e.g. if you are building a higher level tool on top of vite and includes
* some code that will be bundled into the final build.
*/
srcRoots?: string[];
/**
* Will be passed to rollup.rollup()

@@ -49,0 +43,0 @@ * https://rollupjs.org/guide/en/#big-list-of-options

@@ -33,3 +33,3 @@ "use strict";

const start = Date.now();
const { root = process.cwd(), base = '/', cdn = !resolveVue_1.resolveVue(root).isLocal, outDir = path_1.default.resolve(root, 'dist'), assetsDir = 'assets', assetsInlineLimit = 4096, resolvers = [], srcRoots = [], rollupInputOptions = {}, rollupOutputOptions = {}, rollupPluginVueOptions = {}, jsx = {}, emitIndex = true, emitAssets = true, write = true, minify = true, silent = false, sourcemap = false } = options;
const { root = process.cwd(), base = '/', cdn = !resolveVue_1.resolveVue(root).isLocal, outDir = path_1.default.resolve(root, 'dist'), assetsDir = 'assets', assetsInlineLimit = 4096, resolvers = [], rollupInputOptions = {}, rollupOutputOptions = {}, rollupPluginVueOptions = {}, jsx = {}, emitIndex = true, emitAssets = true, write = true, minify = true, silent = false, sourcemap = false } = options;
const indexPath = emitIndex ? path_1.default.resolve(root, 'index.html') : null;

@@ -52,3 +52,3 @@ const publicBasePath = base.replace(/([^/])$/, '$1/'); // ensure ending slash

// vite:resolve
buildPluginResolve_1.createBuildResolvePlugin(root, cdn, [root, ...srcRoots], resolver),
buildPluginResolve_1.createBuildResolvePlugin(root, cdn, resolver),
// vite:html

@@ -55,0 +55,0 @@ ...(htmlPlugin ? [htmlPlugin] : []),

@@ -33,2 +33,3 @@ "use strict";

exports.supportedExts = ['.js', '.ts', '.jsx', '.tsx', '.json'];
const debug = require('debug')('vite:resolve');
const resolveExt = (id) => {

@@ -41,3 +42,3 @@ const cleanId = utils_1.cleanUrl(id);

// foo -> foo.js
fs_1.statSync(id + ext);
fs_1.statSync(cleanId + ext);
inferredExt = ext;

@@ -49,3 +50,3 @@ break;

// foo -> foo/index.js
fs_1.statSync(path_1.default.join(id, '/index' + ext));
fs_1.statSync(path_1.default.join(cleanId, '/index' + ext));
inferredExt = '/index' + ext;

@@ -59,3 +60,5 @@ break;

const query = queryMatch ? queryMatch[0] : '';
return cleanId + inferredExt + query;
const reoslved = cleanId + inferredExt + query;
debug(`ext: ${id} -> ${reoslved}`);
return reoslved;
}

@@ -62,0 +65,0 @@ return id;

@@ -46,4 +46,4 @@ "use strict";

if (file.endsWith('.css')) {
if (serverPluginVue_1.styleSrcImportMap.has(file)) {
// this is a vue src import
if (serverPluginVue_1.srcImportMap.has(file)) {
// this is a vue src import, skip
return;

@@ -50,0 +50,0 @@ }

@@ -168,4 +168,6 @@ "use strict";

// bust the vue cache in case this is a src imported file
exports.debugHmr(`busting Vue cache for ${filePath}`);
serverPluginVue_1.vueCache.del(filePath);
if (serverPluginVue_1.srcImportMap.has(filePath)) {
exports.debugHmr(`busting Vue cache for ${filePath}`);
serverPluginVue_1.vueCache.del(filePath);
}
const publicPath = resolver.fileToRequest(filePath);

@@ -172,0 +174,0 @@ const importers = exports.importerMap.get(publicPath);

@@ -42,5 +42,6 @@ "use strict";

};
// special handling for vue's runtime.
if (id === 'vue') {
return serve(id, utils_1.resolveVue(root).runtime, 'vue');
// speical handling for vue runtime packages
const vuePaths = utils_1.resolveVue(root);
if (id in vuePaths) {
return serve(id, vuePaths[id], 'vue');
}

@@ -47,0 +48,0 @@ // already resolved and cached

@@ -95,2 +95,5 @@ "use strict";

}
else {
debug(`(skipped) ${ctx.url}`);
}
});

@@ -147,3 +150,3 @@ };

if (indexMatch) {
pathname = pathname.replace(/\/$/, '') + indexMatch[0];
pathname = pathname.replace(/\/(index)?$/, '') + indexMatch[0];
}

@@ -168,5 +171,7 @@ else {

const importee = utils_1.cleanUrl(resolved);
currentImportees.add(importee);
serverPluginHmr_1.debugHmr(` ${importer} imports ${importee}`);
serverPluginHmr_1.ensureMapEntry(serverPluginHmr_1.importerMap, importee).add(importer);
if (importee !== importer) {
currentImportees.add(importee);
serverPluginHmr_1.debugHmr(` ${importer} imports ${importee}`);
serverPluginHmr_1.ensureMapEntry(serverPluginHmr_1.importerMap, importee).add(importer);
}
}

@@ -173,0 +178,0 @@ else {

@@ -5,3 +5,3 @@ /// <reference types="node" />

import LRUCache from 'lru-cache';
export declare const styleSrcImportMap: Map<any, any>;
export declare const srcImportMap: Map<any, any>;
interface CacheEntry {

@@ -8,0 +8,0 @@ descriptor?: SFCDescriptor;

@@ -19,3 +19,3 @@ "use strict";

const getEtag = require('etag');
exports.styleSrcImportMap = new Map();
exports.srcImportMap = new Map();
exports.vueCache = new lru_cache_1.default({

@@ -65,3 +65,2 @@ max: 65535

filename = await resolveSrcImport(styleBlock, ctx, resolver);
exports.styleSrcImportMap.set(filename, ctx.url);
}

@@ -84,3 +83,3 @@ const result = await compileSFCStyle(root, styleBlock, index, filename, publicPath);

watcher.on('change', (file) => {
const styleImport = exports.styleSrcImportMap.get(file);
const styleImport = exports.srcImportMap.get(file);
if (styleImport) {

@@ -109,2 +108,3 @@ exports.vueCache.del(file);

serverPluginHmr_1.ensureMapEntry(serverPluginHmr_1.importerMap, importee).add(ctx.path);
exports.srcImportMap.set(filename, ctx.url);
return filename;

@@ -111,0 +111,0 @@ }

import sfcCompiler from '@vue/compiler-sfc';
interface ResolvedVuePaths {
runtime: string;
vue: string;
'@vue/runtime-dom': string;
'@vue/runtime-core': string;
'@vue/reactivity': string;
'@vue/shared': string;
compiler: string;

@@ -5,0 +9,0 @@ version: string;

@@ -17,3 +17,3 @@ "use strict";

}
let runtimePath;
let runtimeDomPath;
let compilerPath;

@@ -26,3 +26,5 @@ let isLocal = true;

vueVersion = require(userVuePkg).version;
runtimePath = path_1.default.join(path_1.default.dirname(userVuePkg), 'dist/vue.runtime.esm-bundler.js');
// as long as vue is present,
// dom, core and reactivity are guarunteed to coexist
runtimeDomPath = resolve_from_1.default(root, '@vue/runtime-dom/dist/runtime-dom.esm-bundler.js');
// also resolve matching sfc compiler

@@ -49,3 +51,3 @@ try {

vueVersion = require('vue/package.json').version;
runtimePath = require.resolve('vue/dist/vue.runtime.esm-bundler.js');
runtimeDomPath = require.resolve('@vue/runtime-dom/dist/runtime-dom.esm-bundler.js');
compilerPath = require.resolve('@vue/compiler-sfc');

@@ -55,3 +57,7 @@ }

version: vueVersion,
runtime: runtimePath,
vue: runtimeDomPath,
'@vue/runtime-dom': runtimeDomPath,
'@vue/runtime-core': runtimeDomPath.replace(/runtime-dom/g, 'runtime-core'),
'@vue/reactivity': runtimeDomPath.replace(/runtime-dom/g, 'reactivity'),
'@vue/shared': runtimeDomPath.replace(/runtime-dom/g, 'shared'),
compiler: compilerPath,

@@ -58,0 +64,0 @@ isLocal,

{
"name": "vite",
"version": "0.11.5",
"version": "0.12.0",
"license": "MIT",

@@ -5,0 +5,0 @@ "author": "Evan You",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc