@absolutejs/absolute 0.19.0-beta.1077 → 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/vue/index.js CHANGED
@@ -1939,6 +1939,240 @@ var init_islandSsr = __esm(() => {
1939
1939
  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;
1940
1940
  });
1941
1941
 
1942
+ // src/build/maskLiterals.ts
1943
+ var SENTINEL, isIdentChar = (c) => /[A-Za-z0-9_$]/.test(c), REGEX_OK_AFTER_CHAR, REGEX_OK_AFTER_WORD, maskLiterals = (src) => {
1944
+ const n = src.length;
1945
+ const pieces = [];
1946
+ let out = "";
1947
+ let i = 0;
1948
+ let prevChar = "";
1949
+ let prevWord = "";
1950
+ let prevWasSpace = false;
1951
+ let wordBeforeParen = "";
1952
+ const mask = (text) => {
1953
+ out += SENTINEL + pieces.length + SENTINEL;
1954
+ pieces.push(text);
1955
+ prevChar = ")";
1956
+ prevWord = "";
1957
+ prevWasSpace = false;
1958
+ };
1959
+ const endOfString = (start) => {
1960
+ const q = src[start];
1961
+ let j = start + 1;
1962
+ while (j < n) {
1963
+ const c = src[j];
1964
+ if (c === "\\") {
1965
+ j += 2;
1966
+ continue;
1967
+ }
1968
+ if (c === q)
1969
+ return j + 1;
1970
+ if (c === `
1971
+ `)
1972
+ return j;
1973
+ j++;
1974
+ }
1975
+ return j;
1976
+ };
1977
+ const endOfInterp = (start) => {
1978
+ let j = start;
1979
+ let depth = 1;
1980
+ while (j < n && depth > 0) {
1981
+ const c = src[j];
1982
+ if (c === "\\") {
1983
+ j += 2;
1984
+ continue;
1985
+ }
1986
+ if (c === "`") {
1987
+ j = endOfTemplate(j);
1988
+ continue;
1989
+ }
1990
+ if (c === '"' || c === "'") {
1991
+ j = endOfString(j);
1992
+ continue;
1993
+ }
1994
+ if (c === "/" && src[j + 1] === "/") {
1995
+ const nl = src.indexOf(`
1996
+ `, j);
1997
+ j = nl < 0 ? n : nl;
1998
+ continue;
1999
+ }
2000
+ if (c === "/" && src[j + 1] === "*") {
2001
+ const e = src.indexOf("*/", j + 2);
2002
+ j = e < 0 ? n : e + 2;
2003
+ continue;
2004
+ }
2005
+ if (c === "{")
2006
+ depth++;
2007
+ else if (c === "}")
2008
+ depth--;
2009
+ j++;
2010
+ }
2011
+ return j;
2012
+ };
2013
+ function endOfTemplate(start) {
2014
+ let j = start + 1;
2015
+ while (j < n) {
2016
+ const c = src[j];
2017
+ if (c === "\\") {
2018
+ j += 2;
2019
+ continue;
2020
+ }
2021
+ if (c === "`")
2022
+ return j + 1;
2023
+ if (c === "$" && src[j + 1] === "{") {
2024
+ j = endOfInterp(j + 2);
2025
+ continue;
2026
+ }
2027
+ j++;
2028
+ }
2029
+ return j;
2030
+ }
2031
+ const endOfRegex = (start) => {
2032
+ let j = start + 1;
2033
+ let inClass = false;
2034
+ while (j < n) {
2035
+ const c = src[j];
2036
+ if (c === "\\") {
2037
+ j += 2;
2038
+ continue;
2039
+ }
2040
+ if (c === `
2041
+ `)
2042
+ return -1;
2043
+ if (c === "[")
2044
+ inClass = true;
2045
+ else if (c === "]")
2046
+ inClass = false;
2047
+ else if (c === "/" && !inClass) {
2048
+ j++;
2049
+ break;
2050
+ }
2051
+ j++;
2052
+ }
2053
+ while (j < n && /[a-z]/i.test(src[j] ?? ""))
2054
+ j++;
2055
+ return j;
2056
+ };
2057
+ while (i < n) {
2058
+ const c = src[i];
2059
+ const c2 = src[i + 1];
2060
+ if (c === "/" && c2 === "/") {
2061
+ out += "//";
2062
+ i += 2;
2063
+ const s = i;
2064
+ while (i < n && src[i] !== `
2065
+ `)
2066
+ i++;
2067
+ mask(src.slice(s, i));
2068
+ continue;
2069
+ }
2070
+ if (c === "/" && c2 === "*") {
2071
+ out += "/*";
2072
+ i += 2;
2073
+ const e = src.indexOf("*/", i);
2074
+ const end = e < 0 ? n : e;
2075
+ mask(src.slice(i, end));
2076
+ i = end < n ? end + 2 : n;
2077
+ if (end < n)
2078
+ out += "*/";
2079
+ continue;
2080
+ }
2081
+ if (c === "`") {
2082
+ const end = endOfTemplate(i);
2083
+ mask(src.slice(i, end));
2084
+ i = end;
2085
+ continue;
2086
+ }
2087
+ if (c === '"' || c === "'") {
2088
+ const end = endOfString(i);
2089
+ const isSpecifier = prevWord === "from" || prevWord === "import" || prevChar === "(" && (wordBeforeParen === "import" || wordBeforeParen === "require");
2090
+ if (isSpecifier) {
2091
+ out += src.slice(i, end);
2092
+ prevChar = '"';
2093
+ prevWord = "";
2094
+ prevWasSpace = false;
2095
+ } else {
2096
+ mask(src.slice(i, end));
2097
+ }
2098
+ i = end;
2099
+ continue;
2100
+ }
2101
+ if (c === "/" && (prevChar === "" || REGEX_OK_AFTER_CHAR.has(prevChar) || REGEX_OK_AFTER_WORD.has(prevWord))) {
2102
+ const end = endOfRegex(i);
2103
+ if (end > 0) {
2104
+ out += src.slice(i, end);
2105
+ i = end;
2106
+ prevChar = ")";
2107
+ prevWord = "";
2108
+ prevWasSpace = false;
2109
+ continue;
2110
+ }
2111
+ }
2112
+ out += c;
2113
+ i++;
2114
+ if (c === " " || c === "\t" || c === "\r" || c === `
2115
+ `) {
2116
+ prevWasSpace = true;
2117
+ continue;
2118
+ }
2119
+ if (isIdentChar(c)) {
2120
+ const contiguous = isIdentChar(prevChar) && !prevWasSpace;
2121
+ prevWord = contiguous ? prevWord + c : c;
2122
+ } else {
2123
+ if (c === "(")
2124
+ wordBeforeParen = prevWord;
2125
+ prevWord = "";
2126
+ }
2127
+ prevChar = c;
2128
+ prevWasSpace = false;
2129
+ }
2130
+ const restoreRegex = new RegExp(`${SENTINEL}(\\d+)${SENTINEL}`, "g");
2131
+ const restore = (rewritten) => rewritten.replace(restoreRegex, (_m, d) => pieces[Number(d)] ?? "");
2132
+ return { masked: out, restore };
2133
+ };
2134
+ var init_maskLiterals = __esm(() => {
2135
+ SENTINEL = String.fromCharCode(57344);
2136
+ REGEX_OK_AFTER_CHAR = new Set([
2137
+ "(",
2138
+ ",",
2139
+ "=",
2140
+ ":",
2141
+ "[",
2142
+ "!",
2143
+ "&",
2144
+ "|",
2145
+ "?",
2146
+ "{",
2147
+ "}",
2148
+ ";",
2149
+ "+",
2150
+ "-",
2151
+ "*",
2152
+ "/",
2153
+ "%",
2154
+ "^",
2155
+ "~",
2156
+ "<",
2157
+ ">"
2158
+ ]);
2159
+ REGEX_OK_AFTER_WORD = new Set([
2160
+ "return",
2161
+ "typeof",
2162
+ "instanceof",
2163
+ "in",
2164
+ "of",
2165
+ "new",
2166
+ "delete",
2167
+ "void",
2168
+ "do",
2169
+ "else",
2170
+ "yield",
2171
+ "await",
2172
+ "case"
2173
+ ]);
2174
+ });
2175
+
1942
2176
  // src/build/nativeRewrite.ts
