@textlint/legacy-textlint-core 15.8.0 → 16.0.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/lib/src/index.d.ts +3 -1
- package/lib/src/index.d.ts.map +1 -1
- package/lib/src/index.js +35 -21
- package/lib/src/index.js.map +1 -1
- package/package.json +7 -6
- package/src/index.ts +38 -24
package/lib/src/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { TextlintFixResult, TextlintKernelPlugin,
|
|
1
|
+
import type { TextlintFixResult, TextlintKernelPlugin, TextlintResult } from "@textlint/kernel";
|
|
2
|
+
import type { TextlintPluginCreator } from "@textlint/types";
|
|
2
3
|
/**
|
|
3
4
|
* Convert pluginsObject to TextlintKernelPlugin
|
|
4
5
|
* {
|
|
@@ -22,6 +23,7 @@ export declare const pluginsObjectToKernelRule: (plugins: {
|
|
|
22
23
|
export declare class TextLintCore {
|
|
23
24
|
private kernelDescriptor;
|
|
24
25
|
constructor(_THIS_ARG_IS_JUST_IGNORED?: unknown[]);
|
|
26
|
+
private createKernelOptions;
|
|
25
27
|
/**
|
|
26
28
|
* setup rules
|
|
27
29
|
* @param rules
|
package/lib/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,iBAAiB,EAEjB,oBAAoB,EAEpB,cAAc,EACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAA8B,qBAAqB,EAAsB,MAAM,iBAAiB,CAAC;AA8D7G;;;;;;;;;;GAUG;AACH,eAAO,MAAM,yBAAyB,GAClC,SAAS;IAAE,CAAC,KAAK,EAAE,MAAM,GAAG,qBAAqB,CAAA;CAAE,EACnD,eAAe;IAAE,CAAC,KAAK,EAAE,MAAM,GAAG,oBAAoB,CAAC,SAAS,CAAC,CAAA;CAAE,KACpE,oBAAoB,EAQtB,CAAC;AAEF;;;GAGG;AACH,qBAAa,YAAY;IACrB,OAAO,CAAC,gBAAgB,CAIrB;gBAES,yBAAyB,GAAE,OAAO,EAAO;YAIvC,mBAAmB;IAWjC;;;;OAIG;IACH,UAAU,CAAC,KAAK,KAAK,EAAE,WAAW,KAAK,GAAG,IAAI;IAU9C;;;;OAIG;IACH,gBAAgB,CAAC,WAAW,KAAK,EAAE,iBAAiB,KAAK,GAAG,IAAI;IAUhE;;;OAGG;IACH,UAAU,IAAI,IAAI;IAQlB;;;;OAIG;IACH,YAAY,CAAC,OAAO,KAAK,EAAE,aAAa,KAAK;IAU7C;;;;;OAKG;IACG,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,SAAS,GAAG,OAAO,CAAC,cAAc,CAAC;IAQnE;;;OAGG;IACG,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAQzD;;;OAGG;IACG,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAUzD;;;;;OAKG;IACG,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,SAAS,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAQrE;;OAEG;IACG,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAS9D"}
|
package/lib/src/index.js
CHANGED
|
@@ -7,21 +7,25 @@ exports.TextLintCore = exports.pluginsObjectToKernelRule = void 0;
|
|
|
7
7
|
const kernel_1 = require("@textlint/kernel");
|
|
8
8
|
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
9
9
|
const node_path_1 = __importDefault(require("node:path"));
|
|
10
|
-
const textlint_plugin_text_1 = __importDefault(require("@textlint/textlint-plugin-text"));
|
|
11
|
-
const textlint_plugin_markdown_1 = __importDefault(require("@textlint/textlint-plugin-markdown"));
|
|
12
10
|
// text and markdown are built-in plugins
|
|
13
|
-
const
|
|
14
|
-
{
|
|
15
|
-
|
|
16
|
-
plugin
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
11
|
+
const loadBuiltInPlugins = async () => {
|
|
12
|
+
const [{ default: textPlugin }, { default: markdownPlugin }] = await Promise.all([
|
|
13
|
+
import("@textlint/textlint-plugin-text"),
|
|
14
|
+
import("@textlint/textlint-plugin-markdown"),
|
|
15
|
+
]);
|
|
16
|
+
return [
|
|
17
|
+
{
|
|
18
|
+
pluginId: "@textlint/textlint-plugin-text",
|
|
19
|
+
plugin: textPlugin,
|
|
20
|
+
options: true,
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
pluginId: "@textlint/textlint-plugin-markdown",
|
|
24
|
+
plugin: markdownPlugin,
|
|
25
|
+
options: true,
|
|
26
|
+
},
|
|
27
|
+
];
|
|
28
|
+
};
|
|
25
29
|
/**
|
|
26
30
|
* Convert rulesObject to TextlintKernelRule
|
|
27
31
|
* {
|
|
@@ -80,11 +84,21 @@ class TextLintCore {
|
|
|
80
84
|
constructor(_THIS_ARG_IS_JUST_IGNORED = []) {
|
|
81
85
|
this.kernelDescriptor = new kernel_1.TextlintKernelDescriptor({
|
|
82
86
|
rules: [],
|
|
83
|
-
plugins:
|
|
87
|
+
plugins: [],
|
|
84
88
|
filterRules: [],
|
|
85
89
|
});
|
|
86
90
|
// noop
|
|
87
91
|
}
|
|
92
|
+
async createKernelOptions() {
|
|
93
|
+
const kernelDescriptor = this.kernelDescriptor;
|
|
94
|
+
const builtInPlugins = await loadBuiltInPlugins();
|
|
95
|
+
const builtInPluginDescriptor = new kernel_1.TextlintKernelDescriptor({
|
|
96
|
+
rules: [],
|
|
97
|
+
filterRules: [],
|
|
98
|
+
plugins: builtInPlugins,
|
|
99
|
+
});
|
|
100
|
+
return builtInPluginDescriptor.concat(kernelDescriptor).toKernelOptions();
|
|
101
|
+
}
|
|
88
102
|
/**
|
|
89
103
|
* setup rules
|
|
90
104
|
* @param rules
|
|
@@ -117,7 +131,7 @@ class TextLintCore {
|
|
|
117
131
|
this.kernelDescriptor = new kernel_1.TextlintKernelDescriptor({
|
|
118
132
|
rules: [],
|
|
119
133
|
filterRules: [],
|
|
120
|
-
plugins:
|
|
134
|
+
plugins: [],
|
|
121
135
|
});
|
|
122
136
|
}
|
|
123
137
|
/**
|
|
@@ -142,7 +156,7 @@ class TextLintCore {
|
|
|
142
156
|
const kernel = new kernel_1.TextlintKernel();
|
|
143
157
|
return kernel.lintText(text, {
|
|
144
158
|
ext,
|
|
145
|
-
...this.
|
|
159
|
+
...(await this.createKernelOptions()),
|
|
146
160
|
});
|
|
147
161
|
}
|
|
148
162
|
/**
|
|
@@ -153,7 +167,7 @@ class TextLintCore {
|
|
|
153
167
|
const kernel = new kernel_1.TextlintKernel();
|
|
154
168
|
return kernel.lintText(text, {
|
|
155
169
|
ext: ".md",
|
|
156
|
-
...this.
|
|
170
|
+
...(await this.createKernelOptions()),
|
|
157
171
|
});
|
|
158
172
|
}
|
|
159
173
|
/**
|
|
@@ -166,7 +180,7 @@ class TextLintCore {
|
|
|
166
180
|
return kernel.lintText(content, {
|
|
167
181
|
ext: node_path_1.default.extname(filePath),
|
|
168
182
|
filePath,
|
|
169
|
-
...this.
|
|
183
|
+
...(await this.createKernelOptions()),
|
|
170
184
|
});
|
|
171
185
|
}
|
|
172
186
|
/**
|
|
@@ -179,7 +193,7 @@ class TextLintCore {
|
|
|
179
193
|
const kernel = new kernel_1.TextlintKernel();
|
|
180
194
|
return kernel.fixText(text, {
|
|
181
195
|
ext,
|
|
182
|
-
...this.
|
|
196
|
+
...(await this.createKernelOptions()),
|
|
183
197
|
});
|
|
184
198
|
}
|
|
185
199
|
/**
|
|
@@ -191,7 +205,7 @@ class TextLintCore {
|
|
|
191
205
|
return kernel.fixText(content, {
|
|
192
206
|
ext: node_path_1.default.extname(filePath),
|
|
193
207
|
filePath,
|
|
194
|
-
...this.
|
|
208
|
+
...(await this.createKernelOptions()),
|
|
195
209
|
});
|
|
196
210
|
}
|
|
197
211
|
}
|
package/lib/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAQA,6CAA4E;AAC5E,gEAAkC;AAClC,0DAA6B;AAE7B,yCAAyC;AACzC,MAAM,kBAAkB,GAAG,KAAK,IAAqC,EAAE;IACnE,MAAM,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC7E,MAAM,CAAC,gCAAgC,CAAC;QACxC,MAAM,CAAC,oCAAoC,CAAC;KAC/C,CAAC,CAAC;IACH,OAAO;QACH;YACI,QAAQ,EAAE,gCAAgC;YAC1C,MAAM,EAAE,UAAU;YAClB,OAAO,EAAE,IAAI;SAChB;QACD;YACI,QAAQ,EAAE,oCAAoC;YAC9C,MAAM,EAAE,cAAc;YACtB,OAAO,EAAE,IAAI;SAChB;KACJ,CAAC;AACN,CAAC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,uBAAuB,GAGD,CAAC,KAAK,EAAE,WAAW,EAAE,EAAE;IAC/C,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;QACrC,OAAO;YACH,MAAM;YACN,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC;YACnB,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC;SAC/B,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC,CAAC;AAEF,MA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c,EAAE,CAAC;QACpC,OAAO,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE;YAC3B,GAAG,EAAE,mBAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;YAC3B,QAAQ;YACR,GAAG,CAAC,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC;SACxC,CAAC,CAAC;IACP,CAAC;CACJ;AAjJD,oCAiJC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@textlint/legacy-textlint-core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "16.0.0",
|
|
4
4
|
"description": "Legacy TextLintCore Compatibility Layer for textlint v14+",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"definition",
|
|
@@ -45,18 +45,19 @@
|
|
|
45
45
|
"tabWidth": 4
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@textlint/kernel": "
|
|
49
|
-
"@textlint/textlint-plugin-markdown": "
|
|
50
|
-
"@textlint/textlint-plugin-text": "
|
|
48
|
+
"@textlint/kernel": "16.0.0",
|
|
49
|
+
"@textlint/textlint-plugin-markdown": "16.0.0",
|
|
50
|
+
"@textlint/textlint-plugin-text": "16.0.0",
|
|
51
|
+
"@textlint/types": "16.0.0"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
53
54
|
"@types/debug": "^4.1.13",
|
|
54
|
-
"@types/node": "^24.
|
|
55
|
+
"@types/node": "^24.19.2",
|
|
55
56
|
"prettier": "^2.8.1",
|
|
56
57
|
"typescript": "~5.8.3"
|
|
57
58
|
},
|
|
58
59
|
"publishConfig": {
|
|
59
60
|
"access": "public"
|
|
60
61
|
},
|
|
61
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "c23854983d375b07c10d33f19e7cabc3390d383b"
|
|
62
63
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,32 +1,35 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
TextlintFilterRuleReporter,
|
|
3
2
|
TextlintFixResult,
|
|
4
3
|
TextlintKernelFilterRule,
|
|
5
4
|
TextlintKernelPlugin,
|
|
6
5
|
TextlintKernelRule,
|
|
7
|
-
TextlintPluginCreator,
|
|
8
6
|
TextlintResult,
|
|
9
|
-
TextlintRuleModule,
|
|
10
7
|
} from "@textlint/kernel";
|
|
8
|
+
import type { TextlintFilterRuleReporter, TextlintPluginCreator, TextlintRuleModule } from "@textlint/types";
|
|
11
9
|
import { TextlintKernel, TextlintKernelDescriptor } from "@textlint/kernel";
|
|
12
10
|
import fs from "node:fs/promises";
|
|
13
11
|
import path from "node:path";
|
|
14
|
-
import textPlugin from "@textlint/textlint-plugin-text";
|
|
15
|
-
import markdownPlugin from "@textlint/textlint-plugin-markdown";
|
|
16
12
|
|
|
17
13
|
// text and markdown are built-in plugins
|
|
18
|
-
const
|
|
19
|
-
{
|
|
20
|
-
|
|
21
|
-
plugin
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
14
|
+
const loadBuiltInPlugins = async (): Promise<TextlintKernelPlugin[]> => {
|
|
15
|
+
const [{ default: textPlugin }, { default: markdownPlugin }] = await Promise.all([
|
|
16
|
+
import("@textlint/textlint-plugin-text"),
|
|
17
|
+
import("@textlint/textlint-plugin-markdown"),
|
|
18
|
+
]);
|
|
19
|
+
return [
|
|
20
|
+
{
|
|
21
|
+
pluginId: "@textlint/textlint-plugin-text",
|
|
22
|
+
plugin: textPlugin,
|
|
23
|
+
options: true,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
pluginId: "@textlint/textlint-plugin-markdown",
|
|
27
|
+
plugin: markdownPlugin,
|
|
28
|
+
options: true,
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
};
|
|
32
|
+
|
|
30
33
|
/**
|
|
31
34
|
* Convert rulesObject to TextlintKernelRule
|
|
32
35
|
* {
|
|
@@ -95,7 +98,7 @@ export const pluginsObjectToKernelRule = (
|
|
|
95
98
|
export class TextLintCore {
|
|
96
99
|
private kernelDescriptor = new TextlintKernelDescriptor({
|
|
97
100
|
rules: [],
|
|
98
|
-
plugins:
|
|
101
|
+
plugins: [],
|
|
99
102
|
filterRules: [],
|
|
100
103
|
});
|
|
101
104
|
|
|
@@ -103,6 +106,17 @@ export class TextLintCore {
|
|
|
103
106
|
// noop
|
|
104
107
|
}
|
|
105
108
|
|
|
109
|
+
private async createKernelOptions() {
|
|
110
|
+
const kernelDescriptor = this.kernelDescriptor;
|
|
111
|
+
const builtInPlugins = await loadBuiltInPlugins();
|
|
112
|
+
const builtInPluginDescriptor = new TextlintKernelDescriptor({
|
|
113
|
+
rules: [],
|
|
114
|
+
filterRules: [],
|
|
115
|
+
plugins: builtInPlugins,
|
|
116
|
+
});
|
|
117
|
+
return builtInPluginDescriptor.concat(kernelDescriptor).toKernelOptions();
|
|
118
|
+
}
|
|
119
|
+
|
|
106
120
|
/**
|
|
107
121
|
* setup rules
|
|
108
122
|
* @param rules
|
|
@@ -141,7 +155,7 @@ export class TextLintCore {
|
|
|
141
155
|
this.kernelDescriptor = new TextlintKernelDescriptor({
|
|
142
156
|
rules: [],
|
|
143
157
|
filterRules: [],
|
|
144
|
-
plugins:
|
|
158
|
+
plugins: [],
|
|
145
159
|
});
|
|
146
160
|
}
|
|
147
161
|
|
|
@@ -170,7 +184,7 @@ export class TextLintCore {
|
|
|
170
184
|
const kernel = new TextlintKernel();
|
|
171
185
|
return kernel.lintText(text, {
|
|
172
186
|
ext,
|
|
173
|
-
...this.
|
|
187
|
+
...(await this.createKernelOptions()),
|
|
174
188
|
});
|
|
175
189
|
}
|
|
176
190
|
|
|
@@ -182,7 +196,7 @@ export class TextLintCore {
|
|
|
182
196
|
const kernel = new TextlintKernel();
|
|
183
197
|
return kernel.lintText(text, {
|
|
184
198
|
ext: ".md",
|
|
185
|
-
...this.
|
|
199
|
+
...(await this.createKernelOptions()),
|
|
186
200
|
});
|
|
187
201
|
}
|
|
188
202
|
|
|
@@ -196,7 +210,7 @@ export class TextLintCore {
|
|
|
196
210
|
return kernel.lintText(content, {
|
|
197
211
|
ext: path.extname(filePath),
|
|
198
212
|
filePath,
|
|
199
|
-
...this.
|
|
213
|
+
...(await this.createKernelOptions()),
|
|
200
214
|
});
|
|
201
215
|
}
|
|
202
216
|
|
|
@@ -210,7 +224,7 @@ export class TextLintCore {
|
|
|
210
224
|
const kernel = new TextlintKernel();
|
|
211
225
|
return kernel.fixText(text, {
|
|
212
226
|
ext,
|
|
213
|
-
...this.
|
|
227
|
+
...(await this.createKernelOptions()),
|
|
214
228
|
});
|
|
215
229
|
}
|
|
216
230
|
|
|
@@ -223,7 +237,7 @@ export class TextLintCore {
|
|
|
223
237
|
return kernel.fixText(content, {
|
|
224
238
|
ext: path.extname(filePath),
|
|
225
239
|
filePath,
|
|
226
|
-
...this.
|
|
240
|
+
...(await this.createKernelOptions()),
|
|
227
241
|
});
|
|
228
242
|
}
|
|
229
243
|
}
|