@d-zero/a11y-check-core 0.6.21-alpha.2 → 0.7.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.
@@ -1,5 +1,7 @@
1
1
  import type { Scenario } from './types.js';
2
+ import type { PageHookSource } from '@d-zero/puppeteer-page-scan';
2
3
  export type ChildProcessParams = {
3
4
  readonly scenarios: readonly Scenario[];
4
5
  readonly cacheDir: string;
6
+ readonly hooks?: PageHookSource;
5
7
  };
@@ -1,16 +1,19 @@
1
1
  import { createChildProcess } from '@d-zero/puppeteer-dealer';
2
- import { beforePageScan, defaultSizes, pageScanListener, } from '@d-zero/puppeteer-page-scan';
2
+ import { beforePageScan, defaultSizes, pageScanListener, readPageHooks, } from '@d-zero/puppeteer-page-scan';
3
3
  import { Cache } from '@d-zero/shared/cache';
4
4
  import c from 'ansi-colors';
5
5
  import { importScenarios } from '@d-zero/a11y-check-core';
6
6
  createChildProcess(async (param) => {
7
- const { cacheDir } = param;
7
+ const { cacheDir, hooks: hookSource } = param;
8
8
  const cache = new Cache('a11y-check/run-puppeteer', cacheDir);
9
9
  const sizes = {
10
10
  desktop: defaultSizes.desktop,
11
11
  mobile: defaultSizes.mobile,
12
12
  };
13
13
  const scenarios = await importScenarios(param.scenarios);
14
+ const hooks = hookSource && hookSource.paths.length > 0
15
+ ? await readPageHooks(hookSource.paths, hookSource.baseDir)
16
+ : undefined;
14
17
  return {
15
18
  // async beforeOpenPage(_, url, logger) {
16
19
  // if (options?.cache === false) {
@@ -44,6 +47,7 @@ createChildProcess(async (param) => {
44
47
  await beforePageScan(page, url, {
45
48
  name,
46
49
  ...size,
50
+ hooks,
47
51
  listener: pageScanListener(logger),
48
52
  });
49
53
  const scenarioResult = await scenario.exec(page, name, (log) => logger(`${sizeLabel} ${log}`));
@@ -24,6 +24,7 @@ export async function scenarioRunner(urlList, scenarios, options) {
24
24
  return createProcess(path.resolve(import.meta.dirname, 'scenario-child-process.js'), {
25
25
  scenarios,
26
26
  cacheDir: options?.cacheDir ?? '.a11y-check-core',
27
+ hooks: options?.hooks,
27
28
  }, options);
28
29
  }, {
29
30
  ...options,
package/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { DealOptions } from '@d-zero/dealer';
2
- import type { PageHook } from '@d-zero/puppeteer-page-scan';
2
+ import type { PageHookSource } from '@d-zero/puppeteer-page-scan';
3
3
  import type { Page } from 'puppeteer';
4
4
  export type CoreOptions = {
5
5
  readonly screenshot?: boolean;
@@ -8,7 +8,7 @@ export type CoreOptions = {
8
8
  };
9
9
  export type ScenarioRunnerOptions = DealOptions & {
10
10
  readonly locale?: string;
11
- readonly hooks?: readonly PageHook[];
11
+ readonly hooks?: PageHookSource;
12
12
  };
13
13
  export type ScenarioCreator<O> = (options?: O) => Scenario;
14
14
  export type Scenario = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d-zero/a11y-check-core",
3
- "version": "0.6.21-alpha.2",
3
+ "version": "0.7.0",
4
4
  "description": "Accessibility Checker (Core Module)",
5
5
  "author": "D-ZERO",
6
6
  "license": "MIT",
@@ -23,20 +23,20 @@
23
23
  "clean": "tsc --build --clean"
24
24
  },
25
25
  "dependencies": {
26
- "@d-zero/puppeteer-dealer": "0.7.10-alpha.2",
27
- "@d-zero/shared": "0.21.3-alpha.2",
26
+ "@d-zero/puppeteer-dealer": "0.7.11",
27
+ "@d-zero/shared": "0.22.0",
28
28
  "ansi-colors": "4.1.3",
29
29
  "color-contrast-checker": "2.1.0",
30
30
  "puppeteer": "24.37.5"
31
31
  },
32
32
  "devDependencies": {
33
- "@d-zero/dealer": "1.7.4-alpha.2",
34
- "@d-zero/puppeteer-page-scan": "4.4.10-alpha.2"
33
+ "@d-zero/dealer": "1.7.5",
34
+ "@d-zero/puppeteer-page-scan": "4.5.0"
35
35
  },
36
36
  "repository": {
37
37
  "type": "git",
38
38
  "url": "https://github.com/d-zero-dev/tools.git",
39
39
  "directory": "packages/@d-zero/a11y-check-core"
40
40
  },
41
- "gitHead": "74b262438ed5e263d89a066029adfadf1ec27e0b"
41
+ "gitHead": "2d24e08c0cb516b7ea9d07a4301eb991193cca11"
42
42
  }