@absolutejs/absolute 0.19.0-beta.844 → 0.19.0-beta.846

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 (35) hide show
  1. package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
  2. package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
  3. package/dist/angular/index.js +29 -21
  4. package/dist/angular/index.js.map +10 -9
  5. package/dist/angular/server.js +29 -21
  6. package/dist/angular/server.js.map +10 -9
  7. package/dist/build.js +984 -508
  8. package/dist/build.js.map +16 -13
  9. package/dist/cli/index.js +547 -286
  10. package/dist/client/index.js +16 -9
  11. package/dist/client/index.js.map +6 -5
  12. package/dist/dev/client/handlers/angular.ts +309 -19
  13. package/dist/dev/client/handlers/angularRuntime.ts +468 -0
  14. package/dist/dev/client/hmrToast.ts +150 -0
  15. package/dist/index.js +1031 -555
  16. package/dist/index.js.map +17 -14
  17. package/dist/islands/index.js +16 -9
  18. package/dist/islands/index.js.map +6 -5
  19. package/dist/react/index.js +16 -9
  20. package/dist/react/index.js.map +6 -5
  21. package/dist/src/build/rewriteImports.d.ts +6 -14
  22. package/dist/src/build/rewriteImportsPlugin.d.ts +48 -0
  23. package/dist/src/dev/angular/editTypeDetection.d.ts +8 -0
  24. package/dist/src/dev/pathUtils.d.ts +3 -0
  25. package/dist/src/utils/buildDirectoryLock.d.ts +26 -3
  26. package/dist/src/utils/loadConfig.d.ts +5 -0
  27. package/dist/src/utils/resolveDevPort.d.ts +21 -0
  28. package/dist/src/utils/runtimeMode.d.ts +3 -0
  29. package/dist/svelte/index.js +16 -9
  30. package/dist/svelte/index.js.map +6 -5
  31. package/dist/types/build.d.ts +15 -0
  32. package/dist/types/globals.d.ts +12 -0
  33. package/dist/vue/index.js +16 -9
  34. package/dist/vue/index.js.map +6 -5
  35. package/package.json +1 -1
@@ -1,16 +1,8 @@
1
- /** Post-process bundled output files to rewrite bare specifiers
2
- * (e.g. `from "@angular/core"`) to stable vendor paths
3
- * (e.g. `from "/angular/vendor/angular_core.js"`).
4
- *
5
- * Uses native Zig scanner (15x faster) when available, falls back
6
- * to JS regex on Windows or when the native addon is missing. */
1
+ /** Compatibility shim the rewrite logic moved to
2
+ * `rewriteImportsPlugin.ts` where it runs in-pipeline against
3
+ * `BuildArtifact[]` straight off `Bun.build()`'s result. Existing callers
4
+ * that still pass a list of file paths route through this thin wrapper.
5
+ * The new in-pipeline call site is `rewriteBuildOutputs`/`buildWithImportRewrite`
6
+ * in `rewriteImportsPlugin.ts`. */
7
7
  export declare const rewriteImports: (outputPaths: string[], vendorPaths: Record<string, string>) => Promise<void>;
8
- /** Post-process every .js in one or more vendor directories using the
9
- * combined cross-framework path map. Required because each vendor build
10
- * externalizes packages owned by other vendor pipelines (e.g. a dep-vendor
11
- * wrapper around `@sentry/angular` externalizes `@angular/core` so it isn't
12
- * duplicated, leaving a bare `from "@angular/core"` in the output). Without
13
- * this rewrite the browser fetches the vendor file at runtime and chokes
14
- * on the bare specifier. Run AFTER all vendor builds complete so every
15
- * framework's path map is included in `vendorPaths`. */
16
8
  export declare const rewriteVendorDirectories: (vendorDirs: string[], vendorPaths: Record<string, string>) => Promise<void>;
