@absolutejs/absolute 0.19.0-beta.814 → 0.19.0-beta.816

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/cli/index.js CHANGED
@@ -1153,7 +1153,7 @@ import {
1153
1153
  mkdirSync as mkdirSync5,
1154
1154
  readdirSync as readdirSync2,
1155
1155
  readFileSync as readFileSync10,
1156
- rmSync as rmSync2,
1156
+ rmSync as rmSync3,
1157
1157
  statSync,
1158
1158
  unlinkSync as unlinkSync2,
1159
1159
  writeFileSync as writeFileSync3
@@ -1319,7 +1319,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
1319
1319
  return;
1320
1320
  seen.add(specifier);
1321
1321
  const destDir = join7(outdir, "node_modules", ...specifier.split("/"));
1322
- rmSync2(destDir, { force: true, recursive: true });
1322
+ rmSync3(destDir, { force: true, recursive: true });
1323
1323
  cpSync(srcDir, destDir, {
1324
1324
  filter(source) {
1325
1325
  const rel = relative(srcDir, source);
@@ -1935,7 +1935,7 @@ console.log(\`
1935
1935
  copyServerRuntimeAssetReferences(resolvedOutdir);
1936
1936
  const prerenderStart = performance.now();
1937
1937
  process.stdout.write(cliTag4("\x1B[36m", "Pre-rendering pages"));
1938
- rmSync2(join7(resolvedOutdir, "_prerendered"), {
1938
+ rmSync3(join7(resolvedOutdir, "_prerendered"), {
1939
1939
  force: true,
1940
1940
  recursive: true
1941
1941
  });
@@ -2852,54 +2852,89 @@ var dev = async (serverEntry, configPath2) => {
2852
2852
  };
2853
2853
 
2854
2854
  // src/cli/scripts/eslint.ts
2855
- import { existsSync as existsSync6, readFileSync as readFileSync5 } from "fs";
2855
+ import { existsSync as existsSync6, readFileSync as readFileSync5, rmSync as rmSync2 } from "fs";
2856
2856
  import { resolve as resolve4 } from "path";
2857
- var CACHE_LOCATION = ".absolutejs/eslint-cache";
2857
+ var DEFAULT_CACHE_LOCATION = ".absolutejs/eslint-cache";
2858
+ var getCacheLocation = () => process.env.ABSOLUTE_ESLINT_CACHE?.trim() || DEFAULT_CACHE_LOCATION;
2858
2859
  var CONFIG_CANDIDATES = [
2859
- "eslint.config.mjs",
2860
2860
  "eslint.config.js",
2861
+ "eslint.config.mjs",
2861
2862
  "eslint.config.cjs",
2862
- "eslint.config.ts"
2863
+ "eslint.config.ts",
2864
+ "eslint.config.mts",
2865
+ "eslint.config.cts"
2863
2866
  ];
2864
- var checkForMisplacedIgnores = () => {
2865
- const cwd = process.cwd();
2866
- const configPath2 = CONFIG_CANDIDATES.map((name) => resolve4(cwd, name)).find((candidate) => existsSync6(candidate));
2867
- if (!configPath2)
2868
- return;
2869
- let source;
2870
- try {
2871
- source = readFileSync5(configPath2, "utf-8");
2872
- } catch {
2873
- return;
2874
- }
2875
- const blocks = extractTopLevelObjectLiterals(source);
2876
- const offenders = [];
2877
- for (const block of blocks) {
2878
- if (hasKey(block, "ignores") && hasKey(block, "files")) {
2879
- offenders.push(block.slice(0, 80).replace(/\s+/g, " "));
2867
+ var FLAG_VALUE_FLAGS = new Set([
2868
+ "-c",
2869
+ "--config",
2870
+ "--cache-location",
2871
+ "--cache-strategy",
2872
+ "--ignore-path",
2873
+ "--ignore-pattern",
2874
+ "--rule",
2875
+ "--rulesdir",
2876
+ "--ext",
2877
+ "-f",
2878
+ "--format",
2879
+ "--max-warnings",
2880
+ "--parser",
2881
+ "--parser-options",
2882
+ "--plugin",
2883
+ "--global",
2884
+ "--env",
2885
+ "--report-unused-disable-directives-severity",
2886
+ "--resolve-plugins-relative-to",
2887
+ "-o",
2888
+ "--output-file",
2889
+ "--flag",
2890
+ "--inspect-config",
2891
+ "--stats",
2892
+ "--concurrency"
2893
+ ]);
2894
+ var hasUserPositional = (args) => {
2895
+ for (let i = 0;i < args.length; i++) {
2896
+ const arg = args[i];
2897
+ if (arg === undefined)
2898
+ continue;
2899
+ if (arg.startsWith("-")) {
2900
+ if (arg.includes("="))
2901
+ continue;
2902
+ if (FLAG_VALUE_FLAGS.has(arg))
2903
+ i++;
2904
+ continue;
2880
2905
  }
2906
+ return true;
2881
2907
  }
2882
- if (offenders.length === 0)
2883
- return;
2884
- const yellow = "\x1B[33m";
2885
- const reset = "\x1B[0m";
2886
- const bold = "\x1B[1m";
2887
- console.warn(`${yellow}${bold}\u26A0 ESLint flat-config warning${reset}${yellow}: found ${offenders.length} config block(s) where \`ignores\` lives alongside \`files\`. In ESLint v9, \`ignores\` is only a *global* ignore when it's the sole key in its config object \u2014 otherwise it just suppresses that block's own rules and ESLint still walks every other directory (including node_modules), making lint extremely slow.
2888
-
2889
- Move ignores into a standalone block at the top of your config:
2890
-
2891
- export default defineConfig([
2892
- { ignores: ['node_modules/**', 'dist/**', 'build/**', '.absolutejs/**'] },
2893
- pluginJs.configs.recommended,
2894
- ...
2895
- ]);
2896
-
2897
- Detected at: ${configPath2}${reset}`);
2908
+ return false;
2909
+ };
2910
+ var findConfigPath = () => {
2911
+ const cwd = process.cwd();
2912
+ for (const name of CONFIG_CANDIDATES) {
2913
+ const candidate = resolve4(cwd, name);
2914
+ if (existsSync6(candidate))
2915
+ return candidate;
2916
+ }
2917
+ return null;
2898
2918
  };
2899
2919
  var hasKey = (objectLiteralSource, key) => {
2900
2920
  const pattern = new RegExp(`(^|[\\s,{])${key}\\s*:`, "m");
2901
2921
  return pattern.test(objectLiteralSource);
2902
2922
  };
2923
+ var NON_GLOBAL_IGNORE_KEYS = [
2924
+ "files",
2925
+ "rules",
2926
+ "plugins",
2927
+ "languageOptions",
2928
+ "linterOptions",
2929
+ "processor",
2930
+ "settings",
2931
+ "extends"
2932
+ ];
2933
+ var isGlobalIgnoresBlock = (block) => {
2934
+ if (!hasKey(block, "ignores"))
2935
+ return false;
2936
+ return !NON_GLOBAL_IGNORE_KEYS.some((key) => hasKey(block, key));
2937
+ };
2903
2938
  var extractTopLevelObjectLiterals = (source) => {
2904
2939
  const arrayStart = source.search(/defineConfig\s*\(\s*\[|export\s+default\s*\[/);
2905
2940
  if (arrayStart === -1)
@@ -2968,6 +3003,42 @@ var extractTopLevelObjectLiterals = (source) => {
2968
3003
  }
2969
3004
  return blocks;
2970
3005
  };
3006
+ var checkForMisplacedIgnores = () => {
3007
+ const configPath2 = findConfigPath();
3008
+ if (!configPath2)
3009
+ return;
3010
+ let source;
3011
+ try {
3012
+ source = readFileSync5(configPath2, "utf-8");
3013
+ } catch {
3014
+ return;
3015
+ }
3016
+ const blocks = extractTopLevelObjectLiterals(source);
3017
+ if (blocks.some(isGlobalIgnoresBlock))
3018
+ return;
3019
+ let offenderCount = 0;
3020
+ for (const block of blocks) {
3021
+ if (hasKey(block, "ignores") && hasKey(block, "files")) {
3022
+ offenderCount++;
3023
+ }
3024
+ }
3025
+ if (offenderCount === 0)
3026
+ return;
3027
+ const yellow = "\x1B[33m";
3028
+ const reset = "\x1B[0m";
3029
+ const bold = "\x1B[1m";
3030
+ console.warn(`${yellow}${bold}\u26A0 ESLint flat-config warning${reset}${yellow}: found ${offenderCount} config block(s) where \`ignores\` lives alongside \`files\`. In ESLint v9, \`ignores\` is only a *global* ignore when it's the sole key in its config object \u2014 otherwise it just suppresses that block's own rules and ESLint still walks every other directory (including node_modules), making lint extremely slow.
3031
+
3032
+ Move ignores into a standalone block at the top of your config:
3033
+
3034
+ export default defineConfig([
3035
+ { ignores: ['node_modules/**', 'dist/**', 'build/**', '.absolutejs/**'] },
3036
+ pluginJs.configs.recommended,
3037
+ ...
3038
+ ]);
3039
+
3040
+ Detected at: ${configPath2}${reset}`);
3041
+ };
2971
3042
  var formatDuration = (ms) => {
2972
3043
  if (ms < 1000)
2973
3044
  return `${ms}ms`;
@@ -2977,20 +3048,34 @@ var formatDuration = (ms) => {
2977
3048
  const seconds = Math.round(ms % 60000 / 1000);
2978
3049
  return `${minutes}m ${seconds}s`;
2979
3050
  };
3051
+ var handleClearCache = (cacheLocation) => {
3052
+ try {
3053
+ rmSync2(cacheLocation, { force: true });
3054
+ console.log(`\x1B[32m\u2713\x1B[0m Cleared cache: ${cacheLocation}`);
3055
+ } catch (err) {
3056
+ console.error(`\x1B[31m\u2717\x1B[0m Failed to clear cache at ${cacheLocation}:`, err);
3057
+ process.exit(1);
3058
+ }
3059
+ };
2980
3060
  var eslint = async (args) => {
3061
+ const cacheLocation = getCacheLocation();
3062
+ if (args.includes("--clear-cache")) {
3063
+ handleClearCache(cacheLocation);
3064
+ return;
3065
+ }
2981
3066
  checkForMisplacedIgnores();
2982
3067
  const command = [
2983
3068
  "bun",
2984
3069
  "eslint",
2985
3070
  "--cache",
2986
3071
  "--cache-location",
2987
- CACHE_LOCATION,
3072
+ cacheLocation,
2988
3073
  ...args,
2989
- "."
3074
+ ...hasUserPositional(args) ? [] : ["."]
2990
3075
  ];
2991
3076
  const dim = "\x1B[2m";
2992
3077
  const reset = "\x1B[0m";
2993
- console.log(`${dim}cache: ${CACHE_LOCATION} (subsequent runs only re-lint changed files)${reset}`);
3078
+ console.log(`${dim}cache: ${cacheLocation} (subsequent runs only re-lint changed files)${reset}`);
2994
3079
  const startedAt = Date.now();
2995
3080
  const proc = Bun.spawn(command, {
2996
3081
  stderr: "inherit",