@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/build.js CHANGED
@@ -12089,16 +12089,17 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
12089
12089
  ].join(", ")}`);
12090
12090
  }
12091
12091
  const original = await traceAngularPhase("wrapper/read-server-output", () => fs.readFile(rawServerFile, "utf-8"), { entry: resolvedEntry });
12092
- const detectExportedComponentClass = (source, fallback) => {
12092
+ const detectExportedComponentClass = (source) => {
12093
12093
  const defaultMatch = source.match(/export\s+default\s+([A-Za-z_$][\w$]*)\s*;/);
12094
12094
  if (defaultMatch)
12095
12095
  return defaultMatch[1];
12096
12096
  const exportClassMatch = source.match(/export\s+(?:default\s+)?class\s+([A-Za-z_$][\w$]*)/);
12097
12097
  if (exportClassMatch)
12098
12098
  return exportClassMatch[1];
12099
- return fallback;
12099
+ return null;
12100
12100
  };
12101
- const componentClassName = await traceAngularPhase("wrapper/detect-component-class", () => detectExportedComponentClass(original, `${toPascal(fileBase)}Component`), { entry: resolvedEntry });
12101
+ const detectedClassName = await traceAngularPhase("wrapper/detect-component-class", () => detectExportedComponentClass(original), { entry: resolvedEntry });
12102
+ const componentClassName = detectedClassName ?? `${toPascal(fileBase)}Component`;
12102
12103
  const usesLegacyAnimations = await traceAngularPhase("wrapper/detect-legacy-animations", () => usesLegacyAngularAnimations(resolvedEntry), { entry: resolvedEntry });
12103
12104
  const serverContentHash = Bun.hash(original).toString(BASE_36_RADIX);
12104
12105
  const cachedWrapper = wrapperOutputCache.get(resolvedEntry);
@@ -12118,7 +12119,7 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
12118
12119
  ${rewritten}`;
12119
12120
  }
12120
12121
  rewritten = rewritten.replace(new RegExp(`templateUrl:\\s*['"]\\.\\/${fileBase}\\.html['"]`), `templateUrl: '../../pages/${fileBase}.html'`);
12121
- if (!rewritten.includes("export default")) {
12122
+ if (detectedClassName && !rewritten.includes("export default")) {
12122
12123
  rewritten += `
12123
12124
  export default ${componentClassName};
12124
12125
  `;
@@ -18877,18 +18878,51 @@ var toSafeFileName6 = (specifier) => {
18877
18878
  }));
18878
18879
  const isPrefixOrEqual = (candidate, current) => current === candidate || current.startsWith(`${candidate}/`);
18879
18880
  const otherSpecsFor = (current) => specifiers.filter((spec) => !isPrefixOrEqual(spec, current));
18880
- const results = await Promise.all(entries.map(({ entryPath, specifier }) => bunBuild9({
18881
- entrypoints: [entryPath],
18882
- external: [...FRAMEWORK_EXTERNALS, ...otherSpecsFor(specifier)],
18883
- format: "esm",
18884
- minify: false,
18885
- naming: "[name].[ext]",
18886
- outdir: vendorDir,
18887
- plugins: [createStripPureAnnotationsPlugin()],
18888
- splitting: false,
18889
- target: "browser",
18890
- throw: false
18891
- })));
18881
+ const REQUIRE_CALL_RE = /__require\(\s*["']([^"']+)["']\s*\)/g;
18882
+ const MAX_INLINE_PASSES = 4;
18883
+ const buildEntryWithCjsRequireResolution = async (entryPath, specifier) => {
18884
+ const baseExternals = [
18885
+ ...FRAMEWORK_EXTERNALS,
18886
+ ...otherSpecsFor(specifier)
18887
+ ];
18888
+ const externalsSet = new Set(baseExternals);
18889
+ let lastResult = null;
18890
+ for (let pass = 0;pass < MAX_INLINE_PASSES; pass++) {
18891
+ lastResult = await bunBuild9({
18892
+ entrypoints: [entryPath],
18893
+ external: [...externalsSet],
18894
+ format: "esm",
18895
+ minify: false,
18896
+ naming: "[name].[ext]",
18897
+ outdir: vendorDir,
18898
+ plugins: [createStripPureAnnotationsPlugin()],
18899
+ splitting: false,
18900
+ target: "browser",
18901
+ throw: false
18902
+ });
18903
+ if (!lastResult.success)
18904
+ return lastResult;
18905
+ const output = lastResult.outputs[0];
18906
+ if (!output)
18907
+ return lastResult;
18908
+ const text = await output.text();
18909
+ REQUIRE_CALL_RE.lastIndex = 0;
18910
+ const requiredSpecs = new Set;
18911
+ let match;
18912
+ while ((match = REQUIRE_CALL_RE.exec(text)) !== null) {
18913
+ const requiredSpec = match[1];
18914
+ if (requiredSpec && externalsSet.has(requiredSpec)) {
18915
+ requiredSpecs.add(requiredSpec);
18916
+ }
18917
+ }
18918
+ if (requiredSpecs.size === 0)
18919
+ return lastResult;
18920
+ for (const spec of requiredSpecs)
18921
+ externalsSet.delete(spec);
18922
+ }
18923
+ return lastResult;
18924
+ };
18925
+ const results = await Promise.all(entries.map(({ entryPath, specifier }) => buildEntryWithCjsRequireResolution(entryPath, specifier)));
18892
18926
  const aggregated = {
18893
18927
  success: results.every((result) => result.success),
18894
18928
  logs: results.flatMap((result) => result.logs),
@@ -19347,5 +19381,5 @@ export {
19347
19381
  build
19348
19382
  };
19349
19383
 
19350
- //# debugId=2874204DAC18A03064756E2164756E21
19384
+ //# debugId=6C326DB07EC8C78F64756E2164756E21
19351
19385
  //# sourceMappingURL=build.js.map