@bgforge/mls-server 3.6.0 → 3.8.1

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/out/td-plugin.js CHANGED
@@ -1 +1 @@
1
- "use strict";var b=Object.create;var C=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var N=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty;var O=(t,r,e,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of D(r))!v.call(t,o)&&o!==e&&C(t,o,{get:()=>r[o],enumerable:!(a=x(r,o))||a.enumerable});return t};var g=(t,r,e)=>(e=t!=null?b(N(t)):{},O(r||!t||!t.__esModule?C(e,"default",{value:t,enumerable:!0}):e,t));var E=new Set(["keyword","property","method","getter","setter","constructor","call","index","construct","local var","local function","local class","parameter","label","string"]),L=new Set(["Array","ArrayBuffer","ArrayBufferConstructor","ArrayBufferLike","ArrayBufferTypes","ArrayBufferView","ArrayConstructor","ArrayIterator","ArrayLike","AsyncGenerator","AsyncGeneratorFunction","AsyncGeneratorFunctionConstructor","AsyncIterable","AsyncIterableIterator","AsyncIterator","AsyncIteratorObject","Atomics","Awaited","BigInt","BigInt64Array","BigInt64ArrayConstructor","BigIntConstructor","BigIntToLocaleStringOptions","BigUint64Array","BigUint64ArrayConstructor","Boolean","BooleanConstructor","BuiltinIteratorReturn","CallableFunction","Capitalize","ClassAccessorDecoratorContext","ClassAccessorDecoratorResult","ClassAccessorDecoratorTarget","ClassDecorator","ClassDecoratorContext","ClassFieldDecoratorContext","ClassGetterDecoratorContext","ClassMemberDecoratorContext","ClassMethodDecoratorContext","ClassSetterDecoratorContext","Collator","CollatorConstructor","CollatorOptions","ConcatArray","ConstructorParameters","DataView","DataViewConstructor","Date","DateConstructor","DateTimeFormat","DateTimeFormatConstructor","DateTimeFormatOptions","DateTimeFormatPart","DateTimeFormatPartTypes","DateTimeFormatPartTypesRegistry","DecoratorContext","DecoratorMetadata","DecoratorMetadataObject","DisplayNames","DisplayNamesFallback","DisplayNamesLanguageDisplay","DisplayNamesOptions","DisplayNamesType","Error","ErrorConstructor","EvalError","EvalErrorConstructor","Exclude","Extract","FlatArray","Float32Array","Float32ArrayConstructor","Float64Array","Float64ArrayConstructor","Function","FunctionConstructor","Generator","GeneratorFunction","GeneratorFunctionConstructor","IArguments","ImportAssertions","ImportAttributes","ImportCallOptions","ImportMeta","Infinity","InstanceType","Int16Array","Int16ArrayConstructor","Int32Array","Int32ArrayConstructor","Int8Array","Int8ArrayConstructor","Iterable","IterableIterator","Iterator","IteratorObject","IteratorResult","IteratorReturnResult","IteratorYieldResult","JSON","LDMLPluralRule","Locale","LocaleCollationCaseFirst","LocaleHourCycleKey","LocaleOptions","LocalesArgument","Lowercase","Map","MapConstructor","MapIterator","Math","MethodDecorator","NaN","NewableFunction","NoInfer","NonNullable","Number","NumberConstructor","NumberFormat","NumberFormatConstructor","NumberFormatOptions","NumberFormatOptionsCurrencyDisplay","NumberFormatOptionsCurrencyDisplayRegistry","NumberFormatOptionsSignDisplay","NumberFormatOptionsSignDisplayRegistry","NumberFormatOptionsStyle","NumberFormatOptionsStyleRegistry","NumberFormatOptionsUseGrouping","NumberFormatOptionsUseGroupingRegistry","NumberFormatPart","NumberFormatPartTypeRegistry","NumberFormatPartTypes","Object","ObjectConstructor","Omit","OmitThisParameter","ParameterDecorator","Parameters","Partial","Pick","PluralRuleType","PluralRules","PluralRulesConstructor","PluralRulesOptions","Promise","PromiseConstructor","PromiseConstructorLike","PromiseFulfilledResult","PromiseLike","PromiseRejectedResult","PromiseSettledResult","PropertyDecorator","PropertyDescriptor","PropertyDescriptorMap","PropertyKey","Proxy","ProxyConstructor","ProxyHandler","RangeError","RangeErrorConstructor","Readonly","ReadonlyArray","ReadonlyMap","ReadonlySet","Record","ReferenceError","ReferenceErrorConstructor","RegExp","RegExpConstructor","RegExpExecArray","RegExpMatchArray","RegExpStringIterator","RelativeTimeFormat","RelativeTimeFormatLocaleMatcher","RelativeTimeFormatNumeric","RelativeTimeFormatOptions","RelativeTimeFormatPart","RelativeTimeFormatStyle","RelativeTimeFormatUnit","RelativeTimeFormatUnitSingular","Required","ResolvedCollatorOptions","ResolvedDateTimeFormatOptions","ResolvedDisplayNamesOptions","ResolvedNumberFormatOptions","ResolvedNumberFormatOptionsUseGrouping","ResolvedPluralRulesOptions","ResolvedRelativeTimeFormatOptions","ReturnType","Set","SetConstructor","SetIterator","SharedArrayBuffer","SharedArrayBufferConstructor","String","StringConstructor","StringIterator","Symbol","SymbolConstructor","SyntaxError","SyntaxErrorConstructor","TemplateStringsArray","ThisParameterType","ThisType","TypeError","TypeErrorConstructor","TypedPropertyDescriptor","URIError","URIErrorConstructor","Uint16Array","Uint16ArrayConstructor","Uint32Array","Uint32ArrayConstructor","Uint8Array","Uint8ArrayConstructor","Uint8ClampedArray","Uint8ClampedArrayConstructor","Uncapitalize","UnicodeBCP47LocaleIdentifier","Uppercase","WeakKey","WeakKeyTypes","WeakMap","WeakMapConstructor","WeakSet","WeakSetConstructor","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","eval","isFinite","isNaN","parseFloat","parseInt","unescape","apply","construct","defineProperty","deleteProperty","get","getCanonicalLocales","getOwnPropertyDescriptor","getPrototypeOf","has","isExtensible","ownKeys","preventExtensions","set","setPrototypeOf"]);function f(t){return t.filter(r=>E.has(r.kind)||!L.has(r.name))}function R(t,r){return t.filter(e=>!r.has(e.name))}var m=g(require("path")),i=g(require("fs"));function A(){let t=m.resolve(__dirname,"../../server/out/td-runtime.d.ts"),r=m.resolve(__dirname,"../../@bgforge/mls-server/out/td-runtime.d.ts");return i.existsSync(t)?{path:t,exists:!0}:i.existsSync(r)?{path:r,exists:!0}:{path:t,exists:!1}}function h(t){let r=new Set,e=/^[ \t]*(?:declare\s+)?(?:function|interface|type|var|const|let|class|enum)\s+(\w+)/gm,a;for(;(a=e.exec(t))!==null;){let o=a[1];o!==void 0&&r.add(o)}return r}function F(t){try{let r=i.readFileSync(t,"utf-8");return h(r)}catch{return new Set}}function c(t){return t.endsWith(".td")}function S(t,r,e){let a=t.getScriptFileNames.bind(t);t.getScriptFileNames=()=>{let n=a();return!n.some(u=>c(u))||n.includes(r)?n:[...n,r]};let o=t.getCompilationSettings.bind(t);t.getCompilationSettings=()=>{let n=o();return t.getScriptFileNames().some(l=>c(l))?{...n,target:e.ScriptTarget.ES2020,lib:["lib.es2020.d.ts"]}:n}}function U(t){let r,e=A();function a(){return r===void 0&&(r=F(e.path)),r}function o(n){return e.exists?(S(n.languageServiceHost,e.path,t.typescript),new Proxy(n.languageService,{get(l,p,T){return p==="getCompletionsAtPosition"?(y,I,P)=>{let s=l.getCompletionsAtPosition(y,I,P);if(s===void 0)return s;if(c(y))return{...s,entries:f(s.entries)};let d=a();return d.size===0?s:{...s,entries:R(s.entries,d)}}:Reflect.get(l,p,T)}})):n.languageService}return{create:o}}module.exports=U;
1
+ "use strict";var D=Object.create;var f=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var F=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty;var v=(r,t,o,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of b(t))!h.call(r,e)&&e!==o&&f(r,e,{get:()=>t[e],enumerable:!(a=P(t,e))||a.enumerable});return r};var C=(r,t,o)=>(o=r!=null?D(F(r)):{},v(t||!r||!r.__esModule?f(o,"default",{value:r,enumerable:!0}):o,r));var L=new Set(["keyword","property","method","getter","setter","constructor","call","index","construct","local var","local function","local class","parameter","label","string"]),N=new Set(["Array","ArrayBuffer","ArrayBufferConstructor","ArrayBufferLike","ArrayBufferTypes","ArrayBufferView","ArrayConstructor","ArrayIterator","ArrayLike","AsyncGenerator","AsyncGeneratorFunction","AsyncGeneratorFunctionConstructor","AsyncIterable","AsyncIterableIterator","AsyncIterator","AsyncIteratorObject","Atomics","Awaited","BigInt","BigInt64Array","BigInt64ArrayConstructor","BigIntConstructor","BigIntToLocaleStringOptions","BigUint64Array","BigUint64ArrayConstructor","Boolean","BooleanConstructor","BuiltinIteratorReturn","CallableFunction","Capitalize","ClassAccessorDecoratorContext","ClassAccessorDecoratorResult","ClassAccessorDecoratorTarget","ClassDecorator","ClassDecoratorContext","ClassFieldDecoratorContext","ClassGetterDecoratorContext","ClassMemberDecoratorContext","ClassMethodDecoratorContext","ClassSetterDecoratorContext","ConcatArray","ConstructorParameters","DataView","DataViewConstructor","Date","DateConstructor","DecoratorContext","DecoratorMetadata","DecoratorMetadataObject","Error","ErrorConstructor","EvalError","EvalErrorConstructor","Exclude","Extract","FlatArray","Float32Array","Float32ArrayConstructor","Float64Array","Float64ArrayConstructor","Function","FunctionConstructor","Generator","GeneratorFunction","GeneratorFunctionConstructor","IArguments","ImportAssertions","ImportAttributes","ImportCallOptions","ImportMeta","Infinity","InstanceType","Int16Array","Int16ArrayConstructor","Int32Array","Int32ArrayConstructor","Int8Array","Int8ArrayConstructor","Intl","Iterable","IterableIterator","Iterator","IteratorObject","IteratorResult","IteratorReturnResult","IteratorYieldResult","JSON","Lowercase","Map","MapConstructor","MapIterator","Math","MethodDecorator","NaN","NewableFunction","NoInfer","NonNullable","Number","NumberConstructor","Object","ObjectConstructor","Omit","OmitThisParameter","ParameterDecorator","Parameters","Partial","Pick","Promise","PromiseConstructor","PromiseConstructorLike","PromiseFulfilledResult","PromiseLike","PromiseRejectedResult","PromiseSettledResult","PropertyDecorator","PropertyDescriptor","PropertyDescriptorMap","PropertyKey","Proxy","ProxyConstructor","ProxyHandler","RangeError","RangeErrorConstructor","Readonly","ReadonlyArray","ReadonlyMap","ReadonlySet","Record","ReferenceError","ReferenceErrorConstructor","Reflect","RegExp","RegExpConstructor","RegExpExecArray","RegExpMatchArray","RegExpStringIterator","Required","ReturnType","Set","SetConstructor","SetIterator","SharedArrayBuffer","SharedArrayBufferConstructor","String","StringConstructor","StringIterator","Symbol","SymbolConstructor","SyntaxError","SyntaxErrorConstructor","TemplateStringsArray","ThisParameterType","ThisType","TypeError","TypeErrorConstructor","TypedPropertyDescriptor","URIError","URIErrorConstructor","Uint16Array","Uint16ArrayConstructor","Uint32Array","Uint32ArrayConstructor","Uint8Array","Uint8ArrayConstructor","Uint8ClampedArray","Uint8ClampedArrayConstructor","Uncapitalize","Uppercase","WeakKey","WeakKeyTypes","WeakMap","WeakMapConstructor","WeakSet","WeakSetConstructor","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","eval","isFinite","isNaN","parseFloat","parseInt","unescape"]);function g(r){return r.filter(t=>L.has(t.kind)||!N.has(t.name))}function A(r,t){return r.filter(o=>!t.has(o.name))}var p=C(require("path")),s=C(require("fs"));function S(){let r=p.resolve(__dirname,"../../server/out/td-runtime.d.ts"),t=p.resolve(__dirname,"../../@bgforge/mls-server/out/td-runtime.d.ts");return s.existsSync(r)?{path:r,exists:!0}:s.existsSync(t)?{path:t,exists:!0}:{path:r,exists:!1}}function B(r,t){let o=t.createSourceFile("td-runtime.d.ts",r,t.ScriptTarget.ES2020,!1,t.ScriptKind.TS),a=new Set;for(let e of o.statements)if(t.isFunctionDeclaration(e)||t.isInterfaceDeclaration(e)||t.isTypeAliasDeclaration(e)||t.isClassDeclaration(e)||t.isEnumDeclaration(e))e.name&&a.add(e.name.text);else if(t.isVariableStatement(e))for(let n of e.declarationList.declarations)t.isIdentifier(n.name)&&a.add(n.name.text);return a}function I(r,t){try{let o=s.readFileSync(r,"utf-8");return B(o,t)}catch{return new Set}}function l(r){return r.endsWith(".td")}function R(r,t,o){let a=r.getScriptFileNames.bind(r);r.getScriptFileNames=()=>{let n=a();return!n.some(u=>l(u))||n.includes(t)?n:[...n,t]};let e=r.getCompilationSettings.bind(r);r.getCompilationSettings=()=>{let n=e();return r.getScriptFileNames().some(c=>l(c))?{...n,target:o.ScriptTarget.ES2020,lib:["lib.es2020.d.ts"]}:n}}function U(r){let t,o=S();function a(){return t===void 0&&(t=I(o.path,r.typescript)),t}function e(n){return o.exists?(R(n.languageServiceHost,o.path,r.typescript),new Proxy(n.languageService,{get(c,y,x){return y==="getCompletionsAtPosition"?(m,T,E)=>{let i=c.getCompletionsAtPosition(m,T,E);if(i===void 0)return i;if(l(m))return{...i,entries:g(i.entries)};let d=a();return d.size===0?i:{...i,entries:A(i.entries,d)}}:Reflect.get(c,y,x)}})):(n.project?.projectService?.logger?.info(`[td-plugin] TD runtime not found at ${o.path}; .td completions will not include the TD API.`),n.languageService)}return{create:e}}module.exports=U;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Core TD (TypeScript to D) runtime API declarations.
3
- * This is the transpiler API functions that map to WeiDU D constructs.
3
+ * This is the transpiler API - functions that map to WeiDU D constructs.
4
4
  * Engine-specific functions (triggers, actions, constants) are separate
