@markw65/monkeyc-optimizer 1.1.34 → 1.1.35

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 (80) hide show
  1. package/CHANGELOG.md +959 -0
  2. package/README.md +9 -1
  3. package/build/api.cjs +31 -31
  4. package/build/{chunk-QBCVUVLD.cjs → chunk-Q5WTV4CN.cjs} +944 -2248
  5. package/build/optimizer.cjs +17 -17
  6. package/build/sdk-util.cjs +14 -14
  7. package/build/src/api.d.ts +1 -1
  8. package/build/src/type-flow/types.d.ts +1 -1
  9. package/build/worker-thread.cjs +3 -3
  10. package/package.json +2 -1
  11. package/build/src/readprg/switch.d.ts +0 -5
  12. package/build/src/src/api.d.ts +0 -51
  13. package/build/src/src/ast.d.ts +0 -59
  14. package/build/src/src/build.d.ts +0 -7
  15. package/build/src/src/cftinfo.d.ts +0 -32
  16. package/build/src/src/control-flow.d.ts +0 -22
  17. package/build/src/src/data-flow.d.ts +0 -107
  18. package/build/src/src/driver.d.ts +0 -2
  19. package/build/src/src/function-info.d.ts +0 -14
  20. package/build/src/src/inliner.d.ts +0 -13
  21. package/build/src/src/jungles.d.ts +0 -66
  22. package/build/src/src/launch.d.ts +0 -5
  23. package/build/src/src/logger.d.ts +0 -6
  24. package/build/src/src/manifest.d.ts +0 -11
  25. package/build/src/src/mc-rewrite.d.ts +0 -13
  26. package/build/src/src/negative-fixups.d.ts +0 -1
  27. package/build/src/src/optimizer-types.d.ts +0 -249
  28. package/build/src/src/optimizer.d.ts +0 -100
  29. package/build/src/src/pragma-checker.d.ts +0 -3
  30. package/build/src/src/pre.d.ts +0 -2
  31. package/build/src/src/projects.d.ts +0 -26
  32. package/build/src/src/readprg/array-init.d.ts +0 -3
  33. package/build/src/src/readprg/bytecode.d.ts +0 -72
  34. package/build/src/src/readprg/cflow.d.ts +0 -17
  35. package/build/src/src/readprg/data.d.ts +0 -4
  36. package/build/src/src/readprg/dce.d.ts +0 -6
  37. package/build/src/src/readprg/emit.d.ts +0 -23
  38. package/build/src/src/readprg/exceptions.d.ts +0 -10
  39. package/build/src/src/readprg/header.d.ts +0 -15
  40. package/build/src/src/readprg/interp.d.ts +0 -21
  41. package/build/src/src/readprg/linenum.d.ts +0 -29
  42. package/build/src/src/readprg/locals.d.ts +0 -3
  43. package/build/src/src/readprg/opcodes.d.ts +0 -279
  44. package/build/src/src/readprg/optimize.d.ts +0 -3
  45. package/build/src/src/readprg/pre.d.ts +0 -2
  46. package/build/src/src/readprg/sharing.d.ts +0 -2
  47. package/build/src/src/readprg/signer.d.ts +0 -8
  48. package/build/src/src/readprg/symbols.d.ts +0 -19
  49. package/build/src/src/readprg.d.ts +0 -25
  50. package/build/src/src/resources.d.ts +0 -12
  51. package/build/src/src/sdk-util.d.ts +0 -28
  52. package/build/src/src/type-flow/could-be.d.ts +0 -5
  53. package/build/src/src/type-flow/dead-store.d.ts +0 -18
  54. package/build/src/src/type-flow/interp-binary.d.ts +0 -4
  55. package/build/src/src/type-flow/interp-call.d.ts +0 -16
  56. package/build/src/src/type-flow/interp.d.ts +0 -33
  57. package/build/src/src/type-flow/intersection-type.d.ts +0 -4
  58. package/build/src/src/type-flow/minimize-locals.d.ts +0 -4
  59. package/build/src/src/type-flow/minimize-modules.d.ts +0 -3
  60. package/build/src/src/type-flow/optimize.d.ts +0 -7
  61. package/build/src/src/type-flow/sub-type.d.ts +0 -2
  62. package/build/src/src/type-flow/type-flow-util.d.ts +0 -27
  63. package/build/src/src/type-flow/types.d.ts +0 -204
  64. package/build/src/src/type-flow/union-type.d.ts +0 -4
  65. package/build/src/src/type-flow.d.ts +0 -18
  66. package/build/src/src/unused-exprs.d.ts +0 -3
  67. package/build/src/src/util.d.ts +0 -33
  68. package/build/src/src/variable-renamer.d.ts +0 -4
  69. package/build/src/src/visitor.d.ts +0 -5
  70. package/build/src/src/worker-pool.d.ts +0 -4
  71. package/build/src/src/worker-task.d.ts +0 -88
  72. package/build/src/src/worker-thread.d.ts +0 -1
  73. package/build/src/src/xml-util.d.ts +0 -172
  74. package/build/src/test/mocha/bytecode.spec.d.ts +0 -1
  75. package/build/src/test/mocha/coudbe.spec.d.ts +0 -2
  76. package/build/src/test/mocha/intersection.spec.d.ts +0 -2
  77. package/build/src/test/mocha/root.spec.d.ts +0 -1
  78. package/build/src/test/mocha/subtype.spec.d.ts +0 -2
  79. package/build/src/test/mocha/test-utils.d.ts +0 -6
  80. package/build/src/test/mocha/types.spec.d.ts +0 -1
