@spyglassmc/mcdoc 0.3.8 → 0.3.10
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/lib/binder/index.js +108 -192
- package/lib/index.d.ts +1 -0
- package/lib/index.js +4 -4
- package/lib/node/index.d.ts +5 -0
- package/lib/node/index.js +76 -131
- package/lib/parser/index.js +97 -217
- package/lib/runtime/attribute/builtin.d.ts +3 -0
- package/lib/runtime/attribute/builtin.js +130 -0
- package/lib/runtime/attribute/index.d.ts +22 -0
- package/lib/runtime/attribute/index.js +22 -0
- package/lib/runtime/attribute/validator.d.ts +16 -0
- package/lib/runtime/attribute/validator.js +85 -0
- package/lib/runtime/checker/context.d.ts +34 -0
- package/lib/runtime/checker/context.js +17 -0
- package/lib/runtime/checker/error.d.ts +70 -0
- package/lib/runtime/checker/error.js +352 -0
- package/lib/runtime/checker/index.d.ts +80 -0
- package/lib/runtime/checker/index.js +914 -0
- package/lib/runtime/completer/index.d.ts +20 -0
- package/lib/runtime/completer/index.js +123 -0
- package/lib/runtime/index.d.ts +5 -0
- package/lib/runtime/index.js +5 -0
- package/lib/type/index.d.ts +65 -82
- package/lib/type/index.js +341 -407
- package/lib/uri_processors.js +2 -8
- package/package.json +3 -3
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { CheckerContext, FullResourceLocation } from '@spyglassmc/core';
|
|
2
|
+
import { type EnumKind } from '../../node/index.js';
|
|
3
|
+
import type { EnumType, Index, KeywordType, ListType, LiteralType, NumericType, ParallelIndices, PrimitiveArrayType, StringType, StructType, StructTypePairField, TupleType, UnionType } from '../../type/index.js';
|
|
4
|
+
import { McdocType } from '../../type/index.js';
|
|
5
|
+
import type { NodeEquivalenceChecker, RuntimeNode } from './context.js';
|
|
6
|
+
import { McdocCheckerContext } from './context.js';
|
|
7
|
+
import type { McdocRuntimeError } from './error.js';
|
|
8
|
+
export * from './context.js';
|
|
9
|
+
export * from './error.js';
|
|
10
|
+
export type SimplifiedMcdocType = SimplifiedMcdocTypeNoUnion | UnionType<SimplifiedMcdocTypeNoUnion>;
|
|
11
|
+
export type SimplifiedMcdocTypeNoUnion = SimplifiedEnum | KeywordType | ListType | LiteralType | NumericType | PrimitiveArrayType | StringType | SimplifiedStructType | TupleType;
|
|
12
|
+
export interface SimplifiedEnum extends EnumType {
|
|
13
|
+
enumKind: EnumKind;
|
|
14
|
+
}
|
|
15
|
+
export interface SimplifiedStructType extends StructType {
|
|
16
|
+
fields: SimplifiedStructTypePairField[];
|
|
17
|
+
}
|
|
18
|
+
export interface SimplifiedStructTypePairField extends StructTypePairField {
|
|
19
|
+
key: SimplifiedMcdocTypeNoUnion;
|
|
20
|
+
}
|
|
21
|
+
export declare function reference<T>(node: RuntimeNode<T>[], path: string, ctx: McdocCheckerContext<T>): void;
|
|
22
|
+
export declare function dispatcher<T>(node: RuntimeNode<T>[], registry: FullResourceLocation, index: string | Index | ParallelIndices, ctx: McdocCheckerContext<T>): void;
|
|
23
|
+
export declare function isAssignable(assignValue: McdocType, typeDef: McdocType, ctx: CheckerContext, isEquivalent?: NodeEquivalenceChecker): boolean;
|
|
24
|
+
export interface CheckerTreeNode<T> {
|
|
25
|
+
parent: CheckerTreeRuntimeNode<T> | undefined;
|
|
26
|
+
runtimeKey: RuntimeNode<T> | undefined;
|
|
27
|
+
possibleValues: CheckerTreeRuntimeNode<T>[];
|
|
28
|
+
}
|
|
29
|
+
export interface CheckerTreeRuntimeNode<T> {
|
|
30
|
+
entryNode: CheckerTreeNode<T>;
|
|
31
|
+
children: CheckerTreeNode<T>[];
|
|
32
|
+
node: RuntimeNode<T>;
|
|
33
|
+
definitionsByParent: CheckerTreeDefinitionGroupNode<T>[];
|
|
34
|
+
}
|
|
35
|
+
export interface CheckerTreeDefinitionGroupNode<T> {
|
|
36
|
+
parents: CheckerTreeDefinitionNode<T>[];
|
|
37
|
+
runtimeNode: CheckerTreeRuntimeNode<T>;
|
|
38
|
+
condensedErrors: McdocRuntimeError<T>[][];
|
|
39
|
+
desc?: string;
|
|
40
|
+
keyDefinition: SimplifiedMcdocTypeNoUnion | undefined;
|
|
41
|
+
originalTypeDef: McdocType;
|
|
42
|
+
validDefinitions: CheckerTreeDefinitionNode<T>[];
|
|
43
|
+
}
|
|
44
|
+
export interface CheckerTreeDefinitionNode<T> {
|
|
45
|
+
groupNode: CheckerTreeDefinitionGroupNode<T>;
|
|
46
|
+
typeDef: SimplifiedMcdocTypeNoUnion;
|
|
47
|
+
children: CheckerTreeDefinitionGroupNode<T>[];
|
|
48
|
+
}
|
|
49
|
+
export declare function typeDefinition<T>(runtimeValues: RuntimeNode<T>[], typeDef: McdocType, ctx: McdocCheckerContext<T>): void;
|
|
50
|
+
export declare function getPossibleTypes(typeDef: McdocType): Exclude<McdocType, UnionType>[];
|
|
51
|
+
/**
|
|
52
|
+
* Basically the same as a {@link CheckerTreeRuntimeNode}, just with a few fields
|
|
53
|
+
* that aren't needed here removed for simplicity.
|
|
54
|
+
*
|
|
55
|
+
* This means {@link CheckerTreeRuntimeNode} can be used in place of this type without
|
|
56
|
+
* any conversions as this type is compatible with {@link CheckerTreeRuntimeNode}.
|
|
57
|
+
*/
|
|
58
|
+
export interface SimplifyValueNode<T> {
|
|
59
|
+
entryNode: {
|
|
60
|
+
parent: SimplifyValueNode<T> | undefined;
|
|
61
|
+
runtimeKey: RuntimeNode<T> | undefined;
|
|
62
|
+
};
|
|
63
|
+
node: RuntimeNode<T>;
|
|
64
|
+
}
|
|
65
|
+
export interface SimplifyContext<T> {
|
|
66
|
+
node: SimplifyValueNode<T>;
|
|
67
|
+
ctx: McdocCheckerContext<T>;
|
|
68
|
+
structFields?: {
|
|
69
|
+
literalFields: Map<string, StructTypePairField>;
|
|
70
|
+
complexFields: SimplifiedStructTypePairField[];
|
|
71
|
+
};
|
|
72
|
+
isMember?: boolean;
|
|
73
|
+
typeArgs?: SimplifiedMcdocType[];
|
|
74
|
+
typeMapping?: {
|
|
75
|
+
[path: string]: SimplifiedMcdocType;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
export declare function simplify<T>(typeDef: Exclude<McdocType, UnionType>, context: SimplifyContext<T>): SimplifiedMcdocTypeNoUnion;
|
|
79
|
+
export declare function simplify<T>(typeDef: McdocType, context: SimplifyContext<T>): SimplifiedMcdocType;
|
|
80
|
+
//# sourceMappingURL=index.d.ts.map
|