@vue/typescript-plugin
Advanced tools
Comparing version 2.1.2 to 2.1.4
22
index.js
"use strict"; | ||
const createLanguageServicePlugin_1 = require("@volar/typescript/lib/quickstart/createLanguageServicePlugin"); | ||
const path = require("path"); | ||
const vue = require("@vue/language-core"); | ||
@@ -8,5 +9,9 @@ const common_1 = require("./lib/common"); | ||
const vueCompilerOptions = new WeakMap(); | ||
const setupedProjects = new WeakSet(); | ||
const basePlugin = (0, createLanguageServicePlugin_1.createLanguageServicePlugin)((ts, info) => { | ||
const vueOptions = getVueCompilerOptions(); | ||
const languagePlugin = vue.createVueLanguagePlugin(ts, info.languageServiceHost.getCompilationSettings(), vueOptions, id => id); | ||
const languagePlugin = vue.createVueLanguagePlugin(ts, info.languageServiceHost.getCompilationSettings(), { | ||
...vueOptions, | ||
__setupedGlobalTypes: () => setupedProjects.has(info.project), | ||
}, id => id); | ||
vueCompilerOptions.set(info.project, vueOptions); | ||
@@ -48,7 +53,14 @@ return { | ||
try { | ||
const libDir = require.resolve(`${options.lib}/package.json`, { paths: [proj.getCurrentDirectory()] }) | ||
.slice(0, -'package.json'.length); | ||
const globalTypesPath = `${libDir}dist/__globalTypes_${options.target}_${options.strictTemplates}.d.ts`; | ||
const globalTypesContents = vue.generateGlobalTypes(options.lib, options.target, options.strictTemplates); | ||
let dir = proj.getCurrentDirectory(); | ||
while (!proj.directoryExists(path.resolve(dir, 'node_modules'))) { | ||
const parentDir = path.resolve(dir, '..'); | ||
if (dir === parentDir) { | ||
throw 0; | ||
} | ||
dir = parentDir; | ||
} | ||
const globalTypesPath = path.resolve(dir, `node_modules/.vue-global-types/${options.lib}_${options.target}_${options.strictTemplates}.d.ts`); | ||
const globalTypesContents = vue.generateGlobalTypes('global', options.lib, options.target, options.strictTemplates); | ||
proj.writeFile(globalTypesPath, globalTypesContents); | ||
setupedProjects.add(proj); | ||
} | ||
@@ -55,0 +67,0 @@ catch { } |
{ | ||
"name": "@vue/typescript-plugin", | ||
"version": "2.1.2", | ||
"version": "2.1.4", | ||
"license": "MIT", | ||
@@ -16,3 +16,3 @@ "files": [ | ||
"@volar/typescript": "~2.4.1", | ||
"@vue/language-core": "2.1.2", | ||
"@vue/language-core": "2.1.4", | ||
"@vue/shared": "^3.4.0" | ||
@@ -23,3 +23,3 @@ }, | ||
}, | ||
"gitHead": "4e4b839ea20ae11a2aef7ee9206465cb60a4be53" | ||
"gitHead": "5e197d08eaef57209ff2927c943ba1db3bf4eff6" | ||
} |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
53736
1169
2
+ Added@vue/language-core@2.1.4(transitive)
- Removed@vue/language-core@2.1.2(transitive)
Updated@vue/language-core@2.1.4