@absolutejs/absolute 0.19.0-beta.131 → 0.19.0-beta.132

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/build.js CHANGED
@@ -72,6 +72,146 @@ var init_constants = __esm(() => {
72
72
  TWO_THIRDS = 2 / 3;
73
73
  });
74
74
 
75
+ // src/utils/getDurationString.ts
76
+ var getDurationString = (duration) => {
77
+ let durationString;
78
+ if (duration < MILLISECONDS_IN_A_SECOND) {
79
+ durationString = `${duration.toFixed(TIME_PRECISION)}ms`;
80
+ } else if (duration < MILLISECONDS_IN_A_MINUTE) {
81
+ durationString = `${(duration / MILLISECONDS_IN_A_SECOND).toFixed(TIME_PRECISION)}s`;
82
+ } else {
83
+ durationString = `${(duration / MILLISECONDS_IN_A_MINUTE).toFixed(TIME_PRECISION)}m`;
84
+ }
85
+ return durationString;
86
+ };
87
+ var init_getDurationString = __esm(() => {
88
+ init_constants();
89
+ });
90
+
91
+ // src/utils/startupBanner.ts
92
+ var colors, MONTHS, formatTimestamp = () => {
93
+ const now = new Date;
94
+ const month = MONTHS[now.getMonth()];
95
+ const day = now.getDate().toString().padStart(2, "0");
96
+ let hours = now.getHours();
97
+ const minutes = now.getMinutes().toString().padStart(2, "0");
98
+ const seconds = now.getSeconds().toString().padStart(2, "0");
99
+ const ampm = hours >= HOURS_IN_HALF_DAY ? "PM" : "AM";
100
+ hours = hours % HOURS_IN_HALF_DAY || HOURS_IN_HALF_DAY;
101
+ return `${month} ${day} ${hours}:${minutes}:${seconds} ${ampm}`;
102
+ }, startupBanner = (options) => {
103
+ const {
104
+ version,
105
+ duration,
106
+ port,
107
+ host,
108
+ networkUrl,
109
+ protocol = "http"
110
+ } = options;
111
+ const name = `${colors.cyan}${colors.bold}ABSOLUTEJS${colors.reset}`;
112
+ const ver = `${colors.dim}v${version}${colors.reset}`;
113
+ const time = `${colors.dim}ready in${colors.reset} ${colors.bold}${getDurationString(duration)}${colors.reset}`;
114
+ console.log("");
115
+ console.log(` ${name} ${ver} ${time}`);
116
+ console.log("");
117
+ console.log(` ${colors.green}\u279C${colors.reset} ${colors.bold}Local:${colors.reset} ${protocol}://${host === "0.0.0.0" ? "localhost" : host}:${port}/`);
118
+ if (networkUrl) {
119
+ console.log(` ${colors.green}\u279C${colors.reset} ${colors.bold}Network:${colors.reset} ${networkUrl}`);
120
+ }
121
+ console.log("");
122
+ };
123
+ var init_startupBanner = __esm(() => {
124
+ init_constants();
125
+ init_getDurationString();
126
+ colors = {
127
+ bold: "\x1B[1m",
128
+ cyan: "\x1B[36m",
129
+ dim: "\x1B[2m",
130
+ green: "\x1B[32m",
131
+ reset: "\x1B[0m"
132
+ };
133
+ MONTHS = [
134
+ "Jan",
135
+ "Feb",
136
+ "Mar",
137
+ "Apr",
138
+ "May",
139
+ "Jun",
140
+ "Jul",
141
+ "Aug",
142
+ "Sep",
143
+ "Oct",
144
+ "Nov",
145
+ "Dec"
146
+ ];
147
+ });
148
+
149
+ // src/utils/logger.ts
150
+ var colors2, frameworkColors, formatPath = (filePath) => {
151
+ const cwd = process.cwd();
152
+ let relative = filePath.startsWith(cwd) ? filePath.slice(cwd.length + 1) : filePath;
153
+ relative = relative.replace(/\\/g, "/");
154
+ if (!relative.startsWith("/")) {
155
+ relative = `/${relative}`;
156
+ }
157
+ return relative;
158
+ }, getFrameworkColor = (framework) => frameworkColors[framework] || colors2.white, log = (action, options) => {
159
+ const timestamp = `${colors2.dim}${formatTimestamp()}${colors2.reset}`;
160
+ const tag = `${colors2.cyan}[hmr]${colors2.reset}`;
161
+ let message = action;
162
+ if (options?.path) {
163
+ const pathColor = options.framework ? getFrameworkColor(options.framework) : colors2.white;
164
+ message += ` ${pathColor}${formatPath(options.path)}${colors2.reset}`;
165
+ }
166
+ if (options?.duration !== undefined) {
167
+ message += ` ${colors2.dim}(${options.duration}ms)${colors2.reset}`;
168
+ }
169
+ console.log(`${timestamp} ${tag} ${message}`);
170
+ }, logCssUpdate = (path, framework, duration) => {
171
+ log("css update", { duration, framework: framework ?? "css", path });
172
+ }, logError = (message, error) => {
173
+ const timestamp = `${colors2.dim}${formatTimestamp()}${colors2.reset}`;
174
+ const tag = `${colors2.red}[hmr]${colors2.reset}`;
175
+ const errorMsg = error instanceof Error ? error.message : error;
176
+ const fullMessage = `${colors2.red}error${colors2.reset} ${message}${errorMsg ? `: ${errorMsg}` : ""}`;
177
+ console.error(`${timestamp} ${tag} ${fullMessage}`);
178
+ }, logHmrUpdate = (path, framework, duration) => {
179
+ log("hmr update", { duration, framework, path });
180
+ }, logScriptUpdate = (path, framework, duration) => {
181
+ log("script update", { duration, framework, path });
182
+ }, logServerReload = () => {
183
+ log(`${colors2.cyan}server module reloaded${colors2.reset}`);
184
+ }, logWarn = (message) => {
185
+ const timestamp = `${colors2.dim}${formatTimestamp()}${colors2.reset}`;
186
+ const tag = `${colors2.yellow}[hmr]${colors2.reset}`;
187
+ console.warn(`${timestamp} ${tag} ${colors2.yellow}warning${colors2.reset} ${message}`);
188
+ };
189
+ var init_logger = __esm(() => {
190
+ init_startupBanner();
191
+ colors2 = {
192
+ blue: "\x1B[34m",
193
+ bold: "\x1B[1m",
194
+ cyan: "\x1B[36m",
195
+ dim: "\x1B[2m",
196
+ green: "\x1B[32m",
197
+ magenta: "\x1B[35m",
198
+ red: "\x1B[31m",
199
+ reset: "\x1B[0m",
200
+ white: "\x1B[37m",
201
+ yellow: "\x1B[33m"
202
+ };
203
+ frameworkColors = {
204
+ angular: colors2.magenta,
205
+ assets: colors2.dim,
206
+ css: colors2.cyan,
207
+ html: colors2.white,
208
+ htmx: colors2.white,
209
+ react: colors2.blue,
210
+ svelte: colors2.yellow,
211
+ vue: colors2.green
212
+ };
213
+ });
214
+
75
215
  // src/utils/normalizePath.ts
