Skip to content

Commit

Permalink
refactor: extract referrerpolicy
Browse files Browse the repository at this point in the history
  • Loading branch information
harlan-zw committed Dec 4, 2022
1 parent 8a0ace7 commit f275ab6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 18 deletions.
11 changes: 2 additions & 9 deletions packages/schema/src/link.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { MaybePromiseProps } from '@zhead/schema/src/utils'
import type { ReferrerPolicy } from '@zhead/schema/src/shared'
import type { HttpEventAttributes } from './attributes'

export type LinkRelTypes = 'alternate' |
Expand Down Expand Up @@ -141,15 +142,7 @@ export interface LinkBase {
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-referrerpolicy
*/
referrerpolicy?: '' |
'no-referrer' |
'no-referrer-when-downgrade' |
'origin' |
'origin-when-cross-origin' |
'same-origin' |
'strict-origin' |
'strict-origin-when-cross-origin' |
'unsafe-url'
referrerpolicy?: ReferrerPolicy
/**
* This attribute names a relationship of the linked document to the current document.
* The attribute must be a space-separated list of link type values.
Expand Down
11 changes: 2 additions & 9 deletions packages/schema/src/metaFlat.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { ReferrerPolicy } from '@zhead/schema/src/shared'
import type { Booleanable, MaybePromiseProps } from './utils'

export interface MetaFlat {
Expand Down Expand Up @@ -63,15 +64,7 @@ export interface MetaFlat {
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta/name#standard_metadata_names_defined_in_the_html_specification
*/
referrer: '' |
'no-referrer' |
'no-referrer-when-downgrade' |
'origin' |
'origin-when-cross-origin' |
'same-origin' |
'strict-origin' |
'strict-origin-when-cross-origin' |
'unsafe-url'
referrer: ReferrerPolicy
/**
* This tag tells the browser how to render a page on a mobile device.
* Presence of this tag indicates to Google that the page is mobile friendly.
Expand Down
9 changes: 9 additions & 0 deletions packages/schema/src/shared.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export type ReferrerPolicy = '' |
'no-referrer' |
'no-referrer-when-downgrade' |
'origin' |
'origin-when-cross-origin' |
'same-origin' |
'strict-origin' |
'strict-origin-when-cross-origin' |
'unsafe-url'

0 comments on commit f275ab6

Please sign in to comment.