@absolutejs/absolute 0.19.0-beta.1011 → 0.19.0-beta.1013

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/cli/index.js CHANGED
@@ -589,7 +589,13 @@ __export(exports_devCert, {
589
589
  hasCert: () => hasCert,
590
590
  ensureDevCert: () => ensureDevCert
591
591
  });
592
- import { existsSync as existsSync4, mkdirSync as mkdirSync3, readFileSync as readFileSync5, rmSync } from "fs";
592
+ import {
593
+ copyFileSync,
594
+ existsSync as existsSync4,
595
+ mkdirSync as mkdirSync3,
596
+ readFileSync as readFileSync5,
597
+ rmSync
598
+ } from "fs";
593
599
  import { platform as platform2 } from "os";
594
600
  import { join as join4 } from "path";
595
601
  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 = () => existsSync4(CERT_PATH) && existsSync4(KEY_PATH), isCertExpired = () => {
@@ -776,6 +782,58 @@ var CERT_DIR, CERT_PATH, KEY_PATH, CERT_VALIDITY_DAYS = 365, devLog = (msg) => c
776
782
  return false;
777
783
  }
778
784
  return true;
785
+ }, isWSL = () => {
786
+ if (platform2() !== "linux")
787
+ return false;
788
+ try {
789
+ return /microsoft|wsl/i.test(readFileSync5("/proc/version", "utf-8"));
790
+ } catch {
791
+ return false;
792
+ }
793
+ }, runCapture = (cmd) => {
794
+ try {
795
+ const result = Bun.spawnSync(cmd, { stderr: "pipe", stdout: "pipe" });
796
+ if (result.exitCode !== 0)
797
+ return null;
798
+ const out = new TextDecoder().decode(result.stdout).trim();
799
+ return out || null;
800
+ } catch {
801
+ return null;
802
+ }
803
+ }, mkcertCaRoot = () => runCapture(["mkcert", "-CAROOT"]), toWindowsPath = (linuxPath) => runCapture(["wslpath", "-w", linuxPath]), windowsTempDir = () => {
804
+ const winTemp = runCapture(["cmd.exe", "/c", "echo %TEMP%"]);
805
+ if (!winTemp)
806
+ return null;
807
+ return runCapture(["wslpath", "-u", winTemp]);
808
+ }, trustCaOnWindows = () => {
809
+ const caRoot = mkcertCaRoot();
810
+ if (!caRoot)
811
+ return false;
812
+ const rootCa = join4(caRoot, "rootCA.pem");
813
+ if (!existsSync4(rootCa))
814
+ return false;
815
+ const winTemp = windowsTempDir();
816
+ if (!winTemp)
817
+ return false;
818
+ const staged = join4(winTemp, "absolutejs-mkcert-rootCA.crt");
819
+ try {
820
+ copyFileSync(rootCa, staged);
821
+ } catch {
822
+ return false;
823
+ }
824
+ const stagedWin = toWindowsPath(staged);
825
+ if (!stagedWin) {
826
+ rmSync(staged, { force: true });
827
+ return false;
828
+ }
829
+ const result = Bun.spawnSync([
830
+ "powershell.exe",
831
+ "-NoProfile",
832
+ "-Command",
833
+ `Import-Certificate -FilePath '${stagedWin}' -CertStoreLocation Cert:\\CurrentUser\\Root`
834
+ ], { stderr: "pipe", stdout: "pipe" });
835
+ rmSync(staged, { force: true });
836
+ return result.exitCode === 0;
779
837
  }, setupMkcert = () => {
780
838
  if (!ensureMkcert())
781
839
  return false;
@@ -788,6 +846,18 @@ var CERT_DIR, CERT_PATH, KEY_PATH, CERT_VALIDITY_DAYS = 365, devLog = (msg) => c
788
846
  devWarn("Failed to install local CA");
789
847
  return false;
790
848
  }
849
+ if (isWSL()) {
850
+ if (trustCaOnWindows()) {
851
+ devLog("Trusted the local CA in the Windows store \u2014 Chrome/Edge on Windows now accept dev HTTPS");
852
+ } else {
853
+ const caRoot = mkcertCaRoot();
854
+ const hint = caRoot ? toWindowsPath(join4(caRoot, "rootCA.pem")) : null;
855
+ devWarn("Could not auto-trust the local CA on Windows; Windows browsers may warn.");
856
+ if (hint) {
857
+ console.log(` Run in PowerShell: Import-Certificate -FilePath "${hint}" -CertStoreLocation Cert:\\CurrentUser\\Root`);
858
+ }
859
+ }
860
+ }
791
861
  rmSync(CERT_PATH, { force: true });
