22
 å    import { rulesDisabledForVueAstroAndSvelteFiles } from './constants.js';

// Some type helpers for better type inference
type LegacyConfig = {
  rules?: Record<string, 'off'>;
  overrides?: {
    files: string[];
    excludedFiles?: string[];
    rules?: Record<string, 'off'>;
  }[];
};

type FlatConfig = {
  name?: string;
  rules?: Record<string, 'off'>;
  ignores?: string[];
};

// for eslint legacy configuration
export const overrideDisabledRulesForVueAndSvelteFiles = <C extends LegacyConfig>(config: C): C => {
  const foundRules = Object.keys(config.rules!).filter((rule) =>
    rulesDisabledForVueAstroAndSvelteFiles.includes(rule)
  );

  if (foundRules.length === 0) {
    return config;
  }

  const newConfig = structuredClone(config);

  newConfig.overrides = [
    {
      // classic configs use glob syntax
      files: ['*.*'],
      excludedFiles: ['*.vue', '*.svelte', '*.astro'],
      rules: {},
    },
  ];

  for (const rule of foundRules) {
    delete newConfig.rules![rule];
    newConfig.overrides[0].rules![rule] = 'off';
  }

  return newConfig;
};

export type SplittedFlatConfig<C extends FlatConfig> = [C] | [C, FlatConfig];

// for eslint flat configuration
export const splitDisabledRulesForVueAstroAndSvelteFiles = <C extends FlatConfig>(
  config: C
): SplittedFlatConfig<C> => {
  const foundRules = Object.keys(config.rules!).filter((rule) =>
    rulesDisabledForVueAstroAndSvelteFiles.includes(rule)
  );

  if (foundRules.length === 0) {
    return [config];
  }

  const oldConfig = structuredClone(config);

  const newConfig: FlatConfig = {
    // flat configs use minimatch syntax
    name: 'oxlint/vue-svelte-astro-exceptions',
    ignores: ['**/*.vue', '**/*.svelte', '**/*.astro'],
    rules: {},
  };

  for (const rule of foundRules) {
    delete oldConfig.rules![rule];
    newConfig.rules![rule] = 'off';
  }

  return [oldConfig, newConfig];
};

export const splitDisabledRulesForVueAstroAndSvelteFilesDeep = <
  T extends Record<string, FlatConfig>,
>(
  config: T
): { [K in keyof T]: SplittedFlatConfig<T[K]> } => {
  const result = {} as { [K in keyof T]: SplittedFlatConfig<T[K]> };

  for (const name in config) {
    result[name] = splitDisabledRulesForVueAstroAndSvelteFiles(config[name]);
  }

  return result;
};
  7   ˆl—Ým_Jõ!®Å2 ¸ÛWmLZ7ÿ�þD Ê³r¼V™•Ù
Ë@þÄƒxBgËÉÈ      #!/bin/sh
# original mktexlsr -- create or rebuild ls-R.
# 
# (If you change or delete the word `original' on the previous line,
# installation won't write this script over yours.)
#
# Suitable for calling from cron, as in:
# 0 * * * * cd /your/texmf/root && /usr/local/texlive/bin/mktexlsr
# 
# Originally written as `texhash' by Thomas Esser, Okt., 1994.
# Public domain.

version='$Id: mktexlsr 56842 2020-11-02 23:00:54Z karl $'
progname=`echo $0 | sed 's%.*/%%'`

usage="Usage: $progname [OPTION]... [DIR]...

Rebuild ls-R filename databases used by TeX.  If one or more arguments
DIRS are given, these are used as the directories in which to build
ls-R. Else all directories in the search path for ls-R files
(\$TEXMFDBS) are used.

Options:
  --dry-run  do not actually update anything
  --help     display this help and exit 
  --quiet    cancel --verbose
  --silent   same as --quiet
  --verbose  explain what is being done
  --version  output version information and exit
  
If standard input is a terminal, --verbose is on by default.

For more information, see the \`Filename database' section of
Kpathsea manual available at http://tug.org/kpathsea.

Report bugs to: tex-k@tug.org
TeX Live home page: <http://tug.org/texlive/>
"

# The simple PATH-prepending approach we take in other scripts doesn't
# handle DOS/Windows, but we don't use the shell scripts on Windows
# anyway, and does anyone want current TL on DOS or DJGPP?  Maybe they
# can maintain their own changes if so.  Leaving this code though, since
# it's always been here ...

# MS-DOS and MS-Windows define $COMSPEC or $ComSpec and use `;' to separate
# directories in path lists whereas Unix uses `:'.  Make an exception for
# Cygwin, which pretends to b