@irrelon/battlescript 3.1.4 → 3.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/functionality.ts +10 -0
- package/bin/index.js +407 -318
- package/bin/index.js.map +1 -1
- package/bin/index.ts +2 -0
- package/dist/bin/functionality.d.ts.map +1 -1
- package/dist/index.js +397 -316
- package/dist/index.js.map +1 -1
- package/dist/services/grammar/ts/language/BattleScriptLexer.d.ts.map +1 -1
- package/dist/services/parser.d.ts.map +1 -1
- package/dist/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/ast/nodes/RootNode.d.ts.map +1 -1
- package/package.json +1 -1
package/bin/functionality.ts
CHANGED
|
@@ -15,6 +15,7 @@ import {readFileSync} from "fs";
|
|
|
15
15
|
import {writeFileSync} from "node:fs";
|
|
16
16
|
|
|
17
17
|
export async function toAst(inputPath: string, outputPath?: string) {
|
|
18
|
+
console.log(`[BattleScript ${version}] toAst: ${inputPath}`);
|
|
18
19
|
try {
|
|
19
20
|
const sourceCode = await readFile(inputPath, "utf-8");
|
|
20
21
|
const ast = fromSourceCodeToFullAst(sourceCode, {filePath: inputPath, includeMetaData: true});
|
|
@@ -32,6 +33,7 @@ export async function toAst(inputPath: string, outputPath?: string) {
|
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
export function toAstSync(inputPath: string, outputPath?: string) {
|
|
36
|
+
console.log(`[BattleScript ${version}] toAstSync: ${inputPath}`);
|
|
35
37
|
try {
|
|
36
38
|
const sourceCode = readFileSync(inputPath, "utf-8");
|
|
37
39
|
const ast = fromSourceCodeToFullAst(sourceCode, {filePath: inputPath, includeMetaData: true});
|
|
@@ -49,6 +51,7 @@ export function toAstSync(inputPath: string, outputPath?: string) {
|
|
|
49
51
|
}
|
|
50
52
|
|
|
51
53
|
export async function fromAst(inputPath: string, outputPath: string) {
|
|
54
|
+
console.log(`[BattleScript ${version}] fromAst: ${inputPath}`);
|
|
52
55
|
try {
|
|
53
56
|
const astString = await readFile(inputPath, "utf-8");
|
|
54
57
|
const ast = JSON.parse(astString);
|
|
@@ -62,6 +65,7 @@ export async function fromAst(inputPath: string, outputPath: string) {
|
|
|
62
65
|
}
|
|
63
66
|
|
|
64
67
|
export async function toMiniAst(inputPath: string, outputPath: string) {
|
|
68
|
+
console.log(`[BattleScript ${version}] toMiniAst: ${inputPath}`);
|
|
65
69
|
try {
|
|
66
70
|
const sourceCode = await readFile(inputPath, "utf-8");
|
|
67
71
|
const ast = fromSourceCodeToMiniAst(sourceCode, {filePath: inputPath, includeMetaData: true});
|
|
@@ -75,9 +79,15 @@ export async function toMiniAst(inputPath: string, outputPath: string) {
|
|
|
75
79
|
}
|
|
76
80
|
|
|
77
81
|
export async function toBinary(inputPath: string, outputPath: string) {
|
|
82
|
+
console.log(`[BattleScript ${version}] toBinary: ${inputPath}`);
|
|
78
83
|
try {
|
|
84
|
+
console.log(`[BattleScript ${version}] Reading file contents: ${inputPath}`);
|
|
79
85
|
const sourceCode = await readFile(inputPath, "utf-8");
|
|
86
|
+
|
|
87
|
+
console.log(`[BattleScript ${version}] fromSourceCodeToBinary: ${inputPath}`);
|
|
80
88
|
const binary = fromSourceCodeToBinary(sourceCode, {includeMetaData: true, flatten: true, filePath: inputPath});
|
|
89
|
+
|
|
90
|
+
console.log(`[BattleScript ${version}] Writing file contents: ${outputPath}`);
|
|
81
91
|
await writeFile(outputPath, Buffer.concat(binary))
|
|
82
92
|
|
|
83
93
|
console.log(`[BattleScript ${version}] Compiled to ${outputPath}`);
|