@volar/typescript 1.10.0 → 1.10.2

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.
@@ -1,2 +1,3 @@
1
1
  import type * as ts from 'typescript/lib/tsserverlibrary';
2
2
  export declare function getDocumentRegistry(ts: typeof import('typescript/lib/tsserverlibrary'), useCaseSensitiveFileNames: boolean, currentDirectory: string): ts.DocumentRegistry;
3
+ //# sourceMappingURL=documentRegistry.d.ts.map
@@ -1,3 +1,4 @@
1
1
  import type * as ts from 'typescript/lib/tsserverlibrary';
2
2
  import type * as embedded from '@volar/language-core';
3
3
  export declare function getProgram(ts: typeof import('typescript/lib/tsserverlibrary'), core: embedded.LanguageContext, ls: ts.LanguageService, sys: ts.System): ts.Program;
4
+ //# sourceMappingURL=getProgram.d.ts.map
package/out/index.d.ts CHANGED
@@ -4,3 +4,4 @@ export * from './languageServiceHost';
4
4
  export * from './sys';
5
5
  export * from './getProgram';
6
6
  export * from './serverPlugin';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,4 @@
1
1
  import { VirtualFiles } from '@volar/language-core';
2
2
  import type * as ts from 'typescript/lib/tsserverlibrary';
3
3
  export declare function decorateLanguageService(virtualFiles: VirtualFiles, languageService: ts.LanguageService, isTsPlugin: boolean): void;
4
+ //# sourceMappingURL=languageService.d.ts.map
@@ -4,3 +4,4 @@ import { ServiceEnvironment } from '@volar/language-service';
4
4
  export declare function createLanguageServiceHost(ctx: LanguageContext, ts: typeof import('typescript/lib/tsserverlibrary'), sys: ts.System & {
5
5
  version?: number;
6
6
  }, env: ServiceEnvironment | undefined): ts.LanguageServiceHost;
7
+ //# sourceMappingURL=languageServiceHost.d.ts.map
@@ -8,6 +8,7 @@ function createLanguageServiceHost(ctx, ts, sys, env) {
8
8
  let lastProjectVersion;
9
9
  let tsProjectVersion = 0;
10
10
  let tsFileNames = [];
11
+ let tsDirectories = new Set();
11
12
  const _tsHost = {
12
13
  ...sys,
13
14
  getCurrentDirectory: () => ctx.host.workspacePath,
@@ -144,6 +145,11 @@ function createLanguageServiceHost(ctx, ts, sys, env) {
144
145
  }
145
146
  }
146
147
  tsFileNames = [...tsFileNamesSet];
148
+ // Update tsDirectories for `directoryExists()`
149
+ tsDirectories.clear();
150
+ for (const fileName of tsFileNames) {
151
+ tsDirectories.add(path_1.posix.dirname(normalizePath(fileName)));
152
+ }
147
153
  }
