Skip to content

Commit

Permalink
Update Alfa (Siteimprove#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jym77 authored Mar 30, 2023
1 parent 880ad28 commit 7c24df0
Show file tree
Hide file tree
Showing 39 changed files with 1,267 additions and 1,175 deletions.
8 changes: 4 additions & 4 deletions packages/alfa-angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
],
"dependencies": {
"@angular/core": "^11.0.0",
"@siteimprove/alfa-device": "^0.61.0",
"@siteimprove/alfa-dom": "^0.61.0",
"@siteimprove/alfa-http": "^0.61.0",
"@siteimprove/alfa-web": "^0.61.0",
"@siteimprove/alfa-device": "^0.62.0",
"@siteimprove/alfa-dom": "^0.62.0",
"@siteimprove/alfa-http": "^0.62.0",
"@siteimprove/alfa-web": "^0.62.0",
"rxjs": "^7.3.0",
"zone.js": "^0.11.4"
},
Expand Down
18 changes: 9 additions & 9 deletions packages/alfa-assert/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@
"src/**/*.d.ts"
],
"dependencies": {
"@siteimprove/alfa-act": "^0.61.0",
"@siteimprove/alfa-future": "^0.61.0",
"@siteimprove/alfa-hash": "^0.61.0",
"@siteimprove/alfa-option": "^0.61.0",
"@siteimprove/alfa-performance": "^0.61.0",
"@siteimprove/alfa-predicate": "^0.61.0",
"@siteimprove/alfa-result": "^0.61.0",
"@siteimprove/alfa-sequence": "^0.61.0"
"@siteimprove/alfa-act": "^0.62.0",
"@siteimprove/alfa-future": "^0.62.0",
"@siteimprove/alfa-hash": "^0.62.0",
"@siteimprove/alfa-option": "^0.62.0",
"@siteimprove/alfa-performance": "^0.62.0",
"@siteimprove/alfa-predicate": "^0.62.0",
"@siteimprove/alfa-result": "^0.62.0",
"@siteimprove/alfa-sequence": "^0.62.0"
},
"devDependencies": {
"@siteimprove/alfa-test": "^0.61.0"
"@siteimprove/alfa-test": "^0.62.0"
},
"publishConfig": {
"access": "public",
Expand Down
14 changes: 9 additions & 5 deletions packages/alfa-assert/src/asserter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Rule } from "@siteimprove/alfa-act";
import { Question, Rule } from "@siteimprove/alfa-act";
import { Hashable } from "@siteimprove/alfa-hash";

