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

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,26 @@ 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
+ const helperStart = code.indexOf("var __require = /* @__PURE__ */");
172405
+ if (helperStart === -1) {
172406
+ return code;
172407
+ }
172408
+ const helperEndMarker = `throw Error('Dynamic require of "' + x + '" is not supported');`;
172409
+ const helperEnd = code.indexOf(helperEndMarker, helperStart);
172410
+ if (helperEnd === -1) {
172411
+ return code;
172412
+ }
172413
+ const statementEnd = code.indexOf("});", helperEnd);
172414
+ if (statementEnd === -1) {
172415
+ return code;
172416
+ }
172417
+ return `${code.slice(0, helperStart)}${code.slice(statementEnd + 3)}`;
172418
+ }, exists = async (path) => {
172400
172419
  try {
172401
172420
  await stat(path);
172402
172421
  return true;
@@ -172562,6 +172581,9 @@ var resolveDevClientDir2 = () => {
172562
172581
  var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleKey)}] = cb; };`);
172563
172582
  code = code.replace(/import\.meta\.hot\.accept\(/g, "__hmr_accept(");
172564
172583
  }
172584
+ if (mode === "client") {
172585
+ code = removeUnusedRequireHelper(code);
172586
+ }
172565
172587
  code += islandMetadataExports;
172566
172588
  return code;
172567
172589
  };
@@ -179301,16 +179323,17 @@ var init_hmr = __esm(() => {
179301
179323
  // src/plugins/devtoolsJson.ts
179302
179324
  var exports_devtoolsJson = {};
179303
179325
  __export(exports_devtoolsJson, {
179326
+ resolveDevtoolsUuidCachePath: () => resolveDevtoolsUuidCachePath,
179304
179327
  normalizeDevtoolsWorkspaceRoot: () => normalizeDevtoolsWorkspaceRoot,
179305
179328
  devtoolsJson: () => devtoolsJson
179306
179329
  });
179307
179330
  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";
179331
+ import { dirname as dirname14, join as join22, resolve as resolve31 } from "path";
179309
179332
  import { Elysia } from "elysia";
179310
179333
  var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_KEY = "__absoluteDevtoolsWorkspaceUuid", getGlobalUuid = () => Reflect.get(globalThis, UUID_CACHE_KEY), setGlobalUuid = (uuid) => {
179311
179334
  Reflect.set(globalThis, UUID_CACHE_KEY, uuid);
179312
179335
  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) => {
179336
+ }, 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
179337
  if (!existsSync21(cachePath))
179315
179338
  return null;
179316
179339
  try {
@@ -179319,17 +179342,20 @@ var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_K
179319
179342
  } catch {
179320
179343
  return null;
179321
179344
  }
179322
- }, getOrCreateUuid = (buildDir) => {
179345
+ }, getOrCreateUuid = (buildDir, options) => {
179346
+ if (options.uuid && isUuidV4(options.uuid)) {
179347
+ return options.uuid;
179348
+ }
179323
179349
  const globalUuid = getGlobalUuid();
179324
179350
  if (typeof globalUuid === "string" && isUuidV4(globalUuid)) {
179325
179351
  return globalUuid;
179326
179352
  }
179327
- const cachePath = getUuidCachePath(buildDir);
179353
+ const cachePath = resolveDevtoolsUuidCachePath(buildDir, options.uuidCachePath);
179328
179354
  const cachedUuid = readCachedUuid(cachePath);
179329
179355
  if (cachedUuid)
179330
179356
  return setGlobalUuid(cachedUuid);
179331
179357
  const uuid = crypto.randomUUID();
179332
- mkdirSync12(join22(buildDir, ".absolute"), { recursive: true });
179358
+ mkdirSync12(dirname14(cachePath), { recursive: true });
179333
179359
  writeFileSync8(cachePath, uuid, "utf-8");
179334
179360
  return setGlobalUuid(uuid);
179335
179361
  }, normalizeDevtoolsWorkspaceRoot = (root) => {
@@ -179343,9 +179369,10 @@ var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_K
179343
179369
  return join22("\\\\wsl.localhost", "docker-desktop-data", withoutLeadingSlash).replace(/\//g, "\\");
179344
179370
  }
179345
179371
  return root;
179346
- }, devtoolsJson = (buildDir, projectRoot = process.cwd()) => {
179347
- const root = normalizeDevtoolsWorkspaceRoot(resolve31(projectRoot));
179348
- const uuid = getOrCreateUuid(buildDir);
179372
+ }, devtoolsJson = (buildDir, options = {}) => {
179373
+ const rootPath = resolve31(options.projectRoot ?? process.cwd());
179374
+ const root = options.normalizeForWindowsContainer === false ? rootPath : normalizeDevtoolsWorkspaceRoot(rootPath);
179375
+ const uuid = getOrCreateUuid(buildDir, options);
179349
179376
  return new Elysia({ name: "absolute-devtools-json" }).get(ENDPOINT, () => ({
179350
179377
  workspace: {
179351
179378
  root,
@@ -180991,7 +181018,12 @@ var prepareDev = async (config, buildDir) => {
180991
181018
  const { imageOptimizer: imageOptimizer2 } = await Promise.resolve().then(() => (init_imageOptimizer(), exports_imageOptimizer));
180992
181019
  return {
180993
181020
  manifest: result.manifest,
180994
- absolutejs: (app) => addNotFoundHook(addSitemapHook(hmrPlugin(app.use(devtoolsJson2(buildDir)).use(imageOptimizer2(config.images, buildDir)).use(staticPlugin({
181021
+ absolutejs: (app) => addNotFoundHook(addSitemapHook(hmrPlugin(app.use(devtoolsJson2(buildDir, {
181022
+ normalizeForWindowsContainer: config.dev?.devtools?.normalizeForWindowsContainer,
181023
+ projectRoot: config.dev?.devtools?.projectRoot,
181024
+ uuid: config.dev?.devtools?.uuid,
181025
+ uuidCachePath: config.dev?.devtools?.uuidCachePath
181026
+ })).use(imageOptimizer2(config.images, buildDir)).use(staticPlugin({
180995
181027
  assets: buildDir,
180996
181028
  directive: "no-cache",
180997
181029
  maxAge: null,
@@ -181168,6 +181200,9 @@ var networking = (app) => app.listen({
181168
181200
  var pageRouterPlugin = () => {
181169
181201
  console.log("Page Router Plugin Not Implemented Yet");
181170
181202
  };
181203
+
181204
+ // src/plugins/index.ts
181205
+ init_devtoolsJson();
181171
181206
  // src/utils/defineConfig.ts
181172
181207
  var defineConfig = (config) => config;
181173
181208
  // src/utils/generateHeadElement.ts
@@ -187455,6 +187490,7 @@ export {
187455
187490
  setStreamingSlotPolicy,
187456
187491
  setSsrContextGetter,
187457
187492
  serializeIslandProps,
187493
+ resolveDevtoolsUuidCachePath,
187458
187494
  renderStreamingSlotsRuntimeTag,
187459
187495
  renderStreamingSlotPlaceholder,
187460
187496
  renderStreamingSlotPatchTag,
@@ -187464,6 +187500,7 @@ export {
187464
187500
  prepare,
187465
187501
  parseIslandProps,
187466
187502
  pageRouterPlugin,
187503
+ normalizeDevtoolsWorkspaceRoot,
187467
187504
  networking,
187468
187505
  jsonLd2 as jsonLd,
187469
187506
  isValidHMRClientMessage,
@@ -187491,6 +187528,7 @@ export {
187491
187528
  generateHeadElement,
187492
187529
  generateClientScriptCode,
187493
187530
  enhanceHtmlResponseWithStreamingSlots,
187531
+ devtoolsJson,
187494
187532
  defineIslandRegistry,
187495
187533
  defineIslandComponent,
187496
187534
  defineEnv,
@@ -187551,5 +187589,5 @@ export {
187551
187589
  ANGULAR_INIT_TIMEOUT_MS
187552
187590
  };
187553
187591
 
187554
- //# debugId=683AF83777003BDD64756E2164756E21
187592
+ //# debugId=043BF8656FFA280564756E2164756E21
187555
187593
  //# sourceMappingURL=index.js.map