@@ -698,7 +698,7 @@ fun manage(
698
698
if (bc.env.verbose) {
699
699
print_string(">> Copy types declaration files.");
700
700
};
701
- declFiles.each(f -> copyToDir(f, distDir, ".mjs" ));
701
+ declFiles.each(f -> copyToDir(f, distDir));
702
702
srcDir = Path.join(npmDir, "src");
703
703
checkDir(srcDir);
704
704
if (bc.env.verbose) {
@@ -708,7 +708,7 @@ fun manage(
708
708
tsDir,
709
709
f -> f.endsWith(".ts"),
710
710
_f -> false,
711
- ).each(f -> copyToDir(f, srcDir, "" ));
711
+ ).each(f -> copyToDir(f, srcDir));
712
712
if (bc.env.verbose) {
713
713
print_string(">> Manage license and package files.");
714
714
};
@@ -825,25 +825,23 @@ fun tsc(tsDir: String, link: ?(String, String), verbose: Bool): void {
825
825
Skargo.run(Array["tsc", "--project", tsconfig], verbose);
826
826
}
827
827
828
- fun copyToDir(tsFile: String, dir: String, ext: String = ".ts" ): void {
828
+ fun copyToDir(tsFile: String, dir: String): void {
829
829
contents = FileSystem.readTextFile(tsFile);
830
830
target = Path.join(dir, Path.basename(tsFile));
831
831
lines = contents.split("\n").map(line -> {
832
- if (line.startsWith("import ") || line.startsWith("export {")) {
832
+ if (
833
+ line.startsWith("import ") ||
834
+ line.startsWith("export {") ||
835
+ line.startsWith("export type {")
836
+ ) {
833
837
elements = line.split(" from ");
834
838
if (elements.size() == 2) {
835
839
imported = elements[1].split("\"");
836
840
if (imported.size() == 3) {
837
841
elems = imported[1].split("/");
838
842
size = elems.size();
839
843
if (size > 1 && elems[0].startsWith("#")) {
840
- !elems = elems.mapWithIndex((idx, v) ->
841
- if (idx == 0) "." else if (idx == size - 1) {
842
- `${v}${ext}`
843
- } else {
844
- v
845
- }
846
- );
844
+ !elems = elems.mapWithIndex((idx, v) -> if (idx == 0) "." else v);
847
845
!line = `${elements[0]} from "${elems.join("/")}"`
848
846
}
849
847
}
0 commit comments