@absolutejs/absolute 0.19.0-beta.1104 → 0.19.0-beta.1106

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.
@@ -8,16 +8,19 @@
8
8
  * comment — so it rewrites the snippet's specifier too. The browser bundle then
9
9
  * diverges from the SSR pre-render → React hydration mismatch on the code block.
10
10
  *
11
- * Fix: before rewriting, replace template literals, comments, and non-specifier
12
- * string literals with opaque placeholders; rewrite; then restore them verbatim.
13
- * String literals that ARE real import specifiers (those right after
14
- * `from`/`import`, or inside `import(`/`require(`) are left untouched, so real
15
- * import rewriting is unaffected. Regex literals are skipped (copied verbatim)
16
- * so their contents can't be misread as strings/templates.
11
+ * Fix: before rewriting, replace template literals and comments with opaque
12
+ * placeholders, plus any string literal whose *own text* contains an
13
+ * import-like sequence (`from`/`import`/`require` + quote); rewrite; then
14
+ * restore them verbatim. A real import specifier string (e.g.
15
+ * "react/jsx-runtime") never contains that sequence, so it is left untouched
16
+ * and always gets rewritten no matter what token precedes it. Regex literals
17
+ * are skipped (copied verbatim) so their contents can't be misread as
18
+ * strings/templates.
17
19
  *
18
20
  * Usage: `const { masked, restore } = maskLiterals(src)`, run the existing
19
21
  * rewriter on `masked`, then `restore(rewritten)`.
20
22
  */
23
+ export declare const SENTINEL: string;
21
24
  export type MaskedSource = {
22
25
  masked: string;
23
26
  restore: (rewritten: string) => string;
@@ -1,8 +1,20 @@
1
+ export declare const getCacheLocation: (args: string[]) => string;
2
+ export declare const createEslintCacheFingerprint: (cwd?: string) => string;
3
+ type EslintCacheOptions = {
4
+ cacheLocation: string;
5
+ cwd?: string;
6
+ fingerprint?: string;
7
+ };
8
+ export declare const prepareEslintCache: (options: EslintCacheOptions) => boolean;
9
+ export declare const buildEslintCommand: (args: string[], cacheLocation: string) => string[];
1
10
  /**
2
11
  * Run ESLint with sensible absolutejs defaults.
3
12
  *
4
- * - Caching: enabled by default, cache file location overridable via
5
- * the `ABSOLUTE_ESLINT_CACHE` env var (default: `.absolutejs/eslint-cache`).
13
+ * - Caching: enabled by default with ESLint's content strategy, so Git
14
+ * operations that alter mtimes don't make unchanged files expensive.
15
+ * Installed lint-tool or config changes invalidate the cache automatically.
16
+ * The cache location is overridable via `ABSOLUTE_ESLINT_CACHE`
17
+ * (default: `.absolutejs/eslint-cache`).
6
18
  * - Implicit lint target: `.` is appended only when the user hasn't
7
19
  * supplied a positional path of their own. So `bun lint src/backend/`
8
20
  * lints just that directory — not the whole repo plus `src/backend/`.
@@ -14,3 +26,4 @@
14
26
  * spread through to the underlying `bun eslint` invocation.
15
27
  */
16
28
  export declare const eslint: (args: string[]) => Promise<void>;
29
+ export {};
@@ -3129,7 +3129,7 @@ var init_islandSsr = __esm(() => {
3129
3129
  });
3130
3130
 
3131
3131
  // src/build/maskLiterals.ts
3132
- var SENTINEL, isIdentChar = (c) => /[A-Za-z0-9_$]/.test(c), REGEX_OK_AFTER_CHAR, REGEX_OK_AFTER_WORD, maskLiterals = (src) => {
3132
+ var SENTINEL, RISKY_STRING_CONTENT, isIdentChar = (c) => /[A-Za-z0-9_$]/.test(c), REGEX_OK_AFTER_CHAR, REGEX_OK_AFTER_WORD, maskLiterals = (src) => {
3133
3133
  const n = src.length;
3134
3134
  const pieces = [];
3135
3135
  let out = "";
@@ -3137,7 +3137,6 @@ var SENTINEL, isIdentChar = (c) => /[A-Za-z0-9_$]/.test(c), REGEX_OK_AFTER_CHAR,
3137
3137
  let prevChar = "";
3138
3138
  let prevWord = "";
3139
3139
  let prevWasSpace = false;
3140
- let wordBeforeParen = "";
3141
3140
  const mask = (text) => {
3142
3141
  out += SENTINEL + pieces.length + SENTINEL;
3143
3142
  pieces.push(text);
@@ -3275,14 +3274,14 @@ var SENTINEL, isIdentChar = (c) => /[A-Za-z0-9_$]/.test(c), REGEX_OK_AFTER_CHAR,
3275
3274
  }
3276
3275
  if (c === '"' || c === "'") {
3277
3276
  const end = endOfString(i);
3278
- const isSpecifier = prevWord === "from" || prevWord === "import" || prevChar === "(" && (wordBeforeParen === "import" || wordBeforeParen === "require");
3279
- if (isSpecifier) {
3280
- out += src.slice(i, end);
3277
+ const text = src.slice(i, end);
3278
+ if (RISKY_STRING_CONTENT.test(text)) {
3279
+ mask(text);
3280
+ } else {
3281
+ out += text;
3281
3282
  prevChar = '"';
3282
3283
  prevWord = "";
3283
3284
  prevWasSpace = false;
3284
- } else {
3285
- mask(src.slice(i, end));
3286
3285
  }
3287
3286
  i = end;
3288
3287
  continue;
@@ -3309,8 +3308,6 @@ var SENTINEL, isIdentChar = (c) => /[A-Za-z0-9_$]/.test(c), REGEX_OK_AFTER_CHAR,
3309
3308
  const contiguous = isIdentChar(prevChar) && !prevWasSpace;
3310
3309
  prevWord = contiguous ? prevWord + c : c;
3311
3310
  } else {
3312
- if (c === "(")
3313
- wordBeforeParen = prevWord;
3314
3311
  prevWord = "";
3315
3312
  }
3316
3313
  prevChar = c;
@@ -3322,6 +3319,7 @@ var SENTINEL, isIdentChar = (c) => /[A-Za-z0-9_$]/.test(c), REGEX_OK_AFTER_CHAR,
3322
3319
  };
3323
3320
  var init_maskLiterals = __esm(() => {
3324
3321
  SENTINEL = String.fromCharCode(57344);
3322
+ RISKY_STRING_CONTENT = /\b(?:from|import|require)\s*\(?\s*["'`]/;
3325
3323
  REGEX_OK_AFTER_CHAR = new Set([
3326
3324
  "(",
3327
3325
  ",",
@@ -4700,5 +4698,5 @@ export {
4700
4698
  createTypedIsland
4701
4699
  };
4702
4700
 
4703
- //# debugId=AD96519B394CE95B64756E2164756E21
4701
+ //# debugId=5A09E6361E2C596964756E2164756E21
4704
4702
  //# sourceMappingURL=index.js.map