@jay-framework/compiler-shared 0.5.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/index.d.ts +317 -0
- package/dist/index.js +941 -0
- package/package.json +52 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
import * as prettier from 'prettier';
|
|
2
|
+
|
|
3
|
+
declare enum ImportsFor {
|
|
4
|
+
definition = 0,
|
|
5
|
+
implementation = 1,
|
|
6
|
+
elementSandbox = 2
|
|
7
|
+
}
|
|
8
|
+
interface ImportName {
|
|
9
|
+
index: number;
|
|
10
|
+
statement: string;
|
|
11
|
+
module: string;
|
|
12
|
+
usage: ImportsFor[];
|
|
13
|
+
}
|
|
14
|
+
declare const Import: {
|
|
15
|
+
jayElement: ImportName;
|
|
16
|
+
element: ImportName;
|
|
17
|
+
svgElement: ImportName;
|
|
18
|
+
mathMlElement: ImportName;
|
|
19
|
+
dynamicText: ImportName;
|
|
20
|
+
dynamicAttribute: ImportName;
|
|
21
|
+
booleanAttribute: ImportName;
|
|
22
|
+
dynamicProperty: ImportName;
|
|
23
|
+
RenderElement: ImportName;
|
|
24
|
+
ReferencesManager: ImportName;
|
|
25
|
+
SecureReferencesManager: ImportName;
|
|
26
|
+
conditional: ImportName;
|
|
27
|
+
dynamicElement: ImportName;
|
|
28
|
+
svgDynamicElement: ImportName;
|
|
29
|
+
mathMLDynamicElement: ImportName;
|
|
30
|
+
forEach: ImportName;
|
|
31
|
+
ConstructContext: ImportName;
|
|
32
|
+
HTMLElementCollectionProxy: ImportName;
|
|
33
|
+
HTMLElementProxy: ImportName;
|
|
34
|
+
childComp: ImportName;
|
|
35
|
+
elemRef: ImportName;
|
|
36
|
+
elemCollectionRef: ImportName;
|
|
37
|
+
compRef: ImportName;
|
|
38
|
+
compCollectionRef: ImportName;
|
|
39
|
+
RenderElementOptions: ImportName;
|
|
40
|
+
MapEventEmitterViewState: ImportName;
|
|
41
|
+
OnlyEventEmitters: ImportName;
|
|
42
|
+
ComponentCollectionProxy: ImportName;
|
|
43
|
+
sandboxElementBridge: ImportName;
|
|
44
|
+
sandboxRoot: ImportName;
|
|
45
|
+
sandboxElement: ImportName;
|
|
46
|
+
sandboxChildComp: ImportName;
|
|
47
|
+
sandboxElemRef: ImportName;
|
|
48
|
+
sandboxElemCollectionRef: ImportName;
|
|
49
|
+
sandboxCompRef: ImportName;
|
|
50
|
+
sandboxCompCollectionRef: ImportName;
|
|
51
|
+
sandboxForEach: ImportName;
|
|
52
|
+
handshakeMessageJayChannel: ImportName;
|
|
53
|
+
jayPort: ImportName;
|
|
54
|
+
setWorkerPort: ImportName;
|
|
55
|
+
secureMainRoot: ImportName;
|
|
56
|
+
secureChildComp: ImportName;
|
|
57
|
+
functionRepository: ImportName;
|
|
58
|
+
ReactElement: ImportName;
|
|
59
|
+
Jay4ReactElementProps: ImportName;
|
|
60
|
+
eventsFor: ImportName;
|
|
61
|
+
jay2React: ImportName;
|
|
62
|
+
mimicJayElement: ImportName;
|
|
63
|
+
jayContract: ImportName;
|
|
64
|
+
};
|
|
65
|
+
declare class Imports {
|
|
66
|
+
private readonly imports;
|
|
67
|
+
constructor(imports: Array<boolean>);
|
|
68
|
+
plus(addImport: ImportName | Imports): Imports;
|
|
69
|
+
has(anImport: ImportName): boolean;
|
|
70
|
+
render(importsFor: ImportsFor): string;
|
|
71
|
+
static none(): Imports;
|
|
72
|
+
static for(...imports: Array<ImportName>): Imports;
|
|
73
|
+
static merge(imports1: Imports, imports2: Imports): Imports;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
declare const JAY_EXTENSION = ".jay-html";
|
|
77
|
+
declare const JAY_CONTRACT_EXTENSION = ".jay-contract";
|
|
78
|
+
declare const JAY_TS_EXTENSION = ".jay-html.ts";
|
|
79
|
+
declare const JAY_DTS_EXTENSION = ".jay-html.d.ts";
|
|
80
|
+
declare const JAY_CONTRACT_DTS_EXTENSION = ".jay-contract.d.ts";
|
|
81
|
+
declare const JAY_COMPONENT = "@jay-framework/component";
|
|
82
|
+
declare const JAY_SECURE = "@jay-framework/secure";
|
|
83
|
+
declare const JAY_RUNTIME = "@jay-framework/runtime";
|
|
84
|
+
declare const JAY_4_REACT = "@jay-framework/4-react";
|
|
85
|
+
declare const JAY_FULLSTACK_COMPONENTS = "@jay-framework/fullstack-component";
|
|
86
|
+
declare const REACT = "react";
|
|
87
|
+
declare const MAKE_JAY_COMPONENT = "makeJayComponent";
|
|
88
|
+
declare const MAKE_JAY_TSX_COMPONENT = "makeJayTsxComponent";
|
|
89
|
+
declare const MAKE_JAY_4_REACT_COMPONENT = "jay4react";
|
|
90
|
+
|
|
91
|
+
declare enum JayTypeKind {
|
|
92
|
+
atomic = 0,
|
|
93
|
+
typeAlias = 1,
|
|
94
|
+
enum = 2,
|
|
95
|
+
html = 3,
|
|
96
|
+
imported = 4,
|
|
97
|
+
element = 5,
|
|
98
|
+
elementConstructor = 6,
|
|
99
|
+
component = 7,
|
|
100
|
+
object = 8,
|
|
101
|
+
array = 9,
|
|
102
|
+
union = 10
|
|
103
|
+
}
|
|
104
|
+
interface JayType {
|
|
105
|
+
name: string;
|
|
106
|
+
readonly kind: JayTypeKind;
|
|
107
|
+
}
|
|
108
|
+
declare class JayAtomicType implements JayType {
|
|
109
|
+
readonly name: string;
|
|
110
|
+
constructor(name: string);
|
|
111
|
+
readonly kind = JayTypeKind.atomic;
|
|
112
|
+
}
|
|
113
|
+
declare const JayString: JayAtomicType;
|
|
114
|
+
declare const JayNumber: JayAtomicType;
|
|
115
|
+
declare const JayBoolean: JayAtomicType;
|
|
116
|
+
declare const JayDate: JayAtomicType;
|
|
117
|
+
declare const JayUnknown: JayAtomicType;
|
|
118
|
+
declare function resolvePrimitiveType(typeName: string): JayType;
|
|
119
|
+
declare class JayTypeAlias implements JayType {
|
|
120
|
+
readonly name: string;
|
|
121
|
+
constructor(name: string);
|
|
122
|
+
readonly kind = JayTypeKind.typeAlias;
|
|
123
|
+
}
|
|
124
|
+
declare class JayEnumType implements JayType {
|
|
125
|
+
readonly name: string;
|
|
126
|
+
readonly values: Array<string>;
|
|
127
|
+
constructor(name: string, values: Array<string>);
|
|
128
|
+
readonly kind = JayTypeKind.enum;
|
|
129
|
+
}
|
|
130
|
+
declare class JayHTMLType implements JayType {
|
|
131
|
+
readonly name: string;
|
|
132
|
+
constructor(name: string);
|
|
133
|
+
readonly kind = JayTypeKind.html;
|
|
134
|
+
}
|
|
135
|
+
declare class JayImportedType implements JayType {
|
|
136
|
+
readonly name: string;
|
|
137
|
+
readonly type: JayType;
|
|
138
|
+
constructor(name: string, type: JayType);
|
|
139
|
+
readonly kind = JayTypeKind.imported;
|
|
140
|
+
}
|
|
141
|
+
declare class JayElementType implements JayType {
|
|
142
|
+
readonly name: string;
|
|
143
|
+
constructor(name: string);
|
|
144
|
+
readonly kind = JayTypeKind.element;
|
|
145
|
+
}
|
|
146
|
+
declare class JayElementConstructorType implements JayType {
|
|
147
|
+
readonly name: string;
|
|
148
|
+
readonly typeName: string;
|
|
149
|
+
constructor(name: string, typeName: string);
|
|
150
|
+
readonly kind = JayTypeKind.elementConstructor;
|
|
151
|
+
}
|
|
152
|
+
declare class JayComponentApiMember {
|
|
153
|
+
readonly property: string;
|
|
154
|
+
readonly isEvent: boolean;
|
|
155
|
+
constructor(property: string, isEvent: boolean);
|
|
156
|
+
}
|
|
157
|
+
declare class JayComponentType implements JayType {
|
|
158
|
+
readonly name: string;
|
|
159
|
+
readonly api: Array<JayComponentApiMember>;
|
|
160
|
+
constructor(name: string, api: Array<JayComponentApiMember>);
|
|
161
|
+
readonly kind = JayTypeKind.component;
|
|
162
|
+
}
|
|
163
|
+
declare class JayObjectType implements JayType {
|
|
164
|
+
readonly name: string;
|
|
165
|
+
readonly props: {
|
|
166
|
+
[key: string]: JayType;
|
|
167
|
+
};
|
|
168
|
+
constructor(name: string, props: {
|
|
169
|
+
[key: string]: JayType;
|
|
170
|
+
});
|
|
171
|
+
readonly kind = JayTypeKind.object;
|
|
172
|
+
}
|
|
173
|
+
declare class JayArrayType implements JayType {
|
|
174
|
+
readonly itemType: JayType;
|
|
175
|
+
constructor(itemType: JayType);
|
|
176
|
+
get name(): string;
|
|
177
|
+
readonly kind = JayTypeKind.array;
|
|
178
|
+
}
|
|
179
|
+
declare class JayUnionType implements JayType {
|
|
180
|
+
readonly ofTypes: JayType[];
|
|
181
|
+
constructor(ofTypes: JayType[]);
|
|
182
|
+
readonly kind = JayTypeKind.union;
|
|
183
|
+
get name(): string;
|
|
184
|
+
hasType(aType: JayType): any;
|
|
185
|
+
}
|
|
186
|
+
declare function isAtomicType(aType: JayType): aType is JayAtomicType;
|
|
187
|
+
declare function isTypeAliasType(aType: JayType): aType is JayTypeAlias;
|
|
188
|
+
declare function isEnumType(aType: JayType): aType is JayEnumType;
|
|
189
|
+
declare function isHTMLType(aType: JayType): aType is JayHTMLType;
|
|
190
|
+
declare function isImportedType(aType: JayType): aType is JayImportedType;
|
|
191
|
+
declare function isElementConstructorType(aType: JayType): aType is JayElementConstructorType;
|
|
192
|
+
declare function isElementType(aType: JayType): aType is JayElementType;
|
|
193
|
+
declare function isComponentType(aType: JayType): aType is JayComponentType;
|
|
194
|
+
declare function isObjectType(aType: JayType): aType is JayObjectType;
|
|
195
|
+
declare function isArrayType(aType: JayType): aType is JayArrayType;
|
|
196
|
+
declare function isUnionType(aType: JayType): aType is JayUnionType;
|
|
197
|
+
declare function equalJayTypes(a: JayType, b: JayType): any;
|
|
198
|
+
|
|
199
|
+
interface JayImportName {
|
|
200
|
+
name: string;
|
|
201
|
+
as?: string;
|
|
202
|
+
type: JayType;
|
|
203
|
+
}
|
|
204
|
+
interface JayImportLink {
|
|
205
|
+
module: string;
|
|
206
|
+
names: JayImportName[];
|
|
207
|
+
sandbox?: boolean;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
declare enum RuntimeMode {
|
|
211
|
+
MainTrusted = "mainTrusted",
|
|
212
|
+
MainSandbox = "mainSandbox",
|
|
213
|
+
WorkerTrusted = "workerTrusted",
|
|
214
|
+
WorkerSandbox = "workerSandbox"
|
|
215
|
+
}
|
|
216
|
+
type MainRuntimeModes = RuntimeMode.MainSandbox | RuntimeMode.MainTrusted;
|
|
217
|
+
declare const TS_EXTENSION = ".ts";
|
|
218
|
+
declare const TSX_EXTENSION = ".tsx";
|
|
219
|
+
declare const JAY_QUERY_PREFIX = "?jay-";
|
|
220
|
+
declare const JAY_QUERY_MAIN_SANDBOX = "?jay-mainSandbox";
|
|
221
|
+
declare const JAY_QUERY_WORKER_TRUSTED = "?jay-workerTrusted";
|
|
222
|
+
declare const JAY_QUERY_WORKER_SANDBOX = "?jay-workerSandbox";
|
|
223
|
+
declare const JAY_QUERY_MAIN_SANDBOX_TS = "?jay-mainSandbox.ts";
|
|
224
|
+
declare const JAY_QUERY_WORKER_TRUSTED_TS = "?jay-workerTrusted.ts";
|
|
225
|
+
declare const JAY_QUERY_WORKER_SANDBOX_TS = "?jay-workerSandbox.ts";
|
|
226
|
+
declare function hasExtension(filename: string, extension: string, { withTs }?: {
|
|
227
|
+
withTs?: boolean;
|
|
228
|
+
}): boolean;
|
|
229
|
+
declare function hasJayModeExtension(filename: string, { withTs }?: {
|
|
230
|
+
withTs?: boolean;
|
|
231
|
+
}): boolean;
|
|
232
|
+
declare function getModeFileExtension(isSandbox: boolean, importerMode: RuntimeMode, { withTs }?: {
|
|
233
|
+
withTs?: boolean;
|
|
234
|
+
}): string;
|
|
235
|
+
declare function getMode(isSandbox: boolean, importerMode: RuntimeMode): RuntimeMode;
|
|
236
|
+
declare function getModeFromExtension(filename: string): RuntimeMode;
|
|
237
|
+
declare function getJayTsFileSourcePath(filename: string): string;
|
|
238
|
+
declare function withoutExtension(filename: string, extension: string): string;
|
|
239
|
+
|
|
240
|
+
type JayValidations = Array<string>;
|
|
241
|
+
declare class WithValidations<Value> {
|
|
242
|
+
val?: Value;
|
|
243
|
+
validations: JayValidations;
|
|
244
|
+
constructor(val: Value | undefined, validations?: JayValidations);
|
|
245
|
+
map<R>(func: (v: Value) => R): WithValidations<R>;
|
|
246
|
+
mapAsync<R>(func: (v: Value) => Promise<R>): Promise<WithValidations<R>>;
|
|
247
|
+
flatMap<R>(func: (v: Value) => WithValidations<R>): WithValidations<R>;
|
|
248
|
+
flatMapAsync<R>(func: (v: Value) => Promise<WithValidations<R>>): Promise<WithValidations<R>>;
|
|
249
|
+
merge(other: WithValidations<Value>, merge: (t1: Value, t2: Value) => Value): WithValidations<Value>;
|
|
250
|
+
}
|
|
251
|
+
declare function checkValidationErrors<T>(withValidations: WithValidations<T>): T;
|
|
252
|
+
|
|
253
|
+
declare enum SourceFileFormat {
|
|
254
|
+
JayHtml = "jay-html",
|
|
255
|
+
JayTsx = "jay-tsx",
|
|
256
|
+
JayContract = "jay-contract",
|
|
257
|
+
TypeScript = "typeScript"
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
interface ImportedRefsTree {
|
|
261
|
+
readonly refsTypeName: string;
|
|
262
|
+
readonly repeatedRefsTypeName: string;
|
|
263
|
+
}
|
|
264
|
+
interface RefsTree {
|
|
265
|
+
readonly kind: 'refTree';
|
|
266
|
+
readonly refs: Ref[];
|
|
267
|
+
readonly children: Record<string, RefsTree>;
|
|
268
|
+
readonly imported?: ImportedRefsTree;
|
|
269
|
+
readonly repeated: boolean;
|
|
270
|
+
}
|
|
271
|
+
declare function mergeRefsTrees(...trees: RefsTree[]): RefsTree;
|
|
272
|
+
declare function hasRefs(refs: RefsTree, includingAutoRefs: boolean): any;
|
|
273
|
+
declare function nestRefs(path: string[], renderFragment: RenderFragment): RenderFragment;
|
|
274
|
+
declare function mkRefsTree(refs: Ref[], children: Record<string, RefsTree>, repeated?: boolean, refsTypeName?: string, repeatedRefsTypeName?: string): RefsTree;
|
|
275
|
+
interface Ref {
|
|
276
|
+
readonly kind: 'ref';
|
|
277
|
+
originalName: string;
|
|
278
|
+
ref: string;
|
|
279
|
+
constName: string;
|
|
280
|
+
repeated: boolean;
|
|
281
|
+
autoRef: boolean;
|
|
282
|
+
viewStateType: JayType;
|
|
283
|
+
elementType: JayType;
|
|
284
|
+
}
|
|
285
|
+
declare function mkRef(ref: string, originalName: string, constName: string, repeated: boolean, autoRef: boolean, viewStateType: JayType, elementType: JayType): Ref;
|
|
286
|
+
declare class RenderFragment {
|
|
287
|
+
rendered: string;
|
|
288
|
+
imports: Imports;
|
|
289
|
+
validations: JayValidations;
|
|
290
|
+
refs: RefsTree;
|
|
291
|
+
constructor(rendered: string, imports?: Imports, validations?: JayValidations, refs?: RefsTree);
|
|
292
|
+
map(f: (s: string) => string): RenderFragment;
|
|
293
|
+
plusImport(imp: Imports): RenderFragment;
|
|
294
|
+
static empty(): RenderFragment;
|
|
295
|
+
static merge(fragment1: RenderFragment, fragment2: RenderFragment, combinator?: string): RenderFragment;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
interface CompilerSourceFile {
|
|
299
|
+
format: SourceFileFormat;
|
|
300
|
+
imports: JayImportLink[];
|
|
301
|
+
}
|
|
302
|
+
interface GenericTypescriptSourceFile extends CompilerSourceFile {
|
|
303
|
+
format: SourceFileFormat.TypeScript;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
declare enum GenerateTarget {
|
|
307
|
+
jay = 0,
|
|
308
|
+
react = 1
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
declare function withOriginalTrace<T extends Error>(error: T, originalError: Error): T;
|
|
312
|
+
|
|
313
|
+
declare function prettify(code: string, options?: prettier.Options): Promise<string>;
|
|
314
|
+
declare function prettifyHtml(html: string): string;
|
|
315
|
+
declare function removeComments(code: string): string;
|
|
316
|
+
|
|
317
|
+
export { type CompilerSourceFile, GenerateTarget, type GenericTypescriptSourceFile, Import, type ImportName, type ImportedRefsTree, Imports, ImportsFor, JAY_4_REACT, JAY_COMPONENT, JAY_CONTRACT_DTS_EXTENSION, JAY_CONTRACT_EXTENSION, JAY_DTS_EXTENSION, JAY_EXTENSION, JAY_FULLSTACK_COMPONENTS, JAY_QUERY_MAIN_SANDBOX, JAY_QUERY_MAIN_SANDBOX_TS, JAY_QUERY_PREFIX, JAY_QUERY_WORKER_SANDBOX, JAY_QUERY_WORKER_SANDBOX_TS, JAY_QUERY_WORKER_TRUSTED, JAY_QUERY_WORKER_TRUSTED_TS, JAY_RUNTIME, JAY_SECURE, JAY_TS_EXTENSION, JayArrayType, JayAtomicType, JayBoolean, JayComponentApiMember, JayComponentType, JayDate, JayElementConstructorType, JayElementType, JayEnumType, JayHTMLType, type JayImportLink, type JayImportName, JayImportedType, JayNumber, JayObjectType, JayString, type JayType, JayTypeAlias, JayTypeKind, JayUnionType, JayUnknown, type JayValidations, MAKE_JAY_4_REACT_COMPONENT, MAKE_JAY_COMPONENT, MAKE_JAY_TSX_COMPONENT, type MainRuntimeModes, REACT, type Ref, type RefsTree, RenderFragment, RuntimeMode, SourceFileFormat, TSX_EXTENSION, TS_EXTENSION, WithValidations, checkValidationErrors, equalJayTypes, getJayTsFileSourcePath, getMode, getModeFileExtension, getModeFromExtension, hasExtension, hasJayModeExtension, hasRefs, isArrayType, isAtomicType, isComponentType, isElementConstructorType, isElementType, isEnumType, isHTMLType, isImportedType, isObjectType, isTypeAliasType, isUnionType, mergeRefsTrees, mkRef, mkRefsTree, nestRefs, prettify, prettifyHtml, removeComments, resolvePrimitiveType, withOriginalTrace, withoutExtension };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,941 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
|
+
var __publicField = (obj, key, value) => {
|
|
5
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
6
|
+
return value;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
9
|
+
const prettier = require("prettier");
|
|
10
|
+
const jsBeautify = require("js-beautify");
|
|
11
|
+
function _interopNamespaceDefault(e) {
|
|
12
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
13
|
+
if (e) {
|
|
14
|
+
for (const k in e) {
|
|
15
|
+
if (k !== "default") {
|
|
16
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
17
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: () => e[k]
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
n.default = e;
|
|
25
|
+
return Object.freeze(n);
|
|
26
|
+
}
|
|
27
|
+
const prettier__namespace = /* @__PURE__ */ _interopNamespaceDefault(prettier);
|
|
28
|
+
const JAY_EXTENSION = ".jay-html";
|
|
29
|
+
const JAY_CONTRACT_EXTENSION = ".jay-contract";
|
|
30
|
+
const JAY_TS_EXTENSION = ".jay-html.ts";
|
|
31
|
+
const JAY_DTS_EXTENSION = ".jay-html.d.ts";
|
|
32
|
+
const JAY_CONTRACT_DTS_EXTENSION = ".jay-contract.d.ts";
|
|
33
|
+
const JAY_COMPONENT = "@jay-framework/component";
|
|
34
|
+
const JAY_SECURE = "@jay-framework/secure";
|
|
35
|
+
const JAY_RUNTIME = "@jay-framework/runtime";
|
|
36
|
+
const JAY_4_REACT = "@jay-framework/4-react";
|
|
37
|
+
const JAY_FULLSTACK_COMPONENTS = "@jay-framework/fullstack-component";
|
|
38
|
+
const REACT = "react";
|
|
39
|
+
const MAKE_JAY_COMPONENT = "makeJayComponent";
|
|
40
|
+
const MAKE_JAY_TSX_COMPONENT = "makeJayTsxComponent";
|
|
41
|
+
const MAKE_JAY_4_REACT_COMPONENT = "jay4react";
|
|
42
|
+
var ImportsFor = /* @__PURE__ */ ((ImportsFor2) => {
|
|
43
|
+
ImportsFor2[ImportsFor2["definition"] = 0] = "definition";
|
|
44
|
+
ImportsFor2[ImportsFor2["implementation"] = 1] = "implementation";
|
|
45
|
+
ImportsFor2[ImportsFor2["elementSandbox"] = 2] = "elementSandbox";
|
|
46
|
+
return ImportsFor2;
|
|
47
|
+
})(ImportsFor || {});
|
|
48
|
+
let nextKey = 0;
|
|
49
|
+
function importStatementFragment(module2, statement, ...usage) {
|
|
50
|
+
return { module: module2, index: nextKey++, statement, usage };
|
|
51
|
+
}
|
|
52
|
+
const importsOrder = {
|
|
53
|
+
JAY_RUNTIME: 1,
|
|
54
|
+
JAY_SECURE: 2,
|
|
55
|
+
REACT: 3,
|
|
56
|
+
JAY_4_REACT: 4
|
|
57
|
+
};
|
|
58
|
+
const Import = {
|
|
59
|
+
jayElement: importStatementFragment(
|
|
60
|
+
JAY_RUNTIME,
|
|
61
|
+
"JayElement",
|
|
62
|
+
0,
|
|
63
|
+
1,
|
|
64
|
+
2
|
|
65
|
+
/* elementSandbox */
|
|
66
|
+
),
|
|
67
|
+
element: importStatementFragment(
|
|
68
|
+
JAY_RUNTIME,
|
|
69
|
+
"element as e",
|
|
70
|
+
1
|
|
71
|
+
/* implementation */
|
|
72
|
+
),
|
|
73
|
+
svgElement: importStatementFragment(
|
|
74
|
+
JAY_RUNTIME,
|
|
75
|
+
"svgElement as svg",
|
|
76
|
+
1
|
|
77
|
+
/* implementation */
|
|
78
|
+
),
|
|
79
|
+
mathMlElement: importStatementFragment(
|
|
80
|
+
JAY_RUNTIME,
|
|
81
|
+
"mathMLElement as ml",
|
|
82
|
+
1
|
|
83
|
+
/* implementation */
|
|
84
|
+
),
|
|
85
|
+
dynamicText: importStatementFragment(
|
|
86
|
+
JAY_RUNTIME,
|
|
87
|
+
"dynamicText as dt",
|
|
88
|
+
1
|
|
89
|
+
/* implementation */
|
|
90
|
+
),
|
|
91
|
+
dynamicAttribute: importStatementFragment(
|
|
92
|
+
JAY_RUNTIME,
|
|
93
|
+
"dynamicAttribute as da",
|
|
94
|
+
1
|
|
95
|
+
/* implementation */
|
|
96
|
+
),
|
|
97
|
+
booleanAttribute: importStatementFragment(
|
|
98
|
+
JAY_RUNTIME,
|
|
99
|
+
"booleanAttribute as ba",
|
|
100
|
+
1
|
|
101
|
+
/* implementation */
|
|
102
|
+
),
|
|
103
|
+
dynamicProperty: importStatementFragment(
|
|
104
|
+
JAY_RUNTIME,
|
|
105
|
+
"dynamicProperty as dp",
|
|
106
|
+
1
|
|
107
|
+
/* implementation */
|
|
108
|
+
),
|
|
109
|
+
RenderElement: importStatementFragment(
|
|
110
|
+
JAY_RUNTIME,
|
|
111
|
+
"RenderElement",
|
|
112
|
+
1,
|
|
113
|
+
0,
|
|
114
|
+
2
|
|
115
|
+
/* elementSandbox */
|
|
116
|
+
),
|
|
117
|
+
ReferencesManager: importStatementFragment(
|
|
118
|
+
JAY_RUNTIME,
|
|
119
|
+
"ReferencesManager",
|
|
120
|
+
1
|
|
121
|
+
/* implementation */
|
|
122
|
+
),
|
|
123
|
+
SecureReferencesManager: importStatementFragment(
|
|
124
|
+
JAY_SECURE,
|
|
125
|
+
"SecureReferencesManager",
|
|
126
|
+
2
|
|
127
|
+
/* elementSandbox */
|
|
128
|
+
),
|
|
129
|
+
conditional: importStatementFragment(
|
|
130
|
+
JAY_RUNTIME,
|
|
131
|
+
"conditional as c",
|
|
132
|
+
1
|
|
133
|
+
/* implementation */
|
|
134
|
+
),
|
|
135
|
+
dynamicElement: importStatementFragment(
|
|
136
|
+
JAY_RUNTIME,
|
|
137
|
+
"dynamicElement as de",
|
|
138
|
+
1
|
|
139
|
+
/* implementation */
|
|
140
|
+
),
|
|
141
|
+
svgDynamicElement: importStatementFragment(
|
|
142
|
+
JAY_RUNTIME,
|
|
143
|
+
"svgDynamicElement as dsvg",
|
|
144
|
+
1
|
|
145
|
+
/* implementation */
|
|
146
|
+
),
|
|
147
|
+
mathMLDynamicElement: importStatementFragment(
|
|
148
|
+
JAY_RUNTIME,
|
|
149
|
+
"mathMLDynamicElement as dml",
|
|
150
|
+
1
|
|
151
|
+
/* implementation */
|
|
152
|
+
),
|
|
153
|
+
forEach: importStatementFragment(
|
|
154
|
+
JAY_RUNTIME,
|
|
155
|
+
"forEach",
|
|
156
|
+
1
|
|
157
|
+
/* implementation */
|
|
158
|
+
),
|
|
159
|
+
ConstructContext: importStatementFragment(
|
|
160
|
+
JAY_RUNTIME,
|
|
161
|
+
"ConstructContext",
|
|
162
|
+
1
|
|
163
|
+
/* implementation */
|
|
164
|
+
),
|
|
165
|
+
HTMLElementCollectionProxy: importStatementFragment(
|
|
166
|
+
JAY_RUNTIME,
|
|
167
|
+
"HTMLElementCollectionProxy",
|
|
168
|
+
0,
|
|
169
|
+
1,
|
|
170
|
+
2
|
|
171
|
+
/* elementSandbox */
|
|
172
|
+
),
|
|
173
|
+
HTMLElementProxy: importStatementFragment(
|
|
174
|
+
JAY_RUNTIME,
|
|
175
|
+
"HTMLElementProxy",
|
|
176
|
+
0,
|
|
177
|
+
1,
|
|
178
|
+
2
|
|
179
|
+
/* elementSandbox */
|
|
180
|
+
),
|
|
181
|
+
childComp: importStatementFragment(
|
|
182
|
+
JAY_RUNTIME,
|
|
183
|
+
"childComp",
|
|
184
|
+
1
|
|
185
|
+
/* implementation */
|
|
186
|
+
),
|
|
187
|
+
elemRef: importStatementFragment(
|
|
188
|
+
JAY_RUNTIME,
|
|
189
|
+
"elemRef as er",
|
|
190
|
+
1
|
|
191
|
+
/* implementation */
|
|
192
|
+
),
|
|
193
|
+
elemCollectionRef: importStatementFragment(
|
|
194
|
+
JAY_RUNTIME,
|
|
195
|
+
"elemCollectionRef as ecr",
|
|
196
|
+
1
|
|
197
|
+
/* implementation */
|
|
198
|
+
),
|
|
199
|
+
compRef: importStatementFragment(
|
|
200
|
+
JAY_RUNTIME,
|
|
201
|
+
"compRef as cr",
|
|
202
|
+
1
|
|
203
|
+
/* implementation */
|
|
204
|
+
),
|
|
205
|
+
compCollectionRef: importStatementFragment(
|
|
206
|
+
JAY_RUNTIME,
|
|
207
|
+
"compCollectionRef as ccr",
|
|
208
|
+
1
|
|
209
|
+
/* implementation */
|
|
210
|
+
),
|
|
211
|
+
RenderElementOptions: importStatementFragment(
|
|
212
|
+
JAY_RUNTIME,
|
|
213
|
+
"RenderElementOptions",
|
|
214
|
+
1,
|
|
215
|
+
0
|
|
216
|
+
/* definition */
|
|
217
|
+
),
|
|
218
|
+
MapEventEmitterViewState: importStatementFragment(
|
|
219
|
+
JAY_RUNTIME,
|
|
220
|
+
"MapEventEmitterViewState",
|
|
221
|
+
1,
|
|
222
|
+
0,
|
|
223
|
+
2
|
|
224
|
+
/* elementSandbox */
|
|
225
|
+
),
|
|
226
|
+
OnlyEventEmitters: importStatementFragment(
|
|
227
|
+
JAY_RUNTIME,
|
|
228
|
+
"OnlyEventEmitters",
|
|
229
|
+
1,
|
|
230
|
+
0,
|
|
231
|
+
2
|
|
232
|
+
/* elementSandbox */
|
|
233
|
+
),
|
|
234
|
+
ComponentCollectionProxy: importStatementFragment(
|
|
235
|
+
JAY_RUNTIME,
|
|
236
|
+
"ComponentCollectionProxy",
|
|
237
|
+
1,
|
|
238
|
+
0,
|
|
239
|
+
2
|
|
240
|
+
/* elementSandbox */
|
|
241
|
+
),
|
|
242
|
+
sandboxElementBridge: importStatementFragment(
|
|
243
|
+
JAY_SECURE,
|
|
244
|
+
"elementBridge",
|
|
245
|
+
2
|
|
246
|
+
/* elementSandbox */
|
|
247
|
+
),
|
|
248
|
+
sandboxRoot: importStatementFragment(
|
|
249
|
+
JAY_SECURE,
|
|
250
|
+
"sandboxRoot",
|
|
251
|
+
2
|
|
252
|
+
/* elementSandbox */
|
|
253
|
+
),
|
|
254
|
+
sandboxElement: importStatementFragment(
|
|
255
|
+
JAY_SECURE,
|
|
256
|
+
"sandboxElement as e",
|
|
257
|
+
2
|
|
258
|
+
/* elementSandbox */
|
|
259
|
+
),
|
|
260
|
+
sandboxChildComp: importStatementFragment(
|
|
261
|
+
JAY_SECURE,
|
|
262
|
+
"sandboxChildComp as childComp",
|
|
263
|
+
2
|
|
264
|
+
/* elementSandbox */
|
|
265
|
+
),
|
|
266
|
+
sandboxElemRef: importStatementFragment(
|
|
267
|
+
JAY_SECURE,
|
|
268
|
+
"elemRef as er",
|
|
269
|
+
2
|
|
270
|
+
/* elementSandbox */
|
|
271
|
+
),
|
|
272
|
+
sandboxElemCollectionRef: importStatementFragment(
|
|
273
|
+
JAY_SECURE,
|
|
274
|
+
"elemCollectionRef as ecr",
|
|
275
|
+
2
|
|
276
|
+
/* elementSandbox */
|
|
277
|
+
),
|
|
278
|
+
sandboxCompRef: importStatementFragment(
|
|
279
|
+
JAY_SECURE,
|
|
280
|
+
"compRef as cr",
|
|
281
|
+
2
|
|
282
|
+
/* elementSandbox */
|
|
283
|
+
),
|
|
284
|
+
sandboxCompCollectionRef: importStatementFragment(
|
|
285
|
+
JAY_SECURE,
|
|
286
|
+
"compCollectionRef as ccr",
|
|
287
|
+
2
|
|
288
|
+
/* elementSandbox */
|
|
289
|
+
),
|
|
290
|
+
sandboxForEach: importStatementFragment(
|
|
291
|
+
JAY_SECURE,
|
|
292
|
+
"sandboxForEach as forEach",
|
|
293
|
+
2
|
|
294
|
+
/* elementSandbox */
|
|
295
|
+
),
|
|
296
|
+
handshakeMessageJayChannel: importStatementFragment(
|
|
297
|
+
JAY_SECURE,
|
|
298
|
+
"HandshakeMessageJayChannel",
|
|
299
|
+
2
|
|
300
|
+
/* elementSandbox */
|
|
301
|
+
),
|
|
302
|
+
jayPort: importStatementFragment(
|
|
303
|
+
JAY_SECURE,
|
|
304
|
+
"JayPort",
|
|
305
|
+
2
|
|
306
|
+
/* elementSandbox */
|
|
307
|
+
),
|
|
308
|
+
setWorkerPort: importStatementFragment(
|
|
309
|
+
JAY_SECURE,
|
|
310
|
+
"setWorkerPort",
|
|
311
|
+
2
|
|
312
|
+
/* elementSandbox */
|
|
313
|
+
),
|
|
314
|
+
secureMainRoot: importStatementFragment(
|
|
315
|
+
JAY_SECURE,
|
|
316
|
+
"mainRoot as mr",
|
|
317
|
+
1
|
|
318
|
+
/* implementation */
|
|
319
|
+
),
|
|
320
|
+
secureChildComp: importStatementFragment(
|
|
321
|
+
JAY_SECURE,
|
|
322
|
+
"secureChildComp",
|
|
323
|
+
1
|
|
324
|
+
/* implementation */
|
|
325
|
+
),
|
|
326
|
+
functionRepository: importStatementFragment(
|
|
327
|
+
"./function-repository",
|
|
328
|
+
"funcRepository",
|
|
329
|
+
1
|
|
330
|
+
/* implementation */
|
|
331
|
+
),
|
|
332
|
+
ReactElement: importStatementFragment(
|
|
333
|
+
`react`,
|
|
334
|
+
"ReactElement",
|
|
335
|
+
1,
|
|
336
|
+
0
|
|
337
|
+
/* definition */
|
|
338
|
+
),
|
|
339
|
+
Jay4ReactElementProps: importStatementFragment(
|
|
340
|
+
JAY_4_REACT,
|
|
341
|
+
"Jay4ReactElementProps",
|
|
342
|
+
1,
|
|
343
|
+
0
|
|
344
|
+
/* definition */
|
|
345
|
+
),
|
|
346
|
+
eventsFor: importStatementFragment(
|
|
347
|
+
JAY_4_REACT,
|
|
348
|
+
"eventsFor",
|
|
349
|
+
1,
|
|
350
|
+
0
|
|
351
|
+
/* definition */
|
|
352
|
+
),
|
|
353
|
+
jay2React: importStatementFragment(
|
|
354
|
+
JAY_4_REACT,
|
|
355
|
+
"jay2React",
|
|
356
|
+
1,
|
|
357
|
+
0
|
|
358
|
+
/* definition */
|
|
359
|
+
),
|
|
360
|
+
mimicJayElement: importStatementFragment(
|
|
361
|
+
JAY_4_REACT,
|
|
362
|
+
"mimicJayElement",
|
|
363
|
+
1,
|
|
364
|
+
0
|
|
365
|
+
/* definition */
|
|
366
|
+
),
|
|
367
|
+
jayContract: importStatementFragment(
|
|
368
|
+
JAY_RUNTIME,
|
|
369
|
+
"JayContract",
|
|
370
|
+
1,
|
|
371
|
+
0,
|
|
372
|
+
2
|
|
373
|
+
/* elementSandbox */
|
|
374
|
+
)
|
|
375
|
+
};
|
|
376
|
+
class Imports {
|
|
377
|
+
constructor(imports) {
|
|
378
|
+
this.imports = imports;
|
|
379
|
+
}
|
|
380
|
+
plus(addImport) {
|
|
381
|
+
if (addImport instanceof Imports) {
|
|
382
|
+
return Imports.merge(this, addImport);
|
|
383
|
+
} else {
|
|
384
|
+
let newImports = [...this.imports];
|
|
385
|
+
newImports[addImport.index] = true;
|
|
386
|
+
return new Imports(newImports);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
has(anImport) {
|
|
390
|
+
return !!this.imports[anImport.index];
|
|
391
|
+
}
|
|
392
|
+
render(importsFor) {
|
|
393
|
+
let moduleImportStatements = /* @__PURE__ */ new Map();
|
|
394
|
+
for (let importKey in Import) {
|
|
395
|
+
let importName = Import[importKey];
|
|
396
|
+
if (this.imports[importName.index] && importName.usage.includes(importsFor)) {
|
|
397
|
+
if (moduleImportStatements.has(importName.module))
|
|
398
|
+
moduleImportStatements.get(importName.module).push(importName.statement);
|
|
399
|
+
else
|
|
400
|
+
moduleImportStatements.set(importName.module, [importName.statement]);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
const modulesToImport = [...moduleImportStatements.keys()].sort(
|
|
404
|
+
(a, b) => (importsOrder[a] || 999) - (importsOrder[b] || 999)
|
|
405
|
+
);
|
|
406
|
+
return modulesToImport.map(
|
|
407
|
+
(module2) => `import {${moduleImportStatements.get(module2).join(", ")}} from "${module2}";`
|
|
408
|
+
).join("\n");
|
|
409
|
+
}
|
|
410
|
+
static none() {
|
|
411
|
+
return new Imports([]);
|
|
412
|
+
}
|
|
413
|
+
static for(...imports) {
|
|
414
|
+
let newImports = Imports.none();
|
|
415
|
+
imports.forEach((anImport) => newImports = newImports.plus(anImport));
|
|
416
|
+
return newImports;
|
|
417
|
+
}
|
|
418
|
+
static merge(imports1, imports2) {
|
|
419
|
+
let merged = [];
|
|
420
|
+
for (let i = 0; i < Math.max(imports1.imports.length, imports2.imports.length); i++)
|
|
421
|
+
merged[i] = imports1.imports[i] || imports2.imports[i];
|
|
422
|
+
return new Imports(merged);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
var JayTypeKind = /* @__PURE__ */ ((JayTypeKind2) => {
|
|
426
|
+
JayTypeKind2[JayTypeKind2["atomic"] = 0] = "atomic";
|
|
427
|
+
JayTypeKind2[JayTypeKind2["typeAlias"] = 1] = "typeAlias";
|
|
428
|
+
JayTypeKind2[JayTypeKind2["enum"] = 2] = "enum";
|
|
429
|
+
JayTypeKind2[JayTypeKind2["html"] = 3] = "html";
|
|
430
|
+
JayTypeKind2[JayTypeKind2["imported"] = 4] = "imported";
|
|
431
|
+
JayTypeKind2[JayTypeKind2["element"] = 5] = "element";
|
|
432
|
+
JayTypeKind2[JayTypeKind2["elementConstructor"] = 6] = "elementConstructor";
|
|
433
|
+
JayTypeKind2[JayTypeKind2["component"] = 7] = "component";
|
|
434
|
+
JayTypeKind2[JayTypeKind2["object"] = 8] = "object";
|
|
435
|
+
JayTypeKind2[JayTypeKind2["array"] = 9] = "array";
|
|
436
|
+
JayTypeKind2[JayTypeKind2["union"] = 10] = "union";
|
|
437
|
+
return JayTypeKind2;
|
|
438
|
+
})(JayTypeKind || {});
|
|
439
|
+
class JayAtomicType {
|
|
440
|
+
constructor(name) {
|
|
441
|
+
__publicField(this, "kind", 0);
|
|
442
|
+
this.name = name;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
const JayString = new JayAtomicType("string");
|
|
446
|
+
const JayNumber = new JayAtomicType("number");
|
|
447
|
+
const JayBoolean = new JayAtomicType("boolean");
|
|
448
|
+
const JayDate = new JayAtomicType("Date");
|
|
449
|
+
const JayUnknown = new JayAtomicType("Unknown");
|
|
450
|
+
const typesMap = {
|
|
451
|
+
string: JayString,
|
|
452
|
+
number: JayNumber,
|
|
453
|
+
boolean: JayBoolean,
|
|
454
|
+
date: JayDate
|
|
455
|
+
};
|
|
456
|
+
function resolvePrimitiveType(typeName) {
|
|
457
|
+
return typesMap[typeName] || JayUnknown;
|
|
458
|
+
}
|
|
459
|
+
class JayTypeAlias {
|
|
460
|
+
constructor(name) {
|
|
461
|
+
__publicField(this, "kind", 1);
|
|
462
|
+
this.name = name;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
class JayEnumType {
|
|
466
|
+
constructor(name, values) {
|
|
467
|
+
__publicField(this, "kind", 2);
|
|
468
|
+
this.name = name;
|
|
469
|
+
this.values = values;
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
class JayHTMLType {
|
|
473
|
+
constructor(name) {
|
|
474
|
+
__publicField(this, "kind", 3);
|
|
475
|
+
this.name = name;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
class JayImportedType {
|
|
479
|
+
constructor(name, type) {
|
|
480
|
+
__publicField(this, "kind", 4);
|
|
481
|
+
this.name = name;
|
|
482
|
+
this.type = type;
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
class JayElementType {
|
|
486
|
+
constructor(name) {
|
|
487
|
+
__publicField(this, "kind", 5);
|
|
488
|
+
this.name = name;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
class JayElementConstructorType {
|
|
492
|
+
constructor(name, typeName) {
|
|
493
|
+
__publicField(this, "kind", 6);
|
|
494
|
+
this.name = name;
|
|
495
|
+
this.typeName = typeName;
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
class JayComponentApiMember {
|
|
499
|
+
constructor(property, isEvent) {
|
|
500
|
+
this.property = property;
|
|
501
|
+
this.isEvent = isEvent;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
class JayComponentType {
|
|
505
|
+
constructor(name, api) {
|
|
506
|
+
__publicField(this, "kind", 7);
|
|
507
|
+
this.name = name;
|
|
508
|
+
this.api = api;
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
class JayObjectType {
|
|
512
|
+
constructor(name, props) {
|
|
513
|
+
__publicField(this, "kind", 8);
|
|
514
|
+
this.name = name;
|
|
515
|
+
this.props = props;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
class JayArrayType {
|
|
519
|
+
constructor(itemType) {
|
|
520
|
+
__publicField(this, "kind", 9);
|
|
521
|
+
this.itemType = itemType;
|
|
522
|
+
}
|
|
523
|
+
get name() {
|
|
524
|
+
return `Array<${this.itemType.name}>`;
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
class JayUnionType {
|
|
528
|
+
constructor(ofTypes) {
|
|
529
|
+
__publicField(this, "kind", 10);
|
|
530
|
+
this.ofTypes = ofTypes;
|
|
531
|
+
}
|
|
532
|
+
get name() {
|
|
533
|
+
return this.ofTypes.map((_) => _.name).join(" | ");
|
|
534
|
+
}
|
|
535
|
+
hasType(aType) {
|
|
536
|
+
return !!this.ofTypes.find((bType) => equalJayTypes(aType, bType));
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
function isAtomicType(aType) {
|
|
540
|
+
return aType.kind === 0;
|
|
541
|
+
}
|
|
542
|
+
function isTypeAliasType(aType) {
|
|
543
|
+
return aType.kind === 1;
|
|
544
|
+
}
|
|
545
|
+
function isEnumType(aType) {
|
|
546
|
+
return aType.kind === 2;
|
|
547
|
+
}
|
|
548
|
+
function isHTMLType(aType) {
|
|
549
|
+
return aType.kind === 3;
|
|
550
|
+
}
|
|
551
|
+
function isImportedType(aType) {
|
|
552
|
+
return aType.kind === 4;
|
|
553
|
+
}
|
|
554
|
+
function isElementConstructorType(aType) {
|
|
555
|
+
return aType.kind === 6;
|
|
556
|
+
}
|
|
557
|
+
function isElementType(aType) {
|
|
558
|
+
return aType.kind === 5;
|
|
559
|
+
}
|
|
560
|
+
function isComponentType(aType) {
|
|
561
|
+
return aType.kind === 7;
|
|
562
|
+
}
|
|
563
|
+
function isObjectType(aType) {
|
|
564
|
+
return aType.kind === 8;
|
|
565
|
+
}
|
|
566
|
+
function isArrayType(aType) {
|
|
567
|
+
return aType.kind === 9;
|
|
568
|
+
}
|
|
569
|
+
function isUnionType(aType) {
|
|
570
|
+
return aType.kind === 10;
|
|
571
|
+
}
|
|
572
|
+
function equalJayTypes(a, b) {
|
|
573
|
+
if (a.name !== b.name)
|
|
574
|
+
return false;
|
|
575
|
+
if (a instanceof JayAtomicType && b instanceof JayAtomicType)
|
|
576
|
+
return true;
|
|
577
|
+
else if (a instanceof JayEnumType && b instanceof JayEnumType)
|
|
578
|
+
return a.values.length === b.values.length && a.values.reduce(
|
|
579
|
+
(res, a_val, currentIndex) => res && a_val === b.values[currentIndex],
|
|
580
|
+
true
|
|
581
|
+
);
|
|
582
|
+
else if (a instanceof JayArrayType && b instanceof JayArrayType)
|
|
583
|
+
return equalJayTypes(a.itemType, b.itemType);
|
|
584
|
+
else if (a instanceof JayTypeAlias && b instanceof JayTypeAlias)
|
|
585
|
+
return true;
|
|
586
|
+
else if (a instanceof JayHTMLType && b instanceof JayHTMLType)
|
|
587
|
+
return true;
|
|
588
|
+
else if (a instanceof JayImportedType && b instanceof JayImportedType)
|
|
589
|
+
return equalJayTypes(a.type, b.type);
|
|
590
|
+
else if (a instanceof JayElementType && b instanceof JayElementType)
|
|
591
|
+
return true;
|
|
592
|
+
else if (a instanceof JayElementConstructorType && b instanceof JayElementConstructorType)
|
|
593
|
+
return a.typeName === b.typeName;
|
|
594
|
+
else if (a instanceof JayComponentType && b instanceof JayComponentType)
|
|
595
|
+
return a.api.length === b.api.length && a.api.reduce(
|
|
596
|
+
(res, a_val, currentIndex) => res && a_val.property === b.api[currentIndex].property && a_val.isEvent === b.api[currentIndex].isEvent,
|
|
597
|
+
true
|
|
598
|
+
);
|
|
599
|
+
else if (a instanceof JayObjectType && b instanceof JayObjectType) {
|
|
600
|
+
const aProps = new Set(Object.keys(a.props));
|
|
601
|
+
const bProps = new Set(Object.keys(b.props));
|
|
602
|
+
return aProps.size === bProps.size && [...aProps].map((aProp) => bProps.has(aProp) && equalJayTypes(a[aProp], b[aProp]));
|
|
603
|
+
} else if (a instanceof JayUnionType && b instanceof JayUnionType) {
|
|
604
|
+
return a.ofTypes.length === b.ofTypes.length && a.ofTypes.reduce((res, aType) => res && b.hasType(aType), true);
|
|
605
|
+
} else
|
|
606
|
+
;
|
|
607
|
+
}
|
|
608
|
+
var RuntimeMode = /* @__PURE__ */ ((RuntimeMode2) => {
|
|
609
|
+
RuntimeMode2["MainTrusted"] = "mainTrusted";
|
|
610
|
+
RuntimeMode2["MainSandbox"] = "mainSandbox";
|
|
611
|
+
RuntimeMode2["WorkerTrusted"] = "workerTrusted";
|
|
612
|
+
RuntimeMode2["WorkerSandbox"] = "workerSandbox";
|
|
613
|
+
return RuntimeMode2;
|
|
614
|
+
})(RuntimeMode || {});
|
|
615
|
+
const TS_EXTENSION = ".ts";
|
|
616
|
+
const TSX_EXTENSION = ".tsx";
|
|
617
|
+
const JAY_QUERY_PREFIX = "?jay-";
|
|
618
|
+
const JAY_QUERY_MAIN_SANDBOX = `${JAY_QUERY_PREFIX}${"mainSandbox"}`;
|
|
619
|
+
const JAY_QUERY_WORKER_TRUSTED = `${JAY_QUERY_PREFIX}${"workerTrusted"}`;
|
|
620
|
+
const JAY_QUERY_WORKER_SANDBOX = `${JAY_QUERY_PREFIX}${"workerSandbox"}`;
|
|
621
|
+
const JAY_QUERY_MAIN_SANDBOX_TS = `${JAY_QUERY_PREFIX}${"mainSandbox"}${TS_EXTENSION}`;
|
|
622
|
+
const JAY_QUERY_WORKER_TRUSTED_TS = `${JAY_QUERY_PREFIX}${"workerTrusted"}${TS_EXTENSION}`;
|
|
623
|
+
const JAY_QUERY_WORKER_SANDBOX_TS = `${JAY_QUERY_PREFIX}${"workerSandbox"}${TS_EXTENSION}`;
|
|
624
|
+
function hasExtension(filename, extension, { withTs = false } = {}) {
|
|
625
|
+
const fullTsExtension = withTs ? `${extension}${TS_EXTENSION}` : extension;
|
|
626
|
+
const fullTsxExtension = withTs ? `${extension}${TSX_EXTENSION}` : extension;
|
|
627
|
+
return filename.endsWith(fullTsExtension) && filename.length > fullTsExtension.length || filename.endsWith(fullTsxExtension) && filename.length > fullTsxExtension.length;
|
|
628
|
+
}
|
|
629
|
+
function hasJayModeExtension(filename, { withTs = false } = {}) {
|
|
630
|
+
return hasExtension(filename, JAY_QUERY_MAIN_SANDBOX, { withTs }) || hasExtension(filename, JAY_QUERY_WORKER_TRUSTED, { withTs }) || hasExtension(filename, JAY_QUERY_WORKER_SANDBOX, { withTs });
|
|
631
|
+
}
|
|
632
|
+
function getModeFileExtension(isSandbox, importerMode, { withTs = false } = {}) {
|
|
633
|
+
const tsExtension = withTs ? TS_EXTENSION : "";
|
|
634
|
+
const mode = getMode(isSandbox, importerMode);
|
|
635
|
+
return mode === "mainTrusted" ? tsExtension : `${JAY_QUERY_PREFIX}${mode}${tsExtension}`;
|
|
636
|
+
}
|
|
637
|
+
function getMode(isSandbox, importerMode) {
|
|
638
|
+
switch (importerMode) {
|
|
639
|
+
case "mainTrusted":
|
|
640
|
+
return isSandbox ? "mainSandbox" : "mainTrusted";
|
|
641
|
+
case "workerTrusted":
|
|
642
|
+
return isSandbox ? "workerSandbox" : "workerTrusted";
|
|
643
|
+
default:
|
|
644
|
+
return importerMode;
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
function getModeFromExtension(filename) {
|
|
648
|
+
const modeString = `?${filename.split("?").pop()}`;
|
|
649
|
+
switch (modeString) {
|
|
650
|
+
case JAY_QUERY_MAIN_SANDBOX_TS:
|
|
651
|
+
return "mainSandbox";
|
|
652
|
+
case JAY_QUERY_WORKER_TRUSTED_TS:
|
|
653
|
+
return "workerTrusted";
|
|
654
|
+
case JAY_QUERY_WORKER_SANDBOX_TS:
|
|
655
|
+
return "workerSandbox";
|
|
656
|
+
default:
|
|
657
|
+
return "mainTrusted";
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
function getJayTsFileSourcePath(filename) {
|
|
661
|
+
const beforeExtension = filename.split("?");
|
|
662
|
+
if (beforeExtension.length === 1) {
|
|
663
|
+
throw new Error(
|
|
664
|
+
`Filename ${filename} does not contain jay mode extension "?jay-[mode].ts"`
|
|
665
|
+
);
|
|
666
|
+
}
|
|
667
|
+
return `${beforeExtension.slice(0, -1).join("")}.ts`;
|
|
668
|
+
}
|
|
669
|
+
function withoutExtension(filename, extension) {
|
|
670
|
+
if (!filename.endsWith(extension)) {
|
|
671
|
+
throw new Error(`Filename ${filename} does not end with extension ${extension}`);
|
|
672
|
+
}
|
|
673
|
+
return filename.slice(0, -extension.length);
|
|
674
|
+
}
|
|
675
|
+
class WithValidations {
|
|
676
|
+
constructor(val, validations = []) {
|
|
677
|
+
__publicField(this, "val");
|
|
678
|
+
__publicField(this, "validations");
|
|
679
|
+
this.val = val;
|
|
680
|
+
this.validations = validations;
|
|
681
|
+
}
|
|
682
|
+
map(func) {
|
|
683
|
+
if (this.val)
|
|
684
|
+
return new WithValidations(func(this.val), this.validations);
|
|
685
|
+
else
|
|
686
|
+
return new WithValidations(void 0, this.validations);
|
|
687
|
+
}
|
|
688
|
+
async mapAsync(func) {
|
|
689
|
+
if (this.val) {
|
|
690
|
+
const result = await func(this.val);
|
|
691
|
+
return new WithValidations(result, this.validations);
|
|
692
|
+
} else {
|
|
693
|
+
return new WithValidations(void 0, this.validations);
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
flatMap(func) {
|
|
697
|
+
if (this.val) {
|
|
698
|
+
let that = func(this.val);
|
|
699
|
+
return new WithValidations(that.val, [...this.validations, ...that.validations]);
|
|
700
|
+
} else
|
|
701
|
+
return new WithValidations(void 0, this.validations);
|
|
702
|
+
}
|
|
703
|
+
async flatMapAsync(func) {
|
|
704
|
+
if (this.val) {
|
|
705
|
+
const result = await func(this.val);
|
|
706
|
+
return new WithValidations(result.val, [...this.validations, ...result.validations]);
|
|
707
|
+
} else {
|
|
708
|
+
return new WithValidations(void 0, this.validations);
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
merge(other, merge) {
|
|
712
|
+
return new WithValidations(merge(this.val, other.val), [
|
|
713
|
+
...this.validations,
|
|
714
|
+
...other.validations
|
|
715
|
+
]);
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
function checkValidationErrors(withValidations) {
|
|
719
|
+
const { validations } = withValidations;
|
|
720
|
+
if (validations.length > 0) {
|
|
721
|
+
throw new Error(validations.join("\n"));
|
|
722
|
+
}
|
|
723
|
+
return withValidations.val;
|
|
724
|
+
}
|
|
725
|
+
var SourceFileFormat = /* @__PURE__ */ ((SourceFileFormat2) => {
|
|
726
|
+
SourceFileFormat2["JayHtml"] = "jay-html";
|
|
727
|
+
SourceFileFormat2["JayTsx"] = "jay-tsx";
|
|
728
|
+
SourceFileFormat2["JayContract"] = "jay-contract";
|
|
729
|
+
SourceFileFormat2["TypeScript"] = "typeScript";
|
|
730
|
+
return SourceFileFormat2;
|
|
731
|
+
})(SourceFileFormat || {});
|
|
732
|
+
function mergeRefsTrees(...trees) {
|
|
733
|
+
const allRefs = trees.flatMap((tree) => tree.refs);
|
|
734
|
+
const allChildren = {};
|
|
735
|
+
const allKeys = new Set(trees.flatMap((tree) => Object.keys(tree.children)));
|
|
736
|
+
for (const key of allKeys) {
|
|
737
|
+
const childTrees = trees.filter((tree) => tree.children[key] !== void 0).map((tree) => tree.children[key]);
|
|
738
|
+
if (childTrees.length > 0) {
|
|
739
|
+
allChildren[key] = mergeRefsTrees(...childTrees);
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
const isRepeated = trees.some((tree) => tree.repeated);
|
|
743
|
+
return mkRefsTree(allRefs, allChildren, isRepeated);
|
|
744
|
+
}
|
|
745
|
+
function hasRefs(refs, includingAutoRefs) {
|
|
746
|
+
const onlyNonAutoRefs = (ref) => !ref.autoRef;
|
|
747
|
+
const allRefs = (ref) => true;
|
|
748
|
+
return refs.refs.filter(includingAutoRefs ? allRefs : onlyNonAutoRefs).length > 0 || refs.imported || Object.entries(refs.children).map(([ref, refs2]) => hasRefs(refs2, includingAutoRefs)).reduce((prev, curr) => prev || curr, false);
|
|
749
|
+
}
|
|
750
|
+
function nestRefs(path, renderFragment) {
|
|
751
|
+
let refs = renderFragment.refs;
|
|
752
|
+
for (let index = path.length - 1; index >= 0; --index) {
|
|
753
|
+
refs = mkRefsTree([], { [path[index]]: refs }, refs.repeated);
|
|
754
|
+
}
|
|
755
|
+
return new RenderFragment(
|
|
756
|
+
renderFragment.rendered,
|
|
757
|
+
renderFragment.imports,
|
|
758
|
+
renderFragment.validations,
|
|
759
|
+
refs
|
|
760
|
+
);
|
|
761
|
+
}
|
|
762
|
+
function mkRefsTree(refs, children, repeated = false, refsTypeName, repeatedRefsTypeName) {
|
|
763
|
+
if (refsTypeName)
|
|
764
|
+
return {
|
|
765
|
+
kind: "refTree",
|
|
766
|
+
refs,
|
|
767
|
+
children,
|
|
768
|
+
repeated,
|
|
769
|
+
imported: { refsTypeName, repeatedRefsTypeName }
|
|
770
|
+
};
|
|
771
|
+
else
|
|
772
|
+
return { kind: "refTree", refs, children, repeated };
|
|
773
|
+
}
|
|
774
|
+
function mkRef(ref, originalName, constName, repeated, autoRef, viewStateType, elementType) {
|
|
775
|
+
return {
|
|
776
|
+
kind: "ref",
|
|
777
|
+
originalName,
|
|
778
|
+
ref,
|
|
779
|
+
constName,
|
|
780
|
+
repeated,
|
|
781
|
+
autoRef,
|
|
782
|
+
viewStateType,
|
|
783
|
+
elementType
|
|
784
|
+
};
|
|
785
|
+
}
|
|
786
|
+
class RenderFragment {
|
|
787
|
+
constructor(rendered, imports = Imports.none(), validations = [], refs = mkRefsTree([], {})) {
|
|
788
|
+
__publicField(this, "rendered");
|
|
789
|
+
__publicField(this, "imports");
|
|
790
|
+
__publicField(this, "validations");
|
|
791
|
+
__publicField(this, "refs");
|
|
792
|
+
this.rendered = rendered;
|
|
793
|
+
this.imports = imports;
|
|
794
|
+
this.validations = validations;
|
|
795
|
+
this.refs = refs;
|
|
796
|
+
}
|
|
797
|
+
map(f) {
|
|
798
|
+
return new RenderFragment(f(this.rendered), this.imports, this.validations, this.refs);
|
|
799
|
+
}
|
|
800
|
+
plusImport(imp) {
|
|
801
|
+
return new RenderFragment(
|
|
802
|
+
this.rendered,
|
|
803
|
+
this.imports.plus(imp),
|
|
804
|
+
this.validations,
|
|
805
|
+
this.refs
|
|
806
|
+
);
|
|
807
|
+
}
|
|
808
|
+
static empty() {
|
|
809
|
+
return new RenderFragment("", Imports.none());
|
|
810
|
+
}
|
|
811
|
+
static merge(fragment1, fragment2, combinator = "") {
|
|
812
|
+
const rendered = !!fragment1.rendered && !!fragment2.rendered ? `${fragment1.rendered}${combinator}${fragment2.rendered}` : !!fragment1.rendered ? fragment1.rendered : fragment2.rendered;
|
|
813
|
+
const newRefsTree = mergeRefsTrees(fragment1.refs, fragment2.refs);
|
|
814
|
+
return new RenderFragment(
|
|
815
|
+
rendered,
|
|
816
|
+
Imports.merge(fragment1.imports, fragment2.imports),
|
|
817
|
+
[...fragment1.validations, ...fragment2.validations],
|
|
818
|
+
newRefsTree
|
|
819
|
+
);
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
var GenerateTarget = /* @__PURE__ */ ((GenerateTarget2) => {
|
|
823
|
+
GenerateTarget2[GenerateTarget2["jay"] = 0] = "jay";
|
|
824
|
+
GenerateTarget2[GenerateTarget2["react"] = 1] = "react";
|
|
825
|
+
return GenerateTarget2;
|
|
826
|
+
})(GenerateTarget || {});
|
|
827
|
+
function withOriginalTrace(error, originalError) {
|
|
828
|
+
error.stack = `${error.stack}
|
|
829
|
+
Caused by
|
|
830
|
+
${originalError.stack}`;
|
|
831
|
+
return error;
|
|
832
|
+
}
|
|
833
|
+
async function prettify(code, options = {}) {
|
|
834
|
+
try {
|
|
835
|
+
return await prettier__namespace.format(code, {
|
|
836
|
+
printWidth: 100,
|
|
837
|
+
singleQuote: true,
|
|
838
|
+
tabWidth: 4,
|
|
839
|
+
parser: "typescript",
|
|
840
|
+
...options
|
|
841
|
+
});
|
|
842
|
+
} catch (error) {
|
|
843
|
+
throw new Error(`failed to prettify code
|
|
844
|
+
original error: ${error.message}
|
|
845
|
+
code:
|
|
846
|
+
${code}`);
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
function prettifyHtml(html) {
|
|
850
|
+
return jsBeautify.html(
|
|
851
|
+
html.split("\n").map((line) => line.trim()).join(""),
|
|
852
|
+
{
|
|
853
|
+
indent_size: 2,
|
|
854
|
+
wrap_line_length: 100
|
|
855
|
+
}
|
|
856
|
+
);
|
|
857
|
+
}
|
|
858
|
+
function removeComments(code) {
|
|
859
|
+
return code.split("\n").filter(
|
|
860
|
+
(line) => !(line.includes("// @ts-expect-error ") || line.includes("// @ts-ignore") || line.includes("{/* @ts-ignore */}"))
|
|
861
|
+
).join("\n");
|
|
862
|
+
}
|
|
863
|
+
exports.GenerateTarget = GenerateTarget;
|
|
864
|
+
exports.Import = Import;
|
|
865
|
+
exports.Imports = Imports;
|
|
866
|
+
exports.ImportsFor = ImportsFor;
|
|
867
|
+
exports.JAY_4_REACT = JAY_4_REACT;
|
|
868
|
+
exports.JAY_COMPONENT = JAY_COMPONENT;
|
|
869
|
+
exports.JAY_CONTRACT_DTS_EXTENSION = JAY_CONTRACT_DTS_EXTENSION;
|
|
870
|
+
exports.JAY_CONTRACT_EXTENSION = JAY_CONTRACT_EXTENSION;
|
|
871
|
+
exports.JAY_DTS_EXTENSION = JAY_DTS_EXTENSION;
|
|
872
|
+
exports.JAY_EXTENSION = JAY_EXTENSION;
|
|
873
|
+
exports.JAY_FULLSTACK_COMPONENTS = JAY_FULLSTACK_COMPONENTS;
|
|
874
|
+
exports.JAY_QUERY_MAIN_SANDBOX = JAY_QUERY_MAIN_SANDBOX;
|
|
875
|
+
exports.JAY_QUERY_MAIN_SANDBOX_TS = JAY_QUERY_MAIN_SANDBOX_TS;
|
|
876
|
+
exports.JAY_QUERY_PREFIX = JAY_QUERY_PREFIX;
|
|
877
|
+
exports.JAY_QUERY_WORKER_SANDBOX = JAY_QUERY_WORKER_SANDBOX;
|
|
878
|
+
exports.JAY_QUERY_WORKER_SANDBOX_TS = JAY_QUERY_WORKER_SANDBOX_TS;
|
|
879
|
+
exports.JAY_QUERY_WORKER_TRUSTED = JAY_QUERY_WORKER_TRUSTED;
|
|
880
|
+
exports.JAY_QUERY_WORKER_TRUSTED_TS = JAY_QUERY_WORKER_TRUSTED_TS;
|
|
881
|
+
exports.JAY_RUNTIME = JAY_RUNTIME;
|
|
882
|
+
exports.JAY_SECURE = JAY_SECURE;
|
|
883
|
+
exports.JAY_TS_EXTENSION = JAY_TS_EXTENSION;
|
|
884
|
+
exports.JayArrayType = JayArrayType;
|
|
885
|
+
exports.JayAtomicType = JayAtomicType;
|
|
886
|
+
exports.JayBoolean = JayBoolean;
|
|
887
|
+
exports.JayComponentApiMember = JayComponentApiMember;
|
|
888
|
+
exports.JayComponentType = JayComponentType;
|
|
889
|
+
exports.JayDate = JayDate;
|
|
890
|
+
exports.JayElementConstructorType = JayElementConstructorType;
|
|
891
|
+
exports.JayElementType = JayElementType;
|
|
892
|
+
exports.JayEnumType = JayEnumType;
|
|
893
|
+
exports.JayHTMLType = JayHTMLType;
|
|
894
|
+
exports.JayImportedType = JayImportedType;
|
|
895
|
+
exports.JayNumber = JayNumber;
|
|
896
|
+
exports.JayObjectType = JayObjectType;
|
|
897
|
+
exports.JayString = JayString;
|
|
898
|
+
exports.JayTypeAlias = JayTypeAlias;
|
|
899
|
+
exports.JayTypeKind = JayTypeKind;
|
|
900
|
+
exports.JayUnionType = JayUnionType;
|
|
901
|
+
exports.JayUnknown = JayUnknown;
|
|
902
|
+
exports.MAKE_JAY_4_REACT_COMPONENT = MAKE_JAY_4_REACT_COMPONENT;
|
|
903
|
+
exports.MAKE_JAY_COMPONENT = MAKE_JAY_COMPONENT;
|
|
904
|
+
exports.MAKE_JAY_TSX_COMPONENT = MAKE_JAY_TSX_COMPONENT;
|
|
905
|
+
exports.REACT = REACT;
|
|
906
|
+
exports.RenderFragment = RenderFragment;
|
|
907
|
+
exports.RuntimeMode = RuntimeMode;
|
|
908
|
+
exports.SourceFileFormat = SourceFileFormat;
|
|
909
|
+
exports.TSX_EXTENSION = TSX_EXTENSION;
|
|
910
|
+
exports.TS_EXTENSION = TS_EXTENSION;
|
|
911
|
+
exports.WithValidations = WithValidations;
|
|
912
|
+
exports.checkValidationErrors = checkValidationErrors;
|
|
913
|
+
exports.equalJayTypes = equalJayTypes;
|
|
914
|
+
exports.getJayTsFileSourcePath = getJayTsFileSourcePath;
|
|
915
|
+
exports.getMode = getMode;
|
|
916
|
+
exports.getModeFileExtension = getModeFileExtension;
|
|
917
|
+
exports.getModeFromExtension = getModeFromExtension;
|
|
918
|
+
exports.hasExtension = hasExtension;
|
|
919
|
+
exports.hasJayModeExtension = hasJayModeExtension;
|
|
920
|
+
exports.hasRefs = hasRefs;
|
|
921
|
+
exports.isArrayType = isArrayType;
|
|
922
|
+
exports.isAtomicType = isAtomicType;
|
|
923
|
+
exports.isComponentType = isComponentType;
|
|
924
|
+
exports.isElementConstructorType = isElementConstructorType;
|
|
925
|
+
exports.isElementType = isElementType;
|
|
926
|
+
exports.isEnumType = isEnumType;
|
|
927
|
+
exports.isHTMLType = isHTMLType;
|
|
928
|
+
exports.isImportedType = isImportedType;
|
|
929
|
+
exports.isObjectType = isObjectType;
|
|
930
|
+
exports.isTypeAliasType = isTypeAliasType;
|
|
931
|
+
exports.isUnionType = isUnionType;
|
|
932
|
+
exports.mergeRefsTrees = mergeRefsTrees;
|
|
933
|
+
exports.mkRef = mkRef;
|
|
934
|
+
exports.mkRefsTree = mkRefsTree;
|
|
935
|
+
exports.nestRefs = nestRefs;
|
|
936
|
+
exports.prettify = prettify;
|
|
937
|
+
exports.prettifyHtml = prettifyHtml;
|
|
938
|
+
exports.removeComments = removeComments;
|
|
939
|
+
exports.resolvePrimitiveType = resolvePrimitiveType;
|
|
940
|
+
exports.withOriginalTrace = withOriginalTrace;
|
|
941
|
+
exports.withoutExtension = withoutExtension;
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@jay-framework/compiler-shared",
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"directories": {
|
|
8
|
+
"lib": "lib"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"readme.md"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "npm run build:js && npm run build:types",
|
|
16
|
+
"build:watch": "npm run build:js -- --watch & npm run build:types -- --watch",
|
|
17
|
+
"build:js": "vite build",
|
|
18
|
+
"build:types": "tsup lib/index.ts --dts-only --format cjs",
|
|
19
|
+
"build:check-types": "tsc",
|
|
20
|
+
"clean": "rimraf dist",
|
|
21
|
+
"confirm": "npm run clean && npm run build && npm run build:check-types && npm run test",
|
|
22
|
+
"test": "vitest run",
|
|
23
|
+
"test:watch": "vitest"
|
|
24
|
+
},
|
|
25
|
+
"author": "",
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@jay-framework/component": "workspace:^",
|
|
28
|
+
"@jay-framework/runtime": "workspace:^",
|
|
29
|
+
"@jay-framework/secure": "workspace:^",
|
|
30
|
+
"@types/js-yaml": "^4.0.9",
|
|
31
|
+
"change-case": "^4.1.2",
|
|
32
|
+
"js-beautify": "^1.14.11",
|
|
33
|
+
"js-yaml": "^4.1.0",
|
|
34
|
+
"node-html-parser": "^6.1.12",
|
|
35
|
+
"pegjs": "^0.10.0",
|
|
36
|
+
"pluralize": "^8.0.0",
|
|
37
|
+
"typescript": "^5.3.3"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@caiogondim/strip-margin": "^1.0.0",
|
|
41
|
+
"@jay-framework/dev-environment": "workspace:^",
|
|
42
|
+
"@testing-library/jest-dom": "^6.2.0",
|
|
43
|
+
"@types/js-beautify": "^1",
|
|
44
|
+
"@types/node": "^20.11.5",
|
|
45
|
+
"jest-diff": "^29.7.0",
|
|
46
|
+
"jest-matcher-utils": "^29.7.0",
|
|
47
|
+
"rimraf": "^5.0.5",
|
|
48
|
+
"tsup": "^8.0.1",
|
|
49
|
+
"vite": "^5.0.11",
|
|
50
|
+
"vitest": "^1.2.1"
|
|
51
|
+
}
|
|
52
|
+
}
|