5
5
  * and generated per-project from server/data/*.yml.
6
6
  *
@@ -19,10 +19,12 @@
19
19
  * Branded to prevent accidentally passing a plain number where a text
20
20
  * reference is expected.
21
21
  */
22
- type StrRef = number & { __brand: "StrRef" }
22
+ type StrRef = number & { __brand: "StrRef" };
23
23
 
24
24
  /** Branded type for engine actions. Engine action functions must return this type. */
25
- interface Action { readonly __brand: "Action" }
25
+ interface Action {
26
+ readonly __brand: "Action";
27
+ }
26
28
 
27
29
  // --- IElib sync surface end ---
28
30
 
@@ -35,8 +37,8 @@ interface Action { readonly __brand: "Action" }
35
37
  * Variadic: `say(t1, t2, t3)` emits multisay (`SAY text = text = text`).
36
38
  * Two-arg form: `say(dialog, text)` for cross-dialog say (chain speaker switch).
37
39
  */
38
- declare function say(...text: StrRef[]): void
39
- declare function say(dialog: string, text: StrRef): void
40
+ declare function say(...text: StrRef[]): void;
41
+ declare function say(dialog: string, text: StrRef): void;
40
42
 
41
43
  /**
42
44
  * Copy all transitions from the given state in the given dialog file.
@@ -44,13 +46,13 @@ declare function say(dialog: string, text: StrRef): void
44
46
  * If `safe` is true, COPY_TRANS will not warn about potentially unsafe uses.
45
47
  * @see copyTransLate for late-binding variant
46
48
  */
