gridify-client 2.0.0-preview.2 → 2.0.0-preview.4
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 +59 -0
- package/dist/GridifyQueryBuilder.d.ts +2 -3
- package/dist/IGridifyQuery.d.ts +1 -1
- package/dist/index.cjs.js +2 -1
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.esm.js +2 -1
- package/dist/index.esm.js.map +1 -0
- package/dist/index.umd.js +2 -1
- package/dist/index.umd.js.map +1 -0
- package/package.json +10 -10
package/README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Gridify (A Modern Dynamic LINQ library)
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+

|
|
7
|
+
[](https://www.nuget.org/packages/Gridify/)
|
|
8
|
+

|
|
9
|
+
[](https://www.fuget.org/packages/Gridify)
|
|
10
|
+
[](https://alirezanet.github.io/Gridify/)
|
|
11
|
+
[](https://discord.gg/jaSXnDMv)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
[](https://alirezanet.github.io/Gridify/)
|
|
17
|
+
|
|
18
|
+
## Introduction
|
|
19
|
+
Gridify is a dynamic LINQ library that simplifies the process of converting strings to LINQ queries. With exceptional performance and ease-of-use, Gridify makes it effortless to apply filtering, sorting, and pagination using text-based data.
|
|
20
|
+
|
|
21
|
+
## Features
|
|
22
|
+
|
|
23
|
+
- Fast and easy to use
|
|
24
|
+
- Supports filtering, sorting, and pagination
|
|
25
|
+
- Supports `string` to LINQ conversion
|
|
26
|
+
- Supports nested queries and sub-collections
|
|
27
|
+
- Supports `string` to `object` mapping
|
|
28
|
+
- Supports query compilation
|
|
29
|
+
- Supports collection indexes
|
|
30
|
+
- Custom Operators
|
|
31
|
+
- Compatible with ORMs, especially Entity Framework
|
|
32
|
+
- Can be used on every collection that LINQ supports
|
|
33
|
+
- Compatible with object-mappers like AutoMapper
|
|
34
|
+
- Compatible with Elasticsearch 🔥🔥
|
|
35
|
+
|
|
36
|
+
## Documentation
|
|
37
|
+
|
|
38
|
+
Check out our docs at [https://alirezanet.github.io/Gridify/](https://alirezanet.github.io/Gridify/).
|
|
39
|
+
|
|
40
|
+
## Articles / Examples
|
|
41
|
+
- [Using Gridify in the api controllers](https://alirezanet.github.io/Gridify/example/api-controller.html#using-gridify-in-api-controllers)
|
|
42
|
+
- [Trabajando con filtros dinámicos usando Gridify en .NET](https://henriquemauri.net/trabalhando-com-filtros-dinamicos-utilizando-o-gridify-no-net/) by [@Henrique Mauri](https://github.com/hgmauri) (Spanish)
|
|
43
|
+
- [<span dir="rtl" align="right">آشنایی با Gridify</span>](https://www.dntips.ir/post/3345/%d8%a2%d8%b4%d9%86%d8%a7%db%8c%db%8c-%d8%a8%d8%a7-gridify) (Persian)
|
|
44
|
+
- Comming soon
|
|
45
|
+
|
|
46
|
+
## Want to support us?
|
|
47
|
+
|
|
48
|
+
- Don't forget to give a ⭐ to this repo on GitHub!
|
|
49
|
+
- Share your feedback and ideas to improve the library!
|
|
50
|
+
- Share the library on your favorite social media and with your friends!
|
|
51
|
+
- Help us to improve the documentation!
|
|
52
|
+
|
|
53
|
+
## Contribution
|
|
54
|
+
|
|
55
|
+
We welcome contributions! Feel free to send us a pull request. Check out our [Contribution Page](https://alirezanet.github.io/Gridify/contribution) for more information.
|
|
56
|
+
|
|
57
|
+
## License
|
|
58
|
+
|
|
59
|
+
This project is licensed under the [MIT License](https://github.com/alirezanet/gridify/blob/master/LICENSE).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ConditionalOperator } from "./GridifyOperator";
|
|
2
|
-
import IGridifyQuery from "./IGridifyQuery";
|
|
3
|
-
declare class GridifyQueryBuilder {
|
|
2
|
+
import { IGridifyQuery } from "./IGridifyQuery";
|
|
3
|
+
export declare class GridifyQueryBuilder {
|
|
4
4
|
private query;
|
|
5
5
|
private filteringExpressions;
|
|
6
6
|
setPage(page: number): GridifyQueryBuilder;
|
|
@@ -13,4 +13,3 @@ declare class GridifyQueryBuilder {
|
|
|
13
13
|
or(): GridifyQueryBuilder;
|
|
14
14
|
build(): IGridifyQuery;
|
|
15
15
|
}
|
|
16
|
-
export default GridifyQueryBuilder;
|
package/dist/IGridifyQuery.d.ts
CHANGED
package/dist/index.cjs.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";var r,t;exports.ConditionalOperator=void 0,(r=exports.ConditionalOperator||(exports.ConditionalOperator={})).Equal="=",r.NotEqual="!=",r.LessThan="<",r.GreaterThan=">",r.GreaterThanOrEqual=">=",r.LessThanOrEqual="<=",r.Contains="*",r.NotContains="!*",r.StartsWith="^",r.NotStartsWith="!^",r.EndsWith="$",r.NotEndsWith="!$",exports.LogicalOperator=void 0,(t=exports.LogicalOperator||(exports.LogicalOperator={})).And=",",t.Or="|";var o=function(){function r(){this.query={page:1,pageSize:20,orderBy:"",filter:""},this.filteringExpressions=[]}return r.prototype.setPage=function(r){return this.query.page=r,this},r.prototype.setPageSize=function(r){return this.query.pageSize=r,this},r.prototype.addOrderBy=function(r,t){void 0===t&&(t=!1);var o="".concat(r.trim()," ").concat(t?"desc":"").trim();return this.query.orderBy=this.query.orderBy?"".concat(this.query.orderBy,", ").concat(o):o,this},r.prototype.addCondition=function(r,t,o,e,i){void 0===e&&(e=!0),void 0===i&&(i=!0);var n=o;i&&"string"==typeof o&&(n=o.replace(/([(),|]|\/i)/g,"\\$1")),n=e?n.toString():"".concat(n.toString(),"/i");var p="".concat(r.trim()).concat(t).concat(n);return this.filteringExpressions.push({value:p,type:"filter"}),this},r.prototype.startGroup=function(){return this.filteringExpressions.push({value:"(",type:"startGroup"}),this},r.prototype.endGroup=function(){return this.filteringExpressions.push({value:")",type:"endGroup"}),this},r.prototype.and=function(){return this.filteringExpressions.push({value:exports.LogicalOperator.And,type:"op"}),this},r.prototype.or=function(){return this.filteringExpressions.push({value:exports.LogicalOperator.Or,type:"op"}),this},r.prototype.build=function(){var r=this,t=null,o=0;if(this.filteringExpressions.forEach((function(e){if("startGroup"===e.type&&o++,"endGroup"===e.type&&o--,null===t&&"op"===e.type)throw new Error("expression cannot start with a logical operator");if("filter"===t&&"filter"===e.type)throw new Error("consecutive conditions are not allowed, consider adding a logical operator");if("op"===t&&"op"===e.type)throw new Error("consecutive operators are not allowed, consider adding a filter");if("startGroup"===t&&"op"===e.type)throw new Error("logical operator immediately after startGroup is not allowed");if("endGroup"===t&&"filter"===e.type)throw new Error("Missing logical operator after endGroup");if("startGroup"===t&&"endGroup"===e.type)throw new Error("Empty groups are not allowed");if("endGroup"===t&&"startGroup"===e.type)throw new Error("Missing a logical operator between groups");t=e.type,r.query.filter+=e.value})),0!=o)throw new Error("Group not properly closed");return this.query},r}();exports.GridifyQueryBuilder=o;
|
|
2
|
+
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/GridifyOperator.ts","../src/GridifyQueryBuilder.ts"],"sourcesContent":[null,null],"names":["ConditionalOperator","LogicalOperator","GridifyQueryBuilder","this","query","page","pageSize","orderBy","filter","filteringExpressions","prototype","setPage","setPageSize","addOrderBy","field","descending","concat","trim","addCondition","operator","value","caseSensitive","escapeValue","filterValue","replace","toString","filterExpression","push","type","startGroup","endGroup","and","And","or","Or","build","_this","previousType","groupCounter","forEach","exp","Error"],"mappings":"aAAA,IAAYA,EAeAC,EAfAD,QAaXA,yBAAA,GAbWA,EAAAA,8BAAAA,QAAAA,oBAaX,CAAA,IAZE,MAAA,IACAA,EAAA,SAAA,KACAA,EAAA,SAAA,IACAA,EAAA,YAAA,IACAA,EAAA,mBAAA,KACAA,EAAA,gBAAA,KACAA,EAAA,SAAA,IACAA,EAAA,YAAA,KACAA,EAAA,WAAA,IACAA,EAAA,cAAA,KACAA,EAAA,SAAA,IACAA,EAAA,YAAA,KAGSC,QAGXA,qBAAA,GAHWA,EA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=">=",t.LessThanOrEqual="<=",t.Contains="*",t.NotContains="!*",t.StartsWith="^",t.NotStartsWith="!^",t.EndsWith="$",t.NotEndsWith="!$"}(t||(t={})),function(t){t.And=",",t.Or="|"}(r||(r={}));var o=function(){function t(){this.query={page:1,pageSize:20,orderBy:"",filter:""},this.filteringExpressions=[]}return t.prototype.setPage=function(t){return this.query.page=t,this},t.prototype.setPageSize=function(t){return this.query.pageSize=t,this},t.prototype.addOrderBy=function(t,r){void 0===r&&(r=!1);var o="".concat(t.trim()," ").concat(r?"desc":"").trim();return this.query.orderBy=this.query.orderBy?"".concat(this.query.orderBy,", ").concat(o):o,this},t.prototype.addCondition=function(t,r,o,e,i){void 0===e&&(e=!0),void 0===i&&(i=!0);var n=o;i&&"string"==typeof o&&(n=o.replace(/([(),|]|\/i)/g,"\\$1")),n=e?n.toString():"".concat(n.toString(),"/i");var s="".concat(t.trim()).concat(r).concat(n);return this.filteringExpressions.push({value:s,type:"filter"}),this},t.prototype.startGroup=function(){return this.filteringExpressions.push({value:"(",type:"startGroup"}),this},t.prototype.endGroup=function(){return this.filteringExpressions.push({value:")",type:"endGroup"}),this},t.prototype.and=function(){return this.filteringExpressions.push({value:r.And,type:"op"}),this},t.prototype.or=function(){return this.filteringExpressions.push({value:r.Or,type:"op"}),this},t.prototype.build=function(){var t=this,r=null,o=0;if(this.filteringExpressions.forEach((function(e){if("startGroup"===e.type&&o++,"endGroup"===e.type&&o--,null===r&&"op"===e.type)throw new Error("expression cannot start with a logical operator");if("filter"===r&&"filter"===e.type)throw new Error("consecutive conditions are not allowed, consider adding a logical operator");if("op"===r&&"op"===e.type)throw new Error("consecutive operators are not allowed, consider adding a filter");if("startGroup"===r&&"op"===e.type)throw new Error("logical operator immediately after startGroup is not allowed");if("endGroup"===r&&"filter"===e.type)throw new Error("Missing logical operator after endGroup");if("startGroup"===r&&"endGroup"===e.type)throw new Error("Empty groups are not allowed");if("endGroup"===r&&"startGroup"===e.type)throw new Error("Missing a logical operator between groups");r=e.type,t.query.filter+=e.value})),0!=o)throw new Error("Group not properly closed");return this.query},t}();export{t as ConditionalOperator,o as GridifyQueryBuilder,r as LogicalOperator};
|
|
2
|
+
//# sourceMappingURL=index.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/GridifyOperator.ts","../src/GridifyQueryBuilder.ts"],"sourcesContent":[null,null],"names":["ConditionalOperator","LogicalOperator","GridifyQueryBuilder","this","query","page","pageSize","orderBy","filter","filteringExpressions","prototype","setPage","setPageSize","addOrderBy","field","descending","concat","trim","addCondition","operator","value","caseSensitive","escapeValue","filterValue","replace","toString","filterExpression","push","type","startGroup","endGroup","and","And","or","Or","build","_this","previousType","groupCounter","forEach","exp","Error"],"mappings":"IAAYA,EAeAC,GAfZ,SAAYD,GACTA,EAAA,MAAA,IACAA,EAAA,SAAA,KACAA,EAAA,SAAA,IACAA,EAAA,YAAA,IACAA,EAAA,mBAAA,KACAA,EAAA,gBAAA,KACAA,EAAA,SAAA,IACAA,EAAA,YAAA,KACAA,EAAA,WAAA,IACAA,EAAA,cAAA,KACAA,EAAA,SAAA,IACAA,EAAA,YAAA,IACF,CAbD,CAAYA,IAAAA,EAaX,CAAA,IAED,SAAYC,GACTA,EAAA,IAAA,IACAA,EAAA,GAAA,GACF,CAHD,CAAYA,IAAAA,EAGX,CAAA,ICfD,IAAAC,EAAA,WAAA,SAAAA,IACWC,KAAAC,MAAuB,CAC5BC,KAAM,EACNC,SAAU,GACVC,QAAS,GACTC,OAAQ,IAGHL,KAAoBM,qBAAkB,EAiIhD,CAAD,OA/HGP,EAAOQ,UAAAC,QAAP,SAAQN,GAEL,OADAF,KAAKC,MAAMC,KAAOA,EACXF,MAGVD,EAAWQ,UAAAE,YAAX,SAAYN,GAET,OADAH,KAAKC,MAAME,SAAWA,EACfH,MAGVD,EAAAQ,UAAAG,WAAA,SAAWC,EAAeC,QAAA,IAAAA,IAAAA,GAA2B,GAClD,IAAMR,EAAU,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EAAIZ,KAC9B,MAAM,IAAIa,MAAM,mDAInB,GAAqB,WAAjBJ,GAA0C,WAAbG,EAAIZ,KAClC,MAAM,IAAIa,MACP,8EAKN,GAAqB,OAAjBJ,GAAsC,OAAbG,EAAIZ,KAC9B,MAAM,IAAIa,MACP,mEAKN,GAAqB,eAAjBJ,GAA8C,OAAbG,EAAIZ,KACtC,MAAM,IAAIa,MACP,gEAKN,GAAqB,aAAjBJ,GAA4C,WAAbG,EAAIZ,KACpC,MAAM,IAAIa,MAAM,2CAInB,GAAqB,eAAjBJ,GAA8C,aAAbG,EAAIZ,KACtC,MAAM,IAAIa,MAAM,gCAInB,GAAqB,aAAjBJ,GAA4C,eAAbG,EAAIZ,KACpC,MAAM,IAAIa,MAAM,6CAGnBJ,EAAeG,EAAIZ,KACnBQ,EAAKhC,MAAMI,QAAUgC,EAAIpB,KAC5B,IAEoB,GAAhBkB,EACD,MAAM,IAAIG,MAAM,6BAGnB,OAAOtC,KAAKC,OAEjBF,CAAD"}
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
!function(
|
|
1
|
+
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((t="undefined"!=typeof globalThis?globalThis:t||self).GridifyClient={})}(this,(function(t){"use strict";var r,o;t.ConditionalOperator=void 0,(r=t.ConditionalOperator||(t.ConditionalOperator={})).Equal="=",r.NotEqual="!=",r.LessThan="<",r.GreaterThan=">",r.GreaterThanOrEqual=">=",r.LessThanOrEqual="<=",r.Contains="*",r.NotContains="!*",r.StartsWith="^",r.NotStartsWith="!^",r.EndsWith="$",r.NotEndsWith="!$",t.LogicalOperator=void 0,(o=t.LogicalOperator||(t.LogicalOperator={})).And=",",o.Or="|";var e=function(){function r(){this.query={page:1,pageSize:20,orderBy:"",filter:""},this.filteringExpressions=[]}return r.prototype.setPage=function(t){return this.query.page=t,this},r.prototype.setPageSize=function(t){return this.query.pageSize=t,this},r.prototype.addOrderBy=function(t,r){void 0===r&&(r=!1);var o="".concat(t.trim()," ").concat(r?"desc":"").trim();return this.query.orderBy=this.query.orderBy?"".concat(this.query.orderBy,", ").concat(o):o,this},r.prototype.addCondition=function(t,r,o,e,i){void 0===e&&(e=!0),void 0===i&&(i=!0);var n=o;i&&"string"==typeof o&&(n=o.replace(/([(),|]|\/i)/g,"\\$1")),n=e?n.toString():"".concat(n.toString(),"/i");var a="".concat(t.trim()).concat(r).concat(n);return this.filteringExpressions.push({value:a,type:"filter"}),this},r.prototype.startGroup=function(){return this.filteringExpressions.push({value:"(",type:"startGroup"}),this},r.prototype.endGroup=function(){return this.filteringExpressions.push({value:")",type:"endGroup"}),this},r.prototype.and=function(){return this.filteringExpressions.push({value:t.LogicalOperator.And,type:"op"}),this},r.prototype.or=function(){return this.filteringExpressions.push({value:t.LogicalOperator.Or,type:"op"}),this},r.prototype.build=function(){var t=this,r=null,o=0;if(this.filteringExpressions.forEach((function(e){if("startGroup"===e.type&&o++,"endGroup"===e.type&&o--,null===r&&"op"===e.type)throw new Error("expression cannot start with a logical operator");if("filter"===r&&"filter"===e.type)throw new Error("consecutive conditions are not allowed, consider adding a logical operator");if("op"===r&&"op"===e.type)throw new Error("consecutive operators are not allowed, consider adding a filter");if("startGroup"===r&&"op"===e.type)throw new Error("logical operator immediately after startGroup is not allowed");if("endGroup"===r&&"filter"===e.type)throw new Error("Missing logical operator after endGroup");if("startGroup"===r&&"endGroup"===e.type)throw new Error("Empty groups are not allowed");if("endGroup"===r&&"startGroup"===e.type)throw new Error("Missing a logical operator between groups");r=e.type,t.query.filter+=e.value})),0!=o)throw new Error("Group not properly closed");return this.query},r}();t.GridifyQueryBuilder=e}));
|
|
2
|
+
//# sourceMappingURL=index.umd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.umd.js","sources":["../src/GridifyOperator.ts","../src/GridifyQueryBuilder.ts"],"sourcesContent":[null,null],"names":["ConditionalOperator","LogicalOperator","exports","GridifyQueryBuilder","this","query","page","pageSize","orderBy","filter","filteringExpressions","prototype","setPage","setPageSize","addOrderBy","field","descending","concat","trim","addCondition","operator","value","caseSensitive","escapeValue","filterValue","replace","toString","filterExpression","push","type","startGroup","endGroup","and","And","or","Or","build","_this","previousType","groupCounter","forEach","exp","Error"],"mappings":"qPAAA,IAAYA,EAeAC,EAFXC,EAAAF,yBAAA,GAbWA,EAAAA,wBAAAA,EAAAA,oBAaX,CAAA,IAZE,MAAA,IACAA,EAAA,SAAA,KACAA,EAAA,SAAA,IACAA,EAAA,YAAA,IACAA,EAAA,mBAAA,KACAA,EAAA,gBAAA,KACAA,EAAA,SAAA,IACAA,EAAA,YAAA,KACAA,EAAA,WAAA,IACAA,EAAA,cAAA,KACAA,EAAA,SAAA,IACAA,EAAA,YAAA,KAMFE,EAAAD,qBAAA,GAHWA,EAAAA,EAAeA,kBAAfA,kBAGX,CAAA,IAFE,IAAA,IACAA,EAAA,GAAA,ICdH,IAAAE,EAAA,WAAA,SAAAA,IACWC,KAAAC,MAAuB,CAC5BC,KAAM,EACNC,SAAU,GACVC,QAAS,GACTC,OAAQ,IAGHL,KAAoBM,qBAAkB,EAiIhD,CAAD,OA/HGP,EAAOQ,UAAAC,QAAP,SAAQN,GAEL,OADAF,KAAKC,MAAMC,KAAOA,EACXF,MAGVD,EAAWQ,UAAAE,YAAX,SAAYN,GAET,OADAH,KAAKC,MAAME,SAAWA,EACfH,MAGVD,EAAAQ,UAAAG,WAAA,SAAWC,EAAeC,QAAA,IAAAA,IAAAA,GAA2B,GAClD,IAAMR,EAAU,GAAGS,OAAAF,EAAMG,mBAAUF,EAAa,OAAS,IAAKE,OAI9D,OAHAd,KAAKC,MAAMG,QAAUJ,KAAKC,MAAMG,QAC3B,UAAGJ,KAAKC,MAAMG,QAAY,MAAAS,OAAAT,GAC1BA,EACEJ,MAGVD,EAAYQ,UAAAQ,aAAZ,SACGJ,EACAK,EACAC,EACAC,EACAC,QADA,IAAAD,IAA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AM,IAAIa,MACP,gEAKN,GAAqB,aAAjBJ,GAA4C,WAAbG,EAAIZ,KACpC,MAAM,IAAIa,MAAM,2CAInB,GAAqB,eAAjBJ,GAA8C,aAAbG,EAAIZ,KACtC,MAAM,IAAIa,MAAM,gCAInB,GAAqB,aAAjBJ,GAA4C,eAAbG,EAAIZ,KACpC,MAAM,IAAIa,MAAM,6CAGnBJ,EAAeG,EAAIZ,KACnBQ,EAAKhC,MAAMI,QAAUgC,EAAIpB,KAC5B,IAEoB,GAAhBkB,EACD,MAAM,IAAIG,MAAM,6BAGnB,OAAOtC,KAAKC,OAEjBF,CAAD"}
|
package/package.json
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gridify-client",
|
|
3
|
-
"version": "2.0.0-preview.
|
|
3
|
+
"version": "2.0.0-preview.4",
|
|
4
4
|
"description": "Client JS library for the dotnet Gridify project",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
7
|
+
"browser": "dist/index.umd.js",
|
|
7
8
|
"types": "dist/index.d.ts",
|
|
8
9
|
"repository": "https://github.com/alirezanet/Gridify/",
|
|
9
10
|
"homepage": "https://alirezanet.github.io/Gridify/guide/gridify-client/",
|
|
10
11
|
"author": "AliReza Sabouri",
|
|
11
12
|
"license": "MIT",
|
|
12
13
|
"scripts": {
|
|
13
|
-
"build": "
|
|
14
|
-
"watch": "webpack --watch",
|
|
14
|
+
"build": "rollup -c",
|
|
15
15
|
"test": "jest"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
+
"@rollup/plugin-commonjs": "^25.0.7",
|
|
19
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
20
|
+
"@rollup/plugin-typescript": "^11.1.5",
|
|
18
21
|
"@types/jest": "^29.5.8",
|
|
19
22
|
"jest": "^29.7.0",
|
|
20
|
-
"terser-webpack-plugin": "^5.3.9",
|
|
21
23
|
"ts-jest": "^29.1.1",
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"webpack-cli": "^5.1.4",
|
|
27
|
-
"webpack-merge": "^5.10.0"
|
|
24
|
+
"rollup": "^4.4.0",
|
|
25
|
+
"rollup-plugin-terser": "^7.0.2",
|
|
26
|
+
"tslib": "^2.6.2",
|
|
27
|
+
"typescript": "^5.2.2"
|
|
28
28
|
},
|
|
29
29
|
"files": [
|
|
30
30
|
"dist/**/*"
|