@@ -0,0 +1,48 @@
1
+ /** In-pipeline import rewriter for Bun.build outputs.
2
+ *
3
+ * Replaces the previous post-build `rewriteImports` + `rewriteVendorDirectories`
4
+ * passes that walked file paths captured at scheduling time and read them off
5
+ * disk later — a race window where the next rebuild could sweep a path between
6
+ * capture and read, producing ENOENT.
7
+ *
8
+ * Now: the rewrite operates on the `BuildArtifact` outputs returned by
9
+ * `Bun.build()` itself, in the same await chain. Each output's content is
10
+ * transformed (using the native Zig scanner when available, falling back to
11
+ * the JS regex implementation), then written back to disk. The standalone
12
+ * iteration over a captured path list goes away. */
13
+ import type { BuildArtifact, BuildOutput } from 'bun';
14
+ /** JS fallback: regex-based import rewriting. */
15
+ export declare const jsRewriteImports: (content: string, replacements: [string, string][]) => string;
16
+ /** Apply the bare-specifier → vendor-URL rewrite to a single chunk of text. */
17
+ export declare const rewriteImportsInContent: (content: string, vendorPaths: Record<string, string>) => string;
18
+ /** Workaround for a Bun bundler bug: when a module does both
19
+ * `import { x } from 'X'` AND `export * from 'X'`, and `X` is externalized,
20
+ * Bun synthesizes a `__reExport(exports_Y, ns)` call but drops the
21
+ * corresponding `import * as ns from "X"` declaration. The resulting chunk
22
+ * references an undeclared identifier and crashes at module evaluation.
23
+ *
24
+ * Detects the pattern and injects the missing namespace import. The source
25
+ * path is recovered from a sibling named-import in the same chunk (Bun keeps
26
+ * that intact). */
27
+ export declare const fixMissingReExportNamespacesInContent: (content: string) => string;
28
+ /** In-pipeline output rewrite. Reads each emitted .js artifact, applies the
29
+ * rewrite, and writes back. Operates on `BuildArtifact[]` straight off
30
+ * `Bun.build()`'s result so paths are guaranteed-current — no race window. */
31
+ export declare const rewriteBuildOutputs: (outputs: BuildArtifact[], vendorPaths: Record<string, string>) => Promise<void>;
32
+ /** Like `rewriteBuildOutputs`, but takes a separate per-artifact resolver to
33
+ * produce path maps. Used for the SSR-side @angular/* rewrite which uses
34
+ * paths relative to each artifact's directory. */
35
+ export declare const rewriteBuildOutputsWith: (outputs: BuildArtifact[], resolveVendorPaths: (artifact: BuildArtifact) => Record<string, string>) => Promise<void>;
36
+ /** Apply the rewrite + re-export fix to every .js file inside a list of
37
+ * vendor directories. Used after vendor builds where each pipeline emits
38
+ * files that may externalize specifiers owned by another pipeline.
39
+ *
40
+ * This still walks the directory because the cross-vendor rewrite happens
41
+ * AFTER all vendor builds complete (so every framework's path map is
42
+ * available) — it doesn't have a single `BuildArtifact[]` to operate on.
43
+ * ENOENT during read/write is tolerated for the same race-protection
44
+ * reason as the in-pipeline path. */
45
+ export declare const rewriteVendorDirectories: (vendorDirs: string[], vendorPaths: Record<string, string>) => Promise<void>;
46
+ /** Helper to wrap a `Bun.build` call so the rewrite happens in-pipeline.
47
+ * Use as: `const result = await buildWithImportRewrite(bunBuild(config), vendorPaths)`. */
48
+ export declare const buildWithImportRewrite: (pendingBuild: Promise<BuildOutput>, vendorPaths: Record<string, string>) => Promise<BuildOutput>;
@@ -0,0 +1,8 @@
1
+ export type AngularEditType = 'template' | 'style-component' | 'class-component' | 'service-method-only' | 'service-with-side-effects' | 'route' | 'reboot';
2
+ export type AngularEditClassification = {
3
+ type: AngularEditType;
4
+ reason: string;
5
+ sourceFile: string;
6
+ };
7
+ export declare const classifyAngularEdit: (file: string) => AngularEditClassification;
8
+ export declare const collapseClassifications: (classifications: AngularEditClassification[]) => AngularEditClassification;
@@ -2,4 +2,7 @@ import { BuildConfig } from '../../types/build';
2
2
  import type { ResolvedBuildPaths } from './configResolver';