47
- declare function copyTrans(dialog: string, stateRef: string | number, options?: { safe?: boolean }): void
49
+ declare function copyTrans(dialog: string, stateRef: string | number, options?: { safe?: boolean }): void;
48
50
 
49
51
  /**
50
52
  * Set state weight for priority ordering.
51
53
  * Lower weights are evaluated first. Should only be used to patch existing dialogues.
52
54
  */
53
- declare function weight(n: number): void
55
+ declare function weight(n: number): void;
54
56
 
55
57
  // ---------------------------------------------------------------------------
56
58
  // Transition builder - reply(text).action(...).goTo(target)
@@ -58,28 +60,28 @@ declare function weight(n: number): void
58
60
 
59
61
  /** Shared terminal and modifier methods for transition builders. */
60
62
  interface TransitionBuilder<Self> {
61
- /** Add text to the PC's journal if this transition is taken. */
62
- journal(text: StrRef): Self
63
- /** Add text to the "solved" section of the PC's journal. */
64
- solvedJournal(text: StrRef): Self
65
- /** Add text to the "unsolved" section of the PC's journal. */
66
- unsolvedJournal(text: StrRef): Self
67
- /** Set transition feature flags directly using the binary DLG format. */
68
- flags(n: number): Self
69
- /** Continue dialogue at the given state label in the same DLG file. */
70
- goTo(target: string | number | Function): void
71
- /** End the conversation. */
72
- exit(): void
73
- /** Continue dialogue at the given state in another DLG file. */
74
- extern(dialog: string, state: string | number, options?: { ifFileExists?: boolean }): void
75
- /** Copy transitions from the given state, resolved after all other D Actions. */
76
- copyTransLate(dialog: string, state: string | number, options?: { safe?: boolean }): void
63
+ /** Add text to the PC's journal if this transition is taken. */
64
+ journal(text: StrRef): Self;
65
+ /** Add text to the "solved" section of the PC's journal. */
66
+ solvedJournal(text: StrRef): Self;
67
+ /** Add text to the "unsolved" section of the PC's journal. */
68
+ unsolvedJournal(text: StrRef): Self;
69
+ /** Set transition feature flags directly using the binary DLG format. */
70
+ flags(n: number): Self;
71
+ /** Continue dialogue at the given state label in the same DLG file. */
72
+ goTo(target: string | number | Function): void;
73
+ /** End the conversation. */
74
+ exit(): void;
75
+ /** Continue dialogue at the given state in another DLG file. */
76
+ extern(dialog: string, state: string | number, options?: { ifFileExists?: boolean }): void;
77
+ /** Copy transitions from the given state, resolved after all other D Actions. */
78
+ copyTransLate(dialog: string, state: string | number, options?: { safe?: boolean }): void;
77
79
  }
