@markuplint/ml-core 4.0.0-dev.12 → 4.0.0-dev.23
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/index.d.ts +0 -1
- package/lib/index.js +0 -1
- package/lib/ml-core.d.ts +1 -1
- package/package.json +11 -11
- package/lib/configs.d.ts +0 -2
- package/lib/configs.js +0 -37
package/lib/index.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ export { ariaSpecs, contentModelCategoryToTagNames, getAttrSpecs, getComputedRol
|
|
|
3
3
|
export { Ruleset } from './ruleset/index.js';
|
|
4
4
|
export { enableDebug } from './debug.js';
|
|
5
5
|
export { getIndent } from './ml-dom/helper/get-indent.js';
|
|
6
|
-
export * from './configs.js';
|
|
7
6
|
export * from './convert-ruleset.js';
|
|
8
7
|
export * from './ml-core.js';
|
|
9
8
|
export * from './ml-dom/index.js';
|
package/lib/index.js
CHANGED
|
@@ -2,7 +2,6 @@ export { ariaSpecs, contentModelCategoryToTagNames, getAttrSpecs, getComputedRol
|
|
|
2
2
|
export { Ruleset } from './ruleset/index.js';
|
|
3
3
|
export { enableDebug } from './debug.js';
|
|
4
4
|
export { getIndent } from './ml-dom/helper/get-indent.js';
|
|
5
|
-
export * from './configs.js';
|
|
6
5
|
export * from './convert-ruleset.js';
|
|
7
6
|
export * from './ml-core.js';
|
|
8
7
|
export * from './ml-dom/index.js';
|
package/lib/ml-core.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export type MLCoreParams = {
|
|
|
10
10
|
export declare class MLCore {
|
|
11
11
|
#private;
|
|
12
12
|
constructor({ parser, sourceCode, ruleset, rules, locale, schemas, parserOptions, pretenders, filename, debug, configErrors, }: MLCoreParams);
|
|
13
|
-
get document():
|
|
13
|
+
get document(): Document<RuleConfigValue, PlainData> | ParserError;
|
|
14
14
|
setCode(sourceCode: string): void;
|
|
15
15
|
update({ parser, ruleset, rules, locale, schemas, parserOptions, configErrors }: Partial<MLFabric>): void;
|
|
16
16
|
verify(fix?: boolean): Promise<Violation[]>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markuplint/ml-core",
|
|
3
|
-
"version": "4.0.0-dev.
|
|
3
|
+
"version": "4.0.0-dev.23+d6f2aa9bc",
|
|
4
4
|
"description": "The core module of markuplint",
|
|
5
5
|
"repository": "git@github.com:markuplint/markuplint.git",
|
|
6
6
|
"author": "Yusuke Hirao <yusukehirao@me.com>",
|
|
@@ -28,19 +28,19 @@
|
|
|
28
28
|
"./lib/configs.js": "./lib/configs.browser.js"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@markuplint/config-presets": "4.0.0-dev.
|
|
32
|
-
"@markuplint/html-parser": "4.0.0-dev.
|
|
33
|
-
"@markuplint/html-spec": "4.0.0-dev.
|
|
34
|
-
"@markuplint/i18n": "4.0.0-dev.
|
|
35
|
-
"@markuplint/ml-ast": "4.0.0-dev.
|
|
36
|
-
"@markuplint/ml-config": "4.0.0-dev.
|
|
37
|
-
"@markuplint/ml-spec": "4.0.0-dev.
|
|
38
|
-
"@markuplint/parser-utils": "4.0.0-dev.
|
|
39
|
-
"@markuplint/selector": "4.0.0-dev.
|
|
31
|
+
"@markuplint/config-presets": "4.0.0-dev.23+d6f2aa9bc",
|
|
32
|
+
"@markuplint/html-parser": "4.0.0-dev.23+d6f2aa9bc",
|
|
33
|
+
"@markuplint/html-spec": "4.0.0-dev.23+d6f2aa9bc",
|
|
34
|
+
"@markuplint/i18n": "4.0.0-dev.23+d6f2aa9bc",
|
|
35
|
+
"@markuplint/ml-ast": "4.0.0-dev.23+d6f2aa9bc",
|
|
36
|
+
"@markuplint/ml-config": "4.0.0-dev.23+d6f2aa9bc",
|
|
37
|
+
"@markuplint/ml-spec": "4.0.0-dev.23+d6f2aa9bc",
|
|
38
|
+
"@markuplint/parser-utils": "4.0.0-dev.23+d6f2aa9bc",
|
|
39
|
+
"@markuplint/selector": "4.0.0-dev.23+d6f2aa9bc",
|
|
40
40
|
"@types/debug": "^4.1.12",
|
|
41
41
|
"debug": "^4.3.4",
|
|
42
42
|
"is-plain-object": "^5.0.0",
|
|
43
43
|
"type-fest": "^4.9.0"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "d6f2aa9bc287768466f23b5340e4e0eecfa30d59"
|
|
46
46
|
}
|
package/lib/configs.d.ts
DELETED
package/lib/configs.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { readFile } from 'node:fs/promises';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import { log } from './debug.js';
|
|
4
|
-
export async function getPreset(name) {
|
|
5
|
-
const json = await forceImportJsonInModule(`@markuplint/config-presets/preset.${name}.json`);
|
|
6
|
-
if (json instanceof Error) {
|
|
7
|
-
throw new ReferenceError(`Preset markuplint:${name} is not found`);
|
|
8
|
-
}
|
|
9
|
-
return json;
|
|
10
|
-
}
|
|
11
|
-
async function forceImportJsonInModule(modPath) {
|
|
12
|
-
const error = await import(modPath).catch(error => error);
|
|
13
|
-
if (error instanceof Error) {
|
|
14
|
-
log('Error in forceImportJsonInModule: %O', error);
|
|
15
|
-
if (!('code' in error)) {
|
|
16
|
-
throw error;
|
|
17
|
-
}
|
|
18
|
-
if (error.code !== 'ERR_IMPORT_ASSERTION_TYPE_MISSING') {
|
|
19
|
-
throw error;
|
|
20
|
-
}
|
|
21
|
-
const searchPath = /module\s"([^"]+)"\sneeds/i.exec(error.message);
|
|
22
|
-
const absPath = searchPath?.[1] ?? null;
|
|
23
|
-
log('Extract path: %s', absPath);
|
|
24
|
-
if (!absPath) {
|
|
25
|
-
throw error;
|
|
26
|
-
}
|
|
27
|
-
const normalizePath = absPath
|
|
28
|
-
.replace(/^file:\/\//, '')
|
|
29
|
-
.replaceAll('/', path.sep)
|
|
30
|
-
// Windows
|
|
31
|
-
.replace(/^[/\\][a-z]:/i, '');
|
|
32
|
-
log('Find JSON file path: %s', normalizePath);
|
|
33
|
-
const fileContent = await readFile(normalizePath, { encoding: 'utf8' });
|
|
34
|
-
return JSON.parse(fileContent);
|
|
35
|
-
}
|
|
36
|
-
return error.default ?? error;
|
|
37
|
-
}
|