@absolutejs/absolute 0.19.0-beta.318 → 0.19.0-beta.319

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/cli/index.js CHANGED
@@ -1007,8 +1007,14 @@ var exports_generateIslandBindings = {};
1007
1007
  __export(exports_generateIslandBindings, {
1008
1008
  generateIslandBindings: () => generateIslandBindings
1009
1009
  });
1010
- import { existsSync as existsSync9, mkdirSync as mkdirSync4, rmSync as rmSync2, writeFileSync as writeFileSync2 } from "fs";
1011
- import { dirname as dirname2, resolve as resolve7 } from "path";
1010
+ import {
1011
+ existsSync as existsSync9,
1012
+ mkdirSync as mkdirSync4,
1013
+ readFileSync as readFileSync9,
1014
+ rmSync as rmSync2,
1015
+ writeFileSync as writeFileSync2
1016
+ } from "fs";
1017
+ import { dirname as dirname2, relative as relative2, resolve as resolve7 } from "path";
1012
1018
  var ensureDir = (filePath) => {
1013
1019
  mkdirSync4(dirname2(filePath), { recursive: true });
1014
1020
  }, writeIfChanged = (filePath, content) => {
@@ -1018,11 +1024,77 @@ var ensureDir = (filePath) => {
1018
1024
  if (existsSync9(filePath)) {
1019
1025
  rmSync2(filePath, { force: true });
1020
1026
  }
1027
+ }, writeHTMLCustomData = (projectRoot) => {
1028
+ const customDataPath = resolve7(projectRoot, ".absolutejs", "html-custom-data.json");
1029
+ const vscodeSettingsPath = resolve7(projectRoot, ".vscode", "settings.json");
1030
+ const customDataRelativePath = relative2(dirname2(vscodeSettingsPath), customDataPath).replace(/\\/g, "/");
1031
+ const customData = {
1032
+ version: 1.1,
1033
+ tags: [
1034
+ {
1035
+ name: "absolute-island",
1036
+ description: "Platform-native AbsoluteJS island element for HTML and HTMX host pages. AbsoluteJS server rendering lowers this element into SSR island markup and the client bootstrap hydrates it according to the `hydrate` mode.",
1037
+ attributes: [
1038
+ {
1039
+ name: "framework",
1040
+ description: "Target framework runtime for this island component.",
1041
+ values: [
1042
+ { name: "react" },
1043
+ { name: "svelte" },
1044
+ { name: "vue" },
1045
+ { name: "angular" }
1046
+ ]
1047
+ },
1048
+ {
1049
+ name: "component",
1050
+ description: "Registry component name to render for this island."
1051
+ },
1052
+ {
1053
+ name: "hydrate",
1054
+ description: "Client hydration timing. `load` hydrates immediately, `idle` waits for idle time, `visible` waits for intersection, and `none` renders static HTML only.",
1055
+ values: [
1056
+ { name: "load" },
1057
+ { name: "idle" },
1058
+ { name: "visible" },
1059
+ { name: "none" }
1060
+ ]
1061
+ },
1062
+ {
1063
+ name: "props",
1064
+ description: "JSON-serialized props payload passed to the target island component. In HTML, prefer single quotes around the attribute so the JSON can keep its double quotes."
1065
+ }
1066
+ ]
1067
+ }
1068
+ ]
1069
+ };
1070
+ writeIfChanged(customDataPath, `${JSON.stringify(customData, null, 2)}
1071
+ `);
1072
+ let settings = {};
1073
+ if (existsSync9(vscodeSettingsPath)) {
1074
+ try {
1075
+ const parsed = JSON.parse(readFileSync9(vscodeSettingsPath, "utf-8"));
1076
+ if (parsed && typeof parsed === "object") {
1077
+ settings = parsed;
1078
+ }
1079
+ } catch {
1080
+ return;
1081
+ }
1082
+ }
1083
+ const currentCustomData = Array.isArray(settings["html.customData"]) ? settings["html.customData"].filter((value) => typeof value === "string") : [];
1084
+ if (!currentCustomData.includes(customDataRelativePath)) {
1085
+ settings["html.customData"] = [
1086
+ ...currentCustomData,
1087
+ customDataRelativePath
1088
+ ];
1089
+ writeIfChanged(vscodeSettingsPath, `${JSON.stringify(settings, null, 2)}
1090
+ `);
1091
+ }
1021
1092
  }, generateIslandBindings = (projectRoot, config) => {
1022
1093
  const registryPath = config.islands?.registry;
1023
1094
  if (!registryPath) {
1024
1095
  return;
1025
1096
  }
1097
+ writeHTMLCustomData(projectRoot);
1026
1098
  const resolvedRegistryPath = resolve7(projectRoot, registryPath);
1027
1099
  removeIfExists(resolve7(dirname2(resolvedRegistryPath), "absolute-islands.d.ts"));
1028
1100
  if (config.reactDirectory) {