Comparing version 0.5.3 to 0.6.0-next.1
@@ -153,29 +153,13 @@ "use strict"; | ||
} | ||
class Groups { | ||
constructor() { | ||
this.groups = new Map(); | ||
class SourceInfo { | ||
handleSource(source) { | ||
this._workspaceRoot = vscode_uri_1.URI.parse(source.workspaceRoot).fsPath; | ||
} | ||
handleGroup(group) { | ||
this.groups.set(group.id, group); | ||
get workspaceRoot() { | ||
return this._workspaceRoot; | ||
} | ||
handleGroupBegin(event) { | ||
const group = this.groups.get(event.data); | ||
if (group === undefined) { | ||
this._activeProjectRoot = undefined; | ||
} | ||
else { | ||
this._activeProjectRoot = paths.normalizePath(vscode_uri_1.URI.parse(group.rootUri).fsPath); | ||
} | ||
} | ||
handleGroupEnd(event) { | ||
this._activeProjectRoot = undefined; | ||
this.groups.delete(event.data); | ||
} | ||
get activeProjectRoot() { | ||
return this._activeProjectRoot; | ||
} | ||
} | ||
class ExportLinker { | ||
constructor(groups, packageJson, queue) { | ||
this.groups = groups; | ||
constructor(source, packageJson, queue) { | ||
this.source = source; | ||
this.packageJson = packageJson; | ||
@@ -192,10 +176,10 @@ this.queue = queue; | ||
} | ||
const projectRoot = this.groups.activeProjectRoot; | ||
if (projectRoot === undefined) { | ||
const workspaceRoot = this.source.workspaceRoot; | ||
if (workspaceRoot === undefined) { | ||
return; | ||
} | ||
const tscMoniker = moniker_1.TscMoniker.parse(moniker.identifier); | ||
if (moniker_1.TscMoniker.hasPath(tscMoniker) && this.isPackaged(path.join(projectRoot, tscMoniker.path))) { | ||
if (moniker_1.TscMoniker.hasPath(tscMoniker) && this.isPackaged(path.join(workspaceRoot, tscMoniker.path))) { | ||
this.ensurePackageInformation(); | ||
const monikerPath = this.getMonikerPath(projectRoot, tscMoniker); | ||
const monikerPath = this.getMonikerPath(workspaceRoot, tscMoniker); | ||
let npmIdentifier; | ||
@@ -233,4 +217,4 @@ if (this.packageJson.main === monikerPath || this.packageJson.typings === monikerPath) { | ||
class ImportLinker { | ||
constructor(group, queue) { | ||
this.group = group; | ||
constructor(source, queue) { | ||
this.source = source; | ||
this.queue = queue; | ||
@@ -247,4 +231,4 @@ this.packageData = new Map(); | ||
} | ||
const projectRoot = this.group.activeProjectRoot; | ||
if (projectRoot === undefined) { | ||
const workspaceRoot = this.source.workspaceRoot; | ||
if (workspaceRoot === undefined) { | ||
return; | ||
@@ -260,3 +244,3 @@ } | ||
const packageIndex = i + (parts[i + 1].startsWith('@') ? 3 : 2); | ||
packagePath = path.join(projectRoot, ...parts.slice(0, packageIndex), `package.json`); | ||
packagePath = path.join(workspaceRoot, ...parts.slice(0, packageIndex), `package.json`); | ||
monikerPath = parts.slice(packageIndex).join('/'); | ||
@@ -348,8 +332,8 @@ break; | ||
const queue = new AttachQueue(emit); | ||
const groups = new Groups(); | ||
const sourceInfo = new SourceInfo(); | ||
let exportLinker; | ||
if (packageJson !== undefined) { | ||
exportLinker = new ExportLinker(groups, packageJson, queue); | ||
exportLinker = new ExportLinker(sourceInfo, packageJson, queue); | ||
} | ||
const importLinker = new ImportLinker(groups, queue); | ||
const importLinker = new ImportLinker(sourceInfo, queue); | ||
let input = process.stdin; | ||
@@ -381,15 +365,7 @@ if (options.in !== undefined && fs.existsSync(options.in)) { | ||
break; | ||
case lsif_protocol_1.VertexLabels.group: | ||
groups.handleGroup(element); | ||
case lsif_protocol_1.VertexLabels.source: | ||
sourceInfo.handleSource(element); | ||
break; | ||
case lsif_protocol_1.VertexLabels.event: | ||
queue.duplicateEvent(element); | ||
if (element.scope === lsif_protocol_1.EventScope.group) { | ||
if (element.kind === lsif_protocol_1.EventKind.begin) { | ||
groups.handleGroupBegin(element); | ||
} | ||
else { | ||
groups.handleGroupEnd(element); | ||
} | ||
} | ||
break; | ||
@@ -396,0 +372,0 @@ } |
{ | ||
"name": "lsif-npm", | ||
"description": "A tools to rewrite Typescript LSIF monikers into npm monikers", | ||
"version": "0.5.3", | ||
"version": "0.6.0-next.1", | ||
"author": "Microsoft Corporation", | ||
@@ -20,6 +20,6 @@ "license": "MIT", | ||
"dependencies": { | ||
"lsif-protocol": "0.5.3", | ||
"yargs": "16.2.0", | ||
"lsif-protocol": "0.6.0-next.1", | ||
"uuid": "^8.3.2", | ||
"vscode-uri": "^3.0.2" | ||
"vscode-uri": "^3.0.2", | ||
"yargs": "16.2.0" | ||
}, | ||
@@ -26,0 +26,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
220236
781
+ Addedlsif-protocol@0.6.0-next.1(transitive)
- Removedlsif-protocol@0.5.3(transitive)
Updatedlsif-protocol@0.6.0-next.1