@@ -92,10 +92,26 @@ for await (const { path } of walk("_npm", { exts: [".js"] })) {
9292 Deno . writeTextFile ( path , code . replaceAll ( / \. t s " ; / g, '.js";' ) ) ;
9393}
9494
95+ // Some fine-tuning replacements: https://github.com/ventojs/vento/issues/174
96+ const replacements = new Map < string , string > ( [
97+ [
98+ 'import { type Token } from "./tokenizer.d.ts";' ,
99+ 'import type { Token } from "./tokenizer.d.ts";' ,
100+ ] ,
101+ [
102+ 'import { Environment, type Loader } from "./core/environment.d.ts";' ,
103+ 'import type { Environment, Loader } from "./core/environment.d.ts";' ,
104+ ] ,
105+ ] ) ;
106+
95107// Replace .ts extensions with .d.ts in the imports of TypeScript files
96108for await ( const { path } of walk ( "_npm" , { exts : [ ".ts" ] } ) ) {
97- const code = await Deno . readTextFile ( path ) ;
98- Deno . writeTextFile ( path , code . replaceAll ( / \. t s " ; / g, '.d.ts";' ) ) ;
109+ let code = Deno . readTextFileSync ( path ) . replaceAll ( / \. t s " ; / g, '.d.ts";' ) ;
110+ for ( const [ search , replace ] of replacements ) {
111+ code = code . replace ( search , replace ) ;
112+ }
113+
114+ Deno . writeTextFile ( path , code ) ;
99115}
100116
101117// Remove the TypeScript files
0 commit comments