@douyinfe/semi-mcp 1.0.14 → 1.0.15

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/dist/http.js CHANGED
@@ -8,6 +8,7 @@ import { fileURLToPath } from "url";
8
8
  import { dirname, join as external_path_join } from "path";
9
9
  import { homedir } from "os";
10
10
  import { mkdir, readFile, writeFile } from "fs/promises";
11
+ import { lt } from "semver";
11
12
  import { parseSync } from "oxc-parser";
12
13
  function getCacheDir() {
13
14
  return external_path_join(homedir(), '.semi-mcp', 'cache');
@@ -45,6 +46,7 @@ async function writeCache(cacheDir, key, content) {
45
46
  await writeFile(filePath, content, 'utf-8');
46
47
  } catch {}
47
48
  }
49
+ const MIN_SUPPORTED_VERSION = '2.90.2';
48
50
  function getVersionCacheDir() {
49
51
  return external_path_join(getCacheDir(), 'version');
50
52
  }
@@ -80,7 +82,8 @@ async function fetchVersionFromRegistry(packageName, tag) {
80
82
  throw new Error(`无法获取 ${packageName}@${tag} 的版本号: ${lastError?.message}`);
81
83
  }
82
84
  async function resolveVersion(packageName, version) {
83
- if (/^\d+\.\d+\.\d+/.test(version)) return version;
85
+ if (/^\d+\.\d+\.\d+/.test(version)) if (!lt(version, MIN_SUPPORTED_VERSION)) return version;
86
+ else version = 'latest';
84
87
  const cacheDir = getVersionCacheDir();
85
88
  const cacheKey = getVersionCacheKey(packageName, version);
86
89
  const today = getCurrentDate();
package/dist/index.js CHANGED
@@ -7,6 +7,7 @@ import { fileURLToPath } from "url";
7
7
  import { dirname, join as external_path_join } from "path";
8
8
  import { homedir } from "os";
9
9
  import { mkdir, readFile, writeFile } from "fs/promises";
10
+ import { lt } from "semver";
10
11
  import { parseSync } from "oxc-parser";
11
12
  function getCacheDir() {
12
13
  return external_path_join(homedir(), '.semi-mcp', 'cache');
@@ -44,6 +45,7 @@ async function writeCache(cacheDir, key, content) {
44
45
  await writeFile(filePath, content, 'utf-8');
45
46
  } catch {}
46
47
  }
48
+ const MIN_SUPPORTED_VERSION = '2.90.2';
47
49
  function getVersionCacheDir() {
48
50
  return external_path_join(getCacheDir(), 'version');
49
51
  }
@@ -79,7 +81,8 @@ async function fetchVersionFromRegistry(packageName, tag) {
79
81
  throw new Error(`无法获取 ${packageName}@${tag} 的版本号: ${lastError?.message}`);
80
82
  }
81
83
  async function resolveVersion(packageName, version) {
82
- if (/^\d+\.\d+\.\d+/.test(version)) return version;
84
+ if (/^\d+\.\d+\.\d+/.test(version)) if (!lt(version, MIN_SUPPORTED_VERSION)) return version;
85
+ else version = 'latest';
83
86
  const cacheDir = getVersionCacheDir();
84
87
  const cacheKey = getVersionCacheKey(packageName, version);
85
88
  const today = getCurrentDate();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-mcp",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "description": "Semi Design MCP Server - Model Context Protocol server for Semi Design components and documentation",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -51,7 +51,8 @@
51
51
  "dependencies": {
52
52
  "@modelcontextprotocol/sdk": "^1.25.1",
53
53
  "@swc/core": "^1.15.8",
54
- "oxc-parser": "^0.106.0"
54
+ "oxc-parser": "^0.106.0",
55
+ "semver": "^7.7.3"
55
56
  },
56
57
  "devDependencies": {
57
58
  "@rslib/core": "^0.18.5",