deno.land / x / cannon_4_deno@v0.15.1.5 / main.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { walkSync } from "https://deno.land/std/fs/mod.ts";
// @ts-ignoreconst [errors, emitted] = await Deno.compile( "./src/cannon-es.ts", undefined, { lib: ["esnext"], },);
if (errors == null) { for (const obj in emitted) { const path = obj.split("/"); const filename = path.slice(8).join("/"); Deno.writeTextFileSync(`./${filename}`, emitted[obj]); }}
// then go through the src directory.// change all urls within .js files to reference the other .js filesfor (const entry of walkSync("./src")) { if (entry.isFile) { if (entry.name.endsWith("js")) { let data = Deno.readTextFileSync(entry.path); data = data.replaceAll(/\.ts/g, ".js"); data = data.replace( /^/, `/// <reference types="./${entry.name.split(".")[0]}.ts" />\n/// <reference lib="dom" />\n`, ); data = data.replace(/\/\/# sourceMappingURL=.+?map/g, ""); Deno.writeTextFileSync(entry.path, data); } else if (entry.name.endsWith("map")) { Deno.removeSync(entry.path); } else if (entry.name.endsWith("ts")) { let data = Deno.readTextFileSync(entry.path); data = data.replaceAll(/\/\/\/ <reference lib="dom" \/>\n/g, "") data = data.replace(/^/, `/// <reference lib="dom" />\n`); Deno.writeTextFileSync(entry.path, data); } }}
// fmt afterwardsDeno.run({ cmd: ["deno", "fmt"],});
cannon_4_deno

Version Info

Tagged at
3 years ago

External Dependencies

2 external dependencies