@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/index.js CHANGED
@@ -151,6 +151,146 @@ body{min-height:100vh;background:linear-gradient(135deg,rgba(15,23,42,0.98) 0%,r
151
151
  </html>`;
152
152
  };
153
153
 
154
+ // src/utils/getDurationString.ts
155
+ var getDurationString = (duration) => {
156
+ let durationString;
157
+ if (duration < MILLISECONDS_IN_A_SECOND) {
158
+ durationString = `${duration.toFixed(TIME_PRECISION)}ms`;
159
+ } else if (duration < MILLISECONDS_IN_A_MINUTE) {
160
+ durationString = `${(duration / MILLISECONDS_IN_A_SECOND).toFixed(TIME_PRECISION)}s`;
161
+ } else {
162
+ durationString = `${(duration / MILLISECONDS_IN_A_MINUTE).toFixed(TIME_PRECISION)}m`;
163
+ }
164
+ return durationString;
165
+ };
166
+ var init_getDurationString = __esm(() => {
167
+ init_constants();
168
+ });
169
+
170
+ // src/utils/startupBanner.ts
171
+ var colors, MONTHS, formatTimestamp = () => {
172
+ const now = new Date;
173
+ const month = MONTHS[now.getMonth()];
174
+ const day = now.getDate().toString().padStart(2, "0");
175
+ let hours = now.getHours();
176
+ const minutes = now.getMinutes().toString().padStart(2, "0");
177
+ const seconds = now.getSeconds().toString().padStart(2, "0");
178
+ const ampm = hours >= HOURS_IN_HALF_DAY ? "PM" : "AM";
179
+ hours = hours % HOURS_IN_HALF_DAY || HOURS_IN_HALF_DAY;
180
+ return `${month} ${day} ${hours}:${minutes}:${seconds} ${ampm}`;
181
+ }, startupBanner = (options) => {
182
+ const {
183
+ version,
184
+ duration,
185
+ port,
186
+ host,
187
+ networkUrl,
188
+ protocol = "http"
189
+ } = options;
190
+ const name = `${colors.cyan}${colors.bold}ABSOLUTEJS${colors.reset}`;
191
+ const ver = `${colors.dim}v${version}${colors.reset}`;
192
+ const time = `${colors.dim}ready in${colors.reset} ${colors.bold}${getDurationString(duration)}${colors.reset}`;
193
+ console.log("");
194
+ console.log(` ${name} ${ver} ${time}`);
195
+ console.log("");
196
+ console.log(` ${colors.green}\u279C${colors.reset} ${colors.bold}Local:${colors.reset} ${protocol}://${host === "0.0.0.0" ? "localhost" : host}:${port}/`);
197
+ if (networkUrl) {
198
+ console.log(` ${colors.green}\u279C${colors.reset} ${colors.bold}Network:${colors.reset} ${networkUrl}`);
199
+ }
200
+ console.log("");
201
+ };
202
+ var init_startupBanner = __esm(() => {
203
+ init_constants();
204
+ init_getDurationString();
205
+ colors = {
206
+ bold: "\x1B[1m",
207
+ cyan: "\x1B[36m",
208
+ dim: "\x1B[2m",
209
+ green: "\x1B[32m",
210
+ reset: "\x1B[0m"
211
+ };
212
+ MONTHS = [
213
+ "Jan",
214
+ "Feb",
215
+ "Mar",
216
+ "Apr",
217
+ "May",
218
+ "Jun",
219
+ "Jul",
220
+ "Aug",
221
+ "Sep",
222
+ "Oct",
223
+ "Nov",
224
+ "Dec"
225
+ ];
226
+ });
227
+
228
+ // src/utils/logger.ts
229
+ var colors2, frameworkColors, formatPath = (filePath) => {
230
+ const cwd = process.cwd();
231
+ let relative = filePath.startsWith(cwd) ? filePath.slice(cwd.length + 1) : filePath;
232
+ relative = relative.replace(/\\/g, "/");
233
+ if (!relative.startsWith("/")) {
234
+ relative = `/${relative}`;
235
+ }
236
+ return relative;
237
+ }, getFrameworkColor = (framework) => frameworkColors[framework] || colors2.white, log = (action, options) => {
238
+ const timestamp = `${colors2.dim}${formatTimestamp()}${colors2.reset}`;
239
+ const tag = `${colors2.cyan}[hmr]${colors2.reset}`;
240
+ let message = action;
241
+ if (options?.path) {
242
+ const pathColor = options.framework ? getFrameworkColor(options.framework) : colors2.white;
243
+ message += ` ${pathColor}${formatPath(options.path)}${colors2.reset}`;
244
+ }
245
+ if (options?.duration !== undefined) {
246
+ message += ` ${colors2.dim}(${options.duration}ms)${colors2.reset}`;
247
+ }
248
+ console.log(`${timestamp} ${tag} ${message}`);
249
+ }, logCssUpdate = (path, framework, duration) => {
250
+ log("css update", { duration, framework: framework ?? "css", path });
251
+ }, logError = (message, error) => {
252
+ const timestamp = `${colors2.dim}${formatTimestamp()}${colors2.reset}`;
253
+ const tag = `${colors2.red}[hmr]${colors2.reset}`;
254
+ const errorMsg = error instanceof Error ? error.message : error;
255
+ const fullMessage = `${colors2.red}error${colors2.reset} ${message}${errorMsg ? `: ${errorMsg}` : ""}`;
256
+ console.error(`${timestamp} ${tag} ${fullMessage}`);
257
+ }, logHmrUpdate = (path, framework, duration) => {
258
+ log("hmr update", { duration, framework, path });
259
+ }, logScriptUpdate = (path, framework, duration) => {
260
+ log("script update", { duration, framework, path });
261
+ }, logServerReload = () => {
262
+ log(`${colors2.cyan}server module reloaded${colors2.reset}`);
263
+ }, logWarn = (message) => {
264
+ const timestamp = `${colors2.dim}${formatTimestamp()}${colors2.reset}`;
265
+ const tag = `${colors2.yellow}[hmr]${colors2.reset}`;
266
+ console.warn(`${timestamp} ${tag} ${colors2.yellow}warning${colors2.reset} ${message}`);
267
+ };
268
+ var init_logger = __esm(() => {
269
+ init_startupBanner();
270
+ colors2 = {
271
+ blue: "\x1B[34m",
272
+ bold: "\x1B[1m",
273
+ cyan: "\x1B[36m",
274
+ dim: "\x1B[2m",
275
+ green: "\x1B[32m",
276
+ magenta: "\x1B[35m",
277
+ red: "\x1B[31m",
278
+ reset: "\x1B[0m",
279
+ white: "\x1B[37m",
280
+ yellow: "\x1B[33m"
281
+ };
282
+ frameworkColors = {
283
+ angular: colors2.magenta,
284
+ assets: colors2.dim,
285
+ css: colors2.cyan,
286
+ html: colors2.white,
287
+ htmx: colors2.white,
288
+ react: colors2.blue,
289
+ svelte: colors2.yellow,
290
+ vue: colors2.green
291
+ };
292
+ });
293
+
154
294
  // src/utils/normalizePath.ts
155
295
  var normalizePath = (path) => path.replace(/\\/g, "/");
156
296
 
@@ -195,7 +335,11 @@ var getManifestKey = (folder, pascalName, isClientComponent, isReact, isVue, isS
195
335
  const pascalName = toPascal(baseName);
196
336
  const ext = extname(fileWithHash);
197
337
  if (ext === ".css") {
198
- manifest[`${pascalName}CSS`] = `/${relative}`;
338
+ const cssKey = `${pascalName}CSS`;
339
+ if (manifest[cssKey] && manifest[cssKey] !== `/${relative}`) {
340
+ logWarn(`Duplicate manifest key "${cssKey}" \u2014 "${manifest[cssKey]}" will be overwritten by "/${relative}". Use unique page names across frameworks.`);
341
+ }
342
+ manifest[cssKey] = `/${relative}`;
199
343
  return manifest;
200
344
  }
201
345
  const idx = segments.findIndex((seg) => seg === "indexes" || seg === "pages" || seg === "client");
@@ -206,11 +350,15 @@ var getManifestKey = (folder, pascalName, isClientComponent, isReact, isVue, isS
206
350
  const isAngular = segments.some((seg) => seg === "angular");
207
351
  const isClientComponent = segments.includes("client");
208
352
  const manifestKey = getManifestKey(folder, pascalName, isClientComponent, isReact, isVue, isSvelte, isAngular);
353
+ if (manifest[manifestKey] && manifest[manifestKey] !== `/${relative}`) {
354
+ logWarn(`Duplicate manifest key "${manifestKey}" \u2014 "${manifest[manifestKey]}" will be overwritten by "/${relative}". Use unique page names across frameworks.`);
355
+ }
209
356
  manifest[manifestKey] = `/${relative}`;
210
357
  return manifest;
211
358
  }, {});
212
359
  var init_generateManifest = __esm(() => {
213
360
  init_constants();
361
+ init_logger();
214
362
  });
215
363
 
216
364
  // src/build/generateReactIndexes.ts
@@ -595,15 +743,15 @@ var init_htmlScriptHMRPlugin = __esm(() => {
595
743
 
596
744
  // src/build/outputLogs.ts
597
745
  var outputLogs = (logs) => {
598
- for (const log of logs) {
599
- if (log.message.includes(BUN_BUILD_WARNING_SUPPRESSION))
746
+ for (const log2 of logs) {
747
+ if (log2.message.includes(BUN_BUILD_WARNING_SUPPRESSION))
600
748
  continue;
601
- if (log.level === "error")
602
- console.error(log);
603
- else if (log.level === "warning")
604
- console.warn(log);
749
+ if (log2.level === "error")
750
+ console.error(log2);
751
+ else if (log2.level === "warning")
752
+ console.warn(log2);
605
753
  else
606
- console.info(log);
754
+ console.info(log2);
607
755
  }
608
756
  };
609
757
  var init_outputLogs = __esm(() => {
@@ -793,7 +941,7 @@ var resolveHmrClientPath = () => {
793
941
  console.error("Failed to build HMR client:", result.logs);
794
942
  sendTelemetryEvent("hmr:client-build-failed", {
795
943
  logCount: result.logs.length,
796
- message: result.logs.map((log) => log.message).join("; ")
944
+ message: result.logs.map((log2) => log2.message).join("; ")
797
945
  });
798
946
  return "// HMR client build failed";
799
947
  }
@@ -1141,146 +1289,6 @@ var commonAncestor = (paths, fallback) => {
1141
1289
  };
1142
1290
  var init_commonAncestor = () => {};
1143
1291
 
1144
- // src/utils/getDurationString.ts
1145
- var getDurationString = (duration) => {
1146
- let durationString;
1147
- if (duration < MILLISECONDS_IN_A_SECOND) {
1148
- durationString = `${duration.toFixed(TIME_PRECISION)}ms`;
1149
- } else if (duration < MILLISECONDS_IN_A_MINUTE) {
1150
- durationString = `${(duration / MILLISECONDS_IN_A_SECOND).toFixed(TIME_PRECISION)}s`;
1151
- } else {
1152
- durationString = `${(duration / MILLISECONDS_IN_A_MINUTE).toFixed(TIME_PRECISION)}m`;
1153
- }
1154
- return durationString;
1155
- };
1156
- var init_getDurationString = __esm(() => {
1157
- init_constants();
1158
- });
1159
-
1160
- // src/utils/startupBanner.ts
1161
- var colors, MONTHS, formatTimestamp = () => {
1162
- const now = new Date;
1163
- const month = MONTHS[now.getMonth()];
1164
- const day = now.getDate().toString().padStart(2, "0");
1165
- let hours = now.getHours();
1166
- const minutes = now.getMinutes().toString().padStart(2, "0");
1167
- const seconds = now.getSeconds().toString().padStart(2, "0");
1168
- const ampm = hours >= HOURS_IN_HALF_DAY ? "PM" : "AM";
1169
- hours = hours % HOURS_IN_HALF_DAY || HOURS_IN_HALF_DAY;
1170
- return `${month} ${day} ${hours}:${minutes}:${seconds} ${ampm}`;
1171
- }, startupBanner = (options) => {
1172
- const {
1173
- version,
1174
- duration,
1175
- port,
1176
- host,
1177
- networkUrl,
1178
- protocol = "http"
1179
- } = options;
1180
- const name = `${colors.cyan}${colors.bold}ABSOLUTEJS${colors.reset}`;
1181
- const ver = `${colors.dim}v${version}${colors.reset}`;
1182
- const time = `${colors.dim}ready in${colors.reset} ${colors.bold}${getDurationString(duration)}${colors.reset}`;
1183
- console.log("");
1184
- console.log(` ${name} ${ver} ${time}`);
1185
- console.log("");
1186
- console.log(` ${colors.green}\u279C${colors.reset} ${colors.bold}Local:${colors.reset} ${protocol}://${host === "0.0.0.0" ? "localhost" : host}:${port}/`);
1187
- if (networkUrl) {
1188
- console.log(` ${colors.green}\u279C${colors.reset} ${colors.bold}Network:${colors.reset} ${networkUrl}`);
1189
- }
1190
- console.log("");
1191
- };
1192
- var init_startupBanner = __esm(() => {
1193
- init_constants();
1194
- init_getDurationString();
1195
- colors = {
1196
- bold: "\x1B[1m",
1197
- cyan: "\x1B[36m",
1198
- dim: "\x1B[2m",
1199
- green: "\x1B[32m",
1200
- reset: "\x1B[0m"
1201
- };
1202
- MONTHS = [
1203
- "Jan",
1204
- "Feb",
1205
- "Mar",
1206
- "Apr",
1207
- "May",
1208
- "Jun",
1209
- "Jul",
1210
- "Aug",
1211
- "Sep",
1212
- "Oct",
1213
- "Nov",
1214
- "Dec"
1215
- ];
1216
- });
1217
-
1218
- // src/utils/logger.ts
1219
- var colors2, frameworkColors, formatPath = (filePath) => {
1220
- const cwd = process.cwd();
1221
- let relative3 = filePath.startsWith(cwd) ? filePath.slice(cwd.length + 1) : filePath;
1222
- relative3 = relative3.replace(/\\/g, "/");
1223
- if (!relative3.startsWith("/")) {
1224
- relative3 = `/${relative3}`;
1225
- }
1226
- return relative3;
1227
- }, getFrameworkColor = (framework) => frameworkColors[framework] || colors2.white, log = (action, options) => {
1228
- const timestamp = `${colors2.dim}${formatTimestamp()}${colors2.reset}`;
1229
- const tag = `${colors2.cyan}[hmr]${colors2.reset}`;
1230
- let message = action;
1231
- if (options?.path) {
1232
- const pathColor = options.framework ? getFrameworkColor(options.framework) : colors2.white;
1233
- message += ` ${pathColor}${formatPath(options.path)}${colors2.reset}`;
1234
- }
1235
- if (options?.duration !== undefined) {
1236
- message += ` ${colors2.dim}(${options.duration}ms)${colors2.reset}`;
1237
- }
1238
- console.log(`${timestamp} ${tag} ${message}`);
1239
- }, logCssUpdate = (path, framework, duration) => {
1240
- log("css update", { duration, framework: framework ?? "css", path });
1241
- }, logError = (message, error) => {
1242
- const timestamp = `${colors2.dim}${formatTimestamp()}${colors2.reset}`;
1243
- const tag = `${colors2.red}[hmr]${colors2.reset}`;
1244
- const errorMsg = error instanceof Error ? error.message : error;
1245
- const fullMessage = `${colors2.red}error${colors2.reset} ${message}${errorMsg ? `: ${errorMsg}` : ""}`;
1246
- console.error(`${timestamp} ${tag} ${fullMessage}`);
1247
- }, logHmrUpdate = (path, framework, duration) => {
1248
- log("hmr update", { duration, framework, path });
1249
- }, logScriptUpdate = (path, framework, duration) => {
1250
- log("script update", { duration, framework, path });
1251
- }, logServerReload = () => {
1252
- log(`${colors2.cyan}server module reloaded${colors2.reset}`);
1253
- }, logWarn = (message) => {
1254
- const timestamp = `${colors2.dim}${formatTimestamp()}${colors2.reset}`;
1255
- const tag = `${colors2.yellow}[hmr]${colors2.reset}`;
1256
- console.warn(`${timestamp} ${tag} ${colors2.yellow}warning${colors2.reset} ${message}`);
1257
- };
1258
- var init_logger = __esm(() => {
1259
- init_startupBanner();
1260
- colors2 = {
1261
- blue: "\x1B[34m",
1262
- bold: "\x1B[1m",
1263
- cyan: "\x1B[36m",
1264
- dim: "\x1B[2m",
1265
- green: "\x1B[32m",
1266
- magenta: "\x1B[35m",
1267
- red: "\x1B[31m",
1268
- reset: "\x1B[0m",
1269
- white: "\x1B[37m",
1270
- yellow: "\x1B[33m"
1271
- };
1272
- frameworkColors = {
1273
- angular: colors2.magenta,
1274
- assets: colors2.dim,
1275
- css: colors2.cyan,
1276
- html: colors2.white,
1277
- htmx: colors2.white,
1278
- react: colors2.blue,
1279
- svelte: colors2.yellow,
1280
- vue: colors2.green
1281
- };
1282
- });
1283
-
1284
1292
  // src/utils/validateSafePath.ts
1285
1293
  import { resolve as resolve7, relative as relative3 } from "path";
1286
1294
  var validateSafePath = (targetPath, baseDirectory) => {
@@ -205723,5 +205731,5 @@ export {
205723
205731
  ANGULAR_INIT_TIMEOUT_MS
205724
205732
  };
205725
205733
 
205726
- //# debugId=A4B0380C43D3114264756E2164756E21
205734
+ //# debugId=9ACCBA59801C8BAE64756E2164756E21
205727
205735
  //# sourceMappingURL=index.js.map