@absolutejs/absolute 0.19.0-beta.734 → 0.19.0-beta.736

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
@@ -42200,78 +42200,79 @@ var devVendorPaths = null, getDevVendorPaths = () => devVendorPaths, setDevVendo
42200
42200
  import { existsSync as existsSync13, mkdirSync as mkdirSync5, readFileSync as readFileSync9, writeFileSync as writeFileSync6 } from "fs";
42201
42201
  import { dirname as dirname8, join as join11, relative as relative5, resolve as resolve14 } from "path";
42202
42202
  import { createHash } from "crypto";
42203
- var CACHE_DIR, angularLinkerPlugin;
42204
- var init_angularLinkerPlugin = __esm(() => {
42205
- CACHE_DIR = resolve14(".absolutejs", "cache", "angular-linker");
42206
- angularLinkerPlugin = {
42207
- name: "angular-linker",
42208
- setup(bld) {
42209
- let needsLinking;
42210
- let babelTransform;
42211
- let linkerPlugin;
42212
- bld.onLoad({ filter: /[\\/]@angular[\\/].*\.m?js$/ }, async (args) => {
42213
- const source = await Bun.file(args.path).text();
42214
- if (!needsLinking) {
42215
- const specifier = "@angular/compiler-cli/linker";
42216
- const mod = await import(specifier);
42217
- ({ needsLinking } = mod);
42218
- }
42219
- const checkLink = needsLinking;
42220
- if (!checkLink || !checkLink(args.path, source)) {
42221
- return;
42222
- }
42223
- const hash = createHash("md5").update(source).digest("hex");
42224
- const cachePath = join11(CACHE_DIR, `${hash}.js`);
42225
- if (existsSync13(cachePath)) {
42226
- return {
42227
- contents: readFileSync9(cachePath, "utf-8"),
42228
- loader: "js"
42229
- };
42230
- }
42231
- if (!babelTransform) {
42232
- const babelSpecifier = "@babel/core";
42233
- const babel = await import(babelSpecifier);
42234
- babelTransform = babel.transformSync;
42235
- }
42236
- if (!linkerPlugin) {
42237
- const linkerSpecifier = "@angular/compiler-cli/linker/babel";
42238
- const mod = await import(linkerSpecifier);
42239
- linkerPlugin = mod.createEs2015LinkerPlugin({
42240
- fileSystem: {
42241
- dirname: dirname8,
42242
- exists: existsSync13,
42243
- readFile: readFileSync9,
42244
- relative: relative5,
42245
- resolve: resolve14
42246
- },
42247
- linkerJitMode: false,
42248
- logger: {
42249
- error: console.error,
42250
- level: 1,
42251
- warn: console.warn,
42252
- debug: () => {},
42253
- info: () => {}
42254
- }
42255
- });
42256
- }
42257
- const transform = babelTransform;
42258
- if (!transform) {
42259
- return { contents: source, loader: "js" };
42260
- }
42261
- const result = transform(source, {
42262
- compact: false,
42263
- filename: args.path,
42264
- filenameRelative: args.path,
42265
- plugins: [linkerPlugin],
42266
- sourceMaps: false
42203
+ var CACHE_ROOT, createAngularLinkerPlugin = (linkerJitMode) => ({
42204
+ name: "angular-linker",
42205
+ setup(bld) {
42206
+ let needsLinking;
42207
+ let babelTransform;
42208
+ let linkerPlugin;
42209
+ const cacheDir = join11(CACHE_ROOT, linkerJitMode ? "jit" : "aot");
42210
+ bld.onLoad({ filter: /[\\/]@angular[\\/].*\.m?js$/ }, async (args) => {
42211
+ const source = await Bun.file(args.path).text();
42212
+ if (!needsLinking) {
42213
+ const specifier = "@angular/compiler-cli/linker";
42214
+ const mod = await import(specifier);
42215
+ ({ needsLinking } = mod);
42216
+ }
42217
+ const checkLink = needsLinking;
42218
+ if (!checkLink || !checkLink(args.path, source)) {
42219
+ return;
42220
+ }
42221
+ const hash = createHash("md5").update(source).digest("hex");
42222
+ const cachePath = join11(cacheDir, `${hash}.js`);
42223
+ if (existsSync13(cachePath)) {
42224
+ return {
42225
+ contents: readFileSync9(cachePath, "utf-8"),
42226
+ loader: "js"
42227
+ };
42228
+ }
42229
+ if (!babelTransform) {
42230
+ const babelSpecifier = "@babel/core";
42231
+ const babel = await import(babelSpecifier);
42232
+ babelTransform = babel.transformSync;
42233
+ }
42234
+ if (!linkerPlugin) {
42235
+ const linkerSpecifier = "@angular/compiler-cli/linker/babel";
42236
+ const mod = await import(linkerSpecifier);
42237
+ linkerPlugin = mod.createEs2015LinkerPlugin({
42238
+ fileSystem: {
42239
+ dirname: dirname8,
42240
+ exists: existsSync13,
42241
+ readFile: readFileSync9,
42242
+ relative: relative5,
42243
+ resolve: resolve14
42244
+ },
42245
+ linkerJitMode,
42246
+ logger: {
42247
+ error: console.error,
42248
+ level: 1,
42249
+ warn: console.warn,
42250
+ debug: () => {},
42251
+ info: () => {}
42252
+ }
42267
42253
  });
42268
- const linked = result?.code ?? source;
42269
- mkdirSync5(CACHE_DIR, { recursive: true });
42270
- writeFileSync6(cachePath, linked, "utf-8");
42271
- return { contents: linked, loader: "js" };
42254
+ }
42255
+ const transform = babelTransform;
42256
+ if (!transform) {
42257
+ return { contents: source, loader: "js" };
42258
+ }
42259
+ const result = transform(source, {
42260
+ compact: false,
42261
+ filename: args.path,
42262
+ filenameRelative: args.path,
42263
+ plugins: [linkerPlugin],
42264
+ sourceMaps: false
42272
42265
  });
42273
- }
42274
- };
42266
+ const linked = result?.code ?? source;
42267
+ mkdirSync5(cacheDir, { recursive: true });
42268
+ writeFileSync6(cachePath, linked, "utf-8");
42269
+ return { contents: linked, loader: "js" };
42270
+ });
42271
+ }
42272
+ }), angularLinkerPlugin;
42273
+ var init_angularLinkerPlugin = __esm(() => {
42274
+ CACHE_ROOT = resolve14(".absolutejs", "cache", "angular-linker");
42275
+ angularLinkerPlugin = createAngularLinkerPlugin(false);
42275
42276
  });
42276
42277
 
42277
42278
  // src/utils/cleanStaleOutputs.ts
@@ -44432,6 +44433,11 @@ var propProviders = Object.entries(pageProps).map(function(entry) {
44432
44433
  var token = pageModule[toScreamingSnake(propName)];
44433
44434
  return isInjectionToken(token) ? { provide: token, useValue: propValue } : null;
44434
44435
  }).filter(Boolean);
44436
+ // Page-level providers, opt-in via \`export const providers = [...]\` in the
44437
+ // page module. Required so DI tokens that the component (or any service it
44438
+ // injects) needs are available client-side too \u2014 without these, services
44439
+ // that worked in SSR fail with NG0201 after hydration.
44440
+ var pageProviders = Array.isArray(pageModule.providers) ? pageModule.providers : [];
44435
44441
 
44436
44442
  // Re-Bootstrap HMR with View Transitions API
44437
44443
  if (window.__ANGULAR_APP__) {
@@ -44450,6 +44456,7 @@ if (!window.__HMR_SKIP_HYDRATION__ && !pageHasIslands) {
44450
44456
  providers.push(provideClientHydration());
44451
44457
  }
44452
44458
  delete window.__HMR_SKIP_HYDRATION__;
44459
+ providers.push.apply(providers, pageProviders);
44453
44460
  providers.push.apply(providers, propProviders);
44454
44461
  window.__ABS_SLOT_HYDRATION_PENDING__ = pageHasRawStreamingSlots;
44455
44462
 
@@ -44497,10 +44504,15 @@ var propProviders = Object.entries(pageProps).map(function(entry) {
44497
44504
  var token = pageModule[toScreamingSnake(propName)];
44498
44505
  return isInjectionToken(token) ? { provide: token, useValue: propValue } : null;
44499
44506
  }).filter(Boolean);
44507
+ // Page-level providers, opt-in via \`export const providers = [...]\` in the
44508
+ // page module. Required so DI tokens that the component (or any service it
44509
+ // injects) needs are available client-side too \u2014 without these, services
44510
+ // that worked in SSR fail with NG0201 after hydration.
44511
+ var pageProviders = Array.isArray(pageModule.providers) ? pageModule.providers : [];
44500
44512
 
44501
44513
  enableProdMode();
44502
44514
 
44503
- var providers = [provideZonelessChangeDetection()].concat(propProviders);
44515
+ var providers = [provideZonelessChangeDetection()].concat(pageProviders).concat(propProviders);
44504
44516
  if (!pageHasIslands) {
44505
44517
  providers.unshift(provideClientHydration());
44506
44518
  }
@@ -44766,7 +44778,7 @@ var REQUIRED_ANGULAR_SPECIFIERS, SERVER_ONLY_ANGULAR_SPECIFIERS, SCAN_SKIP_DIRS,
44766
44778
  angular.add(spec);
44767
44779
  await collectTransitiveAngularSpecs([...angular, ...transitiveRoots], angular);
44768
44780
  return Array.from(angular).filter(isResolvable2);
44769
- }, buildAngularVendor = async (buildDir, directories = []) => {
44781
+ }, buildAngularVendor = async (buildDir, directories = [], linkerJitMode = false) => {
44770
44782
  const vendorDir = join17(buildDir, "angular", "vendor");
44771
44783
  mkdirSync7(vendorDir, { recursive: true });
44772
44784
  const tmpDir = join17(buildDir, "_angular_vendor_tmp");
@@ -44784,7 +44796,7 @@ var REQUIRED_ANGULAR_SPECIFIERS, SERVER_ONLY_ANGULAR_SPECIFIERS, SCAN_SKIP_DIRS,
44784
44796
  minify: false,
44785
44797
  naming: "[name].[ext]",
44786
44798
  outdir: vendorDir,
44787
- plugins: [angularLinkerPlugin],
44799
+ plugins: [createAngularLinkerPlugin(linkerJitMode)],
44788
44800
  splitting: true,
44789
44801
  target: "browser",
44790
44802
  throw: false
@@ -45789,7 +45801,7 @@ ${content.slice(firstUseIdx)}`;
45789
45801
  outdir: buildPath,
45790
45802
  plugins: [
45791
45803
  stylePreprocessorPlugin2,
45792
- ...angularDir ? [angularLinkerPlugin] : [],
45804
+ ...angularDir ? [createAngularLinkerPlugin(hmr)] : [],
45793
45805
  ...htmlScriptPlugin ? [htmlScriptPlugin] : []
45794
45806
  ],
45795
45807
  root: clientRoot,
@@ -45808,7 +45820,7 @@ ${content.slice(firstUseIdx)}`;
45808
45820
  outdir: buildPath,
45809
45821
  plugins: [
45810
45822
  stylePreprocessorPlugin2,
45811
- ...angularDir ? [angularLinkerPlugin] : []
45823
+ ...angularDir ? [createAngularLinkerPlugin(hmr)] : []
45812
45824
  ],
45813
45825
  root: islandEntryResult.generatedRoot,
45814
45826
  splitting: !isDev2,
@@ -49832,7 +49844,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
49832
49844
  const { buildDepVendor: buildDepVendor2 } = await Promise.resolve().then(() => (init_buildDepVendor(), exports_buildDepVendor));
49833
49845
  const [, angularSpecs, , , depPaths] = await Promise.all([
49834
49846
  config.reactDirectory ? buildReactVendor(state.resolvedPaths.buildDir) : Promise.resolve(undefined),
49835
- config.angularDirectory ? buildAngularVendor(state.resolvedPaths.buildDir, sourceDirs) : Promise.resolve(undefined),
49847
+ config.angularDirectory ? buildAngularVendor(state.resolvedPaths.buildDir, sourceDirs, true) : Promise.resolve(undefined),
49836
49848
  config.svelteDirectory ? buildSvelteVendor(state.resolvedPaths.buildDir) : Promise.resolve(undefined),
49837
49849
  config.vueDirectory ? buildVueVendor(state.resolvedPaths.buildDir) : Promise.resolve(undefined),
49838
49850
  buildDepVendor2(state.resolvedPaths.buildDir, sourceDirs)
@@ -58314,5 +58326,5 @@ export {
58314
58326
  ANGULAR_INIT_TIMEOUT_MS
58315
58327
  };
58316
58328
 
58317
- //# debugId=C4C031E905AA4A0E64756E2164756E21
58329
+ //# debugId=2561B31C4102BB4864756E2164756E21
58318
58330
  //# sourceMappingURL=index.js.map