792
862
  rmSync(KEY_PATH, { force: true });
793
863
  mkdirSync3(CERT_DIR, { recursive: true });
@@ -1278,7 +1348,7 @@ var init_build = __esm(() => {
1278
1348
  });
1279
1349
 
1280
1350
  // src/build/externalAssetPlugin.ts
1281
- import { copyFileSync, existsSync as existsSync10, mkdirSync as mkdirSync6, statSync } from "fs";
1351
+ import { copyFileSync as copyFileSync2, existsSync as existsSync10, mkdirSync as mkdirSync6, statSync } from "fs";
1282
1352
  import { basename as basename2, dirname as dirname3, join as join9, resolve as resolve10 } from "path";
1283
1353
  var createExternalAssetPlugin = (outDir, userSourceRoots = []) => ({
1284
1354
  name: "absolute-external-asset",
@@ -1308,7 +1378,7 @@ var createExternalAssetPlugin = (outDir, userSourceRoots = []) => ({
1308
1378
  if (existsSync10(targetPath))
1309
1379
  continue;
1310
1380
  mkdirSync6(dirname3(targetPath), { recursive: true });
1311
- copyFileSync(assetPath, targetPath);
1381
+ copyFileSync2(assetPath, targetPath);
1312
1382
  }
1313
1383
  return;
1314
1384
  });
@@ -3265,9 +3335,9 @@ var dev = async (serverEntry, configPath2) => {
3265
3335
  const openInBrowser = async () => {
3266
3336
  const url = `http://${resolvedDev.host === "0.0.0.0" ? "localhost" : resolvedDev.host}:${port}`;
3267
3337
  const { platform: platform3 } = process;
3268
- const isWSL = platform3 === "linux" && isWSLEnvironment();
3338
+ const isWSL2 = platform3 === "linux" && isWSLEnvironment();
3269
3339
  let cmd;
3270
- if (isWSL) {
3340
+ if (isWSL2) {
3271
3341
  cmd = "cmd.exe";
3272
3342
  } else if (platform3 === "darwin") {
3273
3343
  cmd = "open";
@@ -3276,7 +3346,7 @@ var dev = async (serverEntry, configPath2) => {
3276
3346
  } else {
3277
3347
  cmd = "xdg-open";
3278
3348
  }
3279
- const args = isWSL ? ["/c", "start", url] : [url];
3349
+ const args = isWSL2 ? ["/c", "start", url] : [url];
3280
3350
  try {
3281
3351
  Bun.spawn([cmd, ...args], {
3282
3352
  stderr: "ignore",
@@ -5647,9 +5717,9 @@ var workspace = async (subcommand, options) => {
5647
5717
  return;
5648
5718
  }
5649
5719
  const { platform: platform5 } = process;
5650
- const isWSL = platform5 === "linux" && isWSLEnvironment();
5720
+ const isWSL2 = platform5 === "linux" && isWSLEnvironment();
5651
5721
  let cmd;
5652
- if (isWSL) {
5722
+ if (isWSL2) {
5653
5723
  cmd = "cmd.exe";
5654
5724
  } else if (platform5 === "darwin") {
5655
5725
  cmd = "open";
@@ -5658,7 +5728,7 @@ var workspace = async (subcommand, options) => {
5658
5728
  } else {
5659
5729
  cmd = "xdg-open";
5660
5730
  }
5661
- const args = isWSL ? ["/c", "start", url] : [url];
5731
+ const args = isWSL2 ? ["/c", "start", url] : [url];
5662
5732
  try {
5663
5733
  Bun.spawn([cmd, ...args], {
5664
5734
  stderr: "ignore",
package/dist/index.js CHANGED
@@ -9083,7 +9083,7 @@ var indexContentCache, resolveDevClientDir = () => {
9083
9083
  if (existsSync8(fromNodeModules))
9084
9084
  return fromNodeModules;
9085
9085
  return resolve13(import.meta.dir, "./dev/client");
9086
- }, devClientDir, errorOverlayPath, hmrClientPath, refreshSetupPath, generateReactIndexFiles = async (reactPagesDirectory, reactIndexesDirectory, isDev2 = false) => {
9086
+ }, devClientDir, errorOverlayPath, hmrClientPath, refreshSetupPath, reactRefreshRuntimePath, generateReactIndexFiles = async (reactPagesDirectory, reactIndexesDirectory, isDev2 = false) => {
9087
9087
  if (!existsSync8(reactIndexesDirectory)) {
9088
9088
  mkdirSync2(reactIndexesDirectory, { recursive: true });
9089
9089
  }
@@ -9416,6 +9416,7 @@ var init_generateReactIndexes = __esm(() => {
9416
9416
  errorOverlayPath = join9(devClientDir, "errorOverlay.ts").replace(/\\/g, "/");
9417
9417
  hmrClientPath = join9(devClientDir, "hmrClient.ts").replace(/\\/g, "/");
9418
9418
  refreshSetupPath = join9(devClientDir, "reactRefreshSetup.ts").replace(/\\/g, "/");
9419
+ reactRefreshRuntimePath = join9(devClientDir, "vendor", "reactRefreshRuntime.js").replace(/\\/g, "/");
9419
9420
  });
9420
9421
 
9421
9422
  // src/build/wrapHTMLScript.ts
@@ -19592,7 +19593,10 @@ import {
19592
19593
  } from "fs";
19593
19594
  import { basename as basename11, dirname as dirname19, extname as extname8, join as join36, relative as relative13, resolve as resolve28 } from "path";
19594
19595
  import { cwd, env as env3, exit } from "process";
19595
- var {build: bunBuild7, Glob: Glob8 } = globalThis.Bun;
19596
+ var {
19597
+ build: bunBuild7,
19598
+ Glob: Glob8
19599
+ } = globalThis.Bun;
19596
19600
  var isDev2, isBuildTraceEnabled = () => {
19597
19601
  const value = env3.ABSOLUTE_BUILD_TRACE?.toLowerCase();
19598
19602
  return value === "1" || value === "true" || value === "yes";
@@ -20735,6 +20739,14 @@ ${content.slice(firstUseIdx)}`;
20735
20739
  ];
20736
20740
  const svelteResolveConditions = svelteDir ? ["svelte", "main"] : undefined;
20737
20741
  const htmlScriptPlugin = hmr ? createHTMLScriptHMRPlugin(htmlDir, htmxDir) : undefined;
20742
+ const reactRefreshRuntimePlugin = {
20743
+ name: "absolute-react-refresh-runtime",
20744
+ setup(builder) {
20745
+ builder.onResolve({ filter: /^react-refresh\/runtime$/ }, () => ({
20746
+ path: reactRefreshRuntimePath
20747
+ }));
20748
+ }
20749
+ };
20738
20750
  const reactBuildConfig = reactClientEntryPoints.length > 0 ? mergeBunBuildConfig({
20739
20751
  entrypoints: reactClientEntryPoints,
20740
20752
  ...Object.keys(reactExternalPaths).length > 0 ? { external: Object.keys(reactExternalPaths) } : {},
@@ -20746,7 +20758,10 @@ ${content.slice(firstUseIdx)}`;
20746
20758
  jsx: { development: true },
20747
20759
  reactFastRefresh: true
20748
20760
  } : {},
20749
- plugins: [stylePreprocessorPlugin2],
20761
+ plugins: hmr ? [
20762
+ stylePreprocessorPlugin2,
20763
+ reactRefreshRuntimePlugin
20764
+ ] : [stylePreprocessorPlugin2],
20750
20765
  root: clientRoot,
20751
20766
  splitting: true,
20752
20767
  target: "browser",
@@ -29133,7 +29148,13 @@ import { argv } from "process";
29133
29148
  var {env: env4 } = globalThis.Bun;
29134
29149
 
29135
29150
  // src/dev/devCert.ts
29136
- import { existsSync as existsSync38, mkdirSync as mkdirSync17, readFileSync as readFileSync32, rmSync as rmSync4 } from "fs";
29151
+ import {
29152
+ copyFileSync as copyFileSync3,
29153
+ existsSync as existsSync38,
29154
+ mkdirSync as mkdirSync17,
29155
+ readFileSync as readFileSync32,
29156
+ rmSync as rmSync4
29157
+ } from "fs";
29137
29158
  import { join as join46 } from "path";
29138
29159
  var CERT_DIR = join46(process.cwd(), ".absolutejs");
29139
29160
  var CERT_PATH = join46(CERT_DIR, "cert.pem");
@@ -35838,5 +35859,5 @@ export {
35838
35859
  ANGULAR_INIT_TIMEOUT_MS
35839
35860
  };
35840
35861
 
35841
- //# debugId=291AAF3E2052619064756E2164756E21
35862
+ //# debugId=9BA6CEB425584CC564756E2164756E21
35842
35863
  //# sourceMappingURL=index.js.map