markuplint 4.0.0-alpha.1 → 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/README.md +3 -1
- package/lib/api/ml-engine.js +16 -5
- package/lib/debug.js +3 -2
- package/lib/index.d.ts +1 -0
- package/package.json +24 -21
package/README.md
CHANGED
|
@@ -121,8 +121,10 @@ Need [Sponsors❤️🔥](https://github.com/sponsors/markuplint)
|
|
|
121
121
|
### Personal Supporters
|
|
122
122
|
|
|
123
123
|
[<img width="36" src="https://avatars.githubusercontent.com/u/91733847" alt="Tokitake" />](https://github.com/Tokitake)
|
|
124
|
-
[<img width="36" src="https://avatars.githubusercontent.com/u/1996642" alt="
|
|
124
|
+
[<img width="36" src="https://avatars.githubusercontent.com/u/1996642" alt="Okuto Oyama" />](https://github.com/yamanoku)
|
|
125
125
|
[<img width="36" src="https://avatars.githubusercontent.com/u/6581173" alt="miita" />](https://github.com/mikimhk)
|
|
126
|
+
[<img width="36" src="https://avatars.githubusercontent.com/u/111797" alt="Yasuo Fukuda" />](https://github.com/sigwyg)
|
|
127
|
+
[<img width="36" src="https://avatars.githubusercontent.com/u/802921" alt="Hideyuki Saito" />](https://github.com/hideyukisaito)
|
|
126
128
|
|
|
127
129
|
## Thanks
|
|
128
130
|
|
package/lib/api/ml-engine.js
CHANGED
|
@@ -11,6 +11,10 @@ const fileLog = log.extend('file');
|
|
|
11
11
|
const configLog = log.extend('config');
|
|
12
12
|
class MLEngine extends Emitter {
|
|
13
13
|
static async fromCode(sourceCode, options) {
|
|
14
|
+
if (options?.debug) {
|
|
15
|
+
verbosely();
|
|
16
|
+
}
|
|
17
|
+
log('[fromCode] Creates: %O', options);
|
|
14
18
|
const file = await MLEngine.toMLFile({
|
|
15
19
|
sourceCode,
|
|
16
20
|
name: options?.name,
|
|
@@ -19,7 +23,9 @@ class MLEngine extends Emitter {
|
|
|
19
23
|
if (!file) {
|
|
20
24
|
throw new Error('Never reach error');
|
|
21
25
|
}
|
|
22
|
-
|
|
26
|
+
log('[fromCode] Created file: %s', file.path);
|
|
27
|
+
const engine = new MLEngine(file, options);
|
|
28
|
+
return engine;
|
|
23
29
|
}
|
|
24
30
|
static async toMLFile(target) {
|
|
25
31
|
const files = await resolveFiles([target]);
|
|
@@ -32,13 +38,14 @@ class MLEngine extends Emitter {
|
|
|
32
38
|
_MLEngine_file.set(this, void 0);
|
|
33
39
|
_MLEngine_options.set(this, void 0);
|
|
34
40
|
_MLEngine_watcher.set(this, new FSWatcher());
|
|
41
|
+
if (__classPrivateFieldGet(this, _MLEngine_options, "f")?.debug) {
|
|
42
|
+
verbosely();
|
|
43
|
+
}
|
|
35
44
|
__classPrivateFieldSet(this, _MLEngine_file, file, "f");
|
|
36
45
|
__classPrivateFieldSet(this, _MLEngine_options, options, "f");
|
|
37
46
|
__classPrivateFieldSet(this, _MLEngine_configProvider, new ConfigProvider(), "f");
|
|
38
47
|
this.watchMode(!!__classPrivateFieldGet(this, _MLEngine_options, "f")?.watch);
|
|
39
|
-
|
|
40
|
-
verbosely();
|
|
41
|
-
}
|
|
48
|
+
log('[MLEngine] Initialized: %s', __classPrivateFieldGet(this, _MLEngine_file, "f").path);
|
|
42
49
|
}
|
|
43
50
|
get document() {
|
|
44
51
|
if (__classPrivateFieldGet(this, _MLEngine_core, "f")?.document instanceof Error) {
|
|
@@ -225,12 +232,16 @@ class MLEngine extends Emitter {
|
|
|
225
232
|
};
|
|
226
233
|
}
|
|
227
234
|
async resolveConfig(cache) {
|
|
235
|
+
this.emit('log', 'resolveConfig', JSON.stringify(__classPrivateFieldGet(this, _MLEngine_configProvider, "f"), null, 2));
|
|
236
|
+
configLog('configProvider: %s', __classPrivateFieldGet(this, _MLEngine_configProvider, "f"));
|
|
228
237
|
const defaultConfigKey = __classPrivateFieldGet(this, _MLEngine_options, "f")?.defaultConfig && __classPrivateFieldGet(this, _MLEngine_configProvider, "f").set(__classPrivateFieldGet(this, _MLEngine_options, "f")?.defaultConfig);
|
|
229
238
|
configLog('defaultConfigKey: %s', defaultConfigKey ?? 'N/A');
|
|
230
239
|
this.emit('log', 'defaultConfigKey', defaultConfigKey ?? 'N/A');
|
|
240
|
+
const targetConfig = await __classPrivateFieldGet(this, _MLEngine_configProvider, "f").search(__classPrivateFieldGet(this, _MLEngine_file, "f"));
|
|
241
|
+
this.emit('log', 'targetConfig', targetConfig ?? 'N/A');
|
|
231
242
|
const configFilePathsFromTarget = __classPrivateFieldGet(this, _MLEngine_options, "f")?.noSearchConfig
|
|
232
243
|
? defaultConfigKey ?? null
|
|
233
|
-
:
|
|
244
|
+
: targetConfig ?? defaultConfigKey;
|
|
234
245
|
configLog('configFilePathsFromTarget: %s', configFilePathsFromTarget ?? 'N/A');
|
|
235
246
|
this.emit('log', 'configFilePathsFromTarget', configFilePathsFromTarget ?? 'N/A');
|
|
236
247
|
const configKey = __classPrivateFieldGet(this, _MLEngine_options, "f")?.config && __classPrivateFieldGet(this, _MLEngine_configProvider, "f").set(__classPrivateFieldGet(this, _MLEngine_options, "f").config);
|
package/lib/debug.js
CHANGED
|
@@ -3,8 +3,9 @@ import debug from 'debug';
|
|
|
3
3
|
export const log = debug('markuplint-cli');
|
|
4
4
|
export function verbosely() {
|
|
5
5
|
if (!log.enabled) {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
const namespace = `${log.namespace}*,ml-*`;
|
|
7
|
+
debug.enable(namespace);
|
|
8
|
+
log(`[Debug] Enable: "${namespace}"`);
|
|
8
9
|
}
|
|
9
10
|
enableDebug();
|
|
10
11
|
}
|
package/lib/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "markuplint",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.3",
|
|
4
4
|
"description": "An HTML linter for all markup developers",
|
|
5
5
|
"author": "Yusuke Hirao",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,23 +24,26 @@
|
|
|
24
24
|
"dev": "tsc --build --watch",
|
|
25
25
|
"clean": "tsc --build --clean"
|
|
26
26
|
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"execa": "^8.0.1"
|
|
29
|
+
},
|
|
27
30
|
"dependencies": {
|
|
28
|
-
"@markuplint/create-rule-helper": "4.0.0-alpha.
|
|
29
|
-
"@markuplint/file-resolver": "4.0.0-alpha.
|
|
30
|
-
"@markuplint/html-parser": "4.0.0-alpha.
|
|
31
|
-
"@markuplint/html-spec": "4.0.0-alpha.
|
|
32
|
-
"@markuplint/i18n": "4.0.0-alpha.
|
|
33
|
-
"@markuplint/ml-ast": "4.0.0-alpha.
|
|
34
|
-
"@markuplint/ml-config": "4.0.0-alpha.
|
|
35
|
-
"@markuplint/ml-core": "4.0.0-alpha.
|
|
36
|
-
"@markuplint/ml-spec": "4.0.0-alpha.
|
|
37
|
-
"@markuplint/rules": "4.0.0-alpha.
|
|
38
|
-
"@markuplint/shared": "4.0.0-alpha.
|
|
39
|
-
"@types/cli-color": "^2.0.
|
|
40
|
-
"@types/debug": "^4.1.
|
|
31
|
+
"@markuplint/create-rule-helper": "4.0.0-alpha.3",
|
|
32
|
+
"@markuplint/file-resolver": "4.0.0-alpha.3",
|
|
33
|
+
"@markuplint/html-parser": "4.0.0-alpha.3",
|
|
34
|
+
"@markuplint/html-spec": "4.0.0-alpha.3",
|
|
35
|
+
"@markuplint/i18n": "4.0.0-alpha.3",
|
|
36
|
+
"@markuplint/ml-ast": "4.0.0-alpha.3",
|
|
37
|
+
"@markuplint/ml-config": "4.0.0-alpha.3",
|
|
38
|
+
"@markuplint/ml-core": "4.0.0-alpha.3",
|
|
39
|
+
"@markuplint/ml-spec": "4.0.0-alpha.3",
|
|
40
|
+
"@markuplint/rules": "4.0.0-alpha.3",
|
|
41
|
+
"@markuplint/shared": "4.0.0-alpha.3",
|
|
42
|
+
"@types/cli-color": "^2.0.3",
|
|
43
|
+
"@types/debug": "^4.1.9",
|
|
41
44
|
"@types/has-yarn": "^1.0.1",
|
|
42
45
|
"@types/meow": "^6.0.0",
|
|
43
|
-
"@types/uuid": "^9.0.
|
|
46
|
+
"@types/uuid": "^9.0.4",
|
|
44
47
|
"chokidar": "^3.5.3",
|
|
45
48
|
"cli-color": "^2.0.3",
|
|
46
49
|
"debug": "^4.3.4",
|
|
@@ -50,14 +53,14 @@
|
|
|
50
53
|
"get-stdin": "^9.0.0",
|
|
51
54
|
"gray-matter": "^4.0.3",
|
|
52
55
|
"has-yarn": "^3.0.0",
|
|
53
|
-
"meow": "^12.
|
|
56
|
+
"meow": "^12.1.1",
|
|
54
57
|
"node-fetch": "^3.3.2",
|
|
55
58
|
"os-locale": "^6.0.2",
|
|
56
|
-
"strict-event-emitter": "^0.5.
|
|
59
|
+
"strict-event-emitter": "^0.5.1",
|
|
57
60
|
"strip-ansi": "^7.1.0",
|
|
58
|
-
"tslib": "^2.6.
|
|
59
|
-
"type-fest": "^4.1
|
|
60
|
-
"uuid": "^9.0.
|
|
61
|
+
"tslib": "^2.6.2",
|
|
62
|
+
"type-fest": "^4.3.1",
|
|
63
|
+
"uuid": "^9.0.1"
|
|
61
64
|
},
|
|
62
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "380836f7adc1ff7e8eaf9d869e68d29eee8f3b7e"
|
|
63
66
|
}
|