@lokascript/compilation-service 2.0.0 → 2.2.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/{chunk-HMLY7DHA.js → chunk-GBPMR66W.js} +8 -1
- package/dist/{chunk-ODJIDVMN.js → chunk-PVQF6QYP.js} +5 -118
- package/dist/chunk-PVQF6QYP.js.map +1 -0
- package/dist/{chunk-JDOSUTCM.js → chunk-ZQ3GX55O.js} +2 -2
- package/dist/{core-parser-adapter-VCJB52SO-MDHRIVZ7.js → core-parser-adapter-VCJB52SO-7T2PARW4.js} +3 -3
- package/dist/{dist-ICUX26U7.js → dist-A6VWPCPB.js} +498 -15
- package/dist/dist-A6VWPCPB.js.map +1 -0
- package/dist/{dist-JOIDNRL3.js → dist-CYO3JGTJ.js} +32925 -24218
- package/dist/dist-CYO3JGTJ.js.map +1 -0
- package/dist/http.cjs +13467 -4407
- package/dist/http.cjs.map +1 -1
- package/dist/http.d.cts +2 -1
- package/dist/http.d.ts +2 -1
- package/dist/http.js +2 -2
- package/dist/index.cjs +13472 -4409
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -23
- package/dist/index.d.ts +4 -23
- package/dist/index.js +9 -4
- package/dist/index.js.map +1 -1
- package/dist/{semantic-adapter-7HTMTO75-MFFBR7K3.js → semantic-adapter-7HTMTO75-WVF6UAHI.js} +2 -2
- package/dist/{service-891L1MYk.d.cts → service-qk1aChG9.d.cts} +6 -25
- package/dist/{service-891L1MYk.d.ts → service-qk1aChG9.d.ts} +6 -25
- package/package.json +4 -2
- package/dist/chunk-ODJIDVMN.js.map +0 -1
- package/dist/dist-ICUX26U7.js.map +0 -1
- package/dist/dist-JOIDNRL3.js.map +0 -1
- /package/dist/{chunk-HMLY7DHA.js.map → chunk-GBPMR66W.js.map} +0 -0
- /package/dist/{chunk-JDOSUTCM.js.map → chunk-ZQ3GX55O.js.map} +0 -0
- /package/dist/{core-parser-adapter-VCJB52SO-MDHRIVZ7.js.map → core-parser-adapter-VCJB52SO-7T2PARW4.js.map} +0 -0
- /package/dist/{semantic-adapter-7HTMTO75-MFFBR7K3.js.map → semantic-adapter-7HTMTO75-WVF6UAHI.js.map} +0 -0
|
@@ -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-
|
|
23
|
+
//# sourceMappingURL=chunk-GBPMR66W.js.map
|
|
@@ -268,118 +268,6 @@ function detectFormat(input) {
|
|
|
268
268
|
return "natural";
|
|
269
269
|
}
|
|
270
270
|
|
|
271
|
-
// src/input/json-schema.ts
|
|
272
|
-
var VALID_VALUE_TYPES = /* @__PURE__ */ new Set(["selector", "literal", "reference", "expression"]);
|
|
273
|
-
function validateSemanticJSON(input) {
|
|
274
|
-
const diagnostics = [];
|
|
275
|
-
if (!input.action || typeof input.action !== "string") {
|
|
276
|
-
diagnostics.push({
|
|
277
|
-
severity: "error",
|
|
278
|
-
code: "INVALID_ACTION",
|
|
279
|
-
message: 'Field "action" is required and must be a string.',
|
|
280
|
-
suggestion: 'Provide a command name like "toggle", "add", "set", etc.'
|
|
281
|
-
});
|
|
282
|
-
return diagnostics;
|
|
283
|
-
}
|
|
284
|
-
if (input.roles && typeof input.roles === "object") {
|
|
285
|
-
for (const [role, value] of Object.entries(input.roles)) {
|
|
286
|
-
if (!value || typeof value !== "object") {
|
|
287
|
-
diagnostics.push({
|
|
288
|
-
severity: "error",
|
|
289
|
-
code: "INVALID_ROLE_VALUE",
|
|
290
|
-
message: `Role "${role}" must be an object with "type" and "value" fields.`,
|
|
291
|
-
suggestion: `Use: { "type": "selector", "value": ".active" }`
|
|
292
|
-
});
|
|
293
|
-
continue;
|
|
294
|
-
}
|
|
295
|
-
const v = value;
|
|
296
|
-
if (!VALID_VALUE_TYPES.has(v.type)) {
|
|
297
|
-
diagnostics.push({
|
|
298
|
-
severity: "error",
|
|
299
|
-
code: "INVALID_VALUE_TYPE",
|
|
300
|
-
message: `Role "${role}" has invalid type "${v.type}".`,
|
|
301
|
-
suggestion: `Valid types: selector, literal, reference, expression.`
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
if (v.value === void 0 || v.value === null) {
|
|
305
|
-
diagnostics.push({
|
|
306
|
-
severity: "error",
|
|
307
|
-
code: "MISSING_VALUE",
|
|
308
|
-
message: `Role "${role}" is missing the "value" field.`
|
|
309
|
-
});
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
if (input.trigger) {
|
|
314
|
-
if (!input.trigger.event || typeof input.trigger.event !== "string") {
|
|
315
|
-
diagnostics.push({
|
|
316
|
-
severity: "error",
|
|
317
|
-
code: "INVALID_TRIGGER",
|
|
318
|
-
message: 'Trigger "event" is required and must be a string.',
|
|
319
|
-
suggestion: 'Use an event name like "click", "mouseover", "keydown".'
|
|
320
|
-
});
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
return diagnostics;
|
|
324
|
-
}
|
|
325
|
-
function jsonToSemanticNode(input) {
|
|
326
|
-
const roles = /* @__PURE__ */ new Map();
|
|
327
|
-
if (input.roles) {
|
|
328
|
-
for (const [role, value] of Object.entries(input.roles)) {
|
|
329
|
-
roles.set(role, convertJSONValue(value));
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
if (input.trigger) {
|
|
333
|
-
roles.set("event", { type: "literal", value: input.trigger.event, dataType: "string" });
|
|
334
|
-
const bodyNode = {
|
|
335
|
-
kind: "command",
|
|
336
|
-
action: input.action,
|
|
337
|
-
roles: new Map(roles)
|
|
338
|
-
};
|
|
339
|
-
bodyNode.roles.delete("event");
|
|
340
|
-
return {
|
|
341
|
-
kind: "event-handler",
|
|
342
|
-
action: "on",
|
|
343
|
-
roles,
|
|
344
|
-
body: [bodyNode],
|
|
345
|
-
eventModifiers: input.trigger.modifiers ?? {}
|
|
346
|
-
};
|
|
347
|
-
}
|
|
348
|
-
return {
|
|
349
|
-
kind: "command",
|
|
350
|
-
action: input.action,
|
|
351
|
-
roles
|
|
352
|
-
};
|
|
353
|
-
}
|
|
354
|
-
function convertJSONValue(value) {
|
|
355
|
-
switch (value.type) {
|
|
356
|
-
case "selector":
|
|
357
|
-
return {
|
|
358
|
-
type: "selector",
|
|
359
|
-
value: String(value.value),
|
|
360
|
-
selectorKind: detectSelectorKind(String(value.value))
|
|
361
|
-
};
|
|
362
|
-
case "literal":
|
|
363
|
-
return {
|
|
364
|
-
type: "literal",
|
|
365
|
-
value: value.value,
|
|
366
|
-
dataType: typeof value.value === "number" ? "number" : typeof value.value === "boolean" ? "boolean" : "string"
|
|
367
|
-
};
|
|
368
|
-
case "reference":
|
|
369
|
-
return { type: "reference", value: String(value.value) };
|
|
370
|
-
case "expression":
|
|
371
|
-
return { type: "expression", raw: String(value.value) };
|
|
372
|
-
default:
|
|
373
|
-
return { type: "literal", value: String(value.value), dataType: "string" };
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
function detectSelectorKind(selector) {
|
|
377
|
-
if (selector.startsWith("#")) return "id";
|
|
378
|
-
if (selector.startsWith(".")) return "class";
|
|
379
|
-
if (selector.startsWith("[")) return "attribute";
|
|
380
|
-
return "complex";
|
|
381
|
-
}
|
|
382
|
-
|
|
383
271
|
// src/compile/cache.ts
|
|
384
272
|
var SemanticCache = class {
|
|
385
273
|
constructor(maxSize = 500) {
|
|
@@ -2579,6 +2467,7 @@ function renderSvelteElement(el, analysis) {
|
|
|
2579
2467
|
}
|
|
2580
2468
|
|
|
2581
2469
|
// src/input/normalize.ts
|
|
2470
|
+
import { validateProtocolJSON, fromProtocolJSON } from "@lokascript/framework";
|
|
2582
2471
|
var _semantic = null;
|
|
2583
2472
|
function initNormalizer(semantic) {
|
|
2584
2473
|
_semantic = semantic;
|
|
@@ -2673,7 +2562,7 @@ function normalizeExplicit(input) {
|
|
|
2673
2562
|
}
|
|
2674
2563
|
}
|
|
2675
2564
|
function normalizeJSON(input) {
|
|
2676
|
-
const validationErrors =
|
|
2565
|
+
const validationErrors = validateProtocolJSON(input);
|
|
2677
2566
|
if (validationErrors.some((d) => d.severity === "error")) {
|
|
2678
2567
|
return {
|
|
2679
2568
|
node: null,
|
|
@@ -2682,7 +2571,7 @@ function normalizeJSON(input) {
|
|
|
2682
2571
|
diagnostics: validationErrors
|
|
2683
2572
|
};
|
|
2684
2573
|
}
|
|
2685
|
-
const node =
|
|
2574
|
+
const node = fromProtocolJSON(input);
|
|
2686
2575
|
return {
|
|
2687
2576
|
node,
|
|
2688
2577
|
confidence: 1,
|
|
@@ -2879,7 +2768,7 @@ var CompilationService = class _CompilationService {
|
|
|
2879
2768
|
initValidation({
|
|
2880
2769
|
validateSemanticResult: semantic.validateSemanticResult
|
|
2881
2770
|
});
|
|
2882
|
-
const aot = await import("./dist-
|
|
2771
|
+
const aot = await import("./dist-A6VWPCPB.js");
|
|
2883
2772
|
const compiler = aot.createCompiler();
|
|
2884
2773
|
initBridge(
|
|
2885
2774
|
{
|
|
@@ -3308,8 +3197,6 @@ export {
|
|
|
3308
3197
|
diffBehaviors,
|
|
3309
3198
|
canonicalizeOp,
|
|
3310
3199
|
detectFormat,
|
|
3311
|
-
validateSemanticJSON,
|
|
3312
|
-
jsonToSemanticNode,
|
|
3313
3200
|
SemanticCache,
|
|
3314
3201
|
generateCacheKey,
|
|
3315
3202
|
extractOperations,
|
|
@@ -3319,4 +3206,4 @@ export {
|
|
|
3319
3206
|
SvelteRenderer,
|
|
3320
3207
|
CompilationService
|
|
3321
3208
|
};
|
|
3322
|
-
//# sourceMappingURL=chunk-
|
|
3209
|
+
//# sourceMappingURL=chunk-PVQF6QYP.js.map
|