@absolutejs/absolute 0.19.0-beta.845 → 0.19.0-beta.847

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 (37) 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 +45 -23
  4. package/dist/angular/index.js.map +11 -10
  5. package/dist/angular/server.js +45 -23
  6. package/dist/angular/server.js.map +11 -10
  7. package/dist/build.js +955 -498
  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 +1002 -545
  16. package/dist/index.js.map +17 -14
  17. package/dist/islands/index.js +32 -11
  18. package/dist/islands/index.js.map +7 -6
  19. package/dist/react/index.js +32 -11
  20. package/dist/react/index.js.map +7 -6
  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 +32 -11
  30. package/dist/svelte/index.js.map +7 -6
  31. package/dist/svelte/server.js +17 -3
  32. package/dist/svelte/server.js.map +3 -3
  33. package/dist/types/build.d.ts +15 -0
  34. package/dist/types/globals.d.ts +12 -0
  35. package/dist/vue/index.js +32 -11
  36. package/dist/vue/index.js.map +7 -6
  37. 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;
@@ -754,6 +754,18 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
754
754
  return runPostcss(await readFile(filePath, "utf-8"), filePath, config);
755
755
  }
756
756
  return compileStyleSource(filePath, undefined, undefined, config);
757
+ }, CSS_IMPORT_PATTERN, resolveCssImportsSync = (content, baseDir, visited) => {
758
+ return content.replace(CSS_IMPORT_PATTERN, (match, importPath) => {
759
+ const fullPath = isAbsolute(importPath) ? importPath : resolve2(baseDir, importPath);
760
+ if (visited.has(fullPath))
761
+ return "";
762
+ if (!existsSync2(fullPath))
763
+ return match;
764
+ const nextVisited = new Set(visited);
765
+ nextVisited.add(fullPath);
766
+ const imported = readFileSync2(fullPath, "utf-8");
767
+ return resolveCssImportsSync(imported, dirname(fullPath), nextVisited);
768
+ });
757
769
  }, compileStyleFileIfNeededSync = (filePath, config) => {
758
770
  const rawContents = readFileSync2(filePath, "utf-8");
759
771
  const language = getStyleLanguage(filePath);
@@ -771,7 +783,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
771
783
  }
772
784
  const contents = withAdditionalData(rawContents, options.additionalData);
773
785
  const loadPaths = normalizeLoadPaths(filePath, options.loadPaths);
774
- return sass.compileString(contents, {
786
+ const compiled = sass.compileString(contents, {
775
787
  importers: [
776
788
  createSassImporter(filePath, loadPaths, language, config)
777
789
  ],
@@ -780,6 +792,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
780
792
  syntax: language === "sass" ? "indented" : "scss",
781
793
  url: new URL(`file://${filePath}`)
782
794
  }).css;
795
+ return resolveCssImportsSync(compiled, dirname(filePath), new Set([filePath]));
783
796
  }
784
797
  if (language === "less") {
785
798
  throw new Error(`Unable to compile ${filePath}: Less styleUrl preprocessing is async-only. Import the Less file from a bundled entrypoint or use SCSS/CSS for Angular styleUrl.`);
@@ -787,7 +800,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
787
800
  if (language === "stylus") {
788
801
  throw new Error(`Unable to compile ${filePath}: Stylus styleUrl preprocessing is async-only. Import the Stylus file from a bundled entrypoint or use SCSS/CSS for Angular styleUrl.`);
789
802
  }
790
- return rawContents;
803
+ return resolveCssImportsSync(rawContents, dirname(filePath), new Set([filePath]));
791
804
  }, getCssOutputExtension = (filePath) => isPreprocessableStylePath(filePath) ? ".css" : extname(filePath);
792
805
  var init_stylePreprocessor = __esm(() => {
793
806
  CSS_EXTENSION_PATTERN = /\.css$/i;
@@ -800,6 +813,7 @@ var init_stylePreprocessor = __esm(() => {
800
813
  styleDependencyGraph = new Map;
801
814
  styleOutputHashes = new Map;
802
815
  stylePreprocessorPlugin = createStylePreprocessorPlugin();
816
+ CSS_IMPORT_PATTERN = /@import\s+["']([^"']+)["']\s*;?/g;
803
817
  });
804
818
 
805
819
  // src/core/svelteServerModule.ts
@@ -2046,6 +2060,9 @@ var resolveAngularPackageDir = (specifier) => {
2046
2060
  };
2047
2061
  var init_resolveAngularPackage = () => {};
2048
2062
 
2063
+ // src/utils/runtimeMode.ts
2064
+ var ENV_VAR = "NODE_ENV", isProductionRuntime = () => process.env[ENV_VAR] === "production", isDevelopmentRuntime = () => process.env[ENV_VAR] === "development";
2065
+
2049
2066
  // src/angular/angularPatch.ts
2050
2067
  var exports_angularPatch = {};
2051
2068
  __export(exports_angularPatch, {
@@ -2128,7 +2145,8 @@ var ensureHead = (doc) => {
2128
2145
  }
2129
2146
  layoutPatchApplied = true;
2130
2147
  }, applyPatches = async () => {
2131
- const { \u{275}DominoAdapter } = await import(resolveAngularRuntimePath("@angular/platform-server"));
2148
+ const spec = isProductionRuntime() ? resolveAngularRuntimePath("@angular/platform-server") : "@angular/platform-server";
2149
+ const { \u{275}DominoAdapter } = await import(spec);
2132
2150
  if (!\u{275}DominoAdapter?.prototype) {
2133
2151
  console.warn("[Angular Patch] \u0275DominoAdapter not found, skipping patches");
2134
2152
  return false;
@@ -2195,18 +2213,21 @@ var initDominoAdapter = (platformServer) => {
2195
2213
  console.error("Failed to initialize DominoAdapter:", err);
2196
2214
  }
2197
2215
  }, loadAngularDeps = async () => {
2198
- if (true) {
2199
- await import(resolveAngularRuntimePath("@angular/compiler"));
2216
+ if (!isProductionRuntime()) {
2217
+ await import("@angular/compiler");
2200
2218
  }
2201
2219
  const { applyPatches: applyPatches2 } = await Promise.resolve().then(() => (init_angularPatch(), exports_angularPatch));
2202
2220
  await applyPatches2();
2221
+ const useBareSpecifiers = !isProductionRuntime();
2203
2222
  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"))
2223
+ useBareSpecifiers ? import("@angular/platform-browser") : import(resolveAngularRuntimePath("@angular/platform-browser")),
2224
+ useBareSpecifiers ? import("@angular/platform-server") : import(resolveAngularRuntimePath("@angular/platform-server")),
2225
+ useBareSpecifiers ? import("@angular/common") : import(resolveAngularRuntimePath("@angular/common")),
2226
+ useBareSpecifiers ? import("@angular/core") : import(resolveAngularRuntimePath("@angular/core"))
2208
2227
  ]);
2209
- if (false) {}
2228
+ if (!isDevelopmentRuntime()) {
2229
+ core.enableProdMode();
2230
+ }
2210
2231
  initDominoAdapter(platformServer);
2211
2232
  return {
2212
2233
  APP_BASE_HREF: common.APP_BASE_HREF,
@@ -3765,5 +3786,5 @@ export {
3765
3786
  createTypedIsland
3766
3787
  };
3767
3788
 
3768
- //# debugId=B5BA84C66FADA6BA64756E2164756E21
3789
+ //# debugId=E4D8E2ADF4965B6964756E2164756E21
3769
3790
  //# sourceMappingURL=index.js.map