78
80
 
79
81
  /** After reply(): can chain .action(), .journal(), or terminate. */
80
82
  interface AfterReply extends TransitionBuilder<AfterReply> {
81
- /** Execute engine actions if this transition is taken. */
82
- action(...actions: Action[]): AfterAction
83
+ /** Execute engine actions if this transition is taken. */
84
+ action(...actions: Action[]): AfterAction;
83
85
  }
84
86
 
85
87
  /** After action(): can chain .journal() or terminate. */
@@ -89,44 +91,44 @@ interface AfterAction extends TransitionBuilder<AfterAction> {}
89
91
  * If this transition is taken, the PC says the reply text.
90
92
  * Returns a builder for chaining `.action()`, `.journal()`, and terminal (`.goTo()`, `.exit()`, `.extern()`).
91
93
  */
92
- declare function reply(text: StrRef): AfterReply
94
+ declare function reply(text: StrRef): AfterReply;
93
95
 
94
96
  /**
95
97
  * Execute engine actions if this transition is taken.
96
98
  * Returns a builder for chaining `.journal()` and terminal (`.goTo()`, `.exit()`, `.extern()`).
97
99
  */
98
- declare function action(...actions: Action[]): AfterAction
100
+ declare function action(...actions: Action[]): AfterAction;
99
101
 
