@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/build.js CHANGED
@@ -41931,78 +41931,79 @@ var devVendorPaths = null, getDevVendorPaths = () => devVendorPaths, setDevVendo
41931
41931
  import { existsSync as existsSync13, mkdirSync as mkdirSync5, readFileSync as readFileSync8, writeFileSync as writeFileSync6 } from "fs";
41932
41932
  import { dirname as dirname7, join as join11, relative as relative5, resolve as resolve11 } from "path";
41933
41933
  import { createHash } from "crypto";
41934
- var CACHE_DIR, angularLinkerPlugin;
41935
- var init_angularLinkerPlugin = __esm(() => {
41936
- CACHE_DIR = resolve11(".absolutejs", "cache", "angular-linker");
41937
- angularLinkerPlugin = {
41938
- name: "angular-linker",
41939
- setup(bld) {
41940
- let needsLinking;
41941
- let babelTransform;
41942
- let linkerPlugin;
41943
- bld.onLoad({ filter: /[\\/]@angular[\\/].*\.m?js$/ }, async (args) => {
41944
- const source = await Bun.file(args.path).text();
41945
- if (!needsLinking) {
41946
- const specifier = "@angular/compiler-cli/linker";
41947
- const mod = await import(specifier);
41948
- ({ needsLinking } = mod);
41949
- }
41950
- const checkLink = needsLinking;
41951
- if (!checkLink || !checkLink(args.path, source)) {
41952
- return;
41953
- }
41954
- const hash = createHash("md5").update(source).digest("hex");
41955
- const cachePath = join11(CACHE_DIR, `${hash}.js`);
41956
- if (existsSync13(cachePath)) {
41957
- return {
41958
- contents: readFileSync8(cachePath, "utf-8"),
41959
- loader: "js"
41960
- };
41961
- }
41962
- if (!babelTransform) {
41963
- const babelSpecifier = "@babel/core";
41964
- const babel = await import(babelSpecifier);
41965
- babelTransform = babel.transformSync;
41966
- }
41967
- if (!linkerPlugin) {
41968
- const linkerSpecifier = "@angular/compiler-cli/linker/babel";
41969
- const mod = await import(linkerSpecifier);
41970
- linkerPlugin = mod.createEs2015LinkerPlugin({
41971
- fileSystem: {
41972
- dirname: dirname7,
41973
- exists: existsSync13,
41974
- readFile: readFileSync8,
41975
- relative: relative5,
41976
- resolve: resolve11
41977
- },
41978
- linkerJitMode: false,
41979
- logger: {
41980
- error: console.error,
41981
- level: 1,
41982
- warn: console.warn,
41983
- debug: () => {},
41984
- info: () => {}
41985
- }
41986
- });
41987
- }
41988
- const transform = babelTransform;
41989
- if (!transform) {
41990
- return { contents: source, loader: "js" };
41991
- }
41992
- const result = transform(source, {
41993
- compact: false,
41994
- filename: args.path,
41995
- filenameRelative: args.path,
41996
- plugins: [linkerPlugin],
41997
- sourceMaps: false
41934
+ var CACHE_ROOT, createAngularLinkerPlugin = (linkerJitMode) => ({
41935
+ name: "angular-linker",
41936
+ setup(bld) {
41937
+ let needsLinking;
41938
+ let babelTransform;
41939
+ let linkerPlugin;
41940
+ const cacheDir = join11(CACHE_ROOT, linkerJitMode ? "jit" : "aot");
41941
+ bld.onLoad({ filter: /[\\/]@angular[\\/].*\.m?js$/ }, async (args) => {
41942
+ const source = await Bun.file(args.path).text();
41943
+ if (!needsLinking) {
41944
+ const specifier = "@angular/compiler-cli/linker";
41945
+ const mod = await import(specifier);
41946
+ ({ needsLinking } = mod);
41947
+ }
41948
+ const checkLink = needsLinking;
41949
+ if (!checkLink || !checkLink(args.path, source)) {
41950
+ return;
41951
+ }
41952
+ const hash = createHash("md5").update(source).digest("hex");
41953
+ const cachePath = join11(cacheDir, `${hash}.js`);
41954
+ if (existsSync13(cachePath)) {
41955
+ return {
41956
+ contents: readFileSync8(cachePath, "utf-8"),
41957
+ loader: "js"
41958
+ };
41959
+ }
41960
+ if (!babelTransform) {
41961
+ const babelSpecifier = "@babel/core";
41962
+ const babel = await import(babelSpecifier);
41963
+ babelTransform = babel.transformSync;
41964
+ }
41965
+ if (!linkerPlugin) {
41966
+ const linkerSpecifier = "@angular/compiler-cli/linker/babel";
41967
+ const mod = await import(linkerSpecifier);
41968
+ linkerPlugin = mod.createEs2015LinkerPlugin({
41969
+ fileSystem: {
41970
+ dirname: dirname7,
41971
+ exists: existsSync13,
41972
+ readFile: readFileSync8,
41973
+ relative: relative5,
41974
+ resolve: resolve11
41975
+ },
41976
+ linkerJitMode,
41977
+ logger: {
41978
+ error: console.error,
41979
+ level: 1,
41980
+ warn: console.warn,
41981
+ debug: () => {},
41982
+ info: () => {}
41983
+ }
41998
41984
  });
41999
- const linked = result?.code ?? source;
42000
- mkdirSync5(CACHE_DIR, { recursive: true });
42001
- writeFileSync6(cachePath, linked, "utf-8");
42002
- return { contents: linked, loader: "js" };
41985
+ }
41986
+ const transform = babelTransform;
41987
+ if (!transform) {
41988
+ return { contents: source, loader: "js" };
41989
+ }
41990
+ const result = transform(source, {
41991
+ compact: false,
41992
+ filename: args.path,
41993
+ filenameRelative: args.path,
41994
+ plugins: [linkerPlugin],
41995
+ sourceMaps: false
42003
41996
  });
42004
- }
42005
- };
41997
+ const linked = result?.code ?? source;
41998
+ mkdirSync5(cacheDir, { recursive: true });
41999
+ writeFileSync6(cachePath, linked, "utf-8");
42000
+ return { contents: linked, loader: "js" };
42001
+ });
42002
+ }
42003
+ }), angularLinkerPlugin;
42004
+ var init_angularLinkerPlugin = __esm(() => {
42005
+ CACHE_ROOT = resolve11(".absolutejs", "cache", "angular-linker");
42006
+ angularLinkerPlugin = createAngularLinkerPlugin(false);
42006
42007
  });
42007
42008
 
42008
42009
  // src/utils/cleanStaleOutputs.ts
@@ -44240,6 +44241,11 @@ var propProviders = Object.entries(pageProps).map(function(entry) {
44240
44241
  var token = pageModule[toScreamingSnake(propName)];
44241
44242
  return isInjectionToken(token) ? { provide: token, useValue: propValue } : null;
44242
44243
  }).filter(Boolean);
44244
+ // Page-level providers, opt-in via \`export const providers = [...]\` in the
44245
+ // page module. Required so DI tokens that the component (or any service it
44246
+ // injects) needs are available client-side too \u2014 without these, services
44247
+ // that worked in SSR fail with NG0201 after hydration.
44248
+ var pageProviders = Array.isArray(pageModule.providers) ? pageModule.providers : [];
44243
44249
 
44244
44250
  // Re-Bootstrap HMR with View Transitions API
44245
44251
  if (window.__ANGULAR_APP__) {
@@ -44258,6 +44264,7 @@ if (!window.__HMR_SKIP_HYDRATION__ && !pageHasIslands) {
44258
44264
  providers.push(provideClientHydration());
44259
44265
  }
44260
44266
  delete window.__HMR_SKIP_HYDRATION__;
44267
+ providers.push.apply(providers, pageProviders);
44261
44268
  providers.push.apply(providers, propProviders);
44262
44269
  window.__ABS_SLOT_HYDRATION_PENDING__ = pageHasRawStreamingSlots;
44263
44270
 
@@ -44305,10 +44312,15 @@ var propProviders = Object.entries(pageProps).map(function(entry) {
44305
44312
  var token = pageModule[toScreamingSnake(propName)];
44306
44313
  return isInjectionToken(token) ? { provide: token, useValue: propValue } : null;
44307
44314
  }).filter(Boolean);
44315
+ // Page-level providers, opt-in via \`export const providers = [...]\` in the
44316
+ // page module. Required so DI tokens that the component (or any service it
44317
+ // injects) needs are available client-side too \u2014 without these, services
44318
+ // that worked in SSR fail with NG0201 after hydration.
44319
+ var pageProviders = Array.isArray(pageModule.providers) ? pageModule.providers : [];
44308
44320
 
44309
44321
  enableProdMode();
44310
44322
 
44311
- var providers = [provideZonelessChangeDetection()].concat(propProviders);
44323
+ var providers = [provideZonelessChangeDetection()].concat(pageProviders).concat(propProviders);
44312
44324
  if (!pageHasIslands) {
44313
44325
  providers.unshift(provideClientHydration());
44314
44326
  }
@@ -44574,7 +44586,7 @@ var REQUIRED_ANGULAR_SPECIFIERS, SERVER_ONLY_ANGULAR_SPECIFIERS, SCAN_SKIP_DIRS,
44574
44586
  angular.add(spec);
44575
44587
  await collectTransitiveAngularSpecs([...angular, ...transitiveRoots], angular);
44576
44588
  return Array.from(angular).filter(isResolvable2);
44577
- }, buildAngularVendor = async (buildDir, directories = []) => {
44589
+ }, buildAngularVendor = async (buildDir, directories = [], linkerJitMode = false) => {
44578
44590
  const vendorDir = join17(buildDir, "angular", "vendor");
44579
44591
  mkdirSync7(vendorDir, { recursive: true });
44580
44592
  const tmpDir = join17(buildDir, "_angular_vendor_tmp");
@@ -44592,7 +44604,7 @@ var REQUIRED_ANGULAR_SPECIFIERS, SERVER_ONLY_ANGULAR_SPECIFIERS, SCAN_SKIP_DIRS,
44592
44604
  minify: false,
44593
44605
  naming: "[name].[ext]",
44594
44606
  outdir: vendorDir,
44595
- plugins: [angularLinkerPlugin],
44607
+ plugins: [createAngularLinkerPlugin(linkerJitMode)],
44596
44608
  splitting: true,
44597
44609
  target: "browser",
44598
44610
  throw: false
@@ -45597,7 +45609,7 @@ ${content.slice(firstUseIdx)}`;
45597
45609
  outdir: buildPath,
45598
45610
  plugins: [
45599
45611
  stylePreprocessorPlugin2,
45600
- ...angularDir ? [angularLinkerPlugin] : [],
45612
+ ...angularDir ? [createAngularLinkerPlugin(hmr)] : [],
45601
45613
  ...htmlScriptPlugin ? [htmlScriptPlugin] : []
45602
45614
  ],
45603
45615
  root: clientRoot,
@@ -45616,7 +45628,7 @@ ${content.slice(firstUseIdx)}`;
45616
45628
  outdir: buildPath,
45617
45629
  plugins: [
45618
45630
  stylePreprocessorPlugin2,
45619
- ...angularDir ? [angularLinkerPlugin] : []
45631
+ ...angularDir ? [createAngularLinkerPlugin(hmr)] : []
45620
45632
  ],
45621
45633
  root: islandEntryResult.generatedRoot,
45622
45634
  splitting: !isDev,
@@ -49755,7 +49767,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
49755
49767
  const { buildDepVendor: buildDepVendor2 } = await Promise.resolve().then(() => (init_buildDepVendor(), exports_buildDepVendor));
49756
49768
  const [, angularSpecs, , , depPaths] = await Promise.all([
49757
49769
  config.reactDirectory ? buildReactVendor(state.resolvedPaths.buildDir) : Promise.resolve(undefined),
49758
- config.angularDirectory ? buildAngularVendor(state.resolvedPaths.buildDir, sourceDirs) : Promise.resolve(undefined),
49770
+ config.angularDirectory ? buildAngularVendor(state.resolvedPaths.buildDir, sourceDirs, true) : Promise.resolve(undefined),
49759
49771
  config.svelteDirectory ? buildSvelteVendor(state.resolvedPaths.buildDir) : Promise.resolve(undefined),
49760
49772
  config.vueDirectory ? buildVueVendor(state.resolvedPaths.buildDir) : Promise.resolve(undefined),
49761
49773
  buildDepVendor2(state.resolvedPaths.buildDir, sourceDirs)
@@ -49854,5 +49866,5 @@ export {
49854
49866
  build
49855
49867
  };
49856
49868
 
49857
- //# debugId=1D72847973D2433A64756E2164756E21
49869
+ //# debugId=762BA503FA6E78FB64756E2164756E21
49858
49870
  //# sourceMappingURL=build.js.map