@absolutejs/absolute 0.19.0-beta.970 → 0.19.0-beta.971

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
@@ -11713,7 +11713,7 @@ var buildModuleSpecifier = (importSpec, outputPath) => {
11713
11713
  }
11714
11714
  return lines.join(`
11715
11715
  `);
11716
- }, ROUTER_FEATURES_DEFAULT, renderFile = (call, outputPath, basePath, pageRoutes) => {
11716
+ }, ROUTER_FEATURES_DEFAULT, renderFile = (call, outputPath, basePath, pageRoutes, globalProvidersAbsPath) => {
11717
11717
  const sections = [];
11718
11718
  sections.push("/* AUTOGENERATED by AbsoluteJS \u2014 see `scanAngularHandlerCalls`. */", "/* eslint-disable */");
11719
11719
  const groups = groupImports(call.providerImports);
@@ -11722,6 +11722,13 @@ var buildModuleSpecifier = (importSpec, outputPath) => {
11722
11722
  sections.push(renderImportGroup(group, outputPath));
11723
11723
  }
11724
11724
  }
11725
+ if (globalProvidersAbsPath) {
11726
+ const outputDir = dirname11(outputPath);
11727
+ const rel = relative10(outputDir, globalProvidersAbsPath).replace(/\\/g, "/");
11728
+ const withoutExt = rel.replace(/\.[cm]?[tj]sx?$/, "");
11729
+ const specifier = withoutExt.startsWith(".") ? withoutExt : `./${withoutExt}`;
11730
+ sections.push(`import { appProviders as __globalProviders } from "${specifier}";`);
11731
+ }
11725
11732
  if (basePath !== null) {
11726
11733
  sections.push(`import { APP_BASE_HREF } from "@angular/common";`, `const __basePathProvider = { provide: APP_BASE_HREF, useValue: ${JSON.stringify(basePath)} };`);
11727
11734
  }
@@ -11729,13 +11736,17 @@ var buildModuleSpecifier = (importSpec, outputPath) => {
11729
11736
  const routesImport = relativeRoutesImport(dirname11(outputPath), pageRoutes.pageFile);
11730
11737
  sections.push(`import { ${["provideRouter", ...ROUTER_FEATURES_DEFAULT].join(", ")} } from "@angular/router";`, `import { routes as __pageRoutes } from "${routesImport}";`, `const __routerProvider = provideRouter(__pageRoutes, ${ROUTER_FEATURES_DEFAULT.map((name) => `${name}()`).join(", ")});`);
11731
11738
  }
11732
- const userProviders = call.providersExpr ?? "[]";
11733
- const extras = [];
11739
+ const userProvidersExpr = call.providersExpr ?? "[]";
11740
+ const fragments = [];
11741
+ if (globalProvidersAbsPath)
11742
+ fragments.push("...__globalProviders");
11743
+ if (call.providersExpr !== null)
11744
+ fragments.push(`...(${userProvidersExpr})`);
11734
11745
  if (pageRoutes?.hasRoutes)
11735
- extras.push("__routerProvider");
11746
+ fragments.push("__routerProvider");
11736
11747
  if (basePath !== null)
11737
- extras.push("__basePathProvider");
11738
- const exportExpr = extras.length === 0 ? userProviders : `[...(${userProviders}), ${extras.join(", ")}]`;
11748
+ fragments.push("__basePathProvider");
11749
+ const exportExpr = fragments.length === 0 ? "[]" : `[${fragments.join(", ")}]`;
11739
11750
  sections.push(`export const providers = ${exportExpr};`);
