-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add build script with type declaration transforms
- Loading branch information
Showing
5 changed files
with
72 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,21 +6,24 @@ | |
"author": "Clément Walter <[email protected]>", | ||
"license": "Apache-2.0", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"types": "dist/types/index.d.ts", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"start": "echo \"Error: no entrypoint yet\" && exit 1", | ||
"clean": "bunx rimraf dist", | ||
"prebuild": "bun run clean", | ||
"build": "bun build --target=node ./src/index.ts --outfile=dist/index.js && bun run build:declaration", | ||
"build:declaration": "tsc --emitDeclarationOnly --project tsconfig.types.json", | ||
"build:declaration": "tspc --emitDeclarationOnly --project tsconfig.types.json", | ||
"postbuild": "rimraf tsconfig.types.tsbuildinfo" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/kkrt-labs/cairo-vm-ts" | ||
}, | ||
"files": [ | ||
"src/**/*.ts", | ||
"dist/*.js", | ||
"dist/*.d.ts" | ||
"dist/types/**/*.d.ts" | ||
], | ||
"prettier": { | ||
"proseWrap": "always", | ||
|
@@ -41,9 +44,11 @@ | |
}, | ||
"devDependencies": { | ||
"bun-types": "^1.1.12", | ||
"typescript": "^5.2.2" | ||
"ts-patch": "^3.2.0", | ||
"typescript": "^5.2.2", | ||
"typescript-transform-paths": "^3.4.7" | ||
}, | ||
"bin": { | ||
"cairo-vm-ts": "./bin/cli.ts" | ||
"cairo-vm-ts": "./src/cli.ts" | ||
} | ||
} |
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,2 +1,41 @@ | ||
import './runners/cairoRunner'; | ||
import './vm/program'; | ||
export * as PrimitiveErrors from 'errors/primitives'; | ||
export * as MemoryErrors from 'errors/memory'; | ||
export * as InstructionErrors from 'errors/instruction'; | ||
export * as VirtualMachineErrors from 'errors/virtualMachine'; | ||
export * as BuiltinErrors from 'errors/builtins'; | ||
export * as CairoRunnerErrors from 'errors/cairoRunner'; | ||
|
||
export { Felt } from 'primitives/felt'; | ||
export { Relocatable } from 'primitives/relocatable'; | ||
export { SegmentValue, isFelt, isRelocatable } from 'primitives/segmentValue'; | ||
|
||
export { Memory } from 'memory/memory'; | ||
export { | ||
Instruction, | ||
Register, | ||
Op1Src, | ||
ResLogic, | ||
Opcode, | ||
PcUpdate, | ||
ApUpdate, | ||
FpUpdate, | ||
} from 'vm/instruction'; | ||
export { | ||
VirtualMachine, | ||
TraceEntry, | ||
RelocatedMemory, | ||
RelocatedTraceEntry, | ||
} from 'vm/virtualMachine'; | ||
export { parseProgram, Program, Identifier } from 'vm/program'; | ||
|
||
export { BuiltinHandler, getBuiltin } from 'builtins/builtin'; | ||
export { outputHandler } from 'builtins/output'; | ||
export { pedersenHandler } from 'builtins/pedersen'; | ||
export { rangeCheckHandler } from 'builtins/rangeCheck'; | ||
export { ecdsaHandler, EcdsaSegment, EcdsaSignature } from 'builtins/ecdsa'; | ||
export { bitwiseHandler } from 'builtins/bitwise'; | ||
export { ecOpHandler } from 'builtins/ecop'; | ||
export { keccakHandler } from 'builtins/keccak'; | ||
export { poseidonHandler } from 'builtins/poseidon'; | ||
|
||
export { CairoRunner, RunOptions } from 'runners/cairoRunner'; |
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,27 +1,28 @@ | ||
{ | ||
"compilerOptions": { | ||
"outDir": "./dist", | ||
"rootDir": "./src", | ||
"baseUrl": "./src", | ||
"baseUrl": ".", | ||
"paths": { | ||
"@/*": ["src/*"] | ||
"*": ["./src/*"] | ||
}, | ||
"lib": ["esnext"], | ||
"module": "esnext", | ||
"target": "esnext", | ||
// if TS 5.x+ | ||
"moduleResolution": "node", | ||
"moduleDetection": "force", | ||
"allowImportingTsExtensions": true, | ||
"noEmit": true, | ||
"strict": true, | ||
"allowJs": false, | ||
"skipLibCheck": true, | ||
"noUnusedLocals": true, | ||
"noImplicitAny": true, | ||
"noUnusedLocals": true, | ||
"noImplicitReturns": true, | ||
"noUnusedParameters": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"allowJs": false, // disallow importing `.js` from `.ts` | ||
"types": ["bun-types"], | ||
"esModuleInterop": true // allow default imports for CommonJS modules | ||
}, | ||
"include": ["src/**/*.ts"] | ||
"include": ["src/**/*.ts"], | ||
"exclude": ["node_modules", "dist"] | ||
} |
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