@riebeckite/plugin-quality 0.0.32 → 0.0.33
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 +4 -4
- package/README_ja.md +8 -8
- package/dist/index.d.ts +1 -2
- package/dist/index.js +2 -4
- package/dist/src/scanner.d.ts +0 -4
- package/dist/src/types.d.ts +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ Static quality and accessibility inspection for generated HTML in Riebeckite.
|
|
|
8
8
|
|
|
9
9
|
## Overview
|
|
10
10
|
|
|
11
|
-
`
|
|
11
|
+
`quality()` runs a small set of dependency-free, regex-based rules over
|
|
12
12
|
the HTML produced by the build and reports the findings through the shared
|
|
13
13
|
diagnostics channel. There is no DOM, no axe-core, and no headless browser.
|
|
14
14
|
|
|
@@ -20,11 +20,11 @@ exported `inspectGeneratedHtml` hook for final pages.
|
|
|
20
20
|
|
|
21
21
|
```ts
|
|
22
22
|
import { defineConfig } from "@riebeckite/core";
|
|
23
|
-
import {
|
|
23
|
+
import { quality } from "@riebeckite/plugin-quality";
|
|
24
24
|
|
|
25
25
|
export default defineConfig({
|
|
26
26
|
// ...
|
|
27
|
-
plugins: [
|
|
27
|
+
plugins: [quality({ failOn: "error" })],
|
|
28
28
|
});
|
|
29
29
|
```
|
|
30
30
|
|
|
@@ -50,7 +50,7 @@ export default defineConfig({
|
|
|
50
50
|
|
|
51
51
|
## API
|
|
52
52
|
|
|
53
|
-
- `
|
|
53
|
+
- `quality(options?)` — plugin factory.
|
|
54
54
|
- `inspectHtml(html, options?)` — pure function returning `Diagnostic[]`.
|
|
55
55
|
- `inspectGeneratedHtml(page, options?)` — pure function that inspects a final
|
|
56
56
|
page and sets `filePath` to `page.path`.
|
package/README_ja.md
CHANGED
|
@@ -8,19 +8,19 @@ Riebeckite が生成する HTML を静的に検査し、品質とアクセシビ
|
|
|
8
8
|
|
|
9
9
|
## 概要
|
|
10
10
|
|
|
11
|
-
`
|
|
11
|
+
`quality()` は、ビルドで生成された HTML に対して依存パッケージなしの正規表現ベースのルールを実行し、結果を共通の診断チャネルへ流します。DOM も axe-core もヘッドレスブラウザも使いません。
|
|
12
12
|
|
|
13
|
-
マニフェスト生成の段階では、公開エントリごとの記事 HTML を検査します。HTML
|
|
13
|
+
マニフェスト生成の段階では、公開エントリごとの記事 HTML を検査します。HTML 生成を完了する統合側は、最終ページに対して公開 API の `inspectGeneratedHtml` を追加で呼び出せます。
|
|
14
14
|
|
|
15
15
|
## 使い方
|
|
16
16
|
|
|
17
17
|
```ts
|
|
18
18
|
import { defineConfig } from "@riebeckite/core";
|
|
19
|
-
import {
|
|
19
|
+
import { quality } from "@riebeckite/plugin-quality";
|
|
20
20
|
|
|
21
21
|
export default defineConfig({
|
|
22
22
|
// ...
|
|
23
|
-
plugins: [
|
|
23
|
+
plugins: [quality({ failOn: "error" })],
|
|
24
24
|
});
|
|
25
25
|
```
|
|
26
26
|
|
|
@@ -28,9 +28,9 @@ export default defineConfig({
|
|
|
28
28
|
|
|
29
29
|
| オプション | 型 | 説明 |
|
|
30
30
|
| ---------- | -- | ---- |
|
|
31
|
-
| `ignoreRules` | `string[]` |
|
|
31
|
+
| `ignoreRules` | `string[]` | 抑制する診断コード(例: `"quality:empty-link-text"`)。 |
|
|
32
32
|
| `a11y` | `{ enabled?: boolean }` | アクセシビリティ検査。既定は有効で、`enabled: false` で全ルールを止めます。 |
|
|
33
|
-
| `failOn` | `"error" \| "never"` | マニフェスト段階で error
|
|
33
|
+
| `failOn` | `"error" \| "never"` | マニフェスト段階で error の診断があればビルドを失敗させます。既定は `"never"`。 |
|
|
34
34
|
|
|
35
35
|
## ルール一覧
|
|
36
36
|
|
|
@@ -46,7 +46,7 @@ export default defineConfig({
|
|
|
46
46
|
|
|
47
47
|
## API
|
|
48
48
|
|
|
49
|
-
- `
|
|
49
|
+
- `quality(options?)`:プラグインファクトリ。
|
|
50
50
|
- `inspectHtml(html, options?)`:`Diagnostic[]` を返す純粋関数。
|
|
51
51
|
- `inspectGeneratedHtml(page, options?)`:最終ページを検査し、`filePath` に `page.path` を設定する純粋関数。
|
|
52
52
|
- `RULE_CODES`:安定した code の一覧。
|
|
@@ -54,7 +54,7 @@ export default defineConfig({
|
|
|
54
54
|
|
|
55
55
|
## 制限事項
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
スキャナーは正規表現ベースであり、実際の DOM ではありません。不正なマークアップの検証やネストの深さの追跡は行わず、開始タグと終了タグの対応付けは整形式でネストのない要素だけを扱います。走査の前にコメントと `<script>`・`<style>` の中身はマスクします。そのため、文書構造に依存するルール(見出し順、テーブルヘッダー)は、特殊なマークアップでは検出漏れや誤検出が起こりえます。
|
|
58
58
|
|
|
59
59
|
## 関連
|
|
60
60
|
|
package/dist/index.d.ts
CHANGED
|
@@ -16,5 +16,4 @@ export declare function inspectGeneratedHtml(page: PluginGeneratedHtml, options?
|
|
|
16
16
|
* field lets an SSG integration inspect final pages after the build, where no
|
|
17
17
|
* manifest is available.
|
|
18
18
|
*/
|
|
19
|
-
export declare function
|
|
20
|
-
export declare const quality: typeof qualityPlugin;
|
|
19
|
+
export declare function quality(options?: QualityOptions): RiebeckitePlugin;
|
package/dist/index.js
CHANGED
|
@@ -364,7 +364,7 @@ function inspectGeneratedHtml(page, options = {}) {
|
|
|
364
364
|
filePath: page.path
|
|
365
365
|
}));
|
|
366
366
|
}
|
|
367
|
-
function
|
|
367
|
+
function quality(options = {}) {
|
|
368
368
|
const resolved = resolveQualityOptions(options);
|
|
369
369
|
const inspectOptions = {
|
|
370
370
|
ignoreRules: options.ignoreRules,
|
|
@@ -401,12 +401,10 @@ ${details}`
|
|
|
401
401
|
}
|
|
402
402
|
});
|
|
403
403
|
}
|
|
404
|
-
var quality = qualityPlugin;
|
|
405
404
|
export {
|
|
406
405
|
QUALITY_PLUGIN_NAME,
|
|
407
406
|
RULE_CODES,
|
|
408
407
|
inspectGeneratedHtml,
|
|
409
408
|
inspectHtml,
|
|
410
|
-
quality
|
|
411
|
-
qualityPlugin
|
|
409
|
+
quality
|
|
412
410
|
};
|
package/dist/src/scanner.d.ts
CHANGED
|
@@ -32,13 +32,9 @@ export declare function maskIgnoredRegions(html: string): string;
|
|
|
32
32
|
* removed by {@link maskIgnoredRegions}.
|
|
33
33
|
*/
|
|
34
34
|
export declare function scanElements(document: string): HtmlElement[];
|
|
35
|
-
/** Parses an attribute list into a lowercase-keyed map. */
|
|
36
|
-
export declare function parseAttributes(text: string): Map<string, string>;
|
|
37
35
|
/** Extracts text content, dropping tags and decoding common entities. */
|
|
38
36
|
export declare function textContent(fragment: string): string;
|
|
39
37
|
/** Returns the raw attribute value, or `undefined` when it is absent. */
|
|
40
38
|
export declare function attribute(element: HtmlElement, name: string): string | undefined;
|
|
41
39
|
/** True when the attribute is present and its value is not blank. */
|
|
42
40
|
export declare function hasNonEmptyAttribute(element: HtmlElement, name: string): boolean;
|
|
43
|
-
/** Decodes a small set of named and numeric HTML entities. */
|
|
44
|
-
export declare function decodeHtmlEntities(value: string): string;
|
package/dist/src/types.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export type InspectOptions = {
|
|
|
16
16
|
};
|
|
17
17
|
};
|
|
18
18
|
/**
|
|
19
|
-
* Options for {@link
|
|
19
|
+
* Options for {@link quality}. Extends the inspection options with a
|
|
20
20
|
* build-failure policy.
|
|
21
21
|
*/
|
|
22
22
|
export type QualityOptions = InspectOptions & {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riebeckite/plugin-quality",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.33",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@riebeckite/core": "0.0.
|
|
17
|
+
"@riebeckite/core": "0.0.33"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"tsx": "^4.22.4"
|