11740
11751
  return sections.join(`
11741
11752
 
@@ -11748,7 +11759,7 @@ var buildModuleSpecifier = (importSpec, outputPath) => {
11748
11759
  return null;
11749
11760
  const trimmed = mountPath.slice(0, -1);
11750
11761
  return trimmed === "/" ? null : trimmed;
11751
- }, emitAngularProvidersFiles = (projectRoot, calls, pageRoutes) => {
11762
+ }, emitAngularProvidersFiles = (projectRoot, calls, pageRoutes, options = {}) => {
11752
11763
  const outputDir = getProvidersOutputDir(projectRoot);
11753
11764
  mkdirSync8(outputDir, { recursive: true });
11754
11765
  const pageRoutesByKey = new Map;
@@ -11760,7 +11771,7 @@ var buildModuleSpecifier = (importSpec, outputPath) => {
11760
11771
  const outputPath = join23(outputDir, `${call.manifestKey}.providers.ts`);
11761
11772
  const basePath = deriveBasePath(call.mountPath);
11762
11773
  const pageRoute = pageRoutesByKey.get(call.manifestKey);
11763
- const content = renderFile(call, outputPath, basePath, pageRoute);
11774
+ const content = renderFile(call, outputPath, basePath, pageRoute, options.providersImport ? resolveProvidersImport(projectRoot, options.providersImport) : null);
11764
11775
  writeFileSync7(outputPath, content, "utf-8");
11765
11776
  emitted.push({
11766
11777
  basePath,
@@ -11770,6 +11781,11 @@ var buildModuleSpecifier = (importSpec, outputPath) => {
11770
11781
  });
11771
11782
  }
11772
11783
  return emitted;
11784
+ }, resolveProvidersImport = (projectRoot, providersImport) => {
11785
+ if (providersImport.startsWith(".")) {
11786
+ return join23(projectRoot, providersImport);
11787
+ }
11788
+ return providersImport;
11773
11789
  }, getProvidersOutputDir = (projectRoot) => join23(getFrameworkGeneratedDir("angular", projectRoot), "providers");
11774
11790
  var init_emitAngularProvidersFiles = __esm(() => {
11775
11791
  init_generatedDir();
@@ -12079,10 +12095,10 @@ var exports_runAngularHandlerScan = {};
12079
12095
  __export(exports_runAngularHandlerScan, {
12080
12096
  runAngularHandlerScan: () => runAngularHandlerScan
12081
12097
  });
12082
- var runAngularHandlerScan = (projectRoot, angularDirectory) => {
12098
+ var runAngularHandlerScan = (projectRoot, angularDirectory, options = {}) => {
12083
12099
  const calls = scanAngularHandlerCalls(projectRoot);
12084
12100
  const pageRoutes = scanAngularPageRoutes(angularDirectory);
12085
- const providersFiles = emitAngularProvidersFiles(projectRoot, calls, pageRoutes);
12101
+ const providersFiles = emitAngularProvidersFiles(projectRoot, calls, pageRoutes, options);
12086
12102
  emitAngularRouteMounts(projectRoot, calls);
12087
12103
  return {
12088
12104
  calls,
@@ -19610,6 +19626,7 @@ ${content.slice(firstUseIdx)}`;
19610
19626
  htmlDirectory,
19611
19627
  htmxDirectory,
19612
19628
  angularDirectory,
19629
+ angular,
19613
19630
  emberDirectory,
19614
19631
  svelteDirectory,
19615
19632
  vueDirectory,
@@ -19996,7 +20013,9 @@ ${content.slice(firstUseIdx)}`;
19996
20013
  if (shouldCompileAngular && angularDir) {
19997
20014
  await tracePhase("scan/angular-handlers", async () => {
19998
20015
  const { runAngularHandlerScan: runAngularHandlerScan2 } = await Promise.resolve().then(() => (init_runAngularHandlerScan(), exports_runAngularHandlerScan));
19999
- runAngularHandlerScan2(projectRoot, angularDir);
20016
+ runAngularHandlerScan2(projectRoot, angularDir, {
20017
+ providersImport: angular?.providersImport
20018
+ });
20000
20019
  });
20001
20020
  }
20002
20021
  const [
@@ -26854,5 +26873,5 @@ export {
26854
26873
  build
26855
26874
  };
26856
26875
 
26857
- //# debugId=3A9DA44EB04713C964756E2164756E21
26876
+ //# debugId=B1D8AE4638C1504B64756E2164756E21
26858
26877
  //# sourceMappingURL=build.js.map