@absolutejs/absolute 0.19.0-beta.275 → 0.19.0-beta.276

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -207235,7 +207235,7 @@ __export(exports_devCert, {
207235
207235
  });
207236
207236
  import { existsSync as existsSync23, mkdirSync as mkdirSync13, readFileSync as readFileSync14, rmSync as rmSync3 } from "fs";
207237
207237
  import { platform as platform3 } from "os";
207238
- import { join as join22 } from "path";
207238
+ import { join as join23 } from "path";
207239
207239
  var CERT_DIR, CERT_PATH, KEY_PATH, CERT_VALIDITY_DAYS = 365, devLog = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[36m[dev]\x1B[0m ${msg}`), devWarn = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[33m[dev]\x1B[0m \x1B[33m${msg}\x1B[0m`), certFilesExist = () => existsSync23(CERT_PATH) && existsSync23(KEY_PATH), isCertExpired = () => {
207240
207240
  try {
207241
207241
  const certPem = readFileSync14(CERT_PATH, "utf-8");
@@ -207441,9 +207441,9 @@ var CERT_DIR, CERT_PATH, KEY_PATH, CERT_VALIDITY_DAYS = 365, devLog = (msg) => c
207441
207441
  return true;
207442
207442
  };
207443
207443
  var init_devCert = __esm(() => {
207444
- CERT_DIR = join22(process.cwd(), ".absolutejs");
207445
- CERT_PATH = join22(CERT_DIR, "cert.pem");
207446
- KEY_PATH = join22(CERT_DIR, "key.pem");
207444
+ CERT_DIR = join23(process.cwd(), ".absolutejs");
207445
+ CERT_PATH = join23(CERT_DIR, "cert.pem");
207446
+ KEY_PATH = join23(CERT_DIR, "key.pem");
207447
207447
  });
207448
207448
  // types/client.ts
207449
207449
  var hmrState = {
@@ -207848,7 +207848,9 @@ var renderVueIslandToHtml = (component, props) => {
207848
207848
  };
207849
207849
 
207850
207850
  // src/core/svelteServerModule.ts
207851
- import { dirname as dirname10, extname as extname5, relative as relative12, resolve as resolve30 } from "path";
207851
+ import { mkdir as mkdir3 } from "fs/promises";
207852
+ import { dirname as dirname10, extname as extname5, join as join22, relative as relative12, resolve as resolve30 } from "path";
207853
+ var serverCacheRoot = join22(process.cwd(), ".absolutejs", "islands", "svelte");
207852
207854
  var compiledModuleCache = new Map;
207853
207855
  var transpiler3 = new Bun.Transpiler({
207854
207856
  loader: "ts",
@@ -207858,6 +207860,11 @@ var ensureRelativeImportPath = (from, to) => {
207858
207860
  const importPath = relative12(dirname10(from), to).replace(/\\/g, "/");
207859
207861
  return importPath.startsWith(".") ? importPath : `./${importPath}`;
207860
207862
  };
207863
+ var getCachedModulePath = (sourcePath) => {
207864
+ const relativeSourcePath = relative12(process.cwd(), sourcePath).replace(/\\/g, "/");
207865
+ const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
207866
+ return join22(serverCacheRoot, `${normalizedSourcePath}.server.js`);
207867
+ };
207861
207868
  var resolveSvelteImport = async (spec, from) => {
207862
207869
  if (spec.startsWith("/")) {
207863
207870
  return spec;
@@ -207875,6 +207882,17 @@ var resolveSvelteImport = async (spec, from) => {
207875
207882
  }
207876
207883
  return null;
207877
207884
  };
207885
+ var writeIfChanged = async (path, content) => {
207886
+ const targetFile = Bun.file(path);
207887
+ const exists2 = await targetFile.exists();
207888
+ if (exists2) {
207889
+ const currentContent = await targetFile.text();
207890
+ if (currentContent === content) {
207891
+ return;
207892
+ }
207893
+ }
207894
+ await Bun.write(path, content);
207895
+ };
207878
207896
  var compileSvelteServerModule = async (sourcePath) => {
207879
207897
  const cachedModulePath = compiledModuleCache.get(sourcePath);
207880
207898
  if (cachedModulePath) {
@@ -207901,10 +207919,11 @@ var compileSvelteServerModule = async (sourcePath) => {
207901
207919
  generate: "server"
207902
207920
  }).js.code;
207903
207921
  for (const [spec, compiledChildPath] of childModulePaths) {
207904
- compiledCode = compiledCode.replaceAll(spec, ensureRelativeImportPath(`${sourcePath}.server.js`, compiledChildPath));
207922
+ compiledCode = compiledCode.replaceAll(spec, ensureRelativeImportPath(getCachedModulePath(sourcePath), compiledChildPath));
207905
207923
  }
207906
- const compiledModulePath = `${sourcePath}.server.js`;
207907
- await Bun.write(compiledModulePath, compiledCode);
207924
+ const compiledModulePath = getCachedModulePath(sourcePath);
207925
+ await mkdir3(dirname10(compiledModulePath), { recursive: true });
207926
+ await writeIfChanged(compiledModulePath, compiledCode);
207908
207927
  compiledModuleCache.set(sourcePath, compiledModulePath);
207909
207928
  return compiledModulePath;
207910
207929
  };
@@ -214385,5 +214404,5 @@ export {
214385
214404
  ANGULAR_INIT_TIMEOUT_MS
214386
214405
  };
214387
214406
 
214388
- //# debugId=405C654C1567A11E64756E2164756E21
214407
+ //# debugId=072EB3A73F36B44B64756E2164756E21
214389
214408
  //# sourceMappingURL=index.js.map