76
216
  var normalizePath = (path) => path.replace(/\\/g, "/");
77
217
 
@@ -116,7 +256,11 @@ var getManifestKey = (folder, pascalName, isClientComponent, isReact, isVue, isS
116
256
  const pascalName = toPascal(baseName);
117
257
  const ext = extname(fileWithHash);
118
258
  if (ext === ".css") {
119
- manifest[`${pascalName}CSS`] = `/${relative}`;
259
+ const cssKey = `${pascalName}CSS`;
260
+ if (manifest[cssKey] && manifest[cssKey] !== `/${relative}`) {
261
+ logWarn(`Duplicate manifest key "${cssKey}" \u2014 "${manifest[cssKey]}" will be overwritten by "/${relative}". Use unique page names across frameworks.`);
262
+ }
263
+ manifest[cssKey] = `/${relative}`;
120
264
  return manifest;
121
265
  }
122
266
  const idx = segments.findIndex((seg) => seg === "indexes" || seg === "pages" || seg === "client");
@@ -127,11 +271,15 @@ var getManifestKey = (folder, pascalName, isClientComponent, isReact, isVue, isS
127
271
  const isAngular = segments.some((seg) => seg === "angular");
128
272
  const isClientComponent = segments.includes("client");
129
273
  const manifestKey = getManifestKey(folder, pascalName, isClientComponent, isReact, isVue, isSvelte, isAngular);
274
+ if (manifest[manifestKey] && manifest[manifestKey] !== `/${relative}`) {
275
+ logWarn(`Duplicate manifest key "${manifestKey}" \u2014 "${manifest[manifestKey]}" will be overwritten by "/${relative}". Use unique page names across frameworks.`);
276
+ }
130
277
  manifest[manifestKey] = `/${relative}`;
131
278
  return manifest;
132
279
  }, {});
133
280
  var init_generateManifest = __esm(() => {
134
281
  init_constants();
282
+ init_logger();
135
283
  });
