Skip to content

Commit 3fdab4e

Browse files
stainless-botrattrayalex
authored andcommitted
chore(internal): fix deno build (#96)
1 parent 2c6a699 commit 3fdab4e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

scripts/denoify.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ function denoify() {
2424
// convert self-referencing module specifiers to relative paths
2525
specifier = file.getRelativePathAsModuleSpecifierTo(denoDir + specifier.substring(pkgName.length));
2626
} else if (!decl.isModuleSpecifierRelative()) {
27-
continue;
27+
specifier = `npm:${specifier}`;
2828
}
2929

30-
if (decl.isModuleSpecifierRelative()) {
30+
if (specifier.startsWith('./') || specifier.startsWith('../')) {
3131
// there may be CJS directory module specifiers that implicitly resolve
3232
// to /index.ts. Add an explicit /index.ts to the end
3333
const sourceFile = decl.getModuleSpecifierSourceFile();
@@ -38,9 +38,9 @@ function denoify() {
3838
) {
3939
specifier += '/' + path.basename(sourceFile.getFilePath());
4040
}
41+
// add explicit .ts file extensions to relative module specifiers
42+
specifier = specifier.replace(/(\.[^./]*)?$/, '.ts');
4143
}
42-
// add explicit .ts file extensions to relative module specifiers
43-
specifier = specifier.replace(/(\.[^./]*)?$/, '.ts');
4444
moduleSpecifier.replaceWithText(JSON.stringify(specifier));
4545
}
4646

0 commit comments

Comments
 (0)