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

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
@@ -12283,16 +12283,17 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
12283
12283
  ].join(", ")}`);
12284
12284
  }
12285
12285
  const original = await traceAngularPhase("wrapper/read-server-output", () => fs.readFile(rawServerFile, "utf-8"), { entry: resolvedEntry });
12286
- const detectExportedComponentClass = (source, fallback) => {
12286
+ const detectExportedComponentClass = (source) => {
12287
12287
  const defaultMatch = source.match(/export\s+default\s+([A-Za-z_$][\w$]*)\s*;/);
12288
12288
  if (defaultMatch)
12289
12289
  return defaultMatch[1];
12290
12290
  const exportClassMatch = source.match(/export\s+(?:default\s+)?class\s+([A-Za-z_$][\w$]*)/);
12291
12291
  if (exportClassMatch)
12292
12292
  return exportClassMatch[1];
12293
- return fallback;
12293
+ return null;
12294
12294
  };
12295
- const componentClassName = await traceAngularPhase("wrapper/detect-component-class", () => detectExportedComponentClass(original, `${toPascal(fileBase)}Component`), { entry: resolvedEntry });
12295
+ const detectedClassName = await traceAngularPhase("wrapper/detect-component-class", () => detectExportedComponentClass(original), { entry: resolvedEntry });
12296
+ const componentClassName = detectedClassName ?? `${toPascal(fileBase)}Component`;
12296
12297
  const usesLegacyAnimations = await traceAngularPhase("wrapper/detect-legacy-animations", () => usesLegacyAngularAnimations(resolvedEntry), { entry: resolvedEntry });
12297
12298
  const serverContentHash = Bun.hash(original).toString(BASE_36_RADIX);
12298
12299
  const cachedWrapper = wrapperOutputCache.get(resolvedEntry);
@@ -12312,7 +12313,7 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
12312
12313
  ${rewritten}`;
12313
12314
  }
12314
12315
  rewritten = rewritten.replace(new RegExp(`templateUrl:\\s*['"]\\.\\/${fileBase}\\.html['"]`), `templateUrl: '../../pages/${fileBase}.html'`);
12315
- if (!rewritten.includes("export default")) {
12316
+ if (detectedClassName && !rewritten.includes("export default")) {
12316
12317
  rewritten += `
12317
12318
  export default ${componentClassName};
12318
12319
  `;
@@ -18954,18 +18955,51 @@ var toSafeFileName6 = (specifier) => {
18954
18955
  }));
18955
18956
  const isPrefixOrEqual = (candidate, current) => current === candidate || current.startsWith(`${candidate}/`);
18956
18957
  const otherSpecsFor = (current) => specifiers.filter((spec) => !isPrefixOrEqual(spec, current));
18957
- const results = await Promise.all(entries.map(({ entryPath, specifier }) => bunBuild9({
18958
- entrypoints: [entryPath],
18959
- external: [...FRAMEWORK_EXTERNALS, ...otherSpecsFor(specifier)],
18960
- format: "esm",
18961
- minify: false,
18962
- naming: "[name].[ext]",
18963
- outdir: vendorDir,
18964
- plugins: [createStripPureAnnotationsPlugin()],
18965
- splitting: false,
18966
- target: "browser",
18967
- throw: false
18968
- })));
18958
+ const REQUIRE_CALL_RE = /__require\(\s*["']([^"']+)["']\s*\)/g;
18959
+ const MAX_INLINE_PASSES = 4;
18960
+ const buildEntryWithCjsRequireResolution = async (entryPath, specifier) => {
18961
+ const baseExternals = [
18962
+ ...FRAMEWORK_EXTERNALS,
18963
+ ...otherSpecsFor(specifier)
18964
+ ];
18965
+ const externalsSet = new Set(baseExternals);
18966
+ let lastResult = null;
18967
+ for (let pass = 0;pass < MAX_INLINE_PASSES; pass++) {
18968
+ lastResult = await bunBuild9({
18969
+ entrypoints: [entryPath],
18970
+ external: [...externalsSet],
18971
+ format: "esm",
18972
+ minify: false,
18973
+ naming: "[name].[ext]",
18974
+ outdir: vendorDir,
18975
+ plugins: [createStripPureAnnotationsPlugin()],
18976
+ splitting: false,
18977
+ target: "browser",
18978
+ throw: false
18979
+ });
18980
+ if (!lastResult.success)
18981
+ return lastResult;
18982
+ const output = lastResult.outputs[0];
18983
+ if (!output)
18984
+ return lastResult;
18985
+ const text = await output.text();
18986
+ REQUIRE_CALL_RE.lastIndex = 0;
18987
+ const requiredSpecs = new Set;
18988
+ let match;
18989
+ while ((match = REQUIRE_CALL_RE.exec(text)) !== null) {
18990
+ const requiredSpec = match[1];
18991
+ if (requiredSpec && externalsSet.has(requiredSpec)) {
18992
+ requiredSpecs.add(requiredSpec);
18993
+ }
18994
+ }
18995
+ if (requiredSpecs.size === 0)
18996
+ return lastResult;
18997
+ for (const spec of requiredSpecs)
18998
+ externalsSet.delete(spec);
18999
+ }
19000
+ return lastResult;
19001
+ };
19002
+ const results = await Promise.all(entries.map(({ entryPath, specifier }) => buildEntryWithCjsRequireResolution(entryPath, specifier)));
18969
19003
  const aggregated = {
18970
19004
  success: results.every((result) => result.success),
18971
19005
  logs: results.flatMap((result) => result.logs),
@@ -27947,5 +27981,5 @@ export {
27947
27981
  ANGULAR_INIT_TIMEOUT_MS
27948
27982
  };
27949
27983
 
27950
- //# debugId=C86F0B52E78282DE64756E2164756E21
27984
+ //# debugId=04E6614BD238791664756E2164756E21
27951
27985
  //# sourceMappingURL=index.js.map