Skip to content

Commit fd88ea5

Browse files
committed
chore(deps): update website generator
1 parent 4f673c9 commit fd88ea5

File tree

5 files changed

+673
-547
lines changed

5 files changed

+673
-547
lines changed
Lines changed: 228 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,228 @@
1+
// Generated webworker code by textlint-script-compiler
2+
import { TextlintKernel } from "@textlint/kernel";
3+
import { moduleInterop } from "@textlint/module-interop";
4+
import { parseOptionsFromConfig } from "@textlint/config-partial-parser"
5+
const kernel = new TextlintKernel();
6+
const rules = [
7+
{
8+
"ruleId": "ja-technical-writing/sentence-length",
9+
"rule": moduleInterop(require('textlint-rule-preset-ja-technical-writing').rules['sentence-length']),
10+
"options": {
11+
"max": 100
12+
}
13+
},
14+
{
15+
"ruleId": "ja-technical-writing/max-comma",
16+
"rule": moduleInterop(require('textlint-rule-preset-ja-technical-writing').rules['max-comma']),
17+
"options": {
18+
"max": 3
19+
}
20+
},
21+
{
22+
"ruleId": "ja-technical-writing/max-ten",
23+
"rule": moduleInterop(require('textlint-rule-preset-ja-technical-writing').rules['max-ten']),
24+
"options": {
25+
"max": 3
26+
}
27+
},
28+
{
29+
"ruleId": "ja-technical-writing/max-kanji-continuous-len",
30+
"rule": moduleInterop(require('textlint-rule-preset-ja-technical-writing').rules['max-kanji-continuous-len']),
31+
"options": {
32+
"max": 6
33+
}
34+
},
35+
{
36+
"ruleId": "ja-technical-writing/no-mix-dearu-desumasu",
37+
"rule": moduleInterop(require('textlint-rule-preset-ja-technical-writing').rules['no-mix-dearu-desumasu']),
38+
"options": {
39+
"preferInHeader": "",
40+
"preferInBody": "ですます",
41+
"preferInList": "である",
42+
"strict": false
43+
}
44+
},
45+
{
46+
"ruleId": "ja-technical-writing/ja-no-mixed-period",
47+
"rule": moduleInterop(require('textlint-rule-preset-ja-technical-writing').rules['ja-no-mixed-period']),
48+
"options": {
49+
"periodMark": "。"
50+
}
51+
},
52+
{
53+
"ruleId": "ja-technical-writing/arabic-kanji-numbers",
54+
"rule": moduleInterop(require('textlint-rule-preset-ja-technical-writing').rules['arabic-kanji-numbers']),
55+
"options": true
56+
},
57+
{
58+
"ruleId": "ja-technical-writing/no-doubled-conjunction",
59+
"rule": moduleInterop(require('textlint-rule-preset-ja-technical-writing').rules['no-doubled-conjunction']),
60+
"options": true
61+
},
62+
{
63+
"ruleId": "ja-technical-writing/no-doubled-conjunctive-particle-ga",
64+
"rule": moduleInterop(require('textlint-rule-preset-ja-technical-writing').rules['no-doubled-conjunctive-particle-ga']),
65+
"options": true
66+
},
67+
{
68+
"ruleId": "ja-technical-writing/no-double-negative-ja",
69+
"rule": moduleInterop(require('textlint-rule-preset-ja-technical-writing').rules['no-double-negative-ja']),
70+
"options": true
71+
},
72+
{
73+
"ruleId": "ja-technical-writing/no-doubled-joshi",
74+
"rule": moduleInterop(require('textlint-rule-preset-ja-technical-writing').rules['no-doubled-joshi']),
75+
"options": {
76+
"min_interval": 1
77+
}
78+
},
79+
{
80+
"ruleId": "ja-technical-writing/no-dropping-the-ra",
81+
"rule": moduleInterop(require('textlint-rule-preset-ja-technical-writing').rules['no-dropping-the-ra']),
82+
"options": true
83+
},
84+
{
85+
"ruleId": "ja-technical-writing/no-nfd",
86+
"rule": moduleInterop(require('textlint-rule-preset-ja-technical-writing').rules['no-nfd']),
87+
"options": true
88+
},
89+
{
90+
"ruleId": "ja-technical-writing/no-exclamation-question-mark",
91+
"rule": moduleInterop(require('textlint-rule-preset-ja-technical-writing').rules['no-exclamation-question-mark']),
92+
"options": true
93+
},
94+
{
95+
"ruleId": "ja-technical-writing/no-hankaku-kana",
96+
"rule": moduleInterop(require('textlint-rule-preset-ja-technical-writing').rules['no-hankaku-kana']),
97+
"options": true
98+
},
99+
{
100+
"ruleId": "ja-technical-writing/no-invalid-control-character",
101+
"rule": moduleInterop(require('textlint-rule-preset-ja-technical-writing').rules['no-invalid-control-character']),
102+
"options": true
103+
},
104+
{
105+
"ruleId": "ja-technical-writing/ja-no-weak-phrase",
106+
"rule": moduleInterop(require('textlint-rule-preset-ja-technical-writing').rules['ja-no-weak-phrase']),
107+
"options": true
108+
},
109+
{
110+
"ruleId": "ja-technical-writing/ja-no-successive-word",
111+
"rule": moduleInterop(require('textlint-rule-preset-ja-technical-writing').rules['ja-no-successive-word']),
112+
"options": true
113+
},
114+
{
115+
"ruleId": "ja-technical-writing/ja-no-abusage",
116+
"rule": moduleInterop(require('textlint-rule-preset-ja-technical-writing').rules['ja-no-abusage']),
117+
"options": true
118+
},
119+
{
120+
"ruleId": "ja-technical-writing/ja-no-redundant-expression",
121+
"rule": moduleInterop(require('textlint-rule-preset-ja-technical-writing').rules['ja-no-redundant-expression']),
122+
"options": true
123+
},
124+
{
125+
"ruleId": "ja-technical-writing/ja-unnatural-alphabet",
126+
"rule": moduleInterop(require('textlint-rule-preset-ja-technical-writing').rules['ja-unnatural-alphabet']),
127+
"options": true
128+
},
129+
{
130+
"ruleId": "ja-technical-writing/no-unmatched-pair",
131+
"rule": moduleInterop(require('textlint-rule-preset-ja-technical-writing').rules['no-unmatched-pair']),
132+
"options": true
133+
},
134+
{
135+
"ruleId": "ja-technical-writing/no-zero-width-spaces",
136+
"rule": moduleInterop(require('textlint-rule-preset-ja-technical-writing').rules['no-zero-width-spaces']),
137+
"options": true
138+
}
139+
];
140+
const filterRules = [
141+
{
142+
"ruleId": "comments",
143+
"rule": moduleInterop(require('textlint-filter-rule-comments')),
144+
"options": true
145+
}
146+
];
147+
const plugins = [
148+
{
149+
"pluginId": "@textlint/text",
150+
"plugin": moduleInterop(require('@textlint/textlint-plugin-text')),
151+
"options": true
152+
},
153+
{
154+
"pluginId": "@textlint/markdown",
155+
"plugin": moduleInterop(require('@textlint/textlint-plugin-markdown')),
156+
"options": true
157+
}
158+
];
159+
const config = {
160+
rules: rules,
161+
filterRules: filterRules,
162+
plugins: plugins
163+
};
164+
// merge config
165+
const assignConfig = (textlintrc) => {
166+
const userDefinedConfig = parseOptionsFromConfig(textlintrc);
167+
if (userDefinedConfig.rules) {
168+
config.rules = config.rules.map(rule => {
169+
const override = userDefinedConfig.rules.find(o => o.ruleId === rule.ruleId);
170+
return { ...rule, ...override };
171+
});
172+
}
173+
if (userDefinedConfig.filterRules) {
174+
config.filterRules = config.filterRules.map(rule => {
175+
const override = userDefinedConfig.filterRules.find(o => o.ruleId === rule.ruleId);
176+
return { ...rule, ...override };
177+
});
178+
}
179+
if (userDefinedConfig.plugins) {
180+
config.plugins = config.plugins.map(rule => {
181+
const override = userDefinedConfig.plugins.find(o => o.pluginId === rule.pluginId);
182+
return { ...rule, ...override };
183+
});
184+
}
185+
};
186+
self.addEventListener('message', (event) => {
187+
const data = event.data;
188+
const rules = data.ruleId === undefined
189+
? config.rules
190+
: config.rules.filter(rule => rule.ruleId === data.ruleId);
191+
switch (data.command) {
192+
case "merge-config":
193+
return assignConfig(data.textlintrc);
194+
case "lint":
195+
return kernel.lintText(data.text, {
196+
rules: rules,
197+
filterRules: config.filterRules,
198+
plugins: config.plugins,
199+
filePath: "/path/to/README" + data.ext,
200+
ext: data.ext,
201+
}).then(result => {
202+
return self.postMessage({
203+
command: "lint:result",
204+
result
205+
});
206+
});
207+
case "fix":
208+
return kernel.fixText(data.text, {
209+
rules: rules,
210+
filterRules: config.filterRules,
211+
plugins: config.plugins,
212+
filePath: "/path/to/README" + data.ext,
213+
ext: data.ext,
214+
}).then(result => {
215+
return self.postMessage({
216+
command: "fix:result",
217+
result
218+
});
219+
});
220+
default:
221+
console.log("Unknown command: " + data.command);
222+
}
223+
});
224+
// ====
225+
self.postMessage({
226+
command: "init",
227+
metadata: process.env.TEXTLINT_SCRIPT_METADATA
228+
});

example/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
"website": "textlint-website-generator --output-dir ./dist"
1010
},
1111
"devDependencies": {
12-
"@textlint/website-generator": "^0.12.1",
13-
"textlint": "^13.1.4",
12+
"@textlint/website-generator": "^0.13.0",
13+
"textlint": "^13.3.0",
1414
"textlint-filter-rule-comments": "^1.2.2",
1515
"textlint-rule-preset-ja-technical-writing": "file:../"
1616
}

0 commit comments

Comments
 (0)