import { Assertion } from "./assertion";
Expand All @@ -7,8 +7,8 @@ import { Handler } from "./handler";
/**
* @public
*/
export class Asserter<I, T extends Hashable, Q, S> {
public static of<I, T extends Hashable, Q, S>(
export class Asserter<I, T extends Hashable, Q extends Question.Metadata, S> {
public static of<I, T extends Hashable, Q extends Question.Metadata, S>(
rules: Iterable<Rule<I, T, Q, S>>,
handlers: Iterable<Handler<I, T, Q, S>> = [],
options: Asserter.Options<I, T, Q, S> = {}
Expand Down Expand Up @@ -44,6 +44,10 @@ export class Asserter<I, T extends Hashable, Q, S> {
* @public
*/
export namespace Asserter {
export interface Options<I, T extends Hashable, Q, S>
extends Assertion.Options<I, T, Q, S> {}
export interface Options<
I,
T extends Hashable,
Q extends Question.Metadata,
S
> extends Assertion.Options<I, T, Q, S> {}
}
13 changes: 9 additions & 4 deletions packages/alfa-assert/src/assertion.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Audit, Oracle, Outcome, Rule } from "@siteimprove/alfa-act";
import { Audit, Oracle, Outcome, Question, Rule } from "@siteimprove/alfa-act";
import { Future } from "@siteimprove/alfa-future";
import { Hashable } from "@siteimprove/alfa-hash";
import { None } from "@siteimprove/alfa-option";
Expand All @@ -14,8 +14,8 @@ const { or } = Predicate;
/**
* @public
*/
export class Assertion<I, T extends Hashable, Q, S> {
public static of<I, T extends Hashable, Q, S>(
export class Assertion<I, T extends Hashable, Q extends Question.Metadata, S> {
public static of<I, T extends Hashable, Q extends Question.Metadata, S>(
input: I,
rules: Iterable<Rule<I, T, Q, S>>,
handlers: Iterable<Handler<I, T, Q, S>> = [],
Expand Down Expand Up @@ -133,7 +133,12 @@ export class Assertion<I, T extends Hashable, Q, S> {
* @public
*/
export namespace Assertion {
export interface Options<I, T extends Hashable, Q, S> {
export interface Options<
I,
T extends Hashable,
Q extends Question.Metadata,
S
> {
/**
* Predicate for filtering outcomes that should count towards an assertion
* failure.; only failed outcomes matching this filter will be reported.
Expand Down
9 changes: 7 additions & 2 deletions packages/alfa-assert/src/handler.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import { Rule, Outcome } from "@siteimprove/alfa-act";
import { Rule, Outcome, Question } from "@siteimprove/alfa-act";
import { Future } from "@siteimprove/alfa-future";
import { Hashable } from "@siteimprove/alfa-hash";

/**
* @public
*/
export interface Handler<I, T extends Hashable, Q, S> {
export interface Handler<
I,
T extends Hashable,
Q extends Question.Metadata,
S
> {
(
input: I,
rules: Iterable<Rule<I, T, Q, S>>,
Expand Down
8 changes: 6 additions & 2 deletions packages/alfa-assert/test/fixture/rule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import { Diagnostic, Question, Rule } from "@siteimprove/alfa-act";
import { Hashable } from "@siteimprove/alfa-hash";
import { Result, Err } from "@siteimprove/alfa-result";

export const Pass = <T extends Hashable, Q = never>(uri: string) =>
export const Pass = <T extends Hashable, Q extends Question.Metadata = {}>(
uri: string
) =>
Rule.Atomic.of<T, T, Q>({
uri,

Expand All @@ -21,7 +23,9 @@ export const Pass = <T extends Hashable, Q = never>(uri: string) =>
},
});

export const Fail = <T extends Hashable, Q = never>(uri: string) =>
export const Fail = <T extends Hashable, Q extends Question.Metadata = {}>(
uri: string
) =>
Rule.Atomic.of<T, T, Q>({
uri,

Expand Down
8 changes: 4 additions & 4 deletions packages/alfa-chai/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
"src/**/*.d.ts"
],
"dependencies": {
"@siteimprove/alfa-act": "^0.61.0",
"@siteimprove/alfa-act": "^0.62.0",
"@siteimprove/alfa-assert": "workspace:^0.61.0",
"@siteimprove/alfa-future": "^0.61.0",
"@siteimprove/alfa-hash": "^0.61.0",
"@siteimprove/alfa-mapper": "^0.61.0",
"@siteimprove/alfa-future": "^0.62.0",
"@siteimprove/alfa-hash": "^0.62.0",
"@siteimprove/alfa-mapper": "^0.62.0",
"@types/chai": "^4.1.7",
"chai": "^4.3.4"
},
Expand Down
17 changes: 14 additions & 3 deletions packages/alfa-chai/src/chai.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference types="chai" />

import { Rule } from "@siteimprove/alfa-act";
import { Question, Rule } from "@siteimprove/alfa-act";
import { Asserter, Assertion, Handler } from "@siteimprove/alfa-assert";
import { Future } from "@siteimprove/alfa-future";
import { Hashable } from "@siteimprove/alfa-hash";
Expand All @@ -11,7 +11,12 @@ import * as assert from "@siteimprove/alfa-assert";
declare global {
namespace Chai {
interface Assertion {
accessible<I, T extends Hashable, Q = never, S = T>(
accessible<
I,
T extends Hashable,
Q extends Question.Metadata = {},
S = T
>(
options?: assert.Assertion.Options<I, T, Q, S>
): Promise<void>;
}
Expand All @@ -22,7 +27,13 @@ declare global {
* @public
*/
export namespace Chai {
export function createPlugin<I, J, T extends Hashable, Q = never, S = T>(
export function createPlugin<
I,
J,
T extends Hashable,
Q extends Question.Metadata = {},
S = T
>(
transform: Mapper<I, Future.Maybe<J>>,
rules: Iterable<Rule<J, T, Q, S>>,
handlers: Iterable<Handler<J, T, Q, S>> = [],
Expand Down
8 changes: 4 additions & 4 deletions packages/alfa-cheerio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
"src/**/*.d.ts"
],
"dependencies": {
"@siteimprove/alfa-device": "^0.61.0",
"@siteimprove/alfa-dom": "^0.61.0",
"@siteimprove/alfa-http": "^0.61.0",
"@siteimprove/alfa-web": "^0.61.0",
"@siteimprove/alfa-device": "^0.62.0",
"@siteimprove/alfa-dom": "^0.62.0",
"@siteimprove/alfa-http": "^0.62.0",
"@siteimprove/alfa-web": "^0.62.0",
"cheerio": "^1.0.0-rc.10",
"domhandler": "^4.2.2"
},
Expand Down
20 changes: 10 additions & 10 deletions packages/alfa-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@
"bin/**/*.d.ts"
],
"dependencies": {
"@siteimprove/alfa-act": "^0.61.0",
"@siteimprove/alfa-act": "^0.62.0",
"@siteimprove/alfa-command": "workspace:^0.61.0",
"@siteimprove/alfa-device": "^0.61.0",
"@siteimprove/alfa-device": "^0.62.0",
"@siteimprove/alfa-formatter": "workspace:^0.61.0",
"@siteimprove/alfa-http": "^0.61.0",
"@siteimprove/alfa-http": "^0.62.0",
"@siteimprove/alfa-interviewer": "workspace:^0.61.0",
"@siteimprove/alfa-iterable": "^0.61.0",
"@siteimprove/alfa-option": "^0.61.0",
"@siteimprove/alfa-result": "^0.61.0",
"@siteimprove/alfa-rules": "^0.61.0",
"@siteimprove/alfa-iterable": "^0.62.0",
"@siteimprove/alfa-option": "^0.62.0",
"@siteimprove/alfa-result": "^0.62.0",
"@siteimprove/alfa-rules": "^0.62.0",
"@siteimprove/alfa-scraper": "workspace:^0.61.0",
"@siteimprove/alfa-time": "^0.61.0",
"@siteimprove/alfa-url": "^0.61.0",
"@siteimprove/alfa-web": "^0.61.0"
"@siteimprove/alfa-time": "^0.62.0",
"@siteimprove/alfa-url": "^0.62.0",
"@siteimprove/alfa-web": "^0.62.0"
},
"publishConfig": {
"access": "public",
Expand Down
22 changes: 11 additions & 11 deletions packages/alfa-command/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@
"src/**/*.d.ts"
],
"dependencies": {
"@siteimprove/alfa-functor": "^0.61.0",
"@siteimprove/alfa-highlight": "^0.61.0",
"@siteimprove/alfa-json": "^0.61.0",
"@siteimprove/alfa-mapper": "^0.61.0",
"@siteimprove/alfa-option": "^0.61.0",
"@siteimprove/alfa-parser": "^0.61.0",
"@siteimprove/alfa-predicate": "^0.61.0",
"@siteimprove/alfa-refinement": "^0.61.0",
"@siteimprove/alfa-result": "^0.61.0",
"@siteimprove/alfa-thunk": "^0.61.0"
"@siteimprove/alfa-functor": "^0.62.0",
"@siteimprove/alfa-highlight": "^0.62.0",
"@siteimprove/alfa-json": "^0.62.0",
"@siteimprove/alfa-mapper": "^0.62.0",
"@siteimprove/alfa-option": "^0.62.0",
"@siteimprove/alfa-parser": "^0.62.0",
"@siteimprove/alfa-predicate": "^0.62.0",
"@siteimprove/alfa-refinement": "^0.62.0",
"@siteimprove/alfa-result": "^0.62.0",
"@siteimprove/alfa-thunk": "^0.62.0"
},
"devDependencies": {
"@siteimprove/alfa-test": "^0.61.0"
"@siteimprove/alfa-test": "^0.62.0"
},
"publishConfig": {
"access": "public",
Expand Down
12 changes: 6 additions & 6 deletions packages/alfa-crawler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
"src/**/*.d.ts"
],
"dependencies": {
"@siteimprove/alfa-dom": "^0.61.0",
"@siteimprove/alfa-dom": "^0.62.0",
"@siteimprove/alfa-frontier": "workspace:^0.61.0",
"@siteimprove/alfa-mapper": "^0.61.0",
"@siteimprove/alfa-result": "^0.61.0",
"@siteimprove/alfa-mapper": "^0.62.0",
"@siteimprove/alfa-result": "^0.62.0",
"@siteimprove/alfa-scraper": "workspace:^0.61.0",
"@siteimprove/alfa-url": "^0.61.0",
"@siteimprove/alfa-web": "^0.61.0"
"@siteimprove/alfa-url": "^0.62.0",
"@siteimprove/alfa-web": "^0.62.0"
},
"devDependencies": {
"@siteimprove/alfa-test": "^0.61.0"
"@siteimprove/alfa-test": "^0.62.0"
},
"publishConfig": {
"access": "public",
Expand Down
14 changes: 7 additions & 7 deletions packages/alfa-cypress/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
"src/**/*.d.ts"
],
"dependencies": {
"@siteimprove/alfa-act": "^0.61.0",
"@siteimprove/alfa-act": "^0.62.0",
"@siteimprove/alfa-assert": "workspace:^0.61.0",
"@siteimprove/alfa-device": "^0.61.0",
"@siteimprove/alfa-dom": "^0.61.0",
"@siteimprove/alfa-device": "^0.62.0",
"@siteimprove/alfa-dom": "^0.62.0",
"@siteimprove/alfa-formatter": "workspace:^0.61.0",
"@siteimprove/alfa-formatter-earl": "workspace:^0.61.0",
"@siteimprove/alfa-hash": "^0.61.0",
"@siteimprove/alfa-http": "^0.61.0",
"@siteimprove/alfa-mapper": "^0.61.0",
"@siteimprove/alfa-web": "^0.61.0",
"@siteimprove/alfa-hash": "^0.62.0",
"@siteimprove/alfa-http": "^0.62.0",
"@siteimprove/alfa-mapper": "^0.62.0",
"@siteimprove/alfa-web": "^0.62.0",
"cypress": "^10.6.0"
},
"publishConfig": {
Expand Down
14 changes: 12 additions & 2 deletions packages/alfa-cypress/src/cypress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// two being referenced in the same compilation unit as they'd be considered
// incompatible.

import { Question } from "@siteimprove/alfa-act";
import { Asserter, Handler } from "@siteimprove/alfa-assert";
import { Device } from "@siteimprove/alfa-device";
import { Document, Node } from "@siteimprove/alfa-dom";
Expand Down Expand Up @@ -40,7 +41,11 @@ declare global {
* @public
*/
export namespace Cypress {
export function createPlugin<T extends Hashable, Q = never, S = T>(
export function createPlugin<
T extends Hashable,
Q extends Question.Metadata = {},
S = T
>(
rules: Iterable<act.Rule<Page, T, Q, S>>,
handlers: Iterable<Handler<Page, T, Q, S>> = [],
options: Asserter.Options<Page, T, Q, S> = {}
Expand Down Expand Up @@ -113,7 +118,12 @@ export namespace Cypress {
* `after()` hook that will write any files collected during the test run
* _after_ the tests are done.
*/
export function persist<I, T extends Hashable, Q, S>(
export function persist<
I,
T extends Hashable,
Q extends Question.Metadata,
S
>(
output: Mapper<I, string>,
format: Formatter<I, T, Q, S> = earl()
): Handler<I, T, Q, S> {
Expand Down
2 changes: 1 addition & 1 deletion packages/alfa-enzyme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
],
"dependencies": {
"@siteimprove/alfa-react": "workspace:^0.61.0",
"@siteimprove/alfa-web": "^0.61.0",
"@siteimprove/alfa-web": "^0.62.0",
"@types/enzyme": "^3.10.8",
"enzyme": "^3.11.0"
},
Expand Down
6 changes: 3 additions & 3 deletions packages/alfa-formatter-earl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
"src/**/*.d.ts"
],
"dependencies": {
"@siteimprove/alfa-earl": "^0.61.0",
"@siteimprove/alfa-earl": "^0.62.0",
"@siteimprove/alfa-formatter": "workspace:^0.61.0",
"@siteimprove/alfa-future": "^0.61.0",
"@siteimprove/alfa-hash": "^0.61.0",
"@siteimprove/alfa-future": "^0.62.0",
"@siteimprove/alfa-hash": "^0.62.0",
"jsonld": "^6.0.0"
},
"publishConfig": {
Expand Down
8 changes: 7 additions & 1 deletion packages/alfa-formatter-earl/src/earl.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Question } from "@siteimprove/alfa-act";
import { Serializable, EARL } from "@siteimprove/alfa-earl";
import { Formatter } from "@siteimprove/alfa-formatter";
import { Future } from "@siteimprove/alfa-future";
Expand All @@ -12,7 +13,12 @@ const { stringify } = JSON;
/**
* @public
*/
export default function <I, T extends Hashable, Q, S>(): Formatter<I, T, Q, S> {
export default function <
I,
T extends Hashable,
Q extends Question.Metadata,
S
>(): Formatter<I, T, Q, S> {
return function EARL(input, rules, outcomes) {
const subject = Serializable.toEARL(input);

Expand Down
Loading

0 comments on commit 7c24df0

Please sign in to comment.