From d77b5ae27c803ec1eadee1d35eb7885549fc287a Mon Sep 17 00:00:00 2001 From: falsandtru Date: Wed, 14 Feb 2024 07:00:33 +0900 Subject: [PATCH] Change `logger` to `log` option --- CHANGELOG.md | 1 + gh-pages/docs/apis/pjax/config/index.md | 4 ++-- index.d.ts | 2 +- src/layer/domain/data/config.ts | 2 +- .../domain/router/module/update/script.test.ts | 18 +++++++++--------- .../domain/router/module/update/script.ts | 8 ++++---- 6 files changed, 18 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 18911178..b9a5d0e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## 3.44.0 +- Change `logger` to `log` option. - Remove `cache` option. ## 3.43.0 diff --git a/gh-pages/docs/apis/pjax/config/index.md b/gh-pages/docs/apis/pjax/config/index.md index cf54db0a..7d7f0a5a 100644 --- a/gh-pages/docs/apis/pjax/config/index.md +++ b/gh-pages/docs/apis/pjax/config/index.md @@ -95,9 +95,9 @@ The next internal defaults are also applied. Reload targets of scripts. -### logger: string = `''` +### log: string = `''` -Logging targets of scripts. +Log targets of scripts. ## fallback: (target: HTMLAnchorElement | HTMLAreaElement | HTMLFormElement | Window, reason: unknown) => void = ... diff --git a/index.d.ts b/index.d.ts index 8d0b8ef5..fe61489e 100644 --- a/index.d.ts +++ b/index.d.ts @@ -33,7 +33,7 @@ export interface Config { readonly script?: boolean; readonly ignore?: string; readonly reload?: string; - readonly logger?: string; + readonly log?: string; }; readonly fallback?: (target: HTMLAnchorElement | HTMLAreaElement | HTMLFormElement | Window, reason: unknown) => void; readonly sequence?: Sequence; diff --git a/src/layer/domain/data/config.ts b/src/layer/domain/data/config.ts index 8b69cbca..2e3a8456 100644 --- a/src/layer/domain/data/config.ts +++ b/src/layer/domain/data/config.ts @@ -41,7 +41,7 @@ export class Config implements Options { security: '[src*=".scr.kaspersky-labs.com/"]', }, reload: '', - logger: '', + log: '', }; public fallback(target: HTMLAnchorElement | HTMLAreaElement | HTMLFormElement | Window, reason: unknown): void { if (target instanceof HTMLAnchorElement || diff --git a/src/layer/domain/router/module/update/script.test.ts b/src/layer/domain/router/module/update/script.test.ts index 97984496..fa6fc81e 100644 --- a/src/layer/domain/router/module/update/script.test.ts +++ b/src/layer/domain/router/module/update/script.test.ts @@ -18,7 +18,7 @@ describe('Unit: layer/domain/router/module/update/script', () => { { ignore: '', reload: '', - logger: '' + log: '' }, 1e3, new Cancellation(), @@ -50,7 +50,7 @@ describe('Unit: layer/domain/router/module/update/script', () => { { ignore: '', reload: '', - logger: 'head' + log: 'head' }, 1e3, new Cancellation(), @@ -92,7 +92,7 @@ describe('Unit: layer/domain/router/module/update/script', () => { { ignore: '', reload: '', - logger: 'head' + log: 'head' }, 1e3, new Cancellation()) @@ -120,7 +120,7 @@ describe('Unit: layer/domain/router/module/update/script', () => { { ignore: '', reload: '', - logger: 'head' + log: 'head' }, 1e3, new Cancellation(), @@ -154,7 +154,7 @@ describe('Unit: layer/domain/router/module/update/script', () => { { ignore: '', reload: '', - logger: 'head' + log: 'head' }, 1e3, new Cancellation(), @@ -188,7 +188,7 @@ describe('Unit: layer/domain/router/module/update/script', () => { { ignore: '', reload: '', - logger: 'head' + log: 'head' }, 1e3, cancellation, @@ -222,7 +222,7 @@ describe('Unit: layer/domain/router/module/update/script', () => { { ignore: '', reload: '', - logger: 'head' + log: 'head' }, 1e3, new Cancellation(), @@ -263,7 +263,7 @@ describe('Unit: layer/domain/router/module/update/script', () => { { ignore: '', reload: '', - logger: 'head' + log: 'head' }, 1e3, new Cancellation(), @@ -305,7 +305,7 @@ describe('Unit: layer/domain/router/module/update/script', () => { { ignore: '', reload: '', - logger: 'head' + log: 'head' }, 1e3, cancellation, diff --git a/src/layer/domain/router/module/update/script.ts b/src/layer/domain/router/module/update/script.ts index 99d333fd..f9807c47 100644 --- a/src/layer/domain/router/module/update/script.ts +++ b/src/layer/domain/router/module/update/script.ts @@ -20,7 +20,7 @@ export function script( selector: { ignore: string; reload: string; - logger: string; + log: string; }, timeout: number, cancellation: Cancellee, @@ -79,7 +79,7 @@ export function script( results .bind(cancellation.either) .bind(([sp, ap]) => - io.evaluate(script, code, selector.logger, skip, AtomicPromise.all(sp), cancellation) + io.evaluate(script, code, selector.log, skip, AtomicPromise.all(sp), cancellation) .extract( p => Right(tuple(push(sp, [p]), ap)), p => Right(tuple(sp, push(ap, [p]))))), @@ -123,7 +123,7 @@ export { fetch as _fetch } function evaluate( script: HTMLScriptElement, code: string, - logger: string, + log: string, skip: ReadonlySet>, wait: Promise, cancellation: Cancellee, @@ -134,7 +134,7 @@ function evaluate( script = script.ownerDocument === document ? script // only for testing : document.importNode(script.cloneNode(true), true) as HTMLScriptElement; - const logging = !!script.parentElement && script.parentElement.matches(logger.trim() || '_'); + const logging = !!script.parentElement && script.parentElement.matches(log.trim() || '_'); const container = document.querySelector( logging ? script.parentElement!.id