Skip to content

Commit

Permalink
chore(internal): fix deno build (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot authored and cleb11 committed Aug 1, 2023
1 parent 8117843 commit 660c841
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions scripts/denoify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ function denoify() {
// convert self-referencing module specifiers to relative paths
specifier = file.getRelativePathAsModuleSpecifierTo(denoDir + specifier.substring(pkgName.length));
} else if (!decl.isModuleSpecifierRelative()) {
continue;
specifier = `npm:${specifier}`;
}

if (decl.isModuleSpecifierRelative()) {
if (specifier.startsWith('./') || specifier.startsWith('../')) {
// there may be CJS directory module specifiers that implicitly resolve
// to /index.ts. Add an explicit /index.ts to the end
const sourceFile = decl.getModuleSpecifierSourceFile();
Expand All @@ -38,9 +38,9 @@ function denoify() {
) {
specifier += '/' + path.basename(sourceFile.getFilePath());
}
// add explicit .ts file extensions to relative module specifiers
specifier = specifier.replace(/(\.[^./]*)?$/, '.ts');
}
// add explicit .ts file extensions to relative module specifiers
specifier = specifier.replace(/(\.[^./]*)?$/, '.ts');
moduleSpecifier.replaceWithText(JSON.stringify(specifier));
}

Expand Down

0 comments on commit 660c841

Please sign in to comment.