@markuplint/ml-config 5.0.0-dev.5 → 5.0.0-rc.0
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/ARCHITECTURE.ja.md +4 -3
- package/ARCHITECTURE.md +4 -3
- package/CHANGELOG.md +6 -0
- package/lib/merge-config.js +2 -1
- package/lib/types.d.ts +38 -11
- package/package.json +6 -6
package/ARCHITECTURE.ja.md
CHANGED
|
@@ -94,7 +94,8 @@ type RuleConfig<T, O> = {
|
|
|
94
94
|
|
|
95
95
|
- `Pretender` -- CSS セレクタを使用してカスタム要素を標準要素に見せかける。`as` フィールドで要素名または詳細な `OriginalNode` を指定
|
|
96
96
|
- `OriginalNode` -- 要素名、スロット、名前空間、属性、継承属性、ARIA プロパティを定義
|
|
97
|
-
- `PretenderDetails` -- マージ後に使用される正規化形式 `{data?, files?, imports?}`
|
|
97
|
+
- `PretenderDetails` -- マージ後に使用される正規化形式 `{data?, files?, imports?, scan?}`
|
|
98
|
+
- `PretenderScanConfig` -- 動的スキャン設定 `{files, ignoreComponentNames?}`。拡張子によりスキャナーを自動判定(`.js/.jsx/.ts/.tsx` → JSX スキャナー、`.vue/.svelte/.astro` → テンプレートスキャナー)
|
|
98
99
|
|
|
99
100
|
### 自動修正型
|
|
100
101
|
|
|
@@ -139,7 +140,7 @@ flowchart TD
|
|
|
139
140
|
| `specs` | オブジェクト shallow merge | `mergeObject()` | 同上 |
|
|
140
141
|
| `excludeFiles` | 結合+重複排除 | `concatArray(uniquely=true)` | 単純な値の重複排除 |
|
|
141
142
|
| `severity` | オブジェクト shallow merge | `mergeObject()` | parser と同様 |
|
|
142
|
-
| `pretenders` | セマンティックマージ | `mergePretenders()` | files/imports: 上書き、data: 追加
|
|
143
|
+
| `pretenders` | セマンティックマージ | `mergePretenders()` | files/imports: 上書き、data/scan: 追加 |
|
|
143
144
|
| `rules` | ルール別マージ | `mergeRules()` → `mergeRule()` | **最も複雑 -- 次節で詳述** |
|
|
144
145
|
| `nodeRules` | 結合+名前で重複排除 | `concatArray(uniquely=true, comparePropName='name')` | 名前付きエントリは重複排除、無名は追加 |
|
|
145
146
|
| `childNodeRules` | 結合+名前で重複排除 | `concatArray(uniquely=true, comparePropName='name')` | nodeRules と同様 |
|
|
@@ -198,7 +199,7 @@ flowchart TD
|
|
|
198
199
|
|
|
199
200
|
#### mergePretenders(a, b)
|
|
200
201
|
|
|
201
|
-
配列形式の pretenders を正規化形式 `PretenderDetails`(`{data: [...]}`)に変換してからセマンティックマージ: `files`/`imports` は上書き(右辺優先)、`data` は追加(連結)。
|
|
202
|
+
配列形式の pretenders を正規化形式 `PretenderDetails`(`{data: [...]}`)に変換してからセマンティックマージ: `files`/`imports` は上書き(右辺優先)、`data` と `scan` は追加(連結)。
|
|
202
203
|
|
|
203
204
|
## テンプレートレンダリングシステム
|
|
204
205
|
|
package/ARCHITECTURE.md
CHANGED
|
@@ -94,7 +94,8 @@ type RuleConfig<T, O> = {
|
|
|
94
94
|
|
|
95
95
|
- `Pretender` -- Uses a CSS selector to make custom elements appear as standard elements for linting purposes; the `as` field specifies the element name or a detailed `OriginalNode`
|
|
96
96
|
- `OriginalNode` -- Defines an element's name, slots, namespace, attributes, inherited attributes, and ARIA properties
|
|
97
|
-
- `PretenderDetails` -- Normalized form `{data?, files?, imports?}` used after merging
|
|
97
|
+
- `PretenderDetails` -- Normalized form `{data?, files?, imports?, scan?}` used after merging
|
|
98
|
+
- `PretenderScanConfig` -- Dynamic scanning configuration `{files, ignoreComponentNames?}` for automatic component detection; file extensions determine the scanner (`.js/.jsx/.ts/.tsx` → JSX scanner, `.vue/.svelte/.astro` → template scanner)
|
|
98
99
|
|
|
99
100
|
### Autofix Types
|
|
100
101
|
|
|
@@ -139,7 +140,7 @@ flowchart TD
|
|
|
139
140
|
| `specs` | Object shallow merge | `mergeObject()` | Same as above |
|
|
140
141
|
| `excludeFiles` | Concat + deduplicate | `concatArray(uniquely=true)` | Simple value deduplication |
|
|
141
142
|
| `severity` | Object shallow merge | `mergeObject()` | Same as parser |
|
|
142
|
-
| `pretenders` | Semantic merge | `mergePretenders()` | files/imports: override, data: append
|
|
143
|
+
| `pretenders` | Semantic merge | `mergePretenders()` | files/imports: override, data/scan: append |
|
|
143
144
|
| `rules` | Per-rule merge | `mergeRules()` then `mergeRule()` | **Most complex -- see next section** |
|
|
144
145
|
| `nodeRules` | Concat + deduplicate by name | `concatArray(uniquely=true, comparePropName='name')` | Named entries deduplicated; unnamed entries appended |
|
|
145
146
|
| `childNodeRules` | Concat + deduplicate by name | `concatArray(uniquely=true, comparePropName='name')` | Same as nodeRules |
|
|
@@ -198,7 +199,7 @@ Collects the union of all keys from both override records. For each key, calls `
|
|
|
198
199
|
|
|
199
200
|
#### mergePretenders(a, b)
|
|
200
201
|
|
|
201
|
-
Converts array-form pretenders to the normalized `PretenderDetails` form (`{data: [...]}`) then applies semantic merge: `files`/`imports` are overridden (right-side wins), `data`
|
|
202
|
+
Converts array-form pretenders to the normalized `PretenderDetails` form (`{data: [...]}`) then applies semantic merge: `files`/`imports` are overridden (right-side wins), `data` and `scan` are appended (concatenated).
|
|
202
203
|
|
|
203
204
|
## Template Rendering System
|
|
204
205
|
|
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [5.0.0-rc.0](https://github.com/markuplint/markuplint/compare/v5.0.0-alpha.3...v5.0.0-rc.0) (2026-03-12)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **ml-config,file-resolver:** wire scan field into config pipeline ([76b042a](https://github.com/markuplint/markuplint/commit/76b042a159b4037d3fff4e7c9a5c9be4d6dba44c)), closes [#3335](https://github.com/markuplint/markuplint/issues/3335) [#3336](https://github.com/markuplint/markuplint/issues/3336) [-#3341](https://github.com/-/issues/3341) [#3335](https://github.com/markuplint/markuplint/issues/3335)
|
|
11
|
+
|
|
6
12
|
# [5.0.0-alpha.3](https://github.com/markuplint/markuplint/compare/v5.0.0-alpha.2...v5.0.0-alpha.3) (2026-02-26)
|
|
7
13
|
|
|
8
14
|
### Features
|
package/lib/merge-config.js
CHANGED
|
@@ -112,11 +112,12 @@ function mergePretenders(a, b) {
|
|
|
112
112
|
return aDetails;
|
|
113
113
|
}
|
|
114
114
|
// files/imports: override (right-side wins)
|
|
115
|
-
// data: append (concatenate)
|
|
115
|
+
// data/scan: append (concatenate)
|
|
116
116
|
const details = {
|
|
117
117
|
files: bDetails.files ?? aDetails.files,
|
|
118
118
|
imports: bDetails.imports ?? aDetails.imports,
|
|
119
119
|
data: concatArray(aDetails.data, bDetails.data),
|
|
120
|
+
scan: concatArray(aDetails.scan, bDetails.scan),
|
|
120
121
|
};
|
|
121
122
|
deleteUndefProp(details);
|
|
122
123
|
return details;
|
package/lib/types.d.ts
CHANGED
|
@@ -95,7 +95,8 @@ export type SeverityOptions = {
|
|
|
95
95
|
};
|
|
96
96
|
/**
|
|
97
97
|
* Normalized form of pretender configuration used after merging.
|
|
98
|
-
* Contains optional file references, import paths,
|
|
98
|
+
* Contains optional file references, import paths, inline pretender data,
|
|
99
|
+
* and dynamic scanning configuration.
|
|
99
100
|
*/
|
|
100
101
|
export type PretenderDetails = {
|
|
101
102
|
/**
|
|
@@ -106,13 +107,31 @@ export type PretenderDetails = {
|
|
|
106
107
|
* @experimental
|
|
107
108
|
*/
|
|
108
109
|
readonly imports?: readonly string[];
|
|
110
|
+
/**
|
|
111
|
+
* Inline pretender definitions.
|
|
112
|
+
*/
|
|
109
113
|
readonly data?: readonly Pretender[];
|
|
114
|
+
/**
|
|
115
|
+
* Dynamic scanning configuration. Each entry specifies a glob pattern
|
|
116
|
+
* for component files to scan. File extensions determine the scanner:
|
|
117
|
+
* `.js/.jsx/.ts/.tsx` use the JSX scanner, `.vue/.svelte/.astro` use
|
|
118
|
+
* the template scanner.
|
|
119
|
+
*
|
|
120
|
+
* @experimental
|
|
121
|
+
*/
|
|
122
|
+
readonly scan?: readonly PretenderScanConfig[];
|
|
110
123
|
};
|
|
111
124
|
/**
|
|
112
125
|
* Data structure for a pretender definition file.
|
|
113
126
|
*/
|
|
114
127
|
export type PretenderFileData = {
|
|
128
|
+
/**
|
|
129
|
+
* Schema version of the pretender file format.
|
|
130
|
+
*/
|
|
115
131
|
readonly version: string;
|
|
132
|
+
/**
|
|
133
|
+
* Array of pretender definitions in this file.
|
|
134
|
+
*/
|
|
116
135
|
readonly data: readonly Pretender[];
|
|
117
136
|
};
|
|
118
137
|
/**
|
|
@@ -142,12 +161,6 @@ export type Pretender = {
|
|
|
142
161
|
* @experimental
|
|
143
162
|
*/
|
|
144
163
|
readonly filePath?: string;
|
|
145
|
-
/**
|
|
146
|
-
* Dynamic scaning
|
|
147
|
-
*
|
|
148
|
-
* @experimental
|
|
149
|
-
*/
|
|
150
|
-
readonly scan?: readonly PretenderScanConfig[];
|
|
151
164
|
};
|
|
152
165
|
export type OriginalNode = {
|
|
153
166
|
/**
|
|
@@ -259,21 +272,35 @@ export type PretenderARIA = {
|
|
|
259
272
|
};
|
|
260
273
|
};
|
|
261
274
|
/**
|
|
275
|
+
* Configuration for dynamic component scanning.
|
|
276
|
+
* File extensions determine the scanner automatically:
|
|
277
|
+
* `.js/.jsx/.ts/.tsx` → JSX scanner, `.vue/.svelte/.astro` → template scanner.
|
|
278
|
+
*
|
|
262
279
|
* @experimental
|
|
263
280
|
*/
|
|
264
281
|
export type PretenderScanConfig = {
|
|
265
282
|
/**
|
|
266
|
-
*
|
|
283
|
+
* Glob pattern(s) for component files to scan.
|
|
284
|
+
*/
|
|
285
|
+
readonly files: string | readonly string[];
|
|
286
|
+
/**
|
|
287
|
+
* Component names to exclude from scanning results.
|
|
267
288
|
*/
|
|
268
|
-
readonly
|
|
269
|
-
readonly type: string;
|
|
270
|
-
readonly options: PretenderScanOptions;
|
|
289
|
+
readonly ignoreComponentNames?: readonly string[];
|
|
271
290
|
};
|
|
272
291
|
/**
|
|
292
|
+
* Base options for pretender scanners.
|
|
293
|
+
*
|
|
273
294
|
* @experimental
|
|
274
295
|
*/
|
|
275
296
|
export interface PretenderScanOptions {
|
|
297
|
+
/**
|
|
298
|
+
* Working directory for resolving relative file paths.
|
|
299
|
+
*/
|
|
276
300
|
readonly cwd?: string;
|
|
301
|
+
/**
|
|
302
|
+
* Component names to exclude from scanning results.
|
|
303
|
+
*/
|
|
277
304
|
readonly ignoreComponentNames?: readonly string[];
|
|
278
305
|
}
|
|
279
306
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markuplint/ml-config",
|
|
3
|
-
"version": "5.0.0-
|
|
3
|
+
"version": "5.0.0-rc.0",
|
|
4
4
|
"description": "JSON Schema and TypeScript types of markuplint configure JSON",
|
|
5
5
|
"repository": "git@github.com:markuplint/markuplint.git",
|
|
6
6
|
"author": "Yusuke Hirao <yusukehirao@me.com>",
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
"clean": "tsc --build --clean tsconfig.build.json"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@markuplint/ml-ast": "5.0.0-
|
|
31
|
-
"@markuplint/ml-spec": "5.0.0-
|
|
32
|
-
"@markuplint/selector": "5.0.0-
|
|
33
|
-
"@markuplint/shared": "5.0.0-
|
|
30
|
+
"@markuplint/ml-ast": "5.0.0-rc.0",
|
|
31
|
+
"@markuplint/ml-spec": "5.0.0-rc.0",
|
|
32
|
+
"@markuplint/selector": "5.0.0-rc.0",
|
|
33
|
+
"@markuplint/shared": "5.0.0-rc.0",
|
|
34
34
|
"@types/mustache": "4.2.6",
|
|
35
35
|
"is-plain-object": "5.0.0",
|
|
36
36
|
"mustache": "4.2.0",
|
|
37
37
|
"type-fest": "5.4.4"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "ebf4d7cfca0c259aead3b292c6b8a202db4cd802"
|
|
40
40
|
}
|