@givelotus/compiler 0.0.0-stage → 0.2.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/README.md +331 -2
- package/artifact-v2.schema.json +58 -0
- package/artifact.schema.json +19 -0
- package/dist/ast.d.ts +292 -0
- package/dist/ast.js +150 -0
- package/dist/bindings.d.ts +6 -0
- package/dist/bindings.js +134 -0
- package/dist/call-runtime.d.ts +84 -0
- package/dist/call-runtime.js +249 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +22 -0
- package/dist/compiler.d.ts +79 -0
- package/dist/compiler.js +125 -0
- package/dist/diagnostics.d.ts +163 -0
- package/dist/diagnostics.js +498 -0
- package/dist/ecash.d.ts +41 -0
- package/dist/ecash.js +190 -0
- package/dist/fees.d.ts +164 -0
- package/dist/fees.js +208 -0
- package/dist/fixture-cli.d.ts +2 -0
- package/dist/fixture-cli.js +41 -0
- package/dist/fixtures.d.ts +68 -0
- package/dist/fixtures.js +46 -0
- package/dist/forth-ir.d.ts +73 -0
- package/dist/forth-ir.js +147 -0
- package/dist/generic-cli.d.ts +2 -0
- package/dist/generic-cli.js +140 -0
- package/dist/generic.d.ts +48 -0
- package/dist/generic.js +2566 -0
- package/dist/lints.d.ts +8 -0
- package/dist/lints.js +204 -0
- package/dist/names.d.ts +1 -0
- package/dist/names.js +7 -0
- package/dist/opcodes.d.ts +154 -0
- package/dist/opcodes.js +162 -0
- package/dist/optimizer.d.ts +58 -0
- package/dist/optimizer.js +786 -0
- package/dist/package-fetch-cli.d.ts +2 -0
- package/dist/package-fetch-cli.js +17 -0
- package/dist/package-lock-cli.d.ts +2 -0
- package/dist/package-lock-cli.js +28 -0
- package/dist/package-sources.d.ts +82 -0
- package/dist/package-sources.js +785 -0
- package/dist/package-update-cli.d.ts +2 -0
- package/dist/package-update-cli.js +20 -0
- package/dist/packages.d.ts +231 -0
- package/dist/packages.js +1324 -0
- package/dist/parser.d.ts +32 -0
- package/dist/parser.js +575 -0
- package/dist/policy.d.ts +83 -0
- package/dist/policy.js +207 -0
- package/dist/runtime.d.ts +58 -0
- package/dist/runtime.js +126 -0
- package/dist/scheduler.d.ts +38 -0
- package/dist/scheduler.js +76 -0
- package/dist/semantic-ir.d.ts +76 -0
- package/dist/semantic-ir.js +231 -0
- package/dist/std.d.ts +27 -0
- package/dist/std.js +282 -0
- package/dist/target-compiler.d.ts +9 -0
- package/dist/target-compiler.js +139 -0
- package/dist/targets.d.ts +53 -0
- package/dist/targets.js +67 -0
- package/dist/token-cli.d.ts +2 -0
- package/dist/token-cli.js +82 -0
- package/dist/token-metadata.d.ts +43 -0
- package/dist/token-metadata.js +166 -0
- package/dist/toml-subset.d.ts +19 -0
- package/dist/toml-subset.js +81 -0
- package/dist/transaction-runtime.d.ts +182 -0
- package/dist/transaction-runtime.js +646 -0
- package/dist/version.d.ts +3 -0
- package/dist/version.js +3 -0
- package/dist/vm-cost.d.ts +11 -0
- package/dist/vm-cost.js +541 -0
- package/package.json +74 -4
- package/policy-artifact.schema.json +20 -0
- package/std/custody/arbiter-escrow.lotus +20 -0
- package/std/custody/htlc.lotus +15 -0
- package/std/custody/multisig-2of3.lotus +13 -0
- package/std/custody/single-owner-wallet.lotus +9 -0
- package/std/custody/vault-with-recovery.lotus +14 -0
- package/std/defi/amm-pool-v2.lotus +97 -0
- package/std/defi/indexed-limit-order.lotus +37 -0
- package/std/nft/nft-collection.lotus +51 -0
- package/std/nft/royalty-transfer-rules.lotus +38 -0
- package/std/nft/unique-nft.lotus +30 -0
- package/std/tokens/capped-supply-token.lotus +76 -0
- package/std/tokens/fixed-supply-token.lotus +29 -0
- package/std/tokens/lrc20.lotus +26 -0
- package/std/tokens/standard-transfer-rules.lotus +15 -0
- package/std/tokens/stateful-token-merge.lotus +132 -0
- package/std/tokens/upgradable-token-rules.lotus +70 -0
- package/std/tokens/voucher-mint-token.lotus +31 -0
- package/std-pkg/lotus.toml +9 -0
- package/std-pkg/src/lrc20.lotus +38 -0
- package/std-pkg/src/stateful_token.lotus +131 -0
- package/std-pkg/src/upgradable.lotus +68 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/** Fetch module-path packages into `.lotus/deps` (or `vendor/`) and write `lotus.lock`. */
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { fetchPackages } from './package-sources.js';
|
|
5
|
+
try {
|
|
6
|
+
const args = process.argv.slice(2);
|
|
7
|
+
const vendor = args.includes('--vendor');
|
|
8
|
+
const positional = args.filter(arg => !arg.startsWith('--'));
|
|
9
|
+
if (positional.length !== 1 || args.length !== positional.length + (vendor ? 1 : 0))
|
|
10
|
+
throw new Error('usage: lotus-package-fetch DIR [--vendor]');
|
|
11
|
+
fetchPackages(positional[0], { vendor });
|
|
12
|
+
process.stdout.write(`wrote ${join(positional[0], 'lotus.lock')}\n`);
|
|
13
|
+
}
|
|
14
|
+
catch (err) {
|
|
15
|
+
process.stderr.write(`${err.message}\n`);
|
|
16
|
+
process.exitCode = 1;
|
|
17
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/** Rewrite or check `lotus.lock` from local files only. No network or registry access. */
|
|
3
|
+
import { readFileSync } from 'node:fs';
|
|
4
|
+
import { join } from 'node:path';
|
|
5
|
+
import { generateLock, LOCK_FILE, updateLock } from './packages.js';
|
|
6
|
+
try {
|
|
7
|
+
const [dir, flag] = process.argv.slice(2);
|
|
8
|
+
if (!dir || process.argv.length > 4 || (flag !== undefined && flag !== '--check'))
|
|
9
|
+
throw new Error('usage: lotus-package-lock DIR [--check]');
|
|
10
|
+
if (flag === '--check') {
|
|
11
|
+
let current = '';
|
|
12
|
+
try {
|
|
13
|
+
current = readFileSync(join(dir, LOCK_FILE), 'utf8');
|
|
14
|
+
}
|
|
15
|
+
catch { /* missing lock is stale */ }
|
|
16
|
+
if (current !== generateLock(dir))
|
|
17
|
+
throw new Error(`${LOCK_FILE} is stale; review the dependency changes and run lotus-package-lock ${dir}`);
|
|
18
|
+
process.stdout.write(`${LOCK_FILE} is up to date\n`);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
updateLock(dir);
|
|
22
|
+
process.stdout.write(`wrote ${join(dir, LOCK_FILE)}\n`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
catch (err) {
|
|
26
|
+
process.stderr.write(`${err.message}\n`);
|
|
27
|
+
process.exitCode = 1;
|
|
28
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { type PackageInfo, type PackageLimits } from './packages.js';
|
|
2
|
+
export declare const LOCK_SCHEMA_V2 = "lotus/package-lock/2";
|
|
3
|
+
export type FetchOptions = {
|
|
4
|
+
/** Write a `vendor/` tree instead of the project-local `.lotus/deps` cache. */
|
|
5
|
+
vendor?: boolean;
|
|
6
|
+
limits?: Partial<PackageLimits>;
|
|
7
|
+
/** Test transport. Default is `https://host/owner/repo.git` for a known forge. */
|
|
8
|
+
resolveRepoUrl?: (repo: {
|
|
9
|
+
host: string;
|
|
10
|
+
owner: string;
|
|
11
|
+
repo: string;
|
|
12
|
+
module: string;
|
|
13
|
+
}) => string;
|
|
14
|
+
};
|
|
15
|
+
type SemVer = {
|
|
16
|
+
major: number;
|
|
17
|
+
minor: number;
|
|
18
|
+
patch: number;
|
|
19
|
+
text: string;
|
|
20
|
+
};
|
|
21
|
+
type Selector = {
|
|
22
|
+
kind: 'tag';
|
|
23
|
+
semver: SemVer;
|
|
24
|
+
} | {
|
|
25
|
+
kind: 'commit';
|
|
26
|
+
commit: string;
|
|
27
|
+
} | {
|
|
28
|
+
kind: 'range';
|
|
29
|
+
op: '^' | '~';
|
|
30
|
+
semver: SemVer;
|
|
31
|
+
text: string;
|
|
32
|
+
} | {
|
|
33
|
+
kind: 'branch';
|
|
34
|
+
name: string;
|
|
35
|
+
};
|
|
36
|
+
export type ModuleRef = {
|
|
37
|
+
module: string;
|
|
38
|
+
host: string;
|
|
39
|
+
owner?: string;
|
|
40
|
+
repo?: string;
|
|
41
|
+
forge: boolean;
|
|
42
|
+
suffixMajor?: number;
|
|
43
|
+
subdir: string;
|
|
44
|
+
};
|
|
45
|
+
type Requirement = {
|
|
46
|
+
kind: 'path';
|
|
47
|
+
name: string;
|
|
48
|
+
version: string;
|
|
49
|
+
} | {
|
|
50
|
+
kind: 'module';
|
|
51
|
+
module: string;
|
|
52
|
+
ref: ModuleRef;
|
|
53
|
+
selector: Selector;
|
|
54
|
+
};
|
|
55
|
+
export declare function isGitLocator(value: string): boolean;
|
|
56
|
+
export declare function assertGitLocator(value: string, file?: string): {
|
|
57
|
+
url: string;
|
|
58
|
+
dir: string;
|
|
59
|
+
};
|
|
60
|
+
/** Known-forge and explicit module paths. `/vN` (N >= 2) is only a major suffix when it is the final element. */
|
|
61
|
+
export declare function parseModulePath(module: string, file?: string): ModuleRef;
|
|
62
|
+
export declare function isModulePath(module: string): boolean;
|
|
63
|
+
/** `https://host/owner/repo.git` for a known forge. Major suffixes and subdirectories are not part of the URL. */
|
|
64
|
+
export declare function forgeGitUrl(module: string, file?: string): string;
|
|
65
|
+
export declare function classifyRequirement(target: string, file?: string): Requirement;
|
|
66
|
+
/** Resolve module requirements from the root and selected manifests. Offline when `online` is omitted. */
|
|
67
|
+
export declare function resolveDistributedSources(project: string, root: PackageInfo, limits: PackageLimits, budget: {
|
|
68
|
+
bytes: number;
|
|
69
|
+
limit: number;
|
|
70
|
+
}, online?: FetchOptions): {
|
|
71
|
+
packages: Map<string, PackageInfo>;
|
|
72
|
+
lockText: string;
|
|
73
|
+
modules: Map<string, PackageInfo>;
|
|
74
|
+
};
|
|
75
|
+
/** Fetch exact tags and commits into the cache and write `lotus.lock`. Branch names and ranges are rejected. */
|
|
76
|
+
export declare function fetchPackages(projectDir: string, options?: FetchOptions): string;
|
|
77
|
+
/**
|
|
78
|
+
* Resolve one root dependency that may be a branch or semver range (`^` / `~`), rewrite that
|
|
79
|
+
* manifest entry to an exact tag or commit, then fetch. This is the only command that may name a branch.
|
|
80
|
+
*/
|
|
81
|
+
export declare function updatePackages(projectDir: string, spec: string, options?: FetchOptions): string;
|
|
82
|
+
export {};
|