@absolutejs/absolute 0.19.0-beta.75 → 0.19.0-beta.77

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
@@ -134,26 +134,23 @@ body{min-height:100vh;background:linear-gradient(135deg,rgba(15,23,42,0.98) 0%,r
134
134
  };
135
135
 
136
136
  // src/build/freshReadPlugin.ts
137
+ import { readFileSync } from "fs";
137
138
  var createFreshReadPlugin = (changedFiles) => {
138
139
  const changed = new Set(changedFiles.map((f) => f.replace(/\\/g, "/")));
139
- const escaped = changedFiles.map((f) => f.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
140
- const pattern = escaped.length > 0 ? new RegExp(`(${escaped.join("|")})$`) : /(?!)/;
141
140
  return {
142
141
  name: "fresh-read",
143
142
  setup(build2) {
144
- build2.onLoad({ filter: pattern }, async (args) => {
145
- console.log(`[fresh-read] onLoad: ${args.path}`);
143
+ build2.onLoad({ filter: /\.(tsx?|jsx?)$/ }, (args) => {
146
144
  const normalized = args.path.replace(/\\/g, "/");
147
145
  if (!changed.has(normalized))
148
146
  return;
149
- const contents = await Bun.file(args.path).text();
147
+ const contents = readFileSync(args.path, "utf-8");
150
148
  const ext = args.path.split(".").pop();
151
149
  const loaderMap = {
152
150
  ts: "ts",
153
151
  tsx: "tsx",
154
152
  js: "js",
155
- jsx: "jsx",
156
- css: "css"
153
+ jsx: "jsx"
157
154
  };
158
155
  return {
159
156
  contents,
@@ -163,6 +160,7 @@ var createFreshReadPlugin = (changedFiles) => {
163
160
  }
164
161
  };
165
162
  };
163
+ var init_freshReadPlugin = () => {};
166
164
 
167
165
  // src/utils/normalizePath.ts
168
166
  var normalizePath = (path) => path.replace(/\\/g, "/");
@@ -652,14 +650,14 @@ var scanCssEntryPoints = async (dir, ignore) => {
652
650
  var init_scanCssEntryPoints = () => {};
653
651
 
654
652
  // src/cli/scripts/telemetry.ts
655
- import { existsSync as existsSync4, mkdirSync as mkdirSync2, readFileSync, writeFileSync } from "fs";
653
+ import { existsSync as existsSync4, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync } from "fs";
656
654
  import { homedir } from "os";
657
655
  import { join as join2 } from "path";
658
656
  var configDir, configPath, getTelemetryConfig = () => {
659
657
  try {
660
658
  if (!existsSync4(configPath))
661
659
  return null;
662
- const raw = readFileSync(configPath, "utf-8");
660
+ const raw = readFileSync2(configPath, "utf-8");
663
661
  const config = JSON.parse(raw);
664
662
  return config;
665
663
  } catch {
@@ -672,14 +670,14 @@ var init_telemetry = __esm(() => {
672
670
  });
673
671
 
674
672
  // src/cli/telemetryEvent.ts
675
- import { existsSync as existsSync5, readFileSync as readFileSync2 } from "fs";
673
+ import { existsSync as existsSync5, readFileSync as readFileSync3 } from "fs";
676
674
  import { arch, platform } from "os";
677
675
  import { dirname, join as join3, parse } from "path";
678
676
  var checkCandidate = (candidate) => {
679
677
  if (!existsSync5(candidate)) {
680
678
  return null;
681
679
  }
682
- const pkg = JSON.parse(readFileSync2(candidate, "utf-8"));
680
+ const pkg = JSON.parse(readFileSync3(candidate, "utf-8"));
683
681
  if (pkg.name === "@absolutejs/absolute") {
684
682
  const ver = pkg.version;
685
683
  return ver;
@@ -976,7 +974,7 @@ var devVendorPaths = null, getDevVendorPaths = () => devVendorPaths, setDevVendo
976
974
  };
977
975
 
978
976
  // src/build/angularLinkerPlugin.ts
979
- import { existsSync as existsSync7, mkdirSync as mkdirSync3, readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "fs";
977
+ import { existsSync as existsSync7, mkdirSync as mkdirSync3, readFileSync as readFileSync4, writeFileSync as writeFileSync2 } from "fs";
980
978
  import { dirname as dirname2, join as join4, relative as relative2, resolve as resolve5 } from "path";
981
979
  import { createHash } from "crypto";
982
980
  var CACHE_DIR, angularLinkerPlugin;
@@ -1003,7 +1001,7 @@ var init_angularLinkerPlugin = __esm(() => {
1003
1001
  const cachePath = join4(CACHE_DIR, `${hash}.js`);
1004
1002
  if (existsSync7(cachePath)) {
1005
1003
  return {
1006
- contents: readFileSync3(cachePath, "utf-8"),
1004
+ contents: readFileSync4(cachePath, "utf-8"),
1007
1005
  loader: "js"
1008
1006
  };
1009
1007
  }
@@ -1019,7 +1017,7 @@ var init_angularLinkerPlugin = __esm(() => {
1019
1017
  fileSystem: {
1020
1018
  dirname: dirname2,
1021
1019
  exists: existsSync7,
1022
- readFile: readFileSync3,
1020
+ readFile: readFileSync4,
1023
1021
  relative: relative2,
1024
1022
  resolve: resolve5
1025
1023
  },
@@ -170561,12 +170559,12 @@ __export(exports_compileAngular, {
170561
170559
  compileAngularFile: () => compileAngularFile,
170562
170560
  compileAngular: () => compileAngular
170563
170561
  });
170564
- import { existsSync as existsSync10, readFileSync as readFileSync4, promises as fs } from "fs";
170562
+ import { existsSync as existsSync10, readFileSync as readFileSync5, promises as fs } from "fs";
170565
170563
  import { join as join8, basename as basename4, sep as sep2, dirname as dirname5, resolve as resolve10, relative as relative6 } from "path";
170566
170564
  import { createHash as createHash2 } from "crypto";
170567
170565
  var import_typescript, computeConfigHash = () => {
170568
170566
  try {
170569
- const content = readFileSync4("./tsconfig.json", "utf-8");
170567
+ const content = readFileSync5("./tsconfig.json", "utf-8");
170570
170568
  return createHash2("md5").update(content).digest("hex");
170571
170569
  } catch {
170572
170570
  return "";
@@ -171120,11 +171118,11 @@ var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"
171120
171118
  console.warn("\u26A0\uFE0F Vue vendor build had errors:", result.logs);
171121
171119
  return;
171122
171120
  }
171123
- const { readFileSync: readFileSync5, writeFileSync: writeFileSync3, readdirSync } = await import("fs");
171121
+ const { readFileSync: readFileSync6, writeFileSync: writeFileSync3, readdirSync } = await import("fs");
171124
171122
  const files = readdirSync(vendorDir).filter((f) => f.endsWith(".js"));
171125
171123
  for (const file4 of files) {
171126
171124
  const filePath = join11(vendorDir, file4);
171127
- const content = readFileSync5(filePath, "utf-8");
171125
+ const content = readFileSync6(filePath, "utf-8");
171128
171126
  if (!content.includes("__VUE_HMR_RUNTIME__"))
171129
171127
  continue;
171130
171128
  const patched = content.replace(/getGlobalThis\(\)\.__VUE_HMR_RUNTIME__\s*=\s*\{/, "getGlobalThis().__VUE_HMR_RUNTIME__ = getGlobalThis().__VUE_HMR_RUNTIME__ || {");
@@ -171246,7 +171244,7 @@ import {
171246
171244
  copyFileSync,
171247
171245
  cpSync,
171248
171246
  mkdirSync as mkdirSync8,
171249
- readFileSync as readFileSync5,
171247
+ readFileSync as readFileSync6,
171250
171248
  rmSync,
171251
171249
  writeFileSync as writeFileSync3
171252
171250
  } from "fs";
@@ -171322,6 +171320,9 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171322
171320
  const isIncremental = incrementalFiles && incrementalFiles.length > 0;
171323
171321
  const normalizedIncrementalFiles = incrementalFiles?.map(normalizePath);
171324
171322
  const freshReadPlugins = isIncremental ? [createFreshReadPlugin(incrementalFiles)] : [];
171323
+ if (isIncremental) {
171324
+ console.log(`[build] incremental with ${incrementalFiles.length} changed files, fresh-read plugin active`);
171325
+ }
171325
171326
  const throwOnError = options?.throwOnError === true;
171326
171327
  const hmr = options?.injectHMR === true;
171327
171328
  const buildPath = validateSafePath(buildDirectory, projectRoot);
@@ -171749,7 +171750,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171749
171750
  const injectHMRIntoHTMLFile = (filePath, framework) => {
171750
171751
  if (!hmrClientBundle)
171751
171752
  return;
171752
- let html = readFileSync5(filePath, "utf-8");
171753
+ let html = readFileSync6(filePath, "utf-8");
171753
171754
  if (html.includes("data-hmr-client"))
171754
171755
  return;
171755
171756
  const tag = `<script>window.__HMR_FRAMEWORK__="${framework}";</script><script data-hmr-client>${hmrClientBundle}</script>`;
@@ -171821,7 +171822,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171821
171822
  const indexFiles = readDir(reactIndexesPath).filter((f) => f.endsWith(".tsx"));
171822
171823
  const pagesRel = relative7(process.cwd(), resolve11(reactPagesPath)).replace(/\\/g, "/");
171823
171824
  for (const file4 of indexFiles) {
171824
- let content = readFileSync5(join13(reactIndexesPath, file4), "utf-8");
171825
+ let content = readFileSync6(join13(reactIndexesPath, file4), "utf-8");
171825
171826
  content = content.replace(/from\s*['"]\.\.\/pages\/([^'"]+)['"]/g, `from '/@src/${pagesRel}/$1'`);
171826
171827
  writeFileSync3(join13(devIndexDir, file4), content);
171827
171828
  }
@@ -171847,6 +171848,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171847
171848
  return manifest;
171848
171849
  };
171849
171850
  var init_build = __esm(() => {
171851
+ init_freshReadPlugin();
171850
171852
  init_generateManifest();
171851
171853
  init_generateReactIndexes();
171852
171854
  init_htmlScriptHMRPlugin();
@@ -171872,7 +171874,7 @@ var init_build = __esm(() => {
171872
171874
  });
171873
171875
 
171874
171876
  // src/dev/dependencyGraph.ts
171875
- import { existsSync as existsSync11, readFileSync as readFileSync6 } from "fs";
171877
+ import { existsSync as existsSync11, readFileSync as readFileSync7 } from "fs";
171876
171878
  var {Glob: Glob6 } = globalThis.Bun;
171877
171879
  import { resolve as resolve12 } from "path";
171878
171880
  var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath) => {
@@ -172039,15 +172041,15 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
172039
172041
  const lowerPath = filePath.toLowerCase();
172040
172042
  const isSvelteOrVue = lowerPath.endsWith(".svelte") || lowerPath.endsWith(".vue");
172041
172043
  if (loader === "html") {
172042
- const content = readFileSync6(filePath, "utf-8");
172044
+ const content = readFileSync7(filePath, "utf-8");
172043
172045
  return extractHtmlDependencies(filePath, content);
172044
172046
  }
172045
172047
  if (loader === "tsx" || loader === "js") {
172046
- const content = readFileSync6(filePath, "utf-8");
172048
+ const content = readFileSync7(filePath, "utf-8");
172047
172049
  return extractJsDependencies(filePath, content, loader);
172048
172050
  }
172049
172051
  if (isSvelteOrVue) {
172050
- const content = readFileSync6(filePath, "utf-8");
172052
+ const content = readFileSync7(filePath, "utf-8");
172051
172053
  return extractSvelteVueDependencies(filePath, content);
172052
172054
  }
172053
172055
  return [];
@@ -172482,10 +172484,10 @@ var init_assetStore = __esm(() => {
172482
172484
  });
172483
172485
 
172484
172486
  // src/dev/fileHashTracker.ts
172485
- import { readFileSync as readFileSync7 } from "fs";
172487
+ import { readFileSync as readFileSync8 } from "fs";
172486
172488
  var computeFileHash = (filePath) => {
172487
172489
  try {
172488
- const fileContent = readFileSync7(filePath);
172490
+ const fileContent = readFileSync8(filePath);
172489
172491
  return Number(Bun.hash(fileContent));
172490
172492
  } catch {
172491
172493
  return UNFOUND_INDEX;
@@ -172797,7 +172799,7 @@ var init_registerClientScript = __esm(() => {
172797
172799
  });
172798
172800
 
172799
172801
  // src/angular/injectorPatch.ts
172800
- import { readFileSync as readFileSync8, writeFileSync as writeFileSync4 } from "fs";
172802
+ import { readFileSync as readFileSync9, writeFileSync as writeFileSync4 } from "fs";
172801
172803
  import { dirname as dirname6, join as join15 } from "path";
172802
172804
  var applyInjectorPatch = (chunkPath, content) => {
172803
172805
  if (content.includes('Symbol.for("angular.currentInjector")')) {
@@ -172837,7 +172839,7 @@ var applyInjectorPatch = (chunkPath, content) => {
172837
172839
  try {
172838
172840
  const coreDir = dirname6(__require.resolve("@angular/core/package.json"));
172839
172841
  const chunkPath = join15(coreDir, "fesm2022", "_not_found-chunk.mjs");
172840
- const content = readFileSync8(chunkPath, "utf-8");
172842
+ const content = readFileSync9(chunkPath, "utf-8");
172841
172843
  applyInjectorPatch(chunkPath, content);
172842
172844
  } catch {}
172843
172845
  };
@@ -202397,7 +202399,7 @@ __export(exports_moduleServer, {
202397
202399
  createModuleServer: () => createModuleServer,
202398
202400
  SRC_URL_PREFIX: () => SRC_URL_PREFIX
202399
202401
  });
202400
- import { existsSync as existsSync13, readFileSync as readFileSync9, statSync } from "fs";
202402
+ import { existsSync as existsSync13, readFileSync as readFileSync10, statSync } from "fs";
202401
202403
  import { basename as basename7, dirname as dirname7, extname as extname3, resolve as resolve18, relative as relative8 } from "path";
202402
202404
  var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
202403
202405
  const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
@@ -202552,7 +202554,7 @@ ${stubs}
202552
202554
  `) + `
202553
202555
  ` + code;
202554
202556
  }, reactTranspiler, transformReactFile = (filePath, projectRoot, rewriter) => {
202555
- const raw = readFileSync9(filePath, "utf-8");
202557
+ const raw = readFileSync10(filePath, "utf-8");
202556
202558
  const valueExports = tsxTranspiler.scan(raw).exports;
202557
202559
  let transpiled = reactTranspiler.transformSync(raw);
202558
202560
  transpiled = preserveTypeExports(raw, transpiled, valueExports);
@@ -202567,7 +202569,7 @@ ${stubs}
202567
202569
  transpiled = transpiled.replace(/\binput\.tsx:/g, `${relPath}:`);
202568
202570
  return rewriteImports2(transpiled, filePath, projectRoot, rewriter);
202569
202571
  }, transformPlainFile = (filePath, projectRoot, rewriter) => {
202570
- const raw = readFileSync9(filePath, "utf-8");
202572
+ const raw = readFileSync10(filePath, "utf-8");
202571
202573
  const ext = extname3(filePath);
202572
202574
  const isTS = ext === ".ts" || ext === ".tsx";
202573
202575
  const isTSX = ext === ".tsx" || ext === ".jsx";
@@ -202606,7 +202608,7 @@ ${stubs}
202606
202608
  }
202607
202609
  }
202608
202610
  }, transformSvelteFile = async (filePath, projectRoot, rewriter) => {
202609
- const raw = readFileSync9(filePath, "utf-8");
202611
+ const raw = readFileSync10(filePath, "utf-8");
202610
202612
  if (!svelteCompiler) {
202611
202613
  svelteCompiler = await import("svelte/compiler");
202612
202614
  }
@@ -202642,7 +202644,7 @@ ${code}`;
202642
202644
  }
202643
202645
  return rewriteImports2(code, filePath, projectRoot, rewriter);
202644
202646
  }, transformVueFile = async (filePath, projectRoot, rewriter, vueDir) => {
202645
- const raw = readFileSync9(filePath, "utf-8");
202647
+ const raw = readFileSync10(filePath, "utf-8");
202646
202648
  if (!vueCompiler) {
202647
202649
  vueCompiler = await import("@vue/compiler-sfc");
202648
202650
  }
@@ -202725,7 +202727,7 @@ ${code}`;
202725
202727
  "Content-Type": "application/javascript"
202726
202728
  }
202727
202729
  }), handleCssRequest = (filePath) => {
202728
- const raw = readFileSync9(filePath, "utf-8");
202730
+ const raw = readFileSync10(filePath, "utf-8");
202729
202731
  const escaped = raw.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
202730
202732
  return [
202731
202733
  `const style = document.createElement('style');`,
@@ -204557,13 +204559,13 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
204557
204559
  });
204558
204560
  await rm9(tmpDir, { force: true, recursive: true });
204559
204561
  if (result.success) {
204560
- const { readdirSync, readFileSync: readFileSync10, writeFileSync: writeFileSync5 } = await import("fs");
204562
+ const { readdirSync, readFileSync: readFileSync11, writeFileSync: writeFileSync5 } = await import("fs");
204561
204563
  const { computeVendorPaths: computeVendorPaths2 } = await Promise.resolve().then(() => (init_buildReactVendor(), exports_buildReactVendor));
204562
204564
  const reactPaths = computeVendorPaths2();
204563
204565
  const files = readdirSync(vendorDir).filter((f) => f.endsWith(".js"));
204564
204566
  for (const file4 of files) {
204565
204567
  const filePath = join16(vendorDir, file4);
204566
- let content = readFileSync10(filePath, "utf-8");
204568
+ let content = readFileSync11(filePath, "utf-8");
204567
204569
  let changed = false;
204568
204570
  for (const [specifier, webPath] of Object.entries(reactPaths)) {
204569
204571
  const escaped = specifier.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
@@ -205045,7 +205047,7 @@ var handleReactPageRequest = async (PageComponent, index, ...props) => {
205045
205047
  var handleHTMLPageRequest = (pagePath) => file(pagePath);
205046
205048
  var handleHTMXPageRequest = (pagePath) => file(pagePath);
205047
205049
  // src/core/prepare.ts
205048
- import { readFileSync as readFileSync10 } from "fs";
205050
+ import { readFileSync as readFileSync11 } from "fs";
205049
205051
  import { relative as relative11, resolve as resolve23 } from "path";
205050
205052
 
205051
205053
  // src/utils/loadConfig.ts
@@ -205144,7 +205146,7 @@ var prepare = async (configOrPath) => {
205144
205146
  absolutejs: (app) => hmrPlugin(app.use(staticPlugin2({ assets: buildDir, prefix: "" })))
205145
205147
  };
205146
205148
  }
205147
- const manifest = JSON.parse(readFileSync10(`${buildDir}/manifest.json`, "utf-8"));
205149
+ const manifest = JSON.parse(readFileSync11(`${buildDir}/manifest.json`, "utf-8"));
205148
205150
  const { staticPlugin } = await import("@elysiajs/static");
205149
205151
  const absolutejs = staticPlugin({ assets: buildDir, prefix: "" });
205150
205152
  return { absolutejs, manifest };
@@ -205305,5 +205307,5 @@ export {
205305
205307
  ANGULAR_INIT_TIMEOUT_MS
205306
205308
  };
205307
205309
 
205308
- //# debugId=6029E224354C289564756E2164756E21
205310
+ //# debugId=C6FCF8C73E66208364756E2164756E21
205309
205311
  //# sourceMappingURL=index.js.map