136
284
 
137
285
  // src/build/generateReactIndexes.ts
@@ -516,15 +664,15 @@ var init_htmlScriptHMRPlugin = __esm(() => {
516
664
 
517
665
  // src/build/outputLogs.ts
518
666
  var outputLogs = (logs) => {
519
- for (const log of logs) {
520
- if (log.message.includes(BUN_BUILD_WARNING_SUPPRESSION))
667
+ for (const log2 of logs) {
668
+ if (log2.message.includes(BUN_BUILD_WARNING_SUPPRESSION))
521
669
  continue;
522
- if (log.level === "error")
523
- console.error(log);
524
- else if (log.level === "warning")
525
- console.warn(log);
670
+ if (log2.level === "error")
671
+ console.error(log2);
672
+ else if (log2.level === "warning")
673
+ console.warn(log2);
526
674
  else
527
- console.info(log);
675
+ console.info(log2);
528
676
  }
529
677
  };
530
678
  var init_outputLogs = __esm(() => {
@@ -714,7 +862,7 @@ var resolveHmrClientPath = () => {
714
862
  console.error("Failed to build HMR client:", result.logs);
715
863
  sendTelemetryEvent("hmr:client-build-failed", {
716
864
  logCount: result.logs.length,
717
- message: result.logs.map((log) => log.message).join("; ")
865
+ message: result.logs.map((log2) => log2.message).join("; ")
718
866
  });
719
867
  return "// HMR client build failed";
720
868
  }
@@ -1062,146 +1210,6 @@ var commonAncestor = (paths, fallback) => {
1062
1210
  };
1063
1211
  var init_commonAncestor = () => {};
1064
1212
 
1065
- // src/utils/getDurationString.ts
1066
- var getDurationString = (duration) => {
1067
- let durationString;
1068
- if (duration < MILLISECONDS_IN_A_SECOND) {
1069
- durationString = `${duration.toFixed(TIME_PRECISION)}ms`;
1070
- } else if (duration < MILLISECONDS_IN_A_MINUTE) {
1071
- durationString = `${(duration / MILLISECONDS_IN_A_SECOND).toFixed(TIME_PRECISION)}s`;
1072
- } else {
1073
- durationString = `${(duration / MILLISECONDS_IN_A_MINUTE).toFixed(TIME_PRECISION)}m`;
1074
- }
1075
- return durationString;
1076
- };
1077
- var init_getDurationString = __esm(() => {
1078
- init_constants();
1079
- });
1080
-
1081
- // src/utils/startupBanner.ts
1082
- var colors, MONTHS, formatTimestamp = () => {
1083
- const now = new Date;
1084
- const month = MONTHS[now.getMonth()];
1085
- const day = now.getDate().toString().padStart(2, "0");
1086
- let hours = now.getHours();
1087
- const minutes = now.getMinutes().toString().padStart(2, "0");
1088
- const seconds = now.getSeconds().toString().padStart(2, "0");
1089
- const ampm = hours >= HOURS_IN_HALF_DAY ? "PM" : "AM";
1090
- hours = hours % HOURS_IN_HALF_DAY || HOURS_IN_HALF_DAY;
1091
- return `${month} ${day} ${hours}:${minutes}:${seconds} ${ampm}`;
1092
- }, startupBanner = (options) => {
1093
- const {
1094
- version,
1095
- duration,
1096
- port,
1097
- host,
1098
- networkUrl,
1099
- protocol = "http"
1100
- } = options;
1101
- const name = `${colors.cyan}${colors.bold}ABSOLUTEJS${colors.reset}`;
1102
- const ver = `${colors.dim}v${version}${colors.reset}`;
1103
- const time = `${colors.dim}ready in${colors.reset} ${colors.bold}${getDurationString(duration)}${colors.reset}`;
1104
- console.log("");
1105
- console.log(` ${name} ${ver} ${time}`);
1106
- console.log("");
1107
- console.log(` ${colors.green}\u279C${colors.reset} ${colors.bold}Local:${colors.reset} ${protocol}://${host === "0.0.0.0" ? "localhost" : host}:${port}/`);
1108
- if (networkUrl) {
1109
- console.log(` ${colors.green}\u279C${colors.reset} ${colors.bold}Network:${colors.reset} ${networkUrl}`);
1110
- }
1111
- console.log("");
1112
- };
1113
- var init_startupBanner = __esm(() => {
1114
- init_constants();
1115
- init_getDurationString();
1116
- colors = {
1117
- bold: "\x1B[1m",
1118
- cyan: "\x1B[36m",
1119
- dim: "\x1B[2m",
1120
- green: "\x1B[32m",
1121
- reset: "\x1B[0m"
1122
- };
1123
- MONTHS = [
1124
- "Jan",
1125
- "Feb",
1126
- "Mar",
1127
- "Apr",
1128
- "May",
1129
- "Jun",
1130
- "Jul",
1131
- "Aug",
1132
- "Sep",
1133
- "Oct",
1134
- "Nov",
1135
- "Dec"
1136
- ];
1137
- });
1138
-
1139
- // src/utils/logger.ts
1140
- var colors2, frameworkColors, formatPath = (filePath) => {
1141
- const cwd = process.cwd();
1142
- let relative3 = filePath.startsWith(cwd) ? filePath.slice(cwd.length + 1) : filePath;
1143
- relative3 = relative3.replace(/\\/g, "/");
1144
- if (!relative3.startsWith("/")) {
1145
- relative3 = `/${relative3}`;
1146
- }
1147
- return relative3;
1148
- }, getFrameworkColor = (framework) => frameworkColors[framework] || colors2.white, log = (action, options) => {
1149
- const timestamp = `${colors2.dim}${formatTimestamp()}${colors2.reset}`;
1150
- const tag = `${colors2.cyan}[hmr]${colors2.reset}`;
1151
- let message = action;
1152
- if (options?.path) {
1153
- const pathColor = options.framework ? getFrameworkColor(options.framework) : colors2.white;
1154
- message += ` ${pathColor}${formatPath(options.path)}${colors2.reset}`;
1155
- }
1156
- if (options?.duration !== undefined) {
1157
- message += ` ${colors2.dim}(${options.duration}ms)${colors2.reset}`;
1158
- }
1159
- console.log(`${timestamp} ${tag} ${message}`);
1160
- }, logCssUpdate = (path, framework, duration) => {
1161
- log("css update", { duration, framework: framework ?? "css", path });
1162
- }, logError = (message, error) => {
1163
- const timestamp = `${colors2.dim}${formatTimestamp()}${colors2.reset}`;
1164
- const tag = `${colors2.red}[hmr]${colors2.reset}`;
1165
- const errorMsg = error instanceof Error ? error.message : error;
1166
- const fullMessage = `${colors2.red}error${colors2.reset} ${message}${errorMsg ? `: ${errorMsg}` : ""}`;
1167
- console.error(`${timestamp} ${tag} ${fullMessage}`);
1168
- }, logHmrUpdate = (path, framework, duration) => {
1169
- log("hmr update", { duration, framework, path });
1170
- }, logScriptUpdate = (path, framework, duration) => {
1171
- log("script update", { duration, framework, path });
1172
- }, logServerReload = () => {
1173
- log(`${colors2.cyan}server module reloaded${colors2.reset}`);
1174
- }, logWarn = (message) => {
1175
- const timestamp = `${colors2.dim}${formatTimestamp()}${colors2.reset}`;
1176
- const tag = `${colors2.yellow}[hmr]${colors2.reset}`;
1177
- console.warn(`${timestamp} ${tag} ${colors2.yellow}warning${colors2.reset} ${message}`);
1178
- };
1179
- var init_logger = __esm(() => {
1180
- init_startupBanner();
1181
- colors2 = {
1182
- blue: "\x1B[34m",
1183
- bold: "\x1B[1m",
1184
- cyan: "\x1B[36m",
1185
- dim: "\x1B[2m",
1186
- green: "\x1B[32m",
1187
- magenta: "\x1B[35m",
1188
- red: "\x1B[31m",
1189
- reset: "\x1B[0m",
1190
- white: "\x1B[37m",
1191
- yellow: "\x1B[33m"
1192
- };
1193
- frameworkColors = {
1194
- angular: colors2.magenta,
1195
- assets: colors2.dim,
1196
- css: colors2.cyan,
1197
- html: colors2.white,
1198
- htmx: colors2.white,
1199
- react: colors2.blue,
1200
- svelte: colors2.yellow,
1201
- vue: colors2.green
1202
- };
1203
- });
1204
-
1205
1213
  // src/utils/validateSafePath.ts
1206
1214
  import { resolve as resolve6, relative as relative3 } from "path";
1207
1215
  var validateSafePath = (targetPath, baseDirectory) => {
@@ -205061,5 +205069,5 @@ export {
205061
205069
  build
205062
205070
  };
205063
205071
 
205064
- //# debugId=242CBBFA5B536A0D64756E2164756E21
205072
+ //# debugId=208EE5F5114BBB0864756E2164756E21
205065
205073
  //# sourceMappingURL=build.js.map