3
3
  export declare const detectFramework: (filePath: string, resolved?: ResolvedBuildPaths) => "react" | "svelte" | "vue" | "angular" | "ember" | "html" | "unknown" | "ignored" | "styles" | "htmx" | "assets";
4
4
  export declare const getWatchPaths: (config: BuildConfig, resolved?: ResolvedBuildPaths) => string[];
5
+ /** A path is ignored when it is NOT inside any of the configured
6
+ * positive watch roots, OR when it falls inside a hard-denied
7
+ * build/output subtree. The styles directory is always allowed. */
5
8
  export declare const shouldIgnorePath: (path: string, resolved?: ResolvedBuildPaths) => boolean;
@@ -1,5 +1,28 @@
1
+ /** Lock file path: `<projectRoot>/.absolutejs/build.lock` where
2
+ * projectRoot is `dirname(buildDirectory)`. Single file (NOT a dir
3
+ * inside build/) — placing it inside .absolutejs avoids interfering
4
+ * with watcher includes scoped to src/, db/, assets/, styles/. */
5
+ export declare const lockPathForBuildDirectory: (buildDirectory: string) => string;
6
+ /** Update the metadata in an already-acquired lock (e.g. fill in the
7
+ * resolved dev-server port once it's been chosen). No-op if we don't
8
+ * hold the lock for this build dir. */
9
+ export declare const updateLockMetadata: (buildDirectory: string, updates: {
10
+ pid?: number;
11
+ port?: number | null;
12
+ }) => void;
1
13
  export declare const acquireBuildDirectoryLock: (buildDirectory: string, options?: {
2
- staleLockMs?: number;
3
- timeoutMs?: number;
14
+ port?: number | null;
15
+ /** When true, an alive holder makes us wait (polling every
16
+ * 250ms up to `waitTimeoutMs`) instead of throwing immediately.
17
+ * Default: true. Dev-server startup passes `wait: false` so
18
+ * the user gets a fast Vite-style error pointing them at the
19
+ * next free port. CLI build/compile leave it true so concurrent
20
+ * invocations against a shared outdir serialize cleanly. */
21
+ wait?: boolean;
22
+ waitTimeoutMs?: number;
4
23
  }) => Promise<() => Promise<void>>;
