@shd101wyy/yo 0.1.12 → 0.1.13
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 +10 -1
- package/out/cjs/index.cjs +578 -572
- package/out/cjs/yo-cli.cjs +1413 -592
- package/out/esm/index.mjs +434 -428
- package/out/types/src/build-runner.d.ts +1 -1
- package/out/types/src/doc/builder.d.ts +21 -0
- package/out/types/src/doc/builder.test.d.ts +1 -0
- package/out/types/src/doc/extractor.d.ts +27 -0
- package/out/types/src/doc/extractor.test.d.ts +1 -0
- package/out/types/src/doc/model.d.ts +87 -0
- package/out/types/src/doc/render-html.d.ts +23 -0
- package/out/types/src/doc/render-html.test.d.ts +1 -0
- package/out/types/src/doc/render-json.d.ts +7 -0
- package/out/types/src/doc/render-json.test.d.ts +1 -0
- package/out/types/src/doc/render-markdown.d.ts +13 -0
- package/out/types/src/doc/render-markdown.test.d.ts +1 -0
- package/out/types/src/doc/sections.d.ts +7 -0
- package/out/types/src/doc/sections.test.d.ts +1 -0
- package/out/types/src/doc-command.d.ts +10 -0
- package/out/types/src/env.d.ts +1 -0
- package/out/types/src/evaluator/builtins/build.d.ts +17 -0
- package/out/types/src/evaluator/context.d.ts +1 -0
- package/out/types/src/expr.d.ts +2 -1
- package/out/types/src/token.d.ts +4 -0
- package/out/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -1
- package/scripts/build-site.ts +461 -0
- package/std/alg/hash.yo +12 -24
- package/std/allocator.yo +21 -29
- package/std/async.yo +4 -2
- package/std/build.yo +188 -42
- package/std/cli/arg_parser.yo +37 -1
- package/std/collections/array_list.yo +8 -20
- package/std/collections/btree_map.yo +15 -20
- package/std/collections/deque.yo +13 -15
- package/std/collections/hash_map.yo +15 -54
- package/std/collections/hash_set.yo +14 -50
- package/std/collections/linked_list.yo +6 -23
- package/std/collections/priority_queue.yo +15 -17
- package/std/crypto/md5.yo +10 -9
- package/std/crypto/random.yo +14 -12
- package/std/crypto/sha256.yo +9 -8
- package/std/encoding/base64.yo +13 -15
- package/std/encoding/hex.yo +14 -10
- package/std/encoding/html.yo +14 -11
- package/std/encoding/html_char_utils.yo +14 -11
- package/std/encoding/html_entities.yo +7 -8
- package/std/encoding/json.yo +36 -19
- package/std/encoding/punycode.yo +21 -18
- package/std/encoding/toml.yo +23 -9
- package/std/encoding/utf16.yo +16 -9
- package/std/error.yo +10 -23
- package/std/fmt/display.yo +15 -17
- package/std/fmt/index.yo +6 -27
- package/std/fmt/to_string.yo +4 -10
- package/std/fmt/writer.yo +33 -34
- package/std/fs/dir.yo +37 -30
- package/std/fs/file.yo +77 -75
- package/std/fs/metadata.yo +25 -25
- package/std/fs/temp.yo +21 -27
- package/std/fs/types.yo +20 -23
- package/std/fs/walker.yo +26 -31
- package/std/gc.yo +5 -0
- package/std/glob/index.yo +3 -0
- package/std/http/client.yo +25 -11
- package/std/http/http.yo +20 -0
- package/std/http/index.yo +1 -0
- package/std/io/reader.yo +4 -8
- package/std/io/writer.yo +4 -7
- package/std/libc/assert.yo +2 -2
- package/std/libc/ctype.yo +1 -2
- package/std/libc/dirent.yo +1 -2
- package/std/libc/errno.yo +1 -2
- package/std/libc/fcntl.yo +2 -2
- package/std/libc/float.yo +1 -2
- package/std/libc/limits.yo +1 -2
- package/std/libc/math.yo +2 -0
- package/std/libc/signal.yo +1 -2
- package/std/libc/stdatomic.yo +1 -2
- package/std/libc/stdint.yo +4 -3
- package/std/libc/stdio.yo +2 -0
- package/std/libc/stdlib.yo +2 -0
- package/std/libc/string.yo +2 -0
- package/std/libc/sys/stat.yo +1 -2
- package/std/libc/time.yo +2 -2
- package/std/libc/unistd.yo +2 -0
- package/std/libc/wctype.yo +1 -2
- package/std/libc/windows.yo +2 -2
- package/std/log/index.yo +11 -26
- package/std/net/addr.yo +18 -11
- package/std/net/dns.yo +3 -2
- package/std/net/errors.yo +16 -2
- package/std/net/tcp.yo +25 -22
- package/std/net/udp.yo +14 -12
- package/std/os/env.yo +23 -18
- package/std/os/signal.yo +31 -19
- package/std/path.yo +23 -74
- package/std/prelude.yo +284 -113
- package/std/process.yo +23 -37
- package/std/regex/compiler.yo +3 -5
- package/std/regex/flags.yo +11 -11
- package/std/regex/index.yo +2 -13
- package/std/regex/match.yo +3 -5
- package/std/regex/node.yo +6 -6
- package/std/regex/parser.yo +2 -4
- package/std/regex/unicode.yo +5 -5
- package/std/regex/vm.yo +5 -5
- package/std/string/index.yo +2 -1
- package/std/string/rune.yo +25 -1
- package/std/string/string.yo +31 -19
- package/std/string/unicode.yo +14 -15
- package/std/sync/channel.yo +18 -28
- package/std/sync/cond.yo +4 -0
- package/std/sync/mutex.yo +4 -1
- package/std/sync/once.yo +17 -19
- package/std/sync/rwlock.yo +19 -22
- package/std/sync/waitgroup.yo +21 -23
- package/std/sys/advise.yo +4 -4
- package/std/sys/bufio/buf_reader.yo +19 -16
- package/std/sys/bufio/buf_writer.yo +14 -11
- package/std/sys/clock.yo +4 -4
- package/std/sys/constants.yo +5 -5
- package/std/sys/copy.yo +9 -8
- package/std/sys/dir.yo +9 -8
- package/std/sys/dns.yo +8 -8
- package/std/sys/errors.yo +35 -6
- package/std/sys/events.yo +3 -3
- package/std/sys/externs.yo +3 -3
- package/std/sys/fallocate.yo +4 -4
- package/std/sys/fcntl.yo +8 -6
- package/std/sys/file.yo +7 -8
- package/std/sys/future.yo +1 -3
- package/std/sys/iov.yo +4 -4
- package/std/sys/lock.yo +7 -7
- package/std/sys/mmap.yo +7 -8
- package/std/sys/path.yo +4 -7
- package/std/sys/perm.yo +8 -8
- package/std/sys/pipe.yo +9 -8
- package/std/sys/process.yo +8 -8
- package/std/sys/seek.yo +4 -4
- package/std/sys/signal.yo +4 -4
- package/std/sys/signals.yo +4 -4
- package/std/sys/socket.yo +4 -4
- package/std/sys/socketpair.yo +4 -4
- package/std/sys/sockinfo.yo +4 -4
- package/std/sys/statfs.yo +8 -8
- package/std/sys/statx.yo +4 -4
- package/std/sys/sysinfo.yo +4 -4
- package/std/sys/tcp.yo +8 -8
- package/std/sys/temp.yo +9 -8
- package/std/sys/time.yo +8 -8
- package/std/sys/timer.yo +7 -8
- package/std/sys/tty.yo +13 -10
- package/std/sys/udp.yo +8 -8
- package/std/sys/umask.yo +4 -4
- package/std/sys/unix.yo +5 -5
- package/std/testing/bench.yo +21 -10
- package/std/thread.yo +18 -9
- package/std/time/datetime.yo +12 -14
- package/std/time/duration.yo +12 -14
- package/std/time/instant.yo +13 -16
- package/std/time/sleep.yo +9 -8
- package/std/url/index.yo +3 -19
- package/std/worker.yo +10 -18
|
@@ -16,7 +16,7 @@ export declare function stageRuntimeFiles(runtimeFiles: readonly string[], outpu
|
|
|
16
16
|
export declare function runBuild(options: BuildOptions): Promise<void>;
|
|
17
17
|
export interface DAGNode {
|
|
18
18
|
name: string;
|
|
19
|
-
kind: "artifact" | "test" | "run" | "step";
|
|
19
|
+
kind: "artifact" | "test" | "run" | "step" | "doc";
|
|
20
20
|
dependsOn: string[];
|
|
21
21
|
}
|
|
22
22
|
export declare function buildDAG(registry: BuildRegistry, rootStepName: string): DAGNode[];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Token } from "../token";
|
|
2
|
+
import type { ModuleValue } from "../value";
|
|
3
|
+
import type { DocExtractionResult } from "./extractor";
|
|
4
|
+
import type { DocModule } from "./model";
|
|
5
|
+
export interface BuildDocModuleOptions {
|
|
6
|
+
name: string;
|
|
7
|
+
path: string;
|
|
8
|
+
moduleValue: ModuleValue;
|
|
9
|
+
extraction: DocExtractionResult;
|
|
10
|
+
tokens: Token[];
|
|
11
|
+
includePrivate?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function buildDocModule(options: BuildDocModuleOptions): DocModule;
|
|
14
|
+
export interface BuildDocModuleFromTokensOptions {
|
|
15
|
+
name: string;
|
|
16
|
+
path: string;
|
|
17
|
+
extraction: DocExtractionResult;
|
|
18
|
+
tokens: Token[];
|
|
19
|
+
}
|
|
20
|
+
export declare function buildDocModuleFromTokens(options: BuildDocModuleFromTokensOptions): DocModule;
|
|
21
|
+
export declare function buildCrossReferences(modules: DocModule[]): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Token } from "../token";
|
|
2
|
+
export interface DocComment {
|
|
3
|
+
content: string;
|
|
4
|
+
inner: boolean;
|
|
5
|
+
position: Token["position"];
|
|
6
|
+
modulePath: string;
|
|
7
|
+
}
|
|
8
|
+
export interface DocAssociation {
|
|
9
|
+
comment: DocComment;
|
|
10
|
+
declarationName: string;
|
|
11
|
+
declarationPosition: Token["position"] | null;
|
|
12
|
+
}
|
|
13
|
+
export interface DocExtractionResult {
|
|
14
|
+
moduleDoc: DocComment | null;
|
|
15
|
+
declarations: DocAssociation[];
|
|
16
|
+
}
|
|
17
|
+
export interface InlineDocResult {
|
|
18
|
+
docs: Map<string, string>;
|
|
19
|
+
}
|
|
20
|
+
export declare function stripDocLineComment(value: string): string;
|
|
21
|
+
export declare function stripDocBlockComment(value: string): string;
|
|
22
|
+
export declare function extractDocComments(tokens: Token[]): DocExtractionResult;
|
|
23
|
+
export declare function extractInlineDocs(tokens: Token[], startIndex: number, endIndex: number): InlineDocResult;
|
|
24
|
+
export declare function findMatchingParens(tokens: Token[], searchStart: number): {
|
|
25
|
+
open: number;
|
|
26
|
+
close: number;
|
|
27
|
+
} | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
export type DocItemKind = "function" | "struct" | "object" | "enum" | "newtype" | "union" | "trait" | "module" | "constant" | "type-alias" | "type-function";
|
|
2
|
+
export interface DocParam {
|
|
3
|
+
name: string;
|
|
4
|
+
type: string;
|
|
5
|
+
isComptime: boolean;
|
|
6
|
+
isImplicit: boolean;
|
|
7
|
+
defaultValue?: string;
|
|
8
|
+
doc?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface DocField {
|
|
11
|
+
name: string;
|
|
12
|
+
type: string;
|
|
13
|
+
doc?: string;
|
|
14
|
+
defaultValue?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface DocVariant {
|
|
17
|
+
name: string;
|
|
18
|
+
fields?: DocField[];
|
|
19
|
+
doc?: string;
|
|
20
|
+
discriminant?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface DocAssociatedType {
|
|
23
|
+
name: string;
|
|
24
|
+
doc?: string;
|
|
25
|
+
constraint?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface DocFunction {
|
|
28
|
+
name: string;
|
|
29
|
+
doc?: string;
|
|
30
|
+
signature: string;
|
|
31
|
+
parameters: DocParam[];
|
|
32
|
+
returnType: string;
|
|
33
|
+
typeParams?: DocParam[];
|
|
34
|
+
effects?: DocParam[];
|
|
35
|
+
isMethod: boolean;
|
|
36
|
+
selfType?: string;
|
|
37
|
+
returns?: string;
|
|
38
|
+
errors?: string;
|
|
39
|
+
deprecated?: string;
|
|
40
|
+
examples?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface DocType {
|
|
43
|
+
name: string;
|
|
44
|
+
doc?: string;
|
|
45
|
+
kind: DocItemKind;
|
|
46
|
+
signature: string;
|
|
47
|
+
typeParams?: DocParam[];
|
|
48
|
+
fields?: DocField[];
|
|
49
|
+
variants?: DocVariant[];
|
|
50
|
+
methods: DocFunction[];
|
|
51
|
+
traitImpls: string[];
|
|
52
|
+
deprecated?: string;
|
|
53
|
+
examples?: string;
|
|
54
|
+
}
|
|
55
|
+
export interface DocTrait {
|
|
56
|
+
name: string;
|
|
57
|
+
doc?: string;
|
|
58
|
+
kind: "trait" | "module" | "trait-function" | "module-function";
|
|
59
|
+
signature: string;
|
|
60
|
+
typeParams?: DocParam[];
|
|
61
|
+
associatedTypes?: DocAssociatedType[];
|
|
62
|
+
methods: DocFunction[];
|
|
63
|
+
implementors: string[];
|
|
64
|
+
deprecated?: string;
|
|
65
|
+
examples?: string;
|
|
66
|
+
}
|
|
67
|
+
export interface DocConstant {
|
|
68
|
+
name: string;
|
|
69
|
+
doc?: string;
|
|
70
|
+
type: string;
|
|
71
|
+
value?: string;
|
|
72
|
+
deprecated?: string;
|
|
73
|
+
}
|
|
74
|
+
export interface DocModule {
|
|
75
|
+
name: string;
|
|
76
|
+
path: string;
|
|
77
|
+
doc?: string;
|
|
78
|
+
functions: DocFunction[];
|
|
79
|
+
types: DocType[];
|
|
80
|
+
traits: DocTrait[];
|
|
81
|
+
constants: DocConstant[];
|
|
82
|
+
submodules: DocModule[];
|
|
83
|
+
}
|
|
84
|
+
export interface DocModel {
|
|
85
|
+
name: string;
|
|
86
|
+
modules: DocModule[];
|
|
87
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { DocModel } from "./model";
|
|
2
|
+
export declare function destroyMarkdownRenderer(): void;
|
|
3
|
+
declare function escapeHtml(text: string): string;
|
|
4
|
+
declare function moduleToFilename(name: string): string;
|
|
5
|
+
declare function moduleDisplayName(name: string): string;
|
|
6
|
+
declare function moduleGroup(name: string): string;
|
|
7
|
+
declare function generateCSS(): string;
|
|
8
|
+
declare function generateSearchJS(): string;
|
|
9
|
+
interface SearchEntry {
|
|
10
|
+
name: string;
|
|
11
|
+
kind: string;
|
|
12
|
+
href: string;
|
|
13
|
+
doc?: string;
|
|
14
|
+
module: string;
|
|
15
|
+
}
|
|
16
|
+
declare function buildSearchIndex(model: DocModel): SearchEntry[];
|
|
17
|
+
declare function firstSentence(text: string): string;
|
|
18
|
+
export interface RenderHtmlOptions {
|
|
19
|
+
model: DocModel;
|
|
20
|
+
outputDir: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function renderDocSite(options: RenderHtmlOptions): Promise<void>;
|
|
23
|
+
export { escapeHtml, buildSearchIndex, firstSentence, generateCSS, generateSearchJS, moduleToFilename, moduleDisplayName, moduleGroup, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { DocModel, DocModule, DocFunction, DocType, DocTrait, DocConstant } from "./model";
|
|
2
|
+
declare function renderFunction(fn: DocFunction): string;
|
|
3
|
+
declare function renderType(type: DocType): string;
|
|
4
|
+
declare function renderTrait(trait: DocTrait): string;
|
|
5
|
+
declare function renderConstant(constant: DocConstant): string;
|
|
6
|
+
declare function renderModule(mod: DocModule): string;
|
|
7
|
+
declare function renderIndex(model: DocModel): string;
|
|
8
|
+
export interface RenderMarkdownOptions {
|
|
9
|
+
model: DocModel;
|
|
10
|
+
outputDir: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function renderDocMarkdown(options: RenderMarkdownOptions): void;
|
|
13
|
+
export { renderFunction as renderFunctionMd, renderType as renderTypeMd, renderTrait as renderTraitMd, renderConstant as renderConstantMd, renderModule as renderModuleMd, renderIndex as renderIndexMd, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type DocFormat = "html" | "markdown" | "json";
|
|
2
|
+
export interface DocCommandOptions {
|
|
3
|
+
input: string;
|
|
4
|
+
outputDir: string;
|
|
5
|
+
includePrivate: boolean;
|
|
6
|
+
verbose: boolean;
|
|
7
|
+
title?: string;
|
|
8
|
+
format?: DocFormat;
|
|
9
|
+
}
|
|
10
|
+
export declare function runDoc(options: DocCommandOptions): Promise<void>;
|
package/out/types/src/env.d.ts
CHANGED
|
@@ -73,6 +73,17 @@ export interface ImportedModule {
|
|
|
73
73
|
resolvedRoot?: string;
|
|
74
74
|
propagatedSystemLibraries?: string[];
|
|
75
75
|
}
|
|
76
|
+
export interface BuildDocConfig {
|
|
77
|
+
name: string;
|
|
78
|
+
root: string;
|
|
79
|
+
outputDir: string;
|
|
80
|
+
format: string;
|
|
81
|
+
includePrivate: boolean;
|
|
82
|
+
includeDeps: boolean;
|
|
83
|
+
title: string;
|
|
84
|
+
logo: string;
|
|
85
|
+
favicon: string;
|
|
86
|
+
}
|
|
76
87
|
export declare class BuildRegistry {
|
|
77
88
|
artifacts: BuildArtifact[];
|
|
78
89
|
testSuites: BuildTestSuite[];
|
|
@@ -83,6 +94,7 @@ export declare class BuildRegistry {
|
|
|
83
94
|
systemLibraries: BuildSystemLibrary[];
|
|
84
95
|
dependencyArtifacts: DependencyArtifactRef[];
|
|
85
96
|
modules: BuildModuleEntry[];
|
|
97
|
+
docConfigs: BuildDocConfig[];
|
|
86
98
|
cliOptions: Map<string, string>;
|
|
87
99
|
declaredOptions: Map<string, {
|
|
88
100
|
description: string;
|
|
@@ -109,6 +121,8 @@ export declare class BuildRegistry {
|
|
|
109
121
|
findTest(name: string): BuildTestSuite | undefined;
|
|
110
122
|
findRunStep(name: string): BuildRunStep | undefined;
|
|
111
123
|
findStep(name: string): BuildStep | undefined;
|
|
124
|
+
findDocumentation(name: string): BuildDocConfig | undefined;
|
|
125
|
+
registerDocumentation(config: BuildDocConfig): void;
|
|
112
126
|
private checkDuplicateArtifactName;
|
|
113
127
|
findDependency(name: string): BuildGitDependency | undefined;
|
|
114
128
|
findPathDependency(name: string): BuildPathDependency | undefined;
|
|
@@ -123,6 +137,9 @@ export declare class BuildRegistry {
|
|
|
123
137
|
} | {
|
|
124
138
|
kind: "run";
|
|
125
139
|
value: BuildRunStep;
|
|
140
|
+
} | {
|
|
141
|
+
kind: "doc";
|
|
142
|
+
value: BuildDocConfig;
|
|
126
143
|
} | {
|
|
127
144
|
kind: "step";
|
|
128
145
|
value: BuildStep;
|
package/out/types/src/expr.d.ts
CHANGED
|
@@ -64,7 +64,7 @@ export interface EvaluatedExprData {
|
|
|
64
64
|
caseExecuted?: boolean;
|
|
65
65
|
isPrimitiveMatch?: boolean;
|
|
66
66
|
primitivePatternValues?: (Value | undefined)[];
|
|
67
|
-
|
|
67
|
+
docComment?: string;
|
|
68
68
|
deferredDupExpressions?: Expr[];
|
|
69
69
|
deferredDropExpressions?: Expr[];
|
|
70
70
|
consumedVariableDropExpressions?: Expr[];
|
|
@@ -600,6 +600,7 @@ export declare const BuiltinFunctions: {
|
|
|
600
600
|
__yo_build_add_import: string[];
|
|
601
601
|
__yo_build_add_cflags: string[];
|
|
602
602
|
__yo_build_dep_module: string[];
|
|
603
|
+
__yo_build_doc: string[];
|
|
603
604
|
asm: string[];
|
|
604
605
|
global_asm: string[];
|
|
605
606
|
};
|
package/out/types/src/token.d.ts
CHANGED
|
@@ -17,6 +17,10 @@ export declare enum TokenType {
|
|
|
17
17
|
Comma = ",",
|
|
18
18
|
SingleLineComment = "single_line_comment",
|
|
19
19
|
MultiLineComment = "multi_line_comment",
|
|
20
|
+
DocLineComment = "doc_line_comment",
|
|
21
|
+
InnerDocLineComment = "inner_doc_line_comment",
|
|
22
|
+
DocBlockComment = "doc_block_comment",
|
|
23
|
+
InnerDocBlockComment = "inner_doc_block_comment",
|
|
20
24
|
Whitespace = "whitespace",
|
|
21
25
|
TemplateString = "template_string"
|
|
22
26
|
}
|