@sfirew/minecraft-motd-parser 1.1.4 → 1.1.5-dev.1
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 +281 -0
- package/README.md +125 -221
- package/coverage/base.css +224 -0
- package/coverage/block-navigation.js +87 -0
- package/coverage/coverage-summary.json +13 -0
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +131 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +131 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +196 -0
- package/coverage/lcov.info +633 -0
- package/coverage/prettify.css +1 -0
- package/coverage/prettify.js +2 -0
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +196 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/jest.config.ts +32 -0
- package/package.json +6 -1
- package/types/utils.d.ts +17 -10
- package/jest.config.js +0 -5
package/package.json
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sfirew/minecraft-motd-parser",
|
|
3
3
|
"description": "Minecraft Server MOTD Parser, can convert to html, json, text.",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.5-dev.1",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
7
7
|
"types": "types/index.d.ts",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"scripts": {
|
|
10
10
|
"test": "jest",
|
|
11
|
+
"test:coverage": "jest --coverage",
|
|
12
|
+
"test:watch": "jest --watch",
|
|
13
|
+
"test:performance": "jest --testNamePattern=\"Performance test|Stress test\"",
|
|
14
|
+
"test:security": "jest --testNamePattern=\"Security Tests\"",
|
|
15
|
+
"test:all": "jest --coverage --verbose",
|
|
11
16
|
"test-self": "ts-node ./src/test.ts",
|
|
12
17
|
"build": "yarn build:dist && yarn build:declarations",
|
|
13
18
|
"build:dist": "tsup --format cjs,esm",
|
package/types/utils.d.ts
CHANGED
|
@@ -1,24 +1,31 @@
|
|
|
1
1
|
import { motdJsonType } from "./types";
|
|
2
|
-
export declare function isMotdJSONType(object: object): object is motdJsonType;
|
|
3
2
|
/**
|
|
4
|
-
*
|
|
5
|
-
|
|
3
|
+
* Base color code regex
|
|
4
|
+
*/
|
|
5
|
+
export declare const baseColorCodeRegex: RegExp;
|
|
6
|
+
export declare function isMotdJSONType(object: any): object is motdJsonType;
|
|
7
|
+
/**
|
|
8
|
+
* Replace all HTML special characters with HTML entities
|
|
9
|
+
* Prevents HTML injection by safely encoding special characters
|
|
6
10
|
*/
|
|
7
11
|
export declare function htmlStringFormatting(text: string): string;
|
|
8
12
|
/**
|
|
9
|
-
*
|
|
13
|
+
* Clean HTML tags safely
|
|
14
|
+
*
|
|
15
|
+
* Safely removes HTML tags and prevents HTML injection vulnerabilities.
|
|
10
16
|
*
|
|
11
|
-
* @param text
|
|
12
|
-
* example
|
|
17
|
+
* @param text - Input text that may contain HTML tags
|
|
18
|
+
* @example `<span>hello world</span>` → `hello world`
|
|
13
19
|
*
|
|
14
|
-
*
|
|
20
|
+
* @returns Clean text without HTML tags
|
|
15
21
|
*/
|
|
16
22
|
export declare function cleanHtmlTags(text: string): string;
|
|
17
23
|
/**
|
|
18
|
-
*
|
|
24
|
+
* Clean MOTD color codes
|
|
19
25
|
*
|
|
20
|
-
* Clean all codes from
|
|
26
|
+
* Clean all formatting codes from MOTD source string.
|
|
21
27
|
*
|
|
22
|
-
* @param {string} text -
|
|
28
|
+
* @param {string} text - MOTD string with § formatting codes to be removed
|
|
29
|
+
* @returns {string} Text without MOTD formatting codes
|
|
23
30
|
*/
|
|
24
31
|
export declare function cleanCodes(text: string): string;
|