@witchcraft/expressit 0.0.2 → 0.1.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/README.md +6 -4
- package/dist/Lexer.d.ts +146 -0
- package/dist/Lexer.d.ts.map +1 -0
- package/dist/Lexer.js +960 -0
- package/dist/Parser.d.ts +140 -0
- package/dist/Parser.d.ts.map +1 -0
- package/dist/Parser.js +668 -0
- package/dist/ast/builders/token.js +1 -1
- package/dist/ast/handlers.d.ts +3 -3
- package/dist/ast/handlers.d.ts.map +1 -1
- package/dist/ast/index.d.ts.map +1 -1
- package/dist/examples/index.d.ts +2 -0
- package/dist/examples/index.d.ts.map +1 -0
- package/dist/examples/index.js +4 -0
- package/dist/examples/shortcutContextParser.d.ts +2 -1
- package/dist/examples/shortcutContextParser.d.ts.map +1 -1
- package/dist/examples/shortcutContextParser.js +9 -5
- package/dist/helpers/errors.d.ts.map +1 -1
- package/dist/helpers/errors.js +3 -1
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/parser/checkParserOpts.d.ts.map +1 -1
- package/dist/helpers/parser/checkParserOpts.js +3 -2
- package/dist/helpers/parser/extractPosition.d.ts +2 -6
- package/dist/helpers/parser/extractPosition.d.ts.map +1 -1
- package/dist/helpers/parser/extractPosition.js +3 -3
- package/dist/helpers/parser/getUnclosedRightParenCount.d.ts +2 -3
- package/dist/helpers/parser/getUnclosedRightParenCount.d.ts.map +1 -1
- package/dist/helpers/parser/getUnclosedRightParenCount.js +4 -4
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -5
- package/dist/methods/autocomplete.d.ts.map +1 -1
- package/dist/methods/autocomplete.js +1 -1
- package/dist/methods/autoreplace.js +1 -1
- package/dist/methods/autosuggest.js +1 -1
- package/dist/methods/evaluate.d.ts.map +1 -1
- package/dist/methods/evaluate.js +3 -1
- package/dist/methods/getIndexes.d.ts.map +1 -1
- package/dist/methods/getIndexes.js +2 -1
- package/dist/methods/normalize.d.ts +0 -2
- package/dist/methods/normalize.d.ts.map +1 -1
- package/dist/methods/normalize.js +2 -3
- package/dist/methods/validate.d.ts.map +1 -1
- package/dist/methods/validate.js +3 -1
- package/dist/package.json.js +44 -37
- package/dist/types/ast.d.ts +2 -8
- package/dist/types/ast.d.ts.map +1 -1
- package/dist/types/errors.d.ts +5 -17
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/errors.js +0 -1
- package/dist/types/parser.d.ts +6 -2
- package/dist/types/parser.d.ts.map +1 -1
- package/dist/utils/extractTokens.js +1 -1
- package/dist/utils/getCursorInfo.d.ts +2 -2
- package/dist/utils/getCursorInfo.d.ts.map +1 -1
- package/dist/utils/getCursorInfo.js +3 -2
- package/dist/utils/getOppositeDelimiter.d.ts.map +1 -1
- package/dist/utils/getOppositeDelimiter.js +1 -1
- package/dist/utils/prettyAst.d.ts.map +1 -1
- package/dist/utils/prettyAst.js +15 -9
- package/package.json +42 -37
- package/src/Lexer.ts +704 -0
- package/src/Parser.ts +972 -0
- package/src/ast/builders/array.ts +2 -2
- package/src/ast/builders/condition.ts +1 -1
- package/src/ast/builders/expression.ts +1 -1
- package/src/ast/builders/group.ts +1 -1
- package/src/ast/builders/index.ts +1 -1
- package/src/ast/builders/pos.ts +1 -1
- package/src/ast/builders/token.ts +2 -2
- package/src/ast/builders/type.ts +1 -1
- package/src/ast/builders/variable.ts +1 -1
- package/src/ast/classes/ConditionNode.ts +1 -1
- package/src/ast/classes/ErrorToken.ts +1 -1
- package/src/ast/classes/ValidToken.ts +2 -2
- package/src/ast/classes/index.ts +1 -1
- package/src/ast/handlers.ts +6 -6
- package/src/ast/index.ts +2 -2
- package/src/examples/index.ts +3 -0
- package/src/examples/shortcutContextParser.ts +11 -6
- package/src/helpers/errors.ts +5 -3
- package/src/helpers/general/defaultConditionNormalizer.ts +1 -1
- package/src/helpers/general/index.ts +1 -1
- package/src/helpers/index.ts +3 -2
- package/src/helpers/parser/checkParserOpts.ts +13 -12
- package/src/helpers/parser/extractPosition.ts +4 -8
- package/src/helpers/parser/getUnclosedRightParenCount.ts +6 -6
- package/src/helpers/parser/index.ts +1 -1
- package/src/helpers/parser/parseParserOptions.ts +1 -1
- package/src/index.ts +2 -2
- package/src/methods/autocomplete.ts +5 -5
- package/src/methods/autoreplace.ts +2 -2
- package/src/methods/autosuggest.ts +3 -3
- package/src/methods/evaluate.ts +4 -2
- package/src/methods/getIndexes.ts +2 -1
- package/src/methods/normalize.ts +3 -4
- package/src/methods/validate.ts +4 -2
- package/src/types/ast.ts +2 -9
- package/src/types/errors.ts +12 -22
- package/src/types/parser.ts +6 -4
- package/src/utils/extractTokens.ts +1 -1
- package/src/utils/getCursorInfo.ts +6 -4
- package/src/utils/getOppositeDelimiter.ts +5 -2
- package/src/utils/prettyAst.ts +5 -3
- package/dist/examples/advancedValueComparer.d.ts +0 -3
- package/dist/examples/advancedValueComparer.d.ts.map +0 -1
- package/dist/examples/advancedValueComparer.js +0 -28
- package/dist/grammar/ParserBase.d.ts +0 -51
- package/dist/grammar/ParserBase.d.ts.map +0 -1
- package/dist/grammar/ParserBase.js +0 -516
- package/dist/grammar/createTokens.d.ts +0 -56
- package/dist/grammar/createTokens.d.ts.map +0 -1
- package/dist/grammar/createTokens.js +0 -843
- package/dist/grammar/index.d.ts +0 -3
- package/dist/grammar/index.d.ts.map +0 -1
- package/dist/grammar/index.js +0 -6
- package/dist/parser.d.ts +0 -58
- package/dist/parser.d.ts.map +0 -1
- package/dist/parser.js +0 -136
- package/src/examples/advancedValueComparer.ts +0 -31
- package/src/grammar/ParserBase.ts +0 -715
- package/src/grammar/createTokens.ts +0 -512
- package/src/grammar/index.ts +0 -4
- package/src/parser.ts +0 -183
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/types/parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+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AAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAAA;AACvG,MAAM,MAAM,cAAc,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE,GAAG,GAAG,SAAS,EAAE,KAAK,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC,EAAE,GAAG,SAAS,GAAG,IAAI,CAAA;AAEnL,MAAM,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,EAAE,CAAA;AACjD,MAAM,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAA;AAExE,MAAM,MAAM,YAAY,GAAG;IAC1B,+CAA+C;IAC/C,QAAQ,EAAE,OAAO,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;CACb,CAAA;AACD,MAAM,MAAM,cAAc,GAAG;IAC5B,EAAE,CAAC,EAAE,YAAY,EAAE,CAAA;IACnB,GAAG,CAAC,EAAE,YAAY,EAAE,CAAA;IACpB,GAAG,CAAC,EAAE,YAAY,EAAE,CAAA;CACpB,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { unreachable } from "@alanscodelog/utils";
|
|
1
|
+
import { unreachable } from "@alanscodelog/utils/unreachable";
|
|
2
2
|
import { ArrayNode } from "../ast/classes/ArrayNode.js";
|
|
3
3
|
import { ConditionNode } from "../ast/classes/ConditionNode.js";
|
|
4
4
|
import { ErrorToken } from "../ast/classes/ErrorToken.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type
|
|
1
|
+
import { type AnyToken, type ParserResults } from "../types/ast.js";
|
|
2
|
+
import { type CursorInfo } from "../types/autocomplete.js";
|
|
3
3
|
/**
|
|
4
4
|
* Returns a @see CursorInfo object, see it for details.
|
|
5
5
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCursorInfo.d.ts","sourceRoot":"","sources":["../../src/utils/getCursorInfo.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getCursorInfo.d.ts","sourceRoot":"","sources":["../../src/utils/getCursorInfo.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAA;AACnE,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAG1D;;GAEG;AACH,wBAAgB,aAAa,CAC5B,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,aAAa,GAAG,QAAQ,EAAE,EAC/B,KAAK,EAAE,MAAM,GACX,UAAU,CAoDZ"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { isArray
|
|
1
|
+
import { isArray } from "@alanscodelog/utils/isArray";
|
|
2
|
+
import { unreachable } from "@alanscodelog/utils/unreachable";
|
|
2
3
|
import { extractTokens } from "./extractTokens.js";
|
|
3
|
-
import { ValidToken } from "../ast/classes/ValidToken.js";
|
|
4
4
|
import { ErrorToken } from "../ast/classes/ErrorToken.js";
|
|
5
|
+
import { ValidToken } from "../ast/classes/ValidToken.js";
|
|
5
6
|
function getCursorInfo(input, ast, index) {
|
|
6
7
|
const tokens = isArray(ast) ? ast : extractTokens(ast);
|
|
7
8
|
if (input.length < index || index < 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOppositeDelimiter.d.ts","sourceRoot":"","sources":["../../src/utils/getOppositeDelimiter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getOppositeDelimiter.d.ts","sourceRoot":"","sources":["../../src/utils/getOppositeDelimiter.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,KAAK,QAAQ,EAAc,KAAK,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAErF;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,QAAQ,GAAG,QAAQ,CAAC,mBAAmB,CAAC,GAAG,SAAS,CAsB/F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prettyAst.d.ts","sourceRoot":"","sources":["../../src/utils/prettyAst.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prettyAst.d.ts","sourceRoot":"","sources":["../../src/utils/prettyAst.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAA6C,SAAS,EAAc,YAAY,EAAE,MAAM,yBAAyB,CAAA;AACnI,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,aAAa,EAAc,MAAM,iBAAiB,CAAA;AAG/E,KAAK,MAAM,GAAG;IACb,0EAA0E;IAC1E,MAAM,EAAE,MAAM,CAAA;IACd,6NAA6N;IAC7N,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,mKAAmK;IACnK,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAA;CACb,CAAA;AAoBD;;;;;;;;;;;;;;;;;GAiBG;AAEH,wBAAgB,SAAS,CACxB,GAAG,EAAE,aAAa,GAAG,QAAQ,GAAG,YAAY,GAAG,SAAS,GAAG,SAAS,EACpE,EAAE,MAAc,EAAE,QAAe,EAAE,IAAW,EAAE,MAAY,EAAE,KAAU,EAAE,GAAE,OAAO,CAAC,MAAM,CAAC,QAAQ,GAAG,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,EAAE,MAAM,CAAC,CAAM,EAC7J,MAAM,GAAE,OAAO,CAAC,MAAM,CAAC,GAAG,KAAU,GAClC,MAAM,CAyFR"}
|
package/dist/utils/prettyAst.js
CHANGED
|
@@ -1,19 +1,25 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as color from "@alanscodelog/utils/colors";
|
|
2
|
+
import { isBlank } from "@alanscodelog/utils/isBlank";
|
|
3
|
+
import "@alanscodelog/utils/types";
|
|
4
|
+
import { unreachable } from "@alanscodelog/utils/unreachable";
|
|
2
5
|
import { ArrayNode } from "../ast/classes/ArrayNode.js";
|
|
3
6
|
import { ConditionNode } from "../ast/classes/ConditionNode.js";
|
|
4
7
|
import { ErrorToken } from "../ast/classes/ErrorToken.js";
|
|
5
8
|
import { ExpressionNode } from "../ast/classes/ExpressionNode.js";
|
|
6
9
|
import { GroupNode } from "../ast/classes/GroupNode.js";
|
|
10
|
+
import "@alanscodelog/utils/crop";
|
|
11
|
+
import "@alanscodelog/utils/indent";
|
|
12
|
+
import "@alanscodelog/utils/pretty";
|
|
7
13
|
import { ValidToken } from "../ast/classes/ValidToken.js";
|
|
8
14
|
import { VariableNode } from "../ast/classes/VariableNode.js";
|
|
9
15
|
import { TOKEN_TYPE } from "../types/ast.js";
|
|
10
16
|
const defaultColors = {
|
|
11
|
-
values:
|
|
12
|
-
info:
|
|
13
|
-
position:
|
|
14
|
-
hint:
|
|
15
|
-
error:
|
|
16
|
-
reset:
|
|
17
|
+
values: color.yellow,
|
|
18
|
+
info: color.cyan,
|
|
19
|
+
position: color.green,
|
|
20
|
+
hint: color.blue,
|
|
21
|
+
error: color.red,
|
|
22
|
+
reset: color.reset
|
|
17
23
|
};
|
|
18
24
|
const disableColors = Object.fromEntries(Object.keys(defaultColors).map((key) => [key, ""]));
|
|
19
25
|
const toRows = (rows, opts) => {
|
|
@@ -23,10 +29,10 @@ const toRows = (rows, opts) => {
|
|
|
23
29
|
`${opts.indent}${opts.last}${rows[rows.length - 1]}`
|
|
24
30
|
];
|
|
25
31
|
};
|
|
26
|
-
function prettyAst(ast, { indent = " ", children = "├╴", last = "└╴", branch = "│", quote = "" } = {},
|
|
32
|
+
function prettyAst(ast, { indent = " ", children = "├╴", last = "└╴", branch = "│", quote = "" } = {}, colors = {}) {
|
|
27
33
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
28
34
|
const opts = { indent, children, last, branch, quote };
|
|
29
|
-
const c =
|
|
35
|
+
const c = colors ? { ...defaultColors, ...colors } : disableColors;
|
|
30
36
|
const pos = `${c.position}(${ast.start}, ${ast.end})${c.reset}`;
|
|
31
37
|
const _ = indent;
|
|
32
38
|
const __ = arguments[3] ?? "";
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@witchcraft/expressit",
|
|
3
3
|
"description": "A blazing fast, customizable, error-tolerant expression parser that creates safe to eval expressions + a few other goodies like autocomplete.",
|
|
4
|
-
"version": "0.0
|
|
4
|
+
"version": "0.1.0",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
7
|
+
"module": "./dist/index.js",
|
|
7
8
|
"exports": {
|
|
8
9
|
".": {
|
|
9
10
|
"types": "./dist/index.d.ts",
|
|
@@ -13,33 +14,45 @@
|
|
|
13
14
|
"types": "./dist/ast/index.d.ts",
|
|
14
15
|
"import": "./dist/ast/index.js"
|
|
15
16
|
},
|
|
16
|
-
"./
|
|
17
|
-
"types": "./dist/
|
|
18
|
-
"import": "./dist/
|
|
17
|
+
"./ast/*": {
|
|
18
|
+
"types": "./dist/ast/*",
|
|
19
|
+
"import": "./dist/ast/*"
|
|
19
20
|
},
|
|
20
21
|
"./helpers": {
|
|
21
22
|
"types": "./dist/helpers/index.d.ts",
|
|
22
23
|
"import": "./dist/helpers/index.js"
|
|
23
24
|
},
|
|
25
|
+
"./helpers/*": {
|
|
26
|
+
"types": "./dist/helpers/*",
|
|
27
|
+
"import": "./dist/helpers/*"
|
|
28
|
+
},
|
|
24
29
|
"./methods": {
|
|
25
30
|
"types": "./dist/methods/index.d.ts",
|
|
26
31
|
"import": "./dist/methods/index.js"
|
|
27
32
|
},
|
|
28
|
-
"./
|
|
29
|
-
"types": "./dist/
|
|
30
|
-
"import": "./dist/
|
|
33
|
+
"./methods/*": {
|
|
34
|
+
"types": "./dist/methods/*",
|
|
35
|
+
"import": "./dist/methods/*"
|
|
31
36
|
},
|
|
32
37
|
"./utils": {
|
|
33
38
|
"types": "./dist/utils/index.d.ts",
|
|
34
39
|
"import": "./dist/utils/index.js"
|
|
35
40
|
},
|
|
41
|
+
"./utils/*": {
|
|
42
|
+
"types": "./dist/utils/*",
|
|
43
|
+
"import": "./dist/utils/*"
|
|
44
|
+
},
|
|
36
45
|
"./examples": {
|
|
37
46
|
"types": "./dist/examples/index.d.ts",
|
|
38
47
|
"import": "./dist/examples/index.js"
|
|
39
48
|
},
|
|
49
|
+
"./examples/*": {
|
|
50
|
+
"types": "./dist/examples/*",
|
|
51
|
+
"import": "./dist/examples/*"
|
|
52
|
+
},
|
|
40
53
|
"./*": {
|
|
41
|
-
"types": "./dist/*",
|
|
42
|
-
"import": "./dist/*"
|
|
54
|
+
"types": "./dist/types/*",
|
|
55
|
+
"import": "./dist/types/*"
|
|
43
56
|
}
|
|
44
57
|
},
|
|
45
58
|
"scripts": {
|
|
@@ -49,15 +62,15 @@
|
|
|
49
62
|
"build:watch": "vite build --watch --mode production",
|
|
50
63
|
"build:types": "tsc --emitDeclarationOnly -p tsconfig.types.json && npm run build:types:fix",
|
|
51
64
|
"build:types:fix": "tsc-alias -p tsconfig.types.json --debug",
|
|
52
|
-
"lint:eslint": "eslint \"{src,tests,bin}/**/*.{cjs,js,ts}\" \"*.{cjs,js,ts}\" --max-warnings=
|
|
65
|
+
"lint:eslint": "eslint \"{src,tests,bin}/**/*.{cjs,js,ts}\" \"*.{cjs,js,ts}\" --max-warnings=1 --report-unused-disable-directives",
|
|
53
66
|
"lint:types": "tsc --noEmit --pretty",
|
|
54
67
|
"lint:commits": "commitlint --from $(git rev-list --max-parents=0 HEAD) --to HEAD --verbose",
|
|
55
68
|
"lint:imports": "madge --circular --extensions ts ./src",
|
|
56
69
|
"lint": "npm run lint:types && npm run lint:eslint",
|
|
57
|
-
"coverage": "vitest --coverage",
|
|
58
|
-
"coverage:dev": "vitest --watch --coverage",
|
|
59
|
-
"test": "npm run lint:types && vitest run",
|
|
60
|
-
"test:watch": "vitest --watch",
|
|
70
|
+
"coverage": "vitest --exclude '.direnv/**/*' --coverage",
|
|
71
|
+
"coverage:dev": "vitest --exclude '.direnv/**/*' --watch --coverage",
|
|
72
|
+
"test": "npm run lint:types && vitest run --exclude '.direnv/**/*'",
|
|
73
|
+
"test:watch": "vitest --watch --exclude '.direnv/**/*'",
|
|
61
74
|
"test:inspect-errors": "cross-env INSPECT_ERRORS=true npm run test",
|
|
62
75
|
"doc": "typedoc --options typedoc.config.cjs",
|
|
63
76
|
"doc:watch": "onchange -i \"src/**/*.ts\" \"typedoc.config.cjs\" -- npm run doc",
|
|
@@ -68,45 +81,37 @@
|
|
|
68
81
|
"demo:build": "cd demo && npm run build",
|
|
69
82
|
"actions:debug": "act -r -v -j build",
|
|
70
83
|
"gen:exports": "indexit update -o '${path}.js' -i **/*.d.ts",
|
|
71
|
-
"prepare": "husky
|
|
84
|
+
"prepare": "husky && npm run build"
|
|
72
85
|
},
|
|
73
86
|
"dependencies": {
|
|
74
|
-
"@alanscodelog/utils": "
|
|
75
|
-
"chevrotain": "^11.0.3"
|
|
87
|
+
"@alanscodelog/utils": "4.0.0-beta.15"
|
|
76
88
|
},
|
|
77
89
|
"devDependencies": {
|
|
78
|
-
"@alanscodelog/commitlint-config": "^
|
|
79
|
-
"@alanscodelog/eslint-config": "
|
|
80
|
-
"@alanscodelog/semantic-release-config": "^
|
|
81
|
-
"@alanscodelog/tsconfigs": "^
|
|
90
|
+
"@alanscodelog/commitlint-config": "^3.0.1",
|
|
91
|
+
"@alanscodelog/eslint-config": "5.0.0-beta.2",
|
|
92
|
+
"@alanscodelog/semantic-release-config": "^4.1.2",
|
|
93
|
+
"@alanscodelog/tsconfigs": "^4.0.1",
|
|
82
94
|
"@knodes/typedoc-plugin-pages": "^0.23.4",
|
|
83
95
|
"@types/node": "^20.4.1",
|
|
84
|
-
"@
|
|
85
|
-
"
|
|
86
|
-
"@vitest/coverage-c8": "^0.33.0",
|
|
87
|
-
"commitlint": "^17.6.6",
|
|
96
|
+
"@vitest/coverage-v8": "^1.6.0",
|
|
97
|
+
"commitlint": "^19.3.0",
|
|
88
98
|
"concurrently": "^8.2.0",
|
|
89
99
|
"cross-env": "^7.0.3",
|
|
90
|
-
"eslint": "^8.44.0",
|
|
91
|
-
"eslint-import-resolver-typescript": "^3.5.5",
|
|
92
|
-
"eslint-plugin-import": "^2.27.5",
|
|
93
|
-
"eslint-plugin-jsdoc": "^46.4.3",
|
|
94
|
-
"eslint-plugin-simple-import-sort": "^10.0.0",
|
|
95
100
|
"fast-glob": "^3.3.1",
|
|
96
101
|
"http-server": "^14.1.1",
|
|
97
|
-
"husky": "^
|
|
102
|
+
"husky": "^9.0.11",
|
|
98
103
|
"indexit": "2.1.0-beta.3",
|
|
99
|
-
"madge": "^
|
|
104
|
+
"madge": "^7.0.0",
|
|
100
105
|
"onchange": "^7.1.0",
|
|
101
|
-
"semantic-release": "^
|
|
106
|
+
"semantic-release": "^23.1.1",
|
|
102
107
|
"ts-node": "^10.9.1",
|
|
103
108
|
"tsc-alias": "^1.8.7",
|
|
104
109
|
"typedoc": "~0.23.1",
|
|
105
|
-
"typescript": "~5.
|
|
106
|
-
"vite": "^
|
|
107
|
-
"vite-plugin-externalize-deps": "^0.
|
|
110
|
+
"typescript": "~5.4.5",
|
|
111
|
+
"vite": "^5.2.11",
|
|
112
|
+
"vite-plugin-externalize-deps": "^0.8.0",
|
|
108
113
|
"vite-tsconfig-paths": "^4.2.0",
|
|
109
|
-
"vitest": "^
|
|
114
|
+
"vitest": "^1.6.0"
|
|
110
115
|
},
|
|
111
116
|
"author": "Alan <alanscodelog@gmail.com>",
|
|
112
117
|
"repository": "https://github.com/witchcraftjs/expressit",
|