meocli 0.1.7 → 0.1.9

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.
@@ -38,15 +38,9 @@ export const DEFAULT_ARGS = [
38
38
  "false",
39
39
  "--embedded-language-formatting",
40
40
  "auto",
41
- // plugins
42
- // '--plugin',
43
- // '@prettier/plugin-xml',
44
- // '--plugin',
45
- // 'prettier-plugin-toml',
46
- // '--plugin',
47
- // 'prettier-plugin-sh',
48
- // '--plugin',
49
- // 'prettier-plugin-nginx',
41
+ // prettier-plugin-ini
42
+ "--ini-space-around-equals",
43
+ "true",
50
44
  // xml
51
45
  "--xml-whitespace-sensitivity",
52
46
  "strict",
@@ -76,6 +70,7 @@ export const DEFAULT_CONFIG = {
76
70
  experimentalTernaries: false,
77
71
  htmlWhitespaceSensitivity: "css",
78
72
  indentEntries: true, // toml
73
+ iniSpaceAroundEquals: true, // prettier-plugin-ini
79
74
  insertPragma: false,
80
75
  jsxSingleQuote: false,
81
76
  objectWrap: "preserve",
@@ -88,6 +83,7 @@ export const DEFAULT_CONFIG = {
88
83
  "prettier-plugin-toml",
89
84
  "prettier-plugin-sh",
90
85
  "prettier-plugin-nginx",
86
+ "prettier-plugin-ini",
91
87
  ],
92
88
  printWidth: 80,
93
89
  proseWrap: "preserve",
@@ -112,6 +108,7 @@ export const DEFAULT_PLUGINS = [
112
108
  { main: "lib/index.cjs", name: "prettier-plugin-toml" },
113
109
  { main: "lib/index.cjs", name: "prettier-plugin-sh" },
114
110
  { main: "dist/index.js", name: "prettier-plugin-nginx" },
111
+ { main: "src/plugin.js", name: "prettier-plugin-ini" },
115
112
  ];
116
113
  // 默认的忽略模式
117
114
  export const DEFAULT_IGNORE_PATTERNS = [
package/dist/lib/ast.js CHANGED
@@ -45,7 +45,13 @@ export function objToAst(value) {
45
45
  // 递归处理嵌套对象
46
46
  valNode = objToAst(v);
47
47
  }
48
- props.push(t.objectProperty(t.identifier(k), valNode));
48
+ // 判断键名是否为有效标识符,不是则使用字符串字面量
49
+ const keyNode = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(k)
50
+ ? t.identifier(k)
51
+ : t.stringLiteral(k);
52
+ // shorthand 只能在 key 是 Identifier 时为 true
53
+ // computed: false 表示不使用方括号语法
54
+ props.push(t.objectProperty(keyNode, valNode, false, false));
49
55
  }
50
56
  return t.objectExpression(props);
51
57
  }
@@ -152,7 +152,7 @@
152
152
  "required": true
153
153
  }
154
154
  },
155
- "description": "Use Prettier to format file,集成:『@prettier/plugin-xml、prettier-plugin-toml、prettier-plugin-sh』、prettier-plugin-nginx",
155
+ "description": "Use Prettier to format file,集成:『@prettier/plugin-xml、prettier-plugin-toml、prettier-plugin-shprettier-plugin-nginx、prettier-plugin-ini』",
156
156
  "examples": [
157
157
  "<%= config.bin %> <%= command.id %> ./tests/test.svg",
158
158
  "<%= config.bin %> <%= command.id %> ./src/file.ts --config ./.prettierrc.yaml"
@@ -241,11 +241,16 @@
241
241
  "description": "目标js文件路径",
242
242
  "name": "filePath",
243
243
  "required": true
244
+ },
245
+ "templatePath": {
246
+ "description": "template.json配置文件路径",
247
+ "name": "templatePath",
248
+ "required": true
244
249
  }
245
250
  },
246
251
  "description": "修改Clash脚本",
247
252
  "examples": [
248
- "<%= config.bin %> <%= command.id %> ./tests/test.js"
253
+ "<%= config.bin %> <%= command.id %> ./test.js ./template.json"
249
254
  ],
250
255
  "flags": {
251
256
  "verbose": {
@@ -273,5 +278,5 @@
273
278
  ]
274
279
  }
275
280
  },
276
- "version": "0.1.7"
281
+ "version": "0.1.9"
277
282
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "meocli",
3
3
  "description": "Node CLI generated with oclif, Integrate Prettier",
4
- "version": "0.1.7",
4
+ "version": "0.1.9",
5
5
  "author": "meme2046",
6
6
  "bin": {
7
7
  "me": "./bin/run.js"
@@ -24,6 +24,7 @@
24
24
  "js-yaml": "^4.3.0",
25
25
  "lodash": "^4.18.1",
26
26
  "prettier": "^3.9.4",
27
+ "prettier-plugin-ini": "^1.3.0",
27
28
  "prettier-plugin-nginx": "^1.0.3",
28
29
  "prettier-plugin-sh": "^0.18.1",
29
30
  "prettier-plugin-toml": "^2.0.6",