diff --git a/.gitignore b/.gitignore index 3d241e8..f0ccf1b 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ # sources !/src +!/scripts # builded !/lib diff --git a/lib/index.d.mts b/lib/index.d.mts deleted file mode 100644 index 0edde7f..0000000 --- a/lib/index.d.mts +++ /dev/null @@ -1,3 +0,0 @@ -export * from "./str.mjs"; -export * from "./nodes.mjs"; -export * from "./types.mjs"; diff --git a/lib/index.d.ts b/lib/index.d.ts new file mode 100644 index 0000000..d2c6477 --- /dev/null +++ b/lib/index.d.ts @@ -0,0 +1,3 @@ +export * from "./str.js"; +export * from "./nodes.js"; +export * from "./types.js"; diff --git a/lib/lang.d.mts b/lib/lang.d.ts similarity index 100% rename from lib/lang.d.mts rename to lib/lang.d.ts diff --git a/lib/nodes.d.mts b/lib/nodes.d.ts similarity index 96% rename from lib/nodes.d.mts rename to lib/nodes.d.ts index acbac54..4d0e114 100644 --- a/lib/nodes.d.mts +++ b/lib/nodes.d.ts @@ -1,4 +1,4 @@ -import { Nilable } from "./lang.mjs"; +import { Nilable } from "./lang.js"; export declare type AnyNode = AnySyncNode | AnyAsyncNode; export declare type AnyAsyncNode = Promise; export declare type AnySyncNode = TextNode | Elem | Frag; diff --git a/lib/str.d.mts b/lib/str.d.ts similarity index 61% rename from lib/str.d.mts rename to lib/str.d.ts index c97add4..e602328 100644 --- a/lib/str.d.mts +++ b/lib/str.d.ts @@ -1,5 +1,5 @@ -import { Renderer } from "./types.mjs"; -import { Elem } from "./nodes.mjs"; +import { Renderer } from "./types.js"; +import { Elem } from "./nodes.js"; export declare class StrRenderer implements Renderer { render(node: Elem | Promise): Promise; } diff --git a/lib/types.d.mts b/lib/types.d.ts similarity index 70% rename from lib/types.d.mts rename to lib/types.d.ts index fd25db7..3db235b 100644 --- a/lib/types.d.mts +++ b/lib/types.d.ts @@ -1,4 +1,4 @@ -import { Elem } from "./nodes.mjs"; +import { Elem } from "./nodes.js"; export interface Renderer { render(node: Elem | Promise): Promise; } diff --git a/makefile b/makefile index f01afd3..4631d09 100644 --- a/makefile +++ b/makefile @@ -1,9 +1,12 @@ ts: - npx tsc + npx tsc && make fix-decl ts-w: - npx tsc-watch + npx tsc-watch --onSuccess "make fix-decl" + +fix-decl: + ./scripts/fix_decl.sh clean: rm -rf lib diff --git a/package.json b/package.json index 4a26304..dc0ad92 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "description": "", "version": "0.0.1", "main": "lib/index.mjs", - "types": "lib/index.d.mts", + "types": "lib/index.d.ts", "directories": { "lib": "lib", "src": "src" diff --git a/scripts/fix_decl.sh b/scripts/fix_decl.sh new file mode 100755 index 0000000..abe6db6 --- /dev/null +++ b/scripts/fix_decl.sh @@ -0,0 +1,6 @@ +#!/bin/bash +for f in lib/*.d.mts; +do + sed -i 's/.mjs"/.js"/' "$f" + mv "$f" "${f//\.d\.mts/.d.ts}" +done diff --git a/tsconfig.json b/tsconfig.json index 33398dc..2724bb4 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -17,6 +17,6 @@ "noImplicitAny": true }, "include": [ - "src/**/*" + "src/**/*.mts" ], }