@absolutejs/absolute 0.19.0-beta.387 → 0.19.0-beta.388

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
@@ -172396,7 +172396,13 @@ var resolveDevClientDir2 = () => {
172396
172396
  }, devClientDir2, hmrClientPath3, persistentCache, sourceHashCache, clearSvelteCompilerCache = () => {
172397
172397
  persistentCache.clear();
172398
172398
  sourceHashCache.clear();
172399
- }, transpiler2, exists = async (path) => {
172399
+ }, transpiler2, removeUnusedRequireHelper = (code) => {
172400
+ const requireMatches = code.match(/\b__require\b/g);
172401
+ if (requireMatches && requireMatches.length > 1) {
172402
+ return code;
172403
+ }
172404
+ return code.replace(/var __require = \/\* @__PURE__ \*\/ \(\(x\) => typeof require !== "undefined" \? require : typeof Proxy !== "undefined" \? new Proxy\(x, \{\s*get: \(a, b\) => \(typeof require !== "undefined" \? require : a\)\[b\]\s*\}\) : x\)\(function\(x\) \{\s*if \(typeof require !== "undefined"\)\s*return require\.apply\(this, arguments\);\s*throw Error\('Dynamic require of "' \+ x \+ '" is not supported'\);\s*\}\);\s*/m, "");
172405
+ }, exists = async (path) => {
172400
172406
  try {
172401
172407
  await stat(path);
172402
172408
  return true;
@@ -172562,6 +172568,9 @@ var resolveDevClientDir2 = () => {
172562
172568
  var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleKey)}] = cb; };`);
172563
172569
  code = code.replace(/import\.meta\.hot\.accept\(/g, "__hmr_accept(");
172564
172570
  }
172571
+ if (mode === "client") {
172572
+ code = removeUnusedRequireHelper(code);
172573
+ }
172565
172574
  code += islandMetadataExports;
172566
172575
  return code;
172567
172576
  };
@@ -173231,7 +173240,7 @@ ${registrations}
173231
173240
  ({ tsLibDir } = cached);
173232
173241
  cached.lastUsed = Date.now();
173233
173242
  } else {
173234
- const tsPath = __require.resolve("/home/alexkahn/abs/absolutejs/node_modules/typescript/lib/typescript.js");
173243
+ const tsPath = __require.resolve("typescript");
173235
173244
  const tsRootDir = dirname9(tsPath);
173236
173245
  tsLibDir = tsRootDir.endsWith("lib") ? tsRootDir : resolve18(tsRootDir, "lib");
173237
173246
  const config = readConfiguration("./tsconfig.json");
@@ -179301,16 +179310,17 @@ var init_hmr = __esm(() => {
179301
179310
  // src/plugins/devtoolsJson.ts
179302
179311
  var exports_devtoolsJson = {};
179303
179312
  __export(exports_devtoolsJson, {
179313
+ resolveDevtoolsUuidCachePath: () => resolveDevtoolsUuidCachePath,
179304
179314
  normalizeDevtoolsWorkspaceRoot: () => normalizeDevtoolsWorkspaceRoot,
179305
179315
  devtoolsJson: () => devtoolsJson
179306
179316
  });
179307
179317
  import { existsSync as existsSync21, mkdirSync as mkdirSync12, readFileSync as readFileSync14, writeFileSync as writeFileSync8 } from "fs";
179308
- import { join as join22, resolve as resolve31 } from "path";
179318
+ import { dirname as dirname14, join as join22, resolve as resolve31 } from "path";
179309
179319
  import { Elysia } from "elysia";
179310
179320
  var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_KEY = "__absoluteDevtoolsWorkspaceUuid", getGlobalUuid = () => Reflect.get(globalThis, UUID_CACHE_KEY), setGlobalUuid = (uuid) => {
179311
179321
  Reflect.set(globalThis, UUID_CACHE_KEY, uuid);
179312
179322
  return uuid;
179313
- }, isUuidV4 = (value) => /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value), getUuidCachePath = (buildDir) => join22(buildDir, ".absolute", "chrome-devtools-workspace-uuid"), readCachedUuid = (cachePath) => {
179323
+ }, isUuidV4 = (value) => /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value), resolveDevtoolsUuidCachePath = (buildDir, uuidCachePath) => resolve31(uuidCachePath ?? join22(buildDir, ".absolute", "chrome-devtools-workspace-uuid")), readCachedUuid = (cachePath) => {
179314
179324
  if (!existsSync21(cachePath))
179315
179325
  return null;
179316
179326
  try {
@@ -179319,17 +179329,20 @@ var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_K
179319
179329
  } catch {
179320
179330
  return null;
179321
179331
  }
179322
- }, getOrCreateUuid = (buildDir) => {
179332
+ }, getOrCreateUuid = (buildDir, options) => {
179333
+ if (options.uuid && isUuidV4(options.uuid)) {
179334
+ return options.uuid;
179335
+ }
179323
179336
  const globalUuid = getGlobalUuid();
179324
179337
  if (typeof globalUuid === "string" && isUuidV4(globalUuid)) {
179325
179338
  return globalUuid;
179326
179339
  }
179327
- const cachePath = getUuidCachePath(buildDir);
179340
+ const cachePath = resolveDevtoolsUuidCachePath(buildDir, options.uuidCachePath);
179328
179341
  const cachedUuid = readCachedUuid(cachePath);
179329
179342
  if (cachedUuid)
179330
179343
  return setGlobalUuid(cachedUuid);
179331
179344
  const uuid = crypto.randomUUID();
179332
- mkdirSync12(join22(buildDir, ".absolute"), { recursive: true });
179345
+ mkdirSync12(dirname14(cachePath), { recursive: true });
179333
179346
  writeFileSync8(cachePath, uuid, "utf-8");
179334
179347
  return setGlobalUuid(uuid);
179335
179348
  }, normalizeDevtoolsWorkspaceRoot = (root) => {
@@ -179343,9 +179356,10 @@ var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_K
179343
179356
  return join22("\\\\wsl.localhost", "docker-desktop-data", withoutLeadingSlash).replace(/\//g, "\\");
179344
179357
  }
179345
179358
  return root;
179346
- }, devtoolsJson = (buildDir, projectRoot = process.cwd()) => {
179347
- const root = normalizeDevtoolsWorkspaceRoot(resolve31(projectRoot));
179348
- const uuid = getOrCreateUuid(buildDir);
179359
+ }, devtoolsJson = (buildDir, options = {}) => {
179360
+ const rootPath = resolve31(options.projectRoot ?? process.cwd());
179361
+ const root = options.normalizeForWindowsContainer === false ? rootPath : normalizeDevtoolsWorkspaceRoot(rootPath);
179362
+ const uuid = getOrCreateUuid(buildDir, options);
179349
179363
  return new Elysia({ name: "absolute-devtools-json" }).get(ENDPOINT, () => ({
179350
179364
  workspace: {
179351
179365
  root,
@@ -180991,7 +181005,12 @@ var prepareDev = async (config, buildDir) => {
180991
181005
  const { imageOptimizer: imageOptimizer2 } = await Promise.resolve().then(() => (init_imageOptimizer(), exports_imageOptimizer));
180992
181006
  return {
180993
181007
  manifest: result.manifest,
180994
- absolutejs: (app) => addNotFoundHook(addSitemapHook(hmrPlugin(app.use(devtoolsJson2(buildDir)).use(imageOptimizer2(config.images, buildDir)).use(staticPlugin({
181008
+ absolutejs: (app) => addNotFoundHook(addSitemapHook(hmrPlugin(app.use(devtoolsJson2(buildDir, {
181009
+ normalizeForWindowsContainer: config.dev?.devtools?.normalizeForWindowsContainer,
181010
+ projectRoot: config.dev?.devtools?.projectRoot,
181011
+ uuid: config.dev?.devtools?.uuid,
181012
+ uuidCachePath: config.dev?.devtools?.uuidCachePath
181013
+ })).use(imageOptimizer2(config.images, buildDir)).use(staticPlugin({
180995
181014
  assets: buildDir,
180996
181015
  directive: "no-cache",
180997
181016
  maxAge: null,
@@ -181168,6 +181187,9 @@ var networking = (app) => app.listen({
181168
181187
  var pageRouterPlugin = () => {
181169
181188
  console.log("Page Router Plugin Not Implemented Yet");
181170
181189
  };
181190
+
181191
+ // src/plugins/index.ts
181192
+ init_devtoolsJson();
181171
181193
  // src/utils/defineConfig.ts
181172
181194
  var defineConfig = (config) => config;
181173
181195
  // src/utils/generateHeadElement.ts
@@ -187455,6 +187477,7 @@ export {
187455
187477
  setStreamingSlotPolicy,
187456
187478
  setSsrContextGetter,
187457
187479
  serializeIslandProps,
187480
+ resolveDevtoolsUuidCachePath,
187458
187481
  renderStreamingSlotsRuntimeTag,
187459
187482
  renderStreamingSlotPlaceholder,
187460
187483
  renderStreamingSlotPatchTag,
@@ -187464,6 +187487,7 @@ export {
187464
187487
  prepare,
187465
187488
  parseIslandProps,
187466
187489
  pageRouterPlugin,
187490
+ normalizeDevtoolsWorkspaceRoot,
187467
187491
  networking,
187468
187492
  jsonLd2 as jsonLd,
187469
187493
  isValidHMRClientMessage,
@@ -187491,6 +187515,7 @@ export {
187491
187515
  generateHeadElement,
187492
187516
  generateClientScriptCode,
187493
187517
  enhanceHtmlResponseWithStreamingSlots,
187518
+ devtoolsJson,
187494
187519
  defineIslandRegistry,
187495
187520
  defineIslandComponent,
187496
187521
  defineEnv,
@@ -187551,5 +187576,5 @@ export {
187551
187576
  ANGULAR_INIT_TIMEOUT_MS
187552
187577
  };
187553
187578
 
187554
- //# debugId=683AF83777003BDD64756E2164756E21
187579
+ //# debugId=7E83CE558B5AECE164756E2164756E21
187555
187580
  //# sourceMappingURL=index.js.map