@absolutejs/absolute 0.19.0-beta.1078 → 0.19.0-beta.1079

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
@@ -2437,16 +2437,39 @@ var init_islandSsr = __esm(() => {
2437
2437
  });
2438
2438
 
2439
2439
  // src/build/maskLiterals.ts
2440
- var SENTINEL = "\uE000", isIdentChar = (c) => /[A-Za-z0-9_$]/.test(c), REGEX_OK_AFTER_CHAR, REGEX_OK_AFTER_WORD, maskLiterals = (src) => {
2440
+ var SENTINEL, isIdentChar = (c) => /[A-Za-z0-9_$]/.test(c), REGEX_OK_AFTER_CHAR, REGEX_OK_AFTER_WORD, maskLiterals = (src) => {
2441
2441
  const n = src.length;
2442
2442
  const pieces = [];
2443
2443
  let out = "";
2444
2444
  let i = 0;
2445
2445
  let prevChar = "";
2446
2446
  let prevWord = "";
2447
+ let prevWasSpace = false;
2448
+ let wordBeforeParen = "";
2447
2449
  const mask = (text) => {
2448
2450
  out += SENTINEL + pieces.length + SENTINEL;
2449
2451
  pieces.push(text);
2452
+ prevChar = ")";
2453
+ prevWord = "";
2454
+ prevWasSpace = false;
2455
+ };
2456
+ const endOfString = (start) => {
2457
+ const q = src[start];
2458
+ let j = start + 1;
2459
+ while (j < n) {
2460
+ const c = src[j];
2461
+ if (c === "\\") {
2462
+ j += 2;
2463
+ continue;
2464
+ }
2465
+ if (c === q)
2466
+ return j + 1;
2467
+ if (c === `
2468
+ `)
2469
+ return j;
2470
+ j++;
2471
+ }
2472
+ return j;
2450
2473
  };
2451
2474
  const endOfInterp = (start) => {
2452
2475
  let j = start;
@@ -2502,24 +2525,6 @@ var SENTINEL = "\uE000", isIdentChar = (c) => /[A-Za-z0-9_$]/.test(c), REGEX_OK_
2502
2525
  }
2503
2526
  return j;
2504
2527
  }
2505
- function endOfString(start) {
2506
- const q = src[start];
2507
- let j = start + 1;
2508
- while (j < n) {
2509
- const c = src[j];
2510
- if (c === "\\") {
2511
- j += 2;
2512
- continue;
2513
- }
2514
- if (c === q)
2515
- return j + 1;
2516
- if (c === `
2517
- `)
2518
- return j;
2519
- j++;
2520
- }
2521
- return j;
2522
- }
2523
2528
  const endOfRegex = (start) => {
2524
2529
  let j = start + 1;
2525
2530
  let inClass = false;
@@ -2557,8 +2562,6 @@ var SENTINEL = "\uE000", isIdentChar = (c) => /[A-Za-z0-9_$]/.test(c), REGEX_OK_
2557
2562
  `)
2558
2563
  i++;
2559
2564
  mask(src.slice(s, i));
2560
- prevChar = "";
2561
- prevWord = "";
2562
2565
  continue;
2563
2566
  }
2564
2567
  if (c === "/" && c2 === "*") {
@@ -2576,16 +2579,20 @@ var SENTINEL = "\uE000", isIdentChar = (c) => /[A-Za-z0-9_$]/.test(c), REGEX_OK_
2576
2579
  const end = endOfTemplate(i);
2577
2580
  mask(src.slice(i, end));
2578
2581
  i = end;
2579
- prevChar = "`";
2580
- prevWord = "";
2581
2582
  continue;
2582
2583
  }
2583
2584
  if (c === '"' || c === "'") {
2584
2585
  const end = endOfString(i);
2585
- out += src.slice(i, end);
2586
+ const isSpecifier = prevWord === "from" || prevWord === "import" || prevChar === "(" && (wordBeforeParen === "import" || wordBeforeParen === "require");
2587
+ if (isSpecifier) {
2588
+ out += src.slice(i, end);
2589
+ prevChar = '"';
2590
+ prevWord = "";
2591
+ prevWasSpace = false;
2592
+ } else {
2593
+ mask(src.slice(i, end));
2594
+ }
2586
2595
  i = end;
2587
- prevChar = '"';
2588
- prevWord = "";
2589
2596
  continue;
2590
2597
  }
2591
2598
  if (c === "/" && (prevChar === "" || REGEX_OK_AFTER_CHAR.has(prevChar) || REGEX_OK_AFTER_WORD.has(prevWord))) {
@@ -2593,25 +2600,36 @@ var SENTINEL = "\uE000", isIdentChar = (c) => /[A-Za-z0-9_$]/.test(c), REGEX_OK_
2593
2600
  if (end > 0) {
2594
2601
  out += src.slice(i, end);
2595
2602
  i = end;
2596
- prevChar = "/";
2603
+ prevChar = ")";
2597
2604
  prevWord = "";
2605
+ prevWasSpace = false;
2598
2606
  continue;
2599
2607
  }
2600
2608
  }
2601
2609
  out += c;
2602
2610
  i++;
2603
2611
  if (c === " " || c === "\t" || c === "\r" || c === `
2604
- `)
2612
+ `) {
2613
+ prevWasSpace = true;
2605
2614
  continue;
2606
- const wasIdent = isIdentChar(prevChar);
2615
+ }
2616
+ if (isIdentChar(c)) {
2617
+ const contiguous = isIdentChar(prevChar) && !prevWasSpace;
2618
+ prevWord = contiguous ? prevWord + c : c;
2619
+ } else {
2620
+ if (c === "(")
2621
+ wordBeforeParen = prevWord;
2622
+ prevWord = "";
2623
+ }
2607
2624
  prevChar = c;
2608
- prevWord = isIdentChar(c) ? wasIdent ? prevWord + c : c : "";
2625
+ prevWasSpace = false;
2609
2626
  }
2610
2627
  const restoreRegex = new RegExp(`${SENTINEL}(\\d+)${SENTINEL}`, "g");
2611
2628
  const restore = (rewritten) => rewritten.replace(restoreRegex, (_m, d) => pieces[Number(d)] ?? "");
2612
2629
  return { masked: out, restore };
2613
2630
  };
2614
2631
  var init_maskLiterals = __esm(() => {
2632
+ SENTINEL = String.fromCharCode(57344);
2615
2633
  REGEX_OK_AFTER_CHAR = new Set([
2616
2634
  "(",
2617
2635
  ",",
@@ -27942,5 +27960,5 @@ export {
27942
27960
  build
27943
27961
  };
27944
27962
 
27945
- //# debugId=0D8E947954EA50F864756E2164756E21
27963
+ //# debugId=36C247738D172D4464756E2164756E21
27946
27964
  //# sourceMappingURL=build.js.map