@markuplint/file-resolver 4.0.0-alpha.2 → 4.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/lib/config-provider.js +8 -1
- package/lib/cosmiconfig.js +4 -0
- package/lib/debug.d.ts +3 -0
- package/lib/debug.js +2 -0
- package/package.json +11 -10
package/lib/config-provider.js
CHANGED
|
@@ -8,8 +8,10 @@ import { ConfigParserError } from '@markuplint/parser-utils';
|
|
|
8
8
|
import { InvalidSelectorError, createSelector } from '@markuplint/selector';
|
|
9
9
|
import { nonNullableFilter, toNoEmptyStringArrayFromStringOrArray } from '@markuplint/shared';
|
|
10
10
|
import { load as loadConfig, search } from './cosmiconfig.js';
|
|
11
|
+
import { log } from './debug.js';
|
|
11
12
|
import { cacheClear, resolvePlugins } from './resolve-plugins.js';
|
|
12
13
|
import { fileExists, uuid } from './utils.js';
|
|
14
|
+
const cpLog = log.extend('config-provider');
|
|
13
15
|
const require = createRequire(import.meta.url);
|
|
14
16
|
const KEY_SEPARATOR = '__ML_CONFIG_MERGE__';
|
|
15
17
|
export class ConfigProvider {
|
|
@@ -80,16 +82,21 @@ export class ConfigProvider {
|
|
|
80
82
|
return result;
|
|
81
83
|
}
|
|
82
84
|
async search(targetFile) {
|
|
83
|
-
|
|
85
|
+
const isExists = await targetFile.dirExists();
|
|
86
|
+
cpLog('search: %s', targetFile.path);
|
|
87
|
+
cpLog('isExists: %s', isExists);
|
|
88
|
+
if (!isExists) {
|
|
84
89
|
return null;
|
|
85
90
|
}
|
|
86
91
|
const res = await search(targetFile.path, false);
|
|
92
|
+
cpLog('searched config: %O', res);
|
|
87
93
|
if (!res) {
|
|
88
94
|
return null;
|
|
89
95
|
}
|
|
90
96
|
const { filePath, config } = res;
|
|
91
97
|
const pathResolvedConfig = await this._pathResolve(config, filePath);
|
|
92
98
|
__classPrivateFieldGet(this, _ConfigProvider_store, "f").set(filePath, pathResolvedConfig);
|
|
99
|
+
cpLog('Store key: %s', filePath);
|
|
93
100
|
return filePath;
|
|
94
101
|
}
|
|
95
102
|
set(config, key) {
|
package/lib/cosmiconfig.js
CHANGED
|
@@ -2,6 +2,8 @@ import path from 'node:path';
|
|
|
2
2
|
import { ConfigParserError } from '@markuplint/parser-utils';
|
|
3
3
|
import { cosmiconfig, defaultLoaders } from 'cosmiconfig';
|
|
4
4
|
import { jsonc } from 'jsonc';
|
|
5
|
+
import { log } from './debug.js';
|
|
6
|
+
const searchLog = log.extend('search');
|
|
5
7
|
const explorer = cosmiconfig('markuplint', {
|
|
6
8
|
loaders: {
|
|
7
9
|
noExt: ((path, content) => {
|
|
@@ -22,7 +24,9 @@ export async function search(dir, cacheClear) {
|
|
|
22
24
|
explorer.clearCaches();
|
|
23
25
|
}
|
|
24
26
|
dir = path.dirname(dir);
|
|
27
|
+
searchLog('Search dir: %s', dir);
|
|
25
28
|
const result = await explorer.search(dir).catch(cacheConfigError(dir));
|
|
29
|
+
searchLog('Search result: %O', result);
|
|
26
30
|
if (!result || result.isEmpty) {
|
|
27
31
|
return null;
|
|
28
32
|
}
|
package/lib/debug.d.ts
ADDED
package/lib/debug.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markuplint/file-resolver",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.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>",
|
|
@@ -27,20 +27,21 @@
|
|
|
27
27
|
"@types/node": "20.8.3"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@markuplint/html-parser": "4.0.0-alpha.
|
|
31
|
-
"@markuplint/ml-ast": "4.0.0-alpha.
|
|
32
|
-
"@markuplint/ml-config": "4.0.0-alpha.
|
|
33
|
-
"@markuplint/ml-core": "4.0.0-alpha.
|
|
34
|
-
"@markuplint/ml-spec": "4.0.0-alpha.
|
|
35
|
-
"@markuplint/parser-utils": "4.0.0-alpha.
|
|
36
|
-
"@markuplint/selector": "4.0.0-alpha.
|
|
37
|
-
"@markuplint/shared": "4.0.0-alpha.
|
|
30
|
+
"@markuplint/html-parser": "4.0.0-alpha.3",
|
|
31
|
+
"@markuplint/ml-ast": "4.0.0-alpha.3",
|
|
32
|
+
"@markuplint/ml-config": "4.0.0-alpha.3",
|
|
33
|
+
"@markuplint/ml-core": "4.0.0-alpha.3",
|
|
34
|
+
"@markuplint/ml-spec": "4.0.0-alpha.3",
|
|
35
|
+
"@markuplint/parser-utils": "4.0.0-alpha.3",
|
|
36
|
+
"@markuplint/selector": "4.0.0-alpha.3",
|
|
37
|
+
"@markuplint/shared": "4.0.0-alpha.3",
|
|
38
38
|
"cosmiconfig": "^8.3.6",
|
|
39
|
+
"debug": "^4.3.4",
|
|
39
40
|
"glob": "^10.3.6",
|
|
40
41
|
"ignore": "^5.2.4",
|
|
41
42
|
"jsonc": "^2.0.0",
|
|
42
43
|
"minimatch": "^9.0.3",
|
|
43
44
|
"tslib": "^2.6.2"
|
|
44
45
|
},
|
|
45
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "380836f7adc1ff7e8eaf9d869e68d29eee8f3b7e"
|
|
46
47
|
}
|