@shd101wyy/yo 0.0.26 → 0.0.28
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 +7 -6
- package/out/cjs/index.cjs +568 -563
- package/out/cjs/yo-cli.cjs +686 -556
- package/out/esm/index.mjs +509 -504
- package/out/types/src/build-runner.d.ts +22 -0
- package/out/types/src/cache.d.ts +3 -0
- package/out/types/src/codegen/async/state-machine.d.ts +1 -1
- package/out/types/src/codegen/codegen-c.d.ts +3 -0
- package/out/types/src/codegen/exprs/await.d.ts +1 -0
- package/out/types/src/codegen/exprs/return.d.ts +1 -0
- package/out/types/src/codegen/exprs/while.d.ts +1 -1
- package/out/types/src/codegen/functions/context.d.ts +6 -18
- package/out/types/src/codegen/functions/declarations.d.ts +10 -2
- package/out/types/src/codegen/index.d.ts +4 -0
- package/out/types/src/codegen/utils/index.d.ts +3 -0
- package/out/types/src/evaluator/async/await-analysis.d.ts +1 -0
- package/out/types/src/evaluator/builtins/build.d.ts +135 -0
- package/out/types/src/evaluator/context.d.ts +1 -0
- package/out/types/src/expr.d.ts +18 -0
- package/out/types/src/fetch-command.d.ts +6 -0
- package/out/types/src/fetch.d.ts +10 -0
- package/out/types/src/function-value.d.ts +1 -0
- package/out/types/src/init.d.ts +5 -0
- package/out/types/src/install-command.d.ts +6 -0
- package/out/types/src/lock-file.d.ts +16 -0
- package/out/types/src/module-manager.d.ts +3 -1
- package/out/types/src/pkg-config.d.ts +11 -0
- package/out/types/src/target.d.ts +28 -0
- package/out/types/src/tests/build-system.test.d.ts +1 -0
- package/out/types/src/types/creators.d.ts +2 -1
- package/out/types/src/types/definitions.d.ts +2 -1
- package/out/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/std/build.yo +287 -0
- package/std/crypto/random.yo +27 -15
- package/std/encoding/base64.yo +24 -49
- package/std/encoding/hex.yo +25 -22
- package/std/encoding/json.yo +25 -3
- package/std/encoding/utf16.yo +6 -5
- package/std/fs/dir.yo +107 -104
- package/std/fs/file.yo +122 -158
- package/std/fs/metadata.yo +23 -22
- package/std/fs/temp.yo +42 -48
- package/std/fs/walker.yo +48 -55
- package/std/net/addr.yo +8 -7
- package/std/net/dns.yo +27 -33
- package/std/net/errors.yo +13 -8
- package/std/net/tcp.yo +92 -113
- package/std/net/udp.yo +50 -54
- package/std/os/env.yo +5 -5
- package/std/os/signal.yo +21 -16
- package/std/path.yo +2 -2
- package/std/prelude.yo +23 -2
- package/std/process.yo +23 -43
- package/std/sys/clock.yo +1 -1
- package/std/sys/constants.yo +3 -3
- package/std/sys/errors.yo +45 -33
- package/std/sys/mmap.yo +2 -2
- package/std/sys/signals.yo +4 -4
- package/std/sys/socket.yo +25 -25
- package/std/sys/sysinfo.yo +4 -4
- package/std/url/url.yo +19 -32
- package/out/types/src/codegen/effects/effect-state-machine.d.ts +0 -34
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BuildRegistry } from "./evaluator/builtins/build";
|
|
2
|
+
export interface BuildOptions {
|
|
3
|
+
buildFile: string;
|
|
4
|
+
targetTriple?: string;
|
|
5
|
+
verbose?: boolean;
|
|
6
|
+
dryRun?: boolean;
|
|
7
|
+
listSteps?: boolean;
|
|
8
|
+
steps?: string[];
|
|
9
|
+
defines?: Record<string, string>;
|
|
10
|
+
cCompiler?: string;
|
|
11
|
+
sysroot?: string;
|
|
12
|
+
summary?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function runBuild(options: BuildOptions): Promise<void>;
|
|
15
|
+
export interface DAGNode {
|
|
16
|
+
name: string;
|
|
17
|
+
kind: "artifact" | "test" | "run" | "step";
|
|
18
|
+
dependsOn: string[];
|
|
19
|
+
}
|
|
20
|
+
export declare function buildDAG(registry: BuildRegistry, rootStepName: string): DAGNode[];
|
|
21
|
+
export declare function detectCycle(dag: DAGNode[]): string[] | null;
|
|
22
|
+
export declare function computeDependencyHash(registry: BuildRegistry, depName: string, projectDir: string): string;
|
|
@@ -11,4 +11,4 @@ export interface StateMachineInfo {
|
|
|
11
11
|
}
|
|
12
12
|
export declare function generateResumeFunctionDeclaration(info: StateMachineInfo, context: FunctionGenerationContext): void;
|
|
13
13
|
export declare function getStateMachineFieldName(variableId: string, kind?: "outer" | "local"): string;
|
|
14
|
-
export declare function generateAsyncBlockResumeFunction(bodyExpr: Expr, asyncBlockId: string, structName: string, resumeFunctionName: string, analysis: AwaitAnalysisResult, futureType: SomeType | DynType, captureType: StructType | undefined, context: FunctionGenerationContext):
|
|
14
|
+
export declare function generateAsyncBlockResumeFunction(bodyExpr: Expr, asyncBlockId: string, structName: string, resumeFunctionName: string, analysis: AwaitAnalysisResult, futureType: SomeType | DynType, captureType: StructType | undefined, context: FunctionGenerationContext): string[];
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import type { ModuleValue } from "../value";
|
|
2
2
|
export declare class CodeGeneratorC {
|
|
3
3
|
private emitter;
|
|
4
|
+
private exportedFunctionNames;
|
|
4
5
|
constructor();
|
|
5
6
|
compileModule(modulePath: string, moduleValue: ModuleValue, options?: {
|
|
6
7
|
debugGc?: boolean;
|
|
7
8
|
debugParallelism?: boolean;
|
|
8
9
|
debugAsyncAwait?: boolean;
|
|
9
10
|
allocator?: "mimalloc" | "libc";
|
|
11
|
+
isLibrary?: boolean;
|
|
10
12
|
}): void;
|
|
11
13
|
print(): string;
|
|
14
|
+
getExportedFunctionNames(): Set<string>;
|
|
12
15
|
}
|
|
@@ -2,3 +2,4 @@ import { type FnCallExpr } from "../../expr";
|
|
|
2
2
|
import { type CodeGenContext } from "../utils";
|
|
3
3
|
export declare function generateAwait(expr: FnCallExpr, indent: string, context: CodeGenContext): string;
|
|
4
4
|
export declare function generateState(expr: FnCallExpr, indent: string, context: CodeGenContext): string;
|
|
5
|
+
export declare function generateJoinHandleAwait(expr: FnCallExpr, indent: string, context: CodeGenContext): string;
|
|
@@ -2,5 +2,6 @@ import { type Expr, type FnCallExpr } from "../../expr";
|
|
|
2
2
|
import type { FunctionGenerationContext } from "../functions/context";
|
|
3
3
|
import { type CodeGenContext } from "../utils";
|
|
4
4
|
export declare function generatePendingDeferredDrops(indent: string, context: FunctionGenerationContext, expr: Expr, isCompletion?: boolean, skipAlreadyDroppedCheck?: boolean, skipEnvCheck?: boolean): void;
|
|
5
|
+
export declare function generateConsumedVarDropsForEscape(indent: string, context: FunctionGenerationContext, expr: Expr, skipEnvCheck?: boolean): void;
|
|
5
6
|
export declare function generateReturn(expr: FnCallExpr, indent: string, context: CodeGenContext): string;
|
|
6
7
|
export declare function generateImplicitReturnStatement(expr: Expr, indent: string, context: CodeGenContext): void;
|
|
@@ -2,8 +2,8 @@ import type { AwaitAnalysisResult, CapturedVariable } from "../../evaluator/asyn
|
|
|
2
2
|
import type { Expr } from "../../expr";
|
|
3
3
|
import type { FunctionValue, FuncValueId } from "../../function-value";
|
|
4
4
|
import type { DynType, FunctionType, FutureTraitType, SomeType, StructType, Type, TypeId } from "../../types/definitions";
|
|
5
|
-
import type { EffectStateMachineInfo } from "../effects/effect-state-machine";
|
|
6
5
|
import type { CodeGenContext } from "../utils";
|
|
6
|
+
import type { EvidenceParameter } from "./declarations";
|
|
7
7
|
export interface FunctionGenerationContext extends CodeGenContext {
|
|
8
8
|
functions: Record<FuncValueId, {
|
|
9
9
|
value: FunctionValue;
|
|
@@ -25,23 +25,17 @@ export interface FunctionGenerationContext extends CodeGenContext {
|
|
|
25
25
|
futureType: SomeType | DynType;
|
|
26
26
|
};
|
|
27
27
|
stateMachineVariables?: Map<string, CapturedVariable>;
|
|
28
|
-
inEffectStateMachine?:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
cFunctionName: string;
|
|
32
|
-
info: EffectStateMachineInfo;
|
|
33
|
-
}>;
|
|
28
|
+
inEffectStateMachine?: unknown;
|
|
29
|
+
isModuleEffectMemberFunction?: boolean;
|
|
30
|
+
currentEvidenceParams?: Map<string, EvidenceParameter>;
|
|
34
31
|
continuationVariables?: Map<string, {
|
|
35
|
-
smVar: string;
|
|
36
|
-
smInfo: EffectStateMachineInfo;
|
|
37
|
-
effectIndex?: number;
|
|
38
|
-
} | {
|
|
39
32
|
directReturnVar: string;
|
|
40
33
|
directExitLabel?: string;
|
|
41
34
|
isUnitReturn?: boolean;
|
|
42
35
|
}>;
|
|
43
36
|
variableIdRemapping?: Map<string, string>;
|
|
44
37
|
pendingDeferredDrops?: Expr[];
|
|
38
|
+
consumedVarPendingDrops?: Expr[];
|
|
45
39
|
deferredAsyncBlocks?: Array<{
|
|
46
40
|
bodyExpr: Expr;
|
|
47
41
|
asyncBlockId: string;
|
|
@@ -112,12 +106,6 @@ export interface FunctionGenerationContext extends CodeGenContext {
|
|
|
112
106
|
shortCircuitHandledDropVarNames?: Set<string>;
|
|
113
107
|
effectHandlerParamDrops?: string[];
|
|
114
108
|
effectSmConsumedArgCNames?: Set<string>;
|
|
115
|
-
effectWhileLoopContinuation?: {
|
|
116
|
-
label: string;
|
|
117
|
-
stepExpr: Expr | undefined;
|
|
118
|
-
whileDoneLabel: string;
|
|
119
|
-
remainingExprs: Expr[];
|
|
120
|
-
bodyDropExprs: Expr[];
|
|
121
|
-
};
|
|
122
109
|
loopBodyDropsBaselineCount?: number;
|
|
110
|
+
overrideReturnTypeStr?: string;
|
|
123
111
|
}
|
|
@@ -3,8 +3,16 @@ import type { FunctionType } from "../../types/definitions";
|
|
|
3
3
|
import { type CodeGenContext } from "../utils";
|
|
4
4
|
import type { FunctionGenerationContext } from "./context";
|
|
5
5
|
export declare function generateFunctionDeclarations(context: FunctionGenerationContext): void;
|
|
6
|
-
export
|
|
7
|
-
|
|
6
|
+
export interface EvidenceParameter {
|
|
7
|
+
implicitLabel: string;
|
|
8
|
+
fieldLabel: string;
|
|
9
|
+
fieldPath: string[];
|
|
10
|
+
fieldFunctionType: FunctionType;
|
|
11
|
+
cParamName: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function getEvidenceParameters(functionType: FunctionType): EvidenceParameter[];
|
|
14
|
+
export declare function generateFunctionPrototype(functionType: FunctionType, cFunctionName: string, context: CodeGenContext, overrideReturnType?: string, originalFunctionType?: FunctionType): string;
|
|
15
|
+
export declare function generateFunctionDeclaration(functionType: FunctionType, cFunctionName: string, isExtern: boolean, context: CodeGenContext, functionBody?: Expr, originalFunctionType?: FunctionType): void;
|
|
8
16
|
export declare function generateObjectConstructorDeclarations(context: FunctionGenerationContext): void;
|
|
9
17
|
export declare function generateClosureConstructorDeclarations(context: FunctionGenerationContext): void;
|
|
10
18
|
export declare function generateCaptureDisposeFunctionDeclarations(context: FunctionGenerationContext): void;
|
|
@@ -5,6 +5,8 @@ export declare class CodeGenerator {
|
|
|
5
5
|
output: string;
|
|
6
6
|
cCompiler: string;
|
|
7
7
|
target: "c";
|
|
8
|
+
targetTriple?: string;
|
|
9
|
+
sysroot?: string;
|
|
8
10
|
extern: string[];
|
|
9
11
|
includePaths?: string[];
|
|
10
12
|
libraryPaths?: string[];
|
|
@@ -23,6 +25,8 @@ export declare class CodeGenerator {
|
|
|
23
25
|
debugSymbols?: boolean;
|
|
24
26
|
strip?: boolean;
|
|
25
27
|
static?: boolean;
|
|
28
|
+
shared?: boolean;
|
|
29
|
+
staticLibrary?: boolean;
|
|
26
30
|
cflags?: string;
|
|
27
31
|
}): void;
|
|
28
32
|
}
|
|
@@ -77,6 +77,9 @@ export interface CodeGenContext {
|
|
|
77
77
|
currentContinueLabel?: string;
|
|
78
78
|
insideMatch?: boolean;
|
|
79
79
|
typeIdStatics?: Map<string, string>;
|
|
80
|
+
isLibrary?: boolean;
|
|
81
|
+
currentModuleId?: string;
|
|
82
|
+
exportedFunctionLabels?: Map<FuncValueId, string>;
|
|
80
83
|
}
|
|
81
84
|
export declare function sanitizeForCIdentifier(str: string, isExternC?: boolean): string;
|
|
82
85
|
export declare function shouldAvoidConst(type: Type): boolean;
|
|
@@ -6,4 +6,5 @@ export declare function isIoAsyncCall(expr: Expr): boolean;
|
|
|
6
6
|
export declare function isIoAwaitCall(expr: Expr): boolean;
|
|
7
7
|
export declare function isIoStateCall(expr: Expr): boolean;
|
|
8
8
|
export declare function isIoSpawnCall(expr: Expr): boolean;
|
|
9
|
+
export declare function isJoinHandleAwaitCall(expr: Expr): boolean;
|
|
9
10
|
export declare function getLocalVariablesFromBody(body: Expr): CapturedVariable[];
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import type { Environment } from "../../env";
|
|
2
|
+
import { type FnCallExpr } from "../../expr";
|
|
3
|
+
import type { EvaluatorContext } from "../context";
|
|
4
|
+
export interface BuildProject {
|
|
5
|
+
name: string;
|
|
6
|
+
root: string;
|
|
7
|
+
}
|
|
8
|
+
export interface BuildArtifact {
|
|
9
|
+
kind: "executable" | "static_library" | "shared_library";
|
|
10
|
+
name: string;
|
|
11
|
+
root: string;
|
|
12
|
+
target: string;
|
|
13
|
+
optimize: string;
|
|
14
|
+
allocator: string;
|
|
15
|
+
sanitize: string;
|
|
16
|
+
linkLibraries: string[];
|
|
17
|
+
includePaths: string[];
|
|
18
|
+
libraryPaths: string[];
|
|
19
|
+
cSources: string[];
|
|
20
|
+
cFlags: string[];
|
|
21
|
+
defines: string[];
|
|
22
|
+
strip: boolean;
|
|
23
|
+
staticLink: boolean;
|
|
24
|
+
linkedArtifacts: string[];
|
|
25
|
+
linkedSystemLibraries: string[];
|
|
26
|
+
}
|
|
27
|
+
export interface BuildTestSuite {
|
|
28
|
+
name: string;
|
|
29
|
+
root: string;
|
|
30
|
+
target: string;
|
|
31
|
+
verbose: boolean;
|
|
32
|
+
bail: boolean;
|
|
33
|
+
parallel: number;
|
|
34
|
+
}
|
|
35
|
+
export interface BuildRunStep {
|
|
36
|
+
name: string;
|
|
37
|
+
artifactName: string;
|
|
38
|
+
args: string[];
|
|
39
|
+
}
|
|
40
|
+
export interface BuildStep {
|
|
41
|
+
name: string;
|
|
42
|
+
description: string;
|
|
43
|
+
dependencyNames: string[];
|
|
44
|
+
}
|
|
45
|
+
export interface BuildGitDependency {
|
|
46
|
+
name: string;
|
|
47
|
+
url: string;
|
|
48
|
+
ref: string;
|
|
49
|
+
path: string;
|
|
50
|
+
}
|
|
51
|
+
export interface BuildPathDependency {
|
|
52
|
+
name: string;
|
|
53
|
+
path: string;
|
|
54
|
+
}
|
|
55
|
+
export interface BuildSystemLibrary {
|
|
56
|
+
name: string;
|
|
57
|
+
pkgConfig: string;
|
|
58
|
+
fallbackInclude: string;
|
|
59
|
+
fallbackLib: string;
|
|
60
|
+
fallbackLink: string;
|
|
61
|
+
}
|
|
62
|
+
export interface DependencyArtifactRef {
|
|
63
|
+
dependencyName: string;
|
|
64
|
+
artifactName: string;
|
|
65
|
+
}
|
|
66
|
+
export declare class BuildRegistry {
|
|
67
|
+
project: BuildProject | undefined;
|
|
68
|
+
artifacts: BuildArtifact[];
|
|
69
|
+
testSuites: BuildTestSuite[];
|
|
70
|
+
runSteps: BuildRunStep[];
|
|
71
|
+
steps: BuildStep[];
|
|
72
|
+
dependencies: BuildGitDependency[];
|
|
73
|
+
pathDependencies: BuildPathDependency[];
|
|
74
|
+
systemLibraries: BuildSystemLibrary[];
|
|
75
|
+
dependencyArtifacts: DependencyArtifactRef[];
|
|
76
|
+
cliOptions: Map<string, string>;
|
|
77
|
+
declaredOptions: Map<string, {
|
|
78
|
+
description: string;
|
|
79
|
+
defaultValue: string;
|
|
80
|
+
}>;
|
|
81
|
+
setCliOptions(options: Map<string, string>): void;
|
|
82
|
+
registerProject(name: string, root: string): void;
|
|
83
|
+
registerExecutable(config: Omit<BuildArtifact, "kind">): void;
|
|
84
|
+
registerStaticLibrary(config: Omit<BuildArtifact, "kind">): void;
|
|
85
|
+
registerSharedLibrary(config: Omit<BuildArtifact, "kind">): void;
|
|
86
|
+
registerTest(config: BuildTestSuite): void;
|
|
87
|
+
registerRun(artifactName: string, args: string[]): void;
|
|
88
|
+
registerStep(name: string, description: string, dependencyNames?: string[]): void;
|
|
89
|
+
addStepDependency(stepName: string, depName: string): void;
|
|
90
|
+
registerDependency(dep: BuildGitDependency): void;
|
|
91
|
+
registerPathDependency(dep: BuildPathDependency): void;
|
|
92
|
+
registerSystemLibrary(lib: BuildSystemLibrary): void;
|
|
93
|
+
registerDependencyArtifact(ref: DependencyArtifactRef): void;
|
|
94
|
+
registerLink(artifactName: string, libraryName: string): void;
|
|
95
|
+
findArtifact(name: string): BuildArtifact | undefined;
|
|
96
|
+
findTest(name: string): BuildTestSuite | undefined;
|
|
97
|
+
findRunStep(name: string): BuildRunStep | undefined;
|
|
98
|
+
findStep(name: string): BuildStep | undefined;
|
|
99
|
+
findDependency(name: string): BuildGitDependency | undefined;
|
|
100
|
+
findPathDependency(name: string): BuildPathDependency | undefined;
|
|
101
|
+
findSystemLibrary(name: string): BuildSystemLibrary | undefined;
|
|
102
|
+
getStepNames(): string[];
|
|
103
|
+
resolveDependency(name: string): {
|
|
104
|
+
kind: "artifact";
|
|
105
|
+
value: BuildArtifact;
|
|
106
|
+
} | {
|
|
107
|
+
kind: "test";
|
|
108
|
+
value: BuildTestSuite;
|
|
109
|
+
} | {
|
|
110
|
+
kind: "run";
|
|
111
|
+
value: BuildRunStep;
|
|
112
|
+
} | {
|
|
113
|
+
kind: "step";
|
|
114
|
+
value: BuildStep;
|
|
115
|
+
} | undefined;
|
|
116
|
+
resolveDependencies(step: BuildStep): {
|
|
117
|
+
artifacts: BuildArtifact[];
|
|
118
|
+
tests: BuildTestSuite[];
|
|
119
|
+
runs: BuildRunStep[];
|
|
120
|
+
};
|
|
121
|
+
clear(): void;
|
|
122
|
+
}
|
|
123
|
+
export declare function getRootBuildProjectDir(): string | undefined;
|
|
124
|
+
export declare function setRootBuildProjectDir(dir: string | undefined): void;
|
|
125
|
+
export declare function getDependencyProjectRoot(depDir: string): string | undefined;
|
|
126
|
+
export declare function setDependencyProjectRoot(depDir: string, root: string): void;
|
|
127
|
+
export declare function clearDependencyProjectRoots(): void;
|
|
128
|
+
export declare function getBuildRegistry(): BuildRegistry;
|
|
129
|
+
export declare function clearBuildRegistry(): void;
|
|
130
|
+
export declare function swapBuildRegistry(newRegistry: BuildRegistry | undefined): BuildRegistry | undefined;
|
|
131
|
+
export declare function evaluateYoBuildFunctions({ expr, env, }: {
|
|
132
|
+
expr: FnCallExpr;
|
|
133
|
+
env: Environment;
|
|
134
|
+
context: EvaluatorContext;
|
|
135
|
+
}): FnCallExpr;
|
package/out/types/src/expr.d.ts
CHANGED
|
@@ -50,6 +50,7 @@ export interface EvaluatedExprData {
|
|
|
50
50
|
comment?: string;
|
|
51
51
|
deferredDupExpressions?: Expr[];
|
|
52
52
|
deferredDropExpressions?: Expr[];
|
|
53
|
+
consumedVariableDropExpressions?: Expr[];
|
|
53
54
|
asyncStackSize?: Expr;
|
|
54
55
|
asyncStateMachineStructName?: string;
|
|
55
56
|
captureType?: StructType;
|
|
@@ -530,6 +531,23 @@ export declare const BuiltinFunctions: {
|
|
|
530
531
|
__yo_maybe_uninit_assume_init: string[];
|
|
531
532
|
__yo_process_platform: string[];
|
|
532
533
|
__yo_process_arch: string[];
|
|
534
|
+
__yo_build_project: string[];
|
|
535
|
+
__yo_build_executable: string[];
|
|
536
|
+
__yo_build_static_library: string[];
|
|
537
|
+
__yo_build_shared_library: string[];
|
|
538
|
+
__yo_build_test: string[];
|
|
539
|
+
__yo_build_run: string[];
|
|
540
|
+
__yo_build_step: string[];
|
|
541
|
+
__yo_build_step_depend_on: string[];
|
|
542
|
+
__yo_build_link: string[];
|
|
543
|
+
__yo_build_link_system_library: string[];
|
|
544
|
+
__yo_build_target_host: string[];
|
|
545
|
+
__yo_build_target_parse: string[];
|
|
546
|
+
__yo_build_dependency: string[];
|
|
547
|
+
__yo_build_path_dependency: string[];
|
|
548
|
+
__yo_build_system_library: string[];
|
|
549
|
+
__yo_build_option: string[];
|
|
550
|
+
__yo_build_dep_artifact: string[];
|
|
533
551
|
};
|
|
534
552
|
export declare function exprIsInfixOperatorFunctionCall(expr: Expr): boolean;
|
|
535
553
|
export interface ExprToStringConfig {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { BuildGitDependency } from "./evaluator/builtins/build";
|
|
2
|
+
import { type LockFile } from "./lock-file";
|
|
3
|
+
export declare function getCacheDir(_projectDir?: string): string;
|
|
4
|
+
export interface FetchResult {
|
|
5
|
+
resolvedPaths: Map<string, string>;
|
|
6
|
+
lockFile: LockFile;
|
|
7
|
+
}
|
|
8
|
+
export declare function fetchAllDependencies(projectDir: string, dependencies: BuildGitDependency[], verbose?: boolean, update?: boolean): FetchResult;
|
|
9
|
+
export declare function areDependenciesCached(projectDir: string, dependencies: BuildGitDependency[]): boolean;
|
|
10
|
+
export declare function resolveDependencyPath(projectDir: string, depName: string, depPath?: string): string | undefined;
|
|
@@ -33,6 +33,7 @@ export type FunctionValue = {
|
|
|
33
33
|
isControlFunction?: boolean;
|
|
34
34
|
definitionSiteEnclosingFunctionType?: FunctionType;
|
|
35
35
|
closureInfo?: ClosureInfo;
|
|
36
|
+
isModuleEffectMember?: boolean;
|
|
36
37
|
isIoAsyncStateMachineClosure?: boolean;
|
|
37
38
|
};
|
|
38
39
|
export interface FunctionCapturedVariableInfo extends CapturedVariableInfo {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface LockEntry {
|
|
2
|
+
name: string;
|
|
3
|
+
url: string;
|
|
4
|
+
ref: string;
|
|
5
|
+
commit: string;
|
|
6
|
+
hash: string;
|
|
7
|
+
}
|
|
8
|
+
export interface LockFile {
|
|
9
|
+
dependencies: LockEntry[];
|
|
10
|
+
}
|
|
11
|
+
export declare function parseLockFile(content: string): LockFile;
|
|
12
|
+
export declare function writeLockFileContent(lockFile: LockFile): string;
|
|
13
|
+
export declare function readLockFile(projectDir: string): LockFile;
|
|
14
|
+
export declare function saveLockFile(projectDir: string, lockFile: LockFile): void;
|
|
15
|
+
export declare function findLockEntry(lockFile: LockFile, name: string): LockEntry | undefined;
|
|
16
|
+
export declare function upsertLockEntry(lockFile: LockFile, entry: LockEntry): LockFile;
|
|
@@ -28,12 +28,14 @@ export declare class ModuleManager {
|
|
|
28
28
|
moduleError: Error | undefined;
|
|
29
29
|
};
|
|
30
30
|
deleteModule(modulePath: string): void;
|
|
31
|
-
compileModule(modulePath: string, { emitC, debugGc, debugParallelism, debugAsyncAwait, allocator, }?: {
|
|
31
|
+
compileModule(modulePath: string, { emitC, debugGc, debugParallelism, debugAsyncAwait, allocator, isLibrary, }?: {
|
|
32
32
|
emitC?: boolean;
|
|
33
33
|
debugGc?: boolean;
|
|
34
34
|
debugParallelism?: boolean;
|
|
35
35
|
debugAsyncAwait?: boolean;
|
|
36
36
|
allocator?: "mimalloc" | "libc";
|
|
37
|
+
isLibrary?: boolean;
|
|
37
38
|
}): void;
|
|
38
39
|
getGeneratedCode(): string;
|
|
40
|
+
getExportedFunctionNames(): Set<string>;
|
|
39
41
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { BuildSystemLibrary } from "./evaluator/builtins/build";
|
|
2
|
+
export interface PkgConfigResult {
|
|
3
|
+
cFlags: string[];
|
|
4
|
+
ldFlags: string[];
|
|
5
|
+
includePaths: string[];
|
|
6
|
+
libraryPaths: string[];
|
|
7
|
+
linkLibraries: string[];
|
|
8
|
+
}
|
|
9
|
+
export declare function isPkgConfigAvailable(): boolean;
|
|
10
|
+
export declare function resolveSystemLibrary(lib: BuildSystemLibrary, verbose?: boolean): PkgConfigResult;
|
|
11
|
+
export declare function resolveAllSystemLibraries(libraries: BuildSystemLibrary[], verbose?: boolean): PkgConfigResult;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export type Arch = "x86_64" | "aarch64" | "x86" | "arm" | "wasm32";
|
|
2
|
+
export type Os = "linux" | "macos" | "windows" | "freebsd" | "wasi";
|
|
3
|
+
export type Abi = "gnu" | "musl" | "msvc" | "none" | "wasm";
|
|
4
|
+
export interface TargetInfo {
|
|
5
|
+
arch: Arch;
|
|
6
|
+
os: Os;
|
|
7
|
+
abi: Abi | undefined;
|
|
8
|
+
pointerSizeBits: 32 | 64;
|
|
9
|
+
triple: string;
|
|
10
|
+
}
|
|
11
|
+
export interface HostInfo {
|
|
12
|
+
platform: Os;
|
|
13
|
+
arch: Arch;
|
|
14
|
+
}
|
|
15
|
+
export declare function pointerSizeForArch(arch: Arch): 32 | 64;
|
|
16
|
+
export declare function detectHost(): HostInfo;
|
|
17
|
+
export declare function hostTarget(): TargetInfo;
|
|
18
|
+
export declare function parseTarget(triple: string): TargetInfo;
|
|
19
|
+
export declare function clangTriple(target: TargetInfo): string;
|
|
20
|
+
export declare function setCurrentTarget(target: TargetInfo): void;
|
|
21
|
+
export declare function getCurrentTarget(): TargetInfo;
|
|
22
|
+
export declare function targetOsToYoString(os: Os): string;
|
|
23
|
+
export declare function targetArchToYoString(arch: Arch): string;
|
|
24
|
+
export declare function isTargetWindows(target: TargetInfo): boolean;
|
|
25
|
+
export declare function isTargetLinux(target: TargetInfo): boolean;
|
|
26
|
+
export declare function isTargetMacos(target: TargetInfo): boolean;
|
|
27
|
+
export declare function isTargetMSVC(target: TargetInfo): boolean;
|
|
28
|
+
export declare function isTargetWasm(target: TargetInfo): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -45,7 +45,7 @@ export declare function createModuleType(env: Environment): ModuleType;
|
|
|
45
45
|
export declare function createTraitType(env: Environment): TraitType;
|
|
46
46
|
export declare function createEnumType(env: Environment): EnumType;
|
|
47
47
|
export declare function createUnionType(env: Environment): UnionType;
|
|
48
|
-
export declare function createFunctionType({ parameters, forallParameters, implicitParameters, variadicParameter, whereClauseExprs, return_, env, parametersFrame, SelfType, SelfTraitType, isClosure, }: {
|
|
48
|
+
export declare function createFunctionType({ parameters, forallParameters, implicitParameters, variadicParameter, whereClauseExprs, return_, env, parametersFrame, SelfType, SelfTraitType, SelfModuleType, isClosure, }: {
|
|
49
49
|
parameters: FunctionParameter[];
|
|
50
50
|
forallParameters: FunctionForallParameter[];
|
|
51
51
|
implicitParameters?: FunctionImplicitParameter[];
|
|
@@ -56,6 +56,7 @@ export declare function createFunctionType({ parameters, forallParameters, impli
|
|
|
56
56
|
parametersFrame: Frame;
|
|
57
57
|
SelfType?: Type;
|
|
58
58
|
SelfTraitType?: Type;
|
|
59
|
+
SelfModuleType?: Type;
|
|
59
60
|
isClosure?: boolean;
|
|
60
61
|
}): FunctionType;
|
|
61
62
|
export declare function createPtrType(childType: Type): PtrType;
|
|
@@ -14,7 +14,7 @@ export interface Type {
|
|
|
14
14
|
cInclude?: string;
|
|
15
15
|
trait?: TraitType;
|
|
16
16
|
definedInModulePath?: string;
|
|
17
|
-
ioBuiltin?: "io_async" | "io_await" | "io_state" | "io_spawn";
|
|
17
|
+
ioBuiltin?: "io_async" | "io_await" | "io_state" | "io_spawn" | "join_handle_await";
|
|
18
18
|
}
|
|
19
19
|
export interface ExprType extends Type {
|
|
20
20
|
tag: TypeTag.Expr;
|
|
@@ -230,6 +230,7 @@ export interface FunctionType extends Type {
|
|
|
230
230
|
parametersFrame: Frame;
|
|
231
231
|
SelfType?: Type;
|
|
232
232
|
SelfTraitType?: Type;
|
|
233
|
+
SelfModuleType?: Type;
|
|
233
234
|
trait: TraitType;
|
|
234
235
|
isClosure?: boolean;
|
|
235
236
|
}
|