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

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.
@@ -783,6 +783,222 @@ var init_islandSsr = __esm(() => {
783
783
  LEADING_HOISTED_RESOURCE_RE = /^\s*(?:<link\b[^>]*\/?>|<meta\b[^>]*\/?>|<title\b[^>]*>[\s\S]*?<\/title>|<style\b[^>]*>[\s\S]*?<\/style>|<script\b[^>]*>[\s\S]*?<\/script>)/i;
784
784
  });
785
785
 
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) => {
788
+ const n = src.length;
789
+ const pieces = [];
790
+ let out = "";
791
+ let i = 0;
792
+ let prevChar = "";
793
+ let prevWord = "";
794
+ const mask = (text) => {
795
+ out += SENTINEL + pieces.length + SENTINEL;
796
+ pieces.push(text);
797
+ };
798
+ const endOfInterp = (start) => {
799
+ let j = start;
800
+ let depth = 1;
801
+ while (j < n && depth > 0) {
802
+ const c = src[j];
803
+ if (c === "\\") {
804
+ j += 2;
805
+ continue;
806
+ }
807
+ if (c === "`") {
808
+ j = endOfTemplate(j);
809
+ continue;
810
+ }
811
+ if (c === '"' || c === "'") {
812
+ j = endOfString(j);
813
+ continue;
814
+ }
815
+ if (c === "/" && src[j + 1] === "/") {
816
+ const nl = src.indexOf(`
817
+ `, j);
818
+ j = nl < 0 ? n : nl;
819
+ continue;
820
+ }
821
+ if (c === "/" && src[j + 1] === "*") {
822
+ const e = src.indexOf("*/", j + 2);
823
+ j = e < 0 ? n : e + 2;
824
+ continue;
825
+ }
826
+ if (c === "{")
827
+ depth++;
828
+ else if (c === "}")
829
+ depth--;
830
+ j++;
831
+ }
832
+ return j;
833
+ };
834
+ function endOfTemplate(start) {
835
+ let j = start + 1;
836
+ while (j < n) {
837
+ const c = src[j];
838
+ if (c === "\\") {
839
+ j += 2;
840
+ continue;
841
+ }
842
+ if (c === "`")
843
+ return j + 1;
844
+ if (c === "$" && src[j + 1] === "{") {
845
+ j = endOfInterp(j + 2);
846
+ continue;
847
+ }
848
+ j++;
849
+ }
850
+ return j;
851
+ }
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
+ const endOfRegex = (start) => {
871
+ let j = start + 1;
872
+ let inClass = false;
873
+ while (j < n) {
874
+ const c = src[j];
875
+ if (c === "\\") {
876
+ j += 2;
877
+ continue;
878
+ }
879
+ if (c === `
880
+ `)
881
+ return -1;
882
+ if (c === "[")
883
+ inClass = true;
884
+ else if (c === "]")
885
+ inClass = false;
886
+ else if (c === "/" && !inClass) {
887
+ j++;
888
+ break;
889
+ }
890
+ j++;
891
+ }
892
+ while (j < n && /[a-z]/i.test(src[j] ?? ""))
893
+ j++;
894
+ return j;
895
+ };
896
+ while (i < n) {
897
+ const c = src[i];
898
+ const c2 = src[i + 1];
899
+ if (c === "/" && c2 === "/") {
900
+ out += "//";
901
+ i += 2;
902
+ const s = i;
903
+ while (i < n && src[i] !== `
904
+ `)
905
+ i++;
906
+ mask(src.slice(s, i));
907
+ prevChar = "";
908
+ prevWord = "";
909
+ continue;
910
+ }
911
+ if (c === "/" && c2 === "*") {
912
+ out += "/*";
913
+ i += 2;
914
+ const e = src.indexOf("*/", i);
915
+ const end = e < 0 ? n : e;
916
+ mask(src.slice(i, end));
917
+ i = end < n ? end + 2 : n;
918
+ if (end < n)
919
+ out += "*/";
920
+ continue;
921
+ }
922
+ if (c === "`") {
923
+ const end = endOfTemplate(i);
924
+ mask(src.slice(i, end));
925
+ i = end;
926
+ prevChar = "`";
927
+ prevWord = "";
928
+ continue;
929
+ }
930
+ if (c === '"' || c === "'") {
931
+ const end = endOfString(i);
932
+ out += src.slice(i, end);
933
+ i = end;
934
+ prevChar = '"';
935
+ prevWord = "";
936
+ continue;
937
+ }
938
+ if (c === "/" && (prevChar === "" || REGEX_OK_AFTER_CHAR.has(prevChar) || REGEX_OK_AFTER_WORD.has(prevWord))) {
939
+ const end = endOfRegex(i);
940
+ if (end > 0) {
941
+ out += src.slice(i, end);
942
+ i = end;
943
+ prevChar = "/";
944
+ prevWord = "";
945
+ continue;
946
+ }
947
+ }
948
+ out += c;
949
+ i++;
950
+ if (c === " " || c === "\t" || c === "\r" || c === `
951
+ `)
952
+ continue;
953
+ const wasIdent = isIdentChar(prevChar);
954
+ prevChar = c;
955
+ prevWord = isIdentChar(c) ? wasIdent ? prevWord + c : c : "";
956
+ }
957
+ const restoreRegex = new RegExp(`${SENTINEL}(\\d+)${SENTINEL}`, "g");
958
+ const restore = (rewritten) => rewritten.replace(restoreRegex, (_m, d) => pieces[Number(d)] ?? "");
959
+ return { masked: out, restore };
960
+ };
961
+ var init_maskLiterals = __esm(() => {
962
+ REGEX_OK_AFTER_CHAR = new Set([
963
+ "(",
964
+ ",",
965
+ "=",
966
+ ":",
967
+ "[",
968
+ "!",
969
+ "&",
970
+ "|",
971
+ "?",
972
+ "{",
973
+ "}",
974
+ ";",
975
+ "+",
976
+ "-",
977
+ "*",
978
+ "/",
979
+ "%",
980
+ "^",
981
+ "~",
982
+ "<",
983
+ ">"
984
+ ]);
985
+ REGEX_OK_AFTER_WORD = new Set([
986
+ "return",
987
+ "typeof",
988
+ "instanceof",
989
+ "in",
990
+ "of",
991
+ "new",
992
+ "delete",
993
+ "void",
994
+ "do",
995
+ "else",
996
+ "yield",
997
+ "await",
998
+ "case"
999
+ ]);
1000
+ });
1001
+
786
1002
  // src/build/nativeRewrite.ts
