@jay-framework/compiler-shared 0.23.0 → 0.23.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/dist/index.js +25 -49
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) =>
|
|
4
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
return value;
|
|
6
|
-
};
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7
4
|
import * as prettier from "prettier";
|
|
8
5
|
import jsBeautify from "js-beautify";
|
|
9
6
|
import fs from "fs";
|
|
@@ -536,8 +533,7 @@ class Imports {
|
|
|
536
533
|
if (this.imports[importName.index] && importName.usage.includes(importsFor)) {
|
|
537
534
|
if (moduleImportStatements.has(importName.module))
|
|
538
535
|
moduleImportStatements.get(importName.module).push(importName.statement);
|
|
539
|
-
else
|
|
540
|
-
moduleImportStatements.set(importName.module, [importName.statement]);
|
|
536
|
+
else moduleImportStatements.set(importName.module, [importName.statement]);
|
|
541
537
|
}
|
|
542
538
|
}
|
|
543
539
|
const modulesToImport = [...moduleImportStatements.keys()].sort(
|
|
@@ -784,10 +780,8 @@ function isDateWithTimezoneType(aType) {
|
|
|
784
780
|
return aType.kind === 0 && aType.name === "DateWithTimezone";
|
|
785
781
|
}
|
|
786
782
|
function equalJayTypes(a, b) {
|
|
787
|
-
if (a.name !== b.name)
|
|
788
|
-
|
|
789
|
-
if (a instanceof JayAtomicType && b instanceof JayAtomicType)
|
|
790
|
-
return a.name === b.name;
|
|
783
|
+
if (a.name !== b.name) return false;
|
|
784
|
+
if (a instanceof JayAtomicType && b instanceof JayAtomicType) return a.name === b.name;
|
|
791
785
|
else if (a instanceof JayEnumType && b instanceof JayEnumType)
|
|
792
786
|
return a.values.length === b.values.length && a.values.reduce(
|
|
793
787
|
(res, a_val, currentIndex) => res && a_val === b.values[currentIndex],
|
|
@@ -797,14 +791,11 @@ function equalJayTypes(a, b) {
|
|
|
797
791
|
return equalJayTypes(a.itemType, b.itemType);
|
|
798
792
|
else if (a instanceof JayRecordType && b instanceof JayRecordType)
|
|
799
793
|
return equalJayTypes(a.itemType, b.itemType);
|
|
800
|
-
else if (a instanceof JayTypeAlias && b instanceof JayTypeAlias)
|
|
801
|
-
|
|
802
|
-
else if (a instanceof JayHTMLType && b instanceof JayHTMLType)
|
|
803
|
-
return true;
|
|
794
|
+
else if (a instanceof JayTypeAlias && b instanceof JayTypeAlias) return true;
|
|
795
|
+
else if (a instanceof JayHTMLType && b instanceof JayHTMLType) return true;
|
|
804
796
|
else if (a instanceof JayImportedType && b instanceof JayImportedType)
|
|
805
797
|
return equalJayTypes(a.type, b.type);
|
|
806
|
-
else if (a instanceof JayElementType && b instanceof JayElementType)
|
|
807
|
-
return true;
|
|
798
|
+
else if (a instanceof JayElementType && b instanceof JayElementType) return true;
|
|
808
799
|
else if (a instanceof JayElementConstructorType && b instanceof JayElementConstructorType)
|
|
809
800
|
return a.typeName === b.typeName;
|
|
810
801
|
else if (a instanceof JayComponentType && b instanceof JayComponentType)
|
|
@@ -824,8 +815,7 @@ function equalJayTypes(a, b) {
|
|
|
824
815
|
return equalJayTypes(a.itemType, b.itemType);
|
|
825
816
|
} else if (a instanceof JayRecursiveType && b instanceof JayRecursiveType) {
|
|
826
817
|
return a.referencePath === b.referencePath;
|
|
827
|
-
} else
|
|
828
|
-
;
|
|
818
|
+
} else ;
|
|
829
819
|
}
|
|
830
820
|
function jayTypeToJsonSchema(type) {
|
|
831
821
|
if (isOptionalType(type)) {
|
|
@@ -1024,12 +1014,9 @@ function parseJayModuleSpecifier(specifier) {
|
|
|
1024
1014
|
isHydrate: hydrate
|
|
1025
1015
|
} of JAY_QUERY_PATTERNS) {
|
|
1026
1016
|
if (remainingQuery.includes(pattern)) {
|
|
1027
|
-
if (buildEnv)
|
|
1028
|
-
|
|
1029
|
-
if (
|
|
1030
|
-
runtimeMode = rtMode;
|
|
1031
|
-
if (hydrate)
|
|
1032
|
-
isHydrate = true;
|
|
1017
|
+
if (buildEnv) buildEnvironment = buildEnv;
|
|
1018
|
+
if (rtMode) runtimeMode = rtMode;
|
|
1019
|
+
if (hydrate) isHydrate = true;
|
|
1033
1020
|
remainingQuery = remainingQuery.replace(pattern, "");
|
|
1034
1021
|
}
|
|
1035
1022
|
}
|
|
@@ -1100,10 +1087,8 @@ class WithValidations {
|
|
|
1100
1087
|
this.validations = validations;
|
|
1101
1088
|
}
|
|
1102
1089
|
map(func) {
|
|
1103
|
-
if (this.val !== void 0)
|
|
1104
|
-
|
|
1105
|
-
else
|
|
1106
|
-
return new WithValidations(void 0, this.validations);
|
|
1090
|
+
if (this.val !== void 0) return new WithValidations(func(this.val), this.validations);
|
|
1091
|
+
else return new WithValidations(void 0, this.validations);
|
|
1107
1092
|
}
|
|
1108
1093
|
async mapAsync(func) {
|
|
1109
1094
|
if (this.val !== void 0) {
|
|
@@ -1117,8 +1102,7 @@ class WithValidations {
|
|
|
1117
1102
|
if (this.val !== void 0) {
|
|
1118
1103
|
let that = func(this.val);
|
|
1119
1104
|
return new WithValidations(that.val, [...this.validations, ...that.validations]);
|
|
1120
|
-
} else
|
|
1121
|
-
return new WithValidations(void 0, this.validations);
|
|
1105
|
+
} else return new WithValidations(void 0, this.validations);
|
|
1122
1106
|
}
|
|
1123
1107
|
async flatMapAsync(func) {
|
|
1124
1108
|
if (this.val !== void 0) {
|
|
@@ -1207,8 +1191,7 @@ function hasRefs(refs, includingAutoRefs) {
|
|
|
1207
1191
|
function nestRefs(path2, renderFragment) {
|
|
1208
1192
|
let refs = renderFragment.refs;
|
|
1209
1193
|
for (let index = path2.length - 1; index >= 0; --index) {
|
|
1210
|
-
if (path2[index] === ".")
|
|
1211
|
-
continue;
|
|
1194
|
+
if (path2[index] === ".") continue;
|
|
1212
1195
|
refs = mkRefsTree([], { [path2[index]]: refs }, refs.repeated);
|
|
1213
1196
|
}
|
|
1214
1197
|
return new RenderFragment(
|
|
@@ -1228,8 +1211,7 @@ function mkRefsTree(refs, children, repeated = false, refsTypeName, repeatedRefs
|
|
|
1228
1211
|
repeated,
|
|
1229
1212
|
imported: { refsTypeName, repeatedRefsTypeName }
|
|
1230
1213
|
};
|
|
1231
|
-
else
|
|
1232
|
-
return { kind: "refTree", refs, children, repeated };
|
|
1214
|
+
else return { kind: "refTree", refs, children, repeated };
|
|
1233
1215
|
}
|
|
1234
1216
|
function mkRef(ref, originalName, constName, repeated, autoRef, viewStateType, elementType) {
|
|
1235
1217
|
return {
|
|
@@ -1331,7 +1313,7 @@ function removeComments(code) {
|
|
|
1331
1313
|
(line) => !(line.includes("// @ts-expect-error ") || line.includes("// @ts-ignore") || line.includes("{/* @ts-ignore */}"))
|
|
1332
1314
|
).join("\n");
|
|
1333
1315
|
}
|
|
1334
|
-
const
|
|
1316
|
+
const require$1 = createRequire(import.meta.url);
|
|
1335
1317
|
const LOCAL_PLUGIN_PATH = "src/plugins";
|
|
1336
1318
|
function normalizeActionEntry(entry) {
|
|
1337
1319
|
if (typeof entry === "string") {
|
|
@@ -1435,7 +1417,7 @@ function resolveLocalPlugin(projectRoot, pluginName, contractName) {
|
|
|
1435
1417
|
function resolveNpmPluginManifest(projectRoot, pluginName) {
|
|
1436
1418
|
let pluginYamlPath;
|
|
1437
1419
|
try {
|
|
1438
|
-
pluginYamlPath =
|
|
1420
|
+
pluginYamlPath = require$1.resolve(`${pluginName}/plugin.yaml`, {
|
|
1439
1421
|
paths: [projectRoot]
|
|
1440
1422
|
});
|
|
1441
1423
|
} catch (error) {
|
|
@@ -1470,7 +1452,7 @@ function resolveNpmPlugin(projectRoot, pluginName, contractName) {
|
|
|
1470
1452
|
if (!manifestWithValidations.val || manifestWithValidations.validations.length > 0)
|
|
1471
1453
|
return new WithValidations(null, manifestWithValidations.validations);
|
|
1472
1454
|
const manifest = manifestWithValidations.val;
|
|
1473
|
-
const pluginYamlPath =
|
|
1455
|
+
const pluginYamlPath = require$1.resolve(`${pluginName}/plugin.yaml`, {
|
|
1474
1456
|
paths: [projectRoot]
|
|
1475
1457
|
});
|
|
1476
1458
|
const npmPluginPath = path.dirname(pluginYamlPath);
|
|
@@ -1603,12 +1585,9 @@ function resolveBinding(bindingPath, scope) {
|
|
|
1603
1585
|
let tags = scope.tags;
|
|
1604
1586
|
for (let i2 = 0; i2 < segments.length; i2++) {
|
|
1605
1587
|
const match = tags.find((t) => t.tag === segments[i2]);
|
|
1606
|
-
if (!match)
|
|
1607
|
-
|
|
1608
|
-
if (
|
|
1609
|
-
return { path: bindingPath, tag: match };
|
|
1610
|
-
if (!match.tags)
|
|
1611
|
-
return { path: bindingPath };
|
|
1588
|
+
if (!match) return { path: bindingPath };
|
|
1589
|
+
if (i2 === segments.length - 1) return { path: bindingPath, tag: match };
|
|
1590
|
+
if (!match.tags) return { path: bindingPath };
|
|
1612
1591
|
tags = match.tags;
|
|
1613
1592
|
}
|
|
1614
1593
|
return { path: bindingPath };
|
|
@@ -1618,12 +1597,9 @@ function resolveTagPath(dotPath, tags) {
|
|
|
1618
1597
|
let currentTags = tags;
|
|
1619
1598
|
for (let i2 = 0; i2 < segments.length; i2++) {
|
|
1620
1599
|
const match = currentTags.find((t) => t.tag === segments[i2]);
|
|
1621
|
-
if (!match)
|
|
1622
|
-
|
|
1623
|
-
if (
|
|
1624
|
-
return match;
|
|
1625
|
-
if (!match.tags)
|
|
1626
|
-
return void 0;
|
|
1600
|
+
if (!match) return void 0;
|
|
1601
|
+
if (i2 === segments.length - 1) return match;
|
|
1602
|
+
if (!match.tags) return void 0;
|
|
1627
1603
|
currentTags = match.tags;
|
|
1628
1604
|
}
|
|
1629
1605
|
return void 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jay-framework/compiler-shared",
|
|
3
|
-
"version": "0.23.
|
|
3
|
+
"version": "0.23.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
},
|
|
26
26
|
"author": "",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@jay-framework/component": "^0.23.
|
|
29
|
-
"@jay-framework/runtime": "^0.23.
|
|
30
|
-
"@jay-framework/secure": "^0.23.
|
|
31
|
-
"@jay-framework/typescript-bridge": "^0.23.
|
|
28
|
+
"@jay-framework/component": "^0.23.1",
|
|
29
|
+
"@jay-framework/runtime": "^0.23.1",
|
|
30
|
+
"@jay-framework/secure": "^0.23.1",
|
|
31
|
+
"@jay-framework/typescript-bridge": "^0.23.1",
|
|
32
32
|
"@types/js-yaml": "^4.0.9",
|
|
33
33
|
"change-case": "^4.1.2",
|
|
34
34
|
"js-beautify": "^1.14.11",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@caiogondim/strip-margin": "^1.0.0",
|
|
44
|
-
"@jay-framework/dev-environment": "^0.23.
|
|
44
|
+
"@jay-framework/dev-environment": "^0.23.1",
|
|
45
45
|
"@testing-library/jest-dom": "^6.2.0",
|
|
46
46
|
"@types/js-beautify": "^1",
|
|
47
47
|
"@types/node": "^20.11.5",
|