@jay-framework/compiler-shared 0.15.4 → 0.15.6
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.d.ts +28 -4
- package/dist/index.js +49 -10
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -129,9 +129,10 @@ declare enum JayTypeKind {
|
|
|
129
129
|
object = 8,
|
|
130
130
|
array = 9,
|
|
131
131
|
union = 10,
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
132
|
+
record = 11,
|
|
133
|
+
promise = 12,
|
|
134
|
+
recursive = 13,
|
|
135
|
+
optional = 14
|
|
135
136
|
}
|
|
136
137
|
interface JayType {
|
|
137
138
|
name: string;
|
|
@@ -157,6 +158,7 @@ declare class JayEnumType implements JayType {
|
|
|
157
158
|
readonly name: string;
|
|
158
159
|
readonly values: Array<string>;
|
|
159
160
|
constructor(name: string, values: Array<string>);
|
|
161
|
+
alias?: string;
|
|
160
162
|
readonly kind = JayTypeKind.enum;
|
|
161
163
|
}
|
|
162
164
|
declare class JayHTMLType implements JayType {
|
|
@@ -209,6 +211,12 @@ declare class JayArrayType implements JayType {
|
|
|
209
211
|
get name(): string;
|
|
210
212
|
readonly kind = JayTypeKind.array;
|
|
211
213
|
}
|
|
214
|
+
declare class JayRecordType implements JayType {
|
|
215
|
+
readonly itemType: JayType;
|
|
216
|
+
constructor(itemType: JayType);
|
|
217
|
+
get name(): string;
|
|
218
|
+
readonly kind = JayTypeKind.record;
|
|
219
|
+
}
|
|
212
220
|
declare class JayUnionType implements JayType {
|
|
213
221
|
readonly ofTypes: JayType[];
|
|
214
222
|
constructor(ofTypes: JayType[]);
|
|
@@ -247,6 +255,7 @@ declare function isElementType(aType: JayType): aType is JayElementType;
|
|
|
247
255
|
declare function isComponentType(aType: JayType): aType is JayComponentType;
|
|
248
256
|
declare function isObjectType(aType: JayType): aType is JayObjectType;
|
|
249
257
|
declare function isArrayType(aType: JayType): aType is JayArrayType;
|
|
258
|
+
declare function isRecordType(aType: JayType): aType is JayRecordType;
|
|
250
259
|
declare function isUnionType(aType: JayType): aType is JayUnionType;
|
|
251
260
|
declare function isPromiseType(aType: JayType): aType is JayPromiseType;
|
|
252
261
|
declare function isRecursiveType(aType: JayType): aType is JayRecursiveType;
|
|
@@ -269,6 +278,7 @@ interface JsonSchemaProperty {
|
|
|
269
278
|
description?: string;
|
|
270
279
|
enum?: string[];
|
|
271
280
|
items?: JsonSchemaProperty;
|
|
281
|
+
additionalProperties?: JsonSchemaProperty;
|
|
272
282
|
properties?: Record<string, JsonSchemaProperty>;
|
|
273
283
|
required?: string[];
|
|
274
284
|
}
|
|
@@ -577,6 +587,20 @@ interface PluginManifest {
|
|
|
577
587
|
actions?: ActionManifestEntry[];
|
|
578
588
|
/** Plugin initialization configuration */
|
|
579
589
|
init?: PluginInitConfig;
|
|
590
|
+
/** Server-side services provided by this plugin (DL#125) */
|
|
591
|
+
services?: Array<{
|
|
592
|
+
name: string;
|
|
593
|
+
marker: string;
|
|
594
|
+
description?: string;
|
|
595
|
+
doc?: string;
|
|
596
|
+
}>;
|
|
597
|
+
/** Client-side contexts provided by this plugin (DL#125) */
|
|
598
|
+
contexts?: Array<{
|
|
599
|
+
name: string;
|
|
600
|
+
marker: string;
|
|
601
|
+
description?: string;
|
|
602
|
+
doc?: string;
|
|
603
|
+
}>;
|
|
580
604
|
/** Plugin setup configuration (Design Log #87) */
|
|
581
605
|
setup?: {
|
|
582
606
|
/** Export name (NPM) or relative path (local) to setup handler function */
|
|
@@ -739,4 +763,4 @@ declare function compileForEachInstanceKeyExpr(coordinateSuffix: string, trackBy
|
|
|
739
763
|
*/
|
|
740
764
|
declare function computeForEachInstanceKey(trackByValue: string, coordinateSuffix: string): string;
|
|
741
765
|
|
|
742
|
-
export { type ActionManifestEntry, CSS_EXTENSION, type CompilerSourceFile, type DynamicContractConfig, GenerateTarget, type GenericTypescriptSourceFile, Import, type ImportName, type ImportedRefsTree, Imports, ImportsFor, JAY_4_REACT, JAY_ACTION_DTS_EXTENSION, JAY_ACTION_EXTENSION, JAY_COMPONENT, JAY_CONTRACT_DTS_EXTENSION, JAY_CONTRACT_EXTENSION, JAY_DTS_EXTENSION, JAY_EXTENSION, JAY_FULLSTACK_COMPONENTS, JAY_QUERY_CLIENT, JAY_QUERY_HYDRATE, JAY_QUERY_MAIN_SANDBOX, JAY_QUERY_MAIN_SANDBOX_TS, JAY_QUERY_PREFIX, JAY_QUERY_SERVER, JAY_QUERY_WORKER_SANDBOX, JAY_QUERY_WORKER_SANDBOX_TS, JAY_QUERY_WORKER_TRUSTED, JAY_QUERY_WORKER_TRUSTED_TS, JAY_RUNTIME, JAY_SECURE, JAY_SSR_RUNTIME, JAY_STACK_CLIENT_RUNTIME, JAY_TS_EXTENSION, JayArrayType, JayAtomicType, JayBoolean, JayBuildEnvironment, JayComponentApiMember, JayComponentType, JayDate, JayElementConstructorType, JayElementType, JayEnumType, type JayEnvironment, JayErrorType, JayHTMLType, type JayImportLink, type JayImportName, JayImportedType, JayNumber, JayObjectType, JayOptionalType, JayPromiseType, JayRecursiveType, JayString, type JayType, JayTypeAlias, JayTypeKind, JayUnionType, JayUnknown, type JayValidations, type JsonSchemaProperty, LOCAL_PLUGIN_PATH, MAKE_JAY_4_REACT_COMPONENT, MAKE_JAY_COMPONENT, MAKE_JAY_TSX_COMPONENT, type MainRuntimeModes, type ParsedJayModuleSpecifier, type PluginComponentResolution, type PluginInitConfig, type PluginManifest, REACT, type RecursiveRegion, type Ref, type RefsTree, RenderFragment, RuntimeMode, SourceFileFormat, TSX_EXTENSION, TS_EXTENSION, WithValidations, addBuildEnvironment, checkValidationErrors, compileCoordinateExpr, compileForEachInstanceKeyExpr, computeForEachInstanceKey, computeInstanceKey, equalJayTypes, findDynamicContract, getBasePath, getBuildEnvironment, getJayTsFileSourcePath, getMode, getModeFileExtension, getModeFromExtension, hasBuildEnvironment, hasExtension, hasJayExtension, hasJayModeExtension, hasRefs, isArrayType, isAtomicType, isComponentType, isCurrencyType, isDateWithTimezoneType, isElementConstructorType, isElementType, isEnumType, isHTMLType, isImportedType, isLocalModule, isObjectType, isOptionalType, isPromiseType, isRecursiveType, isStaticCoordinate, isTypeAliasType, isUnionType, jayTypeToJsonSchema, loadPluginManifest, mergeRefsTrees, mkRef, mkRefsTree, nestRefs, normalizeActionEntry, parseJayModuleSpecifier, prettify, prettifyHtml, removeComments, resolvePluginComponent, resolvePluginManifest, resolvePrimitiveType, withOriginalTrace, withoutExtension };
|
|
766
|
+
export { type ActionManifestEntry, CSS_EXTENSION, type CompilerSourceFile, type DynamicContractConfig, GenerateTarget, type GenericTypescriptSourceFile, Import, type ImportName, type ImportedRefsTree, Imports, ImportsFor, JAY_4_REACT, JAY_ACTION_DTS_EXTENSION, JAY_ACTION_EXTENSION, JAY_COMPONENT, JAY_CONTRACT_DTS_EXTENSION, JAY_CONTRACT_EXTENSION, JAY_DTS_EXTENSION, JAY_EXTENSION, JAY_FULLSTACK_COMPONENTS, JAY_QUERY_CLIENT, JAY_QUERY_HYDRATE, JAY_QUERY_MAIN_SANDBOX, JAY_QUERY_MAIN_SANDBOX_TS, JAY_QUERY_PREFIX, JAY_QUERY_SERVER, JAY_QUERY_WORKER_SANDBOX, JAY_QUERY_WORKER_SANDBOX_TS, JAY_QUERY_WORKER_TRUSTED, JAY_QUERY_WORKER_TRUSTED_TS, JAY_RUNTIME, JAY_SECURE, JAY_SSR_RUNTIME, JAY_STACK_CLIENT_RUNTIME, JAY_TS_EXTENSION, JayArrayType, JayAtomicType, JayBoolean, JayBuildEnvironment, JayComponentApiMember, JayComponentType, JayDate, JayElementConstructorType, JayElementType, JayEnumType, type JayEnvironment, JayErrorType, JayHTMLType, type JayImportLink, type JayImportName, JayImportedType, JayNumber, JayObjectType, JayOptionalType, JayPromiseType, JayRecordType, JayRecursiveType, JayString, type JayType, JayTypeAlias, JayTypeKind, JayUnionType, JayUnknown, type JayValidations, type JsonSchemaProperty, LOCAL_PLUGIN_PATH, MAKE_JAY_4_REACT_COMPONENT, MAKE_JAY_COMPONENT, MAKE_JAY_TSX_COMPONENT, type MainRuntimeModes, type ParsedJayModuleSpecifier, type PluginComponentResolution, type PluginInitConfig, type PluginManifest, REACT, type RecursiveRegion, type Ref, type RefsTree, RenderFragment, RuntimeMode, SourceFileFormat, TSX_EXTENSION, TS_EXTENSION, WithValidations, addBuildEnvironment, checkValidationErrors, compileCoordinateExpr, compileForEachInstanceKeyExpr, computeForEachInstanceKey, computeInstanceKey, equalJayTypes, findDynamicContract, getBasePath, getBuildEnvironment, getJayTsFileSourcePath, getMode, getModeFileExtension, getModeFromExtension, hasBuildEnvironment, hasExtension, hasJayExtension, hasJayModeExtension, hasRefs, isArrayType, isAtomicType, isComponentType, isCurrencyType, isDateWithTimezoneType, isElementConstructorType, isElementType, isEnumType, isHTMLType, isImportedType, isLocalModule, isObjectType, isOptionalType, isPromiseType, isRecordType, isRecursiveType, isStaticCoordinate, isTypeAliasType, isUnionType, jayTypeToJsonSchema, loadPluginManifest, mergeRefsTrees, mkRef, mkRefsTree, nestRefs, normalizeActionEntry, parseJayModuleSpecifier, prettify, prettifyHtml, removeComments, resolvePluginComponent, resolvePluginManifest, resolvePrimitiveType, withOriginalTrace, withoutExtension };
|
package/dist/index.js
CHANGED
|
@@ -572,9 +572,10 @@ var JayTypeKind = /* @__PURE__ */ ((JayTypeKind2) => {
|
|
|
572
572
|
JayTypeKind2[JayTypeKind2["object"] = 8] = "object";
|
|
573
573
|
JayTypeKind2[JayTypeKind2["array"] = 9] = "array";
|
|
574
574
|
JayTypeKind2[JayTypeKind2["union"] = 10] = "union";
|
|
575
|
-
JayTypeKind2[JayTypeKind2["
|
|
576
|
-
JayTypeKind2[JayTypeKind2["
|
|
577
|
-
JayTypeKind2[JayTypeKind2["
|
|
575
|
+
JayTypeKind2[JayTypeKind2["record"] = 11] = "record";
|
|
576
|
+
JayTypeKind2[JayTypeKind2["promise"] = 12] = "promise";
|
|
577
|
+
JayTypeKind2[JayTypeKind2["recursive"] = 13] = "recursive";
|
|
578
|
+
JayTypeKind2[JayTypeKind2["optional"] = 14] = "optional";
|
|
578
579
|
return JayTypeKind2;
|
|
579
580
|
})(JayTypeKind || {});
|
|
580
581
|
class JayAtomicType {
|
|
@@ -605,6 +606,7 @@ class JayTypeAlias {
|
|
|
605
606
|
}
|
|
606
607
|
class JayEnumType {
|
|
607
608
|
constructor(name, values) {
|
|
609
|
+
__publicField(this, "alias");
|
|
608
610
|
__publicField(this, "kind", 2);
|
|
609
611
|
this.name = name;
|
|
610
612
|
this.values = values;
|
|
@@ -666,6 +668,15 @@ class JayArrayType {
|
|
|
666
668
|
return `Array<${this.itemType.name}>`;
|
|
667
669
|
}
|
|
668
670
|
}
|
|
671
|
+
class JayRecordType {
|
|
672
|
+
constructor(itemType) {
|
|
673
|
+
__publicField(this, "kind", 11);
|
|
674
|
+
this.itemType = itemType;
|
|
675
|
+
}
|
|
676
|
+
get name() {
|
|
677
|
+
return `Record<string, ${this.itemType.name}>`;
|
|
678
|
+
}
|
|
679
|
+
}
|
|
669
680
|
class JayUnionType {
|
|
670
681
|
constructor(ofTypes) {
|
|
671
682
|
__publicField(this, "kind", 10);
|
|
@@ -680,7 +691,7 @@ class JayUnionType {
|
|
|
680
691
|
}
|
|
681
692
|
class JayPromiseType {
|
|
682
693
|
constructor(itemType) {
|
|
683
|
-
__publicField(this, "kind",
|
|
694
|
+
__publicField(this, "kind", 12);
|
|
684
695
|
this.itemType = itemType;
|
|
685
696
|
}
|
|
686
697
|
get name() {
|
|
@@ -689,7 +700,7 @@ class JayPromiseType {
|
|
|
689
700
|
}
|
|
690
701
|
class JayRecursiveType {
|
|
691
702
|
constructor(referencePath, resolvedType) {
|
|
692
|
-
__publicField(this, "kind",
|
|
703
|
+
__publicField(this, "kind", 13);
|
|
693
704
|
this.referencePath = referencePath;
|
|
694
705
|
this.resolvedType = resolvedType;
|
|
695
706
|
}
|
|
@@ -699,7 +710,7 @@ class JayRecursiveType {
|
|
|
699
710
|
}
|
|
700
711
|
class JayOptionalType {
|
|
701
712
|
constructor(innerType) {
|
|
702
|
-
__publicField(this, "kind",
|
|
713
|
+
__publicField(this, "kind", 14);
|
|
703
714
|
this.innerType = innerType;
|
|
704
715
|
}
|
|
705
716
|
get name() {
|
|
@@ -712,7 +723,7 @@ const JayErrorType = new JayObjectType("Error", {
|
|
|
712
723
|
stack: new JayAtomicType("string")
|
|
713
724
|
});
|
|
714
725
|
function isOptionalType(aType) {
|
|
715
|
-
return aType.kind ===
|
|
726
|
+
return aType.kind === 14;
|
|
716
727
|
}
|
|
717
728
|
function isAtomicType(aType) {
|
|
718
729
|
return aType.kind === 0;
|
|
@@ -744,14 +755,17 @@ function isObjectType(aType) {
|
|
|
744
755
|
function isArrayType(aType) {
|
|
745
756
|
return aType.kind === 9;
|
|
746
757
|
}
|
|
758
|
+
function isRecordType(aType) {
|
|
759
|
+
return aType.kind === 11;
|
|
760
|
+
}
|
|
747
761
|
function isUnionType(aType) {
|
|
748
762
|
return aType.kind === 10;
|
|
749
763
|
}
|
|
750
764
|
function isPromiseType(aType) {
|
|
751
|
-
return aType.kind ===
|
|
765
|
+
return aType.kind === 12;
|
|
752
766
|
}
|
|
753
767
|
function isRecursiveType(aType) {
|
|
754
|
-
return aType.kind ===
|
|
768
|
+
return aType.kind === 13;
|
|
755
769
|
}
|
|
756
770
|
function isCurrencyType(aType) {
|
|
757
771
|
return aType.kind === 0 && aType.name === "Currency";
|
|
@@ -771,6 +785,8 @@ function equalJayTypes(a, b) {
|
|
|
771
785
|
);
|
|
772
786
|
else if (a instanceof JayArrayType && b instanceof JayArrayType)
|
|
773
787
|
return equalJayTypes(a.itemType, b.itemType);
|
|
788
|
+
else if (a instanceof JayRecordType && b instanceof JayRecordType)
|
|
789
|
+
return equalJayTypes(a.itemType, b.itemType);
|
|
774
790
|
else if (a instanceof JayTypeAlias && b instanceof JayTypeAlias)
|
|
775
791
|
return true;
|
|
776
792
|
else if (a instanceof JayHTMLType && b instanceof JayHTMLType)
|
|
@@ -825,6 +841,13 @@ function jayTypeToJsonSchema(type) {
|
|
|
825
841
|
}
|
|
826
842
|
return { type: "array" };
|
|
827
843
|
}
|
|
844
|
+
if (isRecordType(type)) {
|
|
845
|
+
const valueSchema = jayTypeToJsonSchema(type.itemType);
|
|
846
|
+
if (valueSchema) {
|
|
847
|
+
return { type: "object", additionalProperties: valueSchema };
|
|
848
|
+
}
|
|
849
|
+
return { type: "object" };
|
|
850
|
+
}
|
|
828
851
|
if (isObjectType(type)) {
|
|
829
852
|
const properties = {};
|
|
830
853
|
const required = [];
|
|
@@ -1137,7 +1160,21 @@ var SourceFileFormat = /* @__PURE__ */ ((SourceFileFormat2) => {
|
|
|
1137
1160
|
return SourceFileFormat2;
|
|
1138
1161
|
})(SourceFileFormat || {});
|
|
1139
1162
|
function mergeRefsTrees(...trees) {
|
|
1140
|
-
const
|
|
1163
|
+
const refsByConstName = /* @__PURE__ */ new Map();
|
|
1164
|
+
const refsWithoutConstName = [];
|
|
1165
|
+
for (const tree of trees) {
|
|
1166
|
+
for (const ref of tree.refs) {
|
|
1167
|
+
if (ref.constName == null) {
|
|
1168
|
+
refsWithoutConstName.push(ref);
|
|
1169
|
+
} else {
|
|
1170
|
+
const existing = refsByConstName.get(ref.constName);
|
|
1171
|
+
if (!existing || !existing.repeated && ref.repeated) {
|
|
1172
|
+
refsByConstName.set(ref.constName, ref);
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
const allRefs = [...refsWithoutConstName, ...refsByConstName.values()];
|
|
1141
1178
|
const allChildren = {};
|
|
1142
1179
|
const allKeys = new Set(trees.flatMap((tree) => Object.keys(tree.children)));
|
|
1143
1180
|
for (const key of allKeys) {
|
|
@@ -1650,6 +1687,7 @@ export {
|
|
|
1650
1687
|
JayObjectType,
|
|
1651
1688
|
JayOptionalType,
|
|
1652
1689
|
JayPromiseType,
|
|
1690
|
+
JayRecordType,
|
|
1653
1691
|
JayRecursiveType,
|
|
1654
1692
|
JayString,
|
|
1655
1693
|
JayTypeAlias,
|
|
@@ -1701,6 +1739,7 @@ export {
|
|
|
1701
1739
|
isObjectType,
|
|
1702
1740
|
isOptionalType,
|
|
1703
1741
|
isPromiseType,
|
|
1742
|
+
isRecordType,
|
|
1704
1743
|
isRecursiveType,
|
|
1705
1744
|
isStaticCoordinate,
|
|
1706
1745
|
isTypeAliasType,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jay-framework/compiler-shared",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.6",
|
|
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.15.
|
|
29
|
-
"@jay-framework/runtime": "^0.15.
|
|
30
|
-
"@jay-framework/secure": "^0.15.
|
|
31
|
-
"@jay-framework/typescript-bridge": "^0.15.
|
|
28
|
+
"@jay-framework/component": "^0.15.6",
|
|
29
|
+
"@jay-framework/runtime": "^0.15.6",
|
|
30
|
+
"@jay-framework/secure": "^0.15.6",
|
|
31
|
+
"@jay-framework/typescript-bridge": "^0.15.6",
|
|
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.15.
|
|
44
|
+
"@jay-framework/dev-environment": "^0.15.6",
|
|
45
45
|
"@testing-library/jest-dom": "^6.2.0",
|
|
46
46
|
"@types/js-beautify": "^1",
|
|
47
47
|
"@types/node": "^20.11.5",
|