@jay-framework/compiler-jay-html 0.25.4 → 0.25.5

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.cts CHANGED
@@ -102,6 +102,34 @@ declare function filterTagsByPhase(tags: ContractTag[], targetPhase: RenderingPh
102
102
  */
103
103
  declare function createPhaseContract(contract: Contract, targetPhase: RenderingPhase): Contract;
104
104
 
105
+ /**
106
+ * Owns type-analysis state for one scope (DL#225). The TS type analysis (`ts.createProgram` inside
107
+ * `analyzeExportedTypes`) costs ~hundreds of ms per component file, and `parseJayFile` re-analyzes every
108
+ * local `src=` import on every call — once per SSR request in the dev server. A context memoizes results
109
+ * so repeat requests (and a component imported by many pages at build time) don't re-analyze.
110
+ *
111
+ * A context is created per owner (dev-server session, build run, CLI command, or **test**) and threaded
112
+ * through the resolver — not a module global — so the state's lifetime is the owner's and tests are
113
+ * isolated. DL#225 Phase 3 will make the context own a persistent `ts.LanguageService` here.
114
+ */
115
+ interface AnalysisContext {
116
+ analyzeExportedTypes(fullPath: string, options: ResolveTsConfigOptions): JayType[];
117
+ /**
118
+ * Invalidate after a `.ts` / `.d.ts` / `.jay-contract` change. The cache keys on the analyzed file's
119
+ * own mtime (busts a direct edit), but a change to a *type it imports* (e.g. a regenerated contract
120
+ * `.d.ts`) without touching the component is not seen by mtime — so the dev-server watcher calls this.
121
+ * Currently clears everything (cheap; next request re-analyzes only the pages it renders).
122
+ */
123
+ noteFileChanged(changedPath?: string): void;
124
+ /** Clear all cached analysis. */
125
+ clear(): void;
126
+ }
127
+ /**
128
+ * Create a fresh {@link AnalysisContext}. Each owner creates its own; callers thread it via the resolver.
129
+ * Backed by a persistent `ts.LanguageService` (DL#225) so repeat/incremental analysis is near-free and the
130
+ * cold `createProgram` cost is shared across a session.
131
+ */
132
+ declare function createAnalysisContext(): AnalysisContext;
105
133
  interface JayImportResolver {
106
134
  resolveLink(importingModuleDir: string, link: string): string;
107
135
  /** Load a contract from an absolute file path */
@@ -135,7 +163,21 @@ interface JayImportResolver {
135
163
  filePath: string;
136
164
  } | null;
137
165
  }
166
+ /**
167
+ * Create a resolver bound to an {@link AnalysisContext} (DL#225). Owners (dev-server session, build run,
168
+ * CLI command, test) create one — and typically one context — and thread it through `parseJayFile(…,
169
+ * resolver, …)`. Defaults to a fresh private context when none is passed.
170
+ */
171
+ declare function createJayImportResolver(context?: AnalysisContext): JayImportResolver;
138
172
  declare const JAY_IMPORT_RESOLVER: JayImportResolver;
173
+ /** Fully reset the default resolver's analysis state. */
174
+ declare function clearExportedTypesCache(): void;
175
+ /**
176
+ * Note a changed file on the default context (dev-server watcher). Bumps just that file's version so the
177
+ * LanguageService re-reads it and re-checks dependents — incremental, keeping the rest of the program warm
178
+ * (vs a full reset). A dev server is one process = one default context, so this stays naturally scoped.
179
+ */
180
+ declare function noteExportedTypesFileChanged(changedPath: string): void;
139
181
 
140
182
  interface JayContractImportLink {
141
183
  module: string;
@@ -334,6 +376,46 @@ declare function assignCoordinatesToJayHtml(jayHtml: string, headlessContractNam
334
376
  */
335
377
  declare function assignCoordinates(body: HTMLElement, options: AssignCoordinatesOptions): AssignCoordinatesResult;
336
378
 
379
+ /**
380
+ * Dev-mode source-editing markers (Design Log #219).
381
+ *
382
+ * A pure `string -> string` transform over the ORIGINAL on-disk jay-html, run in the
383
+ * dev-server pre-render pipeline BEFORE slow-render. It injects dev-only attributes that
384
+ * let the source-editing inspector map a rendered pixel back to its jay-html source:
385
+ *
386
+ * - `jay-dev-src="from:to"` — 1-based line range into the original file, on every element
387
+ * under `<body>`. A plain static attribute; the compilers pass it through verbatim.
388
+ * - `jay-dev-item="{<trackBy>}"` — a BOUND attribute on every `forEach` item root, so the
389
+ * compiler emits the live record id per item and keeps it current on list updates.
390
+ *
391
+ * Line offsets are taken against the original source here (not the slow-render re-serialized
392
+ * markup), so the line values stay faithful to the author's file.
393
+ *
394
+ * Note: a region-prop marker (`jay-dev-prop-*`) was planned but dropped — a region's prop
395
+ * bindings are parent-scoped while its only rendered elements are child-scoped, so there is no
396
+ * DOM element on which such a bound attribute could resolve. The inspector instead reads the
397
+ * region's source fragment (contract + binding expressions) via `jay-dev-src`. See DL#219
398
+ * Implementation Results.
399
+ */
400
+ declare const DEV_SRC_ATTR = "jay-dev-src";
401
+ declare const DEV_ITEM_ATTR = "jay-dev-item";
402
+ /** Contract name of a headless region (`<jay:NAME …>`), stamped on the region tag. */
403
+ declare const DEV_REGION_ATTR = "jay-dev-region";
404
+ /** JSON of a region's STATIC (non-bound, non-directive) props — the live identity values the
405
+ * inspector can surface without reading source. Bound props stay source-only (parent-scoped). */
406
+ declare const DEV_REGION_PROPS_ATTR = "jay-dev-region-props";
407
+ /** The region's own `<jay:…>` line range, attached to the region's rendered root alongside
408
+ * `jay-dev-region`. Distinct from that element's own `jay-dev-src` (which is the element's lines):
409
+ * the region root is a shared element (the scope-anchor wrapper, or a ref-less region's single
410
+ * child), so the region's source lives in its own attribute to avoid a dedicated DOM level. */
411
+ declare const DEV_REGION_SRC_ATTR = "jay-dev-region-src";
412
+ /**
413
+ * Inject dev-mode source markers into a jay-html string and return the serialized result.
414
+ * Elements outside `<body>` (e.g. `<head>`, the jay-data script) are left untouched.
415
+ * Idempotent: elements that already carry a marker are not re-stamped.
416
+ */
417
+ declare function injectDevMarkers(jayHtml: string): string;
418
+
337
419
  declare function parseJayFile(html: string, filename: string, filePath: string, options: ResolveTsConfigOptions, linkedContractResolver: JayImportResolver, projectRoot: string,
338
420
  /** Optional source directory for resolving headfull FS files (jay-html, contracts).
339
421
  * When parsing pre-rendered files, filePath is in build/pre-rendered/ but headfull
@@ -646,4 +728,4 @@ declare function resolveHeadlessInstances(preRenderedJayHtml: string, instanceDa
646
728
  */
647
729
  declare function hasSlowPhaseProperties(contract: Contract | undefined): boolean;
648
730
 
649
- export { type ActionDefinition, type AssignCoordinatesOptions, type AssignCoordinatesResult, type Contract, type ContractImportInfo, type ContractParam, type ContractParamKind, type ContractProp, type ContractResolver, type ContractTag, ContractTagType, type DiscoveredHeadlessInstance, ERROR_CONTRACT, ERROR_CONTRACT_MODULE, ERROR_CONTRACT_NAME, ERROR_CONTRACT_PLUGIN, type EnumToImport, type ForEachHeadlessInstance, type HeadlessContractInfo, type HeadlessInstanceDiscoveryResult, type HeadlessInstanceResolvedData, JAY_IMPORT_RESOLVER, type JayContractImportLink, type JayHeadlessImports, type JayHtmlScript, type JayHtmlSourceFile, type JayImportResolver, type PhaseViewStates, type RenderingPhase, type ServerElementOptions, type SlowRenderInput, type SlowRenderOutput, assignCoordinates, assignCoordinatesToJayHtml, buildInstanceCoordinateKey, compileAction, compileContract, contractToAllPhaseViewStates, contractToImportsViewStateAndRefs, contractToPhaseViewState, createPhaseContract, defaultContractResolver, discoverHeadlessInstances, filterTagsByPhase, generateElementBridgeFile, generateElementDefinitionFile, generateElementFile, generateElementFileReactTarget, generateElementHydrateFile, generateSandboxRootFile, generateServerElementFile, generateTypes, getEffectivePhase, getJayHtmlImports, getLinkedContractDir, hasSlowPhaseProperties, htmlElementTagNameMap, isBuiltInErrorContract, isTagInPhase, loadLinkedContract, parseAction, parseContract, parseEnumValues, parseIsEnum, parseJayFile, parseTemplateParts, renderRefsType, resolveHeadlessInstances, slowRenderTransform, validateContractPhases };
731
+ export { type ActionDefinition, type AnalysisContext, type AssignCoordinatesOptions, type AssignCoordinatesResult, type Contract, type ContractImportInfo, type ContractParam, type ContractParamKind, type ContractProp, type ContractResolver, type ContractTag, ContractTagType, DEV_ITEM_ATTR, DEV_REGION_ATTR, DEV_REGION_PROPS_ATTR, DEV_REGION_SRC_ATTR, DEV_SRC_ATTR, type DiscoveredHeadlessInstance, ERROR_CONTRACT, ERROR_CONTRACT_MODULE, ERROR_CONTRACT_NAME, ERROR_CONTRACT_PLUGIN, type EnumToImport, type ForEachHeadlessInstance, type HeadlessContractInfo, type HeadlessInstanceDiscoveryResult, type HeadlessInstanceResolvedData, JAY_IMPORT_RESOLVER, type JayContractImportLink, type JayHeadlessImports, type JayHtmlScript, type JayHtmlSourceFile, type JayImportResolver, type PhaseViewStates, type RenderingPhase, type ServerElementOptions, type SlowRenderInput, type SlowRenderOutput, assignCoordinates, assignCoordinatesToJayHtml, buildInstanceCoordinateKey, clearExportedTypesCache, compileAction, compileContract, contractToAllPhaseViewStates, contractToImportsViewStateAndRefs, contractToPhaseViewState, createAnalysisContext, createJayImportResolver, createPhaseContract, defaultContractResolver, discoverHeadlessInstances, filterTagsByPhase, generateElementBridgeFile, generateElementDefinitionFile, generateElementFile, generateElementFileReactTarget, generateElementHydrateFile, generateSandboxRootFile, generateServerElementFile, generateTypes, getEffectivePhase, getJayHtmlImports, getLinkedContractDir, hasSlowPhaseProperties, htmlElementTagNameMap, injectDevMarkers, isBuiltInErrorContract, isTagInPhase, loadLinkedContract, noteExportedTypesFileChanged, parseAction, parseContract, parseEnumValues, parseIsEnum, parseJayFile, parseTemplateParts, renderRefsType, resolveHeadlessInstances, slowRenderTransform, validateContractPhases };
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
- import { camelCase as camelCase$1, JayImportedType, JayString, JayUnknown, isObjectType as isObjectType$1, isImportedType, isRecursiveType, Imports, Import, RenderFragment, WithValidations, isArrayType as isArrayType$1, isAtomicType, isPromiseType, isEnumType, GenerateTarget, hasRefs, JayTypeAlias, JayUnionType, mkRefsTree, equalJayTypes, mkRef, JayComponentType, JayHTMLType, getModeFileExtension, isHtmlStringType, RuntimeMode, nestRefs, mergeRefsTrees, JayNumber, SourceFileFormat, JayEnumType, JayObjectType, JayArrayType, JayPromiseType, resolvePrimitiveType, JayRecursiveType, JAY_CONTRACT_EXTENSION as JAY_CONTRACT_EXTENSION$1, ImportsFor, JAY_FULLSTACK_COMPONENTS, hoistFreeRefs, freeRefsAugmentedRefType, isComponentType as isComponentType$1, JayErrorType, JayOptionalType, JayRecordType, isOptionalType, isRecordType, resolvePluginManifest, resolvePluginComponent } from "@jay-framework/compiler-shared";
1
+ import { camelCase as camelCase$1, Imports, Import, RenderFragment, JayUnknown, JayImportedType, JayString, isObjectType as isObjectType$1, isImportedType, isRecursiveType, WithValidations, isArrayType as isArrayType$1, isAtomicType, isPromiseType, isEnumType, GenerateTarget, hasRefs, JayTypeAlias, JayUnionType, mkRefsTree, equalJayTypes, mkRef, JayComponentType, JayHTMLType, getModeFileExtension, isHtmlStringType, RuntimeMode, nestRefs, mergeRefsTrees, JayNumber, SourceFileFormat, JayEnumType, JayObjectType, JayArrayType, JayPromiseType, resolvePrimitiveType, JayRecursiveType, JAY_CONTRACT_EXTENSION as JAY_CONTRACT_EXTENSION$1, ImportsFor, JAY_FULLSTACK_COMPONENTS, hoistFreeRefs, freeRefsAugmentedRefType, isComponentType as isComponentType$1, JayErrorType, JayOptionalType, JayRecordType, isOptionalType, isRecordType, resolvePluginManifest, resolvePluginComponent } from "@jay-framework/compiler-shared";
2
2
  import path from "path";
3
3
  import { getLogger } from "@jay-framework/logger";
4
4
  import fs from "fs/promises";
5
5
  import fs$1 from "fs";
6
- import { analyzeExportedTypes } from "@jay-framework/compiler-analyze-exported-types";
6
+ import { createTypeAnalyzer } from "@jay-framework/compiler-analyze-exported-types";
7
7
  import { createRequire } from "module";
8
8
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
9
9
  function getDefaultExportFromCjs$1(x) {
@@ -5775,6 +5775,89 @@ parse$1.valid = valid_1.default;
5775
5775
  parse$1.Node = node_1.default;
5776
5776
  parse$1.TextNode = text_1.default;
5777
5777
  parse$1.NodeType = type_1.default;
5778
+ const DEV_SRC_ATTR = "jay-dev-src";
5779
+ const DEV_ITEM_ATTR = "jay-dev-item";
5780
+ const DEV_REGION_ATTR = "jay-dev-region";
5781
+ const DEV_REGION_PROPS_ATTR = "jay-dev-region-props";
5782
+ const DEV_REGION_SRC_ATTR = "jay-dev-region-src";
5783
+ const REGION_NON_PROP_ATTRS = /* @__PURE__ */ new Set([
5784
+ "ref",
5785
+ "if",
5786
+ "foreach",
5787
+ "trackby",
5788
+ "key",
5789
+ DEV_SRC_ATTR,
5790
+ DEV_ITEM_ATTR,
5791
+ DEV_REGION_ATTR,
5792
+ DEV_REGION_PROPS_ATTR
5793
+ ]);
5794
+ function injectDevMarkers(jayHtml) {
5795
+ const root = parse_2(jayHtml, {
5796
+ comment: true,
5797
+ blockTextElements: { script: true, style: true }
5798
+ });
5799
+ const body = root.querySelector("body");
5800
+ if (!body) return jayHtml;
5801
+ const lineStarts = computeLineStarts(jayHtml);
5802
+ for (const child of body.childNodes) {
5803
+ if (child.nodeType === NodeType.ELEMENT_NODE) {
5804
+ markElement(child, lineStarts);
5805
+ }
5806
+ }
5807
+ return root.toString();
5808
+ }
5809
+ function markElement(element, lineStarts) {
5810
+ const [start, end] = element.range;
5811
+ if (!element.getAttribute(DEV_SRC_ATTR)) {
5812
+ const fromLine = offsetToLine(start, lineStarts);
5813
+ const toLine = offsetToLine(Math.max(start, end - 1), lineStarts);
5814
+ element.setAttribute(DEV_SRC_ATTR, `${fromLine}:${toLine}`);
5815
+ }
5816
+ const forEach = element.getAttribute("forEach");
5817
+ const trackBy = element.getAttribute("trackBy");
5818
+ if (forEach && trackBy && !element.getAttribute(DEV_ITEM_ATTR)) {
5819
+ element.setAttribute(DEV_ITEM_ATTR, `{${trackBy}}`);
5820
+ }
5821
+ const tagName = (element.rawTagName || "").toLowerCase();
5822
+ if (tagName.startsWith("jay:") && !element.getAttribute(DEV_REGION_ATTR)) {
5823
+ element.setAttribute(DEV_REGION_ATTR, tagName.slice(4));
5824
+ const props = {};
5825
+ for (const [key, value] of Object.entries(element.attributes)) {
5826
+ if (REGION_NON_PROP_ATTRS.has(key.toLowerCase())) continue;
5827
+ if (typeof value === "string" && !value.includes("{")) props[key] = value;
5828
+ }
5829
+ if (Object.keys(props).length > 0) {
5830
+ element.setAttribute(DEV_REGION_PROPS_ATTR, encodeURIComponent(JSON.stringify(props)));
5831
+ }
5832
+ }
5833
+ for (const child of element.childNodes) {
5834
+ if (child.nodeType === NodeType.ELEMENT_NODE) {
5835
+ markElement(child, lineStarts);
5836
+ }
5837
+ }
5838
+ }
5839
+ function computeLineStarts(src) {
5840
+ const starts = [0];
5841
+ for (let i = 0; i < src.length; i++) {
5842
+ if (src.charCodeAt(i) === 10) starts.push(i + 1);
5843
+ }
5844
+ return starts;
5845
+ }
5846
+ function offsetToLine(offset, lineStarts) {
5847
+ let lo = 0;
5848
+ let hi = lineStarts.length - 1;
5849
+ let line = 0;
5850
+ while (lo <= hi) {
5851
+ const mid = lo + hi >> 1;
5852
+ if (lineStarts[mid] <= offset) {
5853
+ line = mid;
5854
+ lo = mid + 1;
5855
+ } else {
5856
+ hi = mid - 1;
5857
+ }
5858
+ }
5859
+ return line + 1;
5860
+ }
5778
5861
  const COORD_ATTR$1 = "jay-coordinate-base";
5779
5862
  const SCOPE_ATTR = "jay-scope";
5780
5863
  const AUTO_REF_PATTERN = /^AR\d+$/;
@@ -5877,6 +5960,20 @@ function assignHeadlessInstance(element, contractName, ref, parentCoord, options
5877
5960
  children.forEach((child) => wrapper.appendChild(child));
5878
5961
  element.appendChild(wrapper);
5879
5962
  }
5963
+ const devSrc = element.getAttribute(DEV_SRC_ATTR);
5964
+ const devRegion = element.getAttribute(DEV_REGION_ATTR);
5965
+ const devRegionProps = element.getAttribute(DEV_REGION_PROPS_ATTR);
5966
+ if (devRegion) {
5967
+ const regionRoot = element.childNodes.find((n) => n.nodeType === NodeType.ELEMENT_NODE);
5968
+ if (regionRoot) {
5969
+ regionRoot.setAttribute(DEV_REGION_ATTR, devRegion);
5970
+ if (devRegionProps) regionRoot.setAttribute(DEV_REGION_PROPS_ATTR, devRegionProps);
5971
+ if (devSrc) regionRoot.setAttribute(DEV_REGION_SRC_ATTR, devSrc);
5972
+ }
5973
+ }
5974
+ if (devSrc) element.removeAttribute(DEV_SRC_ATTR);
5975
+ if (devRegion) element.removeAttribute(DEV_REGION_ATTR);
5976
+ if (devRegionProps) element.removeAttribute(DEV_REGION_PROPS_ATTR);
5880
5977
  walkChildren(element, childScopeId, childScopeId, options, counter);
5881
5978
  }
5882
5979
  function walkForEachChildren(parent, itemScopeId, options, counter) {
@@ -13950,6 +14047,127 @@ function parseConditionForSlowRender(expr, slowContext, vars) {
13950
14047
  return { type: "runtime", code: fragment, simplifiedExpr: expr };
13951
14048
  }
13952
14049
  }
14050
+ const htmlElementTagNameMap = {
14051
+ a: "HTMLAnchorElement",
14052
+ abbr: "HTMLElement",
14053
+ address: "HTMLElement",
14054
+ applet: "HTMLAppletElement",
14055
+ area: "HTMLAreaElement",
14056
+ article: "HTMLElement",
14057
+ aside: "HTMLElement",
14058
+ audio: "HTMLAudioElement",
14059
+ b: "HTMLElement",
14060
+ base: "HTMLBaseElement",
14061
+ basefont: "HTMLBaseFontElement",
14062
+ bdi: "HTMLElement",
14063
+ bdo: "HTMLElement",
14064
+ blockquote: "HTMLQuoteElement",
14065
+ body: "HTMLBodyElement",
14066
+ br: "HTMLBRElement",
14067
+ button: "HTMLButtonElement",
14068
+ canvas: "HTMLCanvasElement",
14069
+ caption: "HTMLTableCaptionElement",
14070
+ cite: "HTMLElement",
14071
+ code: "HTMLElement",
14072
+ col: "HTMLTableColElement",
14073
+ colgroup: "HTMLTableColElement",
14074
+ data: "HTMLDataElement",
14075
+ datalist: "HTMLDataListElement",
14076
+ dd: "HTMLElement",
14077
+ del: "HTMLModElement",
14078
+ details: "HTMLDetailsElement",
14079
+ dfn: "HTMLElement",
14080
+ dialog: "HTMLDialogElement",
14081
+ dir: "HTMLDirectoryElement",
14082
+ div: "HTMLDivElement",
14083
+ dl: "HTMLDListElement",
14084
+ dt: "HTMLElement",
14085
+ em: "HTMLElement",
14086
+ embed: "HTMLEmbedElement",
14087
+ fieldset: "HTMLFieldSetElement",
14088
+ figcaption: "HTMLElement",
14089
+ figure: "HTMLElement",
14090
+ font: "HTMLFontElement",
14091
+ footer: "HTMLElement",
14092
+ form: "HTMLFormElement",
14093
+ frame: "HTMLFrameElement",
14094
+ frameset: "HTMLFrameSetElement",
14095
+ h1: "HTMLHeadingElement",
14096
+ h2: "HTMLHeadingElement",
14097
+ h3: "HTMLHeadingElement",
14098
+ h4: "HTMLHeadingElement",
14099
+ h5: "HTMLHeadingElement",
14100
+ h6: "HTMLHeadingElement",
14101
+ head: "HTMLHeadElement",
14102
+ header: "HTMLElement",
14103
+ hgroup: "HTMLElement",
14104
+ hr: "HTMLHRElement",
14105
+ html: "HTMLHtmlElement",
14106
+ i: "HTMLElement",
14107
+ iframe: "HTMLIFrameElement",
14108
+ img: "HTMLImageElement",
14109
+ input: "HTMLInputElement",
14110
+ ins: "HTMLModElement",
14111
+ kbd: "HTMLElement",
14112
+ label: "HTMLLabelElement",
14113
+ legend: "HTMLLegendElement",
14114
+ li: "HTMLLIElement",
14115
+ link: "HTMLLinkElement",
14116
+ main: "HTMLElement",
14117
+ map: "HTMLMapElement",
14118
+ mark: "HTMLElement",
14119
+ marquee: "HTMLMarqueeElement",
14120
+ menu: "HTMLMenuElement",
14121
+ meta: "HTMLMetaElement",
14122
+ meter: "HTMLMeterElement",
14123
+ nav: "HTMLElement",
14124
+ noscript: "HTMLElement",
14125
+ object: "HTMLObjectElement",
14126
+ ol: "HTMLOListElement",
14127
+ optgroup: "HTMLOptGroupElement",
14128
+ option: "HTMLOptionElement",
14129
+ output: "HTMLOutputElement",
14130
+ p: "HTMLParagraphElement",
14131
+ param: "HTMLParamElement",
14132
+ picture: "HTMLPictureElement",
14133
+ pre: "HTMLPreElement",
14134
+ progress: "HTMLProgressElement",
14135
+ q: "HTMLQuoteElement",
14136
+ rp: "HTMLElement",
14137
+ rt: "HTMLElement",
14138
+ ruby: "HTMLElement",
14139
+ s: "HTMLElement",
14140
+ samp: "HTMLElement",
14141
+ script: "HTMLScriptElement",
14142
+ section: "HTMLElement",
14143
+ select: "HTMLSelectElement",
14144
+ slot: "HTMLSlotElement",
14145
+ small: "HTMLElement",
14146
+ source: "HTMLSourceElement",
14147
+ span: "HTMLSpanElement",
14148
+ strong: "HTMLElement",
14149
+ style: "HTMLStyleElement",
14150
+ sub: "HTMLElement",
14151
+ summary: "HTMLElement",
14152
+ sup: "HTMLElement",
14153
+ table: "HTMLTableElement",
14154
+ tbody: "HTMLTableSectionElement",
14155
+ td: "HTMLTableDataCellElement",
14156
+ template: "HTMLTemplateElement",
14157
+ textarea: "HTMLTextAreaElement",
14158
+ tfoot: "HTMLTableSectionElement",
14159
+ th: "HTMLTableHeaderCellElement",
14160
+ thead: "HTMLTableSectionElement",
14161
+ time: "HTMLTimeElement",
14162
+ title: "HTMLTitleElement",
14163
+ tr: "HTMLTableRowElement",
14164
+ track: "HTMLTrackElement",
14165
+ u: "HTMLElement",
14166
+ ul: "HTMLUListElement",
14167
+ var: "HTMLElement",
14168
+ video: "HTMLVideoElement",
14169
+ wbr: "HTMLElement"
14170
+ };
13953
14171
  function kebabToCamel(str2) {
13954
14172
  return str2.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
13955
14173
  }
@@ -14044,7 +14262,7 @@ function getComponentName(tagName, importedSymbols, headlessContractNames) {
14044
14262
  }
14045
14263
  return { name: componentName, kind: "unknown" };
14046
14264
  }
14047
- if (importedSymbols.has(tagName)) {
14265
+ if (importedSymbols.has(tagName) && !(tagName in htmlElementTagNameMap)) {
14048
14266
  return { name: tagName, kind: "headful" };
14049
14267
  }
14050
14268
  return null;
@@ -14157,127 +14375,6 @@ class Indent {
14157
14375
  return code.split("\n").map((_) => _.length > 0 ? indent + _ : _).join("\n");
14158
14376
  }
14159
14377
  }
14160
- const htmlElementTagNameMap = {
14161
- a: "HTMLAnchorElement",
14162
- abbr: "HTMLElement",
14163
- address: "HTMLElement",
14164
- applet: "HTMLAppletElement",
14165
- area: "HTMLAreaElement",
14166
- article: "HTMLElement",
14167
- aside: "HTMLElement",
14168
- audio: "HTMLAudioElement",
14169
- b: "HTMLElement",
14170
- base: "HTMLBaseElement",
14171
- basefont: "HTMLBaseFontElement",
14172
- bdi: "HTMLElement",
14173
- bdo: "HTMLElement",
14174
- blockquote: "HTMLQuoteElement",
14175
- body: "HTMLBodyElement",
14176
- br: "HTMLBRElement",
14177
- button: "HTMLButtonElement",
14178
- canvas: "HTMLCanvasElement",
14179
- caption: "HTMLTableCaptionElement",
14180
- cite: "HTMLElement",
14181
- code: "HTMLElement",
14182
- col: "HTMLTableColElement",
14183
- colgroup: "HTMLTableColElement",
14184
- data: "HTMLDataElement",
14185
- datalist: "HTMLDataListElement",
14186
- dd: "HTMLElement",
14187
- del: "HTMLModElement",
14188
- details: "HTMLDetailsElement",
14189
- dfn: "HTMLElement",
14190
- dialog: "HTMLDialogElement",
14191
- dir: "HTMLDirectoryElement",
14192
- div: "HTMLDivElement",
14193
- dl: "HTMLDListElement",
14194
- dt: "HTMLElement",
14195
- em: "HTMLElement",
14196
- embed: "HTMLEmbedElement",
14197
- fieldset: "HTMLFieldSetElement",
14198
- figcaption: "HTMLElement",
14199
- figure: "HTMLElement",
14200
- font: "HTMLFontElement",
14201
- footer: "HTMLElement",
14202
- form: "HTMLFormElement",
14203
- frame: "HTMLFrameElement",
14204
- frameset: "HTMLFrameSetElement",
14205
- h1: "HTMLHeadingElement",
14206
- h2: "HTMLHeadingElement",
14207
- h3: "HTMLHeadingElement",
14208
- h4: "HTMLHeadingElement",
14209
- h5: "HTMLHeadingElement",
14210
- h6: "HTMLHeadingElement",
14211
- head: "HTMLHeadElement",
14212
- header: "HTMLElement",
14213
- hgroup: "HTMLElement",
14214
- hr: "HTMLHRElement",
14215
- html: "HTMLHtmlElement",
14216
- i: "HTMLElement",
14217
- iframe: "HTMLIFrameElement",
14218
- img: "HTMLImageElement",
14219
- input: "HTMLInputElement",
14220
- ins: "HTMLModElement",
14221
- kbd: "HTMLElement",
14222
- label: "HTMLLabelElement",
14223
- legend: "HTMLLegendElement",
14224
- li: "HTMLLIElement",
14225
- link: "HTMLLinkElement",
14226
- main: "HTMLElement",
14227
- map: "HTMLMapElement",
14228
- mark: "HTMLElement",
14229
- marquee: "HTMLMarqueeElement",
14230
- menu: "HTMLMenuElement",
14231
- meta: "HTMLMetaElement",
14232
- meter: "HTMLMeterElement",
14233
- nav: "HTMLElement",
14234
- noscript: "HTMLElement",
14235
- object: "HTMLObjectElement",
14236
- ol: "HTMLOListElement",
14237
- optgroup: "HTMLOptGroupElement",
14238
- option: "HTMLOptionElement",
14239
- output: "HTMLOutputElement",
14240
- p: "HTMLParagraphElement",
14241
- param: "HTMLParamElement",
14242
- picture: "HTMLPictureElement",
14243
- pre: "HTMLPreElement",
14244
- progress: "HTMLProgressElement",
14245
- q: "HTMLQuoteElement",
14246
- rp: "HTMLElement",
14247
- rt: "HTMLElement",
14248
- ruby: "HTMLElement",
14249
- s: "HTMLElement",
14250
- samp: "HTMLElement",
14251
- script: "HTMLScriptElement",
14252
- section: "HTMLElement",
14253
- select: "HTMLSelectElement",
14254
- slot: "HTMLSlotElement",
14255
- small: "HTMLElement",
14256
- source: "HTMLSourceElement",
14257
- span: "HTMLSpanElement",
14258
- strong: "HTMLElement",
14259
- style: "HTMLStyleElement",
14260
- sub: "HTMLElement",
14261
- summary: "HTMLElement",
14262
- sup: "HTMLElement",
14263
- table: "HTMLTableElement",
14264
- tbody: "HTMLTableSectionElement",
14265
- td: "HTMLTableDataCellElement",
14266
- template: "HTMLTemplateElement",
14267
- textarea: "HTMLTextAreaElement",
14268
- tfoot: "HTMLTableSectionElement",
14269
- th: "HTMLTableHeaderCellElement",
14270
- thead: "HTMLTableSectionElement",
14271
- time: "HTMLTimeElement",
14272
- title: "HTMLTitleElement",
14273
- tr: "HTMLTableRowElement",
14274
- track: "HTMLTrackElement",
14275
- u: "HTMLElement",
14276
- ul: "HTMLUListElement",
14277
- var: "HTMLElement",
14278
- video: "HTMLVideoElement",
14279
- wbr: "HTMLElement"
14280
- };
14281
14378
  const isComponentType = (type2) => type2 instanceof JayComponentType || type2 instanceof JayTypeAlias || type2 instanceof JayUnionType && type2.ofTypes.every(isComponentType);
14282
14379
  const isComponentRef = (ref) => isComponentType(ref.elementType);
14283
14380
  const isCollectionRef = (ref) => ref.repeated;
@@ -30927,10 +31024,22 @@ const YAML = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty
30927
31024
  visitAsync
30928
31025
  }, Symbol.toStringTag, { value: "Module" }));
