@absolutejs/absolute 0.19.0-beta.1107 → 0.19.0-beta.1108

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
@@ -2473,6 +2473,9 @@ var SENTINEL, RISKY_STRING_CONTENT, isIdentChar = (c) => /[A-Za-z0-9_$]/.test(c)
2473
2473
  const endOfInterp = (start) => {
2474
2474
  let j = start;
2475
2475
  let depth = 1;
2476
+ let ipChar = "";
2477
+ let ipWord = "";
2478
+ let ipSpace = false;
2476
2479
  while (j < n && depth > 0) {
2477
2480
  const c = src[j];
2478
2481
  if (c === "\\") {
@@ -2481,10 +2484,16 @@ var SENTINEL, RISKY_STRING_CONTENT, isIdentChar = (c) => /[A-Za-z0-9_$]/.test(c)
2481
2484
  }
2482
2485
  if (c === "`") {
2483
2486
  j = endOfTemplate(j);
2487
+ ipChar = ")";
2488
+ ipWord = "";
2489
+ ipSpace = false;
2484
2490
  continue;
2485
2491
  }
2486
2492
  if (c === '"' || c === "'") {
2487
2493
  j = endOfString(j);
2494
+ ipChar = '"';
2495
+ ipWord = "";
2496
+ ipSpace = false;
2488
2497
  continue;
2489
2498
  }
2490
2499
  if (c === "/" && src[j + 1] === "/") {
@@ -2498,11 +2507,33 @@ var SENTINEL, RISKY_STRING_CONTENT, isIdentChar = (c) => /[A-Za-z0-9_$]/.test(c)
2498
2507
  j = e < 0 ? n : e + 2;
2499
2508
  continue;
2500
2509
  }
2510
+ if (c === "/" && (ipChar === "" || REGEX_OK_AFTER_CHAR.has(ipChar) || REGEX_OK_AFTER_WORD.has(ipWord))) {
2511
+ const e = endOfRegex(j);
2512
+ if (e > 0) {
2513
+ j = e;
2514
+ ipChar = ")";
2515
+ ipWord = "";
2516
+ ipSpace = false;
2517
+ continue;
2518
+ }
2519
+ }
2501
2520
  if (c === "{")
2502
2521
  depth++;
2503
2522
  else if (c === "}")
2504
2523
  depth--;
2505
2524
  j++;
2525
+ if (c === " " || c === "\t" || c === "\r" || c === `
2526
+ `) {
2527
+ ipSpace = true;
2528
+ continue;
2529
+ }
2530
+ if (isIdentChar(c)) {
2531
+ ipWord = isIdentChar(ipChar) && !ipSpace ? ipWord + c : c;
2532
+ } else {
2533
+ ipWord = "";
2534
+ }
2535
+ ipChar = c;
2536
+ ipSpace = false;
2506
2537
  }
2507
2538
  return j;
2508
2539
  };