100
102
  /** Continue dialogue at the given state label in the same DLG file. Synonym for GOTO. */
101
- declare function goTo(target: string | number | Function): void
103
+ declare function goTo(target: string | number | Function): void;
102
104
 
103
105
  /** End the conversation. */
104
- declare function exit(): void
106
+ declare function exit(): void;
105
107
 
106
108
  /**
107
109
  * Continue dialogue at the given state in another DLG file.
108
110
  * If `ifFileExists` is true, the transition is skipped if the file doesn't exist.
109
111
  */
110
- declare function extern(dialog: string, state: string | number, options?: { ifFileExists?: boolean }): void
112
+ declare function extern(dialog: string, state: string | number, options?: { ifFileExists?: boolean }): void;
111
113
 
112
114
  /**
113
115
  * Copy transitions from the given state, resolved after all other D Actions.
114
116
  * Same as COPY_TRANS but late-binding.
115
117
  * If `safe` is true, will not warn about potentially unsafe uses.
116
118
  */
117
- declare function copyTransLate(dialog: string, state: string | number, options?: { safe?: boolean }): void
119
+ declare function copyTransLate(dialog: string, state: string | number, options?: { safe?: boolean }): void;
118
120
 
119
121
  /** Set transition feature flags directly using the binary DLG format. */
120
- declare function flags(value: number): void
122
+ declare function flags(value: number): void;
121
123
 
122
124
  /** Add text to the PC's journal if this transition is taken. */
123
- declare function journal(text: StrRef): void
125
+ declare function journal(text: StrRef): void;
124
126
 
125
127
  /** Add text to the "solved" section of the PC's journal. */
126
- declare function solvedJournal(text: StrRef): void
128
+ declare function solvedJournal(text: StrRef): void;
127
129
 
128
130
  /** Add text to the "unsolved" section of the PC's journal. */
129
- declare function unsolvedJournal(text: StrRef): void
131
+ declare function unsolvedJournal(text: StrRef): void;
130
132
 
131
133
  // ---------------------------------------------------------------------------
132
134
  // Dialog operations - BEGIN, APPEND, EXTEND
@@ -137,43 +139,48 @@ declare function unsolvedJournal(text: StrRef): void
137
139
  * Use inside begin(), append(), appendEarly() argument lists.
138
140
  * @example begin("DLG", [state("greeting", () => { say(tra(1)); exit(); })]);
139
141
  */
140
- declare function state(label: string, body: () => void): Function
142
+ declare function state(label: string, body: () => void): Function;
141
143
 
142
144
  /**
143
145
  * Create a new DLG file from scratch. Any existing DLG file with the same name
144
146
  * will be overwritten. The new DLG file contains exactly the states in the list.
145
147
  */
146
- declare function begin(dialog: string, states: (Function | string)[]): void
147
- declare function begin(dialog: string, ...states: Function[]): void
148
+ declare function begin(dialog: string, states: (Function | string)[]): void;
149
+ declare function begin(dialog: string, ...states: Function[]): void;
148
150
 
149
151
  /**
150
152
  * Add states to the end of an already-existing dialogue file.
151
153
  */
152
- declare function append(dialog: string, states: Function[]): void
153
- declare function append(dialog: string, ...states: Function[]): void
154
+ declare function append(dialog: string, states: Function[]): void;
155
+ declare function append(dialog: string, ...states: Function[]): void;
154
156
 
155
157
  /**
156
158
  * Like `append`, but the states are added early in the compilation timeline
157
159
  * (just after BEGIN is processed). They can be targets for INTERJECT_COPY_TRANS.
158
160
  */
159
- declare function appendEarly(dialog: string, ...states: Function[]): void
161
+ declare function appendEarly(dialog: string, ...states: Function[]): void;
160
162
 