30929
31026
  const require$1 = createRequire(import.meta.url);
30930
- const JAY_IMPORT_RESOLVER = {
30931
- analyzeExportedTypes(fullPath, options) {
30932
- return analyzeExportedTypes(fullPath, options);
30933
- },
31027
+ function createAnalysisContext() {
31028
+ const analyzer = createTypeAnalyzer();
31029
+ return {
31030
+ analyzeExportedTypes(fullPath, options) {
31031
+ return analyzer.analyze(fullPath, options);
31032
+ },
31033
+ noteFileChanged(changedPath) {
31034
+ if (changedPath) analyzer.noteFileChanged(changedPath);
31035
+ else analyzer.clear();
31036
+ },
31037
+ clear() {
31038
+ analyzer.clear();
31039
+ }
31040
+ };
31041
+ }
31042
+ const baseResolverMethods = {
30934
31043
  loadContract(fullPath) {
30935
31044
  const content = fs$1.readFileSync(fullPath).toString();
30936
31045
  return parseContract(content, fullPath);
@@ -31008,6 +31117,20 @@ const JAY_IMPORT_RESOLVER = {
31008
31117
  }
31009
31118
  }
31010
31119
  };
31120
+ function createJayImportResolver(context = createAnalysisContext()) {
31121
+ return {
31122
+ ...baseResolverMethods,
31123
+ analyzeExportedTypes: (fullPath, options) => context.analyzeExportedTypes(fullPath, options)
31124
+ };
31125
+ }
31126
+ const defaultAnalysisContext = createAnalysisContext();
31127
+ const JAY_IMPORT_RESOLVER = createJayImportResolver(defaultAnalysisContext);
31128
+ function clearExportedTypesCache() {
31129
+ defaultAnalysisContext.clear();
31130
+ }
31131
+ function noteExportedTypesFileChanged(changedPath) {
31132
+ defaultAnalysisContext.noteFileChanged(changedPath);
31133
+ }
31011
31134
  function buildPhaseMap(contract, headlessContracts, importResolver) {
31012
31135
  const phaseMap = /* @__PURE__ */ new Map();
31013
31136
  function processTag(tag, pathPrefix, parentPhase = "slow", contractDir) {
@@ -31482,6 +31605,11 @@ function hasSlowPhaseProperties(contract) {
31482
31605
  }
31483
31606
  export {
31484
31607
  ContractTagType,
31608
+ DEV_ITEM_ATTR,
31609
+ DEV_REGION_ATTR,
31610
+ DEV_REGION_PROPS_ATTR,
31611
+ DEV_REGION_SRC_ATTR,
31612
+ DEV_SRC_ATTR,
31485
31613
  ERROR_CONTRACT,
31486
31614
  ERROR_CONTRACT_MODULE,
31487
31615
  ERROR_CONTRACT_NAME,
@@ -31490,11 +31618,14 @@ export {
31490
31618
  assignCoordinates,
31491
31619
  assignCoordinatesToJayHtml,
31492
31620
  buildInstanceCoordinateKey,
31621
+ clearExportedTypesCache,
31493
31622
  compileAction,
31494
31623
  compileContract,
31495
31624
  contractToAllPhaseViewStates,
31496
31625
  contractToImportsViewStateAndRefs,
31497
31626
  contractToPhaseViewState,
31627
+ createAnalysisContext,
31628
+ createJayImportResolver,
31498
31629
  createPhaseContract,
31499
31630
  defaultContractResolver,
31500
31631
  discoverHeadlessInstances,
@@ -31512,9 +31643,11 @@ export {
31512
31643
  getLinkedContractDir,
31513
31644
  hasSlowPhaseProperties,
31514
31645
  htmlElementTagNameMap,
31646
+ injectDevMarkers,
31515
31647
  isBuiltInErrorContract,
31516
31648
  isTagInPhase,
31517
31649
  loadLinkedContract,
31650
+ noteExportedTypesFileChanged,
31518
31651
  parseAction,
31519
31652
  parseContract,
31520
31653
  parseEnumValues,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jay-framework/compiler-jay-html",
3
- "version": "0.25.4",
3
+ "version": "0.25.5",
4
4
  "description": "",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/index.js",
@@ -34,12 +34,12 @@
34
34
  },
35
35
  "author": "",
36
36
  "dependencies": {
37
- "@jay-framework/compiler-analyze-exported-types": "^0.25.4",
38
- "@jay-framework/compiler-shared": "^0.25.4",
39
- "@jay-framework/component": "^0.25.4",
40
- "@jay-framework/logger": "^0.25.4",
41
- "@jay-framework/runtime": "^0.25.4",
42
- "@jay-framework/secure": "^0.25.4",
37
+ "@jay-framework/compiler-analyze-exported-types": "^0.25.5",
38
+ "@jay-framework/compiler-shared": "^0.25.5",
39
+ "@jay-framework/component": "^0.25.5",
40
+ "@jay-framework/logger": "^0.25.5",
41
+ "@jay-framework/runtime": "^0.25.5",
42
+ "@jay-framework/secure": "^0.25.5",
43
43
  "@types/js-yaml": "^4.0.9",
44
44
  "change-case": "^4.1.2",
45
45
  "he": "^1.2.0",
@@ -52,8 +52,8 @@
52
52
  },
53
53
  "devDependencies": {
54
54
  "@caiogondim/strip-margin": "^1.0.0",
55
- "@jay-framework/4-react": "^0.25.4",
56
- "@jay-framework/dev-environment": "^0.25.4",
55
+ "@jay-framework/4-react": "^0.25.5",
56
+ "@jay-framework/dev-environment": "^0.25.5",
57
57
  "@testing-library/jest-dom": "^6.2.0",
58
58
  "@types/js-beautify": "^1",
59
59
  "@types/node": "^20.11.5",