@absolutejs/absolute 0.20.0-beta.171 → 0.20.0-beta.173

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.
Files changed (65) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/README.md +3 -2
  3. package/changelog.json +73 -0
  4. package/dist/angular/browser.js +12 -12
  5. package/dist/angular/browser.js.map +6 -7
  6. package/dist/angular/components/core/streamingSlotRegistrar.js +2 -6
  7. package/dist/angular/components/core/streamingSlotRegistry.js +3 -7
  8. package/dist/angular/components/defer-slot.component.js +12 -7
  9. package/dist/angular/components/stream-slot.component.js +3 -1
  10. package/dist/angular/index.js +40 -13
  11. package/dist/angular/index.js.map +7 -7
  12. package/dist/angular/server.js +39 -12
  13. package/dist/angular/server.js.map +6 -6
  14. package/dist/build/buildWorker.js +135 -57
  15. package/dist/build.js +1183 -1011
  16. package/dist/build.js.map +16 -15
  17. package/dist/cli/config/server.js +43 -12
  18. package/dist/cli/{doctor-repprx92.js → doctor-m36tmx4d.js} +70 -15
  19. package/dist/cli/index.js +2 -2
  20. package/dist/cli/{typecheck-209bemxm.js → typecheck-fag7djt5.js} +21 -6
  21. package/dist/core/streamingSlotRegistrar.js +2 -5
  22. package/dist/core/streamingSlotRegistrar.js.map +4 -5
  23. package/dist/core/streamingSlotRegistry.js +2 -5
  24. package/dist/core/streamingSlotRegistry.js.map +4 -5
  25. package/dist/dev/serverBootstrap.js +2 -1
  26. package/dist/index.js +1116 -940
  27. package/dist/index.js.map +18 -17
  28. package/dist/islands/index.js +2 -2
  29. package/dist/islands/index.js.map +3 -3
  30. package/dist/mobile/browser.js +2 -2
  31. package/dist/mobile/browser.js.map +3 -3
  32. package/dist/mobile/index.js +2 -2
  33. package/dist/mobile/index.js.map +3 -3
  34. package/dist/react/components/index.js +2 -5
  35. package/dist/react/components/index.js.map +5 -6
  36. package/dist/react/index.js +45 -16
  37. package/dist/react/index.js.map +8 -8
  38. package/dist/react/router/browser.js.map +2 -2
  39. package/dist/react/router/index.js.map +2 -2
  40. package/dist/react/server.js +45 -16
  41. package/dist/react/server.js.map +8 -8
  42. package/dist/src/angular/components/defer-slot.component.d.ts +1 -0
  43. package/dist/src/build/missingReactRouter.d.ts +8 -0
  44. package/dist/src/build/vueModuleOutputPath.d.ts +10 -6
  45. package/dist/src/cli/scripts/bunCheck.d.ts +3 -1
  46. package/dist/src/cli/scripts/doctor.d.ts +10 -0
  47. package/dist/src/core/streamingSlotWarningScope.d.ts +3 -0
  48. package/dist/src/dev/hot/reload.d.ts +5 -0
  49. package/dist/src/dev/hot/runtime.d.ts +2 -0
  50. package/dist/src/dev/srcPath.d.ts +2 -1
  51. package/dist/src/react/pageHandler.d.ts +5 -0
  52. package/dist/src/react/router/Link.d.ts +6 -1
  53. package/dist/src/react/serverComponents/pageHandler.d.ts +2 -0
  54. package/dist/src/utils/portInUse.d.ts +16 -0
  55. package/dist/svelte/index.js +39 -12
  56. package/dist/svelte/index.js.map +6 -6
  57. package/dist/svelte/server.js +39 -12
  58. package/dist/svelte/server.js.map +6 -6
  59. package/dist/vue/components/index.js +2 -5
  60. package/dist/vue/components/index.js.map +4 -5
  61. package/dist/vue/index.js +39 -12
  62. package/dist/vue/index.js.map +6 -6
  63. package/dist/vue/server.js +39 -12
  64. package/dist/vue/server.js.map +6 -6
  65. package/package.json +2 -1
@@ -6,6 +6,7 @@ type DeferSlotResolver = () => Promise<AngularDeferSlotPayload>;
6
6
  type DeferSlotState = 'error' | 'fallback' | 'resolved';
