-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1a13037
commit a1dd14e
Showing
25 changed files
with
999 additions
and
977 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const ts = require("typescript"); | ||
|
||
const program = ts.createProgram(['examples/test.js'], { | ||
target: ts.ScriptTarget.ESNext, | ||
module: ts.ModuleKind.CommonJS, | ||
noEmit: true // Avoid emitting any output files | ||
}); | ||
|
||
function processScript(data) { | ||
// Create the source file from the provided script data | ||
const sourceFile = ts.createSourceFile('', data, ts.ScriptTarget.ESNext, true); | ||
|
||
// Check for syntax errors | ||
console.log(sourceFile.parseDiagnostics); | ||
if (sourceFile.parseDiagnostics.length > 0) throw new Error('Syntax error(s) found'); | ||
|
||
// Check for semantic errors | ||
// const semanticDiagnostics = program.getSemanticDiagnostics(sourceFile); | ||
// console.log(semanticDiagnostics); | ||
// if (semanticDiagnostics.length > 0) throw new Error('Semantic error(s) found'); | ||
|
||
// Check for declaration errors | ||
const declarationDiagnostics = program.getDeclarationDiagnostics(sourceFile); | ||
console.log(declarationDiagnostics); | ||
if (declarationDiagnostics.length > 0) throw new Error('Declaration error(s) found'); | ||
} | ||
|
||
processScript(`const a = 1`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import ts, { ScriptTarget, SourceFile, Program } from "typescript" | ||
|
||
type ParseDiagnostics = ts.DiagnosticWithLocation & { code: number } | ||
|
||
const program = ts.createProgram(['examples/test.ts'], { | ||
|
||
} | ||
|
||
) | ||
function processScript (data: string) { | ||
const sourceFile = ts.createSourceFile('', data, ScriptTarget.ESNext, true) as SourceFile & { parseDiagnostics: ParseDiagnostics[] } | ||
console.log(sourceFile.parseDiagnostics) | ||
if (sourceFile.parseDiagnostics.length > 0) throw new Error('Sytax error(s) found') | ||
const semanticDiagnostics = program.getSemanticDiagnostics(sourceFile) | ||
console.log(semanticDiagnostics) | ||
if (semanticDiagnostics.length > 0) throw new Error('Semantic error(s) found') | ||
const declarationDiagnostics = program.getDeclarationDiagnostics(sourceFile) | ||
console.log(declarationDiagnostics) | ||
if (declarationDiagnostics.length > 0) throw new Error('Declaration error(s) found') | ||
} | ||
|
||
processScript(`const a = 1`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,77 +1,39 @@ | ||
{ | ||
|
||
"name": "@nxg-org/mineflayer-pathfinder", | ||
|
||
"version": "0.0.21", | ||
|
||
"description": "Pathfinder using A* for mineflayer", | ||
|
||
"main": "dist/index.js", | ||
|
||
"repository": "https://github.com/Minecraft-Pathfinding/minecraft-pathfinding.git", | ||
|
||
"author": "GenerelSchwerz <xXSG.KingXx@gmail.com>", | ||
|
||
"license": "MIT", | ||
|
||
"publishConfig": { | ||
|
||
"access": "public" | ||
|
||
}, | ||
|
||
"scripts": { | ||
"postinstall": "npm run build", | ||
|
||
"prepublishOnly": "npm run lint && npm run build", | ||
|
||
"build": "tsc -p ./tsconfig.json", | ||
|
||
"pub": "npm run lint && npm run build && npm publish --access public", | ||
|
||
"lint": "ts-standard -y --fix" | ||
|
||
}, | ||
|
||
"dependencies": { | ||
|
||
"@nxg-org/mineflayer-physics-util": "1.5.8", | ||
|
||
"@nxg-org/mineflayer-util-plugin": "^1.8.3", | ||
|
||
"lru-cache": "^10.1.0" | ||
|
||
}, | ||
|
||
"devDependencies": { | ||
|
||
"@nxg-org/mineflayer-pathfinder": "file:./", | ||
|
||
"@nxg-org/mineflayer-pathfinder": "file:.", | ||
"cors": "^2.8.5", | ||
|
||
"express": "^4.18.2", | ||
|
||
"mineflayer": "^4.10.1", | ||
|
||
"prismarine-viewer": "^1.28.0", | ||
|
||
"ts-standard": "^12.0.2", | ||
|
||
"typescript": "^5.3.3", | ||
|
||
"vec3": "^0.1.8" | ||
|
||
}, | ||
|
||
"ts-standard": { | ||
|
||
"ignore": [ | ||
|
||
"examples" | ||
|
||
] | ||
|
||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.