@@ -1,204 +0,0 @@
1
- import { mctree } from "@markw65/prettier-plugin-monkeyc";
2
- import { ClassStateNode, EnumStateNode, FunctionStateNode, ModuleStateNode, ProgramStateAnalysis, ProgramStateStack, StateNode, StateNodeDecl, TypedefStateNode } from "../optimizer-types";
3
- export declare const enum TypeTag {
4
- Never = 0,
5
- Null = 1,
6
- False = 2,
7
- True = 4,
8
- Boolean = 6,
9
- Number = 8,
10
- Long = 16,
11
- Float = 32,
12
- Double = 64,
13
- Decimal = 96,
14
- Numeric = 120,
15
- Char = 128,
16
- String = 256,
17
- Array = 512,
18
- Dictionary = 1024,
19
- Method = 2048,
20
- Module = 4096,
21
- Function = 8192,
22
- Class = 16384,
23
- Object = 32768,
24
- Enum = 65536,
25
- Symbol = 131072,
26
- Typedef = 262144,
27
- Any = 524287
28
- }
29
- export declare function typeTagName(tag: TypeTag): "Never" | "Null" | "False" | "True" | "Boolean" | "Number" | "Long" | "Float" | "Double" | "Decimal" | "Numeric" | "Char" | "String" | "Array" | "Dictionary" | "Method" | "Module" | "Function" | "Class" | "Object" | "Enum" | "Symbol" | "Typedef" | "Any";
30
- export declare const LastTypeTag = TypeTag.Typedef;
31
- export declare const SingletonTypeTagsConst: number;
32
- export declare const UnionDataTypeTagsConst: number;
33
- export declare const ValueTypeTagsConst: number;
34
- export declare const ObjectLikeTagsConst: number;
35
- export declare const EnumTagsConst: number;
36
- type ExactTypeTags = TypeTag.Null | TypeTag.False | TypeTag.True | TypeTag.Number | TypeTag.Long | TypeTag.Float | TypeTag.Double | TypeTag.Char | TypeTag.String | TypeTag.Array | TypeTag.Dictionary | TypeTag.Method | TypeTag.Module | TypeTag.Function | TypeTag.Class | TypeTag.Object | TypeTag.Enum | TypeTag.Symbol | TypeTag.Typedef;
37
- export type EnumeratedTypeTags = ExactTypeTags | TypeTag.Never | TypeTag.Any;
38
- export type UnionTypeTags = number;
39
- interface AbstractValue {
40
- type: UnionTypeTags;
41
- value?: unknown;
42
- }
43
- export type ExactTypes = NullType | FalseType | TrueType | NumberType | LongType | FloatType | DoubleType | CharType | StringType | ArrayType | DictionaryType | MethodType | ModuleType | FunctionType | ClassType | ObjectType | EnumType | SymbolType | TypedefType;
44
- type ExactPairHelper<T> = T extends ExactTypes ? {
45
- type: T["type"];
46
- avalue: T["value"];
47
- bvalue: T["value"];
48
- } : never;
49
- export type ExactPairs = ExactPairHelper<ExactTypes>;
50
- export type ValuePairs = ExactPairHelper<ValueTypes>;
51
- type WithValue<T> = T extends ExactTypes ? T extends SingletonType ? T : {
52
- type: T["type"];
53
- value: NonNullable<T["value"]>;
54
- } : never;
55
- export type ExactData<T extends ExactTypeTags> = T extends SingletonType ? undefined : NonNullable<Extract<ExactTypes, {
56
- type: T;
57
- }>["value"]>;
58
- export type ValueTypes = WithValue<ExactTypes>;
59
- export type ExtendedTypes = ExactTypes | NeverType | AnyType;
60
- export interface NeverType extends AbstractValue {
61
- type: 0;
62
- value?: undefined;
63
- }
64
- export interface NullType extends AbstractValue {
65
- type: TypeTag.Null;
66
- value?: undefined;
67
- }
68
- export interface FalseType extends AbstractValue {
69
- type: TypeTag.False;
70
- value?: undefined;
71
- }
72
- export interface TrueType extends AbstractValue {
73
- type: TypeTag.True;
74
- value?: undefined;
75
- }
76
- export interface NumberType extends AbstractValue {
77
- type: TypeTag.Number;
78
- value?: number | undefined;
79
- }
80
- export interface LongType extends AbstractValue {
81
- type: TypeTag.Long;
82
- value?: bigint | undefined;
83
- }
84
- export interface FloatType extends AbstractValue {
85
- type: TypeTag.Float;
86
- value?: number | undefined;
87
- }
88
- export interface DoubleType extends AbstractValue {
89
- type: TypeTag.Double;
90
- value?: number | undefined;
91
- }
92
- export interface CharType extends AbstractValue {
93
- type: TypeTag.Char;
94
- value?: string | undefined;
95
- }
96
- export interface StringType extends AbstractValue {
97
- type: TypeTag.String;
98
- value?: string | undefined;
99
- }
100
- export interface ArrayType extends AbstractValue {
101
- type: TypeTag.Array;
102
- value?: ExactOrUnion | undefined;
103
- }
104
- export interface DictionaryType extends AbstractValue {
105
- type: TypeTag.Dictionary;
106
- value?: {
107
- key: ExactOrUnion;
108
- value: ExactOrUnion;
109
- } | undefined;
110
- }
111
- export interface MethodType extends AbstractValue {
112
- type: TypeTag.Method;
113
- value?: {
114
- args: ExactOrUnion[];
115
- result: ExactOrUnion;
116
- } | undefined;
117
- }
118
- export interface ModuleType extends AbstractValue {
119
- type: TypeTag.Module;
120
- value?: ModuleStateNode | ModuleStateNode[] | undefined;
121
- }
122
- export interface FunctionType extends AbstractValue {
123
- type: TypeTag.Function;
124
- value?: FunctionStateNode | FunctionStateNode[] | undefined;
125
- }
126
- export interface ClassType extends AbstractValue {
127
- type: TypeTag.Class;
128
- value?: ClassStateNode | ClassStateNode[] | undefined;
129
- }
130
- export interface TypedefType extends AbstractValue {
131
- type: TypeTag.Typedef;
132
- value?: TypedefStateNode | TypedefStateNode[] | undefined;
133
- }
134
- export interface ObjectType extends AbstractValue {
135
- type: TypeTag.Object;
136
- value?: {
137
- klass: ClassType;
138
- obj?: Record<string, ExactOrUnion>;
139
- } | undefined;
140
- }
141
- export interface EnumType extends AbstractValue {
142
- type: TypeTag.Enum;
143
- value?: {
144
- enum: EnumStateNode;
145
- value?: ExactOrUnion | undefined;
146
- } | {
147
- enum?: undefined;
148
- value: ExactOrUnion;
149
- } | undefined;
150
- }
151
- export interface SymbolType extends AbstractValue {
152
- type: TypeTag.Symbol;
153
- value?: string | undefined;
154
- }
155
- export interface AnyType extends AbstractValue {
156
- type: TypeTag.Any;
157
- value?: undefined;
158
- }
159
- export type SingletonType = NullType | FalseType | TrueType;
160
- export type UnionData = {
161
- mask: TypeTag;
162
- [TypeTag.Array]?: NonNullable<ArrayType["value"]>;
163
- [TypeTag.Dictionary]?: NonNullable<DictionaryType["value"]>;
164
- [TypeTag.Method]?: NonNullable<MethodType["value"]>;
165
- [TypeTag.Module]?: NonNullable<ModuleType["value"]>;
166
- [TypeTag.Function]?: NonNullable<FunctionType["value"]>;
167
- [TypeTag.Class]?: NonNullable<ClassType["value"]>;
168
- [TypeTag.Object]?: NonNullable<ObjectType["value"]>;
169
- [TypeTag.Enum]?: NonNullable<EnumType["value"]>;
170
- };
171
- export type UnionDataKey = Exclude<keyof UnionData, "mask">;
172
- export interface UnionType extends AbstractValue {
173
- value?: UnionData | undefined;
174
- }
175
- export type ExactOrUnion = UnionType | ExactTypes;
176
- export type SingleValue = NonNullable<ValueTypes["value"]>;
177
- type TagValue<TAG> = Extract<ValueTypes, {
178
- type: TAG;
179
- }>["value"];
180
- export type EnumValueType = TagValue<TypeTag.Enum>;
181
- export declare function isExact(v: AbstractValue): v is ExactTypes;
182
- export declare function isUnion(v: AbstractValue): v is UnionType;
183
- export declare function isSingleton(v: AbstractValue): v is SingletonType;
184
- export declare function hasValue(v: AbstractValue): v is WithValue<ExactTypes>;
185
- export declare function hasNoData(v: AbstractValue, t: TypeTag): boolean;
186
- export declare function cloneType<T extends ExactOrUnion>(t: T): T;
187
- export declare function typeFromTypeStateNode(state: ProgramStateAnalysis, sn: StateNodeDecl, classVsObj?: boolean): ExactOrUnion;
188
- export declare function typeFromTypeStateNodes(state: ProgramStateAnalysis, sns: StateNodeDecl[], classVsObj?: boolean): ExactOrUnion;
189
- export declare function typeFromSingleTypeSpec(state: ProgramStateAnalysis, type: mctree.TypeSpecPart | mctree.ObjectExpression, stack?: ProgramStateStack | undefined): ExactOrUnion;
190
- export declare function typeFromTypespec(state: ProgramStateAnalysis, ts: mctree.TypeSpecList, stack?: ProgramStateStack | undefined): ExactOrUnion;
191
- export declare function typeFromLiteral(literal: mctree.Literal): ExactTypes;
192
- export declare function mcExprFromType(type: ValueTypes): mctree.Expression | null;
193
- export declare function castType(type: ExactOrUnion, target: UnionTypeTags): ExactOrUnion;
194
- export declare const TruthyTypes: number;
195
- export declare function mustBeTrue(arg: ExactOrUnion): boolean;
196
- export declare function mustBeFalse(arg: ExactOrUnion): boolean;
197
- export declare function display(type: ExactOrUnion): string;
198
- export declare function hasUnionData(tag: TypeTag): boolean;
199
- export declare function getObjectValue(t: ExactOrUnion): ObjectType["value"] | null;
200
- export declare function forEachUnionComponent(v: ExactOrUnion, bits: TypeTag, fn: (type: ExactTypes) => boolean | void): void;
201
- export declare function getUnionComponent<T extends ExactTypeTags>(v: ExactOrUnion, tag: T): ExactData<T> | null;
202
- export declare function setUnionComponent<T extends ExactTypeTags>(v: ExactOrUnion, tag: T, c: ExactData<T>): void;
203
- export declare function getStateNodeDeclsFromType(state: ProgramStateAnalysis, object: ExactOrUnion): StateNode[];
204
- export {};
@@ -1,4 +0,0 @@
1
- import { ExactOrUnion, TypeTag } from "./types";
2
- export declare function unionInto(to: ExactOrUnion, from: ExactOrUnion): boolean;
3
- export declare function clearValuesUnder(v: ExactOrUnion, tag: TypeTag, clearTag?: boolean): void;
4
- export declare function widenType(t: ExactOrUnion): null;
@@ -1,18 +0,0 @@
1
- import { mctree } from "@markw65/prettier-plugin-monkeyc";
2
- import { Event, EventDecl } from "./data-flow";
3
- import { FunctionStateNode, ProgramStateAnalysis } from "./optimizer-types";
4
- import { InterpState } from "./type-flow/interp";
5
- import { TypeStateKey } from "./type-flow/type-flow-util";
6
- export declare const missingNullWorkaround = true;
7
- export type NodeEquivMap = Map<mctree.Node, {
8
- decl: EventDecl;
9
- equiv: Array<EventDecl>;
10
- }>;
11
- export declare function buildTypeInfo(state: ProgramStateAnalysis, func: FunctionStateNode, optimizeEquivalencies: boolean): InterpState | undefined;
12
- export declare function buildConflictGraph(state: ProgramStateAnalysis, func: FunctionStateNode): {
13
- graph: import("./control-flow").Block<Event>;
14
- localConflicts: Map<TypeStateKey, Set<TypeStateKey>> | null;
15
- locals: Set<TypeStateKey>;
16
- identifiers: Set<string>;
17
- logThisRun: boolean;
18
- } | undefined;
@@ -1,3 +0,0 @@
1
- import { mctree } from "@markw65/prettier-plugin-monkeyc";
2
- import { ProgramStateOptimizer } from "./optimizer-types";
3
- export declare function cleanupUnusedVars(state: ProgramStateOptimizer, node: mctree.BlockStatement | mctree.ForStatement): boolean;
@@ -1,33 +0,0 @@
1
- import glob from "fast-glob";
2
- export { logger, log, wouldLog, setBanner, bumpLogging } from "./logger";
3
- export declare function globa(pattern: string, options?: glob.Options & {
4
- mark?: boolean;
5
- }): Promise<Array<string>>;
6
- export declare function globSome(pattern: string, predicate: (path: string) => boolean, options?: glob.Options & {
7
- mark?: boolean;
8
- }): Promise<boolean>;
9
- export declare function forEach<T>(val: T | T[] | null | undefined, fn: (v: T) => void): void;
10
- export declare function map<T, U>(val: T | T[] | null | undefined, fn: (v: T) => U): U[];
11
- export declare function every<T>(val: T | T[] | null | undefined, fn: (v: T) => boolean): boolean;
12
- export declare function some<T>(val: T | T[] | null | undefined, fn: (v: T) => boolean): boolean;
13
- export declare function reduce<T, U>(val: T | T[] | null | undefined, fn: (p: U, v: T) => U, init: U): U;
14
- export declare function last_modified(inputs: string[]): Promise<number>;
15
- export declare function first_modified(inputs: string[]): Promise<number>;
16
- export declare function pushUnique<T, U extends T>(arr: T[], value: U): boolean;
17
- export declare function sameArrays<T>(a1: T[], a2: T[], check: (a: T, b: T) => boolean): boolean;
18
- export type LineHandler = (line: string) => void;
19
- export declare function spawnByLine(command: string, args: string[], lineHandlers: LineHandler | LineHandler[], options?: {
20
- [key: string]: unknown;
21
- }): Promise<void>;
22
- export declare function readByLine(file: string, lineHandler: LineHandler): Promise<unknown>;
23
- export declare function promiseAll<T>(promiseFn: (i: number) => Promise<T> | null, parallelism: number): Promise<T[]>;
24
- export declare function copyRecursiveAsNeeded(source: string, target: string, filter?: (src: string, tgt: string) => boolean): Promise<void>;
25
- export declare function popcount(x: number): number;
26
- export declare class GenericQueue<Block> {
27
- private enqueued;
28
- private queue;
29
- constructor(sort: (a: Block, b: Block) => number);
30
- enqueue(block: Block): void;
31
- dequeue(): Block;
32
- empty(): boolean;
33
- }
@@ -1,4 +0,0 @@
1
- import { mctree } from "@markw65/prettier-plugin-monkeyc";
2
- import { ProgramStateAnalysis } from "./optimizer-types";
3
- export declare function renameIdentifier(ident: mctree.Identifier, newName: string): void;
4
- export declare function renameVariable(state: ProgramStateAnalysis, locals: NonNullable<ProgramStateAnalysis["localsStack"]>[number], declName: string | null): string | null;
@@ -1,5 +0,0 @@
1
- import { mctree } from "@markw65/prettier-plugin-monkeyc";
2
- import { LookupDefinition, ProgramStateAnalysis } from "./optimizer-types";
3
- import { TypeMap } from "./type-flow/interp";
4
- export declare function visitorNode(node: mctree.Node): mctree.Node;
5
- export declare function visitReferences(state: ProgramStateAnalysis, ast: mctree.Program, name: string | null, defn: LookupDefinition[] | null | false, callback: (node: mctree.Node, results: LookupDefinition[], error: boolean) => undefined | false, includeDefs?: boolean, filter?: ((node: mctree.Node) => boolean) | null, typeMap?: TypeMap | null, findSingleDefinition?: boolean): void;
@@ -1,4 +0,0 @@
1
- import type { WorkerTask, WorkerTaskResult } from "./worker-task";
2
- export declare function startPool(parallelism?: number): boolean;
3
- export declare function stopPool(): void;
4
- export declare function runTaskInPool<T extends WorkerTask>(task: T): Promise<WorkerTaskResult<T>>;
@@ -1,88 +0,0 @@
1
- /// <reference types="node" />
2
- import * as crypto from "node:crypto";
3
- import { JungleQualifier } from "./jungles";
4
- import { BuildConfig } from "./optimizer";
5
- import { xmlUtil } from "./sdk-util";
6
- interface BaseNode {
7
- type: string;
8
- data: unknown;
9
- }
10
- interface BuildOptimizedProject extends BaseNode {
11
- type: "buildOptimizedProject";
12
- data: {
13
- product: string | null;
14
- options: BuildConfig;
15
- };
16
- }
17
- interface GenerateOneConfig extends BaseNode {
18
- type: "generateOneConfig";
19
- data: {
20
- buildConfig: JungleQualifier;
21
- manifestXML: xmlUtil.Document;
22
- dependencyFiles: string[];
23
- config: BuildConfig;
24
- };
25
- }
26
- interface GenerateOptimizedProject extends BaseNode {
27
- type: "generateOptimizedProject";
28
- data: {
29
- options: BuildConfig;
30
- };
31
- }
32
- interface OptimizePrgAndDebug extends BaseNode {
33
- type: "optimizePrgAndDebug";
34
- data: {
35
- prgName: string;
36
- prgBuffer: ArrayBuffer;
37
- prgOffset: number;
38
- prgLength: number;
39
- xmlName: string;
40
- xmlBuffer: ArrayBuffer;
41
- xmlOffset: number;
42
- xmlLength: number;
43
- key: crypto.KeyObject;
44
- config: BuildConfig | undefined;
45
- };
46
- }
47
- export type WorkerTask = BuildOptimizedProject | GenerateOptimizedProject | GenerateOneConfig | OptimizePrgAndDebug;
48
- export declare const workerTaskHandlers: {
49
- readonly buildOptimizedProject: (data: BuildOptimizedProject["data"]) => Promise<{
50
- exe: string;
51
- args: string[];
52
- program: string;
53
- product: string | null;
54
- hasTests: boolean;
55
- diagnostics: Record<string, import("./optimizer-types").Diagnostic[]> | undefined;
56
- }>;
57
- readonly generateOptimizedProject: (data: GenerateOptimizedProject["data"]) => Promise<{
58
- jungleFiles: string | undefined;
59
- xml: xmlUtil.Document;
60
- program: string;
61
- hasTests: boolean;
62
- diagnostics?: undefined;
63
- } | {
64
- jungleFiles: string;
65
- xml: xmlUtil.Document;
66
- program: string;
67
- hasTests: boolean;
68
- diagnostics: Record<string, import("./optimizer-types").Diagnostic[]>;
69
- }>;
70
- readonly generateOneConfig: (data: GenerateOneConfig["data"]) => Promise<{
71
- hasTests: boolean;
72
- diagnostics: Record<string, import("./optimizer-types").Diagnostic[]> | undefined;
73
- sdkVersion: number | undefined;
74
- }>;
75
- readonly optimizePrgAndDebug: (data: OptimizePrgAndDebug["data"]) => Promise<{
76
- sigBuffer: ArrayBufferLike | undefined;
77
- sigOffset: number | undefined;
78
- sigLength: number | undefined;
79
- prgBuffer: ArrayBufferLike;
80
- prgOffset: number;
81
- prgLength: number;
82
- debugXml: string;
83
- }>;
84
- };
85
- type RemovePromise<T> = T extends Promise<infer U> ? U : T;
86
- export type WorkerTaskResult<T> = T extends WorkerTask ? RemovePromise<ReturnType<(typeof workerTaskHandlers)[T["type"]]>> : never;
87
- export declare function performTask<T extends WorkerTask>(task: T): Promise<WorkerTaskResult<T>>;
88
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,172 +0,0 @@
1
- export declare class PeggyError extends Error {
2
- location: SourceLocation | null | undefined;
3
- constructor(message: string, location: SourceLocation | null | undefined);
4
- }
5
- export interface Position {
6
- /** >= 0 */
7
- offset: number;
8
- /** >= 1 */
9
- line: number;
10
- /** >= 0 */
11
- column: number;
12
- }
13
- export interface SourceLocation {
14
- source?: string | null | undefined;
15
- start: Position;
16
- end: Position;
17
- }
18
- interface BaseNode {
19
- type: string;
20
- loc?: SourceLocation | null | undefined;
21
- start?: number;
22
- end?: number;
23
- range?: [number, number] | undefined;
24
- }
25
- interface AttrStr extends BaseNode {
26
- type: "attrstr";
27
- value: string;
28
- }
29
- export interface Attribute extends BaseNode {
30
- type: "attribute";
31
- name: AttrStr;
32
- value: AttrStr;
33
- }
34
- export interface CharData extends BaseNode {
35
- type: "chardata";
36
- value: string;
37
- }
38
- interface CharRef extends BaseNode {
39
- type: "charref";
40
- value: number;
41
- base: 10 | 16;
42
- }
43
- interface Comment extends BaseNode {
44
- type: "comment";
45
- value: string;
46
- }
47
- interface DocTypeDecl extends BaseNode {
48
- type: "doctypedecl";
49
- name: string;
50
- externalID?: ExternalID;
51
- intSubset?: Array<MarkupDecl | PEReference>;
52
- }
53
- interface EntityDecl extends BaseNode {
54
- type: "entitydecl";
55
- name: string;
56
- def: XValue;
57
- kind: "&" | "%";
58
- }
59
- interface XValue extends BaseNode {
60
- type: "entityvalue";
61
- value?: Array<string | Reference | PEReference>;
62
- extid?: System;
63
- ndecl?: NData;
64
- }
65
- type Reference = CharRef | EntityRef;
66
- type PEReference = PERef;
67
- type SystemLiteral = string;
68
- interface EntityRef extends BaseNode {
69
- type: "entityref";
70
- name: string;
71
- }
72
- interface PERef extends BaseNode {
73
- type: "peref";
74
- name: string;
75
- }
76
- interface NotationDecl extends BaseNode {
77
- type: "notationdecl";
78
- name: string;
79
- id: ExternalID | PublicID;
80
- }
81
- interface PublicID extends BaseNode {
82
- type: "publicid";
83
- value: string;
84
- }
85
- interface NData extends BaseNode {
86
- type: "ndata";
87
- value: string;
88
- }
89
- type ExternalID = System | Public;
90
- type MarkupDecl = EntityDecl | NotationDecl | PI | Comment;
91
- interface System extends BaseNode {
92
- type: "system";
93
- value: SystemLiteral;
94
- }
95
- interface Public extends BaseNode {
96
- type: "public";
97
- value: SystemLiteral;
98
- pubid: string;
99
- }
100
- export type Misc = Comment | PI | CharData;
101
- export type Content = Element | Reference | CData | Misc;
102
- export interface CData extends BaseNode {
103
- type: "cdata";
104
- value: string;
105
- }
106
- export interface PI extends BaseNode {
107
- type: "pi";
108
- name: string;
109
- value: string | null;
110
- }
111
- export interface Element extends BaseNode {
112
- type: "element";
113
- name: string;
114
- attr: Record<string, Attribute | undefined>;
115
- children?: Array<Content> | undefined;
116
- }
117
- export interface Prolog extends BaseNode {
118
- type: "prolog";
119
- xmldecl?: XmlDecl;
120
- misc1: Misc[];
121
- doctypedecl?: DocTypeDecl;
122
- misc2: Misc[];
123
- }
124
- interface XmlDecl extends BaseNode {
125
- type: "xmldecl";
126
- version: "1.0";
127
- encoding?: string;
128
- standalone?: string;
129
- }
130
- export declare class Document {
131
- prolog: Prolog | null;
132
- body: Nodes | Error;
133
- misc: Array<Misc>;
134
- source?: string | undefined;
135
- data?: Record<string, unknown>;
136
- private entities;
137
- private pentities;
138
- constructor(prolog: Prolog | null, body: Nodes | Error, misc: Array<Misc>, source?: string | undefined);
139
- /**
140
- * If all the children are chardata, charref or entityref,
141
- * return the resulting string. Otherwise null.
142
- */
143
- textContent(element: Element): string | null;
144
- processRefs(text: string): string;
145
- }
146
- export declare function elementKids(e: Element): Element[];
147
- type ElementMatcher = string | ((c: Element) => boolean);
148
- export declare class Nodes {
149
- elements: Array<Element>;
150
- constructor(elements: Element | Element[]);
151
- length(): number;
152
- deleteChildren(arg: ElementMatcher): void;
153
- addChildren(elements: Element[]): void;
154
- filter(arg: ElementMatcher): Nodes;
155
- skip(name: string): Nodes;
156
- children(name?: string): Nodes;
157
- text(): string[];
158
- attrs(): Record<string, Attribute | undefined>[];
159
- }
160
- export declare function attrString(value: string | AttrStr): AttrStr | {
161
- readonly type: "attrstr";
162
- readonly value: string;
163
- };
164
- export declare function makeAttribute(name: string | AttrStr, value: string | AttrStr): Attribute;
165
- export declare function parseXml(content: string, fileName?: string | null): Document;
166
- export declare function writeXml(doc: Document): string;
167
- export type Visitor = {
168
- pre?: (node: Content) => boolean | null | undefined | void;
169
- post?: (node: Content) => void;
170
- };
171
- export declare function visit_xml(contents: Content[], visitor: Visitor): void;
172
- export {};
@@ -1 +0,0 @@
1
- export declare function bytecodeTests(): void;
@@ -1,2 +0,0 @@
1
- import { ProgramStateAnalysis } from "../../src/optimizer-types";
2
- export declare function couldBeTests(statefn: () => ProgramStateAnalysis | null): void;
@@ -1,2 +0,0 @@
1
- import { ProgramStateAnalysis } from "../../src/optimizer-types";
2
- export declare function intersectionTests(statefn: () => ProgramStateAnalysis | null): void;
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- import { ProgramStateAnalysis } from "../../src/optimizer-types";
2
- export declare function subtypeOfTests(statefn: () => ProgramStateAnalysis | null): void;
@@ -1,6 +0,0 @@
1
- import { BuildConfig, ProgramStateAnalysis, StateNodeDecl } from "../../src/optimizer-types";
2
- import { ExactOrUnion } from "../../src/type-flow/types";
3
- export declare function create_program_analysis(source: string, filename: string, config: BuildConfig): Promise<ProgramStateAnalysis>;
4
- export declare function find_by_name(state: ProgramStateAnalysis, name: string): StateNodeDecl[];
5
- export declare function find_type_by_name(state: ProgramStateAnalysis, name: string): ExactOrUnion;
6
- export declare function assertNonNull<T>(obj: T, message?: string): asserts obj is NonNullable<T>;
@@ -1 +0,0 @@
1
- export declare function typeTests(): void;