@jay-framework/compiler-shared 0.22.2 → 0.23.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -629,6 +629,10 @@ interface PluginManifest {
629
629
  component: string;
630
630
  /** Human-readable description */
631
631
  description?: string;
632
+ /** When true, route is dev-server tooling only (e.g. plugin settings UI).
633
+ * Exposed in RouteInfo for consumers like AIditor to filter from page pickers.
634
+ * Future: excluded from production builds. See Design Log #171. */
635
+ devOnly?: boolean;
632
636
  }>;
633
637
  /** CLI commands exposed by this plugin (Design Log #142).
634
638
  * Run via `jay-stack run <plugin>/<command>`. */
@@ -869,4 +873,11 @@ declare function compileForEachInstanceKeyExpr(coordinateSuffix: string, trackBy
869
873
  */
870
874
  declare function computeForEachInstanceKey(trackByValue: string, coordinateSuffix: string): string;
871
875
 
872
- export { type ActionManifestEntry, CSS_EXTENSION, type CompilerSourceFile, type DataScope, type DynamicContractConfig, GenerateTarget, type GenericTypescriptSourceFile, Import, type ImportName, type ImportedRefsTree, Imports, ImportsFor, JAY_4_REACT, JAY_ACTION_DTS_EXTENSION, JAY_ACTION_EXTENSION, JAY_COMPONENT, JAY_CONTRACT_DTS_EXTENSION, JAY_CONTRACT_EXTENSION, JAY_DTS_EXTENSION, JAY_EXTENSION, JAY_FULLSTACK_COMPONENTS, JAY_QUERY_CLIENT, JAY_QUERY_HYDRATE, JAY_QUERY_MAIN_SANDBOX, JAY_QUERY_MAIN_SANDBOX_TS, JAY_QUERY_PREFIX, JAY_QUERY_SERVER, JAY_QUERY_WORKER_SANDBOX, JAY_QUERY_WORKER_SANDBOX_TS, JAY_QUERY_WORKER_TRUSTED, JAY_QUERY_WORKER_TRUSTED_TS, JAY_RUNTIME, JAY_SECURE, JAY_SSR_RUNTIME, JAY_STACK_CLIENT_RUNTIME, JAY_TS_EXTENSION, JayArrayType, JayAtomicType, JayBoolean, JayBuildEnvironment, JayComponentApiMember, JayComponentType, JayDate, JayElementConstructorType, JayElementType, JayEnumType, type JayEnvironment, JayErrorType, JayFileType, JayHTMLType, type JayHtmlHeadMeta, JayHtmlString, type JayHtmlValidationContext, type JayHtmlValidationFinding, type JayHtmlValidatorFn, type JayImportLink, type JayImportName, JayImportedType, JayNumber, JayObjectType, JayOptionalType, JayPromiseType, JayRecordType, JayRecursiveType, JayString, type JayType, JayTypeAlias, JayTypeKind, JayUnionType, JayUnknown, type JayValidations, type JsonSchemaProperty, LOCAL_PLUGIN_PATH, MAKE_JAY_4_REACT_COMPONENT, MAKE_JAY_COMPONENT, MAKE_JAY_STACK_COMPONENT, MAKE_JAY_TSX_COMPONENT, type MainRuntimeModes, type ParsedJayModuleSpecifier, type PluginComponentResolution, type PluginInitConfig, type PluginManifest, REACT, type RecursiveRegion, type Ref, type RefsTree, RenderFragment, type ResolvedBinding, RuntimeMode, SourceFileFormat, TSX_EXTENSION, TS_EXTENSION, type TemplatePart, WithValidations, addBuildEnvironment, checkValidationErrors, compileCoordinateExpr, compileForEachInstanceKeyExpr, computeForEachInstanceKey, equalJayTypes, findDynamicContract, getBasePath, getBuildEnvironment, getJayTsFileSourcePath, getMode, getModeFileExtension, getModeFromExtension, hasBuildEnvironment, hasExtension, hasJayExtension, hasJayModeExtension, hasRefs, isArrayType, isAtomicType, isComponentType, isCurrencyType, isDateWithTimezoneType, isElementConstructorType, isElementType, isEnumType, isHTMLType, isHtmlStringType, isImportedType, isLocalModule, isObjectType, isOptionalType, isPromiseType, isRecordType, isRecursiveType, isStaticCoordinate, isTypeAliasType, isUnionType, jayTypeToJsonSchema, loadPluginManifest, mergeRefsTrees, mkRef, mkRefsTree, nestRefs, normalizeActionEntry, parseJayModuleSpecifier, prettify, prettifyHtml, removeComments, resolveBinding, resolvePluginComponent, resolvePluginManifest, resolvePrimitiveType, walkElements, withOriginalTrace, withoutExtension };
876
+ /**
877
+ * camelCase that preserves leading underscores.
878
+ * The standard camelCase from 'change-case' strips them
879
+ * (e.g., '_id' becomes 'id'), which breaks contract tag names.
880
+ */
881
+ declare function camelCase(str: string): string;
882
+
883
+ export { type ActionManifestEntry, CSS_EXTENSION, type CompilerSourceFile, type DataScope, type DynamicContractConfig, GenerateTarget, type GenericTypescriptSourceFile, Import, type ImportName, type ImportedRefsTree, Imports, ImportsFor, JAY_4_REACT, JAY_ACTION_DTS_EXTENSION, JAY_ACTION_EXTENSION, JAY_COMPONENT, JAY_CONTRACT_DTS_EXTENSION, JAY_CONTRACT_EXTENSION, JAY_DTS_EXTENSION, JAY_EXTENSION, JAY_FULLSTACK_COMPONENTS, JAY_QUERY_CLIENT, JAY_QUERY_HYDRATE, JAY_QUERY_MAIN_SANDBOX, JAY_QUERY_MAIN_SANDBOX_TS, JAY_QUERY_PREFIX, JAY_QUERY_SERVER, JAY_QUERY_WORKER_SANDBOX, JAY_QUERY_WORKER_SANDBOX_TS, JAY_QUERY_WORKER_TRUSTED, JAY_QUERY_WORKER_TRUSTED_TS, JAY_RUNTIME, JAY_SECURE, JAY_SSR_RUNTIME, JAY_STACK_CLIENT_RUNTIME, JAY_TS_EXTENSION, JayArrayType, JayAtomicType, JayBoolean, JayBuildEnvironment, JayComponentApiMember, JayComponentType, JayDate, JayElementConstructorType, JayElementType, JayEnumType, type JayEnvironment, JayErrorType, JayFileType, JayHTMLType, type JayHtmlHeadMeta, JayHtmlString, type JayHtmlValidationContext, type JayHtmlValidationFinding, type JayHtmlValidatorFn, type JayImportLink, type JayImportName, JayImportedType, JayNumber, JayObjectType, JayOptionalType, JayPromiseType, JayRecordType, JayRecursiveType, JayString, type JayType, JayTypeAlias, JayTypeKind, JayUnionType, JayUnknown, type JayValidations, type JsonSchemaProperty, LOCAL_PLUGIN_PATH, MAKE_JAY_4_REACT_COMPONENT, MAKE_JAY_COMPONENT, MAKE_JAY_STACK_COMPONENT, MAKE_JAY_TSX_COMPONENT, type MainRuntimeModes, type ParsedJayModuleSpecifier, type PluginComponentResolution, type PluginInitConfig, type PluginManifest, REACT, type RecursiveRegion, type Ref, type RefsTree, RenderFragment, type ResolvedBinding, RuntimeMode, SourceFileFormat, TSX_EXTENSION, TS_EXTENSION, type TemplatePart, WithValidations, addBuildEnvironment, camelCase, checkValidationErrors, compileCoordinateExpr, compileForEachInstanceKeyExpr, computeForEachInstanceKey, equalJayTypes, findDynamicContract, getBasePath, getBuildEnvironment, getJayTsFileSourcePath, getMode, getModeFileExtension, getModeFromExtension, hasBuildEnvironment, hasExtension, hasJayExtension, hasJayModeExtension, hasRefs, isArrayType, isAtomicType, isComponentType, isCurrencyType, isDateWithTimezoneType, isElementConstructorType, isElementType, isEnumType, isHTMLType, isHtmlStringType, isImportedType, isLocalModule, isObjectType, isOptionalType, isPromiseType, isRecordType, isRecursiveType, isStaticCoordinate, isTypeAliasType, isUnionType, jayTypeToJsonSchema, loadPluginManifest, mergeRefsTrees, mkRef, mkRefsTree, nestRefs, normalizeActionEntry, parseJayModuleSpecifier, prettify, prettifyHtml, removeComments, resolveBinding, resolvePluginComponent, resolvePluginManifest, resolvePrimitiveType, walkElements, withOriginalTrace, withoutExtension };
package/dist/index.js CHANGED
@@ -1,15 +1,13 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => {
4
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- return value;
6
- };
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
7
4
  import * as prettier from "prettier";
8
5
  import jsBeautify from "js-beautify";
9
6
  import fs from "fs";
10
7
  import path from "path";
11
8
  import YAML from "yaml";
12
9
  import { createRequire } from "module";
10
+ import { camelCase as camelCase$1 } from "change-case";
13
11
  const JAY_EXTENSION = ".jay-html";
14
12
  const CSS_EXTENSION = ".css";
15
13
  const JAY_CONTRACT_EXTENSION = ".jay-contract";
@@ -535,8 +533,7 @@ class Imports {
535
533
  if (this.imports[importName.index] && importName.usage.includes(importsFor)) {
536
534
  if (moduleImportStatements.has(importName.module))
537
535
  moduleImportStatements.get(importName.module).push(importName.statement);
538
- else
539
- moduleImportStatements.set(importName.module, [importName.statement]);
536
+ else moduleImportStatements.set(importName.module, [importName.statement]);
540
537
  }
541
538
  }
542
539
  const modulesToImport = [...moduleImportStatements.keys()].sort(
@@ -783,10 +780,8 @@ function isDateWithTimezoneType(aType) {
783
780
  return aType.kind === 0 && aType.name === "DateWithTimezone";
784
781
  }
785
782
  function equalJayTypes(a, b) {
786
- if (a.name !== b.name)
787
- return false;
788
- if (a instanceof JayAtomicType && b instanceof JayAtomicType)
789
- return a.name === b.name;
783
+ if (a.name !== b.name) return false;
784
+ if (a instanceof JayAtomicType && b instanceof JayAtomicType) return a.name === b.name;
790
785
  else if (a instanceof JayEnumType && b instanceof JayEnumType)
791
786
  return a.values.length === b.values.length && a.values.reduce(
792
787
  (res, a_val, currentIndex) => res && a_val === b.values[currentIndex],
@@ -796,14 +791,11 @@ function equalJayTypes(a, b) {
796
791
  return equalJayTypes(a.itemType, b.itemType);
797
792
  else if (a instanceof JayRecordType && b instanceof JayRecordType)
798
793
  return equalJayTypes(a.itemType, b.itemType);
799
- else if (a instanceof JayTypeAlias && b instanceof JayTypeAlias)
800
- return true;
801
- else if (a instanceof JayHTMLType && b instanceof JayHTMLType)
802
- return true;
794
+ else if (a instanceof JayTypeAlias && b instanceof JayTypeAlias) return true;
795
+ else if (a instanceof JayHTMLType && b instanceof JayHTMLType) return true;
803
796
  else if (a instanceof JayImportedType && b instanceof JayImportedType)
804
797
  return equalJayTypes(a.type, b.type);
805
- else if (a instanceof JayElementType && b instanceof JayElementType)
806
- return true;
798
+ else if (a instanceof JayElementType && b instanceof JayElementType) return true;
807
799
  else if (a instanceof JayElementConstructorType && b instanceof JayElementConstructorType)
808
800
  return a.typeName === b.typeName;
809
801
  else if (a instanceof JayComponentType && b instanceof JayComponentType)
@@ -823,8 +815,7 @@ function equalJayTypes(a, b) {
823
815
  return equalJayTypes(a.itemType, b.itemType);
824
816
  } else if (a instanceof JayRecursiveType && b instanceof JayRecursiveType) {
825
817
  return a.referencePath === b.referencePath;
826
- } else
827
- ;
818
+ } else ;
828
819
  }
829
820
  function jayTypeToJsonSchema(type) {
830
821
  if (isOptionalType(type)) {
@@ -1023,12 +1014,9 @@ function parseJayModuleSpecifier(specifier) {
1023
1014
  isHydrate: hydrate
1024
1015
  } of JAY_QUERY_PATTERNS) {
1025
1016
  if (remainingQuery.includes(pattern)) {
1026
- if (buildEnv)
1027
- buildEnvironment = buildEnv;
1028
- if (rtMode)
1029
- runtimeMode = rtMode;
1030
- if (hydrate)
1031
- isHydrate = true;
1017
+ if (buildEnv) buildEnvironment = buildEnv;
1018
+ if (rtMode) runtimeMode = rtMode;
1019
+ if (hydrate) isHydrate = true;
1032
1020
  remainingQuery = remainingQuery.replace(pattern, "");
1033
1021
  }
1034
1022
  }
@@ -1099,10 +1087,8 @@ class WithValidations {
1099
1087
  this.validations = validations;
1100
1088
  }
1101
1089
  map(func) {
1102
- if (this.val !== void 0)
1103
- return new WithValidations(func(this.val), this.validations);
1104
- else
1105
- return new WithValidations(void 0, this.validations);
1090
+ if (this.val !== void 0) return new WithValidations(func(this.val), this.validations);
1091
+ else return new WithValidations(void 0, this.validations);
1106
1092
  }
1107
1093
  async mapAsync(func) {
1108
1094
  if (this.val !== void 0) {
@@ -1116,8 +1102,7 @@ class WithValidations {
1116
1102
  if (this.val !== void 0) {
1117
1103
  let that = func(this.val);
1118
1104
  return new WithValidations(that.val, [...this.validations, ...that.validations]);
1119
- } else
1120
- return new WithValidations(void 0, this.validations);
1105
+ } else return new WithValidations(void 0, this.validations);
1121
1106
  }
1122
1107
  async flatMapAsync(func) {
1123
1108
  if (this.val !== void 0) {
@@ -1206,8 +1191,7 @@ function hasRefs(refs, includingAutoRefs) {
1206
1191
  function nestRefs(path2, renderFragment) {
1207
1192
  let refs = renderFragment.refs;
1208
1193
  for (let index = path2.length - 1; index >= 0; --index) {
1209
- if (path2[index] === ".")
1210
- continue;
1194
+ if (path2[index] === ".") continue;
1211
1195
  refs = mkRefsTree([], { [path2[index]]: refs }, refs.repeated);
1212
1196
  }
1213
1197
  return new RenderFragment(
@@ -1227,8 +1211,7 @@ function mkRefsTree(refs, children, repeated = false, refsTypeName, repeatedRefs
1227
1211
  repeated,
1228
1212
  imported: { refsTypeName, repeatedRefsTypeName }
1229
1213
  };
1230
- else
1231
- return { kind: "refTree", refs, children, repeated };
1214
+ else return { kind: "refTree", refs, children, repeated };
1232
1215
  }
1233
1216
  function mkRef(ref, originalName, constName, repeated, autoRef, viewStateType, elementType) {
1234
1217
  return {
@@ -1330,7 +1313,7 @@ function removeComments(code) {
1330
1313
  (line) => !(line.includes("// @ts-expect-error ") || line.includes("// @ts-ignore") || line.includes("{/* @ts-ignore */}"))
1331
1314
  ).join("\n");
1332
1315
  }
1333
- const require2 = createRequire(import.meta.url);
1316
+ const require$1 = createRequire(import.meta.url);
1334
1317
  const LOCAL_PLUGIN_PATH = "src/plugins";
1335
1318
  function normalizeActionEntry(entry) {
1336
1319
  if (typeof entry === "string") {
@@ -1434,7 +1417,7 @@ function resolveLocalPlugin(projectRoot, pluginName, contractName) {
1434
1417
  function resolveNpmPluginManifest(projectRoot, pluginName) {
1435
1418
  let pluginYamlPath;
1436
1419
  try {
1437
- pluginYamlPath = require2.resolve(`${pluginName}/plugin.yaml`, {
1420
+ pluginYamlPath = require$1.resolve(`${pluginName}/plugin.yaml`, {
1438
1421
  paths: [projectRoot]
1439
1422
  });
1440
1423
  } catch (error) {
@@ -1469,7 +1452,7 @@ function resolveNpmPlugin(projectRoot, pluginName, contractName) {
1469
1452
  if (!manifestWithValidations.val || manifestWithValidations.validations.length > 0)
1470
1453
  return new WithValidations(null, manifestWithValidations.validations);
1471
1454
  const manifest = manifestWithValidations.val;
1472
- const pluginYamlPath = require2.resolve(`${pluginName}/plugin.yaml`, {
1455
+ const pluginYamlPath = require$1.resolve(`${pluginName}/plugin.yaml`, {
1473
1456
  paths: [projectRoot]
1474
1457
  });
1475
1458
  const npmPluginPath = path.dirname(pluginYamlPath);
@@ -1602,12 +1585,9 @@ function resolveBinding(bindingPath, scope) {
1602
1585
  let tags = scope.tags;
1603
1586
  for (let i2 = 0; i2 < segments.length; i2++) {
1604
1587
  const match = tags.find((t) => t.tag === segments[i2]);
1605
- if (!match)
1606
- return { path: bindingPath };
1607
- if (i2 === segments.length - 1)
1608
- return { path: bindingPath, tag: match };
1609
- if (!match.tags)
1610
- return { path: bindingPath };
1588
+ if (!match) return { path: bindingPath };
1589
+ if (i2 === segments.length - 1) return { path: bindingPath, tag: match };
1590
+ if (!match.tags) return { path: bindingPath };
1611
1591
  tags = match.tags;
1612
1592
  }
1613
1593
  return { path: bindingPath };
@@ -1617,12 +1597,9 @@ function resolveTagPath(dotPath, tags) {
1617
1597
  let currentTags = tags;
1618
1598
  for (let i2 = 0; i2 < segments.length; i2++) {
1619
1599
  const match = currentTags.find((t) => t.tag === segments[i2]);
1620
- if (!match)
1621
- return void 0;
1622
- if (i2 === segments.length - 1)
1623
- return match;
1624
- if (!match.tags)
1625
- return void 0;
1600
+ if (!match) return void 0;
1601
+ if (i2 === segments.length - 1) return match;
1602
+ if (!match.tags) return void 0;
1626
1603
  currentTags = match.tags;
1627
1604
  }
1628
1605
  return void 0;
@@ -1709,6 +1686,22 @@ function compileForEachInstanceKeyExpr(coordinateSuffix, trackByExpr) {
1709
1686
  function computeForEachInstanceKey(trackByValue, coordinateSuffix) {
1710
1687
  return [trackByValue, coordinateSuffix].toString();
1711
1688
  }
1689
+ function camelCase(str) {
1690
+ let leadingUnderscores = 0;
1691
+ for (const char of str) {
1692
+ if (char === "_") {
1693
+ leadingUnderscores++;
1694
+ } else {
1695
+ break;
1696
+ }
1697
+ }
1698
+ if (leadingUnderscores === 0) {
1699
+ return camelCase$1(str);
1700
+ }
1701
+ const withoutLeadingUnderscores = str.slice(leadingUnderscores);
1702
+ const camelCased = camelCase$1(withoutLeadingUnderscores);
1703
+ return "_".repeat(leadingUnderscores) + camelCased;
1704
+ }
1712
1705
  const s = createRequire(import.meta.url), e = s("typescript"), u = e, c = new Proxy(e, {
1713
1706
  get(t, r) {
1714
1707
  return t[r];
@@ -1786,6 +1779,7 @@ export {
1786
1779
  TS_EXTENSION,
1787
1780
  WithValidations,
1788
1781
  addBuildEnvironment,
1782
+ camelCase,
1789
1783
  checkValidationErrors,
1790
1784
  compileCoordinateExpr,
1791
1785
  compileForEachInstanceKeyExpr,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jay-framework/compiler-shared",
3
- "version": "0.22.2",
3
+ "version": "0.23.1",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "license": "Apache-2.0",
@@ -25,10 +25,10 @@
25
25
  },
26
26
  "author": "",
27
27
  "dependencies": {
28
- "@jay-framework/component": "^0.22.2",
29
- "@jay-framework/runtime": "^0.22.2",
30
- "@jay-framework/secure": "^0.22.2",
31
- "@jay-framework/typescript-bridge": "^0.22.2",
28
+ "@jay-framework/component": "^0.23.1",
29
+ "@jay-framework/runtime": "^0.23.1",
30
+ "@jay-framework/secure": "^0.23.1",
31
+ "@jay-framework/typescript-bridge": "^0.23.1",
32
32
  "@types/js-yaml": "^4.0.9",
33
33
  "change-case": "^4.1.2",
34
34
  "js-beautify": "^1.14.11",
@@ -41,7 +41,7 @@
41
41
  },
42
42
  "devDependencies": {
43
43
  "@caiogondim/strip-margin": "^1.0.0",
44
- "@jay-framework/dev-environment": "^0.22.2",
44
+ "@jay-framework/dev-environment": "^0.23.1",
45
45
  "@testing-library/jest-dom": "^6.2.0",
46
46
  "@types/js-beautify": "^1",
47
47
  "@types/node": "^20.11.5",