@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.
@@ -784,16 +784,39 @@ var init_islandSsr = __esm(() => {
784
784
  });
785
785
 
786
786
  // src/build/maskLiterals.ts
787
- var SENTINEL = "\uE000", isIdentChar = (c) => /[A-Za-z0-9_$]/.test(c), REGEX_OK_AFTER_CHAR, REGEX_OK_AFTER_WORD, maskLiterals = (src) => {
787
+ var SENTINEL, isIdentChar = (c) => /[A-Za-z0-9_$]/.test(c), REGEX_OK_AFTER_CHAR, REGEX_OK_AFTER_WORD, maskLiterals = (src) => {
788
788
  const n = src.length;
789
789
  const pieces = [];
790
790
  let out = "";
791
791
  let i = 0;
792
792
  let prevChar = "";
793
793
  let prevWord = "";
794
+ let prevWasSpace = false;
795
+ let wordBeforeParen = "";
794
796
  const mask = (text) => {
795
797
  out += SENTINEL + pieces.length + SENTINEL;
796
798
  pieces.push(text);
799
+ prevChar = ")";
800
+ prevWord = "";
801
+ prevWasSpace = false;
802
+ };
803
+ const endOfString = (start) => {
804
+ const q = src[start];
805
+ let j = start + 1;
806
+ while (j < n) {
807
+ const c = src[j];
808
+ if (c === "\\") {
809
+ j += 2;
810
+ continue;
811
+ }
812
+ if (c === q)
813
+ return j + 1;
814
+ if (c === `
815
+ `)
816
+ return j;
817
+ j++;
818
+ }
819
+ return j;
797
820
  };
798
821
  const endOfInterp = (start) => {
799
822
  let j = start;
@@ -849,24 +872,6 @@ var SENTINEL = "\uE000", isIdentChar = (c) => /[A-Za-z0-9_$]/.test(c), REGEX_OK_
849
872
  }
850
873
  return j;
851
874
  }
852
- function endOfString(start) {
853
- const q = src[start];
854
- let j = start + 1;
855
- while (j < n) {
856
- const c = src[j];
857
- if (c === "\\") {
858
- j += 2;
859
- continue;
860
- }
861
- if (c === q)
862
- return j + 1;
863
- if (c === `
864
- `)
865
- return j;
866
- j++;
867
- }
868
- return j;
869
- }
870
875
  const endOfRegex = (start) => {
871
876
  let j = start + 1;
872
877
  let inClass = false;
@@ -904,8 +909,6 @@ var SENTINEL = "\uE000", isIdentChar = (c) => /[A-Za-z0-9_$]/.test(c), REGEX_OK_
904
909
  `)
905
910
  i++;
906
911
  mask(src.slice(s, i));
907
- prevChar = "";
908
- prevWord = "";
909
912
  continue;
910
913
  }
911
914
  if (c === "/" && c2 === "*") {
@@ -923,16 +926,20 @@ var SENTINEL = "\uE000", isIdentChar = (c) => /[A-Za-z0-9_$]/.test(c), REGEX_OK_
923
926
  const end = endOfTemplate(i);
924
927
  mask(src.slice(i, end));
925
928
  i = end;
926
- prevChar = "`";
927
- prevWord = "";
928
929
  continue;
929
930
  }
930
931
  if (c === '"' || c === "'") {
931
932
  const end = endOfString(i);
932
- out += src.slice(i, end);
933
+ const isSpecifier = prevWord === "from" || prevWord === "import" || prevChar === "(" && (wordBeforeParen === "import" || wordBeforeParen === "require");
934
+ if (isSpecifier) {
935
+ out += src.slice(i, end);
936
+ prevChar = '"';
937
+ prevWord = "";
938
+ prevWasSpace = false;
939
+ } else {
940
+ mask(src.slice(i, end));
941
+ }
933
942
  i = end;
934
- prevChar = '"';
935
- prevWord = "";
936
943
  continue;
937
944
  }
938
945
  if (c === "/" && (prevChar === "" || REGEX_OK_AFTER_CHAR.has(prevChar) || REGEX_OK_AFTER_WORD.has(prevWord))) {
@@ -940,25 +947,36 @@ var SENTINEL = "\uE000", isIdentChar = (c) => /[A-Za-z0-9_$]/.test(c), REGEX_OK_
940
947
  if (end > 0) {
941
948
  out += src.slice(i, end);
942
949
  i = end;
943
- prevChar = "/";
950
+ prevChar = ")";
944
951
  prevWord = "";
952
+ prevWasSpace = false;
945
953
  continue;
946
954
  }
947
955
  }
948
956
  out += c;
949
957
  i++;
950
958
  if (c === " " || c === "\t" || c === "\r" || c === `
951
- `)
959
+ `) {
960
+ prevWasSpace = true;
952
961
  continue;
953
- const wasIdent = isIdentChar(prevChar);
962
+ }
963
+ if (isIdentChar(c)) {
964
+ const contiguous = isIdentChar(prevChar) && !prevWasSpace;
965
+ prevWord = contiguous ? prevWord + c : c;
966
+ } else {
967
+ if (c === "(")
968
+ wordBeforeParen = prevWord;
969
+ prevWord = "";
970
+ }
954
971
  prevChar = c;
955
- prevWord = isIdentChar(c) ? wasIdent ? prevWord + c : c : "";
972
+ prevWasSpace = false;
956
973
  }
957
974
  const restoreRegex = new RegExp(`${SENTINEL}(\\d+)${SENTINEL}`, "g");
958
975
  const restore = (rewritten) => rewritten.replace(restoreRegex, (_m, d) => pieces[Number(d)] ?? "");
959
976
  return { masked: out, restore };
960
977
  };
961
978
  var init_maskLiterals = __esm(() => {
979
+ SENTINEL = String.fromCharCode(57344);
962
980
  REGEX_OK_AFTER_CHAR = new Set([
963
981
  "(",
964
982
  ",",
@@ -6670,5 +6688,5 @@ export {
6670
6688
  ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER
6671
6689
  };
6672
6690
 
6673
- //# debugId=97372BAE92D1182064756E2164756E21
6691
+ //# debugId=23A0F9CA53938AFB64756E2164756E21
6674
6692
  //# sourceMappingURL=server.js.map