7
7
  export declare class DeferSlotComponent implements AfterViewInit {
8
8
  private readonly cdr;
9
+ private readonly isServer;
9
10
  private readonly runtimeReady;
10
11
  private serverSlotRegistered;
11
12
  className?: string;
@@ -0,0 +1,8 @@
1
+ import type { BunPlugin } from 'bun';
2
+ /** Build error for a `react-router` import when the package isn't installed.
3
+ * `fromAbsolute`: the import is the package's own (`react/router`). */
4
+ export declare const missingReactRouterMessage: (specifier: string, importer: string, fromAbsolute: boolean) => string;
5
+ export declare const isReactRouterMissing: (projectRoot: string) => boolean;
6
+ /** Fails the build with `missingReactRouterMessage` on any `react-router`
7
+ * import; null when react-router is installed (nothing to do). */
8
+ export declare const createMissingReactRouterPlugin: (projectRoot: string, isMissing?: (projectRoot: string) => boolean) => BunPlugin | null;
@@ -1,7 +1,11 @@
1
- /** Mirror source paths under each compilation mode. Using the filesystem root
2
- * preserves relative imports, including imports outside the configured Vue
3
- * directory, without letting parent traversals escape the client/server tree.
4
- * Encode the root separately so Windows drives and UNC roots cannot collide. */
5
- export declare const vueModuleOutputPath: (outputDir: string, sourcePath: string) => string;
1
+ export declare const vueModuleOutputPath: (outputDir: string, sourcePath: string, projectRoot?: string) => string;
2
+ /** The specifier a compiled module at `importerSource` uses to import the
3
+ * compiled `targetSource`. Inside one region this is the original relative
4
+ * path; across regions it follows the generated layout instead. */
5
+ export declare const vueRelativeOutputImport: (importerSource: string, targetSource: string, projectRoot?: string) => string;
6
+ /** `specifier` as written in `importerSource`, which resolves to
7
+ * `targetSource`, adjusted for the generated mirror: unchanged within one
8
+ * region, re-derived from the generated layout across regions. */
9
+ export declare const vueMirrorImport: (importerSource: string, specifier: string, targetSource: string, projectRoot?: string) => string;
6
10
  /** Reverse the generated mirror for composable hot-reload module identities. */
7
- export declare const vueModuleSourcePath: (outputDir: string, outputPath: string) => string | null;
11
+ export declare const vueModuleSourcePath: (outputDir: string, outputPath: string, projectRoot?: string) => string | null;
@@ -1,6 +1,8 @@
1
- export declare const BUN_CHECK_MIN_VERSION = "1.4.3";
1
+ export declare const BUN_CHECK_MIN_VERSION = "1.4.4";
2
2
  /** Set to `tsc` to keep the TypeScript compiler as the checker. */
3
3
  export declare const CHECKER_ENV = "ABSOLUTE_TYPECHECK_CHECKER";
4
+ /** Type-check, never a project's own `check` script in its place. */
5
+ export declare const NO_SCRIPT = "--no-script";
4
6
  /** Caps the threads `bun check` starts: one per core by default, which a
5
7
  * memory-capped container (Studio) cannot always afford. */
6
8
  export declare const THREADS_ENV = "ABSOLUTE_TYPECHECK_THREADS";
@@ -1 +1,11 @@
1
+ type CheckStatus = 'fail' | 'ok' | 'warn';
2
+ /** The port the dev server would take, resolved the way `absolute dev` does:
3
+ * ABSOLUTE_PORT, then PORT, then `dev.port` in the config, then the default. */
4
+ export declare const devPort: (config: object | null, env?: Record<string, string | undefined>) => number;
5
+ export declare const portCheck: (config: object | null, env?: Record<string, string | undefined>) => Promise<{
6
+ detail: string;
7
+ label: string;
8
+ status: CheckStatus;
9
+ }>;
1
10
  export declare const runDoctor: (args: string[]) => Promise<void>;
11
+ export {};
@@ -1,4 +1,7 @@
1
1
  export declare const captureStreamingSlotWarningCallsite: () => string | undefined;
2
2
  export declare const runWithStreamingSlotWarningScope: <T>(task: () => Promise<T> | T, metadata?: {
3
+ /** The handler turned collection off with `collectStreamingSlots: false`
4
+ * (rather than leaving it at a framework default of off). */
5
+ explicitlyDisabled?: boolean;
3
6
  handlerCallsite?: string;
4
7
  }) => T | Promise<T>;
@@ -18,3 +18,8 @@ export type ServerChangeOutcome = {
18
18
  export declare const reportEntryUpdate: (entryPath: string, elapsed: number) => void;
19
19
  /** Apply an edit to a server module. Edits apply one at a time. */
20
20
  export declare const applyServerChange: (path: string, entryPath: string) => Promise<ServerChangeOutcome>;
21
+ /** Before the server entry re-runs for its own edit: apply every module it
22
+ * imports whose file changed since it was loaded but whose edit never
23
+ * arrived (a missed or misrouted watcher event). The entry re-runs next
24
+ * and sees their new versions, so they do not re-run it themselves. */
25
+ export declare const applyStaleModules: (entryPath: string) => Promise<void>;
@@ -93,6 +93,8 @@ export declare const setCurrent: (path: string, namespace: Record<string, unknow
93
93
  declare const forward: (target: Facade | undefined, initial: Record<string, unknown>, name: string, thisArg: unknown, args: unknown[], newTarget: unknown) => any;
94
94
  export declare const currentTag: (path: string) => number;
95
95
  export declare const managedModule: (path: string) => boolean;
96
+ /** Every module the hot runtime has loaded. */
97
+ export declare const managedModulePaths: () => string[];
96
98
  export declare const moduleRecord: (path: string) => ModuleRecord | undefined;
97
99
  export declare const nextTag: (path: string) => number;
98
100
  export declare const setAnalysis: (path: string, analysis: HotModuleAnalysis, source: string) => void;
@@ -1,4 +1,5 @@
1
- /** `@up/core/x.ts` → `../core/x.ts`, for resolving against the app folder. */
1
+ /** `@up/core/x.ts` → `../core/x.ts`, for resolving against the app folder.
2
+ * Percent-encoding the browser added (`%20` for a space) is decoded. */
2
3
  export declare const decodeSrcPath: (srcPath: string) => string;
3
4
  /** `../core/x.ts` → `@up/core/x.ts`; a path inside the app is unchanged. */
4
5
  export declare const encodeSrcPath: (relativePath: string) => string;
@@ -2,6 +2,11 @@ import type { ComponentType as ReactComponent } from 'react';
2
2
  import type { AbsoluteMobileBuildPageMetadata } from '../mobile/buildMetadata';
3
3
  import { type StreamingSlotEnhancerOptions } from '../core/responseEnhancers';
4
4
  type ReactPageRenderOptions = StreamingSlotEnhancerOptions & {
5
+ /** Collect `<SuspenseSlot>` / `<StreamSlot>` registrations during the
6
+ * render and stream their resolved content after the shell. On by
7
+ * default: a page that renders no slot gets byte-identical output and
8
+ * no extra work. Set `false` to turn collection off for this route;
9
+ * slots then stay on their fallback and a warning is logged once. */
5
10
  collectStreamingSlots?: boolean;
6
11
  /** Buffer this page's stream so it can carry a content-hash `ETag` and
7
12
  * serve a `304` on repeat visits, at the cost of streaming's fast first
@@ -29,7 +29,12 @@ export type LinkProps = Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href' | '
29
29
  * `<Route>`s navigates client-side through react-router; anything else is
30
30
  * a real navigation to that page.
31
31
  *
32
- * import { Link } from '@absolutejs/absolute/react/router';
32
+ * import { Link } from '@absolutejs/absolute/react/components';
33
33
  * <Link href="/pricing" prefetch="viewport">Pricing</Link>
34
+ *
35
+ * `@absolutejs/absolute/react/router` exports the same component next to
36
+ * `<UniversalRouter>`, so importing from it needs react-router installed;
37
+ * `react/components` doesn't. Without a `<UniversalRouter>`, a click falls
38
+ * through to the document, where `enableNavigation()` soft-navigates it.
34
39
  */
35
40
  export declare const Link: ({ href, prefetch: prefetchMode, prerender, replace, target, download, children, onBlur, onClick, onFocus, onPointerDown, onPointerEnter, onPointerLeave, ...rest }: LinkProps) => import("react/jsx-runtime").JSX.Element;
@@ -2,6 +2,8 @@ import { type StreamingSlotEnhancerOptions } from '../../core/responseEnhancers'
2
2
  export type ReactServerPageRequestInput<Props extends Record<string, unknown> = Record<never, never>> = StreamingSlotEnhancerOptions & {
3
3
  /** Buffer the response so it can carry a content-hash `ETag`. */
4
4
  bufferStreamForEtag?: boolean;
5
+ /** Collect streaming slots rendered by the page. On by default; set
6
+ * `false` to turn it off (slots then keep their fallback). */
5
7
  collectStreamingSlots?: boolean;
6
8
  /** `asset(manifest, '<Page>RSC')`: the page's react-server bundle. */
7
9
  page: string;
@@ -0,0 +1,16 @@
1
+ /** "Is something already listening on this TCP port?" — answered for every
2
+ * address family a server can bind, not just the one a single probe
3
+ * happens to use.
4
+ *
5
+ * A lone bind probe misses real conflicts: on macOS/BSD a wildcard bind
6
+ * (0.0.0.0) succeeds next to a listener on a specific address
7
+ * (127.0.0.1), and an IPv4 bind says nothing about an IPv6-only listener.
8
+ * So this first tries to connect to both loopbacks (catches any listener
9
+ * that accepts local traffic), then tries to bind the IPv4 and IPv6
10
+ * wildcards separately. Connects run before binds so a probe never
11
+ * connects to its own listener, and every socket is closed before the
12
+ * result is returned. */
13
+ /** True when any process listens on `port` over IPv4, IPv6 or both. */
14
+ export declare const isPortInUse: (port: number) => Promise<boolean>;
15
+ /** Pids listening on `port`, best effort (lsof; empty where unavailable). */
16
+ export declare const portListenerPids: (port: number) => number[];
@@ -382,7 +382,7 @@ var init_lowerAwaitSlotSyntax = __esm(() => {
382
382
  });
383
383
 
384
384
  // src/utils/runtimeMode.ts
385
- var ENV_VAR = "NODE_ENV", getNodeEnv = () => process.env[ENV_VAR], isDevelopmentRuntime = () => process.env[ENV_VAR] === "development", isProductionRuntime = () => process.env[ENV_VAR] === "production";
385
+ var ENV_VAR = "NODE_ENV", readEnv = () => typeof process === "undefined" ? undefined : process.env?.[ENV_VAR], getNodeEnv = () => readEnv(), isDevelopmentRuntime = () => readEnv() === "development", isProductionRuntime = () => readEnv() === "production";
386
386
 
387
387
  // src/build/stylePreprocessor.ts
388
388
  import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
@@ -1390,13 +1390,25 @@ var ISLAND_MARKER = 'data-island="true"', MANIFEST_MARKER = "__ABSOLUTE_MANIFEST
1390
1390
  return;
1391
1391
  warnedMissingBootstrap = true;
1392
1392
  logWarn("A page contains islands, but the build manifest has no islands bootstrap, so they will render without hydrating. Set `islands.registry` in absolute.config.ts (a default bootstrap is generated from it) or point `islands.bootstrap` at a file that calls startIslands().");
1393
- }, manifestBuildDir, WINDOWS_ABSOLUTE_PATH, isServerFilePath = (value) => {
1393
+ }, MANIFEST_BUILD_DIR_KEY, getManifestBuildDir = () => {
1394
+ const value = Reflect.get(globalThis, MANIFEST_BUILD_DIR_KEY);
1395
+ return typeof value === "string" ? value : undefined;
1396
+ }, WINDOWS_ABSOLUTE_PATH, withTrailingSlash = (path) => path.endsWith("/") ? path : `${path}/`, currentWorkingRoot = () => {
1397
+ try {
1398
+ return withTrailingSlash(process.cwd().replaceAll("\\", "/"));
1399
+ } catch {
1400
+ return;
1401
+ }
1402
+ }, isServerFilePath = (value) => {
1394
1403
  if (WINDOWS_ABSOLUTE_PATH.test(value))
1395
1404
  return true;
1396
- if (!manifestBuildDir)
1397
- return false;
1398
- const root = manifestBuildDir.endsWith("/") ? manifestBuildDir : `${manifestBuildDir}/`;
1399
- return value.startsWith(root);
1405
+ const buildDir = getManifestBuildDir();
1406
+ if (buildDir && value.startsWith(withTrailingSlash(buildDir)))
1407
+ return true;
1408
+ const root = currentWorkingRoot();
1409
+ if (root && root !== "/" && value.startsWith(root))
1410
+ return true;
1411
+ return false;
1400
1412
  }, toBrowserManifest = (manifest) => {
1401
1413
  const browserManifest = {};
1402
1414
  for (const [key, value] of Object.entries(manifest)) {
@@ -1608,12 +1620,13 @@ var ISLAND_MARKER = 'data-island="true"', MANIFEST_MARKER = "__ABSOLUTE_MANIFEST
1608
1620
  return pipeStreamWithIslandMarkerDetection(stream, markup, () => warnIfBootstrapMissing(manifest));
1609
1621
  }, setCurrentIslandManifest = (manifest, buildDir) => {
1610
1622
  globalThis.__absoluteManifest = manifest;
1611
- manifestBuildDir = buildDir?.replaceAll("\\", "/");
1623
+ Reflect.set(globalThis, MANIFEST_BUILD_DIR_KEY, buildDir?.replaceAll("\\", "/"));
1612
1624
  };
1613
1625
  var init_islandPageContext = __esm(() => {
1614
1626
  init_escapeScriptContent();
1615
1627
  init_cspNonceRef();
1616
1628
  init_logger();
1629
+ MANIFEST_BUILD_DIR_KEY = Symbol.for("absolutejs.islandManifestBuildDir");
1617
1630
  WINDOWS_ABSOLUTE_PATH = /^[A-Za-z]:[\\/]|^\\\\/;
1618
1631
  });
1619
1632
 
@@ -5090,7 +5103,7 @@ var setStreamingSlotWarningController = (controller) => {
5090
5103
  Reflect.set(globalThis, STREAMING_SLOT_WARNING_STORAGE_KEY, controller);
5091
5104
  };
5092
5105
  var warnMissingStreamingSlotCollector = (primitiveName) => {
5093
- if (isProductionRuntime() || isStreamingSlotCollectionActive()) {
5106
+ if (isStreamingSlotCollectionActive()) {
5094
5107
  return;
5095
5108
  }
5096
5109
  getWarningController()?.maybeWarn(primitiveName);
@@ -5277,7 +5290,11 @@ var extractCallsiteFromStack = (stack) => {
5277
5290
  `).slice(1).map((line) => line.trim()).filter((frame) => !shouldIgnoreWarningFrame(frame)).map((frame) => getWarningLocation(frame)).find((frameLocation) => frameLocation !== undefined);
5278
5291
  return location ? normalizeCallsitePath2(location) : undefined;
5279
5292
  };
5280
- var buildMissingCollectorWarning = (primitiveName, handlerCallsite) => `${primitiveName} rendered during SSR without streaming slot collection enabled. Add { collectStreamingSlots: true } to this page handler to enable out-of-order streaming for this route.${handlerCallsite ? ` Update ${formatWarningCallsite(handlerCallsite)}.` : ""}`;
5293
+ var buildMissingCollectorWarning = (primitiveName, { explicitlyDisabled, handlerCallsite }) => {
5294
+ const fix = explicitlyDisabled ? "This page handler sets { collectStreamingSlots: false }, so the slot stays on its fallback and never streams. Remove the option (or set it to true) to stream this route." : "The slot stays on its fallback and never streams. Add { collectStreamingSlots: true } to this page handler to enable out-of-order streaming for this route.";
5295
+ return `${primitiveName} rendered during SSR without streaming slot collection enabled. ${fix}${handlerCallsite ? ` Update ${formatWarningCallsite(handlerCallsite)}.` : ""}`;
5296
+ };
5297
+ var productionWarnings = new Set;
5281
5298
  setStreamingSlotWarningController({
5282
5299
  maybeWarn: (primitiveName) => {
5283
5300
  const store = getWarningStorage()?.getStore();
@@ -5285,7 +5302,13 @@ setStreamingSlotWarningController({
5285
5302
  return;
5286
5303
  }
5287
5304
  store.hasWarned = true;
5288
- logWarn(buildMissingCollectorWarning(primitiveName, store.handlerCallsite));
5305
+ const message = buildMissingCollectorWarning(primitiveName, store);
5306
+ if (isProductionRuntime()) {
5307
+ if (productionWarnings.has(message))
5308
+ return;
5309
+ productionWarnings.add(message);
5310
+ }
5311
+ logWarn(message);
5289
5312
  }
5290
5313
  });
5291
5314
  var captureStreamingSlotWarningCallsite = () => {
@@ -5298,7 +5321,11 @@ var captureStreamingSlotWarningCallsite = () => {
5298
5321
  }
5299
5322
  return extractCallsiteFromStack(stack);
5300
5323
  };
5301
- var runWithStreamingSlotWarningScope = (task, metadata) => ensureWarningStorage().run({ handlerCallsite: metadata?.handlerCallsite, hasWarned: false }, task);
5324
+ var runWithStreamingSlotWarningScope = (task, metadata) => ensureWarningStorage().run({
5325
+ explicitlyDisabled: metadata?.explicitlyDisabled === true,
5326
+ handlerCallsite: metadata?.handlerCallsite,
5327
+ hasWarned: false
5328
+ }, task);
5302
5329
 
5303
5330
  // src/svelte/pageHandler.ts
5304
5331
  init_routeAssets();
@@ -6074,5 +6101,5 @@ export {
6074
6101
  useIslandStore
6075
6102
  };
6076
6103
 
6077
- //# debugId=55A3DA350585CD1864756E2164756E21
6104
+ //# debugId=B0580FC0A61D8A6F64756E2164756E21
6078
6105
  //# sourceMappingURL=index.js.map