Skip to content

Commit

Permalink
Address review
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesnw committed Dec 4, 2023
1 parent 5a5cfd2 commit b3f5414
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions lib/src/importer-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,19 @@ export class ImporterRegistry<sync extends 'sync' | 'async'> {
/** Converts an importer to a proto without adding it to `this.importers`. */
register(
importer: Importer<sync> | FileImporter<sync> | NodePackageImporter,
_entryPointURL?: string | URL
providedEntryPointURL?: string | URL
): proto.InboundMessage_CompileRequest_Importer {
const message = new proto.InboundMessage_CompileRequest_Importer();
if (typeof importer === 'symbol') {
if (importer !== nodePackageImporter) {
throw 'Incorrect Node Package Importer used';
throw 'Unknown importer ${importer}';
}
const importerMessage = new proto.NodePackageImporter();
let entryPointURL = _entryPointURL ?? require.main?.filename;
let entryPointURL = providedEntryPointURL ?? require.main?.filename;
entryPointURL = entryPointURL?.toString();
if (entryPointURL === legacyImporterProtocol)
if (entryPointURL === legacyImporterProtocol){

Check failure on line 67 in lib/src/importer-registry.ts

View workflow job for this annotation

GitHub Actions / Static analysis

Insert `·`
entryPointURL = require.main?.filename;
}

if (!entryPointURL) {
throw new Error(
Expand Down
2 changes: 1 addition & 1 deletion lib/src/legacy/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ function convertOptions<sync extends 'sync' | 'async'>(
};

// Use separate return statements, as applying logic directly to the inclusion
// of `nodePackageImporter` causes the symbol to use its unique flag.
// of `nodePackageImporter` causes the symbol to lose its unique flag.
// See https://github.com/microsoft/TypeScript/issues/55901
if (options.pkgImporter === 'node') {
importers = importers || [];
Expand Down

0 comments on commit b3f5414

Please sign in to comment.