Skip to content

Commit f6eeb4a

Browse files
committed
Revert "fix: cjs declaration (#334)"
This reverts commit 622afe8.
1 parent 5f920b4 commit f6eeb4a

1 file changed

Lines changed: 0 additions & 13 deletions

File tree

commonjs.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,13 @@ function convertToCommonJs(filePath) {
1212
fs.renameSync(filePath, commonJsPath);
1313
}
1414

15-
function convertToCommonJsDeclaration(filePath) {
16-
// update imports
17-
const content = fs.readFileSync(filePath, 'utf-8');
18-
const updatedContent = content.replace(/(from ['"])(.*)(\.js)(['"];?)/g, '$1$2.cjs$4');
19-
fs.writeFileSync(filePath, updatedContent, 'utf-8');
20-
21-
// update file extension
22-
const commonJsDeclPath = filePath.replace(/\.d\.ts$/, '.d.cts');
23-
fs.renameSync(filePath, commonJsDeclPath);
24-
}
25-
2615
function walk(dir) {
2716
fs.readdirSync(dir).forEach(file => {
2817
const fullPath = path.join(dir, file);
2918
if (fs.lstatSync(fullPath).isDirectory()) {
3019
walk(fullPath);
3120
} else if (file.endsWith('.js')) {
3221
convertToCommonJs(fullPath);
33-
} else if (file.endsWith('.d.ts')) {
34-
convertToCommonJsDeclaration(fullPath);
3522
}
3623
});
3724
}

0 commit comments

Comments
 (0)