@subconverter/core 0.1.0 → 0.2.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/LICENSE +674 -0
- package/README.md +69 -0
- package/dist/index.cjs +1442 -281
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +227 -2
- package/dist/index.d.ts +227 -2
- package/dist/index.js +1442 -281
- package/dist/index.js.map +1 -1
- package/package.json +24 -1
package/README.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# @subconverter/core
|
|
2
|
+
|
|
3
|
+
Platform-free conversion engine of
|
|
4
|
+
[subconverter-ts](https://github.com/jinganix/subconverter): subscription and config
|
|
5
|
+
parsing, node manipulation, and re-emission. It has no Node.js built-in imports and no DOM
|
|
6
|
+
globals, so the same code runs on Node.js, in the browser, and in a worker.
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm i @subconverter/core
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Quick start
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
import { TargetFormat, generate, parseSubscription } from "@subconverter/core";
|
|
16
|
+
|
|
17
|
+
const nodes = parseSubscription(await response.text());
|
|
18
|
+
const clash = generate(nodes, { target: TargetFormat.Clash });
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
`parseSubscription` auto-detects the input format. `generate` returns the text for the
|
|
22
|
+
requested target and can drop node types that target cannot express.
|
|
23
|
+
|
|
24
|
+
## Supported input
|
|
25
|
+
|
|
26
|
+
Share-link lists (plain or base64), `ssd://` subscriptions, Clash YAML, Surge/Loon INI,
|
|
27
|
+
and app JSON exports (Shadowsocks `ssconf`, SSR, v2rayN, SSTap, Netch).
|
|
28
|
+
|
|
29
|
+
Link schemes: `ss://`, `ssr://`, `vmess://`, `vless://`, `trojan://`, `hysteria://`,
|
|
30
|
+
`hysteria2://` / `hy2://`, `tuic://`, `anytls://`, `socks://`, `tg://socks`,
|
|
31
|
+
`tg://http`, and `Netch://`. WireGuard, Snell, and Hysteria v1 come from config files
|
|
32
|
+
only, since they have no share-link scheme.
|
|
33
|
+
|
|
34
|
+
## Supported output
|
|
35
|
+
|
|
36
|
+
`clash`, `clashr`, `surge`, `surfboard`, `quanx`, `quan`, `loon`, `mellow`, `singbox`,
|
|
37
|
+
`v2ray`, `trojan`, `ss`, `ssr`, `sssub`, `ssd`, `mixed`, and `nodelist` — see the
|
|
38
|
+
[`TargetFormat` enum](https://github.com/jinganix/subconverter/blob/main/docs/API.md).
|
|
39
|
+
|
|
40
|
+
Also included: ruleset conversion between Surge / Quantumult X / Clash dialects,
|
|
41
|
+
proxy-group compilation with every subconverter matcher, external `[custom]` INI config
|
|
42
|
+
parsing, `/sub` query-string parsing, node rename/emoji/country- prefix rules, and
|
|
43
|
+
`subscription-userinfo` quota conversion.
|
|
44
|
+
|
|
45
|
+
## Defaults
|
|
46
|
+
|
|
47
|
+
- Rules are **on**: with no `rulesets` and no `groups`, generation falls back to bundled
|
|
48
|
+
upstream-like defaults. Pass `includeRules: false` to strip them.
|
|
49
|
+
- `surge` targets version **5** by default (`surgeVersion`).
|
|
50
|
+
- `autoCountry` needs a `countryResolver`; `@subconverter/node` supplies a GeoIP-backed
|
|
51
|
+
one.
|
|
52
|
+
|
|
53
|
+
## API reference
|
|
54
|
+
|
|
55
|
+
Every public export with its signature, enum members, and interface fields:
|
|
56
|
+
[docs/API.md](https://github.com/jinganix/subconverter/blob/main/docs/API.md).
|
|
57
|
+
|
|
58
|
+
## Related packages
|
|
59
|
+
|
|
60
|
+
| Package | Purpose |
|
|
61
|
+
| -------------------------------------------------------------------------- | -------------------------------------------- |
|
|
62
|
+
| [`@subconverter/node`](https://npmjs.com/package/@subconverter/node) | Node adapter: fetch/fs, GeoIP, `/sub` server |
|
|
63
|
+
| [`@subconverter/browser`](https://npmjs.com/package/@subconverter/browser) | Browser ESM + IIFE global |
|
|
64
|
+
| [`@subconverter/cli`](https://npmjs.com/package/@subconverter/cli) | `subconverter` command |
|
|
65
|
+
|
|
66
|
+
## License
|
|
67
|
+
|
|
68
|
+
GPL-3.0. The engine is a faithful port of
|
|
69
|
+
[tindy2013/subconverter](https://github.com/tindy2013/subconverter).
|