@absolutejs/absolute 0.19.0-beta.176 → 0.19.0-beta.178

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.
Files changed (40) hide show
  1. package/.absolutejs/eslint-cache +1 -1
  2. package/.absolutejs/tsconfig.tsbuildinfo +1 -1
  3. package/ROADMAP.md +191 -191
  4. package/dist/Image-fpjk72vg.vue +140 -0
  5. package/dist/src/angular/components/image.component.d.ts +33 -0
  6. package/dist/src/angular/components/index.d.ts +1 -0
  7. package/dist/src/angular/components/index.js +395 -0
  8. package/dist/src/angular/components/index.js.map +11 -0
  9. package/dist/{angular → src/angular}/index.js +11 -1
  10. package/dist/{angular → src/angular}/index.js.map +2 -2
  11. package/dist/src/build/optimizeHtmlImages.d.ts +2 -0
  12. package/dist/{build.js → src/build.js} +496 -243
  13. package/dist/{build.js.map → src/build.js.map} +7 -5
  14. package/dist/{index.js → src/index.js} +746 -276
  15. package/dist/{index.js.map → src/index.js.map} +9 -6
  16. package/dist/src/plugins/imageOptimizer.d.ts +2 -0
  17. package/dist/src/react/components/Image.d.ts +2 -0
  18. package/dist/src/react/components/index.d.ts +1 -0
  19. package/dist/{react → src/react}/hooks/index.js +11 -1
  20. package/dist/{react → src/react}/hooks/index.js.map +2 -2
  21. package/dist/{react → src/react}/index.js +11 -1
  22. package/dist/{react → src/react}/index.js.map +2 -2
  23. package/dist/{svelte → src/svelte}/index.js +11 -1
  24. package/dist/{svelte → src/svelte}/index.js.map +2 -2
  25. package/dist/src/utils/imageProcessing.d.ts +33 -0
  26. package/dist/src/vue/components/index.d.ts +1 -0
  27. package/dist/src/vue/components/index.js +84 -0
  28. package/dist/src/vue/components/index.js.map +9 -0
  29. package/dist/{vue → src/vue}/index.js +11 -1
  30. package/dist/{vue → src/vue}/index.js.map +2 -2
  31. package/dist/svelte/components/Head.svelte +147 -0
  32. package/dist/svelte/components/Image.svelte +158 -0
  33. package/dist/svelte/components/JsonLd.svelte +20 -0
  34. package/dist/types/build.d.ts +2 -0
  35. package/dist/types/image.d.ts +77 -0
  36. package/dist/types/index.d.ts +1 -0
  37. package/package.json +19 -4
  38. package/types/build.ts +3 -0
  39. package/types/image.ts +91 -0
  40. package/types/index.ts +1 -0
@@ -61,6 +61,16 @@ var __export = (target, all) => {
61
61
  set: __exportSetter.bind(all, name)
62
62
  });
63
63
  };
64
+ var __legacyDecorateClassTS = function(decorators, target, key, desc) {
65
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
66
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
67
+ r = Reflect.decorate(decorators, target, key, desc);
68
+ else
69
+ for (var i = decorators.length - 1;i >= 0; i--)
70
+ if (d = decorators[i])
71
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
72
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
73
+ };
64
74
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
65
75
  var __require = import.meta.require;
66
76
 
@@ -731,15 +741,253 @@ var scanCssEntryPoints = async (dir, ignore) => {
731
741
  };
732
742
  var init_scanCssEntryPoints = () => {};
733
743
 
734
- // src/cli/scripts/telemetry.ts
744
+ // src/utils/imageProcessing.ts
735
745
  import { existsSync as existsSync4, mkdirSync as mkdirSync2, readFileSync, writeFileSync } from "fs";
736
- import { homedir } from "os";
737
746
  import { join as join2 } from "path";
