arui-presets-lint 9.4.1 → 9.5.0

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/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## 9.5.0
2
+
3
+ ### Minor Changes
4
+
5
+ - [#118](https://github.com/core-ds/arui-presets-lint/pull/118) [`1057d60`](https://github.com/core-ds/arui-presets-lint/commit/1057d601f36fb1f06f70741f0f15b49aa1ed3c98) Thanks [@kiskv](https://github.com/kiskv)! - Библиотека перенесена в монорепозиторий, подняты зависимости. Конфиги prettier, stylelint и commitlint переведены на typescript
6
+
7
+ ### Patch Changes
8
+
9
+ - Updated dependencies [[`1057d60`](https://github.com/core-ds/arui-presets-lint/commit/1057d601f36fb1f06f70741f0f15b49aa1ed3c98)]:
10
+ - @alfalab/stylelint-core-vars@2.1.0
11
+
1
12
  ## 9.4.1
2
13
 
3
14
  ### Patch Changes
package/README.md CHANGED
@@ -234,29 +234,3 @@ npx --no-install commitlint --print-config > commitlintconfig.txt
234
234
  3. Включить Prettier
235
235
  - [Расширение для VS Code](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
236
236
  - [Инструкция для Webstorm](https://prettier.io/docs/en/webstorm.html)
237
-
238
- ## Лицензия
239
-
240
- ```
241
- The MIT License (MIT)
242
-
243
- Copyright (c) 2026 core-ds contributors
244
-
245
- Permission is hereby granted, free of charge, to any person obtaining a copy
246
- of this software and associated documentation files (the "Software"), to deal
247
- in the Software without restriction, including without limitation the rights
248
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
249
- copies of the Software, and to permit persons to whom the Software is
250
- furnished to do so, subject to the following conditions:
251
-
252
- The above copyright notice and this permission notice shall be included in
253
- all copies or substantial portions of the Software.
254
-
255
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
256
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
257
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
258
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
259
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
260
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
261
- THE SOFTWARE.
262
- ```
@@ -0,0 +1,87 @@
1
+ # Гид по миграции на arui-presets-lint@9
2
+
3
+ ## Введение
4
+
5
+ Несмотря на большое количество изменений в этом релизе, мигрировать довольно просто - все нюансы ваших проектов скорее всего уже учтены внутри конфига. Но кое-какие правки руками сделать придется, начнем по шагам:
6
+
7
+ 0. Собственно, обновить зависимость:
8
+
9
+ ```bash
10
+ yarn add arui-presets-lint@latest
11
+ ```
12
+
13
+ 1. Удалить свойство `eslintConfig` из package.json, и создать в корне проекта файл `eslint.config.mts` со следующим содержимым:
14
+
15
+ ```typescript
16
+ import { defineConfig } from 'arui-presets-lint/eslint/config';
17
+ import { eslintConfig } from 'arui-presets-lint/eslint';
18
+
19
+ export default defineConfig(eslintConfig);
20
+ ```
21
+
22
+ Если нужно добавить конфиги на уровне проекта, можно это сделать подобным образом:
23
+
24
+ ```typescript
25
+ import pluginCypress from 'eslint-plugin-cypress';
26
+ import { defineConfig } from 'arui-presets-lint/eslint/config';
27
+ import { eslintConfig } from 'arui-presets-lint/eslint';
28
+
29
+ export default defineConfig(eslintConfig, [
30
+ pluginCypress.configs.recommended,
31
+ {
32
+ rules: {
33
+ 'cypress/no-unnecessary-waiting': 'off',
34
+ },
35
+ },
36
+ // Тут лежат glob-паттерны файлов, которые нужно игнорировать в проекте. Возможно он вам не понадобится, так как глобальный игнор на основные файлы и папки уже настроен на уровне arui-presets-lint
37
+ ignores: []
38
+ ]);
39
+ ```
40
+
41
+ ^^ Тут мы добавляем eslint-plugin-cypress, и определяем кастомные правила на уровне проекта. Про новый формат конфига - подробности [тут](https://eslint.org/docs/latest/use/configure/configuration-files#configuration-objects)
42
+
43
+ > если нужно использовать плагины и правила, которые не поддерживают eslint 9, можно использовать для их подключения утилиты из пакета [@eslint/compat](https://www.npmjs.com/package/@eslint/compat)
44
+
45
+ 1. `tsconfig.eslint.json` и правила игнорирования
46
+
47
+ Ранее мы использовали кастомный tsconfig.eslint.json, например для того чтобы включить eslint для файлов в корневой директории - с переходом на [typescript-eslint projectService](https://typescript-eslint.io/blog/project-service/#introducing-the-project-service) он больше не нужен. Используйте основной tsconfig.json, а те файлы которые туда нельзя добавить, добавьте с помощью опции languageOptions.parserOptions.projectService.allowDefaultProject. Учтите что папки добавлять нельзя, так как это аффектит на производительность. Пример такого конфига:
48
+
49
+ ```typescript
50
+ import { eslintConfig } from 'arui-presets-lint/eslint';
51
+ import { defineConfig } from 'arui-presets-lint/eslint/config';
52
+
53
+ export default defineConfig(eslintConfig, [
54
+ {
55
+ languageOptions: {
56
+ parserOptions: {
57
+ projectService: {
58
+ // Это позволит eslint линтить файлы, даже если они не указаны в tsconfig.json
59
+ // Обратите внимание, что включить '**' тут нельзя, влияет на производительность!
60
+ // https://typescript-eslint.io/packages/parser/#allowdefaultproject
61
+ // Конретно тут - разрешаем линтить все файлы с расширениями .ts, .mts и .cts в корневой директории проекта
62
+ allowDefaultProject: ['*.ts', '*.mts', '*.cts'],
63
+ },
64
+ },
65
+ },
66
+ files: ['**/*.{ts,tsx,mts,cts,mtsx,ctsx}'],
67
+ },
68
+ ]);
69
+ ```
70
+
71
+ Так же можно исключить этот файл через globalIgnores (не рекомендуется), подробнее в README.md
72
+
73
+ 3. import >> import-x
74
+
75
+ Нужно пробежаться по проекту и заменить подобные комментарии:
76
+ // eslint-disable-next-line import/no-default-export на
77
+ // eslint-disable-next-line import-x/no-default-export
78
+
79
+ Так же все правила в конфиге которые начинаються на `import/` нужно заменить на `import-x/`. Других изменений делать не нужно, новый плагин полностью совместим со старым.
80
+
81
+ 4. Набор правил eslint изменился - но многие правятся с помощью автофикса. Сделаем это!
82
+
83
+ ```bash
84
+ yarn lint:fix
85
+ ```
86
+
87
+ Если вы заметили что откровенно "вредное" правило попало в набор, приходите сразу с пулл реквестом в https://github.com/core-ds/arui-presets-lint . Ваш вклад поможет сделать библиотеку лучше!
@@ -1,9 +1,8 @@
1
- declare namespace _default {
2
- let _extends: string;
3
- export { _extends as extends };
4
- export let rules: {
5
- 'scope-empty': (string | number)[];
6
- 'body-max-line-length': (string | number)[];
1
+ declare const _default: {
2
+ extends: string;
3
+ rules: {
4
+ 'scope-empty': [2, "never"];
5
+ 'body-max-line-length': [2, "always", number];
7
6
  };
8
- }
7
+ };
9
8
  export default _default;
@@ -1,3 +1,4 @@
1
+ import {} from '@commitlint/types';
1
2
  export default {
2
3
  extends: '@commitlint/config-conventional',
3
4
  rules: {
package/eslint/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { type Linter } from 'eslint';
2
2
  export declare const eslintConfig: Linter.Config;
3
+ export { defineConfig, globalIgnores, globals } from './config.js';
3
4
  export { type Linter } from 'eslint';
4
5
  export { type TSESLint } from '@typescript-eslint/utils';
package/eslint/index.js CHANGED
@@ -62,5 +62,6 @@ export const eslintConfig = [
62
62
  processor: 'check-file/eslint-processor-check-file',
63
63
  },
64
64
  ];
65
+ export { defineConfig, globalIgnores, globals } from './config.js';
65
66
  export {} from 'eslint';
66
67
  export {} from '@typescript-eslint/utils';
@@ -1,4 +1,4 @@
1
- # Refer for explanation to following link:
1
+ # Описание параметров тут:
2
2
  # https://lefthook.dev/configuration/
3
3
 
4
4
  pre-commit:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arui-presets-lint",
3
- "version": "9.4.1",
3
+ "version": "9.5.0",
4
4
  "description": "Config files for arui-apps",
5
5
  "author": "core-ds contributors",
6
6
  "license": "MIT",
@@ -11,12 +11,12 @@
11
11
  "url": "git+https://github.com/core-ds/arui-presets-lint.git"
12
12
  },
13
13
  "dependencies": {
14
- "@alfalab/stylelint-core-vars": "2.0.0",
15
- "@commitlint/cli": "20.5.0",
16
- "@commitlint/config-conventional": "20.5.0",
14
+ "@alfalab/stylelint-core-vars": "workspace:*",
15
+ "@commitlint/cli": "20.5.3",
16
+ "@commitlint/config-conventional": "20.5.3",
17
17
  "@eslint/js": "9.39.4",
18
18
  "@types/eslint-plugin-jsx-a11y": "6.10.1",
19
- "@typescript-eslint/utils": "8.58.2",
19
+ "@typescript-eslint/utils": "8.59.1",
20
20
  "eslint": "9.39.4",
21
21
  "eslint-config-flat-gitignore": "2.3.0",
22
22
  "eslint-import-resolver-typescript": "4.4.4",
@@ -26,40 +26,39 @@
26
26
  "eslint-plugin-jsx-a11y": "6.10.2",
27
27
  "eslint-plugin-n": "17.24.0",
28
28
  "eslint-plugin-react": "7.37.5",
29
- "eslint-plugin-react-hooks": "7.0.1",
29
+ "eslint-plugin-react-hooks": "7.1.1",
30
30
  "eslint-plugin-simple-import-sort": "13.0.0",
31
31
  "eslint-plugin-unicorn": "64.0.0",
32
32
  "execa": "^9.6.1",
33
33
  "globals": "^17.0.0",
34
34
  "jiti": "^2.6.1",
35
- "lefthook": "2.1.5",
36
- "prettier": "3.8.2",
35
+ "lefthook": "2.1.6",
36
+ "prettier": "3.8.3",
37
37
  "stylelint": "16.26.1",
38
- "typescript-eslint": "8.58.2"
38
+ "typescript-eslint": "8.59.1"
39
39
  },
40
40
  "engines": {
41
41
  "node": ">=18.18.0"
42
42
  },
43
43
  "devDependencies": {
44
- "@alfalab/core-components": "50.10.0",
45
- "@changesets/changelog-github": "0.6.0",
46
- "@changesets/cli": "2.30.0",
44
+ "@alfalab/core-components": "50.12.1",
45
+ "@changesets/cli": "2.31.0",
46
+ "@commitlint/types": "20.5.0",
47
47
  "@types/node": "24.12.2",
48
48
  "@types/react": "19.2.14",
49
49
  "@vitest/coverage-istanbul": "4.1.5",
50
50
  "copyfiles": "2.4.1",
51
- "es-toolkit": "1.45.1",
51
+ "es-toolkit": "1.46.1",
52
52
  "eslint-config-prettier": "10.1.8",
53
53
  "eslint-vitest-rule-tester": "3.1.0",
54
54
  "react": "19.2.5",
55
55
  "rimraf": "6.1.3",
56
56
  "tsx": "4.21.0",
57
- "typescript": "6.0.2",
58
- "vite": "8.0.10",
57
+ "typescript": "6.0.3",
59
58
  "vitest": "4.1.5"
60
59
  },
61
60
  "scripts": {
62
- "build": "rimraf dist && tsc -p tsconfig.build.json && copyfiles 'README.md' 'CHANGELOG.md' 'lefthook/*.yml' 'eslint/**/*.md' dist",
61
+ "build": "rimraf dist && tsc -p tsconfig.build.json && copyfiles 'lefthook/*.yml' '**/*.md' dist && tsx cli/build-dist-package.ts",
63
62
  "test": "tsc --noEmit && eslint-config-prettier ./eslint/index.ts && tsx ./cli/duplicates-checker.ts && yarn lint && yarn test:unit",
64
63
  "test:unit": "vitest --run --coverage",
65
64
  "lint": "yarn lint:styles && yarn lint:scripts && yarn format:check",
@@ -67,15 +66,7 @@
67
66
  "lint:styles": "tsx ./cli/index.mts styles",
68
67
  "lint:scripts": "tsx ./cli/index.mts scripts",
69
68
  "format": "tsx ./cli/index.mts format",
70
- "format:check": "tsx ./cli/index.mts format:check",
71
- "release": "changeset publish",
72
- "release:snapshot": "changeset publish --tag snapshot --no-git-tag",
73
- "version-package": "changeset version",
74
- "version-package:snapshot": "changeset version --snapshot snapshot"
75
- },
76
- "prettier": "./prettier",
77
- "stylelint": {
78
- "extends": "./stylelint"
69
+ "format:check": "tsx ./cli/index.mts format:check"
79
70
  },
80
71
  "exports": {
81
72
  "./eslint": {
@@ -90,20 +81,32 @@
90
81
  "types": "./eslint/rules/index.d.ts",
91
82
  "import": "./eslint/rules/index.js"
92
83
  },
93
- "./prettier": "./prettier/index.js",
94
- "./commitlint": "./commitlint/index.js",
95
- "./stylelint": "./stylelint/index.js",
96
84
  "./eslint/plugins": {
97
85
  "types": "./eslint/plugins/index.d.ts",
98
86
  "import": "./eslint/plugins/index.js"
87
+ },
88
+ "./prettier": {
89
+ "types": "./prettier/index.d.ts",
90
+ "import": "./prettier/index.js"
91
+ },
92
+ "./commitlint": {
93
+ "types": "./commitlint/index.d.ts",
94
+ "import": "./commitlint/index.js"
95
+ },
96
+ "./stylelint": {
97
+ "types": "./stylelint/index.d.ts",
98
+ "import": "./stylelint/index.js"
99
99
  }
100
100
  },
101
- "commitlint": {
102
- "extends": "./commitlint"
103
- },
104
- "packageManager": "yarn@4.13.0",
105
101
  "publishConfig": {
106
102
  "directory": "dist",
107
103
  "access": "public"
108
- }
104
+ },
105
+ "commitlint": {
106
+ "extends": "./commitlint/index.ts"
107
+ },
108
+ "stylelint": {
109
+ "extends": "./stylelint/index.ts"
110
+ },
111
+ "prettier": "./prettier/index.ts"
109
112
  }
@@ -1,9 +1,9 @@
1
- declare namespace _default {
2
- let printWidth: number;
3
- let singleQuote: boolean;
4
- let jsxSingleQuote: boolean;
5
- let tabWidth: number;
6
- let trailingComma: string;
7
- let endOfLine: string;
8
- }
1
+ declare const _default: {
2
+ printWidth: number;
3
+ singleQuote: true;
4
+ jsxSingleQuote: true;
5
+ tabWidth: number;
6
+ trailingComma: "all";
7
+ endOfLine: "auto";
8
+ };
9
9
  export default _default;
package/prettier/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import {} from 'prettier';
1
2
  export default {
2
3
  printWidth: 100,
3
4
  singleQuote: true,
@@ -1,5 +1,5 @@
1
- declare namespace _default {
2
- let rules: {
1
+ declare const _default: {
2
+ rules: {
3
3
  'block-no-empty': boolean;
4
4
  'color-hex-length': string;
5
5
  'color-no-invalid-hex': boolean;
@@ -52,8 +52,8 @@ declare namespace _default {
52
52
  ignore: string[];
53
53
  })[];
54
54
  };
55
- let plugins: string[];
56
- let overrides: {
55
+ plugins: string[];
56
+ overrides: {
57
57
  files: string[];
58
58
  rules: {
59
59
  'selector-class-pattern': (string | {
@@ -63,5 +63,5 @@ declare namespace _default {
63
63
  })[];
64
64
  };
65
65
  }[];
66
- }
66
+ };
67
67
  export default _default;
@@ -1,3 +1,4 @@
1
+ import {} from 'stylelint';
1
2
  export default {
2
3
  rules: {
3
4
  // Запрещает пустые блоки
@@ -1 +0,0 @@
1
- export {};
@@ -1,70 +0,0 @@
1
- /* eslint-disable */
2
- var jumpToCode = (function init() {
3
- // Classes of code we would like to highlight in the file view
4
- var missingCoverageClasses = ['.cbranch-no', '.cstat-no', '.fstat-no'];
5
- // Elements to highlight in the file listing view
6
- var fileListingElements = ['td.pct.low'];
7
- // We don't want to select elements that are direct descendants of another match
8
- var notSelector = ':not(' + missingCoverageClasses.join('):not(') + ') > '; // becomes `:not(a):not(b) > `
9
- // Selector that finds elements on the page to which we can jump
10
- var selector = fileListingElements.join(', ') +
11
- ', ' +
12
- notSelector +
13
- missingCoverageClasses.join(', ' + notSelector); // becomes `:not(a):not(b) > a, :not(a):not(b) > b`
14
- // The NodeList of matching elements
15
- var missingCoverageElements = document.querySelectorAll(selector);
16
- var currentIndex;
17
- function toggleClass(index) {
18
- missingCoverageElements
19
- .item(currentIndex)
20
- .classList.remove('highlighted');
21
- missingCoverageElements.item(index).classList.add('highlighted');
22
- }
23
- function makeCurrent(index) {
24
- toggleClass(index);
25
- currentIndex = index;
26
- missingCoverageElements.item(index).scrollIntoView({
27
- behavior: 'smooth',
28
- block: 'center',
29
- inline: 'center'
30
- });
31
- }
32
- function goToPrevious() {
33
- var nextIndex = 0;
34
- if (typeof currentIndex !== 'number' || currentIndex === 0) {
35
- nextIndex = missingCoverageElements.length - 1;
36
- }
37
- else if (missingCoverageElements.length > 1) {
38
- nextIndex = currentIndex - 1;
39
- }
40
- makeCurrent(nextIndex);
41
- }
42
- function goToNext() {
43
- var nextIndex = 0;
44
- if (typeof currentIndex === 'number' &&
45
- currentIndex < missingCoverageElements.length - 1) {
46
- nextIndex = currentIndex + 1;
47
- }
48
- makeCurrent(nextIndex);
49
- }
50
- return function jump(event) {
51
- if (document.getElementById('fileSearch') === document.activeElement &&
52
- document.activeElement != null) {
53
- // if we're currently focused on the search input, we don't want to navigate
54
- return;
55
- }
56
- switch (event.which) {
57
- case 78: // n
58
- case 74: // j
59
- goToNext();
60
- break;
61
- case 66: // b
62
- case 75: // k
63
- case 80: // p
64
- goToPrevious();
65
- break;
66
- }
67
- };
68
- })();
69
- window.addEventListener('keydown', jumpToCode);
70
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,477 +0,0 @@
1
- /* eslint-disable */
2
- window.PR_SHOULD_USE_CONTINUATION = true;
3
- (function () { var h = ["break,continue,do,else,for,if,return,while"]; var u = [h, "auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"]; var p = [u, "catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"]; var l = [p, "alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"]; var x = [p, "abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"]; var R = [x, "as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"]; var r = "all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes"; var w = [p, "debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"]; var s = "caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"; var I = [h, "and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"]; var f = [h, "alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"]; var H = [h, "case,done,elif,esac,eval,fi,function,in,local,set,then,until"]; var A = [l, R, w, s + I, f, H]; var e = /^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/; var C = "str"; var z = "kwd"; var j = "com"; var O = "typ"; var G = "lit"; var L = "pun"; var F = "pln"; var m = "tag"; var E = "dec"; var J = "src"; var P = "atn"; var n = "atv"; var N = "nocode"; var M = "(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*"; function k(Z) { var ad = 0; var S = false; var ac = false; for (var V = 0, U = Z.length; V < U; ++V) {
4
- var ae = Z[V];
5
- if (ae.ignoreCase) {
6
- ac = true;
7
- }
8
- else {
9
- if (/[a-z]/i.test(ae.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi, ""))) {
10
- S = true;
11
- ac = false;
12
- break;
13
- }
14
- }
15
- } var Y = { b: 8, t: 9, n: 10, v: 11, f: 12, r: 13 }; function ab(ah) { var ag = ah.charCodeAt(0); if (ag !== 92) {
16
- return ag;
17
- } var af = ah.charAt(1); ag = Y[af]; if (ag) {
18
- return ag;
19
- }
20
- else {
21
- if ("0" <= af && af <= "7") {
22
- return parseInt(ah.substring(1), 8);
23
- }
24
- else {
25
- if (af === "u" || af === "x") {
26
- return parseInt(ah.substring(2), 16);
27
- }
28
- else {
29
- return ah.charCodeAt(1);
30
- }
31
- }
32
- } } function T(af) { if (af < 32) {
33
- return (af < 16 ? "\\x0" : "\\x") + af.toString(16);
34
- } var ag = String.fromCharCode(af); if (ag === "\\" || ag === "-" || ag === "[" || ag === "]") {
35
- ag = "\\" + ag;
36
- } return ag; } function X(am) { var aq = am.substring(1, am.length - 1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]", "g")); var ak = []; var af = []; var ao = aq[0] === "^"; for (var ar = ao ? 1 : 0, aj = aq.length; ar < aj; ++ar) {
37
- var ah = aq[ar];
38
- if (/\\[bdsw]/i.test(ah)) {
39
- ak.push(ah);
40
- }
41
- else {
42
- var ag = ab(ah);
43
- var al;
44
- if (ar + 2 < aj && "-" === aq[ar + 1]) {
45
- al = ab(aq[ar + 2]);
46
- ar += 2;
47
- }
48
- else {
49
- al = ag;
50
- }
51
- af.push([ag, al]);
52
- if (!(al < 65 || ag > 122)) {
53
- if (!(al < 65 || ag > 90)) {
54
- af.push([Math.max(65, ag) | 32, Math.min(al, 90) | 32]);
55
- }
56
- if (!(al < 97 || ag > 122)) {
57
- af.push([Math.max(97, ag) & ~32, Math.min(al, 122) & ~32]);
58
- }
59
- }
60
- }
61
- } af.sort(function (av, au) { return (av[0] - au[0]) || (au[1] - av[1]); }); var ai = []; var ap = [NaN, NaN]; for (var ar = 0; ar < af.length; ++ar) {
62
- var at = af[ar];
63
- if (at[0] <= ap[1] + 1) {
64
- ap[1] = Math.max(ap[1], at[1]);
65
- }
66
- else {
67
- ai.push(ap = at);
68
- }
69
- } var an = ["["]; if (ao) {
70
- an.push("^");
71
- } an.push.apply(an, ak); for (var ar = 0; ar < ai.length; ++ar) {
72
- var at = ai[ar];
73
- an.push(T(at[0]));
74
- if (at[1] > at[0]) {
75
- if (at[1] + 1 > at[0]) {
76
- an.push("-");
77
- }
78
- an.push(T(at[1]));
79
- }
80
- } an.push("]"); return an.join(""); } function W(al) { var aj = al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)", "g")); var ah = aj.length; var an = []; for (var ak = 0, am = 0; ak < ah; ++ak) {
81
- var ag = aj[ak];
82
- if (ag === "(") {
83
- ++am;
84
- }
85
- else {
86
- if ("\\" === ag.charAt(0)) {
87
- var af = +ag.substring(1);
88
- if (af && af <= am) {
89
- an[af] = -1;
90
- }
91
- }
92
- }
93
- } for (var ak = 1; ak < an.length; ++ak) {
94
- if (-1 === an[ak]) {
95
- an[ak] = ++ad;
96
- }
97
- } for (var ak = 0, am = 0; ak < ah; ++ak) {
98
- var ag = aj[ak];
99
- if (ag === "(") {
100
- ++am;
101
- if (an[am] === undefined) {
102
- aj[ak] = "(?:";
103
- }
104
- }
105
- else {
106
- if ("\\" === ag.charAt(0)) {
107
- var af = +ag.substring(1);
108
- if (af && af <= am) {
109
- aj[ak] = "\\" + an[am];
110
- }
111
- }
112
- }
113
- } for (var ak = 0, am = 0; ak < ah; ++ak) {
114
- if ("^" === aj[ak] && "^" !== aj[ak + 1]) {
115
- aj[ak] = "";
116
- }
117
- } if (al.ignoreCase && S) {
118
- for (var ak = 0; ak < ah; ++ak) {
119
- var ag = aj[ak];
120
- var ai = ag.charAt(0);
121
- if (ag.length >= 2 && ai === "[") {
122
- aj[ak] = X(ag);
123
- }
124
- else {
125
- if (ai !== "\\") {
126
- aj[ak] = ag.replace(/[a-zA-Z]/g, function (ao) { var ap = ao.charCodeAt(0); return "[" + String.fromCharCode(ap & ~32, ap | 32) + "]"; });
127
- }
128
- }
129
- }
130
- } return aj.join(""); } var aa = []; for (var V = 0, U = Z.length; V < U; ++V) {
131
- var ae = Z[V];
132
- if (ae.global || ae.multiline) {
133
- throw new Error("" + ae);
134
- }
135
- aa.push("(?:" + W(ae) + ")");
136
- } return new RegExp(aa.join("|"), ac ? "gi" : "g"); } function a(V) { var U = /(?:^|\s)nocode(?:\s|$)/; var X = []; var T = 0; var Z = []; var W = 0; var S; if (V.currentStyle) {
137
- S = V.currentStyle.whiteSpace;
138
- }
139
- else {
140
- if (window.getComputedStyle) {
141
- S = document.defaultView.getComputedStyle(V, null).getPropertyValue("white-space");
142
- }
143
- } var Y = S && "pre" === S.substring(0, 3); function aa(ab) { switch (ab.nodeType) {
144
- case 1:
145
- if (U.test(ab.className)) {
146
- return;
147
- }
148
- for (var ae = ab.firstChild; ae; ae = ae.nextSibling) {
149
- aa(ae);
150
- }
151
- var ad = ab.nodeName;
152
- if ("BR" === ad || "LI" === ad) {
153
- X[W] = "\n";
154
- Z[W << 1] = T++;
155
- Z[(W++ << 1) | 1] = ab;
156
- }
157
- break;
158
- case 3:
159
- case 4:
160
- var ac = ab.nodeValue;
161
- if (ac.length) {
162
- if (!Y) {
163
- ac = ac.replace(/[ \t\r\n]+/g, " ");
164
- }
165
- else {
166
- ac = ac.replace(/\r\n?/g, "\n");
167
- }
168
- X[W] = ac;
169
- Z[W << 1] = T;
170
- T += ac.length;
171
- Z[(W++ << 1) | 1] = ab;
172
- }
173
- break;
174
- } } aa(V); return { sourceCode: X.join("").replace(/\n$/, ""), spans: Z }; } function B(S, U, W, T) { if (!U) {
175
- return;
176
- } var V = { sourceCode: U, basePos: S }; W(V); T.push.apply(T, V.decorations); } var v = /\S/; function o(S) { var V = undefined; for (var U = S.firstChild; U; U = U.nextSibling) {
177
- var T = U.nodeType;
178
- V = (T === 1) ? (V ? S : U) : (T === 3) ? (v.test(U.nodeValue) ? S : V) : V;
179
- } return V === S ? undefined : V; } function g(U, T) { var S = {}; var V; (function () { var ad = U.concat(T); var ah = []; var ag = {}; for (var ab = 0, Z = ad.length; ab < Z; ++ab) {
180
- var Y = ad[ab];
181
- var ac = Y[3];
182
- if (ac) {
183
- for (var ae = ac.length; --ae >= 0;) {
184
- S[ac.charAt(ae)] = Y;
185
- }
186
- }
187
- var af = Y[1];
188
- var aa = "" + af;
189
- if (!ag.hasOwnProperty(aa)) {
190
- ah.push(af);
191
- ag[aa] = null;
192
- }
193
- } ah.push(/[\0-\uffff]/); V = k(ah); })(); var X = T.length; var W = function (ah) { var Z = ah.sourceCode, Y = ah.basePos; var ad = [Y, F]; var af = 0; var an = Z.match(V) || []; var aj = {}; for (var ae = 0, aq = an.length; ae < aq; ++ae) {
194
- var ag = an[ae];
195
- var ap = aj[ag];
196
- var ai = void 0;
197
- var am;
198
- if (typeof ap === "string") {
199
- am = false;
200
- }
201
- else {
202
- var aa = S[ag.charAt(0)];
203
- if (aa) {
204
- ai = ag.match(aa[1]);
205
- ap = aa[0];
206
- }
207
- else {
208
- for (var ao = 0; ao < X; ++ao) {
209
- aa = T[ao];
210
- ai = ag.match(aa[1]);
211
- if (ai) {
212
- ap = aa[0];
213
- break;
214
- }
215
- }
216
- if (!ai) {
217
- ap = F;
218
- }
219
- }
220
- am = ap.length >= 5 && "lang-" === ap.substring(0, 5);
221
- if (am && !(ai && typeof ai[1] === "string")) {
222
- am = false;
223
- ap = J;
224
- }
225
- if (!am) {
226
- aj[ag] = ap;
227
- }
228
- }
229
- var ab = af;
230
- af += ag.length;
231
- if (!am) {
232
- ad.push(Y + ab, ap);
233
- }
234
- else {
235
- var al = ai[1];
236
- var ak = ag.indexOf(al);
237
- var ac = ak + al.length;
238
- if (ai[2]) {
239
- ac = ag.length - ai[2].length;
240
- ak = ac - al.length;
241
- }
242
- var ar = ap.substring(5);
243
- B(Y + ab, ag.substring(0, ak), W, ad);
244
- B(Y + ab + ak, al, q(ar, al), ad);
245
- B(Y + ab + ac, ag.substring(ac), W, ad);
246
- }
247
- } ah.decorations = ad; }; return W; } function i(T) { var W = [], S = []; if (T.tripleQuotedStrings) {
248
- W.push([C, /^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/, null, "'\""]);
249
- }
250
- else {
251
- if (T.multiLineStrings) {
252
- W.push([C, /^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/, null, "'\"`"]);
253
- }
254
- else {
255
- W.push([C, /^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/, null, "\"'"]);
256
- }
257
- } if (T.verbatimStrings) {
258
- S.push([C, /^@\"(?:[^\"]|\"\")*(?:\"|$)/, null]);
259
- } var Y = T.hashComments; if (Y) {
260
- if (T.cStyleComments) {
261
- if (Y > 1) {
262
- W.push([j, /^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/, null, "#"]);
263
- }
264
- else {
265
- W.push([j, /^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/, null, "#"]);
266
- }
267
- S.push([C, /^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/, null]);
268
- }
269
- else {
270
- W.push([j, /^#[^\r\n]*/, null, "#"]);
271
- }
272
- } if (T.cStyleComments) {
273
- S.push([j, /^\/\/[^\r\n]*/, null]);
274
- S.push([j, /^\/\*[\s\S]*?(?:\*\/|$)/, null]);
275
- } if (T.regexLiterals) {
276
- var X = ("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");
277
- S.push(["lang-regex", new RegExp("^" + M + "(" + X + ")")]);
278
- } var V = T.types; if (V) {
279
- S.push([O, V]);
280
- } var U = ("" + T.keywords).replace(/^ | $/g, ""); if (U.length) {
281
- S.push([z, new RegExp("^(?:" + U.replace(/[\s,]+/g, "|") + ")\\b"), null]);
282
- } W.push([F, /^\s+/, null, " \r\n\t\xA0"]); S.push([G, /^@[a-z_$][a-z_$@0-9]*/i, null], [O, /^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/, null], [F, /^[a-z_$][a-z_$@0-9]*/i, null], [G, new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*", "i"), null, "0123456789"], [F, /^\\[\s\S]?/, null], [L, /^.[^\s\w\.$@\'\"\`\/\#\\]*/, null]); return g(W, S); } var K = i({ keywords: A, hashComments: true, cStyleComments: true, multiLineStrings: true, regexLiterals: true }); function Q(V, ag) { var U = /(?:^|\s)nocode(?:\s|$)/; var ab = /\r\n?|\n/; var ac = V.ownerDocument; var S; if (V.currentStyle) {
283
- S = V.currentStyle.whiteSpace;
284
- }
285
- else {
286
- if (window.getComputedStyle) {
287
- S = ac.defaultView.getComputedStyle(V, null).getPropertyValue("white-space");
288
- }
289
- } var Z = S && "pre" === S.substring(0, 3); var af = ac.createElement("LI"); while (V.firstChild) {
290
- af.appendChild(V.firstChild);
291
- } var W = [af]; function ae(al) { switch (al.nodeType) {
292
- case 1:
293
- if (U.test(al.className)) {
294
- break;
295
- }
296
- if ("BR" === al.nodeName) {
297
- ad(al);
298
- if (al.parentNode) {
299
- al.parentNode.removeChild(al);
300
- }
301
- }
302
- else {
303
- for (var an = al.firstChild; an; an = an.nextSibling) {
304
- ae(an);
305
- }
306
- }
307
- break;
308
- case 3:
309
- case 4:
310
- if (Z) {
311
- var am = al.nodeValue;
312
- var aj = am.match(ab);
313
- if (aj) {
314
- var ai = am.substring(0, aj.index);
315
- al.nodeValue = ai;
316
- var ah = am.substring(aj.index + aj[0].length);
317
- if (ah) {
318
- var ak = al.parentNode;
319
- ak.insertBefore(ac.createTextNode(ah), al.nextSibling);
320
- }
321
- ad(al);
322
- if (!ai) {
323
- al.parentNode.removeChild(al);
324
- }
325
- }
326
- }
327
- break;
328
- } } function ad(ak) { while (!ak.nextSibling) {
329
- ak = ak.parentNode;
330
- if (!ak) {
331
- return;
332
- }
333
- } function ai(al, ar) { var aq = ar ? al.cloneNode(false) : al; var ao = al.parentNode; if (ao) {
334
- var ap = ai(ao, 1);
335
- var an = al.nextSibling;
336
- ap.appendChild(aq);
337
- for (var am = an; am; am = an) {
338
- an = am.nextSibling;
339
- ap.appendChild(am);
340
- }
341
- } return aq; } var ah = ai(ak.nextSibling, 0); for (var aj; (aj = ah.parentNode) && aj.nodeType === 1;) {
342
- ah = aj;
343
- } W.push(ah); } for (var Y = 0; Y < W.length; ++Y) {
344
- ae(W[Y]);
345
- } if (ag === (ag | 0)) {
346
- W[0].setAttribute("value", ag);
347
- } var aa = ac.createElement("OL"); aa.className = "linenums"; var X = Math.max(0, ((ag - 1)) | 0) || 0; for (var Y = 0, T = W.length; Y < T; ++Y) {
348
- af = W[Y];
349
- af.className = "L" + ((Y + X) % 10);
350
- if (!af.firstChild) {
351
- af.appendChild(ac.createTextNode("\xA0"));
352
- }
353
- aa.appendChild(af);
354
- } V.appendChild(aa); } function D(ac) { var aj = /\bMSIE\b/.test(navigator.userAgent); var am = /\n/g; var al = ac.sourceCode; var an = al.length; var V = 0; var aa = ac.spans; var T = aa.length; var ah = 0; var X = ac.decorations; var Y = X.length; var Z = 0; X[Y] = an; var ar, aq; for (aq = ar = 0; aq < Y;) {
355
- if (X[aq] !== X[aq + 2]) {
356
- X[ar++] = X[aq++];
357
- X[ar++] = X[aq++];
358
- }
359
- else {
360
- aq += 2;
361
- }
362
- } Y = ar; for (aq = ar = 0; aq < Y;) {
363
- var at = X[aq];
364
- var ab = X[aq + 1];
365
- var W = aq + 2;
366
- while (W + 2 <= Y && X[W + 1] === ab) {
367
- W += 2;
368
- }
369
- X[ar++] = at;
370
- X[ar++] = ab;
371
- aq = W;
372
- } Y = X.length = ar; var ae = null; while (ah < T) {
373
- var af = aa[ah];
374
- var S = aa[ah + 2] || an;
375
- var ag = X[Z];
376
- var ap = X[Z + 2] || an;
377
- var W = Math.min(S, ap);
378
- var ak = aa[ah + 1];
379
- var U;
380
- if (ak.nodeType !== 1 && (U = al.substring(V, W))) {
381
- if (aj) {
382
- U = U.replace(am, "\r");
383
- }
384
- ak.nodeValue = U;
385
- var ai = ak.ownerDocument;
386
- var ao = ai.createElement("SPAN");
387
- ao.className = X[Z + 1];
388
- var ad = ak.parentNode;
389
- ad.replaceChild(ao, ak);
390
- ao.appendChild(ak);
391
- if (V < S) {
392
- aa[ah + 1] = ak = ai.createTextNode(al.substring(W, S));
393
- ad.insertBefore(ak, ao.nextSibling);
394
- }
395
- }
396
- V = W;
397
- if (V >= S) {
398
- ah += 2;
399
- }
400
- if (V >= ap) {
401
- Z += 2;
402
- }
403
- } } var t = {}; function c(U, V) { for (var S = V.length; --S >= 0;) {
404
- var T = V[S];
405
- if (!t.hasOwnProperty(T)) {
406
- t[T] = U;
407
- }
408
- else {
409
- if (window.console) {
410
- console.warn("cannot override language handler %s", T);
411
- }
412
- }
413
- } } function q(T, S) { if (!(T && t.hasOwnProperty(T))) {
414
- T = /^\s*</.test(S) ? "default-markup" : "default-code";
415
- } return t[T]; } c(K, ["default-code"]); c(g([], [[F, /^[^<?]+/], [E, /^<!\w[^>]*(?:>|$)/], [j, /^<\!--[\s\S]*?(?:-\->|$)/], ["lang-", /^<\?([\s\S]+?)(?:\?>|$)/], ["lang-", /^<%([\s\S]+?)(?:%>|$)/], [L, /^(?:<[%?]|[%?]>)/], ["lang-", /^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i], ["lang-js", /^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i], ["lang-css", /^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i], ["lang-in.tag", /^(<\/?[a-z][^<>]*>)/i]]), ["default-markup", "htm", "html", "mxml", "xhtml", "xml", "xsl"]); c(g([[F, /^[\s]+/, null, " \t\r\n"], [n, /^(?:\"[^\"]*\"?|\'[^\']*\'?)/, null, "\"'"]], [[m, /^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i], [P, /^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i], ["lang-uq.val", /^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/], [L, /^[=<>\/]+/], ["lang-js", /^on\w+\s*=\s*\"([^\"]+)\"/i], ["lang-js", /^on\w+\s*=\s*\'([^\']+)\'/i], ["lang-js", /^on\w+\s*=\s*([^\"\'>\s]+)/i], ["lang-css", /^style\s*=\s*\"([^\"]+)\"/i], ["lang-css", /^style\s*=\s*\'([^\']+)\'/i], ["lang-css", /^style\s*=\s*([^\"\'>\s]+)/i]]), ["in.tag"]); c(g([], [[n, /^[\s\S]+/]]), ["uq.val"]); c(i({ keywords: l, hashComments: true, cStyleComments: true, types: e }), ["c", "cc", "cpp", "cxx", "cyc", "m"]); c(i({ keywords: "null,true,false" }), ["json"]); c(i({ keywords: R, hashComments: true, cStyleComments: true, verbatimStrings: true, types: e }), ["cs"]); c(i({ keywords: x, cStyleComments: true }), ["java"]); c(i({ keywords: H, hashComments: true, multiLineStrings: true }), ["bsh", "csh", "sh"]); c(i({ keywords: I, hashComments: true, multiLineStrings: true, tripleQuotedStrings: true }), ["cv", "py"]); c(i({ keywords: s, hashComments: true, multiLineStrings: true, regexLiterals: true }), ["perl", "pl", "pm"]); c(i({ keywords: f, hashComments: true, multiLineStrings: true, regexLiterals: true }), ["rb"]); c(i({ keywords: w, cStyleComments: true, regexLiterals: true }), ["js"]); c(i({ keywords: r, hashComments: 3, cStyleComments: true, multilineStrings: true, tripleQuotedStrings: true, regexLiterals: true }), ["coffee"]); c(g([], [[C, /^[\s\S]+/]]), ["regex"]); function d(V) { var U = V.langExtension; try {
416
- var S = a(V.sourceNode);
417
- var T = S.sourceCode;
418
- V.sourceCode = T;
419
- V.spans = S.spans;
420
- V.basePos = 0;
421
- q(U, T)(V);
422
- D(V);
423
- }
424
- catch (W) {
425
- if ("console" in window) {
426
- console.log(W && W.stack ? W.stack : W);
427
- }
428
- } } function y(W, V, U) { var S = document.createElement("PRE"); S.innerHTML = W; if (U) {
429
- Q(S, U);
430
- } var T = { langExtension: V, numberLines: U, sourceNode: S }; d(T); return S.innerHTML; } function b(ad) { function Y(af) { return document.getElementsByTagName(af); } var ac = [Y("pre"), Y("code"), Y("xmp")]; var T = []; for (var aa = 0; aa < ac.length; ++aa) {
431
- for (var Z = 0, V = ac[aa].length; Z < V; ++Z) {
432
- T.push(ac[aa][Z]);
433
- }
434
- } ac = null; var W = Date; if (!W.now) {
435
- W = { now: function () { return +(new Date); } };
436
- } var X = 0; var S; var ab = /\blang(?:uage)?-([\w.]+)(?!\S)/; var ae = /\bprettyprint\b/; function U() { var ag = (window.PR_SHOULD_USE_CONTINUATION ? W.now() + 250 : Infinity); for (; X < T.length && W.now() < ag; X++) {
437
- var aj = T[X];
438
- var ai = aj.className;
439
- if (ai.indexOf("prettyprint") >= 0) {
440
- var ah = ai.match(ab);
441
- var am;
442
- if (!ah && (am = o(aj)) && "CODE" === am.tagName) {
443
- ah = am.className.match(ab);
444
- }
445
- if (ah) {
446
- ah = ah[1];
447
- }
448
- var al = false;
449
- for (var ak = aj.parentNode; ak; ak = ak.parentNode) {
450
- if ((ak.tagName === "pre" || ak.tagName === "code" || ak.tagName === "xmp") && ak.className && ak.className.indexOf("prettyprint") >= 0) {
451
- al = true;
452
- break;
453
- }
454
- }
455
- if (!al) {
456
- var af = aj.className.match(/\blinenums\b(?::(\d+))?/);
457
- af = af ? af[1] && af[1].length ? +af[1] : true : false;
458
- if (af) {
459
- Q(aj, af);
460
- }
461
- S = { langExtension: ah, sourceNode: aj, numberLines: af };
462
- d(S);
463
- }
464
- }
465
- } if (X < T.length) {
466
- setTimeout(U, 250);
467
- }
468
- else {
469
- if (ad) {
470
- ad();
471
- }
472
- } } U(); } window.prettyPrintOne = y; window.prettyPrint = b; window.PR = { createSimpleLexer: g, registerLangHandler: c, sourceDecorator: i, PR_ATTRIB_NAME: P, PR_ATTRIB_VALUE: n, PR_COMMENT: j, PR_DECLARATION: E, PR_KEYWORD: z, PR_LITERAL: G, PR_NOCODE: N, PR_PLAIN: F, PR_PUNCTUATION: L, PR_SOURCE: J, PR_STRING: C, PR_TAG: m, PR_TYPE: O }; })();
473
- PR.registerLangHandler(PR.createSimpleLexer([], [[PR.PR_DECLARATION, /^<!\w[^>]*(?:>|$)/], [PR.PR_COMMENT, /^<\!--[\s\S]*?(?:-\->|$)/], [PR.PR_PUNCTUATION, /^(?:<[%?]|[%?]>)/], ["lang-", /^<\?([\s\S]+?)(?:\?>|$)/], ["lang-", /^<%([\s\S]+?)(?:%>|$)/], ["lang-", /^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i], ["lang-handlebars", /^<script\b[^>]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i], ["lang-js", /^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i], ["lang-css", /^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i], ["lang-in.tag", /^(<\/?[a-z][^<>]*>)/i], [PR.PR_DECLARATION, /^{{[#^>/]?\s*[\w.][^}]*}}/], [PR.PR_DECLARATION, /^{{&?\s*[\w.][^}]*}}/], [PR.PR_DECLARATION, /^{{{>?\s*[\w.][^}]*}}}/], [PR.PR_COMMENT, /^{{![^}]*}}/]]), ["handlebars", "hbs"]);
474
- PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN, /^[ \t\r\n\f]+/, null, " \t\r\n\f"]], [[PR.PR_STRING, /^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/, null], [PR.PR_STRING, /^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/, null], ["lang-css-str", /^url\(([^\)\"\']*)\)/i], [PR.PR_KEYWORD, /^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i, null], ["lang-css-kw", /^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i], [PR.PR_COMMENT, /^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//], [PR.PR_COMMENT, /^(?:<!--|-->)/], [PR.PR_LITERAL, /^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i], [PR.PR_LITERAL, /^#(?:[0-9a-f]{3}){1,2}/i], [PR.PR_PLAIN, /^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i], [PR.PR_PUNCTUATION, /^[^\s\w\'\"]+/]]), ["css"]);
475
- PR.registerLangHandler(PR.createSimpleLexer([], [[PR.PR_KEYWORD, /^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]), ["css-kw"]);
476
- PR.registerLangHandler(PR.createSimpleLexer([], [[PR.PR_STRING, /^[^\)\"\']+/]]), ["css-str"]);
477
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,176 +0,0 @@
1
- /* eslint-disable */
2
- var addSorting = (function () {
3
- 'use strict';
4
- var cols, currentSort = {
5
- index: 0,
6
- desc: false
7
- };
8
- // returns the summary table element
9
- function getTable() {
10
- return document.querySelector('.coverage-summary');
11
- }
12
- // returns the thead element of the summary table
13
- function getTableHeader() {
14
- return getTable().querySelector('thead tr');
15
- }
16
- // returns the tbody element of the summary table
17
- function getTableBody() {
18
- return getTable().querySelector('tbody');
19
- }
20
- // returns the th element for nth column
21
- function getNthColumn(n) {
22
- return getTableHeader().querySelectorAll('th')[n];
23
- }
24
- function onFilterInput() {
25
- const searchValue = document.getElementById('fileSearch').value;
26
- const rows = document.getElementsByTagName('tbody')[0].children;
27
- // Try to create a RegExp from the searchValue. If it fails (invalid regex),
28
- // it will be treated as a plain text search
29
- let searchRegex;
30
- try {
31
- searchRegex = new RegExp(searchValue, 'i'); // 'i' for case-insensitive
32
- }
33
- catch (error) {
34
- searchRegex = null;
35
- }
36
- for (let i = 0; i < rows.length; i++) {
37
- const row = rows[i];
38
- let isMatch = false;
39
- if (searchRegex) {
40
- // If a valid regex was created, use it for matching
41
- isMatch = searchRegex.test(row.textContent);
42
- }
43
- else {
44
- // Otherwise, fall back to the original plain text search
45
- isMatch = row.textContent
46
- .toLowerCase()
47
- .includes(searchValue.toLowerCase());
48
- }
49
- row.style.display = isMatch ? '' : 'none';
50
- }
51
- }
52
- // loads the search box
53
- function addSearchBox() {
54
- var template = document.getElementById('filterTemplate');
55
- var templateClone = template.content.cloneNode(true);
56
- templateClone.getElementById('fileSearch').oninput = onFilterInput;
57
- template.parentElement.appendChild(templateClone);
58
- }
59
- // loads all columns
60
- function loadColumns() {
61
- var colNodes = getTableHeader().querySelectorAll('th'), colNode, cols = [], col, i;
62
- for (i = 0; i < colNodes.length; i += 1) {
63
- colNode = colNodes[i];
64
- col = {
65
- key: colNode.getAttribute('data-col'),
66
- sortable: !colNode.getAttribute('data-nosort'),
67
- type: colNode.getAttribute('data-type') || 'string'
68
- };
69
- cols.push(col);
70
- if (col.sortable) {
71
- col.defaultDescSort = col.type === 'number';
72
- colNode.innerHTML =
73
- colNode.innerHTML + '<span class="sorter"></span>';
74
- }
75
- }
76
- return cols;
77
- }
78
- // attaches a data attribute to every tr element with an object
79
- // of data values keyed by column name
80
- function loadRowData(tableRow) {
81
- var tableCols = tableRow.querySelectorAll('td'), colNode, col, data = {}, i, val;
82
- for (i = 0; i < tableCols.length; i += 1) {
83
- colNode = tableCols[i];
84
- col = cols[i];
85
- val = colNode.getAttribute('data-value');
86
- if (col.type === 'number') {
87
- val = Number(val);
88
- }
89
- data[col.key] = val;
90
- }
91
- return data;
92
- }
93
- // loads all row data
94
- function loadData() {
95
- var rows = getTableBody().querySelectorAll('tr'), i;
96
- for (i = 0; i < rows.length; i += 1) {
97
- rows[i].data = loadRowData(rows[i]);
98
- }
99
- }
100
- // sorts the table using the data for the ith column
101
- function sortByIndex(index, desc) {
102
- var key = cols[index].key, sorter = function (a, b) {
103
- a = a.data[key];
104
- b = b.data[key];
105
- return a < b ? -1 : a > b ? 1 : 0;
106
- }, finalSorter = sorter, tableBody = document.querySelector('.coverage-summary tbody'), rowNodes = tableBody.querySelectorAll('tr'), rows = [], i;
107
- if (desc) {
108
- finalSorter = function (a, b) {
109
- return -1 * sorter(a, b);
110
- };
111
- }
112
- for (i = 0; i < rowNodes.length; i += 1) {
113
- rows.push(rowNodes[i]);
114
- tableBody.removeChild(rowNodes[i]);
115
- }
116
- rows.sort(finalSorter);
117
- for (i = 0; i < rows.length; i += 1) {
118
- tableBody.appendChild(rows[i]);
119
- }
120
- }
121
- // removes sort indicators for current column being sorted
122
- function removeSortIndicators() {
123
- var col = getNthColumn(currentSort.index), cls = col.className;
124
- cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, '');
125
- col.className = cls;
126
- }
127
- // adds sort indicators for current column being sorted
128
- function addSortIndicators() {
129
- getNthColumn(currentSort.index).className += currentSort.desc
130
- ? ' sorted-desc'
131
- : ' sorted';
132
- }
133
- // adds event listeners for all sorter widgets
134
- function enableUI() {
135
- var i, el, ithSorter = function ithSorter(i) {
136
- var col = cols[i];
137
- return function () {
138
- var desc = col.defaultDescSort;
139
- if (currentSort.index === i) {
140
- desc = !currentSort.desc;
141
- }
142
- sortByIndex(i, desc);
143
- removeSortIndicators();
144
- currentSort.index = i;
145
- currentSort.desc = desc;
146
- addSortIndicators();
147
- };
148
- };
149
- for (i = 0; i < cols.length; i += 1) {
150
- if (cols[i].sortable) {
151
- // add the click event handler on the th so users
152
- // dont have to click on those tiny arrows
153
- el = getNthColumn(i).querySelector('.sorter').parentElement;
154
- if (el.addEventListener) {
155
- el.addEventListener('click', ithSorter(i));
156
- }
157
- else {
158
- el.attachEvent('onclick', ithSorter(i));
159
- }
160
- }
161
- }
162
- }
163
- // adds sorting functionality to the UI
164
- return function () {
165
- if (!getTable()) {
166
- return;
167
- }
168
- cols = loadColumns();
169
- loadData();
170
- addSearchBox();
171
- addSortIndicators();
172
- enableUI();
173
- };
174
- })();
175
- window.addEventListener('load', addSorting);
176
- export {};
@@ -1,2 +0,0 @@
1
- declare const _default: import("vite").UserConfig;
2
- export default _default;
package/vitest.config.js DELETED
@@ -1,20 +0,0 @@
1
- import { configDefaults, defineConfig } from 'vitest/config';
2
- export default defineConfig({
3
- test: {
4
- globals: true,
5
- coverage: {
6
- enabled: true,
7
- provider: 'istanbul',
8
- reporter: ['text', 'json', 'lcov'],
9
- thresholds: {
10
- statements: 90,
11
- functions: 90,
12
- branches: 85,
13
- lines: 90,
14
- },
15
- exclude: [...configDefaults.exclude],
16
- },
17
- exclude: [...configDefaults.exclude],
18
- clearMocks: true,
19
- },
20
- });