@shd101wyy/yo 0.1.13 → 0.1.15

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.
Files changed (42) hide show
  1. package/README.md +40 -1
  2. package/out/cjs/index.cjs +514 -514
  3. package/out/cjs/yo-cli.cjs +809 -686
  4. package/out/cjs/yo-lsp.cjs +11635 -0
  5. package/out/esm/index.mjs +359 -359
  6. package/out/types/src/cache.d.ts +2 -0
  7. package/out/types/src/doc/extractor.d.ts +4 -0
  8. package/out/types/src/doc/render-html.d.ts +5 -1
  9. package/out/types/src/evaluator/values/impl.d.ts +9 -1
  10. package/out/types/src/lsp/completion.d.ts +3 -0
  11. package/out/types/src/lsp/definition.d.ts +3 -0
  12. package/out/types/src/lsp/diagnostics.d.ts +6 -0
  13. package/out/types/src/lsp/document-manager.d.ts +31 -0
  14. package/out/types/src/lsp/folding.d.ts +3 -0
  15. package/out/types/src/lsp/hover.d.ts +3 -0
  16. package/out/types/src/lsp/inlay-hints.d.ts +3 -0
  17. package/out/types/src/lsp/references.d.ts +3 -0
  18. package/out/types/src/lsp/rename.d.ts +16 -0
  19. package/out/types/src/lsp/server.d.ts +1 -0
  20. package/out/types/src/lsp/signature-help.d.ts +3 -0
  21. package/out/types/src/lsp/symbols.d.ts +3 -0
  22. package/out/types/src/lsp/utils.d.ts +11 -0
  23. package/out/types/src/tests/lsp.test.d.ts +1 -0
  24. package/out/types/src/tests/version.test.d.ts +1 -0
  25. package/out/types/src/types/definitions.d.ts +2 -0
  26. package/out/types/src/version-cache.d.ts +7 -0
  27. package/out/types/src/version.d.ts +5 -0
  28. package/out/types/tsconfig.tsbuildinfo +1 -1
  29. package/package.json +3 -1
  30. package/scripts/build-site.ts +69 -15
  31. package/scripts/check-liburing.js +2 -2
  32. package/std/build.yo +8 -4
  33. package/std/encoding/base64.yo +7 -4
  34. package/std/encoding/hex.yo +7 -4
  35. package/std/encoding/html.yo +7 -4
  36. package/std/encoding/json.yo +9 -6
  37. package/std/encoding/punycode.yo +9 -6
  38. package/std/encoding/toml.yo +7 -4
  39. package/std/encoding/utf16.yo +7 -4
  40. package/std/fs/dir.yo +16 -13
  41. package/std/fs/file.yo +19 -16
  42. package/std/http/client.yo +12 -6
@@ -1,3 +1,5 @@
1
1
  export declare function getGlobalCacheDir(): string;
2
2
  export declare function getGlobalDepsCacheDir(): string;
3
3
  export declare function ensureGlobalDepsCacheDir(): string;
