Skip to content

Commit aa0c551

Browse files
committed
fix(vscode): add missing reactive analysis plugin entry
1 parent a1f0e8c commit aa0c551

1 file changed

Lines changed: 22 additions & 7 deletions

File tree

extensions/vscode/src/extension.ts

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -246,16 +246,16 @@ function resolveTsdkPath() {
246246
}
247247

248248
function resolveServerPath() {
249-
const pluginDir = path.join(__dirname, '..', 'node_modules', 'vue-typescript-plugin-pack');
250-
const pluginFile = path.join(pluginDir, 'index.js');
249+
const tsPluginDir = path.join(__dirname, '..', 'node_modules', 'vue-typescript-plugin-pack');
250+
const tsPluginEntry = path.join(tsPluginDir, 'index.js');
251251

252-
if (!fs.existsSync(pluginDir)) {
253-
fs.mkdirSync(pluginDir, { recursive: true });
252+
if (!fs.existsSync(tsPluginDir)) {
253+
fs.mkdirSync(tsPluginDir, { recursive: true });
254254
}
255255

256256
if (!config.server.path) {
257257
fs.writeFileSync(
258-
pluginFile,
258+
tsPluginEntry,
259259
`try { module.exports = require("../@vue/typescript-plugin"); } catch { module.exports = require("../../dist/typescript-plugin.js"); }`,
260260
);
261261
return;
@@ -264,7 +264,7 @@ function resolveServerPath() {
264264
if (path.isAbsolute(config.server.path)) {
265265
const entryFile = require.resolve('./index.js', { paths: [config.server.path] });
266266
const tsPluginPath = require.resolve('@vue/typescript-plugin', { paths: [path.dirname(entryFile)] });
267-
fs.writeFileSync(pluginFile, `module.exports = require(${JSON.stringify(tsPluginPath)});`);
267+
fs.writeFileSync(tsPluginEntry, `module.exports = require(${JSON.stringify(tsPluginPath)});`);
268268
return entryFile;
269269
}
270270

@@ -276,7 +276,7 @@ function resolveServerPath() {
276276
const serverPath = path.join(uri.fsPath, config.server.path);
277277
const entryFile = require.resolve('./index.js', { paths: [serverPath] });
278278
const tsPluginPath = require.resolve('@vue/typescript-plugin', { paths: [path.dirname(entryFile)] });
279-
fs.writeFileSync(pluginFile, `module.exports = require(${JSON.stringify(tsPluginPath)});`);
279+
fs.writeFileSync(tsPluginEntry, `module.exports = require(${JSON.stringify(tsPluginPath)});`);
280280
return entryFile;
281281
}
282282
catch {}
@@ -295,6 +295,21 @@ function patchTypeScriptExtension() {
295295
const { publisher, name } = require('../package.json');
296296
const vueExtension = vscode.extensions.getExtension(`${publisher}.${name}`)!;
297297
const tsPluginName = 'vue-typescript-plugin-pack';
298+
const reactiveAnalysisPluginEntry = path.join(
299+
__dirname,
300+
'..',
301+
'node_modules',
302+
'vue-reactivity-analysis-plugin-pack',
303+
'index.js',
304+
);
305+
306+
if (!fs.existsSync(reactiveAnalysisPluginEntry)) {
307+
fs.mkdirSync(path.dirname(reactiveAnalysisPluginEntry), { recursive: true });
308+
fs.writeFileSync(
309+
reactiveAnalysisPluginEntry,
310+
`try { module.exports = require("../../out/reactivityAnalysisPlugin.js"); } catch { module.exports = require("../../dist/reactivity-analysis-plugin.js"); }`,
311+
);
312+
}
298313

299314
vueExtension.packageJSON.contributes.typescriptServerPlugins = [
300315
{

0 commit comments

Comments
 (0)