ms-types 0.11.5 → 0.11.6
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.
- package/package.json +1 -1
- package/ts-plugin/idea.cjs +3 -4
package/package.json
CHANGED
package/ts-plugin/idea.cjs
CHANGED
|
@@ -2,20 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
// IDEA 没有 typescriptServerPlugins,用 `-r` 预加载:在 JetBrains 的 tsc-ide-plugin 创建项目时,
|
|
4
4
|
// 对快点JS项目调用 index.cjs 的 inject。tsserver 进程是所有工程共用的,所以要先判断是不是快点JS项目:
|
|
5
|
-
//
|
|
5
|
+
// 从项目目录往上找快点JS项目:目录下有 package.json 和 scripts。和 ms-vite-plugin 的
|
|
6
|
+
// isValidKuaiJSProject 同一条规则,不看 package.json 的内容;VS Code / IDEA 插件的项目识别也是这条。
|
|
6
7
|
const fs = require('fs');
|
|
7
8
|
const path = require('path');
|
|
8
9
|
const Module = require('module');
|
|
9
10
|
const { inject } = require('./index.cjs');
|
|
10
11
|
|
|
11
|
-
const MS_SCRIPT = /\bms\s+(build|package)\b/;
|
|
12
12
|
const MAX_ASCEND = 4;
|
|
13
13
|
const projectCache = new Map();
|
|
14
14
|
|
|
15
15
|
function hasKuaiJsPackage(dir) {
|
|
16
16
|
try {
|
|
17
|
-
|
|
18
|
-
return ['dev', 'build', 'package'].some((key) => MS_SCRIPT.test(String(scripts[key] || '')));
|
|
17
|
+
return fs.existsSync(path.join(dir, 'package.json')) && fs.existsSync(path.join(dir, 'scripts'));
|
|
19
18
|
} catch (ignored) {
|
|
20
19
|
return false;
|
|
21
20
|
}
|