@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/index.js CHANGED
@@ -12016,7 +12016,7 @@ var buildModuleSpecifier = (importSpec, outputPath) => {
12016
12016
  }
12017
12017
  return lines.join(`
12018
12018
  `);
12019
- }, ROUTER_FEATURES_DEFAULT, renderFile = (call, outputPath, basePath, pageRoutes) => {
12019
+ }, ROUTER_FEATURES_DEFAULT, renderFile = (call, outputPath, basePath, pageRoutes, globalProvidersAbsPath) => {
12020
12020
  const sections = [];
12021
12021
  sections.push("/* AUTOGENERATED by AbsoluteJS \u2014 see `scanAngularHandlerCalls`. */", "/* eslint-disable */");
12022
12022
  const groups = groupImports(call.providerImports);
@@ -12025,6 +12025,13 @@ var buildModuleSpecifier = (importSpec, outputPath) => {
12025
12025
  sections.push(renderImportGroup(group, outputPath));
12026
12026
  }
12027
12027
  }
12028
+ if (globalProvidersAbsPath) {
12029
+ const outputDir = dirname13(outputPath);
12030
+ const rel = relative10(outputDir, globalProvidersAbsPath).replace(/\\/g, "/");
12031
+ const withoutExt = rel.replace(/\.[cm]?[tj]sx?$/, "");
12032
+ const specifier = withoutExt.startsWith(".") ? withoutExt : `./${withoutExt}`;
12033
+ sections.push(`import { appProviders as __globalProviders } from "${specifier}";`);
12034
+ }
12028
12035
  if (basePath !== null) {
12029
12036
  sections.push(`import { APP_BASE_HREF } from "@angular/common";`, `const __basePathProvider = { provide: APP_BASE_HREF, useValue: ${JSON.stringify(basePath)} };`);
12030
12037
  }
@@ -12032,13 +12039,17 @@ var buildModuleSpecifier = (importSpec, outputPath) => {
12032
12039
  const routesImport = relativeRoutesImport(dirname13(outputPath), pageRoutes.pageFile);
12033
12040
  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(", ")});`);
12034
12041
  }
12035
- const userProviders = call.providersExpr ?? "[]";
12036
- const extras = [];
12042
+ const userProvidersExpr = call.providersExpr ?? "[]";
12043
+ const fragments = [];
12044
+ if (globalProvidersAbsPath)
12045
+ fragments.push("...__globalProviders");
12046
+ if (call.providersExpr !== null)
12047
+ fragments.push(`...(${userProvidersExpr})`);
12037
12048
  if (pageRoutes?.hasRoutes)
12038
- extras.push("__routerProvider");
12049
+ fragments.push("__routerProvider");
12039
12050
  if (basePath !== null)
12040
- extras.push("__basePathProvider");
12041
- const exportExpr = extras.length === 0 ? userProviders : `[...(${userProviders}), ${extras.join(", ")}]`;
12051
+ fragments.push("__basePathProvider");
12052
+ const exportExpr = fragments.length === 0 ? "[]" : `[${fragments.join(", ")}]`;
12042
12053
  sections.push(`export const providers = ${exportExpr};`);
12043
12054
  return sections.join(`
12044
12055
 
@@ -12051,7 +12062,7 @@ var buildModuleSpecifier = (importSpec, outputPath) => {
12051
12062
  return null;
12052
12063
  const trimmed = mountPath.slice(0, -1);
12053
12064
  return trimmed === "/" ? null : trimmed;
12054
- }, emitAngularProvidersFiles = (projectRoot, calls, pageRoutes) => {
12065
+ }, emitAngularProvidersFiles = (projectRoot, calls, pageRoutes, options = {}) => {
12055
12066
  const outputDir = getProvidersOutputDir(projectRoot);
12056
12067
  mkdirSync8(outputDir, { recursive: true });
12057
12068
  const pageRoutesByKey = new Map;
@@ -12063,7 +12074,7 @@ var buildModuleSpecifier = (importSpec, outputPath) => {
12063
12074
  const outputPath = join24(outputDir, `${call.manifestKey}.providers.ts`);
12064
12075
  const basePath = deriveBasePath(call.mountPath);
12065
12076
  const pageRoute = pageRoutesByKey.get(call.manifestKey);
12066
- const content = renderFile(call, outputPath, basePath, pageRoute);
12077
+ const content = renderFile(call, outputPath, basePath, pageRoute, options.providersImport ? resolveProvidersImport(projectRoot, options.providersImport) : null);
12067
12078
  writeFileSync8(outputPath, content, "utf-8");
12068
12079
  emitted.push({
12069
12080
  basePath,
@@ -12073,6 +12084,11 @@ var buildModuleSpecifier = (importSpec, outputPath) => {
12073
12084
  });
12074
12085
  }
12075
12086
  return emitted;
12087
+ }, resolveProvidersImport = (projectRoot, providersImport) => {
12088
+ if (providersImport.startsWith(".")) {
12089
+ return join24(projectRoot, providersImport);
12090
+ }
12091
+ return providersImport;
12076
12092
  }, getProvidersOutputDir = (projectRoot) => join24(getFrameworkGeneratedDir("angular", projectRoot), "providers");
12077
12093
  var init_emitAngularProvidersFiles = __esm(() => {
12078
12094
  init_generatedDir();
@@ -12382,10 +12398,10 @@ var exports_runAngularHandlerScan = {};
12382
12398
  __export(exports_runAngularHandlerScan, {
12383
12399
  runAngularHandlerScan: () => runAngularHandlerScan
12384
12400
  });
12385
- var runAngularHandlerScan = (projectRoot, angularDirectory) => {
12401
+ var runAngularHandlerScan = (projectRoot, angularDirectory, options = {}) => {
12386
12402
  const calls = scanAngularHandlerCalls(projectRoot);
12387
12403
  const pageRoutes = scanAngularPageRoutes(angularDirectory);
12388
- const providersFiles = emitAngularProvidersFiles(projectRoot, calls, pageRoutes);
12404
+ const providersFiles = emitAngularProvidersFiles(projectRoot, calls, pageRoutes, options);
12389
12405
  emitAngularRouteMounts(projectRoot, calls);
12390
12406
  return {
12391
12407
  calls,
@@ -19836,6 +19852,7 @@ ${content.slice(firstUseIdx)}`;
19836
19852
  htmlDirectory,
19837
19853
  htmxDirectory,
19838
19854
  angularDirectory,
19855
+ angular,
19839
19856
  emberDirectory,
19840
19857
  svelteDirectory,
19841
19858
  vueDirectory,
@@ -20222,7 +20239,9 @@ ${content.slice(firstUseIdx)}`;
20222
20239
  if (shouldCompileAngular && angularDir) {
20223
20240
  await tracePhase("scan/angular-handlers", async () => {
20224
20241
  const { runAngularHandlerScan: runAngularHandlerScan2 } = await Promise.resolve().then(() => (init_runAngularHandlerScan(), exports_runAngularHandlerScan));
20225
- runAngularHandlerScan2(projectRoot, angularDir);
20242
+ runAngularHandlerScan2(projectRoot, angularDir, {
20243
+ providersImport: angular?.providersImport
20244
+ });
20226
20245
  });
20227
20246
  }
20228
20247
  const [
@@ -35512,5 +35531,5 @@ export {
35512
35531
  ANGULAR_INIT_TIMEOUT_MS
35513
35532
  };
35514
35533
 
35515
- //# debugId=53D6A9BEFCFCD6FB64756E2164756E21
35534
+ //# debugId=78BDAF9977AB738E64756E2164756E21
35516
35535
  //# sourceMappingURL=index.js.map