747
+ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY = 75, OPTIMIZATION_ENDPOINT = "/_absolute/image", BLUR_DEVIATION = 20, sharpModule = undefined, sharpLoaded = false, sharpWarned = false, snapToSize = (target, sizes) => {
748
+ for (const size of sizes) {
749
+ if (size >= target)
750
+ return size;
751
+ }
752
+ return sizes[sizes.length - 1] ?? target;
753
+ }, matchHostname = (actual, pattern) => {
754
+ if (pattern === actual)
755
+ return true;
756
+ if (pattern.startsWith("*.")) {
757
+ const suffix = pattern.slice(1);
758
+ return actual.endsWith(suffix) && actual.length > suffix.length;
759
+ }
760
+ return false;
761
+ }, matchPathname = (actual, pattern) => {
762
+ if (pattern.endsWith("/**")) {
763
+ const prefix = pattern.slice(0, -2);
764
+ return actual.startsWith(prefix);
765
+ }
766
+ return actual === pattern;
767
+ }, MIME_MAP, callSharp = (sharpRef, input) => {
768
+ const factory = sharpRef;
769
+ return factory(input);
770
+ }, toBuffer = (input) => {
771
+ if (Buffer.isBuffer(input))
772
+ return input;
773
+ return Buffer.from(input);
774
+ }, buildOptimizedUrl = (src, width, quality, basePath = OPTIMIZATION_ENDPOINT) => `${basePath}?url=${encodeURIComponent(src)}&w=${width}&q=${quality}`, formatToMime = (format) => MIME_MAP[format], generateBlurSvg = (base64Thumbnail) => {
775
+ const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 320"><filter id="b" color-interpolation-filters="sRGB"><feGaussianBlur stdDeviation="${BLUR_DEVIATION}"/><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 100 -1"/></filter><image filter="url(#b)" x="0" y="0" width="100%" height="100%" href="${base64Thumbnail}"/></svg>`;
776
+ const encoded = encodeURIComponent(svg);
777
+ return `url("data:image/svg+xml,${encoded}")`;
778
+ }, generateSrcSet = (src, width, sizes, config, loader) => {
779
+ const quality = config?.quality ?? DEFAULT_QUALITY;
780
+ const basePath = config?.path ?? OPTIMIZATION_ENDPOINT;
781
+ const buildUrl = loader ?? ((params) => buildOptimizedUrl(params.src, params.width, params.quality, basePath));
782
+ if (sizes) {
783
+ const allSizes = getAllSizes(config);
784
+ return allSizes.map((sizeWidth) => `${buildUrl({ quality, src, width: sizeWidth })} ${sizeWidth}w`).join(", ");
785
+ }
786
+ if (width) {
787
+ const allSizes = getAllSizes(config);
788
+ const w1x = snapToSize(width, allSizes);
789
+ const w2x = snapToSize(width * 2, allSizes);
790
+ return `${buildUrl({ quality, src, width: w1x })} 1x, ${buildUrl({ quality, src, width: w2x })} 2x`;
791
+ }
792
+ const deviceSizes = config?.deviceSizes ?? DEFAULT_DEVICE_SIZES;
793
+ return deviceSizes.map((sizeWidth) => `${buildUrl({ quality, src, width: sizeWidth })} ${sizeWidth}w`).join(", ");
794
+ }, getAllSizes = (config) => {
795
+ const device = config?.deviceSizes ?? DEFAULT_DEVICE_SIZES;
796
+ const image = config?.imageSizes ?? DEFAULT_IMAGE_SIZES;
797
+ return [...device, ...image].sort((left, right) => left - right);
798
+ }, getCacheDir = (buildDir) => {
799
+ const dir = join2(buildDir, ".cache", "images");
800
+ if (!existsSync4(dir))
801
+ mkdirSync2(dir, { recursive: true });
802
+ return dir;
803
+ }, getCacheKey = (url, width, quality, format) => {
804
+ const hasher = new Bun.CryptoHasher("sha256");
805
+ hasher.update(`${url}|${width}|${quality}|${format}`);
806
+ return hasher.digest("hex");
807
+ }, isCacheStale = (meta) => Date.now() > meta.expireAt, matchRemotePattern = (urlString, patterns) => {
808
+ let parsed;
809
+ try {
810
+ parsed = new URL(urlString);
811
+ } catch {
812
+ return false;
813
+ }
814
+ return patterns.some((pattern) => {
815
+ if (pattern.protocol && parsed.protocol !== `${pattern.protocol}:`)
816
+ return false;
817
+ if (!matchHostname(parsed.hostname, pattern.hostname))
818
+ return false;
819
+ if (pattern.port && parsed.port !== pattern.port)
820
+ return false;
821
+ if (pattern.pathname && !matchPathname(parsed.pathname, pattern.pathname))
822
+ return false;
823
+ return true;
824
+ });
825
+ }, negotiateFormat = (acceptHeader, configuredFormats) => {
826
+ for (const format of configuredFormats) {
827
+ const mime = MIME_MAP[format];
828
+ if (mime && acceptHeader.includes(mime))
829
+ return format;
830
+ }
831
+ if (configuredFormats.includes("webp") && acceptHeader.includes("image/webp")) {
832
+ return "webp";
833
+ }
834
+ return "jpeg";
835
+ }, AVIF_QUALITY_OFFSET = 20, AVIF_EFFORT = 3, optimizeImage = async (buffer, width, quality, format) => {
836
+ const sharp = await tryLoadSharp();
837
+ if (!sharp)
838
+ return toBuffer(buffer);
839
+ const pipeline = callSharp(sharp, toBuffer(buffer)).rotate().resize(width, undefined, { withoutEnlargement: true });
840
+ switch (format) {
841
+ case "avif":
842
+ return pipeline.avif({ effort: AVIF_EFFORT, quality: Math.max(1, quality - AVIF_QUALITY_OFFSET) }).toBuffer();
843
+ case "jpeg":
844
+ return pipeline.jpeg({ mozjpeg: true, quality }).toBuffer();
845
+ case "png":
846
+ return pipeline.png({ quality }).toBuffer();
847
+ case "webp":
848
+ return pipeline.webp({ quality }).toBuffer();
849
+ default:
850
+ return toBuffer(buffer);
851
+ }
852
+ }, readFromCache = (cacheDir, cacheKey) => {
853
+ const metaPath = join2(cacheDir, `${cacheKey}.meta`);
854
+ const dataPath = join2(cacheDir, `${cacheKey}.data`);
855
+ if (!existsSync4(metaPath) || !existsSync4(dataPath))
856
+ return null;
857
+ try {
858
+ const meta = JSON.parse(readFileSync(metaPath, "utf-8"));
859
+ const buffer = readFileSync(dataPath);
860
+ return { buffer, meta };
861
+ } catch {
862
+ return null;
863
+ }
864
+ }, tryLoadSharp = async () => {
865
+ if (sharpLoaded)
866
+ return sharpModule;
867
+ sharpLoaded = true;
868
+ try {
869
+ const name = "sharp";
870
+ const mod = await import(name);
871
+ sharpModule = mod.default ?? mod;
872
+ return sharpModule;
873
+ } catch {
874
+ if (sharpWarned)
875
+ return null;
876
+ sharpWarned = true;
877
+ console.warn("[image] sharp not installed \u2014 serving unoptimized images. Install with: bun add sharp");
878
+ return null;
879
+ }
880
+ }, writeToCache = (cacheDir, cacheKey, buffer, meta) => {
881
+ const metaPath = join2(cacheDir, `${cacheKey}.meta`);
882
+ const dataPath = join2(cacheDir, `${cacheKey}.data`);
883
+ writeFileSync(dataPath, buffer);
884
+ writeFileSync(metaPath, JSON.stringify(meta));
885
+ };
886
+ var init_imageProcessing = __esm(() => {
887
+ DEFAULT_DEVICE_SIZES = [
888
+ 640,
889
+ 750,
890
+ 828,
891
+ 1080,
892
+ 1200,
893
+ 1920,
894
+ 2048,
895
+ 3840
896
+ ];
897
+ DEFAULT_IMAGE_SIZES = [
898
+ 16,
899
+ 32,
900
+ 48,
901
+ 64,
902
+ 96,
903
+ 128,
904
+ 256,
905
+ 384
906
+ ];
907
+ MIME_MAP = {
908
+ avif: "image/avif",
909
+ jpeg: "image/jpeg",
910
+ png: "image/png",
911
+ webp: "image/webp"
912
+ };
913
+ });
914
+
915
+ // src/build/optimizeHtmlImages.ts
916
+ var exports_optimizeHtmlImages = {};
917
+ __export(exports_optimizeHtmlImages, {
918
+ optimizeHtmlImages: () => optimizeHtmlImages
919
+ });
920
+ import { readFile, writeFile as writeFile2 } from "fs/promises";
921
+ var IMG_REGEX, getAttr = (attrs, name) => {
922
+ const regex = new RegExp(`${name}\\s*=\\s*["']([^"']*)["']`, "i");
923
+ const match = regex.exec(attrs);
924
+ return match ? match[1] : undefined;
925
+ }, removeAttr = (attrs, name) => attrs.replace(new RegExp(`\\s*${name}\\s*=\\s*["'][^"']*["']`, "gi"), ""), transformImgTag = (fullMatch, before, after, config) => {
926
+ const attrs = before + after;
927
+ const src = getAttr(attrs, "src");
928
+ if (!src)
929
+ return fullMatch;
930
+ const widthStr = getAttr(attrs, "width");
931
+ const sizes = getAttr(attrs, "sizes");
932
+ const quality = config?.quality ?? DEFAULT_QUALITY;
933
+ const basePath = config?.path ?? OPTIMIZATION_ENDPOINT;
934
+ const width = widthStr ? parseInt(widthStr, 10) : undefined;
935
+ const optimizedSrc = buildOptimizedUrl(src, width ?? 0, quality, basePath);
936
+ let srcset;
937
+ if (sizes) {
938
+ const allSizes = getAllSizes(config);
939
+ srcset = allSizes.map((sizeWidth) => `${buildOptimizedUrl(src, sizeWidth, quality, basePath)} ${sizeWidth}w`).join(", ");
940
+ } else if (width) {
941
+ const allSizes = getAllSizes(config);
942
+ const w1x = snapUp(width, allSizes);
943
+ const w2x = snapUp(width * 2, allSizes);
944
+ srcset = `${buildOptimizedUrl(src, w1x, quality, basePath)} 1x, ${buildOptimizedUrl(src, w2x, quality, basePath)} 2x`;
945
+ } else {
946
+ const deviceSizes = config?.deviceSizes ?? [640, 750, 828, 1080, 1200, 1920, 2048, 3840];
947
+ srcset = deviceSizes.map((sizeWidth) => `${buildOptimizedUrl(src, sizeWidth, quality, basePath)} ${sizeWidth}w`).join(", ");
948
+ }
949
+ let cleanAttrs = removeAttr(attrs, "data-optimized");
950
+ cleanAttrs = removeAttr(cleanAttrs, "src");
951
+ cleanAttrs = removeAttr(cleanAttrs, "loading");
952
+ cleanAttrs = removeAttr(cleanAttrs, "decoding");
953
+ cleanAttrs = cleanAttrs.trim();
954
+ const resolvedSizes = sizes ?? (width ? undefined : "100vw");
955
+ const sizesAttr = resolvedSizes ? ` sizes="${resolvedSizes}"` : "";
956
+ return `<img src="${optimizedSrc}" srcset="${srcset}"${sizesAttr} ${cleanAttrs} loading="lazy" decoding="async">`;
957
+ }, snapUp = (target, sizes) => {
958
+ for (const size of sizes) {
959
+ if (size >= target)
960
+ return size;
961
+ }
962
+ return sizes[sizes.length - 1] ?? target;
963
+ }, optimizeHtmlImages = async (directory, config) => {
964
+ const htmlFiles = await scanEntryPoints(directory, "*.html");
965
+ const tasks = htmlFiles.map(async (filePath) => {
966
+ const original = await readFile(filePath, "utf8");
967
+ if (!original.includes("data-optimized"))
968
+ return;
969
+ const updated = original.replace(IMG_REGEX, (match, before, after) => transformImgTag(match, before, after, config));
970
+ if (updated !== original) {
971
+ await writeFile2(filePath, updated, "utf8");
972
+ }
973
+ });
974
+ await Promise.all(tasks);
975
+ };
976
+ var init_optimizeHtmlImages = __esm(() => {
977
+ init_imageProcessing();
978
+ init_scanEntryPoints();
979
+ IMG_REGEX = /<img\s+([^>]*?)data-optimized([^>]*?)\/?>/gi;
980
+ });
981
+
982
+ // src/cli/scripts/telemetry.ts
983
+ import { existsSync as existsSync5, mkdirSync as mkdirSync3, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
984
+ import { homedir } from "os";
985
+ import { join as join3 } from "path";
738
986
  var configDir, configPath, getTelemetryConfig = () => {
739
987
  try {
740
- if (!existsSync4(configPath))
988
+ if (!existsSync5(configPath))
741
989
  return null;
742
- const raw = readFileSync(configPath, "utf-8");
990
+ const raw = readFileSync2(configPath, "utf-8");
743
991
  const config = JSON.parse(raw);
744
992
  return config;
745
993
  } catch {
@@ -747,19 +995,19 @@ var configDir, configPath, getTelemetryConfig = () => {
747
995
  }
748
996
  };
749
997
  var init_telemetry = __esm(() => {
750
- configDir = join2(homedir(), ".absolutejs");
751
- configPath = join2(configDir, "telemetry.json");
998
+ configDir = join3(homedir(), ".absolutejs");
999
+ configPath = join3(configDir, "telemetry.json");
752
1000
  });
753
1001
 
754
1002
  // src/cli/telemetryEvent.ts
755
- import { existsSync as existsSync5, readFileSync as readFileSync2 } from "fs";
1003
+ import { existsSync as existsSync6, readFileSync as readFileSync3 } from "fs";
756
1004
  import { arch, platform } from "os";
757
- import { dirname, join as join3, parse } from "path";
1005
+ import { dirname, join as join4, parse } from "path";
758
1006
  var checkCandidate = (candidate) => {
759
- if (!existsSync5(candidate)) {
1007
+ if (!existsSync6(candidate)) {
760
1008
  return null;
761
1009
  }
762
- const pkg = JSON.parse(readFileSync2(candidate, "utf-8"));
1010
+ const pkg = JSON.parse(readFileSync3(candidate, "utf-8"));
763
1011
  if (pkg.name === "@absolutejs/absolute") {
764
1012
  const ver = pkg.version;
765
1013
  return ver;
@@ -774,7 +1022,7 @@ var checkCandidate = (candidate) => {
774
1022
  }, findPackageVersion = () => {
775
1023
  let { dir } = import.meta;
776
1024
  while (dir !== parse(dir).root) {
777
- const candidate = join3(dir, "package.json");
1025
+ const candidate = join4(dir, "package.json");
778
1026
  const version = checkCandidate(candidate);
779
1027
  if (version) {
780
1028
  return version;
@@ -817,7 +1065,7 @@ var exports_updateAssetPaths = {};
817
1065
  __export(exports_updateAssetPaths, {
818
1066
  updateAssetPaths: () => updateAssetPaths
819
1067
  });
820
- import { readFile, writeFile as writeFile2 } from "fs/promises";
1068
+ import { readFile as readFile2, writeFile as writeFile3 } from "fs/promises";
821
1069
  var replaceAssetRef = (match, prefix, dir, name, ext, suffix, manifest, filePath) => {
822
1070
  const pascal = toPascal(name);
823
1071
  let key;
@@ -849,9 +1097,9 @@ var replaceAssetRef = (match, prefix, dir, name, ext, suffix, manifest, filePath
849
1097
  const htmlFiles = await scanEntryPoints(directory, "*.html");
850
1098
  const assetRegex = /((?:<script[^>]+src=|<link[^>]*?rel=["']stylesheet["'][^>]*?href=)["'])(?!\/?(?:.*\/)?htmx\.min\.js)(\/?(?:.*\/)?)([^./"']+)(?:\.[^."'/]+)?(\.(?:js|ts|css))(["'][^>]*>)/g;
851
1099
  const tasks = htmlFiles.map(async (filePath) => {
852
- const original = await readFile(filePath, "utf8");
1100
+ const original = await readFile2(filePath, "utf8");
853
1101
  const updated = original.replace(assetRegex, (match, prefix, dir, name, ext, suffix) => replaceAssetRef(match, prefix, dir, name, ext, suffix, manifest, filePath));
854
- await writeFile2(filePath, updated, "utf8");
1102
+ await writeFile3(filePath, updated, "utf8");
855
1103
  });
856
1104
  await Promise.all(tasks);
857
1105
  };
@@ -861,12 +1109,12 @@ var init_updateAssetPaths = __esm(() => {
861
1109
  });
862
1110
 
863
1111
  // src/dev/buildHMRClient.ts
864
- import { existsSync as existsSync6 } from "fs";
1112
+ import { existsSync as existsSync7 } from "fs";
865
1113
  import { resolve as resolve2 } from "path";
866
1114
  var {build: bunBuild } = globalThis.Bun;
867
1115
  var resolveHmrClientPath = () => {
868
1116
  const fromSource = resolve2(import.meta.dir, "client/hmrClient.ts");
869
- if (existsSync6(fromSource))
1117
+ if (existsSync7(fromSource))
870
1118
  return fromSource;
871
1119
  return resolve2(import.meta.dir, "dev/client/hmrClient.ts");
872
1120
  }, hmrClientPath2, buildHMRClient = async () => {
@@ -1058,8 +1306,8 @@ var devVendorPaths = null, getDevVendorPaths = () => devVendorPaths, setDevVendo
1058
1306
  };
1059
1307
 
1060
1308
  // src/build/angularLinkerPlugin.ts
1061
- import { existsSync as existsSync7, mkdirSync as mkdirSync3, readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "fs";
1062
- import { dirname as dirname2, join as join4, relative as relative2, resolve as resolve4 } from "path";
1309
+ import { existsSync as existsSync8, mkdirSync as mkdirSync4, readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "fs";
1310
+ import { dirname as dirname2, join as join5, relative as relative2, resolve as resolve4 } from "path";
1063
1311
  import { createHash } from "crypto";
1064
1312
  var CACHE_DIR, angularLinkerPlugin;
1065
1313
  var init_angularLinkerPlugin = __esm(() => {
@@ -1082,10 +1330,10 @@ var init_angularLinkerPlugin = __esm(() => {
1082
1330
  return;
1083
1331
  }
1084
1332
  const hash = createHash("md5").update(source).digest("hex");
1085
- const cachePath = join4(CACHE_DIR, `${hash}.js`);
1086
- if (existsSync7(cachePath)) {
1333
+ const cachePath = join5(CACHE_DIR, `${hash}.js`);
1334
+ if (existsSync8(cachePath)) {
1087
1335
  return {
1088
- contents: readFileSync3(cachePath, "utf-8"),
1336
+ contents: readFileSync4(cachePath, "utf-8"),
1089
1337
  loader: "js"
1090
1338
  };
1091
1339
  }
@@ -1100,8 +1348,8 @@ var init_angularLinkerPlugin = __esm(() => {
1100
1348
  linkerPlugin = mod.createEs2015LinkerPlugin({
1101
1349
  fileSystem: {
1102
1350
  dirname: dirname2,
1103
- exists: existsSync7,
1104
- readFile: readFileSync3,
1351
+ exists: existsSync8,
1352
+ readFile: readFileSync4,
1105
1353
  relative: relative2,
1106
1354
  resolve: resolve4
1107
1355
  },
@@ -1127,8 +1375,8 @@ var init_angularLinkerPlugin = __esm(() => {
1127
1375
  sourceMaps: false
1128
1376
  });
1129
1377
  const linked = result?.code ?? source;
1130
- mkdirSync3(CACHE_DIR, { recursive: true });
1131
- writeFileSync2(cachePath, linked, "utf-8");
1378
+ mkdirSync4(CACHE_DIR, { recursive: true });
1379
+ writeFileSync3(cachePath, linked, "utf-8");
1132
1380
  return { contents: linked, loader: "js" };
1133
1381
  });
1134
1382
  }
@@ -1159,7 +1407,7 @@ var init_cleanStaleOutputs = __esm(() => {
1159
1407
 
1160
1408
  // src/utils/cleanup.ts
1161
1409
  import { rm as rm3 } from "fs/promises";
1162
- import { join as join5 } from "path";
1410
+ import { join as join6 } from "path";
1163
1411
  var cleanup = async ({
1164
1412
  angularDir,
1165
1413
  reactDir,
@@ -1167,19 +1415,19 @@ var cleanup = async ({
1167
1415
  vueDir
1168
1416
  }) => {
1169
1417
  await Promise.all([
1170
- angularDir ? rm3(join5(angularDir, "generated"), {
1418
+ angularDir ? rm3(join6(angularDir, "generated"), {
1171
1419
  force: true,
1172
1420
  recursive: true
1173
1421
  }) : undefined,
1174
- reactDir ? rm3(join5(reactDir, "generated"), {
1422
+ reactDir ? rm3(join6(reactDir, "generated"), {
1175
1423
  force: true,
1176
1424
  recursive: true
1177
1425
  }) : undefined,
1178
- svelteDir ? rm3(join5(svelteDir, "generated"), {
1426
+ svelteDir ? rm3(join6(svelteDir, "generated"), {
1179
1427
  force: true,
1180
1428
  recursive: true
1181
1429
  }) : undefined,
1182
- vueDir ? rm3(join5(vueDir, "generated"), {
1430
+ vueDir ? rm3(join6(vueDir, "generated"), {
1183
1431
  force: true,
1184
1432
  recursive: true
1185
1433
  }) : undefined
@@ -1223,11 +1471,11 @@ __export(exports_compileSvelte, {
1223
1471
  compileSvelte: () => compileSvelte,
1224
1472
  clearSvelteCompilerCache: () => clearSvelteCompilerCache
1225
1473
  });
1226
- import { existsSync as existsSync8 } from "fs";
1474
+ import { existsSync as existsSync9 } from "fs";
1227
1475
  import { mkdir, stat } from "fs/promises";
1228
1476
  import {
1229
1477
  dirname as dirname3,
1230
- join as join6,
1478
+ join as join7,
1231
1479
  basename as basename2,
1232
1480
  extname as extname2,
1233
1481
  resolve as resolve7,
@@ -1238,7 +1486,7 @@ import { env } from "process";
1238
1486
  var {write, file, Transpiler } = globalThis.Bun;
1239
1487
  var resolveDevClientDir2 = () => {
1240
1488
  const fromSource = resolve7(import.meta.dir, "../dev/client");
1241
- if (existsSync8(fromSource))
1489
+ if (existsSync9(fromSource))
1242
1490
  return fromSource;
1243
1491
  return resolve7(import.meta.dir, "./dev/client");
1244
1492
  }, devClientDir2, hmrClientPath3, persistentCache, sourceHashCache, clearSvelteCompilerCache = () => {
@@ -1274,10 +1522,10 @@ var resolveDevClientDir2 = () => {
1274
1522
  return null;
1275
1523
  }, compileSvelte = async (entryPoints, svelteRoot, cache = new Map, isDev = false) => {
1276
1524
  const { compile, compileModule, preprocess } = await import("svelte/compiler");
1277
- const generatedDir = join6(svelteRoot, "generated");
1278
- const clientDir = join6(generatedDir, "client");
1279
- const indexDir = join6(generatedDir, "indexes");
1280
- const serverDir = join6(generatedDir, "server");
1525
+ const generatedDir = join7(svelteRoot, "generated");
1526
+ const clientDir = join7(generatedDir, "client");
1527
+ const indexDir = join7(generatedDir, "indexes");
1528
+ const serverDir = join7(generatedDir, "server");
1281
1529
  await Promise.all([clientDir, indexDir, serverDir].map((dir) => mkdir(dir, { recursive: true })));
1282
1530
  const dev = env.NODE_ENV !== "production";
1283
1531
  const build = async (src) => {
@@ -1318,8 +1566,8 @@ var resolveDevClientDir2 = () => {
1318
1566
  if (!rawSpec)
1319
1567
  continue;
1320
1568
  const origSpec = rawSpec.replace(/\.svelte(?:\.(?:ts|js))?$/, ".js");
1321
- const ssrOutputDir = dirname3(join6(serverDir, relDir, `${baseName}.js`));
1322
- const clientOutputDir = dirname3(join6(clientDir, relDir, `${baseName}.js`));
1569
+ const ssrOutputDir = dirname3(join7(serverDir, relDir, `${baseName}.js`));
1570
+ const clientOutputDir = dirname3(join7(clientDir, relDir, `${baseName}.js`));
1323
1571
  const toServer = relative4(ssrOutputDir, childBuilt.ssr).replace(/\\/g, "/");
1324
1572
  const toClient = relative4(clientOutputDir, childBuilt.client).replace(/\\/g, "/");
1325
1573
  externalRewrites.set(origSpec, {
@@ -1363,8 +1611,8 @@ var resolveDevClientDir2 = () => {
1363
1611
  return `${prefix}${dots}`;
1364
1612
  return `${prefix}../../${dots}`;
1365
1613
  });
1366
- const ssrPath = join6(serverDir, relDir, `${baseName}.js`);
1367
- const clientPath = join6(clientDir, relDir, `${baseName}.js`);
1614
+ const ssrPath = join7(serverDir, relDir, `${baseName}.js`);
1615
+ const clientPath = join7(clientDir, relDir, `${baseName}.js`);
1368
1616
  await Promise.all([
1369
1617
  mkdir(dirname3(ssrPath), { recursive: true }),
1370
1618
  mkdir(dirname3(clientPath), { recursive: true })
@@ -1392,7 +1640,7 @@ var resolveDevClientDir2 = () => {
1392
1640
  await Promise.all(roots.map(async ({ client }) => {
1393
1641
  const relClientDir = dirname3(relative4(clientDir, client));
1394
1642
  const name = basename2(client, extname2(client));
1395
- const indexPath = join6(indexDir, relClientDir, `${name}.js`);
1643
+ const indexPath = join7(indexDir, relClientDir, `${name}.js`);
1396
1644
  const importRaw = relative4(dirname3(indexPath), client).split(sep2).join("/");
1397
1645
  const importPath = importRaw.startsWith(".") || importRaw.startsWith("/") ? importRaw : `./${importRaw}`;
1398
1646
  const hmrImports = isDev ? `window.__HMR_FRAMEWORK__ = "svelte";
@@ -1437,7 +1685,7 @@ if (typeof window !== "undefined") {
1437
1685
  svelteClientPaths: roots.map(({ client }) => client),
1438
1686
  svelteIndexPaths: roots.map(({ client }) => {
1439
1687
  const rel = dirname3(relative4(clientDir, client));
1440
- return join6(indexDir, rel, basename2(client));
1688
+ return join7(indexDir, rel, basename2(client));
1441
1689
  }),
1442
1690
  svelteServerPaths: roots.map(({ ssr }) => ssr)
1443
1691
  };
@@ -1445,7 +1693,7 @@ if (typeof window !== "undefined") {
1445
1693
  var init_compileSvelte = __esm(() => {
1446
1694
  init_constants();
1447
1695
  devClientDir2 = resolveDevClientDir2();
1448
- hmrClientPath3 = join6(devClientDir2, "hmrClient.ts").replace(/\\/g, "/");
1696
+ hmrClientPath3 = join7(devClientDir2, "hmrClient.ts").replace(/\\/g, "/");
1449
1697
  persistentCache = new Map;
1450
1698
  sourceHashCache = new Map;
1451
1699
  transpiler = new Transpiler({ loader: "ts", target: "browser" });
@@ -1460,13 +1708,13 @@ __export(exports_compileVue, {
1460
1708
  compileVue: () => compileVue,
1461
1709
  clearVueHmrCaches: () => clearVueHmrCaches
1462
1710
  });
1463
- import { existsSync as existsSync9 } from "fs";
1711
+ import { existsSync as existsSync10 } from "fs";
1464
1712
  import { mkdir as mkdir2 } from "fs/promises";
1465
- import { basename as basename3, dirname as dirname4, join as join7, relative as relative5, resolve as resolve8 } from "path";
1713
+ import { basename as basename3, dirname as dirname4, join as join8, relative as relative5, resolve as resolve8 } from "path";
1466
1714
  var {file: file2, write: write2, Transpiler: Transpiler2 } = globalThis.Bun;
1467
1715
  var resolveDevClientDir3 = () => {
1468
1716
  const fromSource = resolve8(import.meta.dir, "../dev/client");
1469
- if (existsSync9(fromSource))
1717
+ if (existsSync10(fromSource))
1470
1718
  return fromSource;
1471
1719
  return resolve8(import.meta.dir, "./dev/client");
1472
1720
  }, devClientDir3, hmrClientPath4, transpiler2, scriptCache, scriptSetupCache, templateCache, styleCache, persistentBuildCache, vueSourceHashCache, vueHmrMetadata, clearVueHmrCaches = () => {
@@ -1590,7 +1838,7 @@ var resolveDevClientDir3 = () => {
1590
1838
  ];
1591
1839
  let cssOutputPaths = [];
1592
1840
  if (isEntryPoint && allCss.length) {
1593
- const cssOutputFile = join7(outputDirs.css, `${toKebab(fileBaseName)}-compiled.css`);
1841
+ const cssOutputFile = join8(outputDirs.css, `${toKebab(fileBaseName)}-compiled.css`);
1594
1842
  await mkdir2(dirname4(cssOutputFile), { recursive: true });
1595
1843
  await write2(cssOutputFile, allCss.join(`
1596
1844
  `));
@@ -1621,8 +1869,8 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
1621
1869
  };
1622
1870
  const clientCode = assembleModule(generateRenderFunction(false), "render", true);
1623
1871
  const serverCode = assembleModule(generateRenderFunction(true), "ssrRender", false);
1624
- const clientOutputPath = join7(outputDirs.client, `${relativeWithoutExtension}.js`);
1625
- const serverOutputPath = join7(outputDirs.server, `${relativeWithoutExtension}.js`);
1872
+ const clientOutputPath = join8(outputDirs.client, `${relativeWithoutExtension}.js`);
1873
+ const serverOutputPath = join8(outputDirs.server, `${relativeWithoutExtension}.js`);
1626
1874
  const relDir = dirname4(relativeFilePath);
1627
1875
  const relDepth = relDir === "." ? 0 : relDir.split("/").length;
1628
1876
  const adjustImports = (code) => code.replace(/(from\s+['"])(\.\.\/(?:\.\.\/)*)/g, (_, prefix, dots) => {
@@ -1651,11 +1899,11 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
1651
1899
  return result;
1652
1900
  }, compileVue = async (entryPoints, vueRootDir, isDev = false) => {
1653
1901
  const compiler = await import("@vue/compiler-sfc");
1654
- const generatedDir = join7(vueRootDir, "generated");
1655
- const clientOutputDir = join7(generatedDir, "client");
1656
- const indexOutputDir = join7(generatedDir, "indexes");
1657
- const serverOutputDir = join7(generatedDir, "server");
1658
- const cssOutputDir = join7(generatedDir, "compiled");
1902
+ const generatedDir = join8(vueRootDir, "generated");
1903
+ const clientOutputDir = join8(generatedDir, "client");
1904
+ const indexOutputDir = join8(generatedDir, "indexes");
1905
+ const serverOutputDir = join8(generatedDir, "server");
1906
+ const cssOutputDir = join8(generatedDir, "compiled");
1659
1907
  await Promise.all([
1660
1908
  mkdir2(clientOutputDir, { recursive: true }),
1661
1909
  mkdir2(indexOutputDir, { recursive: true }),
@@ -1672,8 +1920,8 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
1672
1920
  }, buildCache, true, vueRootDir, compiler);
1673
1921
  result.tsHelperPaths.forEach((path) => allTsHelperPaths.add(path));
1674
1922
  const entryBaseName = basename3(entryPath, ".vue");
1675
- const indexOutputFile = join7(indexOutputDir, `${entryBaseName}.js`);
1676
- const clientOutputFile = join7(clientOutputDir, relative5(vueRootDir, entryPath).replace(/\\/g, "/").replace(/\.vue$/, ".js"));
1923
+ const indexOutputFile = join8(indexOutputDir, `${entryBaseName}.js`);
1924
+ const clientOutputFile = join8(clientOutputDir, relative5(vueRootDir, entryPath).replace(/\\/g, "/").replace(/\.vue$/, ".js"));
1677
1925
  await mkdir2(dirname4(indexOutputFile), { recursive: true });
1678
1926
  const vueHmrImports = isDev ? [
1679
1927
  `window.__HMR_FRAMEWORK__ = "vue";`,
@@ -1783,8 +2031,8 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
1783
2031
  const sourceCode = await file2(tsPath).text();
1784
2032
  const transpiledCode = transpiler2.transformSync(sourceCode);
1785
2033
  const relativeJsPath = relative5(vueRootDir, tsPath).replace(/\.ts$/, ".js");
1786
- const outClientPath = join7(clientOutputDir, relativeJsPath);
1787
- const outServerPath = join7(serverOutputDir, relativeJsPath);
2034
+ const outClientPath = join8(clientOutputDir, relativeJsPath);
2035
+ const outServerPath = join8(serverOutputDir, relativeJsPath);
1788
2036
  await mkdir2(dirname4(outClientPath), { recursive: true });
1789
2037
  await mkdir2(dirname4(outServerPath), { recursive: true });
1790
2038
  await write2(outClientPath, transpiledCode);
@@ -1801,7 +2049,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
1801
2049
  var init_compileVue = __esm(() => {
1802
2050
  init_constants();
1803
2051
  devClientDir3 = resolveDevClientDir3();
1804
- hmrClientPath4 = join7(devClientDir3, "hmrClient.ts").replace(/\\/g, "/");
2052
+ hmrClientPath4 = join8(devClientDir3, "hmrClient.ts").replace(/\\/g, "/");
1805
2053
  transpiler2 = new Transpiler2({ loader: "ts", target: "browser" });
1806
2054
  scriptCache = new Map;
1807
2055
  scriptSetupCache = new Map;
@@ -4091,7 +4339,7 @@ var require_typescript = __commonJS((exports, module) => {
4091
4339
  walkUpParenthesizedTypesAndGetParentAndChild: () => walkUpParenthesizedTypesAndGetParentAndChild,
4092
4340
  whitespaceOrMapCommentRegExp: () => whitespaceOrMapCommentRegExp,
4093
4341
  writeCommentRange: () => writeCommentRange,
4094
- writeFile: () => writeFile3,
4342
+ writeFile: () => writeFile4,
4095
4343
  writeFileEnsuringDirectories: () => writeFileEnsuringDirectories,
4096
4344
  zipWith: () => zipWith
4097
4345
  });
@@ -9883,7 +10131,7 @@ ${lanes.join(`
9883
10131
  writeOutputIsTTY() {
9884
10132
  return process.stdout.isTTY;
9885
10133
  },
9886
- readFile: readFile2,
10134
+ readFile: readFile3,
9887
10135
  writeFile: writeFile22,
9888
10136
  watchFile: watchFile2,
9889
10137
  watchDirectory,
@@ -10076,7 +10324,7 @@ ${lanes.join(`
10076
10324
  function fsWatchWorker(fileOrDirectory, recursive, callback) {
10077
10325
  return _fs.watch(fileOrDirectory, fsSupportsRecursiveFsWatch ? { persistent: true, recursive: !!recursive } : { persistent: true }, callback);
10078
10326
  }
10079
- function readFile2(fileName, _encoding) {
10327
+ function readFile3(fileName, _encoding) {
10080
10328
  let buffer;
10081
10329
  try {
10082
10330
  buffer = _fs.readFileSync(fileName);
@@ -21400,7 +21648,7 @@ ${lanes.join(`
21400
21648
  sourceFilePath = isSourceFileInCommonSourceDirectory ? sourceFilePath.substring(commonSourceDirectory.length) : sourceFilePath;
21401
21649
  return combinePaths(newDirPath, sourceFilePath);
21402
21650
  }
21403
- function writeFile3(host, diagnostics, fileName, text, writeByteOrderMark, sourceFiles, data) {
21651
+ function writeFile4(host, diagnostics, fileName, text, writeByteOrderMark, sourceFiles, data) {
21404
21652
  host.writeFile(fileName, text, writeByteOrderMark, (hostErrorMessage) => {
21405
21653
  diagnostics.add(createCompilerDiagnostic(Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage));
21406
21654
  }, sourceFiles, data);
@@ -41023,7 +41271,7 @@ ${lanes.join(`
41023
41271
  const possibleOption = getSpellingSuggestion(unknownOption, diagnostics.optionDeclarations, getOptionName);
41024
41272
  return possibleOption ? createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.unknownDidYouMeanDiagnostic, unknownOptionErrorText || unknownOption, possibleOption.name) : createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.unknownOptionDiagnostic, unknownOptionErrorText || unknownOption);
41025
41273
  }
41026
- function parseCommandLineWorker(diagnostics, commandLine, readFile2) {
41274
+ function parseCommandLineWorker(diagnostics, commandLine, readFile3) {
41027
41275
  const options = {};
41028
41276
  let watchOptions;
41029
41277
  const fileNames = [];
@@ -41061,7 +41309,7 @@ ${lanes.join(`
41061
41309
  }
41062
41310
  }
41063
41311
  function parseResponseFile(fileName) {
41064
- const text = tryReadFile(fileName, readFile2 || ((fileName2) => sys.readFile(fileName2)));
41312
+ const text = tryReadFile(fileName, readFile3 || ((fileName2) => sys.readFile(fileName2)));
41065
41313
  if (!isString(text)) {
41066
41314
  errors.push(text);
41067
41315
  return;
@@ -41164,8 +41412,8 @@ ${lanes.join(`
41164
41412
  unknownDidYouMeanDiagnostic: Diagnostics.Unknown_compiler_option_0_Did_you_mean_1,
41165
41413
  optionTypeMismatchDiagnostic: Diagnostics.Compiler_option_0_expects_an_argument
41166
41414
  };
41167
- function parseCommandLine(commandLine, readFile2) {
41168
- return parseCommandLineWorker(compilerOptionsDidYouMeanDiagnostics, commandLine, readFile2);
41415
+ function parseCommandLine(commandLine, readFile3) {
41416
+ return parseCommandLineWorker(compilerOptionsDidYouMeanDiagnostics, commandLine, readFile3);
41169
41417
  }
41170
41418
  function getOptionFromName(optionName, allowShort) {
41171
41419
  return getOptionDeclarationFromName(getOptionsNameMap, optionName, allowShort);
@@ -41233,8 +41481,8 @@ ${lanes.join(`
41233
41481
  result.originalFileName = result.fileName;
41234
41482
  return parseJsonSourceFileConfigFileContent(result, host, getNormalizedAbsolutePath(getDirectoryPath(configFileName), cwd), optionsToExtend, getNormalizedAbsolutePath(configFileName, cwd), undefined, extraFileExtensions, extendedConfigCache, watchOptionsToExtend);
41235
41483
  }
41236
- function readConfigFile(fileName, readFile2) {
41237
- const textOrDiagnostic = tryReadFile(fileName, readFile2);
41484
+ function readConfigFile(fileName, readFile3) {
41485
+ const textOrDiagnostic = tryReadFile(fileName, readFile3);
41238
41486
  return isString(textOrDiagnostic) ? parseConfigFileTextToJson(fileName, textOrDiagnostic) : { config: {}, error: textOrDiagnostic };
41239
41487
  }
41240
41488
  function parseConfigFileTextToJson(fileName, jsonText) {
@@ -41244,14 +41492,14 @@ ${lanes.join(`
41244
41492
  error: jsonSourceFile.parseDiagnostics.length ? jsonSourceFile.parseDiagnostics[0] : undefined
41245
41493
  };
41246
41494
  }
41247
- function readJsonConfigFile(fileName, readFile2) {
41248
- const textOrDiagnostic = tryReadFile(fileName, readFile2);
41495
+ function readJsonConfigFile(fileName, readFile3) {
41496
+ const textOrDiagnostic = tryReadFile(fileName, readFile3);
41249
41497
  return isString(textOrDiagnostic) ? parseJsonText(fileName, textOrDiagnostic) : { fileName, parseDiagnostics: [textOrDiagnostic] };
41250
41498
  }
41251
- function tryReadFile(fileName, readFile2) {
41499
+ function tryReadFile(fileName, readFile3) {
41252
41500
  let text;
41253
41501
  try {
41254
- text = readFile2(fileName);
41502
+ text = readFile3(fileName);
41255
41503
  } catch (e) {
41256
41504
  return createCompilerDiagnostic(Diagnostics.Cannot_read_file_0_Colon_1, fileName, e.message);
41257
41505
  }
@@ -103993,7 +104241,7 @@ ${lanes.join(`
103993
104241
  return;
103994
104242
  }
103995
104243
  const buildInfo = host.getBuildInfo() || { version };
103996
- writeFile3(host, emitterDiagnostics, buildInfoPath, getBuildInfoText(buildInfo), false, undefined, { buildInfo });
104244
+ writeFile4(host, emitterDiagnostics, buildInfoPath, getBuildInfoText(buildInfo), false, undefined, { buildInfo });
103997
104245
  emittedFilesList == null || emittedFilesList.push(buildInfoPath);
103998
104246
  }
103999
104247
  function emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath) {
@@ -104152,14 +104400,14 @@ ${lanes.join(`
104152
104400
  }
104153
104401
  if (sourceMapFilePath) {
104154
104402
  const sourceMap = sourceMapGenerator.toString();
104155
- writeFile3(host, emitterDiagnostics, sourceMapFilePath, sourceMap, false, sourceFiles);
104403
+ writeFile4(host, emitterDiagnostics, sourceMapFilePath, sourceMap, false, sourceFiles);
104156
104404
  }
104157
104405
  } else {
104158
104406
  writer.writeLine();
104159
104407
  }
104160
104408
  const text = writer.getText();
104161
104409
  const data = { sourceMapUrlPos, diagnostics: transform2.diagnostics };
104162
- writeFile3(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, data);
104410
+ writeFile4(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, data);
104163
104411
  writer.clear();
104164
104412
  return !data.skippedDtsWrite;
104165
104413
  }
@@ -108681,12 +108929,12 @@ ${lanes.join(`
108681
108929
  function createCompilerHost(options, setParentNodes) {
108682
108930
  return createCompilerHostWorker(options, setParentNodes);
108683
108931
  }
108684
- function createGetSourceFile(readFile2, setParentNodes) {
108932
+ function createGetSourceFile(readFile3, setParentNodes) {
108685
108933
  return (fileName, languageVersionOrOptions, onError) => {
108686
108934
  let text;
108687
108935
  try {
108688
108936
  mark("beforeIORead");
108689
- text = readFile2(fileName);
108937
+ text = readFile3(fileName);
108690
108938
  mark("afterIORead");
108691
108939
  measure("I/O Read", "beforeIORead", "afterIORead");
108692
108940
  } catch (e) {
@@ -109477,7 +109725,7 @@ ${lanes.join(`
109477
109725
  getRedirectFromOutput,
109478
109726
  forEachResolvedProjectReference: forEachResolvedProjectReference2
109479
109727
  });
109480
- const readFile2 = host.readFile.bind(host);
109728
+ const readFile3 = host.readFile.bind(host);
109481
109729
  (_e = tracing) == null || _e.push(tracing.Phase.Program, "shouldProgramCreateNewSourceFiles", { hasOldProgram: !!oldProgram });
109482
109730
  const shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options);
109483
109731
  (_f = tracing) == null || _f.pop();
@@ -109653,7 +109901,7 @@ ${lanes.join(`
109653
109901
  shouldTransformImportCall,
109654
109902
  emitBuildInfo,
109655
109903
  fileExists,
109656
- readFile: readFile2,
109904
+ readFile: readFile3,
109657
109905
  directoryExists,
109658
109906
  getSymlinkCache,
109659
109907
  realpath: (_o = host.realpath) == null ? undefined : _o.bind(host),
@@ -160091,7 +160339,7 @@ ${options.prefix}` : `
160091
160339
  walkUpParenthesizedTypesAndGetParentAndChild: () => walkUpParenthesizedTypesAndGetParentAndChild,
160092
160340
  whitespaceOrMapCommentRegExp: () => whitespaceOrMapCommentRegExp,
160093
160341
  writeCommentRange: () => writeCommentRange,
160094
- writeFile: () => writeFile3,
160342
+ writeFile: () => writeFile4,
160095
160343
  writeFileEnsuringDirectories: () => writeFileEnsuringDirectories,
160096
160344
  zipWith: () => zipWith
160097
160345
  });
@@ -170540,19 +170788,19 @@ __export(exports_compileAngular, {
170540
170788
  compileAngularFile: () => compileAngularFile,
170541
170789
  compileAngular: () => compileAngular
170542
170790
  });
170543
- import { existsSync as existsSync10, readFileSync as readFileSync4, promises as fs } from "fs";
170544
- import { join as join8, basename as basename4, sep as sep3, dirname as dirname5, resolve as resolve9, relative as relative6 } from "path";
170791
+ import { existsSync as existsSync11, readFileSync as readFileSync5, promises as fs } from "fs";
170792
+ import { join as join9, basename as basename4, sep as sep3, dirname as dirname5, resolve as resolve9, relative as relative6 } from "path";
170545
170793
  import { createHash as createHash2 } from "crypto";
170546
170794
  var import_typescript, computeConfigHash = () => {
170547
170795
  try {
170548
- const content = readFileSync4("./tsconfig.json", "utf-8");
170796
+ const content = readFileSync5("./tsconfig.json", "utf-8");
170549
170797
  return createHash2("md5").update(content).digest("hex");
170550
170798
  } catch {
170551
170799
  return "";
170552
170800
  }
170553
170801
  }, resolveDevClientDir4 = () => {
170554
170802
  const fromSource = resolve9(import.meta.dir, "../dev/client");
170555
- if (existsSync10(fromSource))
170803
+ if (existsSync11(fromSource))
170556
170804
  return fromSource;
170557
170805
  return resolve9(import.meta.dir, "./dev/client");
170558
170806
  }, devClientDir4, hmrClientPath5, hmrRuntimePath, injectHMRRegistration = (content, sourceId) => {
@@ -170648,7 +170896,7 @@ ${registrations}
170648
170896
  const originalGetSourceFile = host.getSourceFile;
170649
170897
  host.getSourceFile = (fileName, languageVersion, onError) => {
170650
170898
  if (fileName.startsWith("lib.") && fileName.endsWith(".d.ts") && tsLibDir) {
170651
- const resolvedPath = join8(tsLibDir, fileName);
170899
+ const resolvedPath = join9(tsLibDir, fileName);
170652
170900
  return originalGetSourceFile?.call(host, resolvedPath, languageVersion, onError);
170653
170901
  }
170654
170902
  return originalGetSourceFile?.call(host, fileName, languageVersion, onError);
@@ -170675,7 +170923,7 @@ ${registrations}
170675
170923
  });
170676
170924
  throwOnCompilationErrors(diagnostics);
170677
170925
  const entries = Object.entries(emitted).filter(([fileName]) => fileName.endsWith(".js")).map(([fileName, content]) => {
170678
- const target = join8(outDir, fileName);
170926
+ const target = join9(outDir, fileName);
170679
170927
  let processedContent = content.replace(/from\s+(['"])(\.\.?\/[^'"]+)(\1)/g, (match, quote, path) => {
170680
170928
  if (!path.match(/\.(js|ts|mjs|cjs)$/)) {
170681
170929
  return `from ${quote}${path}.js${quote}`;
@@ -170694,7 +170942,7 @@ ${registrations}
170694
170942
  await Promise.all(entries.map(({ target, content }) => fs.writeFile(target, content, "utf-8")));
170695
170943
  return entries.map(({ target }) => target);
170696
170944
  }, jitContentCache, wrapperOutputCache, escapeTemplateContent = (content) => content.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${"), readAndEscapeFile = async (filePath) => {
170697
- if (!existsSync10(filePath))
170945
+ if (!existsSync11(filePath))
170698
170946
  return null;
170699
170947
  const content = await fs.readFile(filePath, "utf-8");
170700
170948
  return escapeTemplateContent(content);
@@ -170702,7 +170950,7 @@ ${registrations}
170702
170950
  const templateUrlMatch = source.match(/templateUrl\s*:\s*['"]([^'"]+)['"]/);
170703
170951
  if (!templateUrlMatch?.[1])
170704
170952
  return source;
170705
- const escaped = await readAndEscapeFile(join8(fileDir, templateUrlMatch[1]));
170953
+ const escaped = await readAndEscapeFile(join9(fileDir, templateUrlMatch[1]));
170706
170954
  if (!escaped)
170707
170955
  return source;
170708
170956
  return source.replace(/templateUrl\s*:\s*['"][^'"]+['"]/, `template: \`${escaped}\``);
@@ -170715,7 +170963,7 @@ ${registrations}
170715
170963
  return source;
170716
170964
  const stylePromises = urlMatches.map((urlMatch) => {
170717
170965
  const styleUrl = urlMatch.replace(/['"]/g, "");
170718
- return readAndEscapeFile(join8(fileDir, styleUrl));
170966
+ return readAndEscapeFile(join9(fileDir, styleUrl));
170719
170967
  });
170720
170968
  const results = await Promise.all(stylePromises);
170721
170969
  const inlinedStyles = results.filter(Boolean).map((escaped) => `\`${escaped}\``);
@@ -170726,7 +170974,7 @@ ${registrations}
170726
170974
  const styleUrlMatch = source.match(/styleUrl\s*:\s*['"]([^'"]+)['"]/);
170727
170975
  if (!styleUrlMatch?.[1])
170728
170976
  return source;
170729
- const escaped = await readAndEscapeFile(join8(fileDir, styleUrlMatch[1]));
170977
+ const escaped = await readAndEscapeFile(join9(fileDir, styleUrlMatch[1]));
170730
170978
  if (!escaped)
170731
170979
  return source;
170732
170980
  return source.replace(/styleUrl\s*:\s*['"][^'"]+['"]/, `styles: [\`${escaped}\`]`);
@@ -170756,15 +171004,15 @@ ${registrations}
170756
171004
  let actualPath = resolved;
170757
171005
  if (!actualPath.endsWith(".ts"))
170758
171006
  actualPath += ".ts";
170759
- if (!existsSync10(actualPath))
171007
+ if (!existsSync11(actualPath))
170760
171008
  return;
170761
171009
  let sourceCode = await fs.readFile(actualPath, "utf-8");
170762
171010
  sourceCode = await inlineResources(sourceCode, dirname5(actualPath));
170763
171011
  const inputDir = dirname5(actualPath);
170764
171012
  const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
170765
171013
  const fileBase = basename4(actualPath).replace(/\.ts$/, ".js");
170766
- const targetDir = join8(outDir, relativeDir);
170767
- const targetPath = join8(targetDir, fileBase);
171014
+ const targetDir = join9(outDir, relativeDir);
171015
+ const targetPath = join9(targetDir, fileBase);
170768
171016
  const importRegex = /from\s+['"](\.\.?\/[^'"]+)['"]/g;
170769
171017
  const localImports = [];
170770
171018
  let importMatch;
@@ -170774,7 +171022,7 @@ ${registrations}
170774
171022
  }
170775
171023
  const contentHash = Bun.hash(sourceCode).toString(BASE_36_RADIX);
170776
171024
  const cacheKey2 = actualPath;
170777
- if (jitContentCache.get(cacheKey2) === contentHash && existsSync10(targetPath)) {
171025
+ if (jitContentCache.get(cacheKey2) === contentHash && existsSync11(targetPath)) {
170778
171026
  allOutputs.push(targetPath);
170779
171027
  } else {
170780
171028
  let processedContent = angularTranspiler.transformSync(sourceCode);
@@ -170808,13 +171056,13 @@ ${registrations}
170808
171056
  await transpileFile(inputPath);
170809
171057
  return allOutputs;
170810
171058
  }, compileAngular = async (entryPoints, outRoot, hmr = false) => {
170811
- const compiledParent = join8(outRoot, "generated");
171059
+ const compiledParent = join9(outRoot, "generated");
170812
171060
  if (entryPoints.length === 0) {
170813
171061
  const emptyPaths = [];
170814
171062
  return { clientPaths: [...emptyPaths], serverPaths: [...emptyPaths] };
170815
171063
  }
170816
171064
  const compiledRoot = compiledParent;
170817
- const indexesDir = join8(compiledParent, "indexes");
171065
+ const indexesDir = join9(compiledParent, "indexes");
170818
171066
  await fs.mkdir(indexesDir, { recursive: true });
170819
171067
  const compileTasks = entryPoints.map(async (entry) => {
170820
171068
  const outputs = hmr ? await compileAngularFileJIT(entry, compiledRoot, outRoot) : await compileAngularFile(entry, compiledRoot);
@@ -170831,8 +171079,8 @@ ${registrations}
170831
171079
  const componentClassName = `${toPascal(fileBase)}Component`;
170832
171080
  const serverContentHash = Bun.hash(original).toString(BASE_36_RADIX);
170833
171081
  const cachedWrapper = wrapperOutputCache.get(entry);
170834
- const clientFile = join8(indexesDir, jsName);
170835
- if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash && existsSync10(clientFile)) {
171082
+ const clientFile = join9(indexesDir, jsName);
171083
+ if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash && existsSync11(clientFile)) {
170836
171084
  return { clientPath: clientFile, indexUnchanged: true, serverPath: rawServerFile };
170837
171085
  }
170838
171086
  let rewritten = original.replace(new RegExp(`templateUrl:\\s*['"]\\.\\/${fileBase}\\.html['"]`), `templateUrl: '../../pages/${fileBase}.html'`);
@@ -170926,8 +171174,8 @@ var init_compileAngular = __esm(() => {
170926
171174
  init_constants();
170927
171175
  import_typescript = __toESM(require_typescript(), 1);
170928
171176
  devClientDir4 = resolveDevClientDir4();
170929
- hmrClientPath5 = join8(devClientDir4, "hmrClient.ts").replace(/\\/g, "/");
170930
- hmrRuntimePath = join8(devClientDir4, "handlers", "angularRuntime.ts").replace(/\\/g, "/");
171177
+ hmrClientPath5 = join9(devClientDir4, "hmrClient.ts").replace(/\\/g, "/");
171178
+ hmrRuntimePath = join9(devClientDir4, "handlers", "angularRuntime.ts").replace(/\\/g, "/");
170931
171179
  jitContentCache = new Map;
170932
171180
  wrapperOutputCache = new Map;
170933
171181
  });
@@ -170938,8 +171186,8 @@ __export(exports_buildReactVendor, {
170938
171186
  computeVendorPaths: () => computeVendorPaths,
170939
171187
  buildReactVendor: () => buildReactVendor
170940
171188
  });
170941
- import { mkdirSync as mkdirSync4 } from "fs";
170942
- import { join as join9 } from "path";
171189
+ import { mkdirSync as mkdirSync5 } from "fs";
171190
+ import { join as join10 } from "path";
170943
171191
  import { rm as rm4 } from "fs/promises";
170944
171192
  var {build: bunBuild2 } = globalThis.Bun;
170945
171193
  var reactSpecifiers, isResolvable = (specifier) => {
@@ -170974,14 +171222,14 @@ var reactSpecifiers, isResolvable = (specifier) => {
170974
171222
  `)}
170975
171223
  `;
170976
171224
  }, buildReactVendor = async (buildDir) => {
170977
- const vendorDir = join9(buildDir, "react", "vendor");
170978
- mkdirSync4(vendorDir, { recursive: true });
170979
- const tmpDir = join9(buildDir, "_vendor_tmp");
170980
- mkdirSync4(tmpDir, { recursive: true });
171225
+ const vendorDir = join10(buildDir, "react", "vendor");
171226
+ mkdirSync5(vendorDir, { recursive: true });
171227
+ const tmpDir = join10(buildDir, "_vendor_tmp");
171228
+ mkdirSync5(tmpDir, { recursive: true });
170981
171229
  const specifiers = resolveVendorSpecifiers();
170982
171230
  const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
170983
171231
  const safeName = toSafeFileName(specifier);
170984
- const entryPath = join9(tmpDir, `${safeName}.ts`);
171232
+ const entryPath = join10(tmpDir, `${safeName}.ts`);
170985
171233
  const source = await generateEntrySource(specifier);
170986
171234
  await Bun.write(entryPath, source);
170987
171235
  return entryPath;
@@ -171017,18 +171265,18 @@ __export(exports_buildAngularVendor, {
171017
171265
  computeAngularVendorPaths: () => computeAngularVendorPaths,
171018
171266
  buildAngularVendor: () => buildAngularVendor
171019
171267
  });
171020
- import { mkdirSync as mkdirSync5 } from "fs";
171021
- import { join as join10 } from "path";
171268
+ import { mkdirSync as mkdirSync6 } from "fs";
171269
+ import { join as join11 } from "path";
171022
171270
  import { rm as rm5 } from "fs/promises";
171023
171271
  var {build: bunBuild3 } = globalThis.Bun;
171024
171272
  var angularSpecifiers, toSafeFileName2 = (specifier) => specifier.replace(/^@/, "").replace(/\//g, "_"), buildAngularVendor = async (buildDir) => {
171025
- const vendorDir = join10(buildDir, "angular", "vendor");
171026
- mkdirSync5(vendorDir, { recursive: true });
171027
- const tmpDir = join10(buildDir, "_angular_vendor_tmp");
171028
- mkdirSync5(tmpDir, { recursive: true });
171273
+ const vendorDir = join11(buildDir, "angular", "vendor");
171274
+ mkdirSync6(vendorDir, { recursive: true });
171275
+ const tmpDir = join11(buildDir, "_angular_vendor_tmp");
171276
+ mkdirSync6(tmpDir, { recursive: true });
171029
171277
  const entrypoints = await Promise.all(angularSpecifiers.map(async (specifier) => {
171030
171278
  const safeName = toSafeFileName2(specifier);
171031
- const entryPath = join10(tmpDir, `${safeName}.ts`);
171279
+ const entryPath = join11(tmpDir, `${safeName}.ts`);
171032
171280
  await Bun.write(entryPath, `export * from '${specifier}';
171033
171281
  `);
171034
171282
  return entryPath;
@@ -171070,18 +171318,18 @@ __export(exports_buildVueVendor, {
171070
171318
  computeVueVendorPaths: () => computeVueVendorPaths,
171071
171319
  buildVueVendor: () => buildVueVendor
171072
171320
  });
171073
- import { mkdirSync as mkdirSync6 } from "fs";
171074
- import { join as join11 } from "path";
171321
+ import { mkdirSync as mkdirSync7 } from "fs";
171322
+ import { join as join12 } from "path";
171075
171323
  import { rm as rm6 } from "fs/promises";
171076
171324
  var {build: bunBuild4 } = globalThis.Bun;
171077
171325
  var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"), buildVueVendor = async (buildDir) => {
171078
- const vendorDir = join11(buildDir, "vue", "vendor");
171079
- mkdirSync6(vendorDir, { recursive: true });
171080
- const tmpDir = join11(buildDir, "_vue_vendor_tmp");
171081
- mkdirSync6(tmpDir, { recursive: true });
171326
+ const vendorDir = join12(buildDir, "vue", "vendor");
171327
+ mkdirSync7(vendorDir, { recursive: true });
171328
+ const tmpDir = join12(buildDir, "_vue_vendor_tmp");
171329
+ mkdirSync7(tmpDir, { recursive: true });
171082
171330
  const entrypoints = await Promise.all(vueSpecifiers.map(async (specifier) => {
171083
171331
  const safeName = toSafeFileName3(specifier);
171084
- const entryPath = join11(tmpDir, `${safeName}.ts`);
171332
+ const entryPath = join12(tmpDir, `${safeName}.ts`);
171085
171333
  await Bun.write(entryPath, `export * from '${specifier}';
171086
171334
  `);
171087
171335
  return entryPath;
@@ -171106,17 +171354,17 @@ var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"
171106
171354
  console.warn("\u26A0\uFE0F Vue vendor build had errors:", result.logs);
171107
171355
  return;
171108
171356
  }
171109
- const { readFileSync: readFileSync5, writeFileSync: writeFileSync3, readdirSync } = await import("fs");
171357
+ const { readFileSync: readFileSync6, writeFileSync: writeFileSync4, readdirSync } = await import("fs");
171110
171358
  const files = readdirSync(vendorDir).filter((f) => f.endsWith(".js"));
171111
171359
  for (const file3 of files) {
171112
- const filePath = join11(vendorDir, file3);
171113
- const content = readFileSync5(filePath, "utf-8");
171360
+ const filePath = join12(vendorDir, file3);
171361
+ const content = readFileSync6(filePath, "utf-8");
171114
171362
  if (!content.includes("__VUE_HMR_RUNTIME__"))
171115
171363
  continue;
171116
171364
  const patched = content.replace(/getGlobalThis\(\)\.__VUE_HMR_RUNTIME__\s*=\s*\{/, "getGlobalThis().__VUE_HMR_RUNTIME__ = getGlobalThis().__VUE_HMR_RUNTIME__ || {");
171117
171365
  if (patched === content)
171118
171366
  continue;
171119
- writeFileSync3(filePath, patched);
171367
+ writeFileSync4(filePath, patched);
171120
171368
  }
171121
171369
  }, computeVueVendorPaths = () => {
171122
171370
  const paths = {};
@@ -171135,8 +171383,8 @@ __export(exports_buildSvelteVendor, {
171135
171383
  computeSvelteVendorPaths: () => computeSvelteVendorPaths,
171136
171384
  buildSvelteVendor: () => buildSvelteVendor
171137
171385
  });
171138
- import { mkdirSync as mkdirSync7 } from "fs";
171139
- import { join as join12 } from "path";
171386
+ import { mkdirSync as mkdirSync8 } from "fs";
171387
+ import { join as join13 } from "path";
171140
171388
  import { rm as rm7 } from "fs/promises";
171141
171389
  var {build: bunBuild5 } = globalThis.Bun;
171142
171390
  var svelteSpecifiers, isResolvable2 = (specifier) => {
@@ -171150,13 +171398,13 @@ var svelteSpecifiers, isResolvable2 = (specifier) => {
171150
171398
  const specifiers = resolveVendorSpecifiers2();
171151
171399
  if (specifiers.length === 0)
171152
171400
  return;
171153
- const vendorDir = join12(buildDir, "svelte", "vendor");
171154
- mkdirSync7(vendorDir, { recursive: true });
171155
- const tmpDir = join12(buildDir, "_svelte_vendor_tmp");
171156
- mkdirSync7(tmpDir, { recursive: true });
171401
+ const vendorDir = join13(buildDir, "svelte", "vendor");
171402
+ mkdirSync8(vendorDir, { recursive: true });
171403
+ const tmpDir = join13(buildDir, "_svelte_vendor_tmp");
171404
+ mkdirSync8(tmpDir, { recursive: true });
171157
171405
  const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
171158
171406
  const safeName = toSafeFileName4(specifier);
171159
- const entryPath = join12(tmpDir, `${safeName}.ts`);
171407
+ const entryPath = join13(tmpDir, `${safeName}.ts`);
171160
171408
  await Bun.write(entryPath, `export * from '${specifier}';
171161
171409
  `);
171162
171410
  return entryPath;
@@ -171231,14 +171479,14 @@ var init_rewriteImports = __esm(() => {
171231
171479
  import {
171232
171480
  copyFileSync,
171233
171481
  cpSync,
171234
- existsSync as existsSync11,
171235
- mkdirSync as mkdirSync8,
171236
- readFileSync as readFileSync5,
171482
+ existsSync as existsSync12,
171483
+ mkdirSync as mkdirSync9,
171484
+ readFileSync as readFileSync6,
171237
171485
  rmSync,
171238
171486
  statSync,
171239
- writeFileSync as writeFileSync3
171487
+ writeFileSync as writeFileSync4
171240
171488
  } from "fs";
171241
- import { basename as basename5, join as join13, relative as relative7, resolve as resolve10 } from "path";
171489
+ import { basename as basename5, join as join14, relative as relative7, resolve as resolve10 } from "path";
171242
171490
  import { cwd, env as env2, exit } from "process";
171243
171491
  var {build: bunBuild6, Glob: Glob5 } = globalThis.Bun;
171244
171492
  var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental, throwOnError) => {
@@ -171260,11 +171508,11 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171260
171508
  throw err;
171261
171509
  exit(1);
171262
171510
  }, copyHtmxVendor = (htmxDir, htmxDestDir) => {
171263
- mkdirSync8(htmxDestDir, { recursive: true });
171511
+ mkdirSync9(htmxDestDir, { recursive: true });
171264
171512
  const glob = new Glob5("htmx*.min.js");
171265
171513
  for (const relPath of glob.scanSync({ cwd: htmxDir })) {
171266
- const src = join13(htmxDir, relPath);
171267
- const dest = join13(htmxDestDir, "htmx.min.js");
171514
+ const src = join14(htmxDir, relPath);
171515
+ const dest = join14(htmxDestDir, "htmx.min.js");
171268
171516
  copyFileSync(src, dest);
171269
171517
  return;
171270
171518
  }
@@ -171304,7 +171552,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171304
171552
  addWorkerPathIfExists(file3, relPath, workerPaths);
171305
171553
  }
171306
171554
  }, collectWorkerPathsFromFile = (file3, patterns, workerPaths) => {
171307
- const content = readFileSync5(file3, "utf-8");
171555
+ const content = readFileSync6(file3, "utf-8");
171308
171556
  for (const pattern of patterns) {
171309
171557
  collectWorkerPathsFromContent(content, pattern, file3, workerPaths);
171310
171558
  }
@@ -171337,8 +171585,8 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171337
171585
  vuePagesPath
171338
171586
  }) => {
171339
171587
  const { readdirSync: readDir } = await import("fs");
171340
- const devIndexDir = join13(buildPath, "_src_indexes");
171341
- mkdirSync8(devIndexDir, { recursive: true });
171588
+ const devIndexDir = join14(buildPath, "_src_indexes");
171589
+ mkdirSync9(devIndexDir, { recursive: true });
171342
171590
  if (reactIndexesPath && reactPagesPath) {
171343
171591
  copyReactDevIndexes(reactIndexesPath, reactPagesPath, devIndexDir, readDir);
171344
171592
  }
@@ -171352,35 +171600,35 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171352
171600
  const indexFiles = readDir(reactIndexesPath).filter((file3) => file3.endsWith(".tsx"));
171353
171601
  const pagesRel = relative7(process.cwd(), resolve10(reactPagesPath)).replace(/\\/g, "/");
171354
171602
  for (const file3 of indexFiles) {
171355
- let content = readFileSync5(join13(reactIndexesPath, file3), "utf-8");
171603
+ let content = readFileSync6(join14(reactIndexesPath, file3), "utf-8");
171356
171604
  content = content.replace(/from\s*['"]([^'"]*\/pages\/([^'"]+))['"]/g, (_match, _fullPath, componentName) => `from '/@src/${pagesRel}/${componentName}'`);
171357
- writeFileSync3(join13(devIndexDir, file3), content);
171605
+ writeFileSync4(join14(devIndexDir, file3), content);
171358
171606
  }
171359
171607
  }, copySvelteDevIndexes = (svelteDir, sveltePagesPath, svelteEntries, devIndexDir) => {
171360
- const svelteIndexDir = join13(svelteDir, "generated", "indexes");
171608
+ const svelteIndexDir = join14(svelteDir, "generated", "indexes");
171361
171609
  const sveltePageEntries = svelteEntries.filter((file3) => resolve10(file3).startsWith(resolve10(sveltePagesPath)));
171362
171610
  for (const entry of sveltePageEntries) {
171363
171611
  const name = basename5(entry).replace(/\.svelte(\.(ts|js))?$/, "");
171364
- const indexFile = join13(svelteIndexDir, "pages", `${name}.js`);
171365
- if (!existsSync11(indexFile))
171612
+ const indexFile = join14(svelteIndexDir, "pages", `${name}.js`);
171613
+ if (!existsSync12(indexFile))
171366
171614
  continue;
171367
- let content = readFileSync5(indexFile, "utf-8");
171615
+ let content = readFileSync6(indexFile, "utf-8");
171368
171616
  const srcRel = relative7(process.cwd(), resolve10(entry)).replace(/\\/g, "/");
171369
171617
  content = content.replace(/import\s+Component\s+from\s+['"]([^'"]+)['"]/, `import Component from "/@src/${srcRel}"`);
171370
- writeFileSync3(join13(devIndexDir, `${name}.svelte.js`), content);
171618
+ writeFileSync4(join14(devIndexDir, `${name}.svelte.js`), content);
171371
171619
  }
171372
171620
  }, copyVueDevIndexes = (vueDir, vuePagesPath, vueEntries, devIndexDir) => {
171373
- const vueIndexDir = join13(vueDir, "generated", "indexes");
171621
+ const vueIndexDir = join14(vueDir, "generated", "indexes");
171374
171622
  const vuePageEntries = vueEntries.filter((file3) => resolve10(file3).startsWith(resolve10(vuePagesPath)));
171375
171623
  for (const entry of vuePageEntries) {
171376
171624
  const name = basename5(entry, ".vue");
171377
- const indexFile = join13(vueIndexDir, `${name}.js`);
171378
- if (!existsSync11(indexFile))
171625
+ const indexFile = join14(vueIndexDir, `${name}.js`);
171626
+ if (!existsSync12(indexFile))
171379
171627
  continue;
171380
- let content = readFileSync5(indexFile, "utf-8");
171628
+ let content = readFileSync6(indexFile, "utf-8");
171381
171629
  const srcRel = relative7(process.cwd(), resolve10(entry)).replace(/\\/g, "/");
171382
171630
  content = content.replace(/import\s+Comp\s+from\s+['"]([^'"]+)['"]/, `import Comp from "/@src/${srcRel}"`);
171383
- writeFileSync3(join13(devIndexDir, `${name}.vue.js`), content);
171631
+ writeFileSync4(join14(devIndexDir, `${name}.vue.js`), content);
171384
171632
  }
171385
171633
  }, resolveVueRuntimeId = (content, firstUseName, outputPath, projectRoot) => {
171386
171634
  const varIdx = content.indexOf(`var ${firstUseName} =`);
@@ -171428,7 +171676,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171428
171676
  }
171429
171677
  return result;
171430
171678
  }, VUE_HMR_RUNTIME, injectVueComposableTracking = (outputPath, projectRoot) => {
171431
- let content = readFileSync5(outputPath, "utf-8");
171679
+ let content = readFileSync6(outputPath, "utf-8");
171432
171680
  const usePattern = /^var\s+(use[A-Z]\w*)\s*=/gm;
171433
171681
  const useNames = [];
171434
171682
  let match;
@@ -171449,7 +171697,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171449
171697
  content = `${content.slice(0, firstUseIdx) + runtime}
171450
171698
  ${content.slice(firstUseIdx)}`;
171451
171699
  content = wrapUseFunctions(content, useNames);
171452
- writeFileSync3(outputPath, content);
171700
+ writeFileSync4(outputPath, content);
171453
171701
  }, buildDevUrlFileMap = (urlReferencedFiles, projectRoot) => {
171454
171702
  const urlFileMap = new Map;
171455
171703
  for (const srcPath of urlReferencedFiles) {
@@ -171478,7 +171726,7 @@ ${content.slice(firstUseIdx)}`;
171478
171726
  }, rewriteUrlReferences = (outputPaths, urlFileMap) => {
171479
171727
  const urlPattern = /new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g;
171480
171728
  for (const outputPath of outputPaths) {
171481
- let content = readFileSync5(outputPath, "utf-8");
171729
+ let content = readFileSync6(outputPath, "utf-8");
171482
171730
  let changed = false;
171483
171731
  content = content.replace(urlPattern, (_match, relPath) => {
171484
171732
  const targetName = basename5(relPath);
@@ -171489,7 +171737,7 @@ ${content.slice(firstUseIdx)}`;
171489
171737
  return `new URL('${resolvedPath}', import.meta.url)`;
171490
171738
  });
171491
171739
  if (changed)
171492
- writeFileSync3(outputPath, content);
171740
+ writeFileSync4(outputPath, content);
171493
171741
  }
171494
171742
  }, vueFeatureFlags, build = async ({
171495
171743
  buildDirectory = "build",
@@ -171525,14 +171773,14 @@ ${content.slice(firstUseIdx)}`;
171525
171773
  const stylesPath = typeof stylesConfig === "string" ? stylesConfig : stylesConfig?.path;
171526
171774
  const stylesIgnore = typeof stylesConfig === "object" ? stylesConfig.ignore : undefined;
171527
171775
  const stylesDir = stylesPath && validateSafePath(stylesPath, projectRoot);
171528
- const reactIndexesPath = reactDir && join13(reactDir, "generated", "indexes");
171529
- const reactPagesPath = reactDir && join13(reactDir, "pages");
171530
- const htmlPagesPath = htmlDir && join13(htmlDir, "pages");
171531
- const htmlScriptsPath = htmlDir && join13(htmlDir, "scripts");
171532
- const sveltePagesPath = svelteDir && join13(svelteDir, "pages");
171533
- const vuePagesPath = vueDir && join13(vueDir, "pages");
171534
- const htmxPagesPath = htmxDir && join13(htmxDir, "pages");
171535
- const angularPagesPath = angularDir && join13(angularDir, "pages");
171776
+ const reactIndexesPath = reactDir && join14(reactDir, "generated", "indexes");
171777
+ const reactPagesPath = reactDir && join14(reactDir, "pages");
171778
+ const htmlPagesPath = htmlDir && join14(htmlDir, "pages");
171779
+ const htmlScriptsPath = htmlDir && join14(htmlDir, "scripts");
171780
+ const sveltePagesPath = svelteDir && join14(svelteDir, "pages");
171781
+ const vuePagesPath = vueDir && join14(vueDir, "pages");
171782
+ const htmxPagesPath = htmxDir && join14(htmxDir, "pages");
171783
+ const angularPagesPath = angularDir && join14(angularDir, "pages");
171536
171784
  const frontends = [
171537
171785
  reactDir,
171538
171786
  htmlDir,
@@ -171568,12 +171816,12 @@ ${content.slice(firstUseIdx)}`;
171568
171816
  if (svelteDir)
171569
171817
  serverDirMap.push({
171570
171818
  dir: svelteDir,
171571
- subdir: join13("generated", "server")
171819
+ subdir: join14("generated", "server")
171572
171820
  });
171573
171821
  if (vueDir)
171574
171822
  serverDirMap.push({
171575
171823
  dir: vueDir,
171576
- subdir: join13("generated", "server")
171824
+ subdir: join14("generated", "server")
171577
171825
  });
171578
171826
  if (angularDir)
171579
171827
  serverDirMap.push({ dir: angularDir, subdir: "generated" });
@@ -171583,14 +171831,14 @@ ${content.slice(firstUseIdx)}`;
171583
171831
  const [firstEntry] = serverDirMap;
171584
171832
  if (!firstEntry)
171585
171833
  throw new Error("Expected at least one server directory entry");
171586
- serverRoot = join13(firstEntry.dir, firstEntry.subdir);
171587
- serverOutDir = join13(buildPath, basename5(firstEntry.dir));
171834
+ serverRoot = join14(firstEntry.dir, firstEntry.subdir);
171835
+ serverOutDir = join14(buildPath, basename5(firstEntry.dir));
171588
171836
  } else if (serverDirMap.length > 1) {
171589
171837
  serverRoot = commonAncestor(serverDirMap.map((entry) => entry.dir), projectRoot);
171590
171838
  serverOutDir = buildPath;
171591
171839
  }
171592
171840
  const publicPath = publicDirectory && validateSafePath(publicDirectory, projectRoot);
171593
- mkdirSync8(buildPath, { recursive: true });
171841
+ mkdirSync9(buildPath, { recursive: true });
171594
171842
  if (publicPath)
171595
171843
  cpSync(publicPath, buildPath, { force: true, recursive: true });
171596
171844
  const filterToIncrementalEntries = (entryPoints, mapToSource) => {
@@ -171612,7 +171860,7 @@ ${content.slice(firstUseIdx)}`;
171612
171860
  await generateReactIndexFiles(reactPagesPath, reactIndexesPath, hmr);
171613
171861
  }
171614
171862
  if (assetsPath && (!isIncremental || normalizedIncrementalFiles?.some((f) => f.includes("/assets/")))) {
171615
- cpSync(assetsPath, join13(buildPath, "assets"), {
171863
+ cpSync(assetsPath, join14(buildPath, "assets"), {
171616
171864
  force: true,
171617
171865
  recursive: true
171618
171866
  });
@@ -171626,7 +171874,7 @@ ${content.slice(firstUseIdx)}`;
171626
171874
  } catch {
171627
171875
  binPath = "tailwindcss";
171628
171876
  }
171629
- const proc = Bun.spawn(["bun", binPath, "-i", input, "-o", join13(buildPath, output)], { stderr: "pipe", stdout: "pipe" });
171877
+ const proc = Bun.spawn(["bun", binPath, "-i", input, "-o", join14(buildPath, output)], { stderr: "pipe", stdout: "pipe" });
171630
171878
  await proc.exited;
171631
171879
  };
171632
171880
  const tailwindPromise = tailwind && (!isIncremental || normalizedIncrementalFiles?.some((file3) => file3.endsWith(".css"))) ? compileTailwind(tailwind.input, tailwind.output) : undefined;
@@ -171651,7 +171899,7 @@ ${content.slice(firstUseIdx)}`;
171651
171899
  const reactEntries = isIncremental && reactIndexesPath && reactPagesPath ? filterToIncrementalEntries(allReactEntries, (entry) => {
171652
171900
  if (entry.startsWith(resolve10(reactIndexesPath))) {
171653
171901
  const pageName = basename5(entry, ".tsx");
171654
- return join13(reactPagesPath, `${pageName}.tsx`);
171902
+ return join14(reactPagesPath, `${pageName}.tsx`);
171655
171903
  }
171656
171904
  return null;
171657
171905
  }) : allReactEntries;
@@ -171742,7 +171990,7 @@ ${content.slice(firstUseIdx)}`;
171742
171990
  return {};
171743
171991
  }
171744
171992
  if (hmr && reactIndexesPath && reactClientEntryPoints.length > 0) {
171745
- const refreshEntry = join13(reactIndexesPath, "_refresh.tsx");
171993
+ const refreshEntry = join14(reactIndexesPath, "_refresh.tsx");
171746
171994
  if (!reactClientEntryPoints.includes(refreshEntry))
171747
171995
  reactClientEntryPoints.push(refreshEntry);
171748
171996
  }
@@ -171785,13 +172033,13 @@ ${content.slice(firstUseIdx)}`;
171785
172033
  throw: false
171786
172034
  } : undefined;
171787
172035
  if (reactDir && reactClientEntryPoints.length > 0) {
171788
- rmSync(join13(buildPath, "react", "indexes"), {
172036
+ rmSync(join14(buildPath, "react", "indexes"), {
171789
172037
  force: true,
171790
172038
  recursive: true
171791
172039
  });
171792
172040
  }
171793
172041
  if (angularDir && angularClientPaths.length > 0) {
171794
- rmSync(join13(buildPath, "angular", "indexes"), {
172042
+ rmSync(join14(buildPath, "angular", "indexes"), {
171795
172043
  force: true,
171796
172044
  recursive: true
171797
172045
  });
@@ -171853,7 +172101,7 @@ ${content.slice(firstUseIdx)}`;
171853
172101
  globalCssEntries.length > 0 ? bunBuild6({
171854
172102
  entrypoints: globalCssEntries,
171855
172103
  naming: `[dir]/[name].[hash].[ext]`,
171856
- outdir: stylesDir ? join13(buildPath, basename5(stylesDir)) : buildPath,
172104
+ outdir: stylesDir ? join14(buildPath, basename5(stylesDir)) : buildPath,
171857
172105
  root: stylesDir || clientRoot,
171858
172106
  target: "browser",
171859
172107
  throw: false
@@ -171861,7 +172109,7 @@ ${content.slice(firstUseIdx)}`;
171861
172109
  vueCssPaths.length > 0 ? bunBuild6({
171862
172110
  entrypoints: vueCssPaths,
171863
172111
  naming: `[name].[hash].[ext]`,
171864
- outdir: join13(buildPath, assetsPath ? basename5(assetsPath) : "assets", "css"),
172112
+ outdir: join14(buildPath, assetsPath ? basename5(assetsPath) : "assets", "css"),
171865
172113
  target: "browser",
171866
172114
  throw: false
171867
172115
  }) : undefined
@@ -171956,20 +172204,20 @@ ${content.slice(firstUseIdx)}`;
171956
172204
  const injectHMRIntoHTMLFile = (filePath, framework) => {
171957
172205
  if (!hmrClientBundle)
171958
172206
  return;
171959
- let html = readFileSync5(filePath, "utf-8");
172207
+ let html = readFileSync6(filePath, "utf-8");
171960
172208
  if (html.includes("data-hmr-client"))
171961
172209
  return;
171962
172210
  const tag = `<script>window.__HMR_FRAMEWORK__="${framework}";</script><script data-hmr-client>${hmrClientBundle}</script>`;
171963
172211
  const bodyClose = /<\/body\s*>/i.exec(html);
171964
172212
  html = bodyClose ? html.slice(0, bodyClose.index) + tag + html.slice(bodyClose.index) : html + tag;
171965
- writeFileSync3(filePath, html);
172213
+ writeFileSync4(filePath, html);
171966
172214
  };
171967
172215
  const processHtmlPages = async () => {
171968
172216
  if (!(htmlDir && htmlPagesPath))
171969
172217
  return;
171970
- const outputHtmlPages = isSingle ? join13(buildPath, "pages") : join13(buildPath, basename5(htmlDir), "pages");
172218
+ const outputHtmlPages = isSingle ? join14(buildPath, "pages") : join14(buildPath, basename5(htmlDir), "pages");
171971
172219
  if (shouldCopyHtml) {
171972
- mkdirSync8(outputHtmlPages, { recursive: true });
172220
+ mkdirSync9(outputHtmlPages, { recursive: true });
171973
172221
  cpSync(htmlPagesPath, outputHtmlPages, {
171974
172222
  force: true,
171975
172223
  recursive: true
@@ -171977,6 +172225,7 @@ ${content.slice(firstUseIdx)}`;
171977
172225
  }
171978
172226
  if (shouldUpdateHtmlAssetPaths) {
171979
172227
  await updateAssetPaths(manifest, outputHtmlPages);
172228
+ await optimizeHtmlImages(outputHtmlPages);
171980
172229
  }
171981
172230
  const htmlPageFiles = await scanEntryPoints(outputHtmlPages, "*.html");
171982
172231
  for (const htmlFile of htmlPageFiles) {
@@ -171989,20 +172238,21 @@ ${content.slice(firstUseIdx)}`;
171989
172238
  const processHtmxPages = async () => {
171990
172239
  if (!(htmxDir && htmxPagesPath))
171991
172240
  return;
171992
- const outputHtmxPages = isSingle ? join13(buildPath, "pages") : join13(buildPath, basename5(htmxDir), "pages");
172241
+ const outputHtmxPages = isSingle ? join14(buildPath, "pages") : join14(buildPath, basename5(htmxDir), "pages");
171993
172242
  if (shouldCopyHtmx) {
171994
- mkdirSync8(outputHtmxPages, { recursive: true });
172243
+ mkdirSync9(outputHtmxPages, { recursive: true });
171995
172244
  cpSync(htmxPagesPath, outputHtmxPages, {
171996
172245
  force: true,
171997
172246
  recursive: true
171998
172247
  });
171999
172248
  }
172000
172249
  if (shouldCopyHtmx) {
172001
- const htmxDestDir = isSingle ? buildPath : join13(buildPath, basename5(htmxDir));
172250
+ const htmxDestDir = isSingle ? buildPath : join14(buildPath, basename5(htmxDir));
172002
172251
  copyHtmxVendor(htmxDir, htmxDestDir);
172003
172252
  }
172004
172253
  if (shouldUpdateHtmxAssetPaths) {
172005
172254
  await updateAssetPaths(manifest, outputHtmxPages);
172255
+ await optimizeHtmlImages(outputHtmxPages);
172006
172256
  }
172007
172257
  const htmxPageFiles = await scanEntryPoints(outputHtmxPages, "*.html");
172008
172258
  for (const htmxFile of htmxPageFiles) {
@@ -172049,7 +172299,7 @@ ${content.slice(firstUseIdx)}`;
172049
172299
  mode: mode ?? (isDev ? "development" : "production")
172050
172300
  });
172051
172301
  if (!isIncremental) {
172052
- writeFileSync3(join13(buildPath, "manifest.json"), JSON.stringify(manifest, null, "\t"));
172302
+ writeFileSync4(join14(buildPath, "manifest.json"), JSON.stringify(manifest, null, "\t"));
172053
172303
  }
172054
172304
  return manifest;
172055
172305
  };
@@ -172061,6 +172311,7 @@ var init_build = __esm(() => {
172061
172311
  init_outputLogs();
172062
172312
  init_scanEntryPoints();
172063
172313
  init_scanCssEntryPoints();
172314
+ init_optimizeHtmlImages();
172064
172315
  init_updateAssetPaths();
172065
172316
  init_buildHMRClient();
172066
172317
  init_rewriteReactImports();
@@ -172108,7 +172359,7 @@ var init_build = __esm(() => {
172108
172359
  });
172109
172360
 
172110
172361
  // src/dev/dependencyGraph.ts
172111
- import { existsSync as existsSync12, readFileSync as readFileSync6 } from "fs";
172362
+ import { existsSync as existsSync13, readFileSync as readFileSync7 } from "fs";
172112
172363
  var {Glob: Glob6 } = globalThis.Bun;
172113
172364
  import { resolve as resolve11 } from "path";
172114
172365
  var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath) => {
@@ -172138,10 +172389,10 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
172138
172389
  ];
172139
172390
  for (const ext of extensions) {
172140
172391
  const withExt = normalized + ext;
172141
- if (existsSync12(withExt))
172392
+ if (existsSync13(withExt))
172142
172393
  return withExt;
172143
172394
  }
172144
- if (existsSync12(normalized))
172395
+ if (existsSync13(normalized))
172145
172396
  return normalized;
172146
172397
  return null;
172147
172398
  }, clearExistingDependents = (graph, normalizedPath) => {
@@ -172156,7 +172407,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
172156
172407
  }
172157
172408
  }, addFileToGraph = (graph, filePath) => {
172158
172409
  const normalizedPath = resolve11(filePath);
172159
- if (!existsSync12(normalizedPath))
172410
+ if (!existsSync13(normalizedPath))
172160
172411
  return;
172161
172412
  const dependencies = extractDependencies(normalizedPath);
172162
172413
  clearExistingDependents(graph, normalizedPath);
@@ -172172,7 +172423,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
172172
172423
  }, IGNORED_SEGMENTS, buildInitialDependencyGraph = (graph, directories) => {
172173
172424
  const processedFiles = new Set;
172174
172425
  const glob = new Glob6("**/*.{ts,tsx,js,jsx,vue,svelte,html,htm}");
172175
- const resolvedDirs = directories.map((dir) => resolve11(dir)).filter((dir) => existsSync12(dir));
172426
+ const resolvedDirs = directories.map((dir) => resolve11(dir)).filter((dir) => existsSync13(dir));
172176
172427
  const allFiles = resolvedDirs.flatMap((dir) => Array.from(glob.scanSync({ absolute: true, cwd: dir })));
172177
172428
  for (const file3 of allFiles) {
172178
172429
  const fullPath = resolve11(file3);
@@ -172269,15 +172520,15 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
172269
172520
  const lowerPath = filePath.toLowerCase();
172270
172521
  const isSvelteOrVue = lowerPath.endsWith(".svelte") || lowerPath.endsWith(".vue");
172271
172522
  if (loader === "html") {
172272
- const content = readFileSync6(filePath, "utf-8");
172523
+ const content = readFileSync7(filePath, "utf-8");
172273
172524
  return extractHtmlDependencies(filePath, content);
172274
172525
  }
172275
172526
  if (loader === "tsx" || loader === "js") {
172276
- const content = readFileSync6(filePath, "utf-8");
172527
+ const content = readFileSync7(filePath, "utf-8");
172277
172528
  return extractJsDependencies(filePath, content, loader);
172278
172529
  }
172279
172530
  if (isSvelteOrVue) {
172280
- const content = readFileSync6(filePath, "utf-8");
172531
+ const content = readFileSync7(filePath, "utf-8");
172281
172532
  return extractSvelteVueDependencies(filePath, content);
172282
172533
  }
172283
172534
  return [];
@@ -172563,8 +172814,8 @@ var init_pathUtils = __esm(() => {
172563
172814
 
172564
172815
  // src/dev/fileWatcher.ts
172565
172816
  import { watch } from "fs";
172566
- import { existsSync as existsSync13 } from "fs";
172567
- import { join as join14, resolve as resolve13 } from "path";
172817
+ import { existsSync as existsSync14 } from "fs";
172818
+ import { join as join15, resolve as resolve13 } from "path";
172568
172819
  var safeRemoveFromGraph = (graph, fullPath) => {
172569
172820
  try {
172570
172821
  removeFileFromGraph(graph, fullPath);
@@ -172591,16 +172842,16 @@ var safeRemoveFromGraph = (graph, fullPath) => {
172591
172842
  if (shouldSkipFilename(filename, isStylesDir)) {
172592
172843
  return;
172593
172844
  }
172594
- const fullPath = join14(absolutePath, filename).replace(/\\/g, "/");
172845
+ const fullPath = join15(absolutePath, filename).replace(/\\/g, "/");
172595
172846
  if (shouldIgnorePath(fullPath, state.resolvedPaths)) {
172596
172847
  return;
172597
172848
  }
172598
- if (event === "rename" && !existsSync13(fullPath)) {
172849
+ if (event === "rename" && !existsSync14(fullPath)) {
172599
172850
  safeRemoveFromGraph(state.dependencyGraph, fullPath);
172600
172851
  onFileChange(fullPath);
172601
172852
  return;
172602
172853
  }
172603
- if (existsSync13(fullPath)) {
172854
+ if (existsSync14(fullPath)) {
172604
172855
  onFileChange(fullPath);
172605
172856
  safeAddToGraph(state.dependencyGraph, fullPath);
172606
172857
  }
@@ -172610,7 +172861,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
172610
172861
  const stylesDir = state.resolvedPaths?.stylesDir;
172611
172862
  paths.forEach((path) => {
172612
172863
  const absolutePath = resolve13(path).replace(/\\/g, "/");
172613
- if (!existsSync13(absolutePath)) {
172864
+ if (!existsSync14(absolutePath)) {
172614
172865
  return;
172615
172866
  }
172616
172867
  const isStylesDir = Boolean(stylesDir && absolutePath.startsWith(stylesDir));
@@ -172621,7 +172872,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
172621
172872
  const stylesDir = state.resolvedPaths?.stylesDir;
172622
172873
  watchPaths.forEach((path) => {
172623
172874
  const absolutePath = resolve13(path).replace(/\\/g, "/");
172624
- if (!existsSync13(absolutePath)) {
172875
+ if (!existsSync14(absolutePath)) {
172625
172876
  return;
172626
172877
  }
172627
172878
  const isStylesDir = Boolean(stylesDir && absolutePath.startsWith(stylesDir));
@@ -172742,10 +172993,10 @@ var init_assetStore = __esm(() => {
172742
172993
  });
172743
172994
 
172744
172995
  // src/dev/fileHashTracker.ts
172745
- import { readFileSync as readFileSync7 } from "fs";
172996
+ import { readFileSync as readFileSync8 } from "fs";
172746
172997
  var computeFileHash = (filePath) => {
172747
172998
  try {
172748
- const fileContent = readFileSync7(filePath);
172999
+ const fileContent = readFileSync8(filePath);
172749
173000
  return Number(Bun.hash(fileContent));
172750
173001
  } catch {
172751
173002
  return UNFOUND_INDEX;
@@ -173132,8 +173383,8 @@ var init_registerClientScript = __esm(() => {
173132
173383
  });
173133
173384
 
173134
173385
  // src/angular/injectorPatch.ts
173135
- import { readFileSync as readFileSync8, writeFileSync as writeFileSync4 } from "fs";
173136
- import { dirname as dirname6, join as join15 } from "path";
173386
+ import { readFileSync as readFileSync9, writeFileSync as writeFileSync5 } from "fs";
173387
+ import { dirname as dirname6, join as join16 } from "path";
173137
173388
  var applyInjectorPatch = (chunkPath, content) => {
173138
173389
  if (content.includes('Symbol.for("angular.currentInjector")')) {
173139
173390
  return;
@@ -173167,12 +173418,12 @@ var applyInjectorPatch = (chunkPath, content) => {
173167
173418
  if (patched === content) {
173168
173419
  return;
173169
173420
  }
173170
- writeFileSync4(chunkPath, patched, "utf-8");
173421
+ writeFileSync5(chunkPath, patched, "utf-8");
173171
173422
  }, patchAngularInjectorSingleton = () => {
173172
173423
  try {
173173
173424
  const coreDir = dirname6(__require.resolve("@angular/core/package.json"));
173174
- const chunkPath = join15(coreDir, "fesm2022", "_not_found-chunk.mjs");
173175
- const content = readFileSync8(chunkPath, "utf-8");
173425
+ const chunkPath = join16(coreDir, "fesm2022", "_not_found-chunk.mjs");
173426
+ const content = readFileSync9(chunkPath, "utf-8");
173176
173427
  applyInjectorPatch(chunkPath, content);
173177
173428
  } catch {}
173178
173429
  };
@@ -202959,7 +203210,7 @@ __export(exports_moduleServer, {
202959
203210
  createModuleServer: () => createModuleServer,
202960
203211
  SRC_URL_PREFIX: () => SRC_URL_PREFIX
202961
203212
  });
202962
- import { existsSync as existsSync14, readFileSync as readFileSync9, statSync as statSync2 } from "fs";
203213
+ import { existsSync as existsSync15, readFileSync as readFileSync10, statSync as statSync2 } from "fs";
202963
203214
  import { basename as basename7, dirname as dirname7, extname as extname3, resolve as resolve17, relative as relative8 } from "path";
202964
203215
  var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
202965
203216
  const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
@@ -202980,7 +203231,7 @@ var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPIL
202980
203231
  ${stubs}
202981
203232
  `;
202982
203233
  }, resolveRelativeExtension = (srcPath, projectRoot, extensions) => {
202983
- const found = extensions.find((ext) => existsSync14(resolve17(projectRoot, srcPath + ext)));
203234
+ const found = extensions.find((ext) => existsSync15(resolve17(projectRoot, srcPath + ext)));
202984
203235
  return found ? srcPath + found : srcPath;
202985
203236
  }, IMPORT_EXTENSIONS, SIDE_EFFECT_EXTENSIONS, MODULE_EXTENSIONS, REACT_EXTENSIONS, escapeRegex3 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), buildImportRewriter = (vendorPaths) => {
202986
203237
  const entries = Object.entries(vendorPaths).sort(([a], [b]) => b.length - a.length);
@@ -203082,7 +203333,7 @@ ${stubs}
203082
203333
  `)}
203083
203334
  ${code}`;
203084
203335
  }, reactTranspilerOptions, reactTranspiler, transformReactFile = (filePath, projectRoot, rewriter) => {
203085
- const raw = readFileSync9(filePath, "utf-8");
203336
+ const raw = readFileSync10(filePath, "utf-8");
203086
203337
  const valueExports = tsxTranspiler.scan(raw).exports;
203087
203338
  let transpiled = reactTranspiler.transformSync(raw);
203088
203339
  transpiled = preserveTypeExports(raw, transpiled, valueExports);
@@ -203097,7 +203348,7 @@ ${transpiled}`;
203097
203348
  transpiled = transpiled.replace(/\binput\.tsx:/g, `${relPath}:`);
203098
203349
  return rewriteImports2(transpiled, filePath, projectRoot, rewriter);
203099
203350
  }, transformPlainFile = (filePath, projectRoot, rewriter, vueDir) => {
203100
- const raw = readFileSync9(filePath, "utf-8");
203351
+ const raw = readFileSync10(filePath, "utf-8");
203101
203352
  const ext = extname3(filePath);
203102
203353
  const isTS = ext === ".ts" || ext === ".tsx";
203103
203354
  const isTSX = ext === ".tsx" || ext === ".jsx";
@@ -203250,7 +203501,7 @@ ${code}`;
203250
203501
  ` + ` var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleUrl)}] = cb; };`);
203251
203502
  return code.replace(/import\.meta\.hot\.accept\(/g, "__hmr_accept(");
203252
203503
  }, transformSvelteFile = async (filePath, projectRoot, rewriter) => {
203253
- const raw = readFileSync9(filePath, "utf-8");
203504
+ const raw = readFileSync10(filePath, "utf-8");
203254
203505
  if (!svelteCompiler) {
203255
203506
  svelteCompiler = await import("svelte/compiler");
203256
203507
  }
@@ -203304,7 +203555,7 @@ export default __script__;`;
203304
203555
  return `${cssInjection}
203305
203556
  ${code}`;
203306
203557
  }, transformVueFile = async (filePath, projectRoot, rewriter, vueDir) => {
203307
- const raw = readFileSync9(filePath, "utf-8");
203558
+ const raw = readFileSync10(filePath, "utf-8");
203308
203559
  if (!vueCompiler) {
203309
203560
  vueCompiler = await import("@vue/compiler-sfc");
203310
203561
  }
@@ -203336,11 +203587,11 @@ ${code}`;
203336
203587
  `);
203337
203588
  return result;
203338
203589
  }, resolveSvelteModulePath = (path) => {
203339
- if (existsSync14(path))
203590
+ if (existsSync15(path))
203340
203591
  return path;
203341
- if (existsSync14(`${path}.ts`))
203592
+ if (existsSync15(`${path}.ts`))
203342
203593
  return `${path}.ts`;
203343
- if (existsSync14(`${path}.js`))
203594
+ if (existsSync15(`${path}.js`))
203344
203595
  return `${path}.js`;
203345
203596
  return path;
203346
203597
  }, jsResponse = (body) => {
@@ -203353,7 +203604,7 @@ ${code}`;
203353
203604
  }
203354
203605
  });
203355
203606
  }, handleCssRequest = (filePath) => {
203356
- const raw = readFileSync9(filePath, "utf-8");
203607
+ const raw = readFileSync10(filePath, "utf-8");
203357
203608
  const escaped = raw.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
203358
203609
  return [
203359
203610
  `const style = document.createElement('style');`,
@@ -203485,7 +203736,7 @@ export default {};
203485
203736
  return { ext, filePath: resolveSvelteModulePath(filePath) };
203486
203737
  if (ext)
203487
203738
  return { ext, filePath };
203488
- const found = MODULE_EXTENSIONS.find((candidate) => existsSync14(filePath + candidate));
203739
+ const found = MODULE_EXTENSIONS.find((candidate) => existsSync15(filePath + candidate));
203489
203740
  if (!found)
203490
203741
  return { ext, filePath };
203491
203742
  const resolved = filePath + found;
@@ -203679,7 +203930,7 @@ var handleHTMXUpdate = async (htmxFilePath) => {
203679
203930
  var init_simpleHTMXHMR = () => {};
203680
203931
 
203681
203932
  // src/dev/rebuildTrigger.ts
203682
- import { existsSync as existsSync15 } from "fs";
203933
+ import { existsSync as existsSync16 } from "fs";
203683
203934
  import { rm as rm8 } from "fs/promises";
203684
203935
  import { basename as basename8, relative as relative9, resolve as resolve20 } from "path";
203685
203936
  var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseErrorLocationFromMessage = (msg) => {
@@ -203749,7 +204000,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
203749
204000
  detectedFw = detected !== "ignored" ? detected : affectedFrameworks[0];
203750
204001
  }
203751
204002
  return { ...parsed, framework: detectedFw };
203752
- }, isValidDeletedAffectedFile = (affectedFile, deletedPathResolved, processedFiles) => affectedFile !== deletedPathResolved && !processedFiles.has(affectedFile) && existsSync15(affectedFile), collectDeletedFileAffected = (state, filePathInSet, processedFiles, validFiles) => {
204003
+ }, isValidDeletedAffectedFile = (affectedFile, deletedPathResolved, processedFiles) => affectedFile !== deletedPathResolved && !processedFiles.has(affectedFile) && existsSync16(affectedFile), collectDeletedFileAffected = (state, filePathInSet, processedFiles, validFiles) => {
203753
204004
  state.fileHashes.delete(filePathInSet);
203754
204005
  try {
203755
204006
  const affectedFiles = getAffectedFiles(state.dependencyGraph, filePathInSet);
@@ -203767,7 +204018,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
203767
204018
  if (!dependents || dependents.size === 0) {
203768
204019
  return;
203769
204020
  }
203770
- const dependentFiles = Array.from(dependents).filter((file3) => existsSync15(file3));
204021
+ const dependentFiles = Array.from(dependents).filter((file3) => existsSync16(file3));
203771
204022
  if (dependentFiles.length === 0) {
203772
204023
  return;
203773
204024
  }
@@ -203783,7 +204034,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
203783
204034
  try {
203784
204035
  const affectedFiles = getAffectedFiles(state.dependencyGraph, normalizedFilePath);
203785
204036
  affectedFiles.forEach((affectedFile) => {
203786
- if (!processedFiles.has(affectedFile) && affectedFile !== normalizedFilePath && existsSync15(affectedFile)) {
204037
+ if (!processedFiles.has(affectedFile) && affectedFile !== normalizedFilePath && existsSync16(affectedFile)) {
203787
204038
  validFiles.push(affectedFile);
203788
204039
  processedFiles.add(affectedFile);
203789
204040
  }
@@ -203808,7 +204059,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
203808
204059
  collectChangedFileAffected(state, normalizedFilePath, processedFiles, validFiles);
203809
204060
  }, processFilePathSet = (state, filePathSet, processedFiles, validFiles) => {
203810
204061
  filePathSet.forEach((filePathInSet) => {
203811
- if (!existsSync15(filePathInSet)) {
204062
+ if (!existsSync16(filePathInSet)) {
203812
204063
  collectDeletedFileAffected(state, filePathInSet, processedFiles, validFiles);
203813
204064
  return;
203814
204065
  }
@@ -203916,7 +204167,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
203916
204167
  return componentFile;
203917
204168
  }
203918
204169
  const tsCounterpart = componentFile.replace(/\.html$/, ".ts");
203919
- if (existsSync15(tsCounterpart)) {
204170
+ if (existsSync16(tsCounterpart)) {
203920
204171
  return tsCounterpart;
203921
204172
  }
203922
204173
  if (!graph)
@@ -204053,7 +204304,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
204053
204304
  }, resolveReactEntryForPageFile = (normalized, pagesPathResolved, reactIndexesPath) => {
204054
204305
  const pageName = basename8(normalized, ".tsx");
204055
204306
  const indexPath = resolve20(reactIndexesPath, `${pageName}.tsx`);
204056
- if (!existsSync15(indexPath)) {
204307
+ if (!existsSync16(indexPath)) {
204057
204308
  return;
204058
204309
  }
204059
204310
  return indexPath;
@@ -204065,7 +204316,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
204065
204316
  }
204066
204317
  const pageName = basename8(dep, ".tsx");
204067
204318
  const indexPath = resolve20(reactIndexesPath, `${pageName}.tsx`);
204068
- if (existsSync15(indexPath) && !reactEntries.includes(indexPath)) {
204319
+ if (existsSync16(indexPath) && !reactEntries.includes(indexPath)) {
204069
204320
  reactEntries.push(indexPath);
204070
204321
  }
204071
204322
  });
@@ -204929,6 +205180,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
204929
205180
  const source = await Bun.file(sourceFile).text();
204930
205181
  await Bun.write(destPath, source);
204931
205182
  await updateAssetPaths2(state.manifest, outputDir);
205183
+ const { optimizeHtmlImages: optimizeHtmlImages2 } = await Promise.resolve().then(() => (init_optimizeHtmlImages(), exports_optimizeHtmlImages));
205184
+ await optimizeHtmlImages2(outputDir);
204932
205185
  injectHmrScript(destPath, hmrScript, readFs, writeFs);
204933
205186
  const newHTML = await handleUpdate(destPath);
204934
205187
  if (!newHTML)
@@ -205147,8 +205400,8 @@ __export(exports_buildDepVendor, {
205147
205400
  computeDepVendorPaths: () => computeDepVendorPaths,
205148
205401
  buildDepVendor: () => buildDepVendor
205149
205402
  });
205150
- import { mkdirSync as mkdirSync9 } from "fs";
205151
- import { join as join16 } from "path";
205403
+ import { mkdirSync as mkdirSync10 } from "fs";
205404
+ import { join as join17 } from "path";
205152
205405
  import { rm as rm9 } from "fs/promises";
205153
205406
  var {build: bunBuild7, Glob: Glob7 } = globalThis.Bun;
205154
205407
  var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g, "").replace(/-/g, "_"), isResolvable3 = (specifier) => {
@@ -205188,7 +205441,7 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
205188
205441
  return Array.from(specifiers).filter(isResolvable3);
205189
205442
  }, generateEntrySource2 = (specifier) => `export * from '${specifier}';
205190
205443
  `, rewriteVendorFiles = async (vendorDir) => {
205191
- const { readdirSync: readdirSync2, readFileSync: readFileSync10, writeFileSync: writeFileSync5 } = await import("fs");
205444
+ const { readdirSync: readdirSync2, readFileSync: readFileSync11, writeFileSync: writeFileSync6 } = await import("fs");
205192
205445
  const { computeVendorPaths: computeVendorPaths2 } = await Promise.resolve().then(() => (init_buildReactVendor(), exports_buildReactVendor));
205193
205446
  const reactPaths = Object.entries(computeVendorPaths2());
205194
205447
  const rewriteContent = (content) => reactPaths.reduce((acc, [specifier, webPath]) => {
@@ -205198,23 +205451,23 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
205198
205451
  }, content);
205199
205452
  const files = readdirSync2(vendorDir).filter((f) => f.endsWith(".js"));
205200
205453
  for (const file3 of files) {
205201
- const filePath = join16(vendorDir, file3);
205202
- const original = readFileSync10(filePath, "utf-8");
205454
+ const filePath = join17(vendorDir, file3);
205455
+ const original = readFileSync11(filePath, "utf-8");
205203
205456
  const rewritten = rewriteContent(original);
205204
205457
  if (rewritten !== original)
205205
- writeFileSync5(filePath, rewritten);
205458
+ writeFileSync6(filePath, rewritten);
205206
205459
  }
205207
205460
  }, buildDepVendor = async (buildDir, directories) => {
205208
205461
  const specifiers = await scanBareImports(directories);
205209
205462
  if (specifiers.length === 0)
205210
205463
  return {};
205211
- const vendorDir = join16(buildDir, "vendor");
205212
- mkdirSync9(vendorDir, { recursive: true });
205213
- const tmpDir = join16(buildDir, "_dep_vendor_tmp");
205214
- mkdirSync9(tmpDir, { recursive: true });
205464
+ const vendorDir = join17(buildDir, "vendor");
205465
+ mkdirSync10(vendorDir, { recursive: true });
205466
+ const tmpDir = join17(buildDir, "_dep_vendor_tmp");
205467
+ mkdirSync10(tmpDir, { recursive: true });
205215
205468
  const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
205216
205469
  const safeName = toSafeFileName5(specifier);
205217
- const entryPath = join16(tmpDir, `${safeName}.ts`);
205470
+ const entryPath = join17(tmpDir, `${safeName}.ts`);
205218
205471
  const source = await generateEntrySource2(specifier);
205219
205472
  await Bun.write(entryPath, source);
205220
205473
  return entryPath;
@@ -205561,5 +205814,5 @@ export {
205561
205814
  build
205562
205815
  };
205563
205816
 
205564
- //# debugId=7684D0C3AAA8F5A164756E2164756E21
205817
+ //# debugId=1D13B3CA347CB6EE64756E2164756E21
205565
205818
  //# sourceMappingURL=build.js.map