1943
2177
  import { dlopen, FFIType, ptr } from "bun:ffi";
1944
2178
  import { platform as platform2, arch as arch2 } from "os";
@@ -2029,8 +2263,9 @@ var escapeRegex = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), jsRewrite
2029
2263
  if (Object.keys(vendorPaths).length === 0)
2030
2264
  return content;
2031
2265
  const replacements = Object.entries(vendorPaths).sort(([keyA], [keyB]) => keyB.length - keyA.length);
2032
- const native = nativeRewriteImports(content, replacements);
2033
- return native ?? jsRewriteImports(content, replacements);
2266
+ const { masked, restore } = maskLiterals(content);
2267
+ const native = nativeRewriteImports(masked, replacements);
2268
+ return restore(native ?? jsRewriteImports(masked, replacements));
2034
2269
  }, fixMissingReExportNamespacesInContent = (content) => {
2035
2270
  const REEXPORT_PATTERN = /__reExport\(\s*[A-Za-z_$][\w$]*\s*,\s*([A-Za-z_$][\w$]*)\s*\)/g;
2036
2271
  REEXPORT_PATTERN.lastIndex = 0;
@@ -2176,6 +2411,7 @@ ${content}`;
2176
2411
  return result;
2177
2412
  };
2178
2413
  var init_rewriteImportsPlugin = __esm(() => {
2414
+ init_maskLiterals();
2179
2415
  init_nativeRewrite();
2180
2416
  });
2181
2417
 
@@ -5362,5 +5598,5 @@ export {
5362
5598
  Image
5363
5599
  };
5364
5600
 
5365
- //# debugId=8B4337B6D986FDEC64756E2164756E21
5601
+ //# debugId=F0E283E992F376C264756E2164756E21
5366
5602
  //# sourceMappingURL=index.js.map