fiberx-backend-toolkit 0.0.67 → 0.0.69

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.
@@ -112,5 +112,6 @@ declare class InputTransformerUtil {
112
112
  */
113
113
  static formatLinksObject(links: Record<string, string>): Record<string, string>;
114
114
  static buildNestedObject(paths: string[]): any;
115
+ static minifyHtml(html: string): string;
115
116
  }
116
117
  export default InputTransformerUtil;
@@ -327,5 +327,27 @@ class InputTransformerUtil {
327
327
  }
328
328
  return root;
329
329
  }
330
+ // Method to minify html code
331
+ static minifyHtml(html) {
332
+ if (!html) {
333
+ return html;
334
+ }
335
+ const preserved = [];
336
+ // Preserve sensitive blocks
337
+ html = html.replace(/<(pre|code|textarea)[^>]*>[\s\S]*?<\/\1>/gi, (match) => {
338
+ preserved.push(match);
339
+ return `___PRESERVE_${preserved.length - 1}___`;
340
+ });
341
+ html = html
342
+ .replace(/[\n\r\t]+/g, " ")
343
+ .replace(/>\s+</g, "><")
344
+ .replace(/\s{2,}/g, " ")
345
+ .trim();
346
+ // Restore preserved blocks
347
+ preserved.forEach((block, i) => {
348
+ html = html.replace(`___PRESERVE_${i}___`, block);
349
+ });
350
+ return html;
351
+ }
330
352
  }
331
353
  exports.default = InputTransformerUtil;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fiberx-backend-toolkit",
3
- "version": "0.0.67",
3
+ "version": "0.0.69",
4
4
  "description": "A TypeScript backend toolkit providing shared domain logic, infrastructure helpers, and utilities for FiberX server-side applications and services.",
5
5
  "type": "commonjs",
6
6
  "main": "./dist/index.js",