@lionden/leo-compiler 0.1.0
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/LICENSE +201 -0
- package/README.md +23 -0
- package/dist/abi-hash.d.ts +15 -0
- package/dist/abi-hash.d.ts.map +1 -0
- package/dist/abi-hash.js +75 -0
- package/dist/abi-hash.js.map +1 -0
- package/dist/abi-parser.d.ts +38 -0
- package/dist/abi-parser.d.ts.map +1 -0
- package/dist/abi-parser.js +513 -0
- package/dist/abi-parser.js.map +1 -0
- package/dist/abi-types.d.ts +111 -0
- package/dist/abi-types.d.ts.map +1 -0
- package/dist/abi-types.js +5 -0
- package/dist/abi-types.js.map +1 -0
- package/dist/cache.d.ts +27 -0
- package/dist/cache.d.ts.map +1 -0
- package/dist/cache.js +74 -0
- package/dist/cache.js.map +1 -0
- package/dist/codegen/codegen-error.d.ts +10 -0
- package/dist/codegen/codegen-error.d.ts.map +1 -0
- package/dist/codegen/codegen-error.js +14 -0
- package/dist/codegen/codegen-error.js.map +1 -0
- package/dist/codegen/contract-wrapper.d.ts +6 -0
- package/dist/codegen/contract-wrapper.d.ts.map +1 -0
- package/dist/codegen/contract-wrapper.js +2482 -0
- package/dist/codegen/contract-wrapper.js.map +1 -0
- package/dist/codegen/type-mapper.d.ts +46 -0
- package/dist/codegen/type-mapper.d.ts.map +1 -0
- package/dist/codegen/type-mapper.js +132 -0
- package/dist/codegen/type-mapper.js.map +1 -0
- package/dist/codegen/typescript-generator.d.ts +65 -0
- package/dist/codegen/typescript-generator.d.ts.map +1 -0
- package/dist/codegen/typescript-generator.js +2076 -0
- package/dist/codegen/typescript-generator.js.map +1 -0
- package/dist/compiler.d.ts +43 -0
- package/dist/compiler.d.ts.map +1 -0
- package/dist/compiler.js +532 -0
- package/dist/compiler.js.map +1 -0
- package/dist/dependency-resolver.d.ts +33 -0
- package/dist/dependency-resolver.d.ts.map +1 -0
- package/dist/dependency-resolver.js +142 -0
- package/dist/dependency-resolver.js.map +1 -0
- package/dist/import-parser.d.ts +17 -0
- package/dist/import-parser.d.ts.map +1 -0
- package/dist/import-parser.js +46 -0
- package/dist/import-parser.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/package-materializer.d.ts +29 -0
- package/dist/package-materializer.d.ts.map +1 -0
- package/dist/package-materializer.js +160 -0
- package/dist/package-materializer.js.map +1 -0
- package/dist/source-discovery.d.ts +24 -0
- package/dist/source-discovery.d.ts.map +1 -0
- package/dist/source-discovery.js +131 -0
- package/dist/source-discovery.js.map +1 -0
- package/dist/source-scrubber.d.ts +22 -0
- package/dist/source-scrubber.d.ts.map +1 -0
- package/dist/source-scrubber.js +71 -0
- package/dist/source-scrubber.js.map +1 -0
- package/dist/types.d.ts +72 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/package.json +34 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-discovery.js","sourceRoot":"","sources":["../src/source-discovery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAG/D,MAAM,OAAO,8BAA+B,SAAQ,KAAK;IACvD,YAAY,SAAiB,EAAE,SAAiB;QAC9C,MAAM,aAAa,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QAC/C,MAAM,eAAe,GAAG,SAAS,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;QACzD,KAAK,CACH,6CAA6C,aAAa,uBAAuB,SAAS,KAAK;YAC7F,6DAA6D;YAC7D,yBAAyB,eAAe,+BAA+B;YACvE,wCAAwC,aAAa,SAAS,CACjE,CAAC;QACF,IAAI,CAAC,IAAI,GAA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
1
|
+
/**
|
|
2
|
+
* Replace comment and string-literal spans in Leo source with whitespace so
|
|
3
|
+
* regex-based scanners only ever see real code. A `<name>.aleo` token that
|
|
4
|
+
* appears in a doc comment (`// see token.aleo::transfer`) or an annotation
|
|
5
|
+
* string (`@checksum(mapping="x.aleo::m")`) would otherwise be detected as a
|
|
6
|
+
* phantom dependency.
|
|
7
|
+
*
|
|
8
|
+
* Single forward scan over the source. Inside a line comment, a block comment,
|
|
9
|
+
* or a string (`"..."` / `'...'`) every character except newlines is replaced by
|
|
10
|
+
* a space, so offsets and line numbers are preserved while no `.aleo` token can
|
|
11
|
+
* survive. Leo string/identifier literals carry no escape sequences and no
|
|
12
|
+
* newlines in practice (only addresses, identifiers, and mapping refs), so no
|
|
13
|
+
* escape handling is needed. An unterminated string or block comment is
|
|
14
|
+
* scrubbed to end-of-input defensively rather than throwing.
|
|
15
|
+
*
|
|
16
|
+
* The `'...'` branch is defensive: Leo has no single-quoted string or character
|
|
17
|
+
* literals, so a lone `'` only ever appears inside a comment (already
|
|
18
|
+
* neutralized above) — treating it as a string delimiter is harmless for both
|
|
19
|
+
* import detection and program-id extraction.
|
|
20
|
+
*/
|
|
21
|
+
export declare function stripCommentsAndStrings(src: string): string;
|
|
22
|
+
//# sourceMappingURL=source-scrubber.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-scrubber.d.ts","sourceRoot":"","sources":["../src/source-scrubber.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAuD3D"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Replace comment and string-literal spans in Leo source with whitespace so
|
|
3
|
+
* regex-based scanners only ever see real code. A `<name>.aleo` token that
|
|
4
|
+
* appears in a doc comment (`// see token.aleo::transfer`) or an annotation
|
|
5
|
+
* string (`@checksum(mapping="x.aleo::m")`) would otherwise be detected as a
|
|
6
|
+
* phantom dependency.
|
|
7
|
+
*
|
|
8
|
+
* Single forward scan over the source. Inside a line comment, a block comment,
|
|
9
|
+
* or a string (`"..."` / `'...'`) every character except newlines is replaced by
|
|
10
|
+
* a space, so offsets and line numbers are preserved while no `.aleo` token can
|
|
11
|
+
* survive. Leo string/identifier literals carry no escape sequences and no
|
|
12
|
+
* newlines in practice (only addresses, identifiers, and mapping refs), so no
|
|
13
|
+
* escape handling is needed. An unterminated string or block comment is
|
|
14
|
+
* scrubbed to end-of-input defensively rather than throwing.
|
|
15
|
+
*
|
|
16
|
+
* The `'...'` branch is defensive: Leo has no single-quoted string or character
|
|
17
|
+
* literals, so a lone `'` only ever appears inside a comment (already
|
|
18
|
+
* neutralized above) — treating it as a string delimiter is harmless for both
|
|
19
|
+
* import detection and program-id extraction.
|
|
20
|
+
*/
|
|
21
|
+
export function stripCommentsAndStrings(src) {
|
|
22
|
+
const out = [];
|
|
23
|
+
const n = src.length;
|
|
24
|
+
let i = 0;
|
|
25
|
+
while (i < n) {
|
|
26
|
+
const c = src[i];
|
|
27
|
+
const next = i + 1 < n ? src[i + 1] : "";
|
|
28
|
+
// Line comment: // ... \n (also covers /// doc comments). The terminating
|
|
29
|
+
// newline is left for the outer loop to emit verbatim.
|
|
30
|
+
if (c === "/" && next === "/") {
|
|
31
|
+
while (i < n && src[i] !== "\n") {
|
|
32
|
+
out.push(" ");
|
|
33
|
+
i++;
|
|
34
|
+
}
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
// Block comment: /* ... */
|
|
38
|
+
if (c === "/" && next === "*") {
|
|
39
|
+
out.push(" ");
|
|
40
|
+
i += 2;
|
|
41
|
+
while (i < n && !(src[i] === "*" && src[i + 1] === "/")) {
|
|
42
|
+
out.push(src[i] === "\n" ? "\n" : " ");
|
|
43
|
+
i++;
|
|
44
|
+
}
|
|
45
|
+
if (i < n) {
|
|
46
|
+
out.push(" "); // closing */
|
|
47
|
+
i += 2;
|
|
48
|
+
}
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
// String literals: "..." and '...'
|
|
52
|
+
if (c === '"' || c === "'") {
|
|
53
|
+
const quote = c;
|
|
54
|
+
out.push(" ");
|
|
55
|
+
i++;
|
|
56
|
+
while (i < n && src[i] !== quote) {
|
|
57
|
+
out.push(src[i] === "\n" ? "\n" : " ");
|
|
58
|
+
i++;
|
|
59
|
+
}
|
|
60
|
+
if (i < n) {
|
|
61
|
+
out.push(" "); // closing quote
|
|
62
|
+
i++;
|
|
63
|
+
}
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
out.push(c);
|
|
67
|
+
i++;
|
|
68
|
+
}
|
|
69
|
+
return out.join("");
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=source-scrubber.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-scrubber.js","sourceRoot":"","sources":["../src/source-scrubber.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,uBAAuB,CAAC,GAAW;IACjD,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,MAAM,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC;IACrB,IAAI,CAAC,GAAG,CAAC,CAAC;IAEV,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACb,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAE,CAAC;QAClB,MAAM,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAEzC,2EAA2E;QAC3E,uDAAuD;QACvD,IAAI,CAAC,KAAK,GAAG,IAAI,IAAI,KAAK,GAAG,EAAE,CAAC;YAC9B,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;gBAChC,GAAG,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AAI,CAAC,GAAG,CAAC,CAAC,CAAC,gBAAgB;gBAC/B,CAAC,EAAE,CAAC;YACN,CAAC;YACD,SAAS;QACX,CAAC;QAED,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACZ,CAAC,EAAE,CAAC;IACN,CAAC;IAED,OAAO,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACtB,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export interface DiscoveredProgram {
|
|
2
|
+
readonly kind: "program";
|
|
3
|
+
/** On-chain program ID, e.g. "hello.aleo" */
|
|
4
|
+
readonly programId: string;
|
|
5
|
+
/** Absolute path to the source directory containing main.leo */
|
|
6
|
+
readonly sourceDir: string;
|
|
7
|
+
/** Absolute path to main.leo */
|
|
8
|
+
readonly entryFile: string;
|
|
9
|
+
/** ALL .leo files under sourceDir (relative paths from sourceDir) */
|
|
10
|
+
readonly allSources: string[];
|
|
11
|
+
}
|
|
12
|
+
export interface DiscoveredLibrary {
|
|
13
|
+
readonly kind: "library";
|
|
14
|
+
/** Library name (directory name), e.g. "math_utils" */
|
|
15
|
+
readonly name: string;
|
|
16
|
+
/** Absolute path to the source directory containing lib.leo */
|
|
17
|
+
readonly sourceDir: string;
|
|
18
|
+
/** Absolute path to lib.leo */
|
|
19
|
+
readonly entryFile: string;
|
|
20
|
+
/** ALL .leo files under sourceDir (relative paths from sourceDir) */
|
|
21
|
+
readonly allSources: string[];
|
|
22
|
+
}
|
|
23
|
+
export type DiscoveredUnit = DiscoveredProgram | DiscoveredLibrary;
|
|
24
|
+
export interface RenameProgramOptions {
|
|
25
|
+
readonly sourceProgramId: string;
|
|
26
|
+
readonly targetProgramId: string;
|
|
27
|
+
}
|
|
28
|
+
/** Get the unique identifier for a compilation unit */
|
|
29
|
+
export declare function unitId(unit: DiscoveredUnit): string;
|
|
30
|
+
export interface CompilationUnitResult {
|
|
31
|
+
readonly unit: DiscoveredUnit;
|
|
32
|
+
/** Whether compilation was skipped (cache hit) */
|
|
33
|
+
readonly cached: boolean;
|
|
34
|
+
/** Absolute path to the materialized package directory */
|
|
35
|
+
readonly packageDir: string;
|
|
36
|
+
/** Absolute path to build output directory */
|
|
37
|
+
readonly buildDir: string;
|
|
38
|
+
}
|
|
39
|
+
export interface ProgramCompilationResult extends CompilationUnitResult {
|
|
40
|
+
readonly unit: DiscoveredProgram;
|
|
41
|
+
/** Canonical local source identity. Differs from programId for deploy renames. */
|
|
42
|
+
readonly sourceProgramId: string;
|
|
43
|
+
/** Effective compiled/runtime identity. */
|
|
44
|
+
readonly programId: string;
|
|
45
|
+
/** Parsed ABI (programs only) */
|
|
46
|
+
readonly abi: import("./abi-types.js").ProgramABI;
|
|
47
|
+
/** Absolute path to compiled .aleo file */
|
|
48
|
+
readonly aleoSource: string;
|
|
49
|
+
}
|
|
50
|
+
export interface LibraryCompilationResult extends CompilationUnitResult {
|
|
51
|
+
readonly unit: DiscoveredLibrary;
|
|
52
|
+
}
|
|
53
|
+
export type CompilationResult = ProgramCompilationResult | LibraryCompilationResult;
|
|
54
|
+
export interface CompileOptions {
|
|
55
|
+
/** Force recompile, ignoring cache */
|
|
56
|
+
readonly force?: boolean;
|
|
57
|
+
/** Skip TypeScript codegen */
|
|
58
|
+
readonly noTypechain?: boolean;
|
|
59
|
+
/** Compile only this specific program/library */
|
|
60
|
+
readonly program?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Internal override: resolve network deps + `.env` for this network instead
|
|
63
|
+
* of `config.defaultNetwork`. Not a CLI flag (`--network` is a reserved
|
|
64
|
+
* global that mutates `defaultNetwork`); it is threaded through programmatic
|
|
65
|
+
* `tasks.run("deploy"/"recipe"/"upgrade", { network })` so the implicit
|
|
66
|
+
* compile fetches imported on-chain sources from the deploying network.
|
|
67
|
+
*/
|
|
68
|
+
readonly network?: string;
|
|
69
|
+
/** Internal deploy/upgrade-only runtime program id override. Not exposed by the compile task CLI. */
|
|
70
|
+
readonly rename?: string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5B,8CAA8C;IAC9C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,wBAAyB,SAAQ,qBAAqB;IACrE,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IACjC,kFAAkF;IAClF,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,2CAA2C;IAC3C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,iCAAiC;IACjC,QAAQ,CAAC,GAAG,EAAE,OAAO,gBAAgB,EAAE,UAAU,CAAC;IAClD,2CAA2C;IAC3C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,wBAAyB,SAAQ,qBAAqB;IACrE,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;CAClC;AAED,MAAM,MAAM,iBAAiB,GAAG,wBAAwB,GAAG,wBAAwB,CAAC;AAMpF,MAAM,WAAW,cAAc;IAC7B,sCAAsC;IACtC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,8BAA8B;IAC9B,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAC/B,iDAAiD;IACjD,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;;;OAMG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,qGAAqG;IACrG,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// Discovered compilation units
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
/** Get the unique identifier for a compilation unit */
|
|
5
|
+
export function unitId(unit) {
|
|
6
|
+
return unit.kind === "program" ? unit.programId : unit.name;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,+BAA+B;AAC/B,8EAA8E;AAiC9E,uDAAuD;AACvD,MAAM,UAAU,MAAM,CAAC,IAAoB;IACzC,OAAO,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;AAC9D,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lionden/leo-compiler",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/sealance-io/lionden.git",
|
|
9
|
+
"directory": "packages/leo-compiler"
|
|
10
|
+
},
|
|
11
|
+
"engines": {
|
|
12
|
+
"node": "^20.19.0 || >=22.12.0"
|
|
13
|
+
},
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"default": "./dist/index.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"!dist/**/*.test.*"
|
|
23
|
+
],
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "tsc --build"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@lionden/config": "^0.1.0",
|
|
32
|
+
"@lionden/core": "^0.1.0"
|
|
33
|
+
}
|
|
34
|
+
}
|