@markuplint/file-resolver 5.0.0-alpha.1 → 5.0.0-alpha.3
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/CHANGELOG.md +8 -0
- package/lib/config-provider.d.ts +0 -4
- package/lib/config-provider.js +11 -11
- package/lib/ml-file/ml-file.d.ts +0 -2
- package/lib/ml-file/ml-file.js +5 -5
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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-alpha.3](https://github.com/markuplint/markuplint/compare/v5.0.0-alpha.2...v5.0.0-alpha.3) (2026-02-26)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @markuplint/file-resolver
|
|
9
|
+
|
|
10
|
+
# [5.0.0-alpha.2](https://github.com/markuplint/markuplint/compare/v5.0.0-alpha.1...v5.0.0-alpha.2) (2026-02-23)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @markuplint/file-resolver
|
|
13
|
+
|
|
6
14
|
# [5.0.0-alpha.1](https://github.com/markuplint/markuplint/compare/v5.0.0-alpha.0...v5.0.0-alpha.1) (2026-02-22)
|
|
7
15
|
|
|
8
16
|
### Bug Fixes
|
package/lib/config-provider.d.ts
CHANGED
package/lib/config-provider.js
CHANGED
|
@@ -49,7 +49,7 @@ export class ConfigProvider {
|
|
|
49
49
|
this.#recursiveLoadKeyAndDepth.set(key, depth);
|
|
50
50
|
let config = this.#store.get(key);
|
|
51
51
|
if (!config) {
|
|
52
|
-
config = await this
|
|
52
|
+
config = await this.#load(key, cache, referrer);
|
|
53
53
|
}
|
|
54
54
|
if (!config) {
|
|
55
55
|
return { stack, errs: [] };
|
|
@@ -95,14 +95,14 @@ export class ConfigProvider {
|
|
|
95
95
|
if (currentConfig) {
|
|
96
96
|
return currentConfig;
|
|
97
97
|
}
|
|
98
|
-
let configSet = await this
|
|
98
|
+
let configSet = await this.#mergeConfigs(keys, cache, targetFile.path);
|
|
99
99
|
const filePath = [...configSet.files].toReversed()[0];
|
|
100
100
|
if (!filePath) {
|
|
101
101
|
throw new ConfigParserError('Config file not found', {
|
|
102
102
|
filePath: targetFile.path,
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
|
-
const errors = this
|
|
105
|
+
const errors = this.#validateConfig(configSet.config, filePath);
|
|
106
106
|
configSet.errs.push(...errors);
|
|
107
107
|
const { plugins, errors: pluginErrors } = await resolvePlugins(configSet.config.plugins);
|
|
108
108
|
configSet.errs.push(...pluginErrors);
|
|
@@ -121,7 +121,7 @@ export class ConfigProvider {
|
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
-
configSet = await this
|
|
124
|
+
configSet = await this.#mergeConfigs([...keys, ...extendHelds], cache, targetFile.path);
|
|
125
125
|
this.#held.clear();
|
|
126
126
|
}
|
|
127
127
|
// Resolves `overrides`
|
|
@@ -171,7 +171,7 @@ export class ConfigProvider {
|
|
|
171
171
|
return null;
|
|
172
172
|
}
|
|
173
173
|
const { filePath, config } = res;
|
|
174
|
-
const pathResolvedConfig = await this
|
|
174
|
+
const pathResolvedConfig = await this.#pathResolve(config, filePath);
|
|
175
175
|
this.#store.set(filePath, pathResolvedConfig);
|
|
176
176
|
cpLog('Store key: %s', filePath);
|
|
177
177
|
return filePath;
|
|
@@ -188,7 +188,7 @@ export class ConfigProvider {
|
|
|
188
188
|
this.#store.set(key, config);
|
|
189
189
|
return key;
|
|
190
190
|
}
|
|
191
|
-
async
|
|
191
|
+
async #load(filePath, cache, referrer) {
|
|
192
192
|
const entity = this.#store.get(filePath);
|
|
193
193
|
if (entity) {
|
|
194
194
|
return entity;
|
|
@@ -196,7 +196,7 @@ export class ConfigProvider {
|
|
|
196
196
|
if (isPresetModuleName(filePath)) {
|
|
197
197
|
const [, name] = filePath.match(/^markuplint:(.+)$/i) ?? [];
|
|
198
198
|
const config = await getPreset(name ?? filePath);
|
|
199
|
-
const pathResolvedConfig = await this
|
|
199
|
+
const pathResolvedConfig = await this.#pathResolve(config, filePath);
|
|
200
200
|
this.#store.set(filePath, pathResolvedConfig);
|
|
201
201
|
return pathResolvedConfig;
|
|
202
202
|
}
|
|
@@ -211,11 +211,11 @@ export class ConfigProvider {
|
|
|
211
211
|
if (config instanceof ConfigLoadError) {
|
|
212
212
|
return config;
|
|
213
213
|
}
|
|
214
|
-
const pathResolvedConfig = await this
|
|
214
|
+
const pathResolvedConfig = await this.#pathResolve(config, filePath);
|
|
215
215
|
this.#store.set(filePath, pathResolvedConfig);
|
|
216
216
|
return pathResolvedConfig;
|
|
217
217
|
}
|
|
218
|
-
async
|
|
218
|
+
async #mergeConfigs(keys, cache, referrer) {
|
|
219
219
|
const resolvedKeys = new Set();
|
|
220
220
|
const errs = [];
|
|
221
221
|
for (const key of keys) {
|
|
@@ -241,7 +241,7 @@ export class ConfigProvider {
|
|
|
241
241
|
errs,
|
|
242
242
|
};
|
|
243
243
|
}
|
|
244
|
-
async
|
|
244
|
+
async #pathResolve(config, filePath) {
|
|
245
245
|
const optimizedConfig = mergeConfig(config);
|
|
246
246
|
const dir = path.dirname(filePath);
|
|
247
247
|
return {
|
|
@@ -260,7 +260,7 @@ export class ConfigProvider {
|
|
|
260
260
|
overrides: await relPathToNameOrAbsPath(dir, optimizedConfig.overrides, undefined, true),
|
|
261
261
|
};
|
|
262
262
|
}
|
|
263
|
-
|
|
263
|
+
#validateConfig(config, filePath) {
|
|
264
264
|
const errors = [];
|
|
265
265
|
if (config.nodeRules)
|
|
266
266
|
for (const rule of config.nodeRules) {
|
package/lib/ml-file/ml-file.d.ts
CHANGED
package/lib/ml-file/ml-file.js
CHANGED
|
@@ -59,7 +59,7 @@ export class MLFile {
|
|
|
59
59
|
return this.#code;
|
|
60
60
|
}
|
|
61
61
|
if (this.#type === 'file-base' && (await this.isExist())) {
|
|
62
|
-
return await this
|
|
62
|
+
return await this.#fetch();
|
|
63
63
|
}
|
|
64
64
|
return '';
|
|
65
65
|
}
|
|
@@ -75,14 +75,14 @@ export class MLFile {
|
|
|
75
75
|
if (this.#type === 'code-base') {
|
|
76
76
|
return true;
|
|
77
77
|
}
|
|
78
|
-
const stat = await this
|
|
78
|
+
const stat = await this.#loadStat();
|
|
79
79
|
return !!stat;
|
|
80
80
|
}
|
|
81
81
|
async isFile() {
|
|
82
82
|
if (this.#type === 'code-base') {
|
|
83
83
|
return true;
|
|
84
84
|
}
|
|
85
|
-
const stat = await this
|
|
85
|
+
const stat = await this.#loadStat();
|
|
86
86
|
return !!stat && stat.isFile();
|
|
87
87
|
}
|
|
88
88
|
matches(globPath) {
|
|
@@ -94,12 +94,12 @@ export class MLFile {
|
|
|
94
94
|
}
|
|
95
95
|
this.#code = code;
|
|
96
96
|
}
|
|
97
|
-
async
|
|
97
|
+
async #fetch() {
|
|
98
98
|
const code = await fs.readFile(this.path, { encoding: 'utf8' });
|
|
99
99
|
this.#code = code;
|
|
100
100
|
return code;
|
|
101
101
|
}
|
|
102
|
-
async
|
|
102
|
+
async #loadStat() {
|
|
103
103
|
if (this.#stat) {
|
|
104
104
|
return this.#stat;
|
|
105
105
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markuplint/file-resolver",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.3",
|
|
4
4
|
"description": "The file resolver of markuplint",
|
|
5
5
|
"repository": "git@github.com:markuplint/markuplint.git",
|
|
6
6
|
"author": "Yusuke Hirao <yusukehirao@me.com>",
|
|
@@ -30,21 +30,21 @@
|
|
|
30
30
|
"@types/node": "24.5.1"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@markuplint/html-parser": "5.0.0-alpha.
|
|
34
|
-
"@markuplint/ml-ast": "5.0.0-alpha.
|
|
35
|
-
"@markuplint/ml-config": "5.0.0-alpha.
|
|
36
|
-
"@markuplint/ml-core": "5.0.0-alpha.
|
|
37
|
-
"@markuplint/ml-spec": "5.0.0-alpha.
|
|
38
|
-
"@markuplint/parser-utils": "5.0.0-alpha.
|
|
39
|
-
"@markuplint/selector": "5.0.0-alpha.
|
|
40
|
-
"@markuplint/shared": "5.0.0-alpha.
|
|
33
|
+
"@markuplint/html-parser": "5.0.0-alpha.3",
|
|
34
|
+
"@markuplint/ml-ast": "5.0.0-alpha.3",
|
|
35
|
+
"@markuplint/ml-config": "5.0.0-alpha.3",
|
|
36
|
+
"@markuplint/ml-core": "5.0.0-alpha.3",
|
|
37
|
+
"@markuplint/ml-spec": "5.0.0-alpha.3",
|
|
38
|
+
"@markuplint/parser-utils": "5.0.0-alpha.3",
|
|
39
|
+
"@markuplint/selector": "5.0.0-alpha.3",
|
|
40
|
+
"@markuplint/shared": "5.0.0-alpha.3",
|
|
41
41
|
"cosmiconfig": "9.0.0",
|
|
42
42
|
"debug": "4.4.3",
|
|
43
43
|
"glob": "13.0.6",
|
|
44
44
|
"ignore": "7.0.5",
|
|
45
45
|
"import-meta-resolve": "4.2.0",
|
|
46
46
|
"jsonc": "2.0.0",
|
|
47
|
-
"minimatch": "10.2.
|
|
47
|
+
"minimatch": "10.2.4"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "2fbdf26daa3d021ac628ccc2f59f0eeae6ddd53d"
|
|
50
50
|
}
|