@hyperfixi/core 2.0.0 → 2.1.0
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/dist/api/hyperscript-api.d.ts +2 -0
- package/dist/ast-utils/index.d.ts +1 -1
- package/dist/ast-utils/index.js +11 -1
- package/dist/ast-utils/index.mjs +11 -1
- package/dist/ast-utils/interchange/index.d.ts +1 -1
- package/dist/ast-utils/interchange/lsp.d.ts +4 -1
- package/dist/behaviors/index.js +13 -5
- package/dist/behaviors/index.mjs +13 -5
- package/dist/bundle-generator/index.js +9 -0
- package/dist/bundle-generator/index.mjs +9 -0
- package/dist/chunks/{bridge-I6ceoWxV.js → bridge-CZfeDyEz.js} +2 -2
- package/dist/chunks/browser-modular-CwTpxqdt.js +2 -0
- package/dist/chunks/feature-eventsource-B5F2-H1r.js +2 -0
- package/dist/chunks/feature-sockets-ClOH7vk7.js +2 -0
- package/dist/chunks/feature-webworker-3bAp0ac9.js +2 -0
- package/dist/commands/index.js +27 -6
- package/dist/commands/index.mjs +27 -6
- package/dist/debug/debug-controller.d.ts +62 -0
- package/dist/debug/index.d.ts +5 -0
- package/dist/expressions/index.js +16 -52
- package/dist/expressions/index.mjs +16 -52
- package/dist/hyperfixi-classic-i18n.js +1 -1
- package/dist/hyperfixi-hx.js +1 -1
- package/dist/hyperfixi-hybrid-complete.js +1 -1
- package/dist/hyperfixi-minimal.js +1 -1
- package/dist/hyperfixi-multilingual.js +1 -1
- package/dist/hyperfixi-standard.js +1 -1
- package/dist/hyperfixi.js +1 -1
- package/dist/hyperfixi.mjs +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +10112 -6941
- package/dist/index.min.js +1 -1
- package/dist/index.mjs +10111 -6942
- package/dist/lokascript-browser-classic-i18n.js +1 -1
- package/dist/lokascript-browser-minimal.js +1 -1
- package/dist/lokascript-browser-standard.js +1 -1
- package/dist/lokascript-browser.js +1 -1
- package/dist/lokascript-hybrid-complete.js +1 -1
- package/dist/lokascript-hybrid-hx.js +1 -1
- package/dist/lokascript-multilingual.js +1 -1
- package/dist/metadata.d.ts +4 -4
- package/dist/metadata.js +4 -4
- package/dist/metadata.mjs +4 -4
- package/dist/parser/full-parser.js +12 -31
- package/dist/parser/full-parser.mjs +12 -31
- package/dist/parser/hybrid/index.js +35 -2
- package/dist/parser/hybrid/index.mjs +35 -2
- package/dist/parser/hybrid/parser-core.d.ts +1 -0
- package/dist/parser/hybrid/parser-core.js +35 -2
- package/dist/parser/hybrid/parser-core.mjs +35 -2
- package/dist/parser/hybrid/tokenizer.js +5 -0
- package/dist/parser/hybrid/tokenizer.mjs +5 -0
- package/dist/parser/hybrid-parser.js +35 -2
- package/dist/parser/hybrid-parser.mjs +35 -2
- package/dist/registry/index.js +16 -52
- package/dist/registry/index.mjs +16 -52
- package/dist/runtime/runtime-base.d.ts +1 -0
- package/package.json +5 -5
- package/dist/chunks/browser-modular-Dv6PAV3c.js +0 -2
- package/dist/chunks/feature-eventsource-DWb514fy.js +0 -2
- package/dist/chunks/feature-sockets-3PFuvCVY.js +0 -2
- package/dist/chunks/feature-webworker-DTm_eh-E.js +0 -2
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Runtime, type RuntimeOptions } from '../runtime/runtime';
|
|
2
2
|
import type { ASTNode, ExecutionContext } from '../types/base-types';
|
|
3
3
|
import type { RuntimeHooks } from '../types/hooks';
|
|
4
|
+
import { DebugController } from '../debug/debug-controller';
|
|
4
5
|
declare global {
|
|
5
6
|
interface Window {
|
|
6
7
|
_hyperscript?: {
|
|
@@ -55,6 +56,7 @@ export interface HyperscriptAPI {
|
|
|
55
56
|
registerHooks(name: string, hooks: RuntimeHooks): void;
|
|
56
57
|
unregisterHooks(name: string): boolean;
|
|
57
58
|
getRegisteredHooks(): string[];
|
|
59
|
+
debug: DebugController;
|
|
58
60
|
clearCache(): void;
|
|
59
61
|
getCacheStats(): {
|
|
60
62
|
size: number;
|
|
@@ -8,5 +8,5 @@ export { transform, optimize, applyOptimizationPasses, normalize, inlineVariable
|
|
|
8
8
|
export type { InterchangeNode, BaseNode as InterchangeBaseNode, EventNode as InterchangeEventNode, CommandNode as InterchangeCommandNode, LiteralNode as InterchangeLiteralNode, IdentifierNode as InterchangeIdentifierNode, SelectorNode as InterchangeSelectorNode, VariableNode as InterchangeVariableNode, BinaryNode as InterchangeBinaryNode, UnaryNode as InterchangeUnaryNode, MemberNode as InterchangeMemberNode, PossessiveNode as InterchangePossessiveNode, CallNode as InterchangeCallNode, IfNode as InterchangeIfNode, RepeatNode as InterchangeRepeatNode, ForEachNode as InterchangeForEachNode, WhileNode as InterchangeWhileNode, PositionalNode as InterchangePositionalNode, EventModifiers as InterchangeEventModifiers, } from './interchange/index.js';
|
|
9
9
|
export { fromCoreAST, toCoreAST } from './interchange/index.js';
|
|
10
10
|
export { interchangeToLSPDiagnostics, interchangeToLSPSymbols, interchangeToLSPHover, interchangeToLSPCompletions, calculateCyclomatic, calculateCognitive, } from './interchange/index.js';
|
|
11
|
-
export type { LSPPosition, LSPRange, LSPDiagnostic, LSPDiagnosticSeverity, LSPDocumentSymbol, LSPSymbolKind, LSPCompletionItem, LSPCompletionItemKind, LSPHoverInfo, } from './interchange/index.js';
|
|
11
|
+
export type { LSPPosition, LSPRange, LSPDiagnostic, LSPDiagnosticSeverity, LSPDocumentSymbol, LSPSymbolKind, LSPCompletionItem, LSPCompletionItemKind, LSPHoverInfo, LSPHoverOptions, } from './interchange/index.js';
|
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/ast-utils/index.js
CHANGED
|
@@ -2892,7 +2892,7 @@ function interchangeToLSPSymbols(nodes) {
|
|
|
2892
2892
|
}
|
|
2893
2893
|
return symbols;
|
|
2894
2894
|
}
|
|
2895
|
-
function interchangeToLSPHover(nodes, position) {
|
|
2895
|
+
function interchangeToLSPHover(nodes, position, options) {
|
|
2896
2896
|
const node = findNodeAtPosition(nodes, position);
|
|
2897
2897
|
if (!node)
|
|
2898
2898
|
return null;
|
|
@@ -2913,6 +2913,16 @@ function interchangeToLSPHover(nodes, position) {
|
|
|
2913
2913
|
contents += 'Loop construct\n\n';
|
|
2914
2914
|
break;
|
|
2915
2915
|
}
|
|
2916
|
+
if (options?.renderLSE) {
|
|
2917
|
+
try {
|
|
2918
|
+
const lse = options.renderLSE(node);
|
|
2919
|
+
if (lse) {
|
|
2920
|
+
contents += `**LSE:** \`${lse}\`\n\n`;
|
|
2921
|
+
}
|
|
2922
|
+
}
|
|
2923
|
+
catch {
|
|
2924
|
+
}
|
|
2925
|
+
}
|
|
2916
2926
|
if (['event', 'if', 'repeat', 'foreach', 'while'].includes(node.type)) {
|
|
2917
2927
|
const cyclomatic = calculateCyclomatic(node);
|
|
2918
2928
|
const cognitive = calculateCognitive(node);
|
package/dist/ast-utils/index.mjs
CHANGED
|
@@ -2890,7 +2890,7 @@ function interchangeToLSPSymbols(nodes) {
|
|
|
2890
2890
|
}
|
|
2891
2891
|
return symbols;
|
|
2892
2892
|
}
|
|
2893
|
-
function interchangeToLSPHover(nodes, position) {
|
|
2893
|
+
function interchangeToLSPHover(nodes, position, options) {
|
|
2894
2894
|
const node = findNodeAtPosition(nodes, position);
|
|
2895
2895
|
if (!node)
|
|
2896
2896
|
return null;
|
|
@@ -2911,6 +2911,16 @@ function interchangeToLSPHover(nodes, position) {
|
|
|
2911
2911
|
contents += 'Loop construct\n\n';
|
|
2912
2912
|
break;
|
|
2913
2913
|
}
|
|
2914
|
+
if (options?.renderLSE) {
|
|
2915
|
+
try {
|
|
2916
|
+
const lse = options.renderLSE(node);
|
|
2917
|
+
if (lse) {
|
|
2918
|
+
contents += `**LSE:** \`${lse}\`\n\n`;
|
|
2919
|
+
}
|
|
2920
|
+
}
|
|
2921
|
+
catch {
|
|
2922
|
+
}
|
|
2923
|
+
}
|
|
2914
2924
|
if (['event', 'if', 'repeat', 'foreach', 'while'].includes(node.type)) {
|
|
2915
2925
|
const cyclomatic = calculateCyclomatic(node);
|
|
2916
2926
|
const cognitive = calculateCognitive(node);
|
|
@@ -2,5 +2,5 @@ export type { InterchangeNode, BaseNode, EventNode, CommandNode, LiteralNode, Id
|
|
|
2
2
|
export { fromCoreAST } from './from-core';
|
|
3
3
|
export { toCoreAST } from './to-core';
|
|
4
4
|
export { interchangeToLSPDiagnostics, interchangeToLSPSymbols, interchangeToLSPHover, interchangeToLSPCompletions, calculateCyclomatic, calculateCognitive, } from './lsp';
|
|
5
|
-
export type { Position as LSPPosition, Range as LSPRange, Diagnostic as LSPDiagnostic, DiagnosticSeverity as LSPDiagnosticSeverity, DocumentSymbol as LSPDocumentSymbol, SymbolKind as LSPSymbolKind, CompletionItem as LSPCompletionItem, CompletionItemKind as LSPCompletionItemKind, HoverInfo as LSPHoverInfo, } from './lsp';
|
|
5
|
+
export type { Position as LSPPosition, Range as LSPRange, Diagnostic as LSPDiagnostic, DiagnosticSeverity as LSPDiagnosticSeverity, DocumentSymbol as LSPDocumentSymbol, SymbolKind as LSPSymbolKind, CompletionItem as LSPCompletionItem, CompletionItemKind as LSPCompletionItemKind, HoverInfo as LSPHoverInfo, HoverOptions as LSPHoverOptions, } from './lsp';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -101,7 +101,10 @@ export declare function interchangeToLSPDiagnostics(nodes: InterchangeNode[], op
|
|
|
101
101
|
cognitiveThreshold?: number;
|
|
102
102
|
}): Diagnostic[];
|
|
103
103
|
export declare function interchangeToLSPSymbols(nodes: InterchangeNode[]): DocumentSymbol[];
|
|
104
|
-
export
|
|
104
|
+
export interface HoverOptions {
|
|
105
|
+
renderLSE?: (node: InterchangeNode) => string;
|
|
106
|
+
}
|
|
107
|
+
export declare function interchangeToLSPHover(nodes: InterchangeNode[], position: Position, options?: HoverOptions): HoverInfo | null;
|
|
105
108
|
export declare function interchangeToLSPCompletions(nodes: InterchangeNode[], position: Position): CompletionItem[];
|
|
106
109
|
export declare function calculateCyclomatic(node: InterchangeNode): number;
|
|
107
110
|
export declare function calculateCognitive(node: InterchangeNode): number;
|
package/dist/behaviors/index.js
CHANGED
|
@@ -26,6 +26,7 @@ var Operation = {
|
|
|
26
26
|
};
|
|
27
27
|
var candidateNodes = new Set;
|
|
28
28
|
var candidateElements = new Set;
|
|
29
|
+
var candidateElementsWithIds = new Set;
|
|
29
30
|
var unmatchedNodes = new Set;
|
|
30
31
|
var unmatchedElements = new Set;
|
|
31
32
|
var whitespaceNodes = new Set;
|
|
@@ -245,6 +246,7 @@ class Morph {
|
|
|
245
246
|
const toChildNodes = [...to.childNodes];
|
|
246
247
|
candidateNodes.clear();
|
|
247
248
|
candidateElements.clear();
|
|
249
|
+
candidateElementsWithIds.clear();
|
|
248
250
|
unmatchedNodes.clear();
|
|
249
251
|
unmatchedElements.clear();
|
|
250
252
|
whitespaceNodes.clear();
|
|
@@ -260,7 +262,11 @@ class Morph {
|
|
|
260
262
|
candidateNodeTypeMap[i] = nodeType;
|
|
261
263
|
if (nodeType === ELEMENT_NODE_TYPE) {
|
|
262
264
|
candidateLocalNameMap[i] = candidate.localName;
|
|
263
|
-
|
|
265
|
+
if (candidate.id !== "") {
|
|
266
|
+
candidateElementsWithIds.add(i);
|
|
267
|
+
} else {
|
|
268
|
+
candidateElements.add(i);
|
|
269
|
+
}
|
|
264
270
|
} else if (nodeType === TEXT_NODE_TYPE && candidate.textContent?.trim() === "") {
|
|
265
271
|
whitespaceNodes.add(i);
|
|
266
272
|
} else {
|
|
@@ -303,13 +309,13 @@ class Morph {
|
|
|
303
309
|
if (id === "" && !idArray)
|
|
304
310
|
continue;
|
|
305
311
|
candidateLoop:
|
|
306
|
-
for (const candidateIndex of
|
|
312
|
+
for (const candidateIndex of candidateElementsWithIds) {
|
|
307
313
|
const candidate = fromChildNodes[candidateIndex];
|
|
308
314
|
if (localNameMap[unmatchedIndex] === candidateLocalNameMap[candidateIndex]) {
|
|
309
315
|
if (id !== "" && id === candidate.id) {
|
|
310
316
|
matches[unmatchedIndex] = candidateIndex;
|
|
311
317
|
op[unmatchedIndex] = Operation.SameElement;
|
|
312
|
-
|
|
318
|
+
candidateElementsWithIds.delete(candidateIndex);
|
|
313
319
|
unmatchedElements.delete(unmatchedIndex);
|
|
314
320
|
break candidateLoop;
|
|
315
321
|
}
|
|
@@ -321,7 +327,7 @@ class Morph {
|
|
|
321
327
|
if (candidateIdSet.has(arrayId)) {
|
|
322
328
|
matches[unmatchedIndex] = candidateIndex;
|
|
323
329
|
op[unmatchedIndex] = Operation.SameElement;
|
|
324
|
-
|
|
330
|
+
candidateElementsWithIds.delete(candidateIndex);
|
|
325
331
|
unmatchedElements.delete(unmatchedIndex);
|
|
326
332
|
break candidateLoop;
|
|
327
333
|
}
|
|
@@ -396,6 +402,8 @@ class Morph {
|
|
|
396
402
|
this.#removeNode(fromChildNodes[i]);
|
|
397
403
|
for (const i of candidateElements)
|
|
398
404
|
this.#removeNode(fromChildNodes[i]);
|
|
405
|
+
for (const i of candidateElementsWithIds)
|
|
406
|
+
this.#removeNode(fromChildNodes[i]);
|
|
399
407
|
const lisIndices = longestIncreasingSubsequence(matches);
|
|
400
408
|
const shouldNotMove = new Array(fromChildNodes.length);
|
|
401
409
|
for (let i = 0;i < lisIndices.length; i++) {
|
|
@@ -540,7 +548,7 @@ function longestIncreasingSubsequence(sequence) {
|
|
|
540
548
|
return result;
|
|
541
549
|
}
|
|
542
550
|
|
|
543
|
-
//# debugId=
|
|
551
|
+
//# debugId=3F4BCB911DEC843864756E2164756E21
|
|
544
552
|
|
|
545
553
|
const morphlexMorph = morph;
|
|
546
554
|
const morphlexMorphInner = morphInner;
|
package/dist/behaviors/index.mjs
CHANGED
|
@@ -24,6 +24,7 @@ var Operation = {
|
|
|
24
24
|
};
|
|
25
25
|
var candidateNodes = new Set;
|
|
26
26
|
var candidateElements = new Set;
|
|
27
|
+
var candidateElementsWithIds = new Set;
|
|
27
28
|
var unmatchedNodes = new Set;
|
|
28
29
|
var unmatchedElements = new Set;
|
|
29
30
|
var whitespaceNodes = new Set;
|
|
@@ -243,6 +244,7 @@ class Morph {
|
|
|
243
244
|
const toChildNodes = [...to.childNodes];
|
|
244
245
|
candidateNodes.clear();
|
|
245
246
|
candidateElements.clear();
|
|
247
|
+
candidateElementsWithIds.clear();
|
|
246
248
|
unmatchedNodes.clear();
|
|
247
249
|
unmatchedElements.clear();
|
|
248
250
|
whitespaceNodes.clear();
|
|
@@ -258,7 +260,11 @@ class Morph {
|
|
|
258
260
|
candidateNodeTypeMap[i] = nodeType;
|
|
259
261
|
if (nodeType === ELEMENT_NODE_TYPE) {
|
|
260
262
|
candidateLocalNameMap[i] = candidate.localName;
|
|
261
|
-
|
|
263
|
+
if (candidate.id !== "") {
|
|
264
|
+
candidateElementsWithIds.add(i);
|
|
265
|
+
} else {
|
|
266
|
+
candidateElements.add(i);
|
|
267
|
+
}
|
|
262
268
|
} else if (nodeType === TEXT_NODE_TYPE && candidate.textContent?.trim() === "") {
|
|
263
269
|
whitespaceNodes.add(i);
|
|
264
270
|
} else {
|
|
@@ -301,13 +307,13 @@ class Morph {
|
|
|
301
307
|
if (id === "" && !idArray)
|
|
302
308
|
continue;
|
|
303
309
|
candidateLoop:
|
|
304
|
-
for (const candidateIndex of
|
|
310
|
+
for (const candidateIndex of candidateElementsWithIds) {
|
|
305
311
|
const candidate = fromChildNodes[candidateIndex];
|
|
306
312
|
if (localNameMap[unmatchedIndex] === candidateLocalNameMap[candidateIndex]) {
|
|
307
313
|
if (id !== "" && id === candidate.id) {
|
|
308
314
|
matches[unmatchedIndex] = candidateIndex;
|
|
309
315
|
op[unmatchedIndex] = Operation.SameElement;
|
|
310
|
-
|
|
316
|
+
candidateElementsWithIds.delete(candidateIndex);
|
|
311
317
|
unmatchedElements.delete(unmatchedIndex);
|
|
312
318
|
break candidateLoop;
|
|
313
319
|
}
|
|
@@ -319,7 +325,7 @@ class Morph {
|
|
|
319
325
|
if (candidateIdSet.has(arrayId)) {
|
|
320
326
|
matches[unmatchedIndex] = candidateIndex;
|
|
321
327
|
op[unmatchedIndex] = Operation.SameElement;
|
|
322
|
-
|
|
328
|
+
candidateElementsWithIds.delete(candidateIndex);
|
|
323
329
|
unmatchedElements.delete(unmatchedIndex);
|
|
324
330
|
break candidateLoop;
|
|
325
331
|
}
|
|
@@ -394,6 +400,8 @@ class Morph {
|
|
|
394
400
|
this.#removeNode(fromChildNodes[i]);
|
|
395
401
|
for (const i of candidateElements)
|
|
396
402
|
this.#removeNode(fromChildNodes[i]);
|
|
403
|
+
for (const i of candidateElementsWithIds)
|
|
404
|
+
this.#removeNode(fromChildNodes[i]);
|
|
397
405
|
const lisIndices = longestIncreasingSubsequence(matches);
|
|
398
406
|
const shouldNotMove = new Array(fromChildNodes.length);
|
|
399
407
|
for (let i = 0;i < lisIndices.length; i++) {
|
|
@@ -538,7 +546,7 @@ function longestIncreasingSubsequence(sequence) {
|
|
|
538
546
|
return result;
|
|
539
547
|
}
|
|
540
548
|
|
|
541
|
-
//# debugId=
|
|
549
|
+
//# debugId=3F4BCB911DEC843864756E2164756E21
|
|
542
550
|
|
|
543
551
|
const morphlexMorph = morph;
|
|
544
552
|
const morphlexMorphInner = morphInner;
|
|
@@ -713,6 +713,15 @@ async function evaluate(node: ASTNode, ctx: Context): Promise<any> {
|
|
|
713
713
|
const obj = await evaluate(node.object, ctx);
|
|
714
714
|
if (obj == null) return undefined;
|
|
715
715
|
const prop = node.computed ? await evaluate(node.property, ctx) : node.property;
|
|
716
|
+
if (prop === 'values' && obj instanceof Element) {
|
|
717
|
+
if (obj instanceof HTMLFormElement) return new FormData(obj);
|
|
718
|
+
const fd = new FormData();
|
|
719
|
+
obj.querySelectorAll('input, select, textarea').forEach(input => {
|
|
720
|
+
const name = input.getAttribute('name');
|
|
721
|
+
if (name && 'value' in input) fd.append(name, (input as HTMLInputElement).value);
|
|
722
|
+
});
|
|
723
|
+
return fd;
|
|
724
|
+
}
|
|
716
725
|
return obj[prop];
|
|
717
726
|
|
|
718
727
|
case 'call': {
|
|
@@ -711,6 +711,15 @@ async function evaluate(node: ASTNode, ctx: Context): Promise<any> {
|
|
|
711
711
|
const obj = await evaluate(node.object, ctx);
|
|
712
712
|
if (obj == null) return undefined;
|
|
713
713
|
const prop = node.computed ? await evaluate(node.property, ctx) : node.property;
|
|
714
|
+
if (prop === 'values' && obj instanceof Element) {
|
|
715
|
+
if (obj instanceof HTMLFormElement) return new FormData(obj);
|
|
716
|
+
const fd = new FormData();
|
|
717
|
+
obj.querySelectorAll('input, select, textarea').forEach(input => {
|
|
718
|
+
const name = input.getAttribute('name');
|
|
719
|
+
if (name && 'value' in input) fd.append(name, (input as HTMLInputElement).value);
|
|
720
|
+
});
|
|
721
|
+
return fd;
|
|
722
|
+
}
|
|
714
723
|
return obj[prop];
|
|
715
724
|
|
|
716
725
|
case 'call': {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{D as n}from"./browser-modular-
|
|
2
|
-
//# sourceMappingURL=bridge-
|
|
1
|
+
import{D as n}from"./browser-modular-CwTpxqdt.js";import"./feature-sockets-ClOH7vk7.js";let e=null;async function t(){return e||(e=await import("./browser-modular-CwTpxqdt.js").then(function(n){return n.n})),e}class a{constructor(e={}){this.analyzer=null,this.config={confidenceThreshold:e.confidenceThreshold??n,fallbackOnLowConfidence:e.fallbackOnLowConfidence??!0}}async initialize(){const n=await t();this.analyzer=n.createSemanticAnalyzer()}isInitialized(){return null!==this.analyzer}async transform(n,e,a){if(this.isInitialized()||await this.initialize(),e===a)return{output:n,usedSemantic:!1,confidence:1,sourceLang:e,targetLang:a};const i=await t();try{const t=i.translate(n,e,a);if(t!==n)return{output:t,usedSemantic:!0,confidence:.9,sourceLang:e,targetLang:a}}catch{}return{output:n,usedSemantic:!1,confidence:0,sourceLang:e,targetLang:a}}async parse(n,e){if(this.isInitialized()||await this.initialize(),!this.analyzer)return null;return this.analyzer.analyze(n,e).node??null}async render(n,e){return(await t()).render(n,e)}async parseToAST(n,e){if(this.isInitialized()||await this.initialize(),!this.analyzer)return null;const a=this.analyzer.analyze(n,e);if(a.confidence>=this.config.confidenceThreshold&&a.node){const n=await t();try{return n.buildAST(a.node).ast}catch(n){}}return null}async parseToASTWithDetails(n,e){if(this.isInitialized()||await this.initialize(),!this.analyzer)return{ast:null,usedDirectPath:!1,confidence:0,lang:e,fallbackText:null};const a=this.analyzer.analyze(n,e),i=await t();if(a.confidence>=this.config.confidenceThreshold&&a.node)try{const n=i.buildAST(a.node);return{ast:n.ast,usedDirectPath:!0,confidence:a.confidence,lang:e,fallbackText:null,warnings:n.warnings}}catch{}if(a.node&&this.config.fallbackOnLowConfidence){const n=i.render(a.node,"en");return{ast:null,usedDirectPath:!1,confidence:a.confidence,lang:e,fallbackText:n}}return{ast:null,usedDirectPath:!1,confidence:a.confidence,lang:e,fallbackText:null}}async getAllTranslations(n,e){const a=(await t()).getSupportedLanguages(),i={};for(const t of a)i[t]=await this.transform(n,e,t);return i}}export{a as SemanticGrammarBridge};
|
|
2
|
+
//# sourceMappingURL=bridge-CZfeDyEz.js.map
|