161
163
  /**
162
164
  * Load the given dialog and replace the state at the given numeric index
163
165
  * with the new state described by the body function.
164
166
  */
165
- declare function replaceState(dialog: string, state: number, body: () => void): void
167
+ declare function replaceState(dialog: string, state: number, body: () => void): void;
166
168
 
167
169
  /**
168
170
  * Add transitions to the top of the transition list for the specified state.
169
171
  */
170
- declare function extendTop(dialog: string, state: string | number | Function, callback: () => void): void
172
+ declare function extendTop(dialog: string, state: string | number | Function, callback: () => void): void;
171
173
 
172
174
  /**
173
175
  * Add transitions to the bottom of the transition list for the specified state.
174
176
  */
175
- declare function extendBottom(dialog: string, state: string | number | Function, callback: () => void): void
176
- declare function extendBottom(dialog: string, state: string | number | Function, options: { position?: number }, callback: () => void): void
177
+ declare function extendBottom(dialog: string, state: string | number | Function, callback: () => void): void;
178
+ declare function extendBottom(
179
+ dialog: string,
180
+ state: string | number | Function,
181
+ options: { position?: number },
182
+ callback: () => void,
183
+ ): void;
177
184
 
178
185
  // ---------------------------------------------------------------------------
179
186
  // Chain - linear multi-speaker conversations