5
- export declare const withBuildDirectoryLock: <T>(buildDirectory: string, action: () => Promise<T>) => Promise<T>;
24
+ export declare const withBuildDirectoryLock: <T>(buildDirectory: string, action: () => Promise<T>, options?: {
25
+ port?: number | null;
26
+ wait?: boolean;
27
+ waitTimeoutMs?: number;
28
+ }) => Promise<T>;
@@ -26,7 +26,12 @@ export declare const loadConfig: (configPath?: string) => Promise<{
26
26
  incrementalFiles?: string[];
27
27
  mode?: "production" | "development";
28
28
  dev?: {
29
+ port?: number;
30
+ portRange?: number;
31
+ strictPort?: boolean;
32
+ host?: string;
29
33
  https?: boolean;
34
+ watchDirs?: string[];
30
35
  devtools?: {
31
36
  projectRoot?: string;
32
37
  uuid?: string;
@@ -0,0 +1,21 @@
1
+ /** Vite-style dev-server port resolution.
2
+ *
3
+ * Probes the requested port. If busy, falls through to the next port up
4
+ * to `portRange-1` neighbors. With `strictPort: true`, fails on the very
5
+ * first conflict so users who pin a port know immediately.
6
+ *
7
+ * Bun's `Bun.serve` rejects EADDRINUSE asynchronously and only after
8
+ * partially binding, which is awkward to clean up — `node:net.createServer`
9
+ * is simpler and battle-tested for this exact "is anyone listening here"
10
+ * probe. */
11
+ export type ResolveDevPortOptions = {
12
+ strictPort?: boolean;
13
+ portRange?: number;
14
+ host?: string;
15
+ };
16
+ export declare const isPortFree: (port: number, host?: string) => Promise<boolean>;
17
+ export type ResolveDevPortResult = {
18
+ port: number;
19
+ fellBack: boolean;
20
+ };
21
+ export declare const resolveDevPort: (requestedPort: number, options?: ResolveDevPortOptions) => Promise<ResolveDevPortResult>;
@@ -0,0 +1,3 @@
1
+ export declare const getNodeEnv: () => string | undefined;
2
+ export declare const isProductionRuntime: () => boolean;
3
+ export declare const isDevelopmentRuntime: () => boolean;
@@ -2046,6 +2046,9 @@ var resolveAngularPackageDir = (specifier) => {
2046
2046
  };
2047
2047
  var init_resolveAngularPackage = () => {};
2048
2048
 
2049
+ // src/utils/runtimeMode.ts
2050
+ var ENV_VAR = "NODE_ENV", isProductionRuntime = () => process.env[ENV_VAR] === "production", isDevelopmentRuntime = () => process.env[ENV_VAR] === "development";
2051
+
2049
2052
  // src/angular/angularPatch.ts
2050
2053
  var exports_angularPatch = {};
2051
2054
  __export(exports_angularPatch, {
@@ -2128,7 +2131,8 @@ var ensureHead = (doc) => {
2128
2131
  }
2129
2132
  layoutPatchApplied = true;
2130
2133
  }, applyPatches = async () => {
2131
- const { \u{275}DominoAdapter } = await import(resolveAngularRuntimePath("@angular/platform-server"));
2134
+ const spec = isProductionRuntime() ? resolveAngularRuntimePath("@angular/platform-server") : "@angular/platform-server";
2135
+ const { \u{275}DominoAdapter } = await import(spec);
2132
2136
  if (!\u{275}DominoAdapter?.prototype) {
2133
2137
  console.warn("[Angular Patch] \u0275DominoAdapter not found, skipping patches");
2134
2138
  return false;
@@ -2195,18 +2199,21 @@ var initDominoAdapter = (platformServer) => {
2195
2199
  console.error("Failed to initialize DominoAdapter:", err);
2196
2200
  }
2197
2201
  }, loadAngularDeps = async () => {
2198
- if (true) {
2199
- await import(resolveAngularRuntimePath("@angular/compiler"));
2202
+ if (!isProductionRuntime()) {
2203
+ await import("@angular/compiler");
2200
2204
  }
2201
2205
  const { applyPatches: applyPatches2 } = await Promise.resolve().then(() => (init_angularPatch(), exports_angularPatch));
2202
2206
  await applyPatches2();
2207
+ const useBareSpecifiers = !isProductionRuntime();
2203
2208
  const [platformBrowser, platformServer, common, core] = await Promise.all([
2204
- import(resolveAngularRuntimePath("@angular/platform-browser")),
2205
- import(resolveAngularRuntimePath("@angular/platform-server")),
2206
- import(resolveAngularRuntimePath("@angular/common")),
2207
- import(resolveAngularRuntimePath("@angular/core"))
2209
+ useBareSpecifiers ? import("@angular/platform-browser") : import(resolveAngularRuntimePath("@angular/platform-browser")),
2210
+ useBareSpecifiers ? import("@angular/platform-server") : import(resolveAngularRuntimePath("@angular/platform-server")),
2211
+ useBareSpecifiers ? import("@angular/common") : import(resolveAngularRuntimePath("@angular/common")),
2212
+ useBareSpecifiers ? import("@angular/core") : import(resolveAngularRuntimePath("@angular/core"))
2208
2213
  ]);
2209
- if (false) {}
2214
+ if (!isDevelopmentRuntime()) {
2215
+ core.enableProdMode();
2216
+ }
2210
2217
  initDominoAdapter(platformServer);
2211
2218
  return {
2212
2219
  APP_BASE_HREF: common.APP_BASE_HREF,
@@ -3765,5 +3772,5 @@ export {
3765
3772
  createTypedIsland
3766
3773
  };
3767
3774
 
3768
- //# debugId=B5BA84C66FADA6BA64756E2164756E21
3775
+ //# debugId=A6579D02DBD1FDED64756E2164756E21
3769
3776
  //# sourceMappingURL=index.js.map