4
+ export declare function getGlobalVersionsCacheDir(): string;
5
+ export declare function getVersionCacheDir(version: string): string;
@@ -17,6 +17,10 @@ export interface DocExtractionResult {
17
17
  export interface InlineDocResult {
18
18
  docs: Map<string, string>;
19
19
  }
20
+ export declare function getDocCommentLookupKey(target: {
21
+ position: Token["position"];
22
+ modulePath: string;
23
+ }): string;
20
24
  export declare function stripDocLineComment(value: string): string;
21
25
  export declare function stripDocBlockComment(value: string): string;
22
26
  export declare function extractDocComments(tokens: Token[]): DocExtractionResult;
@@ -4,8 +4,12 @@ declare function escapeHtml(text: string): string;
4
4
  declare function moduleToFilename(name: string): string;
5
5
  declare function moduleDisplayName(name: string): string;
6
6
  declare function moduleGroup(name: string): string;
7
+ type SymbolLinks = Map<string, string>;
8
+ declare function buildSymbolLinks(model: DocModel): SymbolLinks;
9
+ declare function linkifyType(typeStr: string, symbolLinks: SymbolLinks, currentModuleFilename?: string): string;
7
10
  declare function generateCSS(): string;
8
11
  declare function generateSearchJS(): string;
12
+ declare function generateHighlightJS(): string;
9
13
  interface SearchEntry {
10
14
  name: string;
11
15
  kind: string;
@@ -20,4 +24,4 @@ export interface RenderHtmlOptions {
20
24
  outputDir: string;
21
25
  }
22
26
  export declare function renderDocSite(options: RenderHtmlOptions): Promise<void>;
23
- export { escapeHtml, buildSearchIndex, firstSentence, generateCSS, generateSearchJS, moduleToFilename, moduleDisplayName, moduleGroup, };
27
+ export { escapeHtml, buildSearchIndex, buildSymbolLinks, linkifyType, firstSentence, generateCSS, generateSearchJS, generateHighlightJS, moduleToFilename, moduleDisplayName, moduleGroup, };
@@ -1,6 +1,6 @@
1
1
  import { type Environment } from "../../env";
2
2
  import { type Expr, type FnCallExpr } from "../../expr";
3
- import type { FunctionType, SomeType, TraitType, Type } from "../../types/definitions";
3
+ import type { FunctionType, SomeType, TraitField, TraitType, Type } from "../../types/definitions";
4
4
  import { type TraitValue, type UnknownValue, type Value } from "../../value";
5
5
  import type { EvaluatorContext } from "../context";
6
6
  export type ForallParameter = {
@@ -44,6 +44,13 @@ export declare function findMethodsFromGenericImpls({ concreteType, methodName,
44
44
  type: FunctionType;
45
45
  value: Value | undefined;
46
46
  }[];
47
+ export declare function enumerateMethodNamesFromGenericImpls({ concreteType, env, }: {
48
+ concreteType: Type;
49
+ env: Environment;
50
+ }): {
51
+ name: string;
52
+ type: FunctionType;
53
+ }[];
47
54
  export declare function findAssociatedTypeFromGenericImpls({ concreteType, propertyName, env, }: {
48
55
  concreteType: Type;
49
56
  propertyName: string;
@@ -62,6 +69,7 @@ export declare function findMethodFromGenericImplForTrait({ concreteType, traitT
62
69
  value: Value | undefined;
63
70
  } | undefined;
64
71
  export declare function clearImplsFromModule(modulePath: string): void;
72
+ export declare function snapshotAllImplTraitFields(): Map<TraitType, TraitField[]>;
65
73
  export declare function evaluateModuleValue({ expr, env, context, }: {
66
74
  expr: FnCallExpr;
67
75
  env: Environment;
@@ -0,0 +1,3 @@
1
+ import type { CompletionItem } from "vscode-languageserver";
2
+ import type { LspDocumentManager } from "./document-manager";
3
+ export declare function handleCompletion(uri: string, line: number, character: number, lineText: string, docManager: LspDocumentManager): CompletionItem[];
@@ -0,0 +1,3 @@
1
+ import type { Location } from "vscode-languageserver";
2
+ import type { LspDocumentManager } from "./document-manager";
3
+ export declare function handleDefinition(uri: string, line: number, character: number, docManager: LspDocumentManager): Location | null;
@@ -0,0 +1,6 @@
1
+ import type { Diagnostic } from "vscode-languageserver";
2
+ import { YoLexerError } from "../error";
3
+ import type { LspDocumentManager } from "./document-manager";
4
+ export declare function getDiagnosticsForUri(uri: string, docManager: LspDocumentManager, documentText?: string): Diagnostic[];
5
+ export declare function errorToDiagnostics(error: Error, documentText?: string): Diagnostic[];
6
+ export declare function lexerErrorToDiagnostic(error: YoLexerError, text: string): Diagnostic;
@@ -0,0 +1,31 @@
1
+ import type { TextDocuments } from "vscode-languageserver";
2
+ import type { TextDocument } from "vscode-languageserver-textdocument";
3
+ import { ModuleManager } from "../module-manager";
4
+ type ModuleData = NonNullable<ReturnType<ModuleManager["modules"]["get"]>>;
5
+ export declare class LspDocumentManager {
6
+ private moduleManager;
7
+ private moduleManagerStdPath;
8
+ private evaluatedBuildProjects;
9
+ private lastAnalyzedTextByUri;
10
+ private analyzeGenerationByUri;
11
+ private lastGoodModules;
12
+ constructor(stdPath?: string);
13
+ getStdPath(): string | null;
14
+ attachToDocuments(documents: TextDocuments<TextDocument>, onDiagnostics: (uri: string) => void): void;
15
+ analyzeDocument(document: TextDocument, onDiagnostics: (uri: string) => void): void;
16
+ getModule(uri: string): {
17
+ moduleValue: import("../value").ModuleValue;
18
+ moduleError: Error | undefined;
19
+ evaluator: import("../evaluator").default;
20
+ } | undefined;
21
+ getModuleForCompletion(uri: string): ModuleData | undefined;
22
+ getLastGoodModule(uri: string): ModuleData | undefined;
23
+ getModuleManager(): ModuleManager;
24
+ private ensureStdPathForUri;
25
+ private findStdPath;
26
+ private findBuildYoForUri;
27
+ private ensureBuildImportsResolved;
28
+ private findDependencyDir;
29
+ private resolveDepModuleRoot;
30
+ }
31
+ export {};
@@ -0,0 +1,3 @@
1
+ import { FoldingRange } from "vscode-languageserver";
2
+ import type { LspDocumentManager } from "./document-manager";
3
+ export declare function handleFoldingRange(uri: string, docManager: LspDocumentManager): FoldingRange[];
@@ -0,0 +1,3 @@
1
+ import type { Hover } from "vscode-languageserver";
2
+ import type { LspDocumentManager } from "./document-manager";
3
+ export declare function handleHover(uri: string, line: number, character: number, docManager: LspDocumentManager): Hover | null;
@@ -0,0 +1,3 @@
1
+ import { type InlayHint } from "vscode-languageserver";
2
+ import type { LspDocumentManager } from "./document-manager";
3
+ export declare function handleInlayHint(uri: string, docManager: LspDocumentManager): InlayHint[];
@@ -0,0 +1,3 @@
1
+ import type { Location } from "vscode-languageserver";
2
+ import type { LspDocumentManager } from "./document-manager";
3
+ export declare function handleReferences(uri: string, line: number, character: number, docManager: LspDocumentManager): Location[] | null;
@@ -0,0 +1,16 @@
1
+ import type { RenameParams, WorkspaceEdit } from "vscode-languageserver";
2
+ import type { LspDocumentManager } from "./document-manager";
3
+ export declare function handleRename(params: RenameParams, docManager: LspDocumentManager): WorkspaceEdit | null;
4
+ export declare function handlePrepareRename(uri: string, line: number, character: number, docManager: LspDocumentManager): {
5
+ range: {
6
+ start: {
7
+ line: number;
8
+ character: number;
9
+ };
10
+ end: {
11
+ line: number;
12
+ character: number;
13
+ };
14
+ };
15
+ placeholder: string;
16
+ } | null;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import { type SignatureHelp } from "vscode-languageserver";
2
+ import type { LspDocumentManager } from "./document-manager";
3
+ export declare function handleSignatureHelp(uri: string, line: number, character: number, docManager: LspDocumentManager): SignatureHelp | null;
@@ -0,0 +1,3 @@
1
+ import { DocumentSymbol } from "vscode-languageserver";
2
+ import type { LspDocumentManager } from "./document-manager";
3
+ export declare function handleDocumentSymbol(uri: string, docManager: LspDocumentManager): DocumentSymbol[];
@@ -0,0 +1,11 @@
1
+ import type { Variable } from "../env";
2
+ import { type AtomExpr, type Expr } from "../expr";
3
+ import { type Token } from "../token";
4
+ export declare function findTokenAtPosition(tokens: Token[], line: number, character: number): Token | null;
5
+ export declare function collectExpressionCandidates(exprs: Expr[], targetToken: Token, candidateExprs: AtomExpr[]): void;
6
+ export declare function findBestExpressionMatch(exprs: Expr[], targetToken: Token, targetLine: number): Expr | null;
7
+ export declare function selectBestVariableAtPosition(variables: Variable[], targetToken: Pick<Token, "position" | "modulePath">): Variable | undefined;
8
+ export declare function walkExprs(exprs: Expr[], visitor: (expr: Expr) => void): void;
9
+ export declare function modulePathToUri(modulePath: string): string;
10
+ export declare function uriToModulePath(uri: string): string;
11
+ export declare function modulePathToFsPath(modulePath: string): string;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -97,6 +97,7 @@ export interface TypeField {
97
97
  assignedValue?: Value;
98
98
  exprs: FieldExprs;
99
99
  isEffectParam?: boolean;
100
+ docComment?: string;
100
101
  }
101
102
  export interface TupleType extends Type {
102
103
  tag: TypeTag.Tuple;
@@ -145,6 +146,7 @@ export interface ModuleField {
145
146
  defaultValue?: Value;
146
147
  assignedValue?: Value;
147
148
  exprs: FieldExprs;
149
+ docComment?: string;
148
150
  }
149
151
  export interface TraitField extends ModuleField {
150
152
  unassignedSomeType?: SomeType;
@@ -0,0 +1,7 @@
1
+ export declare function isVersionCached(version: string): boolean;
2
+ export declare function listCachedVersions(): string[];
3
+ export declare function cleanVersionCache(version?: string): void;
4
+ export declare function ensureCachedVersion(version: string): Promise<string>;
5
+ export declare function downloadVersion(version: string): Promise<string>;
6
+ export declare function fetchRemoteVersions(): Promise<string[]>;
7
+ export declare function findJsRuntime(): string;
@@ -0,0 +1,5 @@
1
+ export declare function getCurrentYoVersion(): string;
2
+ export declare function findYoVersionFile(startDir: string): string | null;
3
+ export declare function parseYoVersion(content: string): string;
4
+ export declare function readYoVersion(startDir: string): string | null;
5
+ export declare function isPinnedVersionCurrent(pinnedVersion: string): boolean;