@jay-framework/compiler-jay-html 0.19.1 → 0.19.2

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
@@ -1,4 +1,4 @@
1
- import { JayType, WithValidations, PluginComponentResolution, PluginManifest, JayEnumType, RefsTree, CompilerSourceFile, SourceFileFormat, JayImportLink, TemplatePart, GenerateTarget, Imports, MainRuntimeModes, JayObjectType } from '@jay-framework/compiler-shared';
1
+ import { JayType, WithValidations, PluginComponentResolution, PluginManifest, JayEnumType, RefsTree, CompilerSourceFile, SourceFileFormat, JayHtmlHeadMeta, JayImportLink, TemplatePart, GenerateTarget, Imports, MainRuntimeModes, JayObjectType } from '@jay-framework/compiler-shared';
2
2
  import { HTMLElement } from 'node-html-parser';
3
3
  import { ResolveTsConfigOptions } from '@jay-framework/compiler-analyze-exported-types';
4
4
  import { Coordinate } from '@jay-framework/runtime';
@@ -213,6 +213,7 @@ interface JayHtmlSourceFile extends CompilerSourceFile {
213
213
  * Excludes arrays with phase 'fast+interactive' (dynamic arrays that can be fully replaced).
214
214
  */
215
215
  clientTrackByMap?: Record<string, string>;
216
+ headMeta?: JayHtmlHeadMeta;
216
217
  }
217
218
 
218
219
  declare function parseTemplateParts(value: string): TemplatePart[];
package/dist/index.js CHANGED
@@ -18766,6 +18766,33 @@ function parseHeadLinks(root, excludeCssLinks = false) {
18766
18766
  };
18767
18767
  });
18768
18768
  }
18769
+ function parseHeadMeta(root) {
18770
+ const head = root.querySelector("head");
18771
+ if (!head)
18772
+ return void 0;
18773
+ const titleEl = head.querySelector("title");
18774
+ const title = titleEl?.textContent?.trim() || void 0;
18775
+ const meta = [];
18776
+ for (const el of head.querySelectorAll("meta")) {
18777
+ const content = el.getAttribute("content");
18778
+ if (content === void 0 || content === null)
18779
+ continue;
18780
+ const name = el.getAttribute("name");
18781
+ const property = el.getAttribute("property");
18782
+ if (name || property) {
18783
+ meta.push({ name: name || void 0, property: property || void 0, content });
18784
+ }
18785
+ }
18786
+ const links = [];
18787
+ for (const el of head.querySelectorAll("link")) {
18788
+ const rel = el.getAttribute("rel");
18789
+ if (!rel)
18790
+ continue;
18791
+ const attrs = { ...el.attributes };
18792
+ links.push(attrs);
18793
+ }
18794
+ return { title, meta, links };
18795
+ }
18769
18796
  async function extractCss(root, filePath) {
18770
18797
  const cssParts = [];
18771
18798
  const validations = [];
@@ -18900,6 +18927,7 @@ async function parseJayFile(html2, filename, filePath, options, linkedContractRe
18900
18927
  const cssResult = await extractCss(root, filePath);
18901
18928
  const excludeCssLinks = !!filePath;
18902
18929
  const headLinks = parseHeadLinks(root, excludeCssLinks);
18930
+ const headMeta = parseHeadMeta(root);
18903
18931
  validations.push(...cssResult.validations);
18904
18932
  if (validations.length > 0)
18905
18933
  return new WithValidations(void 0, validations);
@@ -18934,7 +18962,8 @@ async function parseJayFile(html2, filename, filePath, options, linkedContractRe
18934
18962
  contractRef: jayYaml.contractRef,
18935
18963
  hasInlineData: jayYaml.hasInlineData,
18936
18964
  serverTrackByMap: Object.keys(serverTrackByMap).length > 0 ? serverTrackByMap : void 0,
18937
- clientTrackByMap: Object.keys(clientTrackByMap).length > 0 ? clientTrackByMap : void 0
18965
+ clientTrackByMap: Object.keys(clientTrackByMap).length > 0 ? clientTrackByMap : void 0,
18966
+ headMeta
18938
18967
  },
18939
18968
  validations
18940
18969
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jay-framework/compiler-jay-html",
3
- "version": "0.19.1",
3
+ "version": "0.19.2",
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.19.1",
38
- "@jay-framework/compiler-shared": "^0.19.1",
39
- "@jay-framework/component": "^0.19.1",
40
- "@jay-framework/logger": "^0.19.1",
41
- "@jay-framework/runtime": "^0.19.1",
42
- "@jay-framework/secure": "^0.19.1",
37
+ "@jay-framework/compiler-analyze-exported-types": "^0.19.2",
38
+ "@jay-framework/compiler-shared": "^0.19.2",
39
+ "@jay-framework/component": "^0.19.2",
40
+ "@jay-framework/logger": "^0.19.2",
41
+ "@jay-framework/runtime": "^0.19.2",
42
+ "@jay-framework/secure": "^0.19.2",
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.19.1",
56
- "@jay-framework/dev-environment": "^0.19.1",
55
+ "@jay-framework/4-react": "^0.19.2",
56
+ "@jay-framework/dev-environment": "^0.19.2",
57
57
  "@testing-library/jest-dom": "^6.2.0",
58
58
  "@types/js-beautify": "^1",
59
59
  "@types/node": "^20.11.5",