@jay-framework/compiler 0.6.7 → 0.6.8

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 CHANGED
@@ -1,50 +1,52 @@
1
- "use strict";
2
1
  var __defProp = Object.defineProperty;
3
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
3
  var __publicField = (obj, key, value) => {
5
4
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
6
5
  return value;
7
6
  };
8
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
9
- const ts = require("typescript");
10
- const compilerShared = require("@jay-framework/compiler-shared");
11
- const changeCase = require("change-case");
12
- const path = require("node:path");
13
- const compilerJayHtml = require("@jay-framework/compiler-jay-html");
14
- function _interopNamespaceDefault(e) {
15
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
16
- if (e) {
17
- for (const k in e) {
18
- if (k !== "default") {
19
- const d = Object.getOwnPropertyDescriptor(e, k);
20
- Object.defineProperty(n, k, d.get ? d : {
21
- enumerable: true,
22
- get: () => e[k]
23
- });
24
- }
25
- }
26
- }
27
- n.default = e;
28
- return Object.freeze(n);
29
- }
30
- const ts__namespace = /* @__PURE__ */ _interopNamespaceDefault(ts);
31
- const printer = ts.createPrinter({
32
- newLine: ts.NewLineKind.LineFeed
7
+ import { JAY_COMPONENT, WithValidations, getModeFileExtension, MAKE_JAY_COMPONENT, JAY_SECURE, RuntimeMode, withOriginalTrace, JAY_QUERY_WORKER_TRUSTED, hasExtension, JAY_QUERY_MAIN_SANDBOX, JAY_QUERY_WORKER_SANDBOX, JayUnknown, JAY_EXTENSION, withoutExtension, JAY_TS_EXTENSION, SourceFileFormat, GenerateTarget } from "@jay-framework/compiler-shared";
8
+ import { createRequire } from "module";
9
+ import { capitalCase } from "change-case";
10
+ import path from "node:path";
11
+ import { generateElementFile as generateElementFile$1, generateElementFileReactTarget } from "@jay-framework/compiler-jay-html";
12
+ import { generateElementDefinitionFile } from "@jay-framework/compiler-jay-html";
13
+ const require$n = createRequire(import.meta.url);
14
+ const tsModule$m = require$n("typescript");
15
+ const {
16
+ isArrowFunction: isArrowFunction$4,
17
+ isConstructorDeclaration,
18
+ isFunctionDeclaration: isFunctionDeclaration$3,
19
+ isFunctionExpression: isFunctionExpression$1,
20
+ isGetAccessorDeclaration,
21
+ isMethodDeclaration,
22
+ isSetAccessorDeclaration,
23
+ createPrinter,
24
+ EmitHint,
25
+ createSourceFile: createSourceFile$1,
26
+ ScriptTarget: ScriptTarget$1,
27
+ setTextRange,
28
+ visitEachChild: visitEachChild$5,
29
+ NewLineKind
30
+ } = tsModule$m;
31
+ const printer = createPrinter({
32
+ newLine: NewLineKind.LineFeed
33
33
  });
34
34
  function astToCode(node) {
35
- return printer.printNode(ts.EmitHint.Unspecified, node, void 0);
35
+ return printer.printNode(EmitHint.Unspecified, node, void 0);
36
36
  }
37
37
  function codeToAst(code, context) {
38
- let dummySourceFile = ts.createSourceFile("dummy.ts", code, ts.ScriptTarget.Latest, true);
38
+ let dummySourceFile = createSourceFile$1("dummy.ts", code, ScriptTarget$1.Latest, true);
39
39
  function visitor(node) {
40
- let updatedNode = ts.setTextRange(node, { pos: -1, end: -1 });
41
- return ts.visitEachChild(updatedNode, visitor, context);
40
+ let updatedNode = setTextRange(node, { pos: -1, end: -1 });
41
+ return visitEachChild$5(updatedNode, visitor, context);
42
42
  }
43
- return ts.visitEachChild(dummySourceFile, visitor, context).statements;
43
+ return Array.from(visitEachChild$5(dummySourceFile, visitor, context).statements);
44
44
  }
45
45
  function isFunctionLikeDeclarationBase(node) {
46
- return ts.isFunctionExpression(node) || ts.isArrowFunction(node) || ts.isFunctionDeclaration(node) || ts.isMethodDeclaration(node) || ts.isConstructorDeclaration(node) || ts.isGetAccessorDeclaration(node) || ts.isSetAccessorDeclaration(node);
46
+ return isFunctionExpression$1(node) || isArrowFunction$4(node) || isFunctionDeclaration$3(node) || isMethodDeclaration(node) || isConstructorDeclaration(node) || isGetAccessorDeclaration(node) || isSetAccessorDeclaration(node);
47
47
  }
48
+ const require$m = createRequire(import.meta.url);
49
+ require$m("typescript");
48
50
  function mkTransformer(fileTransformer, config) {
49
51
  return (context) => {
50
52
  const { factory } = context;
@@ -53,32 +55,38 @@ function mkTransformer(fileTransformer, config) {
53
55
  };
54
56
  };
55
57
  }
58
+ const require$l = createRequire(import.meta.url);
59
+ const tsModule$l = require$l("typescript");
60
+ const { forEachChild: forEachChild$4, isImportDeclaration: isImportDeclaration$5, isNamedImports: isNamedImports$1, isStringLiteral: isStringLiteral$9 } = tsModule$l;
56
61
  function extractImportDeclarations(sourceFile) {
57
62
  const importDeclarations = [];
58
63
  function visit(node) {
59
- if (ts__namespace.isImportDeclaration(node)) {
64
+ if (isImportDeclaration$5(node)) {
60
65
  importDeclarations.push(node);
61
66
  }
62
- ts__namespace.forEachChild(node, visit);
67
+ forEachChild$4(node, visit);
63
68
  }
64
- ts__namespace.forEachChild(sourceFile, visit);
69
+ forEachChild$4(sourceFile, visit);
65
70
  return importDeclarations;
66
71
  }
67
72
  function extractImportedModules(sourceFile) {
68
- return extractImportDeclarations(sourceFile).filter((node) => ts__namespace.isStringLiteral(node.moduleSpecifier)).map((node) => node.moduleSpecifier.text);
73
+ return extractImportDeclarations(sourceFile).filter((node) => isStringLiteral$9(node.moduleSpecifier)).map((node) => node.moduleSpecifier.text);
69
74
  }
70
- function isRelativeImport(module2) {
71
- return module2.startsWith(".");
75
+ function isRelativeImport(module) {
76
+ return module.startsWith(".");
72
77
  }
73
78
  function getImportSpecifiers(importDeclaration) {
74
79
  const namedBindings = importDeclaration.importClause?.namedBindings;
75
- return namedBindings && ts__namespace.isNamedImports(namedBindings) ? namedBindings.elements : void 0;
80
+ return namedBindings && isNamedImports$1(namedBindings) ? namedBindings.elements : void 0;
76
81
  }
77
82
  function getImportName(importSpecifier) {
78
83
  return importSpecifier.propertyName?.text ?? importSpecifier.name.text;
79
84
  }
85
+ const require$k = createRequire(import.meta.url);
86
+ const tsModule$k = require$k("typescript");
87
+ const { forEachChild: forEachChild$3, isImportDeclaration: isImportDeclaration$4, isStringLiteral: isStringLiteral$8 } = tsModule$k;
80
88
  function findMakeJayComponentImport(makeJayComponentName, node) {
81
- if (ts.isImportDeclaration(node) && ts.isStringLiteral(node.moduleSpecifier) && node.moduleSpecifier.text === compilerShared.JAY_COMPONENT) {
89
+ if (isImportDeclaration$4(node) && isStringLiteral$8(node.moduleSpecifier) && node.moduleSpecifier.text === JAY_COMPONENT) {
82
90
  let importSpecifier = getImportSpecifiers(node)?.find(
83
91
  (element) => getImportName(element) === makeJayComponentName
84
92
  );
@@ -88,29 +96,58 @@ function findMakeJayComponentImport(makeJayComponentName, node) {
88
96
  }
89
97
  return void 0;
90
98
  }
99
+ const require$j = createRequire(import.meta.url);
100
+ const tsModule$j = require$j("typescript");
101
+ const { forEachChild: forEachChild$2, isArrowFunction: isArrowFunction$3, isFunctionDeclaration: isFunctionDeclaration$2, isIdentifier: isIdentifier$7, isVariableStatement: isVariableStatement$3 } = tsModule$j;
91
102
  function findComponentConstructorsBlock(componentFunctionExpressions, sourceFile) {
92
103
  const foundConstructors = [];
93
104
  const namedConstructors = new Set(
94
- componentFunctionExpressions.filter((expression) => ts.isIdentifier(expression)).map((expression) => ts.isIdentifier(expression) && expression.text)
105
+ componentFunctionExpressions.filter((expression) => isIdentifier$7(expression)).map((expression) => isIdentifier$7(expression) && expression.text)
95
106
  );
96
107
  const inlineConstructors = componentFunctionExpressions.filter(
97
108
  isFunctionLikeDeclarationBase
98
109
  );
99
110
  function visit(node) {
100
- if (ts.isFunctionDeclaration(node)) {
111
+ if (isFunctionDeclaration$2(node)) {
101
112
  if (namedConstructors.has(node?.name.text))
102
113
  foundConstructors.push(node);
103
- } else if (ts.isVariableStatement(node)) {
114
+ } else if (isVariableStatement$3(node)) {
104
115
  node.declarationList.declarations.forEach((declaration) => {
105
- if (ts.isIdentifier(declaration.name) && namedConstructors.has(declaration.name.text) && declaration.initializer && ts.isArrowFunction(declaration.initializer))
116
+ if (isIdentifier$7(declaration.name) && namedConstructors.has(declaration.name.text) && declaration.initializer && isArrowFunction$3(declaration.initializer))
106
117
  foundConstructors.push(declaration.initializer);
107
118
  });
108
119
  }
109
- ts.forEachChild(node, visit);
120
+ forEachChild$2(node, visit);
110
121
  }
111
- ts.forEachChild(sourceFile, visit);
122
+ forEachChild$2(sourceFile, visit);
112
123
  return [...foundConstructors, ...inlineConstructors];
113
124
  }
125
+ const require$i = createRequire(import.meta.url);
126
+ const tsModule$i = require$i("typescript");
127
+ const {
128
+ isElementAccessExpression: isElementAccessExpression$1,
129
+ isIdentifier: isIdentifier$6,
130
+ isObjectBindingPattern,
131
+ isPropertyAccessExpression: isPropertyAccessExpression$5,
132
+ isStringLiteral: isStringLiteral$7,
133
+ isObjectLiteralExpression,
134
+ isPropertyAssignment,
135
+ isShorthandPropertyAssignment,
136
+ isArrayBindingPattern,
137
+ isBindingElement,
138
+ isParenthesizedExpression,
139
+ isAsExpression,
140
+ isArrowFunction: isArrowFunction$2,
141
+ isFunctionExpression,
142
+ isStatement: isStatement$2,
143
+ isNamespaceImport,
144
+ isNamedImports,
145
+ isCallExpression: isCallExpression$6,
146
+ isNumericLiteral,
147
+ isToken,
148
+ SyntaxKind: SyntaxKind$5,
149
+ NodeFlags
150
+ } = tsModule$i;
114
151
  function mkParameterVariableRoot(param, paramIndex) {
115
152
  return { kind: 0, param, paramIndex };
116
153
  }
@@ -120,8 +157,8 @@ function mkFunctionVariableRoot(func) {
120
157
  function mkLiteralVariableRoot(literal) {
121
158
  return { kind: 2, literal };
122
159
  }
123
- function mkImportModuleVariableRoot(module2, importType) {
124
- return { kind: 3, module: module2, importType };
160
+ function mkImportModuleVariableRoot(module, importType) {
161
+ return { kind: 3, module, importType };
125
162
  }
126
163
  function mkFunctionCallVariableRoot(node) {
127
164
  return { kind: 4, node };
@@ -160,18 +197,18 @@ function mkVariable(members) {
160
197
  }
161
198
  const UNKNOWN_VARIABLE = {};
162
199
  const getAccessedByProperty = (binding, accessedFrom, propertyName) => {
163
- return accessedFrom ? propertyName ? ts.isIdentifier(propertyName) ? propertyName.text : void 0 : binding.text : void 0;
200
+ return accessedFrom ? propertyName ? isIdentifier$6(propertyName) ? propertyName.text : void 0 : binding.text : void 0;
164
201
  };
165
202
  function findDeclaringStatement(node) {
166
203
  if (!node)
167
204
  return void 0;
168
- else if (ts.isStatement(node))
205
+ else if (isStatement$2(node))
169
206
  return node;
170
207
  else
171
208
  return findDeclaringStatement(node.parent);
172
209
  }
173
210
  function tsBindingNameToVariable(binding, accessedFrom, assignedFrom, propertyName, root) {
174
- if (ts.isIdentifier(binding)) {
211
+ if (isIdentifier$6(binding)) {
175
212
  return [
176
213
  mkVariable({
177
214
  name: binding.text,
@@ -182,10 +219,10 @@ function tsBindingNameToVariable(binding, accessedFrom, assignedFrom, propertyNa
182
219
  definingStatement: findDeclaringStatement(binding)
183
220
  })
184
221
  ];
185
- } else if (ts.isObjectBindingPattern(binding)) {
222
+ } else if (isObjectBindingPattern(binding)) {
186
223
  let variable = mkVariable({
187
224
  accessedFrom,
188
- accessedByProperty: propertyName ? ts.isIdentifier(propertyName) ? propertyName.text : void 0 : void 0,
225
+ accessedByProperty: propertyName ? isIdentifier$6(propertyName) ? propertyName.text : void 0 : void 0,
189
226
  assignedFrom,
190
227
  root,
191
228
  definingStatement: findDeclaringStatement(binding)
@@ -193,16 +230,16 @@ function tsBindingNameToVariable(binding, accessedFrom, assignedFrom, propertyNa
193
230
  return binding.elements.flatMap((element) => {
194
231
  return tsBindingNameToVariable(element.name, variable, void 0, element.propertyName);
195
232
  });
196
- } else if (ts.isArrayBindingPattern(binding)) {
233
+ } else if (isArrayBindingPattern(binding)) {
197
234
  let variable = mkVariable({
198
235
  accessedFrom,
199
- accessedByProperty: propertyName ? ts.isIdentifier(propertyName) ? propertyName.text : void 0 : void 0,
236
+ accessedByProperty: propertyName ? isIdentifier$6(propertyName) ? propertyName.text : void 0 : void 0,
200
237
  assignedFrom,
201
238
  root,
202
239
  definingStatement: findDeclaringStatement(binding)
203
240
  });
204
241
  return binding.elements.flatMap((element, index) => {
205
- return ts.isBindingElement(element) && tsBindingNameToVariable(element.name, variable, void 0, {
242
+ return isBindingElement(element) && tsBindingNameToVariable(element.name, variable, void 0, {
206
243
  kind: 80,
207
244
  text: "" + index
208
245
  });
@@ -243,7 +280,7 @@ class NameBindingResolver {
243
280
  }
244
281
  }
245
282
  addVariableDeclarationList(declarationList) {
246
- const letOrConst = declarationList.flags === ts.NodeFlags.Const ? 1 : 0;
283
+ const letOrConst = declarationList.flags === NodeFlags.Const ? 1 : 0;
247
284
  declarationList.declarations.forEach((declaration) => {
248
285
  let rightSide = declaration.initializer ? this.resolvePropertyAccessChain(declaration.initializer) : void 0;
249
286
  let declaredVariable = tsBindingNameToVariable(
@@ -264,36 +301,36 @@ class NameBindingResolver {
264
301
  return this.variables.get(name) || UNKNOWN_VARIABLE;
265
302
  }
266
303
  resolvePropertyAccessChain(expression) {
267
- if (ts.isPropertyAccessExpression(expression)) {
304
+ if (isPropertyAccessExpression$5(expression)) {
268
305
  const name = expression.name.text;
269
306
  const identifiersFromObject = this.resolvePropertyAccessChain(expression.expression);
270
307
  return { accessedFrom: identifiersFromObject, accessedByProperty: name };
271
- } else if (ts.isElementAccessExpression(expression) && ts.isStringLiteral(expression.argumentExpression)) {
308
+ } else if (isElementAccessExpression$1(expression) && isStringLiteral$7(expression.argumentExpression)) {
272
309
  const name = expression.argumentExpression.text;
273
310
  const identifiersFromObject = this.resolvePropertyAccessChain(expression.expression);
274
311
  return { accessedFrom: identifiersFromObject, accessedByProperty: name };
275
- } else if (ts.isIdentifier(expression)) {
312
+ } else if (isIdentifier$6(expression)) {
276
313
  return this.resolveIdentifier(expression);
277
- } else if (ts.isParenthesizedExpression(expression)) {
314
+ } else if (isParenthesizedExpression(expression)) {
278
315
  return this.resolvePropertyAccessChain(expression.expression);
279
- } else if (ts.isAsExpression(expression)) {
316
+ } else if (isAsExpression(expression)) {
280
317
  return this.resolvePropertyAccessChain(expression.expression);
281
- } else if (ts.isObjectLiteralExpression(expression)) {
318
+ } else if (isObjectLiteralExpression(expression)) {
282
319
  return {
283
320
  properties: expression.properties.map((property) => {
284
- if (ts.isPropertyAssignment(property) && (ts.isStringLiteral(property.name) || ts.isIdentifier(property.name))) {
285
- if (ts.isIdentifier(property.initializer))
321
+ if (isPropertyAssignment(property) && (isStringLiteral$7(property.name) || isIdentifier$6(property.name))) {
322
+ if (isIdentifier$6(property.initializer))
286
323
  return {
287
324
  name: property.name.text,
288
325
  assignedFrom: this.resolveIdentifier(property.initializer)
289
326
  };
290
- else if (ts.isObjectLiteralExpression(property.initializer)) {
327
+ else if (isObjectLiteralExpression(property.initializer)) {
291
328
  let nestedProperty = this.resolvePropertyAccessChain(
292
329
  property.initializer
293
330
  );
294
331
  nestedProperty.name = property.name.text;
295
332
  return nestedProperty;
296
- } else if (ts.isArrowFunction(property.initializer) || ts.isFunctionExpression(property.initializer)) {
333
+ } else if (isArrowFunction$2(property.initializer) || isFunctionExpression(property.initializer)) {
297
334
  return {
298
335
  name: property.name.text,
299
336
  root: mkFunctionVariableRoot(property.initializer)
@@ -303,18 +340,18 @@ class NameBindingResolver {
303
340
  name: property.name.text,
304
341
  root: mkLiteralVariableRoot(property.initializer)
305
342
  };
306
- } else if (ts.isShorthandPropertyAssignment(property))
343
+ } else if (isShorthandPropertyAssignment(property))
307
344
  return {
308
345
  name: property.name.text,
309
346
  assignedFrom: this.resolveIdentifier(property.name)
310
347
  };
311
348
  })
312
349
  };
313
- } else if (ts.isArrowFunction(expression) || ts.isFunctionExpression(expression)) {
350
+ } else if (isArrowFunction$2(expression) || isFunctionExpression(expression)) {
314
351
  return { root: mkFunctionVariableRoot(expression) };
315
- } else if (ts.isCallExpression(expression)) {
352
+ } else if (isCallExpression$6(expression)) {
316
353
  return { root: mkFunctionCallVariableRoot(expression) };
317
- } else if (ts.isStringLiteral(expression) || ts.isNumericLiteral(expression) || ts.isToken(expression) && expression.kind === ts.SyntaxKind.TrueKeyword || ts.isToken(expression) && expression.kind === ts.SyntaxKind.FalseKeyword) {
354
+ } else if (isStringLiteral$7(expression) || isNumericLiteral(expression) || isToken(expression) && expression.kind === SyntaxKind$5.TrueKeyword || isToken(expression) && expression.kind === SyntaxKind$5.FalseKeyword) {
318
355
  return { root: mkLiteralVariableRoot(expression) };
319
356
  } else {
320
357
  return { root: mkOtherVariableRoot(expression) };
@@ -354,14 +391,14 @@ class NameBindingResolver {
354
391
  /* namedImport */
355
392
  );
356
393
  let namedBindings = node.importClause.namedBindings;
357
- if (ts.isNamespaceImport(namedBindings)) {
394
+ if (isNamespaceImport(namedBindings)) {
358
395
  let variable = mkVariable({
359
396
  name: namedBindings.name.text,
360
397
  definingStatement: node,
361
398
  root
362
399
  });
363
400
  this.variables.set(namedBindings.name.text, variable);
364
- } else if (ts.isNamedImports(namedBindings)) {
401
+ } else if (isNamedImports(namedBindings)) {
365
402
  namedBindings.elements.forEach((importSpecifier) => {
366
403
  if (!importSpecifier.isTypeOnly) {
367
404
  let variable = mkVariable({
@@ -393,19 +430,31 @@ function flattenVariable(variable, path2 = []) {
393
430
  } else
394
431
  return { path: path2, root: variable.root };
395
432
  }
433
+ const require$h = createRequire(import.meta.url);
434
+ const tsModule$h = require$h("typescript");
435
+ const { isIdentifier: isIdentifier$5, isPropertyAccessExpression: isPropertyAccessExpression$4 } = tsModule$h;
396
436
  function isIdentifierOrPropertyAccessExpression(node) {
397
- return ts.isIdentifier(node) || ts.isPropertyAccessExpression(node);
437
+ return isIdentifier$5(node) || isPropertyAccessExpression$4(node);
398
438
  }
399
439
  function byAnd() {
400
440
  return (agg, value) => agg && value;
401
441
  }
442
+ const require$g = createRequire(import.meta.url);
443
+ const tsModule$g = require$g("typescript");
444
+ const {
445
+ isBlock: isBlock$3,
446
+ isCallExpression: isCallExpression$5,
447
+ isExpressionStatement: isExpressionStatement$1,
448
+ isIdentifier: isIdentifier$4,
449
+ isPropertyAccessExpression: isPropertyAccessExpression$3
450
+ } = tsModule$g;
402
451
  function findEventHandlersBlock(functionDeclaration, bindingResolver) {
403
452
  const foundEventHandlers = [];
404
453
  const foundEventHandlerFunctionsToHandlerIndex = /* @__PURE__ */ new Map();
405
454
  let nextEventHandlerIndex = 0;
406
- if (ts.isBlock(functionDeclaration.body)) {
455
+ if (isBlock$3(functionDeclaration.body)) {
407
456
  functionDeclaration.body.statements.forEach((statement) => {
408
- if (ts.isExpressionStatement(statement) && ts.isCallExpression(statement.expression)) {
457
+ if (isExpressionStatement$1(statement) && isCallExpression$5(statement.expression)) {
409
458
  if (isIdentifierOrPropertyAccessExpression(statement.expression.expression)) {
410
459
  let functionVariable = bindingResolver.explain(statement.expression.expression);
411
460
  let accessChain = flattenVariable(functionVariable);
@@ -417,7 +466,7 @@ function findEventHandlersBlock(functionDeclaration, bindingResolver) {
417
466
  eventHandlerCallStatement: statement,
418
467
  handlerIndex: nextEventHandlerIndex++
419
468
  });
420
- else if (ts.isIdentifier(handler) || ts.isPropertyAccessExpression(handler)) {
469
+ else if (isIdentifier$4(handler) || isPropertyAccessExpression$3(handler)) {
421
470
  let flattenedHandler = flattenVariable(
422
471
  bindingResolver.explain(handler)
423
472
  );
@@ -437,6 +486,26 @@ function findEventHandlersBlock(functionDeclaration, bindingResolver) {
437
486
  }
438
487
  return foundEventHandlers;
439
488
  }
489
+ const require$f = createRequire(import.meta.url);
490
+ const tsModule$f = require$f("typescript");
491
+ const {
492
+ visitNode: visitNode$3,
493
+ isArrayTypeNode,
494
+ isBlock: isBlock$2,
495
+ isForInStatement: isForInStatement$1,
496
+ isForOfStatement: isForOfStatement$1,
497
+ isForStatement: isForStatement$1,
498
+ isFunctionDeclaration: isFunctionDeclaration$1,
499
+ isFunctionTypeNode,
500
+ isIdentifier: isIdentifier$3,
501
+ isImportDeclaration: isImportDeclaration$3,
502
+ isStringLiteral: isStringLiteral$6,
503
+ isTypeReferenceNode: isTypeReferenceNode$1,
504
+ isUnionTypeNode,
505
+ isVariableDeclarationList,
506
+ isVariableStatement: isVariableStatement$2,
507
+ SyntaxKind: SyntaxKind$4
508
+ } = tsModule$f;
440
509
  const BUILT_IN_TYPES = ["RegExp", "Date"];
441
510
  function builtInType(text) {
442
511
  return BUILT_IN_TYPES.findIndex((_) => _ === text) > -1;
@@ -450,8 +519,8 @@ class BuiltInResolvedType {
450
519
  }
451
520
  }
452
521
  class ImportFromModuleResolvedType {
453
- constructor(module2, path2) {
454
- this.module = module2;
522
+ constructor(module, path2) {
523
+ this.module = module;
455
524
  this.path = path2;
456
525
  }
457
526
  canBeAssignedFrom(rightSide) {
@@ -526,18 +595,18 @@ class SourceFileBindingResolver {
526
595
  nbResolversQueue.unshift(new NameBindingResolver(nbResolversQueue[0]));
527
596
  this.nameBindingResolvers.set(node, nbResolversQueue[0]);
528
597
  callback();
529
- node.getChildren().forEach((child) => ts.visitNode(child, visitor));
598
+ node.getChildren().forEach((child) => visitNode$3(child, visitor));
530
599
  nbResolversQueue.shift();
531
600
  return node;
532
601
  };
533
602
  const visitor = (node) => {
534
- if (ts.isFunctionDeclaration(node))
603
+ if (isFunctionDeclaration$1(node))
535
604
  nbResolversQueue[0].addFunctionDeclaration(node);
536
- if (ts.isVariableStatement(node))
605
+ if (isVariableStatement$2(node))
537
606
  nbResolversQueue[0].addVariableStatement(node);
538
- else if (ts.isImportDeclaration(node))
607
+ else if (isImportDeclaration$3(node))
539
608
  nbResolversQueue[0].addImportDeclaration(node);
540
- else if (ts.isBlock(node))
609
+ else if (isBlock$2(node))
541
610
  return doWithChildBindingResolver(node, () => {
542
611
  });
543
612
  else if (isFunctionLikeDeclarationBase(node)) {
@@ -545,14 +614,14 @@ class SourceFileBindingResolver {
545
614
  node,
546
615
  () => nbResolversQueue[0].addFunctionParams(node)
547
616
  );
548
- } else if (ts.isForStatement(node) && ts.isVariableDeclarationList(node.initializer)) {
617
+ } else if (isForStatement$1(node) && isVariableDeclarationList(node.initializer)) {
549
618
  return doWithChildBindingResolver(
550
619
  node,
551
620
  () => nbResolversQueue[0].addVariableDeclarationList(
552
621
  node.initializer
553
622
  )
554
623
  );
555
- } else if ((ts.isForInStatement(node) || ts.isForOfStatement(node)) && ts.isVariableDeclarationList(node.initializer) && node.initializer.declarations.length === 1 && ts.isIdentifier(node.initializer.declarations[0].name)) {
624
+ } else if ((isForInStatement$1(node) || isForOfStatement$1(node)) && isVariableDeclarationList(node.initializer) && node.initializer.declarations.length === 1 && isIdentifier$3(node.initializer.declarations[0].name)) {
556
625
  return doWithChildBindingResolver(node, () => {
557
626
  let name = node.initializer.declarations[0].name.text;
558
627
  nbResolversQueue[0].addVariable(
@@ -565,10 +634,10 @@ class SourceFileBindingResolver {
565
634
  );
566
635
  });
567
636
  }
568
- node.getChildren().forEach((child) => ts.visitNode(child, visitor));
637
+ node.getChildren().forEach((child) => visitNode$3(child, visitor));
569
638
  return node;
570
639
  };
571
- ts.visitNode(sourceFile, visitor);
640
+ visitNode$3(sourceFile, visitor);
572
641
  }
573
642
  findBindingResolver(node) {
574
643
  let found;
@@ -581,7 +650,7 @@ class SourceFileBindingResolver {
581
650
  }
582
651
  explainFlattenedVariableType(flattened) {
583
652
  if (!!flattened.root) {
584
- if (isImportModuleVariableRoot(flattened.root) && ts.isStringLiteral(flattened.root.module)) {
653
+ if (isImportModuleVariableRoot(flattened.root) && isStringLiteral$6(flattened.root.module)) {
585
654
  return new ImportFromModuleResolvedType(flattened.root.module.text, flattened.path);
586
655
  }
587
656
  } else
@@ -589,9 +658,9 @@ class SourceFileBindingResolver {
589
658
  }
590
659
  explainType(type) {
591
660
  if (type) {
592
- if (ts.isTypeReferenceNode(type)) {
661
+ if (isTypeReferenceNode$1(type)) {
593
662
  let typeName = type.typeName;
594
- if (ts.isIdentifier(typeName)) {
663
+ if (isIdentifier$3(typeName)) {
595
664
  let resolved = this.findBindingResolver(typeName).resolveIdentifier(typeName);
596
665
  let flattened = flattenVariable(resolved);
597
666
  let typeFromFlattened = this.explainFlattenedVariableType(flattened);
@@ -600,23 +669,23 @@ class SourceFileBindingResolver {
600
669
  if (builtInType(typeName.text))
601
670
  return new BuiltInResolvedType(typeName.text);
602
671
  }
603
- } else if (type.kind === ts.SyntaxKind.StringKeyword)
672
+ } else if (type.kind === SyntaxKind$4.StringKeyword)
604
673
  return new BuiltInResolvedType("string");
605
- else if (type.kind === ts.SyntaxKind.NumberKeyword)
674
+ else if (type.kind === SyntaxKind$4.NumberKeyword)
606
675
  return new BuiltInResolvedType("number");
607
- else if (type.kind === ts.SyntaxKind.BooleanKeyword)
676
+ else if (type.kind === SyntaxKind$4.BooleanKeyword)
608
677
  return new BuiltInResolvedType("boolean");
609
- else if (type.kind === ts.SyntaxKind.AnyKeyword)
678
+ else if (type.kind === SyntaxKind$4.AnyKeyword)
610
679
  return new BuiltInResolvedType("any");
611
- else if (type.kind === ts.SyntaxKind.VoidKeyword)
680
+ else if (type.kind === SyntaxKind$4.VoidKeyword)
612
681
  return new BuiltInResolvedType("void");
613
- else if (ts.isArrayTypeNode(type))
682
+ else if (isArrayTypeNode(type))
614
683
  return new ArrayResolvedType(this.explainType(type.elementType));
615
- else if (ts.isFunctionTypeNode(type)) {
684
+ else if (isFunctionTypeNode(type)) {
616
685
  const params = type.parameters.map((param) => this.explainType(param.type));
617
686
  const ret = this.explainType(type.type);
618
687
  return new FunctionResolvedType(params, ret);
619
- } else if (ts.isUnionTypeNode(type))
688
+ } else if (isUnionTypeNode(type))
620
689
  return new UnionResolvedType(type.types.map((aType) => this.explainType(aType)));
621
690
  }
622
691
  return new BuiltInResolvedType("void");
@@ -628,6 +697,23 @@ class SourceFileBindingResolver {
628
697
  function areResolvedTypesCompatible(type1, type2) {
629
698
  return type1.canBeAssignedFrom(type2);
630
699
  }
700
+ const require$e = createRequire(import.meta.url);
701
+ const tsModule$e = require$e("typescript");
702
+ const {
703
+ visitEachChild: visitEachChild$4,
704
+ isBinaryExpression: isBinaryExpression$1,
705
+ isCallExpression: isCallExpression$4,
706
+ isDecorator,
707
+ isExpressionStatement,
708
+ isFunctionDeclaration,
709
+ isIdentifier: isIdentifier$2,
710
+ isNewExpression: isNewExpression$1,
711
+ isPropertyAccessExpression: isPropertyAccessExpression$2,
712
+ isReturnStatement,
713
+ isSpreadElement,
714
+ SyntaxKind: SyntaxKind$3,
715
+ transform
716
+ } = tsModule$e;
631
717
  var CompilePatternType = /* @__PURE__ */ ((CompilePatternType2) => {
632
718
  CompilePatternType2[CompilePatternType2["RETURN"] = 0] = "RETURN";
633
719
  CompilePatternType2[CompilePatternType2["CALL"] = 1] = "CALL";
@@ -670,7 +756,7 @@ function extractArgumentType(argument, sourceFileBinding, node) {
670
756
  return sourceFileBinding.explainType(node.parameters[paramIndex].type);
671
757
  }
672
758
  }
673
- if (ts.isSpreadElement(argument)) {
759
+ if (isSpreadElement(argument)) {
674
760
  return new SpreadResolvedType(
675
761
  extractArgumentType(argument.expression, sourceFileBinding, node)
676
762
  );
@@ -688,10 +774,10 @@ function compileFunctionSplitPatternsBlock(patternFiles) {
688
774
  patternFiles.forEach((patternsFile) => {
689
775
  const sourceFileBinding = new SourceFileBindingResolver(patternsFile);
690
776
  const findPatternFunctions = (node) => {
691
- if (ts.isFunctionDeclaration(node)) {
777
+ if (isFunctionDeclaration(node)) {
692
778
  let declaredTargetEnv = 0;
693
779
  node.modifiers && node.modifiers.forEach((modifier) => {
694
- if (ts.isDecorator(modifier) && ts.isCallExpression(modifier.expression) && ts.isIdentifier(modifier.expression.expression) && modifier.expression.expression.text === "JayPattern" && modifier.expression.arguments.length === 1 && ts.isPropertyAccessExpression(modifier.expression.arguments[0]) && ts.isIdentifier(modifier.expression.arguments[0].expression) && modifier.expression.arguments[0].expression.text === "JayTargetEnv" && modifier.expression.arguments[0].name.text === "any")
780
+ if (isDecorator(modifier) && isCallExpression$4(modifier.expression) && isIdentifier$2(modifier.expression.expression) && modifier.expression.expression.text === "JayPattern" && modifier.expression.arguments.length === 1 && isPropertyAccessExpression$2(modifier.expression.arguments[0]) && isIdentifier$2(modifier.expression.arguments[0].expression) && modifier.expression.arguments[0].expression.text === "JayTargetEnv" && modifier.expression.arguments[0].name.text === "any")
695
781
  declaredTargetEnv = 1;
696
782
  });
697
783
  let name = node.name.text;
@@ -700,11 +786,11 @@ function compileFunctionSplitPatternsBlock(patternFiles) {
700
786
  let patternType;
701
787
  let leftHandSide;
702
788
  let callArgumentTypes = [];
703
- if (ts.isReturnStatement(statement) && isIdentifierOrPropertyAccessExpression(statement.expression)) {
789
+ if (isReturnStatement(statement) && isIdentifierOrPropertyAccessExpression(statement.expression)) {
704
790
  patternType = 0;
705
791
  leftHandSide = statement.expression;
706
792
  patternTargetEnv = 1;
707
- } else if (ts.isReturnStatement(statement) && ts.isCallExpression(statement.expression) && isIdentifierOrPropertyAccessExpression(statement.expression.expression) && node.type) {
793
+ } else if (isReturnStatement(statement) && isCallExpression$4(statement.expression) && isIdentifierOrPropertyAccessExpression(statement.expression.expression) && node.type) {
708
794
  patternType = 2;
709
795
  leftHandSide = statement.expression.expression;
710
796
  callArgumentTypes = extractArgumentTypes(
@@ -712,7 +798,7 @@ function compileFunctionSplitPatternsBlock(patternFiles) {
712
798
  sourceFileBinding,
713
799
  node
714
800
  );
715
- } else if (ts.isReturnStatement(statement) && ts.isNewExpression(statement.expression) && isIdentifierOrPropertyAccessExpression(statement.expression.expression)) {
801
+ } else if (isReturnStatement(statement) && isNewExpression$1(statement.expression) && isIdentifierOrPropertyAccessExpression(statement.expression.expression)) {
716
802
  patternType = 2;
717
803
  leftHandSide = statement.expression.expression;
718
804
  callArgumentTypes = extractArgumentTypes(
@@ -720,7 +806,7 @@ function compileFunctionSplitPatternsBlock(patternFiles) {
720
806
  sourceFileBinding,
721
807
  node
722
808
  );
723
- } else if (ts.isExpressionStatement(statement) && ts.isCallExpression(statement.expression) && isIdentifierOrPropertyAccessExpression(statement.expression.expression)) {
809
+ } else if (isExpressionStatement(statement) && isCallExpression$4(statement.expression) && isIdentifierOrPropertyAccessExpression(statement.expression.expression)) {
724
810
  patternType = 1;
725
811
  leftHandSide = statement.expression.expression;
726
812
  callArgumentTypes = extractArgumentTypes(
@@ -728,7 +814,7 @@ function compileFunctionSplitPatternsBlock(patternFiles) {
728
814
  sourceFileBinding,
729
815
  node
730
816
  );
731
- } else if (ts.isExpressionStatement(statement) && ts.isBinaryExpression(statement.expression) && ts.isPropertyAccessExpression(statement.expression.left) && statement.expression.operatorToken.kind === ts.SyntaxKind.EqualsToken && ts.isIdentifier(statement.expression.right)) {
817
+ } else if (isExpressionStatement(statement) && isBinaryExpression$1(statement.expression) && isPropertyAccessExpression$2(statement.expression.left) && statement.expression.operatorToken.kind === SyntaxKind$3.EqualsToken && isIdentifier$2(statement.expression.right)) {
732
818
  patternType = 3;
733
819
  leftHandSide = statement.expression.left;
734
820
  callArgumentTypes = [
@@ -771,15 +857,18 @@ function compileFunctionSplitPatternsBlock(patternFiles) {
771
857
  }
772
858
  return node;
773
859
  };
774
- ts.transform(patternsFile, [
860
+ transform(patternsFile, [
775
861
  mkTransformer(({ context, sourceFile }) => {
776
- ts.visitEachChild(patternsFile, findPatternFunctions, context);
862
+ visitEachChild$4(patternsFile, findPatternFunctions, context);
777
863
  return sourceFile;
778
864
  })
779
865
  ]);
780
866
  });
781
- return new compilerShared.WithValidations(compiledPatterns, validations);
867
+ return new WithValidations(compiledPatterns, validations);
782
868
  }
869
+ const require$d = createRequire(import.meta.url);
870
+ const tsModule$d = require$d("typescript");
871
+ const { visitEachChild: visitEachChild$3, visitNode: visitNode$2 } = tsModule$d;
783
872
  function visitWithContext(node, initialContext, contextualVisitor) {
784
873
  return visitWithContext2(node, initialContext, void 0, contextualVisitor);
785
874
  }
@@ -788,28 +877,31 @@ function visitWithContext2(node, initialContext, transformationContext, contextu
788
877
  const visitChild = (node2, childContext) => {
789
878
  if (childContext)
790
879
  contexts.push(childContext);
791
- let visitedNode = ts.visitNode(node2, visitor);
880
+ let visitedNode = visitNode$2(node2, visitor);
792
881
  if (childContext)
793
882
  contexts.pop();
794
883
  return visitedNode;
795
884
  };
796
- const visitEachChild = (node2, childContext) => {
885
+ const _visitEachChild = (node2, childContext) => {
797
886
  if (childContext)
798
887
  contexts.push(childContext);
799
- let visitedNode = ts.visitEachChild(node2, visitor, transformationContext);
888
+ let visitedNode = visitEachChild$3(node2, visitor, transformationContext);
800
889
  if (childContext)
801
890
  contexts.pop();
802
891
  return visitedNode;
803
892
  };
804
893
  const visitor = (node2) => {
805
- return contextualVisitor(node2, contexts.at(-1), visitChild, visitEachChild);
894
+ return contextualVisitor(node2, contexts.at(-1), visitChild, _visitEachChild);
806
895
  };
807
- return ts.visitNode(node, visitor);
896
+ return visitNode$2(node, visitor);
808
897
  }
898
+ const require$c = createRequire(import.meta.url);
899
+ const tsModule$c = require$c("typescript");
900
+ const { isTypeReferenceNode } = tsModule$c;
809
901
  function isFirstParamJayEvent(eventHandler, bindingResolver) {
810
902
  if (eventHandler.parameters.length > 0 && eventHandler.parameters[0].type) {
811
903
  const explainedType = bindingResolver.explainType(eventHandler.parameters[0].type);
812
- if (ts.isTypeReferenceNode(eventHandler.parameters[0].type) && eventHandler.parameters[0].type.typeArguments?.length === 2 && explainedType instanceof ImportFromModuleResolvedType && explainedType.module === "@jay-framework/runtime" && explainedType.path.length === 1 && explainedType.path[0] === "JayEvent")
904
+ if (isTypeReferenceNode(eventHandler.parameters[0].type) && eventHandler.parameters[0].type.typeArguments?.length === 2 && explainedType instanceof ImportFromModuleResolvedType && explainedType.module === "@jay-framework/runtime" && explainedType.path.length === 1 && explainedType.path[0] === "JayEvent")
813
905
  return true;
814
906
  }
815
907
  return false;
@@ -820,6 +912,18 @@ function filterEventHandlersToHaveJayEventType(foundEventHandlers, bindingResolv
820
912
  return isFirstParamJayEvent(eventHandler, bindingResolver);
821
913
  });
822
914
  }
915
+ const require$b = createRequire(import.meta.url);
916
+ const tsModule$b = require$b("typescript");
917
+ const {
918
+ SyntaxKind: SyntaxKind$2,
919
+ visitEachChild: visitEachChild$2,
920
+ visitNode: visitNode$1,
921
+ isBlock: isBlock$1,
922
+ isExpression: isExpression$1,
923
+ isIdentifier: isIdentifier$1,
924
+ isLiteralExpression: isLiteralExpression$1,
925
+ isStatement: isStatement$1
926
+ } = tsModule$b;
823
927
  function generateFunctionRepository(matchedReturnPatterns, matchedVariableReads, matchedConstants, safeStatements) {
824
928
  const constCode = [...new Set(matchedConstants)].join("\n");
825
929
  let readPatternsReturnProperties = matchedReturnPatterns.map(
@@ -862,8 +966,8 @@ const mkTransformEventHandlerStatementVisitor = (factory, context, bindingResolv
862
966
  }
863
967
  return patternIndexes.get(pattern);
864
968
  };
865
- const visitor = (node, { parentStatementTargetEnv }, visitChild, visitEachChild) => {
866
- if (ts.isStatement(node)) {
969
+ const visitor = (node, { parentStatementTargetEnv }, visitChild, visitEachChild2) => {
970
+ if (isStatement$1(node)) {
867
971
  let statementAnalysis = analyzer.getStatementStatus(node);
868
972
  if (statementAnalysis)
869
973
  parentStatementTargetEnv = intersectJayTargetEnv(
@@ -871,7 +975,7 @@ const mkTransformEventHandlerStatementVisitor = (factory, context, bindingResolv
871
975
  statementAnalysis.targetEnv
872
976
  );
873
977
  }
874
- if (ts.isBlock(node) && parentStatementTargetEnv !== JayTargetEnv.sandbox) {
978
+ if (isBlock$1(node) && parentStatementTargetEnv !== JayTargetEnv.sandbox) {
875
979
  let sandboxStatements = [], mainStatements = [];
876
980
  node.statements.forEach((statement) => {
877
981
  let statementAnalysis = analyzer.getStatementStatus(statement);
@@ -896,20 +1000,20 @@ const mkTransformEventHandlerStatementVisitor = (factory, context, bindingResolv
896
1000
  );
897
1001
  node = factory.updateBlock(node, sandboxStatements);
898
1002
  return node;
899
- } else if (ts.isExpression(node)) {
1003
+ } else if (isExpression$1(node)) {
900
1004
  let expressionAnalysis = analyzer.getExpressionStatus(node);
901
1005
  if (expressionAnalysis) {
902
1006
  let pattern = expressionAnalysis.patterns[0];
903
1007
  let patternKey = getPatternIndex(pattern);
904
1008
  if (pattern.patternType === CompilePatternType.RETURN)
905
1009
  sideEffects.matchedReturnPatterns.push({ pattern, patternKey });
906
- else if (pattern.patternType === CompilePatternType.KNOWN_VARIABLE_READ && ts.isIdentifier(node))
1010
+ else if (pattern.patternType === CompilePatternType.KNOWN_VARIABLE_READ && isIdentifier$1(node))
907
1011
  sideEffects.matchedVariableReads.push({ variable: node, patternKey });
908
- else if (pattern.patternType === CompilePatternType.CONST_READ && ts.isIdentifier(node)) {
1012
+ else if (pattern.patternType === CompilePatternType.CONST_READ && isIdentifier$1(node)) {
909
1013
  let constant = bindingResolver.explain(node);
910
1014
  let flattenedConstant = flattenVariable(constant);
911
1015
  let literal = flattenedConstant.root.literal;
912
- if (ts.isLiteralExpression(literal)) {
1016
+ if (isLiteralExpression$1(literal)) {
913
1017
  let constantValue = literal.text;
914
1018
  sideEffects.matchedConstants.push(`const ${node.text} = ${constantValue}`);
915
1019
  }
@@ -921,7 +1025,7 @@ const mkTransformEventHandlerStatementVisitor = (factory, context, bindingResolv
921
1025
  return codeToAst(replacementPattern, context)[0].expression;
922
1026
  }
923
1027
  }
924
- return visitEachChild(node, { parentStatementTargetEnv });
1028
+ return visitEachChild2(node, { parentStatementTargetEnv });
925
1029
  };
926
1030
  return { visitor, sideEffects };
927
1031
  };
@@ -945,26 +1049,26 @@ const analyzeEventHandlerByPatternBlock = (context, bindingResolver, analyzer, f
945
1049
  const transformedJayEventType = factory.createTypeReferenceNode(
946
1050
  originalJayEventType.typeName,
947
1051
  [
948
- factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword),
1052
+ factory.createKeywordTypeNode(SyntaxKind$2.AnyKeyword),
949
1053
  originalJayEventType.typeArguments[1]
950
1054
  ]
951
1055
  );
952
1056
  let visitor2 = (node) => {
953
1057
  if (node === originalJayEventType) {
954
- return ts.visitEachChild(transformedJayEventType, visitor2, context);
1058
+ return visitEachChild$2(transformedJayEventType, visitor2, context);
955
1059
  }
956
- return ts.visitEachChild(node, visitor2, context);
1060
+ return visitEachChild$2(node, visitor2, context);
957
1061
  };
958
- transformedEventHandler = ts.visitEachChild(transformedEventHandler, visitor2, context);
1062
+ transformedEventHandler = visitEachChild$2(transformedEventHandler, visitor2, context);
959
1063
  }
960
1064
  let bodyForFunctionRepository = void 0;
961
- if (ts.isBlock(eventHandler.body) && sideEffects.mainContextBlocks.has(eventHandler.body)) {
1065
+ if (isBlock$1(eventHandler.body) && sideEffects.mainContextBlocks.has(eventHandler.body)) {
962
1066
  let body = sideEffects.mainContextBlocks.get(eventHandler.body);
963
1067
  const replaceBodiesVisitor = (node) => {
964
- let mainNode = ts.isBlock(node) && sideEffects.mainContextBlocks.has(node) ? sideEffects.mainContextBlocks.get(node) : node;
965
- return ts.visitEachChild(mainNode, replaceBodiesVisitor, context);
1068
+ let mainNode = isBlock$1(node) && sideEffects.mainContextBlocks.has(node) ? sideEffects.mainContextBlocks.get(node) : node;
1069
+ return visitEachChild$2(mainNode, replaceBodiesVisitor, context);
966
1070
  };
967
- bodyForFunctionRepository = ts.visitNode(body, replaceBodiesVisitor);
1071
+ bodyForFunctionRepository = visitNode$1(body, replaceBodiesVisitor);
968
1072
  }
969
1073
  const { handlerCode, key } = generateFunctionRepository(
970
1074
  sideEffects.matchedReturnPatterns,
@@ -986,8 +1090,11 @@ const analyzeEventHandlerByPatternBlock = (context, bindingResolver, analyzer, f
986
1090
  wasEventHandlerTransformed: false
987
1091
  };
988
1092
  };
1093
+ const require$a = createRequire(import.meta.url);
1094
+ const tsModule$a = require$a("typescript");
1095
+ const { visitEachChild: visitEachChild$1, isCallExpression: isCallExpression$3, isPropertyAccessExpression: isPropertyAccessExpression$1 } = tsModule$a;
989
1096
  const analyzeEventHandlerCall = (context, factory, handlerKey) => (node) => {
990
- if (ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression)) {
1097
+ if (isCallExpression$3(node) && isPropertyAccessExpression$1(node.expression)) {
991
1098
  return factory.createCallExpression(
992
1099
  factory.createPropertyAccessExpression(
993
1100
  factory.createCallExpression(
@@ -1009,11 +1116,7 @@ const analyzeEventHandlerCall = (context, factory, handlerKey) => (node) => {
1009
1116
  return node;
1010
1117
  };
1011
1118
  const analyzeEventHandlerCallStatement$Block = (context, factory, handlerKey) => (node) => {
1012
- return ts.visitEachChild(
1013
- node,
1014
- analyzeEventHandlerCall(context, factory, handlerKey),
1015
- context
1016
- );
1119
+ return visitEachChild$1(node, analyzeEventHandlerCall(context, factory, handlerKey), context);
1017
1120
  };
1018
1121
  function analyzedEventHandlersToReplaceMap(transformedEventHandlers) {
1019
1122
  const map = /* @__PURE__ */ new Map();
@@ -1057,6 +1160,27 @@ function analyzeEventHandlers(context, bindingResolver, analyzer, factory, found
1057
1160
  };
1058
1161
  });
1059
1162
  }
1163
+ const require$9 = createRequire(import.meta.url);
1164
+ const tsModule$9 = require$9("typescript");
1165
+ const {
1166
+ isArrowFunction: isArrowFunction$1,
1167
+ isBinaryExpression,
1168
+ isBlock,
1169
+ isCallExpression: isCallExpression$2,
1170
+ isDoStatement,
1171
+ isElementAccessExpression,
1172
+ isForInStatement,
1173
+ isForOfStatement,
1174
+ isForStatement,
1175
+ isIfStatement,
1176
+ isLiteralExpression,
1177
+ isNewExpression,
1178
+ isPropertyAccessExpression,
1179
+ isStatement,
1180
+ isVariableStatement: isVariableStatement$1,
1181
+ isWhileStatement,
1182
+ SyntaxKind: SyntaxKind$1
1183
+ } = tsModule$9;
1060
1184
  class SourceFileStatementAnalyzer {
1061
1185
  constructor(sourceFile, bindingResolver, compiledPatterns) {
1062
1186
  this.sourceFile = sourceFile;
@@ -1140,7 +1264,7 @@ class ScopedSourceFileStatementAnalyzer {
1140
1264
  if (matchType === 0) {
1141
1265
  addExpressionStatus(statement, matchedPatterns, expression, true);
1142
1266
  } else {
1143
- if (ts.isPropertyAccessExpression(expression))
1267
+ if (isPropertyAccessExpression(expression))
1144
1268
  visitChild(expression.expression, {
1145
1269
  statement,
1146
1270
  roleInParent: 1
@@ -1155,7 +1279,7 @@ class ScopedSourceFileStatementAnalyzer {
1155
1279
  expressionStatus.patterns[0].returnType,
1156
1280
  matchedPatterns[0].callArgumentTypes[index]
1157
1281
  );
1158
- const isLiteral = ts.isLiteralExpression(argument);
1282
+ const isLiteral = isLiteralExpression(argument);
1159
1283
  let isScopedVariableAccess = false;
1160
1284
  if (isIdentifierOrPropertyAccessExpression(argument)) {
1161
1285
  const variable = this.bindingResolver.explain(argument);
@@ -1189,7 +1313,7 @@ class ScopedSourceFileStatementAnalyzer {
1189
1313
  }).reduce(byAnd(), true);
1190
1314
  addExpressionStatus(statement, matchedPatterns, node, areArgumentsMatching);
1191
1315
  } else {
1192
- if (ts.isPropertyAccessExpression(node.expression))
1316
+ if (isPropertyAccessExpression(node.expression))
1193
1317
  visitChild(node.expression.expression, {
1194
1318
  statement,
1195
1319
  roleInParent: 1
@@ -1207,20 +1331,20 @@ class ScopedSourceFileStatementAnalyzer {
1207
1331
  /* none */
1208
1332
  },
1209
1333
  (node, { statement, roleInParent }, visitChild) => {
1210
- if (ts.isStatement(node))
1334
+ if (isStatement(node))
1211
1335
  statement = node;
1212
1336
  if (roleInParent === 1 || roleInParent === 2) {
1213
1337
  if (isIdentifierOrPropertyAccessExpression(node))
1214
1338
  analyzePropertyExpression(node, visitChild, statement, roleInParent);
1215
- else if (ts.isCallExpression(node) || ts.isNewExpression(node)) {
1339
+ else if (isCallExpression$2(node) || isNewExpression(node)) {
1216
1340
  analyzeCallOrNewExpression(node, visitChild, statement, roleInParent);
1217
1341
  return node;
1218
- } else if (ts.isBinaryExpression(node) && node.operatorToken.kind === ts.SyntaxKind.EqualsToken)
1342
+ } else if (isBinaryExpression(node) && node.operatorToken.kind === SyntaxKind$1.EqualsToken)
1219
1343
  this.markStatementSandbox(statement);
1220
- else if (!ts.isLiteralExpression(node) && !ts.isBinaryExpression(node))
1344
+ else if (!isLiteralExpression(node) && !isBinaryExpression(node))
1221
1345
  this.markStatementSandbox(statement);
1222
1346
  }
1223
- if (ts.isCallExpression(node) && isIdentifierOrPropertyAccessExpression(node.expression) && roleInParent === 0) {
1347
+ if (isCallExpression$2(node) && isIdentifierOrPropertyAccessExpression(node.expression) && roleInParent === 0) {
1224
1348
  analyzeCallOrNewExpression(
1225
1349
  node,
1226
1350
  visitChild,
@@ -1228,7 +1352,7 @@ class ScopedSourceFileStatementAnalyzer {
1228
1352
  3
1229
1353
  /* call */
1230
1354
  );
1231
- } else if (ts.isVariableStatement(node)) {
1355
+ } else if (isVariableStatement$1(node)) {
1232
1356
  node.declarationList.declarations.forEach(
1233
1357
  (declaration) => visitChild(declaration.initializer, {
1234
1358
  statement,
@@ -1238,7 +1362,7 @@ class ScopedSourceFileStatementAnalyzer {
1238
1362
  );
1239
1363
  if (this.getStatementStatus(node)?.targetEnv === JayTargetEnv.any)
1240
1364
  this.getStatementStatus(node).targetEnv = JayTargetEnv.main;
1241
- } else if (ts.isArrowFunction(node) && !ts.isBlock(node.body)) {
1365
+ } else if (isArrowFunction$1(node) && !isBlock(node.body)) {
1242
1366
  visitChild(node.body, {
1243
1367
  statement,
1244
1368
  roleInParent: 1
@@ -1269,7 +1393,7 @@ class ScopedSourceFileStatementAnalyzer {
1269
1393
  true
1270
1394
  );
1271
1395
  }
1272
- } else if (ts.isIfStatement(node)) {
1396
+ } else if (isIfStatement(node)) {
1273
1397
  visitChild(node.expression, {
1274
1398
  statement,
1275
1399
  roleInParent: 1
@@ -1286,7 +1410,7 @@ class ScopedSourceFileStatementAnalyzer {
1286
1410
  roleInParent: 0
1287
1411
  /* none */
1288
1412
  });
1289
- } else if (ts.isForStatement(node) || ts.isForOfStatement(node) || ts.isForInStatement(node) || ts.isWhileStatement(node) || ts.isDoStatement(node)) {
1413
+ } else if (isForStatement(node) || isForOfStatement(node) || isForInStatement(node) || isWhileStatement(node) || isDoStatement(node)) {
1290
1414
  this.markStatementSandbox(statement);
1291
1415
  node.getChildren().forEach(
1292
1416
  (child) => visitChild(child, {
@@ -1295,7 +1419,7 @@ class ScopedSourceFileStatementAnalyzer {
1295
1419
  /* none */
1296
1420
  })
1297
1421
  );
1298
- } else if (ts.isBinaryExpression(node)) {
1422
+ } else if (isBinaryExpression(node)) {
1299
1423
  visitChild(node.right, {
1300
1424
  statement,
1301
1425
  roleInParent: 1
@@ -1303,10 +1427,10 @@ class ScopedSourceFileStatementAnalyzer {
1303
1427
  });
1304
1428
  visitChild(node.left, {
1305
1429
  statement,
1306
- roleInParent: node.operatorToken.kind === ts.SyntaxKind.EqualsToken ? 2 : 1
1430
+ roleInParent: node.operatorToken.kind === SyntaxKind$1.EqualsToken ? 2 : 1
1307
1431
  /* read */
1308
1432
  });
1309
- } else if (ts.isElementAccessExpression(node)) {
1433
+ } else if (isElementAccessExpression(node)) {
1310
1434
  node.getChildren().forEach(
1311
1435
  (child) => visitChild(child, {
1312
1436
  statement,
@@ -1456,6 +1580,9 @@ function isChildOf(node, parent) {
1456
1580
  return true;
1457
1581
  return isChildOf(node.parent, parent);
1458
1582
  }
1583
+ const require$8 = createRequire(import.meta.url);
1584
+ const tsModule$8 = require$8("typescript");
1585
+ const { forEachChild: forEachChild$1, isCallExpression: isCallExpression$1, isStringLiteral: isStringLiteral$5, isVariableStatement } = tsModule$8;
1459
1586
  var FindComponentConstructorType = /* @__PURE__ */ ((FindComponentConstructorType2) => {
1460
1587
  FindComponentConstructorType2["makeJayComponent"] = "makeJayComponent";
1461
1588
  FindComponentConstructorType2["makeJayTsxComponent"] = "makeJayTsxComponent";
@@ -1463,14 +1590,14 @@ var FindComponentConstructorType = /* @__PURE__ */ ((FindComponentConstructorTyp
1463
1590
  })(FindComponentConstructorType || {});
1464
1591
  function findComponentConstructorCalls(findType, bindingResolver, node) {
1465
1592
  const foundConstructorCalls = [];
1466
- if (ts.isVariableStatement(node)) {
1593
+ if (isVariableStatement(node)) {
1467
1594
  node.declarationList.declarations.forEach((declaration) => {
1468
- if (declaration.initializer && ts.isCallExpression(declaration.initializer) && isIdentifierOrPropertyAccessExpression(declaration.initializer.expression)) {
1595
+ if (declaration.initializer && isCallExpression$1(declaration.initializer) && isIdentifierOrPropertyAccessExpression(declaration.initializer.expression)) {
1469
1596
  const explainedInitializer = bindingResolver.explain(
1470
1597
  declaration.initializer.expression
1471
1598
  );
1472
1599
  const flattened = flattenVariable(explainedInitializer);
1473
- if (flattened.path.length === 1 && flattened.path[0] === findType && flattened.root && isImportModuleVariableRoot(flattened.root) && ts.isStringLiteral(flattened.root.module) && flattened.root.module.text === compilerShared.JAY_COMPONENT) {
1600
+ if (flattened.path.length === 1 && flattened.path[0] === findType && flattened.root && isImportModuleVariableRoot(flattened.root) && isStringLiteral$5(flattened.root.module) && flattened.root.module.text === JAY_COMPONENT) {
1474
1601
  let render = findType === "makeJayComponent" ? declaration.initializer.arguments[0] : void 0;
1475
1602
  let comp = findType === "makeJayComponent" ? declaration.initializer.arguments[1] : declaration.initializer.arguments[0];
1476
1603
  let foundConstructor = {
@@ -1492,9 +1619,9 @@ function findComponentConstructorCallsBlock(findType, bindingResolver, sourceFil
1492
1619
  foundConstructorCalls.push(
1493
1620
  ...findComponentConstructorCalls(findType, bindingResolver, node)
1494
1621
  );
1495
- ts.forEachChild(node, visit);
1622
+ forEachChild$1(node, visit);
1496
1623
  }
1497
- ts.forEachChild(sourceFile, visit);
1624
+ forEachChild$1(sourceFile, visit);
1498
1625
  return foundConstructorCalls;
1499
1626
  }
1500
1627
  class GeneratedFunctionRepository {
@@ -1552,34 +1679,40 @@ export ${_}`
1552
1679
  );
1553
1680
  }
1554
1681
  }
1682
+ const require$7 = createRequire(import.meta.url);
1683
+ const tsModule$7 = require$7("typescript");
1684
+ const { forEachChild, isCallExpression, isIdentifier, isStringLiteral: isStringLiteral$4 } = tsModule$7;
1555
1685
  function findExec$(bindingResolver, sourceFile) {
1556
1686
  const foundExec$ = [];
1557
1687
  function visit(node) {
1558
- if (ts.isCallExpression(node) && ts.isIdentifier(node.expression)) {
1688
+ if (isCallExpression(node) && isIdentifier(node.expression)) {
1559
1689
  const functionVariable = bindingResolver.explain(node.expression);
1560
1690
  const accessChain = flattenVariable(functionVariable);
1561
- if (accessChain.path.length === 1 && accessChain.path[0] === "exec$" && isImportModuleVariableRoot(accessChain.root) && ts.isStringLiteral(accessChain.root.module) && accessChain.root.module.text === "@jay-framework/secure")
1691
+ if (accessChain.path.length === 1 && accessChain.path[0] === "exec$" && isImportModuleVariableRoot(accessChain.root) && isStringLiteral$4(accessChain.root.module) && accessChain.root.module.text === "@jay-framework/secure")
1562
1692
  foundExec$.push(node);
1563
1693
  }
1564
- ts.forEachChild(node, visit);
1694
+ forEachChild(node, visit);
1565
1695
  }
1566
- ts.forEachChild(sourceFile, visit);
1696
+ forEachChild(sourceFile, visit);
1567
1697
  return foundExec$;
1568
1698
  }
1699
+ const require$6 = createRequire(import.meta.url);
1700
+ const tsModule$6 = require$6("typescript");
1701
+ const { visitNode, isArrowFunction, isExpression } = tsModule$6;
1569
1702
  function analyzeGlobalExec$(context, analyzer, functionRepositoryBuilder, foundExec$) {
1570
1703
  const scopedAnalyzer = analyzer.analyzeForScope(foundExec$);
1571
1704
  let foundUnsafeExpression = false;
1572
1705
  const visitor = (node) => {
1573
- if (ts.isExpression(node)) {
1706
+ if (isExpression(node)) {
1574
1707
  const matchedPattern = scopedAnalyzer.getExpressionStatus(node);
1575
1708
  foundUnsafeExpression = foundUnsafeExpression || !matchedPattern || !matchedPattern.subExpressionsMatching;
1576
1709
  } else {
1577
- node.getChildren().forEach((child) => ts.visitNode(child, visitor));
1710
+ node.getChildren().forEach((child) => visitNode(child, visitor));
1578
1711
  }
1579
1712
  return node;
1580
1713
  };
1581
- if (ts.isArrowFunction(foundExec$.arguments[0]))
1582
- ts.visitNode(foundExec$.arguments[0].body, visitor);
1714
+ if (isArrowFunction(foundExec$.arguments[0]))
1715
+ visitNode(foundExec$.arguments[0].body, visitor);
1583
1716
  if (foundUnsafeExpression)
1584
1717
  return { foundExec$, wasTransformed: false };
1585
1718
  else {
@@ -1602,6 +1735,9 @@ function transformedGlobalExec$toReplaceMap(transformedGlobalExec$s) {
1602
1735
  });
1603
1736
  return map;
1604
1737
  }
1738
+ const require$5 = createRequire(import.meta.url);
1739
+ const tsModule$5 = require$5("typescript");
1740
+ const { SyntaxKind, isImportDeclaration: isImportDeclaration$2, isStringLiteral: isStringLiteral$3, isInterfaceDeclaration } = tsModule$5;
1605
1741
  function generateComponentConstructorCalls(context, componentConstructorCalls, hasFunctionRepository) {
1606
1742
  let optionsParam = hasFunctionRepository ? ", { funcRepository }" : "";
1607
1743
  let transformedConstructors = componentConstructorCalls.map(({ name, render }) => {
@@ -1616,7 +1752,7 @@ function generateComponentConstructorCalls(context, componentConstructorCalls, h
1616
1752
  function getRenderImportSpecifier(node) {
1617
1753
  const namedBindings = node.importClause?.namedBindings;
1618
1754
  switch (namedBindings?.kind) {
1619
- case ts.SyntaxKind.NamedImports: {
1755
+ case SyntaxKind.NamedImports: {
1620
1756
  return namedBindings.elements.find((binding) => getImportName(binding) === "render");
1621
1757
  }
1622
1758
  default:
@@ -1624,14 +1760,14 @@ function getRenderImportSpecifier(node) {
1624
1760
  }
1625
1761
  }
1626
1762
  function transformImport(node, importerMode, context, hasFunctionRepository) {
1627
- if (ts.isStringLiteral(node.moduleSpecifier)) {
1628
- if (findMakeJayComponentImport(compilerShared.MAKE_JAY_COMPONENT, node)) {
1763
+ if (isStringLiteral$3(node.moduleSpecifier)) {
1764
+ if (findMakeJayComponentImport(MAKE_JAY_COMPONENT, node)) {
1629
1765
  const code = hasFunctionRepository ? `import { makeJayComponentBridge, FunctionsRepository } from '@jay-framework/secure';` : `import { makeJayComponentBridge } from '@jay-framework/secure';`;
1630
1766
  return codeToAst(code, context)[0];
1631
1767
  }
1632
1768
  const renderImportSpecifier = getRenderImportSpecifier(node);
1633
1769
  if (Boolean(renderImportSpecifier)) {
1634
- const importModule = `${node.moduleSpecifier.text}${compilerShared.getModeFileExtension(
1770
+ const importModule = `${node.moduleSpecifier.text}${getModeFileExtension(
1635
1771
  true,
1636
1772
  importerMode
1637
1773
  )}`;
@@ -1656,9 +1792,9 @@ function transformSourceFile(sourceFile, factory, context, importerMode, compone
1656
1792
  hasFunctionRepository
1657
1793
  );
1658
1794
  let transformedStatements = sourceFile.statements.map((statement) => {
1659
- if (ts.isInterfaceDeclaration(statement))
1795
+ if (isInterfaceDeclaration(statement))
1660
1796
  return statement;
1661
- else if (ts.isImportDeclaration(statement))
1797
+ else if (isImportDeclaration$2(statement))
1662
1798
  return transformImport(statement, importerMode, context, hasFunctionRepository);
1663
1799
  else
1664
1800
  return void 0;
@@ -1722,8 +1858,11 @@ function transformComponentBridge(importerMode, patterns = [], globalFunctionRep
1722
1858
  globalFunctionRepository
1723
1859
  });
1724
1860
  }
1861
+ const require$4 = createRequire(import.meta.url);
1862
+ const tsModule$4 = require$4("typescript");
1863
+ const { isStringLiteral: isStringLiteral$2 } = tsModule$4;
1725
1864
  function transformImportModeFileExtension(node, factory, importerMode) {
1726
- if (!ts.isStringLiteral(node.moduleSpecifier))
1865
+ if (!isStringLiteral$2(node.moduleSpecifier))
1727
1866
  return void 0;
1728
1867
  const originalTarget = node.moduleSpecifier.text;
1729
1868
  if (!isRelativeImport(originalTarget))
@@ -1732,13 +1871,16 @@ function transformImportModeFileExtension(node, factory, importerMode) {
1732
1871
  node,
1733
1872
  node.modifiers,
1734
1873
  node.importClause,
1735
- factory.createStringLiteral(`${originalTarget}${compilerShared.getModeFileExtension(true, importerMode)}`),
1874
+ factory.createStringLiteral(`${originalTarget}${getModeFileExtension(true, importerMode)}`),
1736
1875
  node.attributes
1737
1876
  );
1738
1877
  }
1878
+ const require$3 = createRequire(import.meta.url);
1879
+ const tsModule$3 = require$3("typescript");
1880
+ const { isImportDeclaration: isImportDeclaration$1 } = tsModule$3;
1739
1881
  function findAfterImportStatementIndex(statements) {
1740
1882
  let lastIndex = 0;
1741
- while (ts.isImportDeclaration(statements[lastIndex]))
1883
+ while (isImportDeclaration$1(statements[lastIndex]))
1742
1884
  lastIndex += 1;
1743
1885
  return lastIndex;
1744
1886
  }
@@ -1754,7 +1896,7 @@ function transformComponentImports(needsHandler$, needsFunc$, needsFuncGlobal$,
1754
1896
  const allStatements = [
1755
1897
  ...statements.slice(0, afterImportStatementIndex),
1756
1898
  codeToAst(
1757
- `import { ${importClause} } from '${compilerShared.JAY_SECURE}';`,
1899
+ `import { ${importClause} } from '${JAY_SECURE}';`,
1758
1900
  context
1759
1901
  )[0],
1760
1902
  ...statements.slice(afterImportStatementIndex)
@@ -1763,8 +1905,11 @@ function transformComponentImports(needsHandler$, needsFunc$, needsFuncGlobal$,
1763
1905
  } else
1764
1906
  return transformedSourceFile;
1765
1907
  }
1908
+ const require$2 = createRequire(import.meta.url);
1909
+ const tsModule$2 = require$2("typescript");
1910
+ const { isImportDeclaration, isStringLiteral: isStringLiteral$1, visitEachChild } = tsModule$2;
1766
1911
  function isCssImport(node) {
1767
- return ts.isStringLiteral(node.moduleSpecifier) && node.moduleSpecifier.text.endsWith(".css");
1912
+ return isStringLiteral$1(node.moduleSpecifier) && node.moduleSpecifier.text.endsWith(".css");
1768
1913
  }
1769
1914
  function mkComponentTransformer(sftContext) {
1770
1915
  const { patterns, globalFunctionRepository, context, factory, sourceFile } = sftContext;
@@ -1809,17 +1954,17 @@ function mkComponentTransformer(sftContext) {
1809
1954
  let visitor = (node) => {
1810
1955
  if (replaceMap.has(node)) {
1811
1956
  node = replaceMap.get(node);
1812
- return ts.visitEachChild(node, visitor, context);
1957
+ return visitEachChild(node, visitor, context);
1813
1958
  }
1814
- if (ts.isImportDeclaration(node)) {
1959
+ if (isImportDeclaration(node)) {
1815
1960
  if (isCssImport(node))
1816
1961
  return void 0;
1817
1962
  else
1818
- return transformImportModeFileExtension(node, factory, compilerShared.RuntimeMode.WorkerSandbox);
1963
+ return transformImportModeFileExtension(node, factory, RuntimeMode.WorkerSandbox);
1819
1964
  }
1820
- return ts.visitEachChild(node, visitor, context);
1965
+ return visitEachChild(node, visitor, context);
1821
1966
  };
1822
- let transformedSourceFile = ts.visitEachChild(sftContext.sourceFile, visitor, context);
1967
+ let transformedSourceFile = visitEachChild(sftContext.sourceFile, visitor, context);
1823
1968
  return transformComponentImports(
1824
1969
  transformedEventHandlers.length > 0,
1825
1970
  false,
@@ -1833,11 +1978,14 @@ function mkComponentTransformer(sftContext) {
1833
1978
  function transformComponent(patterns = [], globalFunctionRepository) {
1834
1979
  return mkTransformer(mkComponentTransformer, { patterns, globalFunctionRepository });
1835
1980
  }
1836
- function createTsSourceFileFromSource(filePath, sourceCode, scriptKind = ts__namespace.ScriptKind.TS) {
1981
+ const require$1 = createRequire(import.meta.url);
1982
+ const tsModule$1 = require$1("typescript");
1983
+ const { ScriptTarget, createSourceFile, ScriptKind } = tsModule$1;
1984
+ function createTsSourceFileFromSource(filePath, sourceCode, scriptKind = ScriptKind.TS) {
1837
1985
  try {
1838
- return ts__namespace.createSourceFile(filePath, sourceCode, ts__namespace.ScriptTarget.Latest, true, scriptKind);
1986
+ return createSourceFile(filePath, sourceCode, ScriptTarget.Latest, true, scriptKind);
1839
1987
  } catch (error) {
1840
- throw compilerShared.withOriginalTrace(
1988
+ throw withOriginalTrace(
1841
1989
  new Error(`Failed to create TypeScript source file for ${filePath}`),
1842
1990
  error
1843
1991
  );
@@ -1851,17 +1999,20 @@ function generateImportsFileFromJayFile(jayFile) {
1851
1999
  return fromImportModules(jayFile.imports.map((link) => link.module));
1852
2000
  }
1853
2001
  function fromImportModules(modules) {
1854
- return modules.filter(isRelativeImport).map((module2) => `import '${module2}${compilerShared.JAY_QUERY_WORKER_TRUSTED}'`).join("\n");
2002
+ return modules.filter(isRelativeImport).map((module) => `import '${module}${JAY_QUERY_WORKER_TRUSTED}'`).join("\n");
1855
2003
  }
2004
+ const require2 = createRequire(import.meta.url);
2005
+ const tsModule = require2("typescript");
2006
+ const { isStringLiteral } = tsModule;
1856
2007
  function parseImportLinks(sourceFile) {
1857
2008
  const importDeclarations = extractImportDeclarations(sourceFile).filter(
1858
- (importDeclaration) => ts__namespace.isStringLiteral(importDeclaration.moduleSpecifier)
2009
+ (importDeclaration) => isStringLiteral(importDeclaration.moduleSpecifier)
1859
2010
  );
1860
2011
  const importLinks = importDeclarations.map((importDeclaration) => {
1861
- const module2 = importDeclaration.moduleSpecifier.text;
1862
- const sandbox = compilerShared.hasExtension(module2, compilerShared.JAY_QUERY_MAIN_SANDBOX) || compilerShared.hasExtension(module2, compilerShared.JAY_QUERY_WORKER_SANDBOX);
2012
+ const module = importDeclaration.moduleSpecifier.text;
2013
+ const sandbox = hasExtension(module, JAY_QUERY_MAIN_SANDBOX) || hasExtension(module, JAY_QUERY_WORKER_SANDBOX);
1863
2014
  const names = getJayImportNames(importDeclaration);
1864
- return { module: module2, names, sandbox };
2015
+ return { module, names, sandbox };
1865
2016
  });
1866
2017
  return importLinks;
1867
2018
  }
@@ -1873,7 +2024,7 @@ function getJayImportNames(importDeclaration) {
1873
2024
  return {
1874
2025
  name,
1875
2026
  ...as && { as },
1876
- type: compilerShared.JayUnknown
2027
+ type: JayUnknown
1877
2028
  };
1878
2029
  }) || [];
1879
2030
  }
@@ -1881,38 +2032,37 @@ function parseGenericTypescriptFile(filePath, code) {
1881
2032
  const sourceFile = createTsSourceFileFromSource(filePath, code);
1882
2033
  const imports = parseImportLinks(sourceFile);
1883
2034
  const filename = path.basename(filePath);
1884
- const baseElementName = changeCase.capitalCase(
1885
- compilerShared.hasExtension(filename, compilerShared.JAY_EXTENSION) ? compilerShared.withoutExtension(filename, compilerShared.JAY_TS_EXTENSION) : filename.split(".").shift(),
2035
+ const baseElementName = capitalCase(
2036
+ hasExtension(filename, JAY_EXTENSION) ? withoutExtension(filename, JAY_TS_EXTENSION) : filename.split(".").shift(),
1886
2037
  { delimiter: "" }
1887
2038
  );
1888
- return new compilerShared.WithValidations(
2039
+ return new WithValidations(
1889
2040
  {
1890
- format: compilerShared.SourceFileFormat.TypeScript,
2041
+ format: SourceFileFormat.TypeScript,
1891
2042
  imports,
1892
2043
  baseElementName
1893
2044
  },
1894
2045
  []
1895
2046
  );
1896
2047
  }
1897
- function generateElementFile(jayFile, importerMode, generateTarget = compilerShared.GenerateTarget.jay) {
1898
- return generateTarget === compilerShared.GenerateTarget.jay ? compilerJayHtml.generateElementFile(jayFile, importerMode) : compilerJayHtml.generateElementFileReactTarget(jayFile, importerMode);
1899
- }
1900
- Object.defineProperty(exports, "generateElementDefinitionFile", {
1901
- enumerable: true,
1902
- get: () => compilerJayHtml.generateElementDefinitionFile
1903
- });
1904
- exports.FunctionRepositoryBuilder = FunctionRepositoryBuilder;
1905
- exports.compileFunctionSplitPatternsBlock = compileFunctionSplitPatternsBlock;
1906
- exports.createTsSourceFileFromSource = createTsSourceFileFromSource;
1907
- exports.extractImportDeclarations = extractImportDeclarations;
1908
- exports.extractImportedModules = extractImportedModules;
1909
- exports.generateElementFile = generateElementFile;
1910
- exports.generateImportsFileFromJayFile = generateImportsFileFromJayFile;
1911
- exports.generateImportsFileFromTsSource = generateImportsFileFromTsSource;
1912
- exports.getImportName = getImportName;
1913
- exports.getImportSpecifiers = getImportSpecifiers;
1914
- exports.isRelativeImport = isRelativeImport;
1915
- exports.parseGenericTypescriptFile = parseGenericTypescriptFile;
1916
- exports.transformComponent = transformComponent;
1917
- exports.transformComponentBridge = transformComponentBridge;
1918
- exports.transformComponentImports = transformComponentImports;
2048
+ function generateElementFile(jayFile, importerMode, generateTarget = GenerateTarget.jay) {
2049
+ return generateTarget === GenerateTarget.jay ? generateElementFile$1(jayFile, importerMode) : generateElementFileReactTarget(jayFile, importerMode);
2050
+ }
2051
+ export {
2052
+ FunctionRepositoryBuilder,
2053
+ compileFunctionSplitPatternsBlock,
2054
+ createTsSourceFileFromSource,
2055
+ extractImportDeclarations,
2056
+ extractImportedModules,
2057
+ generateElementDefinitionFile,
2058
+ generateElementFile,
2059
+ generateImportsFileFromJayFile,
2060
+ generateImportsFileFromTsSource,
2061
+ getImportName,
2062
+ getImportSpecifiers,
2063
+ isRelativeImport,
2064
+ parseGenericTypescriptFile,
2065
+ transformComponent,
2066
+ transformComponentBridge,
2067
+ transformComponentImports
2068
+ };