@lokascript/compilation-service 2.1.0 → 2.2.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.
@@ -2768,7 +2768,7 @@ var CompilationService = class _CompilationService {
2768
2768
  initValidation({
2769
2769
  validateSemanticResult: semantic.validateSemanticResult
2770
2770
  });
2771
- const aot = await import("./dist-SWJWTU4Z.js");
2771
+ const aot = await import("./dist-3TBAKHJP.js");
2772
2772
  const compiler = aot.createCompiler();
2773
2773
  initBridge(
2774
2774
  {
@@ -3206,4 +3206,4 @@ export {
3206
3206
  SvelteRenderer,
3207
3207
  CompilationService
3208
3208
  };
3209
- //# sourceMappingURL=chunk-JGAJAREK.js.map
3209
+ //# sourceMappingURL=chunk-5VQO5CSQ.js.map
@@ -1,6 +1,12 @@
1
1
  var __typeError = (msg) => {
2
2
  throw TypeError(msg);
3
3
  };
4
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
5
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
6
+ }) : x)(function(x) {
7
+ if (typeof require !== "undefined") return require.apply(this, arguments);
8
+ throw Error('Dynamic require of "' + x + '" is not supported');
9
+ });
4
10
  var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
5
11
  var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
6
12
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
@@ -8,9 +14,10 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
8
14
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
9
15
 
10
16
  export {
17
+ __require,
11
18
  __privateGet,
12
19
  __privateAdd,
13
20
  __privateSet,
14
21
  __privateMethod
15
22
  };
16
- //# sourceMappingURL=chunk-HMLY7DHA.js.map
23
+ //# sourceMappingURL=chunk-GBPMR66W.js.map
@@ -24,7 +24,7 @@ function convertCoreASTToAOT(node) {
24
24
  return node;
25
25
  }