148
154
  function readDirectory(dirName, extensions, excludes, includes, depth) {
149
155
  let matches = (0, utilities_1.matchFiles)(dirName, extensions, excludes, includes, sys?.useCaseSensitiveFileNames ?? false, ctx.host.workspacePath, depth, (dirPath) => {
@@ -235,8 +241,7 @@ function createLanguageServiceHost(ctx, ts, sys, env) {
235
241
  return sys.getModifiedTime?.(fileName)?.valueOf().toString() ?? '';
236
242
  }
237
243
  function directoryExists(dirName) {
238
- return sys.directoryExists(dirName)
239
- || tsFileNames.some(fileName => fileName.toLowerCase().startsWith(dirName.toLowerCase()));
244
+ return tsDirectories.has(normalizePath(dirName)) || sys.directoryExists(dirName);
240
245
  }
241
246
  function fileExists(fileName) {
242
247
  // fill external virtual files
@@ -288,4 +293,7 @@ function forEachEmbeddedFile(file, cb) {
288
293
  forEachEmbeddedFile(embeddedFile, cb);
289
294
  }
290
295
  }
296
+ function normalizePath(fileName) {
297
+ return fileName.replace(/\\/g, '/').toLowerCase();
298
+ }
291
299
  //# sourceMappingURL=languageServiceHost.js.map
@@ -2,3 +2,4 @@ import { VirtualFiles } from '@volar/language-core';
2
2
  import type * as ts from 'typescript/lib/tsserverlibrary';
3
3
  export declare function decorateLanguageServiceHost(virtualFiles: VirtualFiles, languageServiceHost: ts.LanguageServiceHost, ts: typeof import('typescript/lib/tsserverlibrary'), exts: string[]): void;
4
4
  export declare function getExternalFiles(ts: typeof import('typescript/lib/tsserverlibrary'), project: ts.server.Project, exts: string[]): string[];
5
+ //# sourceMappingURL=serverPlugin.d.ts.map
package/out/sys.d.ts CHANGED
@@ -4,3 +4,4 @@ export declare function createSys(ts: typeof import('typescript/lib/tsserverlibr
4
4
  version: number;
5
5
  sync(): Promise<number>;
6
6
  } & Disposable;
7
+ //# sourceMappingURL=sys.d.ts.map
package/out/sys.js CHANGED
@@ -9,8 +9,8 @@ function createSys(ts, env) {
9
9
  const rootPath = env.uriToFileName(env.workspaceUri.toString());
10
10
  const sys = ts.sys;
11
11
  const root = {
12
- dirs: {},
13
- files: {},
12
+ dirs: new Map(),
13
+ files: new Map(),
14
14
  requestedRead: false,
15
15
  };
16
16
  const promises = new Set();
@@ -20,10 +20,10 @@ function createSys(ts, env) {
20
20
  const dirName = path_1.posix.dirname(fileName);
21
21
  const baseName = path_1.posix.basename(fileName);
22
22
  const dir = getDir(dirName);
23
- if (dir.files[baseName]) { // is requested file
23
+ if (dir.files.has(baseName)) { // is requested file
24
24
  version++;
25
25
  if (change.type === 1 || change.type === 2) {
26
- dir.files[baseName] = {
26
+ dir.files.set(baseName, {
27
27
  stat: {
28
28
  type: 1,
29
29
  ctime: Date.now(),
@@ -31,15 +31,15 @@ function createSys(ts, env) {
31
31
  size: -1,
32
32
  },
33
33
  requestedStat: false,
34
- };
34
+ });
35
35
  }
36
36
  else if (change.type === 3) {
37
- dir.files[baseName] = {
37
+ dir.files.set(baseName, {
38
38
  stat: undefined,
39
39
  text: undefined,
40
40
  requestedStat: true,
41
41
  requestedText: true,
42
- };
42
+ });
43
43
  }
44
44
  }
45
45
  }
@@ -99,7 +99,7 @@ function createSys(ts, env) {
99
99
  const dir = getDir(dirPath);
100
100
  const name = path_1.posix.basename(fileName);
101
101
  readFileWorker(fileName, encoding, dir);
102
- return dir.files[name]?.text;
102
+ return dir.files.get(name)?.text;
103
103
  }
104
104
  function directoryExists(dirName) {
105
105
  dirName = resolvePath(dirName);
@@ -168,7 +168,10 @@ function createSys(ts, env) {
168
168
  const dirPath = path_1.posix.dirname(fileName);
169
169
  const baseName = path_1.posix.basename(fileName);
170
170
  const dir = getDir(dirPath);
171
- const file = dir.files[baseName] ??= {};
171
+ let file = dir.files.get(baseName);
172
+ if (!file) {
173
+ dir.files.set(baseName, file = {});
174
+ }
172
175
  return file;
173
176
  }
174
177
  // for import path completion
@@ -176,7 +179,7 @@ function createSys(ts, env) {
176
179
  dirName = resolvePath(dirName);
177
180
  readDirectoryWorker(dirName);
178
181
  const dir = getDir(dirName);
179
- return [...Object.entries(dir.dirs)].filter(([_, dir]) => dir.exists).map(([name]) => name);
182
+ return [...dir.dirs.entries()].filter(([_, dir]) => dir.exists).map(([name]) => name);
180
183
  }
181
184
  function readDirectory(dirName, extensions, excludes, includes, depth) {
182
185
  dirName = resolvePath(dirName);
@@ -185,16 +188,18 @@ function createSys(ts, env) {
185
188
  readDirectoryWorker(dirPath);
186
189
  const dir = getDir(dirPath);
187
190
  return {
188
- files: [...Object.entries(dir.files)].filter(([_, file]) => file.stat?.type === 1).map(([name]) => name),
189
- directories: [...Object.entries(dir.dirs)].filter(([_, dir]) => dir.exists).map(([name]) => name),
191
+ files: [...dir.files.entries()].filter(([_, file]) => file.stat?.type === 1).map(([name]) => name),
192
+ directories: [...dir.dirs.entries()].filter(([_, dir]) => dir.exists).map(([name]) => name),
190
193
  };
191
194
  }, sys?.realpath ? (path => sys.realpath(path)) : (path => path));
192
195
  return [...new Set(matches)];
193
196
  }
194
197
  function readFileWorker(fileName, encoding, dir) {
195
198
  const name = path_1.posix.basename(fileName);
196
- dir.files[name] ??= {};
197
- const file = dir.files[name];
199
+ let file = dir.files.get(name);
200
+ if (!file) {
201
+ dir.files.set(name, file = {});
202
+ }
198
203
  if (file.requestedText) {
199
204
  return;
200
205
  }
@@ -254,9 +259,11 @@ function createSys(ts, env) {
254
259
  stat.then((stat) => {
255
260
  promises.delete(promise);
256
261
  if (stat?.type === 1) {
257
- dir.files[name] ??= {};
258
- const file = dir.files[name];
259
- if (stat.type !== file.stat?.type || stat.mtime !== file.stat.mtime) {
262
+ let file = dir.files.get(name);
263
+ if (!file) {
264
+ dir.files.set(name, file = {});
265
+ }
266
+ if (stat.type !== file.stat?.type || stat.mtime !== file.stat?.mtime) {
260
267
  version++;
261
268
  }
262
269
  file.stat = stat;
@@ -276,9 +283,12 @@ function createSys(ts, env) {
276
283
  }
277
284
  }
278
285
  if (fileType === 1) {
279
- dir.files[name] ??= {};
280
- if (!dir.files[name].stat) {
281
- dir.files[name].stat = {
286
+ let file = dir.files.get(name);
287
+ if (!file) {
288
+ dir.files.set(name, file = {});
289
+ }
290
+ if (!file.stat) {
291
+ file.stat = {
282
292
  type: 1,
283
293
  mtime: 0,
284
294
  ctime: 0,
@@ -316,13 +326,12 @@ function createSys(ts, env) {
316
326
  return currentDir;
317
327
  }
318
328
  function getDirFromDir(dir, name) {
319
- let target = dir.dirs[name];
329
+ let target = dir.dirs.get(name);
320
330
  if (!target) {
321
- target = {
322
- dirs: {},
323
- files: {},
324
- };
325
- dir.dirs[name] = target;
331
+ dir.dirs.set(name, target = {
332
+ dirs: new Map(),
333
+ files: new Map(),
334
+ });
326
335
  }
327
336
  return target;
328
337
  }
@@ -81,3 +81,4 @@ type GetCanonicalFileName = (fileName: string) => string;
81
81
  export declare function createGetCanonicalFileName(useCaseSensitiveFileNames: boolean): GetCanonicalFileName;
82
82
  export declare function startsWith(str: string, prefix: string): boolean;
83
83
  export {};
84
+ //# sourceMappingURL=core.d.ts.map
@@ -89,3 +89,4 @@ export declare const enum Comparison {
89
89
  }
90
90
  export declare const Map: MapConstructor;
91
91
  export declare const Set: SetConstructor;
92
+ //# sourceMappingURL=corePublic.d.ts.map
@@ -110,3 +110,4 @@ export declare function removeTrailingDirectorySeparator(path: string): string;
110
110
  */
111
111
  export declare function containsPath(parent: string, child: string, ignoreCase?: boolean): boolean;
112
112
  export declare function containsPath(parent: string, child: string, currentDirectory: string, ignoreCase?: boolean): boolean;
113
+ //# sourceMappingURL=path.d.ts.map
@@ -127,3 +127,4 @@ export declare const enum CharacterCodes {
127
127
  tab = 9,
128
128
  verticalTab = 11
129
129
  }
130
+ //# sourceMappingURL=types.d.ts.map
@@ -5,3 +5,4 @@ interface FileSystemEntries {
5
5
  /** @param path directory of the tsconfig.json */
6
6
  export declare function matchFiles(path: string, extensions: readonly string[] | undefined, excludes: readonly string[] | undefined, includes: readonly string[] | undefined, useCaseSensitiveFileNames: boolean, currentDirectory: string, depth: number | undefined, getFileSystemEntries: (path: string) => FileSystemEntries, realpath: (path: string) => string): string[];
7
7
  export {};
8
+ //# sourceMappingURL=utilities.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volar/typescript",
3
- "version": "1.10.0",
3
+ "version": "1.10.2",
4
4
  "main": "out/index.js",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -13,10 +13,10 @@
13
13
  "directory": "packages/typescript"
14
14
  },
15
15
  "dependencies": {
16
- "@volar/language-core": "1.10.0"
16
+ "@volar/language-core": "1.10.2"
17
17
  },
18
18
  "devDependencies": {
19
- "@volar/language-service": "1.10.0"
19
+ "@volar/language-service": "1.10.2"
20
20
  },
21
- "gitHead": "c25bdec20ee11d278049a738743c694431f08796"
21
+ "gitHead": "15d5e9129c034ef839f6b4646e495b5e80890764"
22
22
  }
package/out/dtsHost.d.ts DELETED
@@ -1,8 +0,0 @@
1
- import { FileSystem, ServiceEnvironment } from '@volar/language-service';
2
- export declare const jsDelivrUriBase = "https://cdn.jsdelivr.net/npm";
3
- export declare function decorateServiceEnvironment(env: ServiceEnvironment, jsDelivrUriResolver: ReturnType<typeof createJsDelivrUriResolver>, jsDelivrFs: FileSystem): void;
4
- export declare function createJsDelivrUriResolver(versions?: Record<string, string>, fileNameBase?: string): {
5
- uriToFileName: (uri: string) => string | undefined;
6
- fileNameToUri: (fileName: string) => string | undefined;
7
- };
8
- export declare function createJsDelivrFs(): FileSystem;
package/out/dtsHost.js DELETED
@@ -1,276 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createJsDelivrFs = exports.createJsDelivrUriResolver = exports.decorateServiceEnvironment = exports.jsDelivrUriBase = void 0;
4
- exports.jsDelivrUriBase = 'https://cdn.jsdelivr.net/npm';
5
- function decorateServiceEnvironment(env, jsDelivrUriResolver, jsDelivrFs) {
6
- const fileNameToUri = env.fileNameToUri;
7
- const uriToFileName = env.uriToFileName;
8
- const fs = env.fs;
9
- env.fileNameToUri = fileName => {
10
- return jsDelivrUriResolver.fileNameToUri(fileName) ?? fileNameToUri(fileName);
11
- };
12
- env.uriToFileName = fileName => {
13
- return jsDelivrUriResolver.uriToFileName(fileName) ?? uriToFileName(fileName);
14
- };
15
- env.fs = {
16
- stat(uri) {
17
- if (jsDelivrUriResolver.uriToFileName(uri)) {
18
- return jsDelivrFs.stat(uri);
19
- }
20
- return fs?.stat(uri);
21
- },
22
- readDirectory(uri) {
23
- if (jsDelivrUriResolver.uriToFileName(uri)) {
24
- return jsDelivrFs.readDirectory(uri);
25
- }
26
- return fs?.readDirectory(uri) ?? [];
27
- },
28
- readFile(uri) {
29
- if (jsDelivrUriResolver.uriToFileName(uri)) {
30
- return jsDelivrFs.readFile(uri);
31
- }
32
- return fs?.readFile(uri);
33
- },
34
- };
35
- }
36
- exports.decorateServiceEnvironment = decorateServiceEnvironment;
37
- function createJsDelivrUriResolver(versions = {}, fileNameBase = '/node_modules') {
38
- return {
39
- uriToFileName,
40
- fileNameToUri,
41
- };
42
- function uriToFileName(uri) {
43
- if (uri === exports.jsDelivrUriBase) {
44
- return fileNameBase;
45
- }
46
- if (uri.startsWith(exports.jsDelivrUriBase + '/')) {
47
- const path = uri.substring(exports.jsDelivrUriBase.length);
48
- const pkgName = getPackageName(path);
49
- if (pkgName?.substring(1).includes('@')) {
50
- const trimedVersion = pkgName.substring(0, pkgName.lastIndexOf('@'));
51
- return `${fileNameBase}${path.replace(pkgName, trimedVersion)}`;
52
- }
53
- return `${fileNameBase}${path}`;
54
- }
55
- }
56
- function fileNameToUri(fileName) {
57
- if (fileName === fileNameBase) {
58
- return exports.jsDelivrUriBase;
59
- }
60
- if (fileName.startsWith(fileNameBase + '/')) {
61
- const path = fileName.substring(fileNameBase.length);
62
- const pkgName = getPackageName(path);
63
- if (pkgName) {
64
- const version = versions[pkgName] ?? 'latest';
65
- return `${exports.jsDelivrUriBase}/${pkgName}@${version}${path.substring(1 + pkgName.length)}`;
66
- }
67
- return `${exports.jsDelivrUriBase}${path}`;
68
- }
69
- }
70
- }
71
- exports.createJsDelivrUriResolver = createJsDelivrUriResolver;
72
- function createJsDelivrFs() {
73
- const fetchResults = new Map();
74
- const flatResults = new Map();
75
- return {
76
- stat,
77
- readDirectory,
78
- readFile,
79
- };
80
- function stat(uri) {
81
- if (uri === exports.jsDelivrUriBase) {
82
- return {
83
- type: 2,
84
- size: -1,
85
- ctime: -1,
86
- mtime: -1,
87
- };
88
- }
89
- if (uri.startsWith(exports.jsDelivrUriBase + '/')) {
90
- const path = uri.substring(exports.jsDelivrUriBase.length);
91
- const pkgName = getPackageName(path);
92
- if (!pkgName || !isValidPackageNameSync(pkgName)) {
93
- return;
94
- }
95
- return (async () => {
96
- if (!await isValidPackageNameAsync(pkgName)) {
97
- return;
98
- }
99
- if (!flatResults.has(pkgName)) {
100
- flatResults.set(pkgName, flat(pkgName));
101
- }
102
- const flatResult = await flatResults.get(pkgName);
103
- const filePath = path.slice(`/${pkgName}`.length);
104
- const file = flatResult.find(file => file.name === filePath);
105
- if (file) {
106
- return {
107
- type: 1,
108
- ctime: new Date(file.time).valueOf(),
109
- mtime: new Date(file.time).valueOf(),
110
- size: file.size,
111
- };
112
- }
113
- else if (flatResult.some(file => file.name.startsWith(filePath + '/'))) {
114
- return {
115
- type: 2,
116
- ctime: -1,
117
- mtime: -1,
118
- size: -1,
119
- };
120
- }
121
- })();
122
- }
123
- }
124
- function readDirectory(uri) {
125
- if (uri.startsWith(exports.jsDelivrUriBase + '/')) {
126
- const path = uri.substring(exports.jsDelivrUriBase.length);
127
- const pkgName = getPackageName(path);
128
- if (!pkgName || !isValidPackageNameSync(pkgName)) {
129
- return [];
130
- }
131
- return (async () => {
132
- if (!await isValidPackageNameAsync(pkgName)) {
133
- return [];
134
- }
135
- if (!flatResults.has(pkgName)) {
136
- flatResults.set(pkgName, flat(pkgName));
137
- }
138
- const flatResult = await flatResults.get(pkgName);
139
- const dirPath = path.slice(`/${pkgName}`.length);
140
- const files = flatResult
141
- .filter(f => f.name.substring(0, f.name.lastIndexOf('/')) === dirPath)
142
- .map(f => f.name.slice(dirPath.length + 1));
143
- const dirs = flatResult
144
- .filter(f => f.name.startsWith(dirPath + '/') && f.name.substring(dirPath.length + 1).split('/').length >= 2)
145
- .map(f => f.name.slice(dirPath.length + 1).split('/')[0]);
146
- return [
147
- ...files.map(f => [f, 1]),
148
- ...[...new Set(dirs)].map(f => [f, 2]),
149
- ];
150
- })();
151
- }
152
- return [];
153
- }
154
- function readFile(uri) {
155
- if (uri.startsWith(exports.jsDelivrUriBase + '/')) {
156
- const path = uri.substring(exports.jsDelivrUriBase.length);
157
- const pkgName = getPackageName(path);
158
- if (!pkgName || !isValidPackageNameSync(pkgName)) {
159
- return;
160
- }
161
- return (async () => {
162
- if (!await isValidPackageNameAsync(pkgName)) {
163
- return;
164
- }
165
- if (!fetchResults.has(path)) {
166
- fetchResults.set(path, (async () => {
167
- if ((await stat(uri))?.type !== 1) {
168
- return;
169
- }
170
- return await fetchText(uri);
171
- })());
172
- }
173
- return await fetchResults.get(path);
174
- })();
175
- }
176
- }
177
- async function flat(pkgNameWithVersion) {
178
- let pkgName = pkgNameWithVersion;
179
- let version = 'latest';
180
- if (pkgNameWithVersion.substring(1).includes('@')) {
181
- pkgName = pkgNameWithVersion.substring(0, pkgNameWithVersion.lastIndexOf('@'));
182
- version = pkgNameWithVersion.substring(pkgNameWithVersion.lastIndexOf('@') + 1);
183
- }
184
- // resolve tag version
185
- if (version === 'latest') {
186
- const data = await fetchJson(`https://data.jsdelivr.com/v1/package/resolve/npm/${pkgName}@latest`);
187
- if (!data?.version) {
188
- return [];
189
- }
190
- version = data.version;
191
- }
192
- const flat = await fetchJson(`https://data.jsdelivr.com/v1/package/npm/${pkgName}@${version}/flat`);
193
- if (!flat) {
194
- return [];
195
- }
196
- return flat.files;
197
- }
198
- function isValidPackageNameSync(pkgName) {
199
- if (pkgName.substring(1).includes('@')) {
200
- pkgName = pkgName.substring(0, pkgName.lastIndexOf('@'));
201
- }
202
- if (pkgName.indexOf('.') >= 0 || pkgName.endsWith('/node_modules')) {
203
- return false;
204
- }
205
- // hard code for known invalid package
206
- if (pkgName.startsWith('@typescript/') || pkgName.startsWith('@types/typescript__')) {
207
- return false;
208
- }
209
- return true;
210
- }
211
- async function isValidPackageNameAsync(pkgName) {
212
- if (pkgName.substring(1).includes('@')) {
213
- pkgName = pkgName.substring(0, pkgName.lastIndexOf('@'));
214
- }
215
- // don't check @types if original package already having types
216
- if (pkgName.startsWith('@types/')) {
217
- let originalPkgName = pkgName.slice('@types/'.length);
218
- if (originalPkgName.indexOf('__') >= 0) {
219
- originalPkgName = '@' + originalPkgName.replace('__', '/');
220
- }
221
- const packageJson = await readFile(`${exports.jsDelivrUriBase}/${originalPkgName}/package.json`);
222
- if (packageJson) {
223
- const packageJsonObj = JSON.parse(packageJson);
224
- if (packageJsonObj.types || packageJsonObj.typings) {
225
- return false;
226
- }
227
- const indexDts = await stat(`${exports.jsDelivrUriBase}/${originalPkgName}/index.d.ts`);
228
- if (indexDts?.type === 1) {
229
- return false;
230
- }
231
- }
232
- }
233
- return true;
234
- }
235
- }
236
- exports.createJsDelivrFs = createJsDelivrFs;
237
- async function fetchText(url) {
238
- try {
239
- const res = await fetch(url);
240
- if (res.status === 200) {
241
- return await res.text();
242
- }
243
- }
244
- catch {
245
- // ignore
246
- }
247
- }
248
- async function fetchJson(url) {
249
- try {
250
- const res = await fetch(url);
251
- if (res.status === 200) {
252
- return await res.json();
253
- }
254
- }
255
- catch {
256
- // ignore
257
- }
258
- }
259
- /**
260
- * @example
261
- * "/a/b/c" -> "a"
262
- * "/@a/b/c" -> "@a/b"
263
- * "/@a/b@1.2.3/c" -> "@a/b@1.2.3"
264
- */
265
- function getPackageName(path) {
266
- const parts = path.split('/');
267
- let pkgName = parts[1];
268
- if (pkgName.startsWith('@')) {
269
- if (parts.length < 3 || !parts[2]) {
270
- return undefined;
271
- }
272
- pkgName += '/' + parts[2];
273
- }
274
- return pkgName;
275
- }
276
- //# sourceMappingURL=dtsHost.js.map