ember-browser-services 3.0.5 → 4.0.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.
- package/CHANGELOG.md +11 -0
- package/README.md +6 -2
- package/addon-main.cjs +6 -0
- package/dist/_app_/services/browser/-proxy-service.js +1 -0
- package/dist/_app_/services/browser/document.js +1 -0
- package/dist/_app_/services/browser/local-storage.js +1 -0
- package/dist/_app_/services/browser/navigator.js +1 -0
- package/dist/_app_/services/browser/session-storage.js +1 -0
- package/dist/_app_/services/browser/window.js +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/{declarations/utils/proxy-service.d.ts → dist/services/browser/-proxy-service.d.ts} +3 -2
- package/{addon/utils/proxy-service.ts → dist/services/browser/-proxy-service.js} +20 -40
- package/dist/services/browser/-proxy-service.js.map +1 -0
- package/dist/services/browser/document.d.ts +7 -0
- package/dist/services/browser/document.js +7 -0
- package/dist/services/browser/document.js.map +1 -0
- package/{declarations → dist}/services/browser/local-storage.d.ts +1 -2
- package/{addon/services/browser/local-storage.ts → dist/services/browser/local-storage.js} +4 -9
- package/dist/services/browser/local-storage.js.map +1 -0
- package/dist/services/browser/navigator.d.ts +7 -0
- package/dist/services/browser/navigator.js +7 -0
- package/dist/services/browser/navigator.js.map +1 -0
- package/{declarations → dist}/services/browser/session-storage.d.ts +1 -2
- package/{addon/services/browser/session-storage.ts → dist/services/browser/session-storage.js} +4 -9
- package/dist/services/browser/session-storage.js.map +1 -0
- package/{declarations → dist}/services/browser/window.d.ts +1 -2
- package/dist/services/browser/window.js +16 -0
- package/dist/services/browser/window.js.map +1 -0
- package/{declarations → dist}/test-support/-private/web-storage.d.ts +4 -4
- package/{addon-test-support/-private/web-storage.ts → dist/test-support/-private/web-storage.js} +12 -9
- package/dist/test-support/-private/web-storage.js.map +1 -0
- package/dist/test-support/index.d.ts +13 -0
- package/{addon-test-support/index.ts → dist/test-support/index.js} +20 -40
- package/dist/test-support/index.js.map +1 -0
- package/dist/test-support/window-mock-augments.d.ts +2 -0
- package/{addon-test-support/window-mock-augments.ts → dist/test-support/window-mock-augments.js} +14 -15
- package/dist/test-support/window-mock-augments.js.map +1 -0
- package/dist/types.d.ts +17 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +89 -135
- package/LICENSE.md +0 -9
- package/addon/services/browser/document.ts +0 -21
- package/addon/services/browser/navigator.ts +0 -21
- package/addon/services/browser/window.ts +0 -27
- package/addon/tsconfig.json +0 -11
- package/addon/tsconfig.tsbuildinfo +0 -1
- package/addon/types.ts +0 -25
- package/addon-test-support/tsconfig.json +0 -16
- package/addon-test-support/tsconfig.tsbuildinfo +0 -1
- package/app/services/browser/document.js +0 -1
- package/app/services/browser/local-storage.js +0 -1
- package/app/services/browser/navigator.js +0 -1
- package/app/services/browser/session-storage.js +0 -1
- package/app/services/browser/window.js +0 -1
- package/config/build/tsconfig.compiler-options.ember.json +0 -14
- package/config/build/tsconfig.compiler-options.json +0 -54
- package/config/ember-try.js +0 -98
- package/config/environment.js +0 -5
- package/declarations/services/browser/document.d.ts +0 -16
- package/declarations/services/browser/navigator.d.ts +0 -16
- package/declarations/test-support/index.d.ts +0 -15
- package/declarations/test-support/window-mock-augments.d.ts +0 -1
- package/declarations/types.d.ts +0 -16
- package/index.js +0 -14
package/CHANGELOG.md
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# [4.0.0](https://github.com/CrowdStrike/ember-browser-services/compare/v3.0.5...v4.0.0) (2022-06-07)
|
2
|
+
|
3
|
+
|
4
|
+
### chore
|
5
|
+
|
6
|
+
* run `npx ember-addon-migrator` ([74bc722](https://github.com/CrowdStrike/ember-browser-services/commit/74bc722aca8fa0787b01b55be7bad58b9b873b9c))
|
7
|
+
|
8
|
+
|
9
|
+
### BREAKING CHANGES
|
10
|
+
|
11
|
+
* this addon now requires ember-auto-import@v2
|
package/README.md
CHANGED
@@ -15,6 +15,8 @@ looking at the documentation.
|
|
15
15
|
|
16
16
|
## Installation
|
17
17
|
|
18
|
+
pnpm add ember-browser-services
|
19
|
+
# or
|
18
20
|
yarn add ember-browser-services
|
19
21
|
# or
|
20
22
|
npm install ember-browser-services
|
@@ -23,8 +25,10 @@ looking at the documentation.
|
|
23
25
|
|
24
26
|
## Compatibility
|
25
27
|
|
26
|
-
*
|
27
|
-
*
|
28
|
+
* Ember.js v3.12 or above
|
29
|
+
* ember-auto-import v2 or above
|
30
|
+
* typescript v4.5 or above
|
31
|
+
* embroider max-compat and strict modes
|
28
32
|
|
29
33
|
## Usage
|
30
34
|
|
package/addon-main.cjs
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from "ember-browser-services/services/browser/-proxy-service.js";
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from "ember-browser-services/services/browser/document.js";
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from "ember-browser-services/services/browser/local-storage.js";
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from "ember-browser-services/services/browser/navigator.js";
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from "ember-browser-services/services/browser/session-storage.js";
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from "ember-browser-services/services/browser/window.js";
|
package/dist/index.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,gGAMN,gBAAgB"}
|
package/dist/index.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import Service from '@ember/service';
|
2
|
-
import
|
2
|
+
import { Class } from "../../types";
|
3
3
|
/**
|
4
4
|
* Allows Services to behave as Proxy objects for real objects, such as
|
5
5
|
* window, document, navigator, Worker, etc.
|
@@ -13,4 +13,5 @@ import type { Class } from 'ember-browser-services/types';
|
|
13
13
|
*
|
14
14
|
* @param {Object | Class} browserObject - the api to wrap a service around.
|
15
15
|
*/
|
16
|
-
|
16
|
+
declare function proxyService<BrowserAPI>(ObjectToProxy: BrowserAPI | Class<BrowserAPI>): typeof Service & BrowserAPI;
|
17
|
+
export { proxyService };
|
@@ -1,7 +1,5 @@
|
|
1
1
|
import Service from '@ember/service';
|
2
2
|
|
3
|
-
import type { Class } from 'ember-browser-services/types';
|
4
|
-
|
5
3
|
/**
|
6
4
|
* Allows Services to behave as Proxy objects for real objects, such as
|
7
5
|
* window, document, navigator, Worker, etc.
|
@@ -15,19 +13,15 @@ import type { Class } from 'ember-browser-services/types';
|
|
15
13
|
*
|
16
14
|
* @param {Object | Class} browserObject - the api to wrap a service around.
|
17
15
|
*/
|
18
|
-
export function proxyService<BrowserAPI>(
|
19
|
-
ObjectToProxy: BrowserAPI | Class<BrowserAPI>
|
20
|
-
): typeof Service & BrowserAPI {
|
21
|
-
type ProxyKey = BrowserAPI | Service;
|
22
|
-
type CreateMethod = typeof Service['create'];
|
23
16
|
|
17
|
+
function proxyService(ObjectToProxy) {
|
24
18
|
// extending the types for the static method create is too hard / impossible
|
25
19
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
26
|
-
let UnTypedService = Service
|
20
|
+
let UnTypedService = Service;
|
27
21
|
|
28
|
-
function instanceHandlerFor(browserObject
|
22
|
+
function instanceHandlerFor(browserObject) {
|
29
23
|
return {
|
30
|
-
get
|
24
|
+
get(targetInstance, prop, receiver) {
|
31
25
|
if (prop in targetInstance) {
|
32
26
|
return Reflect.get(targetInstance, prop, receiver);
|
33
27
|
}
|
@@ -43,63 +37,49 @@ export function proxyService<BrowserAPI>(
|
|
43
37
|
|
44
38
|
return value;
|
45
39
|
},
|
46
|
-
|
47
|
-
|
48
|
-
prop: K,
|
49
|
-
value: BrowserAPI[K],
|
50
|
-
receiver: unknown
|
51
|
-
) {
|
40
|
+
|
41
|
+
set(targetInstance, prop, value, receiver) {
|
52
42
|
if (prop in targetInstance) {
|
53
43
|
Reflect.set(targetInstance, prop, value, receiver);
|
54
44
|
}
|
55
45
|
|
56
46
|
browserObject[prop] = value;
|
57
|
-
|
58
47
|
return true;
|
59
|
-
}
|
48
|
+
}
|
49
|
+
|
60
50
|
};
|
61
51
|
}
|
62
52
|
|
63
|
-
function isConstructable(proxyTo
|
53
|
+
function isConstructable(proxyTo) {
|
64
54
|
return typeof proxyTo === 'function';
|
65
|
-
}
|
66
|
-
|
67
|
-
// We have to untype the Service, because...
|
55
|
+
} // We have to untype the Service, because...
|
68
56
|
// this is nuts:
|
69
57
|
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/da0e5b5/types/ember__object/core.d.ts#L82-L94
|
70
58
|
//
|
71
59
|
// it's also all private, and the ember-TS team apparently didn't think people would want to do this :D
|
60
|
+
|
61
|
+
|
72
62
|
class ProxyCreator extends UnTypedService {
|
73
63
|
// https://github.com/emberjs/ember.js/blob/master/packages/%40ember/service/index.js#L66-L74
|
74
64
|
// https://github.com/emberjs/ember.js/blob/f85cefe9855b2521b02800d4bb2b68da7db2a214/packages/%40ember/service/index.js#L68-L72
|
75
65
|
static isServiceFactory = true;
|
76
66
|
|
77
|
-
static create(injections
|
78
|
-
let serviceInstance = class ProxiedService extends Service {
|
79
|
-
// @private
|
80
|
-
declare __browser_object__: BrowserAPI;
|
81
|
-
/*
|
82
|
-
* We cannot create the base Service, we must use a new one.
|
83
|
-
* If we don't, we are unable to run tests in a legacy qunit environment
|
84
|
-
* due to "writableChains" issues.
|
85
|
-
*
|
86
|
-
* https://github.com/emberjs/ember.js/pull/15347/files#diff-7e13eecefe753df1d82ce67b32bc4366R361
|
87
|
-
*
|
88
|
-
* */
|
89
|
-
}.create(injections);
|
90
|
-
|
67
|
+
static create(injections) {
|
68
|
+
let serviceInstance = class ProxiedService extends Service {}.create(injections);
|
91
69
|
let browserObject = isConstructable(ObjectToProxy) ? new ObjectToProxy() : ObjectToProxy;
|
92
|
-
|
93
70
|
serviceInstance.__browser_object__ = browserObject;
|
94
|
-
|
95
71
|
return new Proxy(serviceInstance, instanceHandlerFor(browserObject));
|
96
72
|
}
|
97
73
|
|
98
|
-
constructor(...args
|
74
|
+
constructor(...args) {
|
99
75
|
super(...args);
|
100
76
|
throw new Error('ProxyCreator is not new-able');
|
101
77
|
}
|
78
|
+
|
102
79
|
}
|
103
80
|
|
104
|
-
return ProxyCreator
|
81
|
+
return ProxyCreator;
|
105
82
|
}
|
83
|
+
|
84
|
+
export { proxyService };
|
85
|
+
//# sourceMappingURL=-proxy-service.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"-proxy-service.js","sources":["../../../src/services/browser/-proxy-service.ts"],"sourcesContent":["import Service from '@ember/service';\n\nimport type { Class } from '../../types';\n\n/**\n * Allows Services to behave as Proxy objects for real objects, such as\n * window, document, navigator, Worker, etc.\n *\n * useful for consistently accessing unmockable objects and then replacing them\n * with fakes in testing.\n *\n * would it be worth recursively wrapping in a proxy for any reason?\n *\n * NOTE: This only works for one layer deep of properties\n *\n * @param {Object | Class} browserObject - the api to wrap a service around.\n */\nexport function proxyService<BrowserAPI>(\n ObjectToProxy: BrowserAPI | Class<BrowserAPI>\n): typeof Service & BrowserAPI {\n type ProxyKey = BrowserAPI | Service;\n type CreateMethod = typeof Service['create'];\n\n // extending the types for the static method create is too hard / impossible\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let UnTypedService = Service as any;\n\n function instanceHandlerFor(browserObject: BrowserAPI) {\n return {\n get<K extends keyof ProxyKey>(targetInstance: Service, prop: K, receiver: unknown) {\n if (prop in targetInstance) {\n return Reflect.get(targetInstance, prop, receiver);\n }\n\n let value = browserObject[prop];\n\n if (typeof value === 'function') {\n // prevents the error \"Illegal Invocation\"\n // which can sometimes happen due to losing the \"this\" depending on\n // the invocation context at the call site\n return value.bind(browserObject);\n }\n\n return value;\n },\n set<K extends keyof ProxyKey>(\n targetInstance: Service,\n prop: K,\n value: BrowserAPI[K],\n receiver: unknown\n ) {\n if (prop in targetInstance) {\n Reflect.set(targetInstance, prop, value, receiver);\n }\n\n browserObject[prop] = value;\n\n return true;\n },\n };\n }\n\n function isConstructable(proxyTo: BrowserAPI | Class<BrowserAPI>): proxyTo is Class<BrowserAPI> {\n return typeof proxyTo === 'function';\n }\n\n // We have to untype the Service, because...\n // this is nuts:\n // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/da0e5b5/types/ember__object/core.d.ts#L82-L94\n //\n // it's also all private, and the ember-TS team apparently didn't think people would want to do this :D\n class ProxyCreator extends UnTypedService {\n // https://github.com/emberjs/ember.js/blob/master/packages/%40ember/service/index.js#L66-L74\n // https://github.com/emberjs/ember.js/blob/f85cefe9855b2521b02800d4bb2b68da7db2a214/packages/%40ember/service/index.js#L68-L72\n static isServiceFactory = true;\n\n static create(injections: Parameters<CreateMethod>): ReturnType<CreateMethod> {\n let serviceInstance = class ProxiedService extends Service {\n // @private\n declare __browser_object__: BrowserAPI;\n /*\n * We cannot create the base Service, we must use a new one.\n * If we don't, we are unable to run tests in a legacy qunit environment\n * due to \"writableChains\" issues.\n *\n * https://github.com/emberjs/ember.js/pull/15347/files#diff-7e13eecefe753df1d82ce67b32bc4366R361\n *\n * */\n }.create(injections);\n\n let browserObject = isConstructable(ObjectToProxy) ? new ObjectToProxy() : ObjectToProxy;\n\n serviceInstance.__browser_object__ = browserObject;\n\n return new Proxy(serviceInstance, instanceHandlerFor(browserObject));\n }\n\n constructor(...args: unknown[]) {\n super(...args);\n throw new Error('ProxyCreator is not new-able');\n }\n }\n\n return ProxyCreator as unknown as typeof Service & BrowserAPI;\n}\n"],"names":["proxyService","ObjectToProxy","UnTypedService","Service","instanceHandlerFor","browserObject","get","targetInstance","prop","receiver","Reflect","value","bind","set","isConstructable","proxyTo","ProxyCreator","isServiceFactory","create","injections","serviceInstance","ProxiedService","__browser_object__","Proxy","constructor","args","Error"],"mappings":";;AAIA;;;;;;;;;;;;;;AAaM,SAAUA,Y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MC,cAAN,SAA6BlB,OAA7B,CAAoC,EAApC,CAWpBe,MAXoB,CAWbC,UAXa,CAAtB,CAAA;MAaA,IAAId,aAAa,GAAGS,eAAe,CAACb,aAAD,CAAf,GAAiC,IAAIA,aAAJ,EAAjC,GAAuDA,aAA3E,CAAA;MAEAmB,eAAe,CAACE,kBAAhB,GAAqCjB,aAArC,CAAA;MAEA,OAAO,IAAIkB,KAAJ,CAAUH,eAAV,EAA2BhB,kBAAkB,CAACC,aAAD,CAA7C,CAAP,CAAA;AACD,KAAA;;IAEDmB,WAAY,CAAA,GAAGC,IAAf,EAA8B;AAC5B,MAAA,KAAA,CAAM,GAAGA,IAAT,CAAA,CAAA;AACA,MAAA,MAAM,IAAIC,KAAJ,CAAU,8BAAV,CAAN,CAAA;AACD,KAAA;;AA7BsC,GAAA;;AAgCzC,EAAA,OAAOV,YAAP,CAAA;AACD;;;;"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"document.js","sources":["../../../src/services/browser/document.ts"],"sourcesContent":["import '@ember/service';\n\nimport { proxyService } from './-proxy-service';\n\nconst DocumentProxyService = proxyService(document);\n\n/**\n * In order to have thorough testing, we should only interact with the document\n * (and other browser APIs) via a service.\n *\n * We can control, mock, and override the services, but we can't do so with\n * the browser APIs.\n *\n */\nexport default DocumentProxyService;\n\ndeclare module '@ember/service' {\n interface Registry {\n 'browser/document': typeof DocumentProxyService;\n }\n}\n"],"names":["DocumentProxyService","proxyService","document"],"mappings":";;;AAIA,MAAMA,oBAAoB,GAAGC,YAAY,CAACC,QAAD;;;;"}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import '@ember/service';
|
2
1
|
/**
|
3
2
|
* In order to have thorough testing, we should only interact with the local storage
|
4
3
|
* (and other browser APIs) via a service.
|
@@ -8,9 +7,9 @@ import '@ember/service';
|
|
8
7
|
*
|
9
8
|
*/
|
10
9
|
declare const LocalStorageProxyService: typeof import("@ember/service").default & Storage;
|
11
|
-
export default LocalStorageProxyService;
|
12
10
|
declare module '@ember/service' {
|
13
11
|
interface Registry {
|
14
12
|
'browser/local-storage': typeof LocalStorageProxyService;
|
15
13
|
}
|
16
14
|
}
|
15
|
+
export { LocalStorageProxyService as default };
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import '@ember/service';
|
2
|
-
|
3
|
-
import { proxyService } from 'ember-browser-services/utils/proxy-service';
|
2
|
+
import { proxyService } from './-proxy-service.js';
|
4
3
|
|
5
4
|
/**
|
6
5
|
* In order to have thorough testing, we should only interact with the local storage
|
@@ -10,12 +9,8 @@ import { proxyService } from 'ember-browser-services/utils/proxy-service';
|
|
10
9
|
* the browser APIs.
|
11
10
|
*
|
12
11
|
*/
|
13
|
-
const LocalStorageProxyService = proxyService(localStorage);
|
14
12
|
|
15
|
-
|
13
|
+
const LocalStorageProxyService = proxyService(localStorage);
|
16
14
|
|
17
|
-
|
18
|
-
|
19
|
-
'browser/local-storage': typeof LocalStorageProxyService;
|
20
|
-
}
|
21
|
-
}
|
15
|
+
export { LocalStorageProxyService as default };
|
16
|
+
//# sourceMappingURL=local-storage.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"local-storage.js","sources":["../../../src/services/browser/local-storage.ts"],"sourcesContent":["import '@ember/service';\n\nimport { proxyService } from './-proxy-service';\n\n/**\n * In order to have thorough testing, we should only interact with the local storage\n * (and other browser APIs) via a service.\n *\n * We can control, mock, and override the services, but we can't do so with\n * the browser APIs.\n *\n */\nconst LocalStorageProxyService = proxyService(localStorage);\n\nexport default LocalStorageProxyService;\n\ndeclare module '@ember/service' {\n interface Registry {\n 'browser/local-storage': typeof LocalStorageProxyService;\n }\n}\n"],"names":["LocalStorageProxyService","proxyService","localStorage"],"mappings":";;;AAIA;;;;;;;;;AAQA,MAAMA,wBAAwB,GAAGC,YAAY,CAACC,YAAD;;;;"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"navigator.js","sources":["../../../src/services/browser/navigator.ts"],"sourcesContent":["import '@ember/service';\n\nimport { proxyService } from './-proxy-service';\n\nconst NavigatorProxyService = proxyService(navigator);\n\n/**\n * In order to have thorough testing, we should only interact with the navigator\n * (and other browser APIs) via a service.\n *\n * We can control, mock, and override the services, but we can't do so with\n * the browser APIs.\n *\n */\nexport default NavigatorProxyService;\n\ndeclare module '@ember/service' {\n interface Registry {\n 'browser/navigator': typeof NavigatorProxyService;\n }\n}\n"],"names":["NavigatorProxyService","proxyService","navigator"],"mappings":";;;AAIA,MAAMA,qBAAqB,GAAGC,YAAY,CAACC,SAAD;;;;"}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import '@ember/service';
|
2
1
|
/**
|
3
2
|
* In order to have thorough testing, we should only interact with the session storage
|
4
3
|
* (and other browser APIs) via a service.
|
@@ -8,9 +7,9 @@ import '@ember/service';
|
|
8
7
|
*
|
9
8
|
*/
|
10
9
|
declare const SessionStorageProxyService: typeof import("@ember/service").default & Storage;
|
11
|
-
export default SessionStorageProxyService;
|
12
10
|
declare module '@ember/service' {
|
13
11
|
interface Registry {
|
14
12
|
'browser/session-storage': typeof SessionStorageProxyService;
|
15
13
|
}
|
16
14
|
}
|
15
|
+
export { SessionStorageProxyService as default };
|
package/{addon/services/browser/session-storage.ts → dist/services/browser/session-storage.js}
RENAMED
@@ -1,6 +1,5 @@
|
|
1
1
|
import '@ember/service';
|
2
|
-
|
3
|
-
import { proxyService } from 'ember-browser-services/utils/proxy-service';
|
2
|
+
import { proxyService } from './-proxy-service.js';
|
4
3
|
|
5
4
|
/**
|
6
5
|
* In order to have thorough testing, we should only interact with the session storage
|
@@ -10,12 +9,8 @@ import { proxyService } from 'ember-browser-services/utils/proxy-service';
|
|
10
9
|
* the browser APIs.
|
11
10
|
*
|
12
11
|
*/
|
13
|
-
const SessionStorageProxyService = proxyService(sessionStorage);
|
14
12
|
|
15
|
-
|
13
|
+
const SessionStorageProxyService = proxyService(sessionStorage);
|
16
14
|
|
17
|
-
|
18
|
-
|
19
|
-
'browser/session-storage': typeof SessionStorageProxyService;
|
20
|
-
}
|
21
|
-
}
|
15
|
+
export { SessionStorageProxyService as default };
|
16
|
+
//# sourceMappingURL=session-storage.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"session-storage.js","sources":["../../../src/services/browser/session-storage.ts"],"sourcesContent":["import '@ember/service';\n\nimport { proxyService } from './-proxy-service';\n\n/**\n * In order to have thorough testing, we should only interact with the session storage\n * (and other browser APIs) via a service.\n *\n * We can control, mock, and override the services, but we can't do so with\n * the browser APIs.\n *\n */\nconst SessionStorageProxyService = proxyService(sessionStorage);\n\nexport default SessionStorageProxyService;\n\ndeclare module '@ember/service' {\n interface Registry {\n 'browser/session-storage': typeof SessionStorageProxyService;\n }\n}\n"],"names":["SessionStorageProxyService","proxyService","sessionStorage"],"mappings":";;;AAIA;;;;;;;;;AAQA,MAAMA,0BAA0B,GAAGC,YAAY,CAACC,cAAD;;;;"}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import '@ember/service';
|
2
1
|
/**
|
3
2
|
* In order to have thorough testing, we should only interact with the window
|
4
3
|
* (and other browser APIs) via a service.
|
@@ -8,7 +7,6 @@ import '@ember/service';
|
|
8
7
|
*
|
9
8
|
*/
|
10
9
|
declare const WindowProxyService: typeof import("@ember/service").default & Window & typeof globalThis;
|
11
|
-
export default WindowProxyService;
|
12
10
|
declare global {
|
13
11
|
interface Window {
|
14
12
|
requirejs: (path: string) => {
|
@@ -21,3 +19,4 @@ declare module '@ember/service' {
|
|
21
19
|
'browser/window': typeof WindowProxyService;
|
22
20
|
}
|
23
21
|
}
|
22
|
+
export { WindowProxyService as default };
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import '@ember/service';
|
2
|
+
import { proxyService } from './-proxy-service.js';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* In order to have thorough testing, we should only interact with the window
|
6
|
+
* (and other browser APIs) via a service.
|
7
|
+
*
|
8
|
+
* We can control, mock, and override the services, but we can't do so with
|
9
|
+
* the browser APIs.
|
10
|
+
*
|
11
|
+
*/
|
12
|
+
|
13
|
+
const WindowProxyService = proxyService(window);
|
14
|
+
|
15
|
+
export { WindowProxyService as default };
|
16
|
+
//# sourceMappingURL=window.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"window.js","sources":["../../../src/services/browser/window.ts"],"sourcesContent":["import '@ember/service';\n\nimport { proxyService } from './-proxy-service';\n\n/**\n * In order to have thorough testing, we should only interact with the window\n * (and other browser APIs) via a service.\n *\n * We can control, mock, and override the services, but we can't do so with\n * the browser APIs.\n *\n */\nconst WindowProxyService = proxyService(window);\n\nexport default WindowProxyService;\n\ndeclare global {\n interface Window {\n requirejs: (path: string) => { default: never };\n }\n}\n\ndeclare module '@ember/service' {\n interface Registry {\n 'browser/window': typeof WindowProxyService;\n }\n}\n"],"names":["WindowProxyService","proxyService","window"],"mappings":";;;AAIA;;;;;;;;;AAQA,MAAMA,kBAAkB,GAAGC,YAAY,CAACC,MAAD;;;;"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import Service from '@ember/service';
|
2
|
-
|
2
|
+
type FakeWebStorage = Record<string, string>;
|
3
3
|
/**
|
4
4
|
* Mimics the Web Storage API, as used by localStorage and sessionStorage.
|
5
5
|
*
|
@@ -11,8 +11,8 @@ declare class FakeWebStorageService extends Service {
|
|
11
11
|
removeItem(key: string): void;
|
12
12
|
clear(): void;
|
13
13
|
}
|
14
|
-
|
14
|
+
declare class FakeLocalStorageService extends FakeWebStorageService {
|
15
15
|
}
|
16
|
-
|
16
|
+
declare class FakeSessionStorageService extends FakeWebStorageService {
|
17
17
|
}
|
18
|
-
export {};
|
18
|
+
export { FakeLocalStorageService, FakeSessionStorageService };
|
package/{addon-test-support/-private/web-storage.ts → dist/test-support/-private/web-storage.js}
RENAMED
@@ -1,31 +1,34 @@
|
|
1
1
|
import Service from '@ember/service';
|
2
2
|
|
3
|
-
type FakeWebStorage = Record<string, string>;
|
4
|
-
|
5
3
|
/**
|
6
4
|
* Mimics the Web Storage API, as used by localStorage and sessionStorage.
|
7
5
|
*
|
8
6
|
*/
|
7
|
+
|
9
8
|
class FakeWebStorageService extends Service {
|
10
|
-
fakeWebStorage
|
9
|
+
fakeWebStorage = {};
|
11
10
|
|
12
|
-
setItem(key
|
11
|
+
setItem(key, value) {
|
13
12
|
// Everything in Web Storage is a string
|
14
13
|
this.fakeWebStorage[key] = `${value}`;
|
15
14
|
}
|
16
15
|
|
17
|
-
getItem(key
|
16
|
+
getItem(key) {
|
18
17
|
return this.fakeWebStorage[key] || null;
|
19
18
|
}
|
20
19
|
|
21
|
-
removeItem(key
|
20
|
+
removeItem(key) {
|
22
21
|
delete this.fakeWebStorage[key];
|
23
22
|
}
|
24
23
|
|
25
|
-
clear()
|
24
|
+
clear() {
|
26
25
|
this.fakeWebStorage = {};
|
27
26
|
}
|
27
|
+
|
28
28
|
}
|
29
29
|
|
30
|
-
|
31
|
-
|
30
|
+
class FakeLocalStorageService extends FakeWebStorageService {}
|
31
|
+
class FakeSessionStorageService extends FakeWebStorageService {}
|
32
|
+
|
33
|
+
export { FakeLocalStorageService, FakeSessionStorageService };
|
34
|
+
//# sourceMappingURL=web-storage.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"web-storage.js","sources":["../../../src/test-support/-private/web-storage.ts"],"sourcesContent":["import Service from '@ember/service';\n\ntype FakeWebStorage = Record<string, string>;\n\n/**\n * Mimics the Web Storage API, as used by localStorage and sessionStorage.\n *\n */\nclass FakeWebStorageService extends Service {\n fakeWebStorage: FakeWebStorage = {};\n\n setItem(key: string, value: string): void {\n // Everything in Web Storage is a string\n this.fakeWebStorage[key] = `${value}`;\n }\n\n getItem(key: string): string | null {\n return this.fakeWebStorage[key] || null;\n }\n\n removeItem(key: string): void {\n delete this.fakeWebStorage[key];\n }\n\n clear(): void {\n this.fakeWebStorage = {};\n }\n}\n\nexport class FakeLocalStorageService extends FakeWebStorageService {}\nexport class FakeSessionStorageService extends FakeWebStorageService {}\n"],"names":["FakeWebStorageService","Service","fakeWebStorage","setItem","key","value","getItem","removeItem","clear","FakeLocalStorageService","FakeSessionStorageService"],"mappings":";;AAIA;;;;;AAIA,MAAMA,qBAAN,SAAoCC,OAApC,CAA2C;AACzCC,EAAAA,cAAc,GAAmB,EAAnB,CAAA;;AAEdC,EAAAA,OAAO,CAACC,GAAD,EAAcC,KAAd,EAA2B;AAChC;AACA,IAAA,IAAA,CAAKH,cAAL,CAAoBE,GAApB,CAA2B,GAAA,CAAA,EAAGC,KAAK,CAAnC,CAAA,CAAA;AACD,GAAA;;EAEDC,OAAO,CAACF,GAAD,EAAY;AACjB,IAAA,OAAO,IAAKF,CAAAA,cAAL,CAAoBE,GAApB,KAA4B,IAAnC,CAAA;AACD,GAAA;;EAEDG,UAAU,CAACH,GAAD,EAAY;AACpB,IAAA,OAAO,IAAKF,CAAAA,cAAL,CAAoBE,GAApB,CAAP,CAAA;AACD,GAAA;;EAEDI,KAAK,GAAA;IACH,IAAKN,CAAAA,cAAL,GAAsB,EAAtB,CAAA;AACD,GAAA;;AAlBwC,CAAA;;AAqBrC,MAAOO,uBAAP,SAAuCT,qBAAvC,CAA4D,EAAA;AAC5D,MAAOU,yBAAP,SAAyCV,qBAAzC,CAA8D;;;;"}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import Service from '@ember/service';
|
2
|
+
import { RecursivePartial } from "../types";
|
3
|
+
type Fakes = {
|
4
|
+
window?: boolean | typeof Service | RecursivePartial<Window>;
|
5
|
+
localStorage?: boolean;
|
6
|
+
sessionStorage?: boolean;
|
7
|
+
document?: boolean | typeof Service | RecursivePartial<Document>;
|
8
|
+
navigator?: boolean | RecursivePartial<Navigator>;
|
9
|
+
};
|
10
|
+
declare function setupBrowserFakes(hooks: NestedHooks, options: Fakes): void;
|
11
|
+
type UnknownObject = Record<string, any>;
|
12
|
+
declare function maybeMake<DefaultType extends UnknownObject, TestClass extends UnknownObject>(maybeImplementation: true | typeof Service | TestClass | RecursivePartial<DefaultType>, target: DefaultType): DefaultType;
|
13
|
+
export { setupBrowserFakes, maybeMake };
|
@@ -1,66 +1,45 @@
|
|
1
1
|
import Service from '@ember/service';
|
2
|
-
|
3
|
-
import { proxyService } from 'ember-browser-services/utils/proxy-service';
|
4
2
|
import window from 'ember-window-mock';
|
5
3
|
import { setupWindowMock } from 'ember-window-mock/test-support';
|
4
|
+
import { proxyService } from '../services/browser/-proxy-service.js';
|
5
|
+
import { FakeLocalStorageService, FakeSessionStorageService } from './-private/web-storage.js';
|
6
|
+
import { patchWindow } from './window-mock-augments.js';
|
7
|
+
import 'ember-window-mock/test-support/-private/mock/location';
|
6
8
|
|
7
|
-
|
8
|
-
import { patchWindow } from './window-mock-augments';
|
9
|
-
|
10
|
-
import type { RecursivePartial } from 'ember-browser-services/types';
|
11
|
-
import type { TestContext } from 'ember-test-helpers';
|
12
|
-
|
13
|
-
type Fakes = {
|
14
|
-
window?: boolean | typeof Service | RecursivePartial<Window>;
|
15
|
-
localStorage?: boolean;
|
16
|
-
sessionStorage?: boolean;
|
17
|
-
document?: boolean | typeof Service | RecursivePartial<Document>;
|
18
|
-
navigator?: boolean | RecursivePartial<Navigator>;
|
19
|
-
};
|
20
|
-
|
21
|
-
export function setupBrowserFakes(hooks: NestedHooks, options: Fakes): void {
|
9
|
+
function setupBrowserFakes(hooks, options) {
|
22
10
|
setupWindowMock(hooks);
|
11
|
+
hooks.beforeEach(function () {
|
12
|
+
// the type for the owner keeps being wrong............
|
13
|
+
let owner = this.owner;
|
23
14
|
|
24
|
-
hooks.beforeEach(function (this: TestContext) {
|
25
15
|
if (options.window) {
|
26
16
|
// default, can still be overwritten
|
27
17
|
// see: https://github.com/kaliber5/ember-window-mock/issues/175
|
28
18
|
let patched = patchWindow(window);
|
29
19
|
let service = maybeMake(options.window, patched);
|
30
|
-
|
31
|
-
this.owner.register('service:browser/window', service);
|
20
|
+
owner.register('service:browser/window', service);
|
32
21
|
}
|
33
22
|
|
34
23
|
if (options.document) {
|
35
24
|
let service = maybeMake(options.document, window.document);
|
36
|
-
|
37
|
-
this.owner.register('service:browser/document', service);
|
25
|
+
owner.register('service:browser/document', service);
|
38
26
|
}
|
39
27
|
|
40
28
|
if (options.localStorage) {
|
41
|
-
|
29
|
+
owner.register('service:browser/local-storage', FakeLocalStorageService);
|
42
30
|
}
|
43
31
|
|
44
32
|
if (options.sessionStorage) {
|
45
|
-
|
33
|
+
owner.register('service:browser/session-storage', FakeSessionStorageService);
|
46
34
|
}
|
47
35
|
|
48
36
|
if (options.navigator) {
|
49
37
|
let service = maybeMake(options.navigator, window.navigator);
|
50
|
-
|
51
|
-
this.owner.register('service:browser/navigator', service);
|
38
|
+
owner.register('service:browser/navigator', service);
|
52
39
|
}
|
53
40
|
});
|
54
41
|
}
|
55
|
-
|
56
|
-
// this usage of any is correct, because it literally could be *any*thing
|
57
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
58
|
-
type UnknownObject = Record<string, any>;
|
59
|
-
|
60
|
-
export function maybeMake<DefaultType extends UnknownObject, TestClass extends UnknownObject>(
|
61
|
-
maybeImplementation: true | typeof Service | TestClass | RecursivePartial<DefaultType>,
|
62
|
-
target: DefaultType
|
63
|
-
): DefaultType {
|
42
|
+
function maybeMake(maybeImplementation, target) {
|
64
43
|
if (maybeImplementation === true) {
|
65
44
|
return proxyService(target);
|
66
45
|
}
|
@@ -71,21 +50,19 @@ export function maybeMake<DefaultType extends UnknownObject, TestClass extends U
|
|
71
50
|
|
72
51
|
if (typeof maybeImplementation === 'object') {
|
73
52
|
applyStub(target, maybeImplementation);
|
74
|
-
|
75
53
|
return proxyService(target);
|
76
54
|
}
|
77
55
|
|
78
56
|
return proxyService(target);
|
79
|
-
}
|
80
|
-
|
81
|
-
// we are already using ember-window-mock, so the proxy internal to that package will
|
57
|
+
} // we are already using ember-window-mock, so the proxy internal to that package will
|
82
58
|
// "just handle" setting stuff on the window
|
83
59
|
//
|
84
60
|
// NOTE:
|
85
61
|
// - Location implementation is incomplete:
|
86
62
|
// https://github.com/kaliber5/ember-window-mock/blob/2b8fbf581fc65e7f5455cd291497a3fdc2efdaf5/addon-test-support/-private/mock/location.js#L23
|
87
63
|
// - does not allow setting "origin"
|
88
|
-
|
64
|
+
|
65
|
+
function applyStub(root, partial) {
|
89
66
|
if (!partial) return root;
|
90
67
|
|
91
68
|
for (let key of Object.keys(partial)) {
|
@@ -100,3 +77,6 @@ function applyStub(root: any, partial?: any) {
|
|
100
77
|
}
|
101
78
|
}
|
102
79
|
}
|
80
|
+
|
81
|
+
export { maybeMake, setupBrowserFakes };
|
82
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/test-support/index.ts"],"sourcesContent":["import Service from '@ember/service';\n\nimport window from 'ember-window-mock';\nimport { setupWindowMock } from 'ember-window-mock/test-support';\n\nimport { proxyService } from '../services/browser/-proxy-service';\nimport { FakeLocalStorageService, FakeSessionStorageService } from './-private/web-storage';\nimport { patchWindow } from './window-mock-augments';\n\nimport type { RecursivePartial } from '../types';\nimport type { TestContext } from '@ember/test-helpers';\n\ntype Fakes = {\n window?: boolean | typeof Service | RecursivePartial<Window>;\n localStorage?: boolean;\n sessionStorage?: boolean;\n document?: boolean | typeof Service | RecursivePartial<Document>;\n navigator?: boolean | RecursivePartial<Navigator>;\n};\n\nexport function setupBrowserFakes(hooks: NestedHooks, options: Fakes): void {\n setupWindowMock(hooks);\n\n hooks.beforeEach(function (this: TestContext) {\n // the type for the owner keeps being wrong............\n let owner = this.owner as unknown as {\n register: (name: string, thing: unknown) => void;\n unregister: (name: string) => void;\n };\n\n if (options.window) {\n // default, can still be overwritten\n // see: https://github.com/kaliber5/ember-window-mock/issues/175\n let patched = patchWindow(window);\n let service = maybeMake(options.window, patched);\n\n owner.register('service:browser/window', service);\n }\n\n if (options.document) {\n let service = maybeMake(options.document, window.document);\n\n owner.register('service:browser/document', service);\n }\n\n if (options.localStorage) {\n owner.register('service:browser/local-storage', FakeLocalStorageService);\n }\n\n if (options.sessionStorage) {\n owner.register('service:browser/session-storage', FakeSessionStorageService);\n }\n\n if (options.navigator) {\n let service = maybeMake(options.navigator, window.navigator);\n\n owner.register('service:browser/navigator', service);\n }\n });\n}\n\n// this usage of any is correct, because it literally could be *any*thing\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype UnknownObject = Record<string, any>;\n\nexport function maybeMake<DefaultType extends UnknownObject, TestClass extends UnknownObject>(\n maybeImplementation: true | typeof Service | TestClass | RecursivePartial<DefaultType>,\n target: DefaultType\n): DefaultType {\n if (maybeImplementation === true) {\n return proxyService(target);\n }\n\n if (maybeImplementation.prototype instanceof Service) {\n return target;\n }\n\n if (typeof maybeImplementation === 'object') {\n applyStub(target, maybeImplementation);\n\n return proxyService(target);\n }\n\n return proxyService(target);\n}\n\n// we are already using ember-window-mock, so the proxy internal to that package will\n// \"just handle\" setting stuff on the window\n//\n// NOTE:\n// - Location implementation is incomplete:\n// https://github.com/kaliber5/ember-window-mock/blob/2b8fbf581fc65e7f5455cd291497a3fdc2efdaf5/addon-test-support/-private/mock/location.js#L23\n// - does not allow setting \"origin\"\nfunction applyStub(root: any, partial?: any) {\n if (!partial) return root;\n\n for (let key of Object.keys(partial)) {\n let value = partial[key];\n\n if (Array.isArray(value)) {\n root[key] = value;\n } else if (typeof value === 'object') {\n applyStub(root[key], value);\n } else {\n root[key] = value;\n }\n }\n}\n"],"names":["setupBrowserFakes","hooks","options","setupWindowMock","beforeEach","owner","window","patched","patchWindow","service","maybeMake","register","document","localStorage","FakeLocalStorageService","sessionStorage","FakeSessionStorageService","navigator","maybeImplementation","target","proxyService","prototype","Service","applyStub","root","partial","key","Object","keys","value","Array","isArray"],"mappings":";;;;;;;;AAoBM,SAAUA,iBAAV,CAA4BC,KAA5B,EAAgDC,OAAhD,EAA8D;EAClEC,eAAe,CAACF,KAAD,CAAf,CAAA;EAEAA,KAAK,CAACG,UAAN,CAAiB,YAAA;AACf;IACA,IAAIC,KAAK,GAAG,IAAA,CA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