@@ -184,16 +191,16 @@ declare function extendBottom(dialog: string, state: string | number | Function,
184
191
  * Useful when NPCs talk among themselves. CHAIN only appends to existing
185
192
  * dialogues; it cannot create a new DLG.
186
193
  */
187
- declare function chain(callback: Function): void
188
- declare function chain(entryTrigger: boolean, callback: Function): void
189
- declare function chain(dialog: string, label: string, body: () => void): void
190
- declare function chain(entryTrigger: boolean, dialog: string, label: string, body: () => void): void
194
+ declare function chain(callback: Function): void;
195
+ declare function chain(entryTrigger: boolean, callback: Function): void;
196
+ declare function chain(dialog: string, label: string, body: () => void): void;
197
+ declare function chain(entryTrigger: boolean, dialog: string, label: string, body: () => void): void;
191
198
 
192
199
  /** Switch speaker in a chain body. Subsequent `say()` calls use this speaker. */
193
- declare function from(speaker: string): void
200
+ declare function from(speaker: string): void;
194
201
 
195
202
  /** Conditional speaker switch. The speaker's lines are only included if the condition is true. */
196
- declare function fromWhen(speaker: string, condition: boolean): void
203
+ declare function fromWhen(speaker: string, condition: boolean): void;
197
204
 
198
205
  // ---------------------------------------------------------------------------
199
206
  // Interject operations
@@ -204,32 +211,61 @@ declare function fromWhen(speaker: string, condition: boolean): void
204
211
  * and accompanied by `SetGlobal(globalVar, "GLOBAL", 1)`, ensuring
205
212
  * the interjection is only seen once per game.
206
213
  */
207
- declare function interject(entryDialog: string, entryState: string, globalVar: string, callback: Function, exitDialog?: string, exitState?: string): void
214
+ declare function interject(
215
+ entryDialog: string,
216
+ entryState: string,
217
+ globalVar: string,
218
+ callback: Function,
219
+ exitDialog?: string,
220
+ exitState?: string,
221
+ ): void;
208
222
 
209
223
  /**
210
224
  * Like `interject`, but at the end of the chain text, copies all transitions
211
225
  * from the entry state instead of using an explicit exit.
212
226
  * Convenient for quick interjections that don't change the conversation flow.
213
227
  */
214
- declare function interjectCopyTrans(entryDialog: string, entryState: string, globalVar: string, callback: Function, exitDialog?: string, exitState?: string): void
228
+ declare function interjectCopyTrans(
229
+ entryDialog: string,
230
+ entryState: string,
231
+ globalVar: string,
232
+ callback: Function,
233
+ exitDialog?: string,
234
+ exitState?: string,
235
+ ): void;
215
236
 
216
237
  /**
217
238
  * Like `interjectCopyTrans`, but actions in the entry state's transitions
218
239
  * are preserved with the original speaker (not transferred to the new speaker).
219
240
  */
220
- declare function interjectCopyTrans2(entryDialog: string, entryState: string, globalVar: string, callback: Function): void
241
+ declare function interjectCopyTrans2(
242
+ entryDialog: string,
243
+ entryState: string,
244
+ globalVar: string,
245
+ callback: Function,
246
+ ): void;
221
247
 
222
248
  /**
223
249
  * Like `interjectCopyTrans`, but all states in the chain text get a link
224
250
  * in the entry state, rather than only the first one.
225
251
  */
226
- declare function interjectCopyTrans3(entryDialog: string, entryState: string, globalVar: string, callback: Function): void
252
+ declare function interjectCopyTrans3(
253
+ entryDialog: string,
254
+ entryState: string,
255
+ globalVar: string,
256
+ callback: Function,
257
+ ): void;
227
258
 
228
259
  /**
229
260
  * Combination of `interjectCopyTrans2` (action handling) and
230
261
  * `interjectCopyTrans3` (extended state creation rules).
231
262
  */
232
- declare function interjectCopyTrans4(entryDialog: string, entryState: string, globalVar: string, callback: Function): void
263
+ declare function interjectCopyTrans4(
264
+ entryDialog: string,
265
+ entryState: string,
266
+ globalVar: string,
267
+ callback: Function,
268
+ ): void;
233
269
 
234
270
  // ---------------------------------------------------------------------------
235
271
  // Patch operations
@@ -238,76 +274,98 @@ declare function interjectCopyTrans4(entryDialog: string, entryState: string, gl
238
274
  /**
239
275
  * Fine-grained altering of transitions in existing dialogue states.
240
276
  */
241
- declare function alterTrans(dialog: string, states: (string | number)[], trans: number[], options: { trigger?: boolean; action?: Action; reply?: StrRef }): void
277
+ declare function alterTrans(
278
+ dialog: string,
279
+ states: (string | number)[],
280
+ trans: number[],
281
+ options: { trigger?: boolean; action?: Action; reply?: StrRef },
282
+ ): void;
242
283
 
243
284
  /**
244
285
  * Add a trigger string to all specified states.
245
286
  * Useful for adding extra conditions to existing dialogue states.
246
287
  */
247
- declare function addStateTrigger(dialog: string, state: string | number | (string | number)[], trigger: boolean): void
288
+ declare function addStateTrigger(dialog: string, state: string | number | (string | number)[], trigger: boolean): void;
248
289
 
249
290
  /**
250
291
  * Add a trigger string to transitions in specified states.
251
292
  * Often used with `extendBottom` to create new branches: add the negation
252
293
  * of a predicate to existing transitions, then add a transition with that predicate.
253
294
  */
254
- declare function addTransTrigger(dialog: string, states: (string | number)[], trigger: boolean, options?: { trans?: number[] }): void
295
+ declare function addTransTrigger(
296
+ dialog: string,
297
+ states: (string | number)[],
298
+ trigger: boolean,
299
+ options?: { trans?: number[] },
300
+ ): void;
255
301
 
256
302
  /**
257
303
  * Add an action string to transitions in specified states.
258
304
  * The action is prepended to any existing action text.
259
305
  */
260
- declare function addTransAction(dialog: string, states: (string | number)[], trans: number[], action: Action): void
306
+ declare function addTransAction(dialog: string, states: (string | number)[], trans: number[], action: Action): void;
261
307
 
262
308
  /**
263
309
  * Replace all instances of `from` text with `to` text in the trigger strings
264
310
  * of transitions in specified states.
265
311
  */
266
- declare function replaceTransTrigger(dialog: string, states: (string | number | Function)[], trans: number[], from: string, to: string): void
312
+ declare function replaceTransTrigger(
313
+ dialog: string,
314
+ states: (string | number | Function)[],
315
+ trans: number[],
316
+ from: string,
317
+ to: string,
318
+ ): void;
267
319
 
268
320
  /**
269
321
  * Replace all instances of `from` text with `to` text in the action strings
270
322
  * of transitions in specified states.
271
323
  */
272
- declare function replaceTransAction(dialog: string, states: (string | number | Function)[], trans: number[], from: string, to: string): void
324
+ declare function replaceTransAction(
325
+ dialog: string,
326
+ states: (string | number | Function)[],
327
+ trans: number[],
328
+ from: string,
329
+ to: string,
330
+ ): void;
273
331
 
274
332
  /**
275
333
  * Destructively replace every occurrence of `from` (may be a regexp) in all
276
334
  * trigger strings of the given dialog file(s).
277
335
  * Should only be used to patch or workaround existing dialogues.
278
336
  */
279
- declare function replaceTriggerText(dialog: string | string[], from: string, to: string): void
337
+ declare function replaceTriggerText(dialog: string | string[], from: string, to: string): void;
280
338
 
281
339
  /**
282
340
  * Destructively replace every occurrence of `from` (may be a regexp) in all
283
341
  * action strings of the given dialog files.
284
342
  * Should only be used to patch or workaround existing dialogues.
285
343
  */
286
- declare function replaceActionText(dialogs: string[], from: string, to: string): void
344
+ declare function replaceActionText(dialogs: string[], from: string, to: string): void;
287
345
 
288
346
  /**
289
347
  * Destructively change the WEIGHT of the given state.
290
348
  * Should only be used to patch or workaround existing dialogues.
291
349
  */
292
- declare function setWeight(dialog: string, state: string | number, weight: number): void
350
+ declare function setWeight(dialog: string, state: string | number, weight: number): void;
293
351
 
294
352
  /**
295
353
  * Destructively change the SAY text of the given state.
296
354
  * Should only be used to patch or workaround existing dialogues.
297
355
  */
298
- declare function replaceSay(dialog: string, state: string | number, text: StrRef): void
356
+ declare function replaceSay(dialog: string, state: string | number, text: StrRef): void;
299
357
 
300
358
  /**
301
359
  * Destructively set the trigger string of the specified states.
302
360
  * Should only be used to patch or workaround existing dialogues.
303
361
  */
304
- declare function replaceStateTrigger(dialog: string, states: (string | number)[], trigger: boolean): void
362
+ declare function replaceStateTrigger(dialog: string, states: (string | number)[], trigger: boolean): void;
305
363
 
306
364
  /**
307
365
  * Load the given dialog and replace states by numeric index.
308
366
  * A new state with key X replaces old state number X.
309
367
  */
310
- declare function replace(dialog: string, states: Record<number, () => void>): void
368
+ declare function replace(dialog: string, states: Record<number, () => void>): void;
311
369
 
312
370
  // ---------------------------------------------------------------------------
313
371
  // Text helpers: tra(), tlk(), obj() are declared in ielib.
Binary file
package/package.json CHANGED
@@ -1,61 +1,62 @@
1
1
  {
2
2
  "name": "@bgforge/mls-server",
3
+ "version": "3.8.1",
3
4
  "description": "LSP server for Fallout SSL, WeiDU (BAF/D/TP2), and related modding languages",
4
- "version": "3.6.0",
5
- "author": "BGforge",
6
- "license": "SEE LICENSE IN LICENSE.txt",
7
- "main": "out/server.js",
8
- "bin": {
9
- "bgforge-mls-server": "out/server.js"
10
- },
11
- "files": [
12
- "out/",
13
- "!out/*.map",
14
- "LICENSE.txt"
5
+ "keywords": [
6
+ "fallout",
7
+ "infinity-engine",
8
+ "language-server",
9
+ "lsp",
10
+ "modding",
11
+ "weidu"
15
12
  ],
16
- "engines": {
17
- "node": ">=18"
13
+ "homepage": "https://github.com/BGforgeNet/BGforge-MLS",
14
+ "bugs": {
15
+ "url": "https://github.com/BGforgeNet/BGforge-MLS/issues"
18
16
  },
17
+ "license": "SEE LICENSE IN LICENSE.txt",
18
+ "author": "BGforge",
19
19
  "repository": {
20
20
  "type": "git",
21
21
  "url": "https://github.com/BGforgeNet/BGforge-MLS",
22
22
  "directory": "server"
23
23
  },
24
- "homepage": "https://github.com/BGforgeNet/BGforge-MLS",
25
- "bugs": {
26
- "url": "https://github.com/BGforgeNet/BGforge-MLS/issues"
24
+ "bin": {
25
+ "bgforge-mls-server": "out/server.js"
27
26
  },
28
- "keywords": [
29
- "lsp",
30
- "language-server",
31
- "fallout",
32
- "weidu",
33
- "infinity-engine",
34
- "modding"
27
+ "files": [
28
+ "out/",
29
+ "!out/*.map",
30
+ "LICENSE.txt"
35
31
  ],
32
+ "main": "out/server.js",
36
33
  "dependencies": {
37
- "@supercharge/promise-pool": "^2.4.0",
38
- "esbuild-wasm": "^0.24.2",
34
+ "esbuild-wasm": "^0.28.0",
39
35
  "fast-glob": "^3.3.3",
40
- "ini": "^6.0.0",
41
- "ts-morph": "^24.0.0",
36
+ "p-limit": "^7.3.0",
37
+ "ts-morph": "^27.0.2",
42
38
  "typescript": "^5.9.3",
43
39
  "vscode-languageserver": "8.1.0",
44
40
  "vscode-languageserver-textdocument": "^1.0.12",
45
- "web-tree-sitter": "^0.26.6",
46
- "yaml": "^2.8.3"
41
+ "web-tree-sitter": "^0.26.9",
42
+ "yaml": "^2.9.0",
43
+ "@bgforge/format": "0.1.0"
44
+ },
45
+ "devDependencies": {
46
+ "@types/node": "^24.12.2",
47
+ "fast-check": "^4.8.0",
48
+ "vitest": "^4.1.8"
47
49
  },
48
50
  "optionalDependencies": {
49
51
  "sslc-emscripten-noderawfs": "https://github.com/sfall-team/sslc/releases/download/2026-02-07-11-20-26/wasm-emscripten-node-noderawfs.tar.gz"
50
52
  },
51
- "devDependencies": {
52
- "@types/ini": "^4.1.1",
53
- "@types/node": "^20.19.35",
54
- "vitest": "^4.1.2"
53
+ "engines": {
54
+ "node": ">=20"
55
55
  },
56
56
  "scripts": {
57
57
  "test": "./scripts/test.sh",
58
58
  "test:unit": "vitest run",
59
- "test:integration": "vitest run --config vitest.integration.config.ts"
59
+ "test:integration": "vitest run --config vitest.integration.config.ts",
60
+ "bench": "vitest bench --run test/perf"
60
61
  }
61
62
  }