26
26
  async function createCoreParserAdapter() {
27
- const core = await import("./dist-KBC4YRQJ.js");
27
+ const core = await import("./dist-TXRKL7PN.js");
28
28
  const api = core.hyperscript ?? core.default ?? core;
29
29
  if (!api?.compileSync) {
30
30
  throw new Error(
@@ -46,4 +46,4 @@ export {
46
46
  convertCoreASTToAOT,
47
47
  createCoreParserAdapter
48
48
  };
49
- //# sourceMappingURL=chunk-UQULNKOC.js.map
49
+ //# sourceMappingURL=chunk-YFCEVGOM.js.map
@@ -2,11 +2,11 @@ import {
2
2
  CoreParserAdapter,
3
3
  convertCoreASTToAOT,
4
4
  createCoreParserAdapter
5
- } from "./chunk-UQULNKOC.js";
6
- import "./chunk-HMLY7DHA.js";
5
+ } from "./chunk-YFCEVGOM.js";
6
+ import "./chunk-GBPMR66W.js";
7
7
  export {
8
8
  CoreParserAdapter,
9
9
  convertCoreASTToAOT,
10
10
  createCoreParserAdapter
11
11
  };
12
- //# sourceMappingURL=core-parser-adapter-VCJB52SO-5HK2TL6Q.js.map
12
+ //# sourceMappingURL=core-parser-adapter-VCJB52SO-VNI2RAC6.js.map
@@ -1,18 +1,19 @@
1
1
  import {
2
2
  CoreParserAdapter,
3
3
  createCoreParserAdapter
4
- } from "./chunk-UQULNKOC.js";
4
+ } from "./chunk-YFCEVGOM.js";
5
5
  import {
6
6
  SemanticParserAdapter,
7
7
  createSemanticAdapter
8
8
  } from "./chunk-CY26COTT.js";
9
- import "./chunk-HMLY7DHA.js";
9
+ import "./chunk-GBPMR66W.js";
10
10
 
11
11
  // ../aot-compiler/dist/index.js
12
12
  import {
13
13
  isExplicitSyntax,
14
14
  parseExplicit,
15
- fromProtocolJSON
15
+ fromProtocolJSON,
16
+ semanticNodeToRuntimeAST
16
17
  } from "@lokascript/framework";
17
18
  var DEFAULT_OPTIONS = {
18
19
  attributeNames: ["_", "data-hs", "data-hyperscript"],
@@ -3527,7 +3528,7 @@ var AOTCompiler = class {
3527
3528
  if (isExplicitSyntax(code)) {
3528
3529
  try {
3529
3530
  const node = parseExplicit(code);
3530
- ast = this.semanticNodeToAOT(node);
3531
+ ast = semanticNodeToRuntimeAST(node);
3531
3532
  if (debug) {
3532
3533
  console.log(`[aot] Parsed explicit syntax: "${code}"`);
3533
3534
  }
@@ -3542,7 +3543,7 @@ var AOTCompiler = class {
3542
3543
  try {
3543
3544
  const json = JSON.parse(code.trim());
3544
3545
  const node = fromProtocolJSON(json);
3545
- ast = this.semanticNodeToAOT(node);
3546
+ ast = semanticNodeToRuntimeAST(node);
3546
3547
  if (debug) {
3547
3548
  console.log(`[aot] Parsed JSON input: "${code.slice(0, 80)}..."`);
3548
3549
  }
@@ -3768,61 +3769,6 @@ var AOTCompiler = class {
3768
3769
  }
3769
3770
  return ast;
3770
3771
  }
3771
- /**
3772
- * Convert a framework SemanticNode to an AOT ASTNode.
3773
- * Handles the simple cases produced by explicit/JSON parsing.
3774
- */
3775
- semanticNodeToAOT(node) {
3776
- if (node.kind === "event-handler") {
3777
- const eh = node;
3778
- const eventValue = eh.roles.get("event");
3779
- const eventName = eventValue && "value" in eventValue ? String(eventValue.value) : "click";
3780
- return {
3781
- type: "event",
3782
- event: eventName,
3783
- modifiers: {},
3784
- body: (eh.body ?? []).map((child) => this.semanticNodeToAOT(child))
3785
- };
3786
- }
3787
- const roles = {};
3788
- const args = [];
3789
- for (const [roleName, value] of node.roles) {
3790
- const astValue = this.semanticValueToAOT(value);
3791
- roles[roleName] = astValue;
3792
- args.push(astValue);
3793
- }
3794
- return {
3795
- type: "command",
3796
- name: node.action,
3797
- args,
3798
- roles
3799
- };
3800
- }
3801
- /**
3802
- * Convert a SemanticValue to an ASTNode.
3803
- */
3804
- semanticValueToAOT(value) {
3805
- switch (value.type) {
3806
- case "selector":
3807
- return { type: "selector", value: value.value };
3808
- case "reference":
3809
- return { type: "identifier", value: value.value };
3810
- case "literal": {
3811
- const lit = value;
3812
- if (lit.dataType === "duration") {
3813
- const str = String(lit.value);
3814
- const match = /^(\d+(?:\.\d+)?)(ms|s)$/.exec(str);
3815
- if (match) {
3816
- const ms = match[2] === "s" ? parseFloat(match[1]) * 1e3 : parseFloat(match[1]);
3817
- return { type: "literal", value: ms };
3818
- }
3819
- }
3820
- return { type: "literal", value: lit.value };
3821
- }
3822
- default:
3823
- return { type: "literal", value: String(value.value ?? "") };
3824
- }
3825
- }
3826
3772
  // ===========================================================================
3827
3773
  // ANALYSIS
3828
3774
  // ===========================================================================
@@ -4018,7 +3964,7 @@ var AOTCompiler = class {
4018
3964
  */
4019
3965
  compileExplicit(code, options = {}) {
4020
3966
  try {
4021
- const ast = isExplicitSyntax(code) ? this.semanticNodeToAOT(parseExplicit(code)) : this.semanticNodeToAOT(fromProtocolJSON(JSON.parse(code.trim())));
3967
+ const ast = isExplicitSyntax(code) ? semanticNodeToRuntimeAST(parseExplicit(code)) : semanticNodeToRuntimeAST(fromProtocolJSON(JSON.parse(code.trim())));
4022
3968
  return this.compileAST(ast, options);
4023
3969
  } catch (error) {
4024
3970
  return {
@@ -4271,12 +4217,12 @@ async function compileHyperscript(code, options) {
4271
4217
  async function createMultilingualCompiler() {
4272
4218
  const compiler = new AOTCompiler();
4273
4219
  try {
4274
- const { createCoreParserAdapter: createCoreParserAdapter2 } = await import("./core-parser-adapter-VCJB52SO-5HK2TL6Q.js");
4220
+ const { createCoreParserAdapter: createCoreParserAdapter2 } = await import("./core-parser-adapter-VCJB52SO-VNI2RAC6.js");
4275
4221
  compiler.setParser(await createCoreParserAdapter2());
4276
4222
  } catch {
4277
4223
  }
4278
4224
  try {
4279
- const { createSemanticAdapter: createSemanticAdapter2 } = await import("./semantic-adapter-7HTMTO75-MFFBR7K3.js");
4225
+ const { createSemanticAdapter: createSemanticAdapter2 } = await import("./semantic-adapter-7HTMTO75-WVF6UAHI.js");
4280
4226
  compiler.setSemanticParser(await createSemanticAdapter2());
4281
4227
  } catch {
4282
4228
  }
@@ -4324,4 +4270,4 @@ export {
4324
4270
  sanitizeSelector,
4325
4271
  scanFiles
4326
4272
  };
4327
- //# sourceMappingURL=dist-SWJWTU4Z.js.map
4273
+ //# sourceMappingURL=dist-3TBAKHJP.js.map