Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BREAKING CHANGE: Move dist/module to lib. Export Flow types #21

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file removed dist/.gitignore
Empty file.
1 change: 0 additions & 1 deletion dist/cross-domain-utils.js.map

This file was deleted.

56 changes: 0 additions & 56 deletions dist/module/index.js.flow

This file was deleted.

5 changes: 0 additions & 5 deletions dist/module/util.js.flow

This file was deleted.

1 change: 0 additions & 1 deletion dist/test.htm

This file was deleted.

File renamed without changes.
14 changes: 14 additions & 0 deletions lib/constants.js.flow
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* @flow */

export const PROTOCOL = {
MOCK: ('mock:' : 'mock:'),
FILE: ('file:' : 'file:'),
ABOUT: ('about:' : 'about:')
};

export const WILDCARD = '*';

export const WINDOW_TYPE = {
IFRAME: ('iframe' : 'iframe'),
POPUP: ('popup' : 'popup')
};
File renamed without changes.
5 changes: 5 additions & 0 deletions lib/index.js.flow
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/* @flow */

export * from './utils';
export * from './types';
export * from './constants';
File renamed without changes.
40 changes: 40 additions & 0 deletions lib/types.js.flow
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/* @flow */

// export something to force webpack to see this as an ES module
export const TYPES = true;

export type CrossDomainLocationType = {|

|};

export type CrossDomainWindowType = {|
location : string | CrossDomainLocationType,
self : CrossDomainWindowType,
closed : boolean,
open : (string, string, string) => CrossDomainWindowType,
close : () => void,
focus : () => void,
top : CrossDomainWindowType,
frames : $ReadOnlyArray<CrossDomainWindowType>,
opener ? : CrossDomainWindowType,
parent : CrossDomainWindowType,
length : number,
postMessage : (string, string) => void
|};

export type SameDomainWindowType = Object & {|
location : string | Object,
self : CrossDomainWindowType,
closed : boolean,
open : (string, string, string) => CrossDomainWindowType,
close : () => void,
focus : () => void,
XMLHttpRequest : typeof XMLHttpRequest,
document : Document,
navigator : {|
userAgent : string,
mockUserAgent? : string
|}
|};

export type DomainMatcher = string | $ReadOnlyArray<string> | $ReadOnlyArray<string> | RegExp;
File renamed without changes.
11 changes: 11 additions & 0 deletions lib/util.js.flow
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* @flow */

export function isRegex(item : mixed) : boolean {
// $FlowFixMe method-unbinding
return Object.prototype.toString.call(item) === '[object RegExp]';
}

// eslint-disable-next-line no-unused-vars
export function noop(...args : $ReadOnlyArray<mixed>) {
// pass
}
File renamed without changes.
Loading