nodelistparser 0.1.2 → 0.1.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/dist/cjs/index.d.ts +3 -1
- package/dist/cjs/index.js +12 -7
- package/dist/es/index.d.mts +3 -1
- package/dist/es/index.mjs +12 -7
- package/package.json +15 -11
package/dist/cjs/index.d.ts
CHANGED
|
@@ -260,12 +260,14 @@ declare namespace index$1 {
|
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
declare function decodeOne(sip002: string): ShadowSocksConfig;
|
|
263
|
+
declare function decodeBase64Multiline(text: string): string[];
|
|
263
264
|
declare function decodeMultiline(text: string): ShadowSocksConfig[];
|
|
264
265
|
|
|
266
|
+
declare const index_decodeBase64Multiline: typeof decodeBase64Multiline;
|
|
265
267
|
declare const index_decodeMultiline: typeof decodeMultiline;
|
|
266
268
|
declare const index_decodeOne: typeof decodeOne;
|
|
267
269
|
declare namespace index {
|
|
268
|
-
export { index_decodeMultiline as decodeMultiline, index_decodeOne as decodeOne };
|
|
270
|
+
export { index_decodeBase64Multiline as decodeBase64Multiline, index_decodeMultiline as decodeMultiline, index_decodeOne as decodeOne };
|
|
269
271
|
}
|
|
270
272
|
|
|
271
273
|
export { type HttpProxyConfig, type Hysteria2Config, type ShadowSocksConfig, type SharedConfigBase, type SnellConfig, type Socks5Config, type SupportedConfig, type TrojanBasicConfig, type TrojanConfig, type TuicConfig, type VmessConfig, index$1 as clash, index as ss, index$2 as surge };
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
var guard = require('foxts/guard');
|
|
2
|
+
|
|
1
3
|
const boolean = (text)=>text === 'true';
|
|
2
4
|
const number = Number;
|
|
3
5
|
const comma = (text)=>text.split(',').map((piece)=>piece.trim());
|
|
@@ -198,9 +200,6 @@ function decode$1(raw) {
|
|
|
198
200
|
// name, type, server, port, restDetails
|
|
199
201
|
// });
|
|
200
202
|
}
|
|
201
|
-
function assertNever(value, msg) {
|
|
202
|
-
throw new TypeError(`Unsupported type: ${msg}`);
|
|
203
|
-
}
|
|
204
203
|
const joinString = (arr)=>arr.filter(Boolean).join(', ');
|
|
205
204
|
function encode$1(config) {
|
|
206
205
|
const shared = [
|
|
@@ -272,7 +271,7 @@ function encode$1(config) {
|
|
|
272
271
|
...shared
|
|
273
272
|
]);
|
|
274
273
|
default:
|
|
275
|
-
|
|
274
|
+
guard.never(config, 'type (clash encode)');
|
|
276
275
|
}
|
|
277
276
|
}
|
|
278
277
|
|
|
@@ -476,7 +475,10 @@ var index$1 = {
|
|
|
476
475
|
|
|
477
476
|
function decodeOne(sip002) {
|
|
478
477
|
// ss://YWVzLTEyOC1nY206YzMxNWFhOGMtNGU1NC00MGRjLWJkYzctYzFjMjEwZjIxYTNi@ss1.meslink.xyz:10009#%F0%9F%87%AD%F0%9F%87%B0%20HK1%20HKT
|
|
479
|
-
const [
|
|
478
|
+
const [type, payload] = sip002.split('://');
|
|
479
|
+
if (type !== 'ss') {
|
|
480
|
+
throw new Error(`[ss.decodeOne] Unsupported type: ${type}`);
|
|
481
|
+
}
|
|
480
482
|
const [userInfo, server] = payload.split('@');
|
|
481
483
|
let cipher, password;
|
|
482
484
|
if (userInfo.includes(':')) {
|
|
@@ -499,13 +501,16 @@ function decodeOne(sip002) {
|
|
|
499
501
|
udp: true
|
|
500
502
|
};
|
|
501
503
|
}
|
|
504
|
+
function decodeBase64Multiline(text) {
|
|
505
|
+
return atob(text).replaceAll('\r\n', '\n').split('\n').filter(Boolean);
|
|
506
|
+
}
|
|
502
507
|
function decodeMultiline(text) {
|
|
503
|
-
|
|
504
|
-
return lines.filter(Boolean).map((line)=>decodeOne(line));
|
|
508
|
+
return decodeBase64Multiline(text).map((line)=>decodeOne(line));
|
|
505
509
|
}
|
|
506
510
|
|
|
507
511
|
var index = {
|
|
508
512
|
__proto__: null,
|
|
513
|
+
decodeBase64Multiline: decodeBase64Multiline,
|
|
509
514
|
decodeMultiline: decodeMultiline,
|
|
510
515
|
decodeOne: decodeOne
|
|
511
516
|
};
|
package/dist/es/index.d.mts
CHANGED
|
@@ -260,12 +260,14 @@ declare namespace index$1 {
|
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
declare function decodeOne(sip002: string): ShadowSocksConfig;
|
|
263
|
+
declare function decodeBase64Multiline(text: string): string[];
|
|
263
264
|
declare function decodeMultiline(text: string): ShadowSocksConfig[];
|
|
264
265
|
|
|
266
|
+
declare const index_decodeBase64Multiline: typeof decodeBase64Multiline;
|
|
265
267
|
declare const index_decodeMultiline: typeof decodeMultiline;
|
|
266
268
|
declare const index_decodeOne: typeof decodeOne;
|
|
267
269
|
declare namespace index {
|
|
268
|
-
export { index_decodeMultiline as decodeMultiline, index_decodeOne as decodeOne };
|
|
270
|
+
export { index_decodeBase64Multiline as decodeBase64Multiline, index_decodeMultiline as decodeMultiline, index_decodeOne as decodeOne };
|
|
269
271
|
}
|
|
270
272
|
|
|
271
273
|
export { type HttpProxyConfig, type Hysteria2Config, type ShadowSocksConfig, type SharedConfigBase, type SnellConfig, type Socks5Config, type SupportedConfig, type TrojanBasicConfig, type TrojanConfig, type TuicConfig, type VmessConfig, index$1 as clash, index as ss, index$2 as surge };
|
package/dist/es/index.mjs
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { never } from 'foxts/guard';
|
|
2
|
+
|
|
1
3
|
const boolean = (text)=>text === 'true';
|
|
2
4
|
const number = Number;
|
|
3
5
|
const comma = (text)=>text.split(',').map((piece)=>piece.trim());
|
|
@@ -198,9 +200,6 @@ function decode$1(raw) {
|
|
|
198
200
|
// name, type, server, port, restDetails
|
|
199
201
|
// });
|
|
200
202
|
}
|
|
201
|
-
function assertNever(value, msg) {
|
|
202
|
-
throw new TypeError(`Unsupported type: ${msg}`);
|
|
203
|
-
}
|
|
204
203
|
const joinString = (arr)=>arr.filter(Boolean).join(', ');
|
|
205
204
|
function encode$1(config) {
|
|
206
205
|
const shared = [
|
|
@@ -272,7 +271,7 @@ function encode$1(config) {
|
|
|
272
271
|
...shared
|
|
273
272
|
]);
|
|
274
273
|
default:
|
|
275
|
-
|
|
274
|
+
never(config, 'type (clash encode)');
|
|
276
275
|
}
|
|
277
276
|
}
|
|
278
277
|
|
|
@@ -476,7 +475,10 @@ var index$1 = {
|
|
|
476
475
|
|
|
477
476
|
function decodeOne(sip002) {
|
|
478
477
|
// ss://YWVzLTEyOC1nY206YzMxNWFhOGMtNGU1NC00MGRjLWJkYzctYzFjMjEwZjIxYTNi@ss1.meslink.xyz:10009#%F0%9F%87%AD%F0%9F%87%B0%20HK1%20HKT
|
|
479
|
-
const [
|
|
478
|
+
const [type, payload] = sip002.split('://');
|
|
479
|
+
if (type !== 'ss') {
|
|
480
|
+
throw new Error(`[ss.decodeOne] Unsupported type: ${type}`);
|
|
481
|
+
}
|
|
480
482
|
const [userInfo, server] = payload.split('@');
|
|
481
483
|
let cipher, password;
|
|
482
484
|
if (userInfo.includes(':')) {
|
|
@@ -499,13 +501,16 @@ function decodeOne(sip002) {
|
|
|
499
501
|
udp: true
|
|
500
502
|
};
|
|
501
503
|
}
|
|
504
|
+
function decodeBase64Multiline(text) {
|
|
505
|
+
return atob(text).replaceAll('\r\n', '\n').split('\n').filter(Boolean);
|
|
506
|
+
}
|
|
502
507
|
function decodeMultiline(text) {
|
|
503
|
-
|
|
504
|
-
return lines.filter(Boolean).map((line)=>decodeOne(line));
|
|
508
|
+
return decodeBase64Multiline(text).map((line)=>decodeOne(line));
|
|
505
509
|
}
|
|
506
510
|
|
|
507
511
|
var index = {
|
|
508
512
|
__proto__: null,
|
|
513
|
+
decodeBase64Multiline: decodeBase64Multiline,
|
|
509
514
|
decodeMultiline: decodeMultiline,
|
|
510
515
|
decodeOne: decodeOne
|
|
511
516
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nodelistparser",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Surge / Mihomo (Clash.Meta) nodelist / proxy provider parser and generator.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -33,19 +33,23 @@
|
|
|
33
33
|
],
|
|
34
34
|
"author": "Sukka <https://skk.moe>",
|
|
35
35
|
"license": "MIT",
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"foxts": "^1.5.1"
|
|
38
|
+
},
|
|
36
39
|
"devDependencies": {
|
|
37
|
-
"@eslint-sukka/node": "^6.
|
|
40
|
+
"@eslint-sukka/node": "^6.14.0",
|
|
38
41
|
"@swc-node/register": "^1.10.9",
|
|
39
|
-
"@
|
|
40
|
-
"@types/
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"eslint
|
|
45
|
-
"eslint-
|
|
42
|
+
"@swc/core": "^1.10.16",
|
|
43
|
+
"@types/mocha": "^10.0.10",
|
|
44
|
+
"@types/node": "^22.13.4",
|
|
45
|
+
"bumpp": "^10.0.3",
|
|
46
|
+
"bunchee": "^6.3.4",
|
|
47
|
+
"eslint": "^9.20.1",
|
|
48
|
+
"eslint-config-sukka": "^6.14.0",
|
|
49
|
+
"eslint-formatter-sukka": "^6.14.0",
|
|
46
50
|
"expect": "^29.7.0",
|
|
47
|
-
"mocha": "^
|
|
48
|
-
"typescript": "^5.
|
|
51
|
+
"mocha": "^11.1.0",
|
|
52
|
+
"typescript": "^5.7.3"
|
|
49
53
|
},
|
|
50
54
|
"scripts": {
|
|
51
55
|
"lint": "eslint --format=sukka .",
|