@volar/jsdelivr 2.4.0-alpha.10 → 2.4.0-alpha.12

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.
Files changed (2) hide show
  1. package/lib/npm.js +14 -13
  2. package/package.json +3 -3
package/lib/npm.js CHANGED
@@ -116,8 +116,8 @@ function createNpmFileSystem(getCdnPath = (uri) => {
116
116
  ];
117
117
  }
118
118
  async function _readFile(path) {
119
- const [_modName, pkgName] = resolvePackageName(path);
120
- if (!pkgName || !await isValidPackageName(pkgName)) {
119
+ const [_modName, pkgName, _version, pkgFilePath] = resolvePackageName(path);
120
+ if (!pkgName || !pkgFilePath || !await isValidPackageName(pkgName)) {
121
121
  return;
122
122
  }
123
123
  if (!fetchResults.has(path)) {
@@ -155,8 +155,8 @@ function createNpmFileSystem(getCdnPath = (uri) => {
155
155
  if (pkgName.endsWith('/node_modules')) {
156
156
  return false;
157
157
  }
158
- // hard code for known invalid package
159
- if (pkgName.startsWith('@typescript/') || pkgName.startsWith('@types/typescript__')) {
158
+ // hard code to skip known invalid package
159
+ if (pkgName.endsWith('.d.ts') || pkgName.startsWith('@typescript/') || pkgName.startsWith('@types/typescript__')) {
160
160
  return false;
161
161
  }
162
162
  // don't check @types if original package already having types
@@ -166,15 +166,16 @@ function createNpmFileSystem(getCdnPath = (uri) => {
166
166
  originalPkgName = '@' + originalPkgName.replace('__', '/');
167
167
  }
168
168
  const packageJson = await _readFile(`${originalPkgName}/package.json`);
169
- if (packageJson) {
170
- const packageJsonObj = JSON.parse(packageJson);
171
- if (packageJsonObj.types || packageJsonObj.typings) {
172
- return false;
173
- }
174
- const indexDts = await _stat(`${originalPkgName}/index.d.ts`);
175
- if (indexDts?.type === 1) {
176
- return false;
177
- }
169
+ if (!packageJson) {
170
+ return false;
171
+ }
172
+ const packageJsonObj = JSON.parse(packageJson);
173
+ if (packageJsonObj.types || packageJsonObj.typings) {
174
+ return false;
175
+ }
176
+ const indexDts = await _stat(`${originalPkgName}/index.d.ts`);
177
+ if (indexDts?.type === 1) {
178
+ return false;
178
179
  }
179
180
  }
180
181
  return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volar/jsdelivr",
3
- "version": "2.4.0-alpha.10",
3
+ "version": "2.4.0-alpha.12",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "**/*.js",
@@ -12,8 +12,8 @@
12
12
  "directory": "packages/jsdelivr"
13
13
  },
14
14
  "devDependencies": {
15
- "@volar/language-service": "2.4.0-alpha.10",
15
+ "@volar/language-service": "2.4.0-alpha.12",
16
16
  "vscode-uri": "^3.0.8"
17
17
  },
18
- "gitHead": "9f0cb9f2e41167baeb503e8f0eca88e9bea06269"
18
+ "gitHead": "9418f0c81cef5ca13b21bf43a49bef67c6cb2993"
19
19
  }