meta-json-schema 1.18.3-beta
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/.gitattributes +2 -0
- package/.vscode/extensions.json +3 -0
- package/.vscode/settings.json +18 -0
- package/CHANGELOG.md +9 -0
- package/LICENSE +21 -0
- package/README.md +200 -0
- package/package.json +40 -0
- package/schemas/clash-verge-merge-json-schema.json +1 -0
- package/schemas/meta-json-schema.json +1 -0
- package/scripts/release.mjs +16 -0
- package/scripts/util/bundle.mjs +91 -0
- package/scripts/util/env.mjs +9 -0
- package/scripts/util/file.mjs +13 -0
- package/scripts/watch.mjs +28 -0
- package/src/clash-verge-merge-json-schema.json +88 -0
- package/src/definitions/compatible.json +6 -0
- package/src/definitions/enums.json +57 -0
- package/src/definitions/patterns.json +87 -0
- package/src/definitions/types.json +155 -0
- package/src/meta-json-schema.json +168 -0
- package/src/modules/adapter/outbound/base.json +91 -0
- package/src/modules/adapter/outbound/direct.json +39 -0
- package/src/modules/adapter/outbound/dns.json +39 -0
- package/src/modules/adapter/outbound/http.json +101 -0
- package/src/modules/adapter/outbound/hysteria.json +182 -0
- package/src/modules/adapter/outbound/hysteria2.json +146 -0
- package/src/modules/adapter/outbound/reality.json +25 -0
- package/src/modules/adapter/outbound/shadowsocks.json +308 -0
- package/src/modules/adapter/outbound/shadowsocksr.json +151 -0
- package/src/modules/adapter/outbound/singmux.json +95 -0
- package/src/modules/adapter/outbound/snell.json +65 -0
- package/src/modules/adapter/outbound/socks5.json +88 -0
- package/src/modules/adapter/outbound/ssh.json +87 -0
- package/src/modules/adapter/outbound/trojan.json +93 -0
- package/src/modules/adapter/outbound/tuic.json +213 -0
- package/src/modules/adapter/outbound/vless.json +146 -0
- package/src/modules/adapter/outbound/vmess.json +251 -0
- package/src/modules/adapter/outbound/wireguard.json +150 -0
- package/src/modules/adapter/outboundgroup/fallback.json +18 -0
- package/src/modules/adapter/outboundgroup/groupbase.json +98 -0
- package/src/modules/adapter/outboundgroup/loadbalance.json +29 -0
- package/src/modules/adapter/outboundgroup/relay.json +18 -0
- package/src/modules/adapter/outboundgroup/urltest.json +25 -0
- package/src/modules/adapter/provider/health-check.json +73 -0
- package/src/modules/adapter/provider/provider.json +159 -0
- package/src/modules/config/authentication.json +9 -0
- package/src/modules/config/controller.json +47 -0
- package/src/modules/config/dns.json +156 -0
- package/src/modules/config/ebpf.json +22 -0
- package/src/modules/config/experimental.json +31 -0
- package/src/modules/config/general.json +140 -0
- package/src/modules/config/geox-url.json +38 -0
- package/src/modules/config/hosts.json +9 -0
- package/src/modules/config/inbound.json +98 -0
- package/src/modules/config/iptables.json +38 -0
- package/src/modules/config/listeners.json +90 -0
- package/src/modules/config/ntp.json +50 -0
- package/src/modules/config/profile.json +24 -0
- package/src/modules/config/proxies.json +118 -0
- package/src/modules/config/proxy-groups.json +21 -0
- package/src/modules/config/proxy-providers.json +11 -0
- package/src/modules/config/rules.json +11 -0
- package/src/modules/config/sniffer.json +111 -0
- package/src/modules/config/sub-rules.json +14 -0
- package/src/modules/config/tls.json +28 -0
- package/src/modules/config/tunnels.json +49 -0
- package/src/modules/listener/config/tuic.json +102 -0
- package/src/modules/listener/config/tun.json +205 -0
- package/src/modules/listener/inbound/base.json +43 -0
- package/src/modules/listener/inbound/http.json +18 -0
- package/src/modules/listener/inbound/hysteria2.json +102 -0
- package/src/modules/listener/inbound/mixed.json +26 -0
- package/src/modules/listener/inbound/mux.json +42 -0
- package/src/modules/listener/inbound/redir.json +18 -0
- package/src/modules/listener/inbound/shadowsocks.json +41 -0
- package/src/modules/listener/inbound/socks.json +26 -0
- package/src/modules/listener/inbound/tproxy.json +26 -0
- package/src/modules/listener/inbound/tuic.json +84 -0
- package/src/modules/listener/inbound/tun.json +207 -0
- package/src/modules/listener/inbound/tunnel.json +33 -0
- package/src/modules/listener/inbound/vmess.json +72 -0
- package/src/modules/listener/sing/sing.json +42 -0
- package/src/modules/rules/provider/provider.json +71 -0
- package/src/modules/rules/rule.json +165 -0
- package/test/clash-meta/example1.yaml +3170 -0
- package/test/clash-verge/merge.yaml +212 -0
package/.gitattributes
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"json.schemas": [
|
|
3
|
+
{
|
|
4
|
+
"url": "http://json-schema.org/draft-07/schema",
|
|
5
|
+
"fileMatch": ["/src/**/*.json"]
|
|
6
|
+
}
|
|
7
|
+
],
|
|
8
|
+
"yaml.schemas": {
|
|
9
|
+
".temp/meta-json-schema.json": "test/clash-meta/**/*.yaml",
|
|
10
|
+
".temp/clash-verge-merge-json-schema.json": "test/clash-verge/**/*.yaml"
|
|
11
|
+
},
|
|
12
|
+
"editor.tabSize": 2,
|
|
13
|
+
"files.exclude": {
|
|
14
|
+
".gitattributes": true,
|
|
15
|
+
".gitignore": true,
|
|
16
|
+
"package-lock.json": true
|
|
17
|
+
}
|
|
18
|
+
}
|
package/CHANGELOG.md
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 dongchengjie
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
## 用法
|
|
2
|
+
|
|
3
|
+
<details>
|
|
4
|
+
<summary>Visual Studio Code中使用</summary>
|
|
5
|
+
|
|
6
|
+
1. 安装YAML语法支持插件`redhat.vscode-yaml`。
|
|
7
|
+
2. 在`.vscode`目录下的`settings.json`文件中(如不存在则手动创建),填入以下内容。其中,key为schema文件的地址,value为路径通配符,请根据需求自行修改。
|
|
8
|
+
```json
|
|
9
|
+
{
|
|
10
|
+
"yaml.schemas": {
|
|
11
|
+
"https://fastly.jsdelivr.net/gh/dongchengjie/meta-json-schema@main/schemas/meta-json-schema.json": "**/*.yaml"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
</details>
|
|
17
|
+
<details>
|
|
18
|
+
<summary>Monaco Editor中使用</summary>
|
|
19
|
+
|
|
20
|
+
1. 安装`monaco-editor`(编辑器)和`monaco-yaml`(YAML支持)。
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
npm install monaco-editor
|
|
24
|
+
npm install monaco-yaml
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
2. 如果是vite项目,可通过安装插件简化初始化(其他构建工具如`webpack`请参考[monaco-yaml文档](https://github.com/remcohaszing/monaco-yaml?tab=readme-ov-file#using-monaco-webpack-loader-plugin))。
|
|
28
|
+
|
|
29
|
+
1. 安装`vite-plugin-monaco-editor`。
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
npm install vite-plugin-monaco-editor
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
2. 配置`vite.config.ts`。
|
|
36
|
+
|
|
37
|
+
```javascript
|
|
38
|
+
import { defineConfig } from 'vite';
|
|
39
|
+
import monacoEditor from 'vite-plugin-monaco-editor';
|
|
40
|
+
export default defineConfig({
|
|
41
|
+
plugins: [
|
|
42
|
+
monacoEditor({
|
|
43
|
+
languageWorkers: ['editorWorkerService'],
|
|
44
|
+
customWorkers: [
|
|
45
|
+
{
|
|
46
|
+
label: 'yaml',
|
|
47
|
+
entry: 'monaco-yaml/yaml.worker'
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
})
|
|
51
|
+
]
|
|
52
|
+
});
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
3. 代码中配置schema(请根据需求自行修改`fileMatch`)。
|
|
56
|
+
|
|
57
|
+
```javascript
|
|
58
|
+
import * as monaco from 'monaco-editor';
|
|
59
|
+
import { configureMonacoYaml } from 'monaco-yaml';
|
|
60
|
+
|
|
61
|
+
configureMonacoYaml(monaco, {
|
|
62
|
+
validate: true,
|
|
63
|
+
enableSchemaRequest: true,
|
|
64
|
+
schemas: [
|
|
65
|
+
{
|
|
66
|
+
uri: 'https://fastly.jsdelivr.net/gh/dongchengjie/airport@main/meta-json-schema.json',
|
|
67
|
+
fileMatch: ['**/*.clash.yaml']
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
});
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
</details>
|
|
74
|
+
|
|
75
|
+
## 可视化
|
|
76
|
+
|
|
77
|
+
- <a href="https://dongchengjie.github.io/meta-json-schema/?schema=https://raw.githubusercontent.com/dongchengjie/meta-json-schema/main/schemas/meta-json-schema.json" target="_blank">meta-json-schema</a>
|
|
78
|
+
|
|
79
|
+
- <a href="https://dongchengjie.github.io/meta-json-schema/?schema=https://raw.githubusercontent.com/dongchengjie/meta-json-schema/main/schemas/clash-verge-merge-json-schema.json" target="_blank">clash-verge-merge-json-schema</a>
|
|
80
|
+
|
|
81
|
+
## 开发
|
|
82
|
+
|
|
83
|
+
1. 下载代码
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
git clone https://github.com/dongchengjie/meta-json-schema.git
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
2. 使用Visual Studio Code打开项目(工作目录为.vscode所在目录)。
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
code /path/to/project/location
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
> [!NOTE]
|
|
96
|
+
> 项目打开后会弹出建议安装YAML插件的提示,请点击确认安装或手动安装,以获取良好的开发体验。
|
|
97
|
+
|
|
98
|
+
3. 安装依赖
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
npm install
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
4. 启动项目。执行下列命令后,会对`src`目录进行监视,如果发生变动则会对项目进行bundle,输出到`.temp`目录下。
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
npm run dev
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
5. 测试schema。由于`.vscode`目录下`settings.json`中已事先配置了如下配置(`test`目录下的文件使用`.temp`目录下输出的schema文件)。因此可以对`src`进行修改,并在`test`目录下新增测试文件,及时观察变动并做出修正。
|
|
111
|
+
|
|
112
|
+
```yaml
|
|
113
|
+
"yaml.schemas": {
|
|
114
|
+
".temp/meta-json-schema.json": "test/clash-meta/**/*.yaml",
|
|
115
|
+
".temp/clash-verge-merge-json-schema.json": "test/clash-verge/**/*.yaml"
|
|
116
|
+
},
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
6. 发布release。执行下列命令后,会根据`package.json`文件中定义的`releases`进行输出,并根据`optimization`决定是否进行压缩。
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
npm run release
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## 语法参考
|
|
126
|
+
|
|
127
|
+
<details>
|
|
128
|
+
<summary>JSON Schema标准语法</summary>
|
|
129
|
+
|
|
130
|
+
项目使用的JSON Schema版本为[`draft-07`](https://json-schema.org/draft-07/json-schema-release-notes),语法请参考[JSON Schema Reference](https://json-schema.org/understanding-json-schema/reference)。
|
|
131
|
+
|
|
132
|
+
</details>
|
|
133
|
+
|
|
134
|
+
<details>
|
|
135
|
+
<summary>Monaco Editor扩展语法</summary>
|
|
136
|
+
|
|
137
|
+
> Monaco 编辑器是为 VS Code 提供支持的开源代码编辑器,使用下列属性提供更丰富的`Snippet`支持。
|
|
138
|
+
|
|
139
|
+
```typescript
|
|
140
|
+
interface JSONSchema {
|
|
141
|
+
// 自定义Snippet建议(数组)
|
|
142
|
+
defaultSnippets?: {
|
|
143
|
+
label?: string; // 标题
|
|
144
|
+
description?: string; // 描述
|
|
145
|
+
markdownDescription?: string; // 描述(markdown格式)
|
|
146
|
+
body?: any; // 内容
|
|
147
|
+
bodyText?: string; // 内容文本
|
|
148
|
+
}[];
|
|
149
|
+
errorMessage?: string; // 错误信息
|
|
150
|
+
patternErrorMessage?: string; // 格式错误信息(优先级高于errorMessage)
|
|
151
|
+
deprecationMessage?: string; // 过时错误信息
|
|
152
|
+
enumDescriptions?: string[]; // 枚举描述信息(数组)
|
|
153
|
+
markdownEnumDescriptions?: string[]; // 枚举描述信息(markdown格式)
|
|
154
|
+
markdownDescription?: string; // 描述信息(markdown格式)
|
|
155
|
+
doNotSuggest?: boolean; // 不显示建议
|
|
156
|
+
suggestSortText?: string; // 属性值建议排序符(默认为属性名)
|
|
157
|
+
allowComments?: boolean; // 允许注释
|
|
158
|
+
allowTrailingCommas?: boolean; // 允许尾随逗号
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
</details>
|
|
163
|
+
|
|
164
|
+
## FAQ
|
|
165
|
+
|
|
166
|
+
### definitions中的`compatible.json`文件的用途是什么?
|
|
167
|
+
|
|
168
|
+
YAML支持`Folded Style`和`Inline Style`的写法。
|
|
169
|
+
使用`"type": "boolean"`来定义某个属性,那么`'true'`和`'false'`就会提示`Incorrect type. Expected "boolean".`。因此引入compatible类型,以兼容多种编码风格。
|
|
170
|
+
|
|
171
|
+
<details>
|
|
172
|
+
<summary>Inline Style</summary>
|
|
173
|
+
|
|
174
|
+
```
|
|
175
|
+
proxies:
|
|
176
|
+
- {name: 'proxy1', type: 'ss', cipher: 'auto', tls: 'true'}
|
|
177
|
+
- {name: proxy2, type: ss, cipher: auto, tls: true}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
</details>
|
|
181
|
+
|
|
182
|
+
<details>
|
|
183
|
+
<summary>Folded Style</summary>
|
|
184
|
+
|
|
185
|
+
```
|
|
186
|
+
proxies:
|
|
187
|
+
- name: 'proxy1'
|
|
188
|
+
type: 'ss'
|
|
189
|
+
cipher: 'auto'
|
|
190
|
+
tls: 'true'
|
|
191
|
+
- name: proxy1
|
|
192
|
+
type: ss
|
|
193
|
+
cipher: auto
|
|
194
|
+
tls: true
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
</details>
|
|
198
|
+
|
|
199
|
+
> [!NOTE]
|
|
200
|
+
> 由于这种情况多发生于`proxies`配置部分,所以目前仅`proxies`配置中使用了`compatible.json`,其余地方可视情况使用。
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "meta-json-schema",
|
|
3
|
+
"version": "1.18.3-beta",
|
|
4
|
+
"keywords": [
|
|
5
|
+
"clash",
|
|
6
|
+
"clash.meta",
|
|
7
|
+
"schema"
|
|
8
|
+
],
|
|
9
|
+
"publishConfig": {
|
|
10
|
+
"registry": "https://registry.npmjs.org"
|
|
11
|
+
},
|
|
12
|
+
"config": {
|
|
13
|
+
"watches": [
|
|
14
|
+
"./src/meta-json-schema.json",
|
|
15
|
+
"./src/clash-verge-merge-json-schema.json"
|
|
16
|
+
],
|
|
17
|
+
"releases": [
|
|
18
|
+
{
|
|
19
|
+
"enabled": true,
|
|
20
|
+
"source": "./src/meta-json-schema.json",
|
|
21
|
+
"target": "./schemas/meta-json-schema.json",
|
|
22
|
+
"optimization": true
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"enabled": true,
|
|
26
|
+
"source": "./src/clash-verge-merge-json-schema.json",
|
|
27
|
+
"target": "./schemas/clash-verge-merge-json-schema.json",
|
|
28
|
+
"optimization": true
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"dev": "node ./scripts/watch.mjs",
|
|
34
|
+
"release": "node ./scripts/release.mjs"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@apidevtools/json-schema-ref-parser": "^11.5.4",
|
|
38
|
+
"prettier": "^3.2.5"
|
|
39
|
+
}
|
|
40
|
+
}
|