787
1003
  import { dlopen, FFIType, ptr } from "bun:ffi";
788
1004
  import { platform, arch } from "os";
@@ -873,8 +1089,9 @@ var escapeRegex = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), jsRewrite
873
1089
  if (Object.keys(vendorPaths).length === 0)
874
1090
  return content;
875
1091
  const replacements = Object.entries(vendorPaths).sort(([keyA], [keyB]) => keyB.length - keyA.length);
876
- const native = nativeRewriteImports(content, replacements);
877
- return native ?? jsRewriteImports(content, replacements);
1092
+ const { masked, restore } = maskLiterals(content);
1093
+ const native = nativeRewriteImports(masked, replacements);
1094
+ return restore(native ?? jsRewriteImports(masked, replacements));
878
1095
  }, fixMissingReExportNamespacesInContent = (content) => {
879
1096
  const REEXPORT_PATTERN = /__reExport\(\s*[A-Za-z_$][\w$]*\s*,\s*([A-Za-z_$][\w$]*)\s*\)/g;
880
1097
  REEXPORT_PATTERN.lastIndex = 0;
@@ -1020,6 +1237,7 @@ ${content}`;
1020
1237
  return result;
1021
1238
  };
1022
1239
  var init_rewriteImportsPlugin = __esm(() => {
1240
+ init_maskLiterals();
1023
1241
  init_nativeRewrite();
1024
1242
  });
1025
1243
 
@@ -6452,5 +6670,5 @@ export {
6452
6670
  ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER
6453
6671
  };
6454
6672
 
6455
- //# debugId=FFA663873D175B9F64756E2164756E21
6673
+ //# debugId=97372BAE92D1182064756E2164756E21
6456
6674
  //# sourceMappingURL=server.js.map