@@ -21185,6 +21216,36 @@ var isDev2, isBuildTraceEnabled = () => {
21185
21216
  `),
21186
21217
  specifier
21187
21218
  };
21219
+ }, REACT_VENDOR_SPECIFIERS, findBareReactImports = (path, importRegex) => {
21220
+ let content;
21221
+ try {
21222
+ content = readFileSync21(path, "utf-8");
21223
+ } catch {
21224
+ return [];
21225
+ }
21226
+ if (!content.includes("react"))
21227
+ return [];
21228
+ const { masked } = maskLiterals(content);
21229
+ const specs = [...masked.matchAll(importRegex)].map((match) => match[1]).filter((spec) => Boolean(spec));
21230
+ return [...new Set(specs)];
21231
+ }, verifyBrowserImportsVendored = (outputPaths) => {
21232
+ const alt = REACT_VENDOR_SPECIFIERS.map((spec) => spec.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
21233
+ const importRegex = new RegExp(`(?:from|import|require)\\s*\\(?\\s*["'](${alt})["']`, "g");
21234
+ const seenPaths = new Set;
21235
+ const offenders = [];
21236
+ for (const path of outputPaths) {
21237
+ if (!path.endsWith(".js") || seenPaths.has(path))
21238
+ continue;
21239
+ seenPaths.add(path);
21240
+ const specs = findBareReactImports(path, importRegex);
21241
+ if (specs.length > 0)
21242
+ offenders.push(`${path} \u2192 ${specs.join(", ")}`);
21243
+ }
21244
+ if (offenders.length === 0)
21245
+ return;
21246
+ throw new Error(`Build emitted browser chunk(s) with un-vendored bare React ` + `specifiers \u2014 these fail to resolve in the browser and break ` + `hydration:
21247
+ ${offenders.map((o3) => ` \u2022 ${o3}`).join(`
21248
+ `)}`);
21188
21249
  }, buildPassError = (logs, pass, label, frameworkNames, isIncremental) => {
21189
21250
  const { column, file: file4, line, message, specifier } = summarizeBuildFailure(logs, label);
21190
21251
  const err = new Error(message);
@@ -22516,6 +22577,21 @@ ${content.slice(firstUseIdx)}`;
22516
22577
  const { rewriteBuildOutputs: rewriteBuildOutputs2 } = await Promise.resolve().then(() => (init_rewriteImportsPlugin(), exports_rewriteImportsPlugin));
22517
22578
  await tracePhase("postprocess/island-vendor-imports", () => rewriteBuildOutputs2(islandClientOutputs, allIslandVendorPaths));
22518
22579
  }
22580
+ if (!hmr) {
22581
+ const reactVendorDir = join36(buildPath, "react", "vendor");
22582
+ const vendorChunkPaths = existsSync27(reactVendorDir) ? [
22583
+ ...new Glob8("**/*.js").scanSync({
22584
+ absolute: true,
22585
+ cwd: reactVendorDir
22586
+ })
22587
+ ] : [];
22588
+ verifyBrowserImportsVendored([
22589
+ ...reactClientOutputPaths,
22590
+ ...nonReactClientOutputPaths,
22591
+ ...islandClientOutputPaths,
22592
+ ...vendorChunkPaths
22593
+ ]);
22594
+ }
22519
22595
  if (serverOutputs.length > 0 && angularServerVendorPaths2 && Object.keys(angularServerVendorPaths2).length > 0) {
22520
22596
  const { rewriteBuildOutputsWith: rewriteBuildOutputsWith2 } = await Promise.resolve().then(() => (init_rewriteImportsPlugin(), exports_rewriteImportsPlugin));
22521
22597
  await tracePhase("postprocess/server-angular-vendor-imports", () => rewriteBuildOutputsWith2(serverOutputs, (artifact) => {
@@ -22842,6 +22918,7 @@ var init_build = __esm(() => {
22842
22918
  init_updateAssetPaths();
22843
22919
  init_buildHMRClient();
22844
22920
  init_rewriteReactImports();
22921
+ init_maskLiterals();
22845
22922
  init_telemetryEvent();
22846
22923
  init_angularLinkerPlugin();
22847
22924
  init_externalAssetPlugin();
@@ -22856,6 +22933,14 @@ var init_build = __esm(() => {
22856
22933
  init_validateSafePath();
22857
22934
  init_spaRouteManifest();
22858
22935
  isDev2 = env2.NODE_ENV === "development";
22936
+ REACT_VENDOR_SPECIFIERS = [
22937
+ "react-dom/client",
22938
+ "react-refresh/runtime",
22939
+ "react/jsx-dev-runtime",
22940
+ "react/jsx-runtime",
22941
+ "react-dom",
22942
+ "react"
22943
+ ];
22859
22944
  SKIP_DIRS5 = new Set([
22860
22945
  "build",
22861
22946
  "node_modules",
@@ -29558,5 +29643,5 @@ export {
29558
29643
  build
29559
29644
  };
29560
29645
 
29561
- //# debugId=193C1DEAEB2BCF1664756E2164756E21
29646
+ //# debugId=A803444A4860084964756E2164756E21
29562
29647
  //# sourceMappingURL=build.js.map