ember-browser-services 4.0.2 → 4.0.4
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 +79 -85
- package/LICENSE.md +9 -0
- package/dist/_app_/services/browser/document.js +1 -1
- package/dist/_app_/services/browser/local-storage.js +1 -1
- package/dist/_app_/services/browser/navigator.js +1 -1
- package/dist/_app_/services/browser/session-storage.js +1 -1
- package/dist/_app_/services/browser/window.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/services/browser/-proxy-service.d.ts +2 -2
- package/dist/services/browser/-proxy-service.js +3 -16
- package/dist/services/browser/-proxy-service.js.map +1 -1
- package/dist/services/browser/document.d.ts +1 -1
- package/dist/services/browser/document.js.map +1 -1
- package/dist/services/browser/local-storage.d.ts +1 -1
- package/dist/services/browser/local-storage.js +0 -1
- package/dist/services/browser/local-storage.js.map +1 -1
- package/dist/services/browser/navigator.d.ts +1 -1
- package/dist/services/browser/navigator.js.map +1 -1
- package/dist/services/browser/session-storage.d.ts +1 -1
- package/dist/services/browser/session-storage.js +0 -1
- package/dist/services/browser/session-storage.js.map +1 -1
- package/dist/services/browser/window.d.ts +1 -1
- package/dist/services/browser/window.js +0 -1
- package/dist/services/browser/window.js.map +1 -1
- package/dist/test-support/-private/web-storage.js +0 -7
- package/dist/test-support/-private/web-storage.js.map +1 -1
- package/dist/test-support/index.d.ts +1 -1
- package/dist/test-support/index.js +14 -13
- package/dist/test-support/index.js.map +1 -1
- package/dist/test-support/window-mock-augments.js +0 -9
- package/dist/test-support/window-mock-augments.js.map +1 -1
- package/dist/types.d.ts +5 -5
- package/package.json +38 -57
package/CHANGELOG.md
CHANGED
@@ -1,250 +1,244 @@
|
|
1
|
-
|
1
|
+
# ember-browser-services
|
2
|
+
|
3
|
+
## 4.0.4
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- [#364](https://github.com/CrowdStrike/ember-browser-services/pull/364) [`0be2928`](https://github.com/CrowdStrike/ember-browser-services/commit/0be2928a13936c06c628ce70f69516981e0d7679) Thanks [@NullVoxPopuli](https://github.com/NullVoxPopuli)! - Include the LICENSE.md in the npm package
|
8
|
+
|
9
|
+
- [#364](https://github.com/CrowdStrike/ember-browser-services/pull/364) [`398d517`](https://github.com/CrowdStrike/ember-browser-services/commit/398d517fc8b520f8b38837c8bac6d5a8e7e1eb57) Thanks [@NullVoxPopuli](https://github.com/NullVoxPopuli)! - Address an issue where the types of each of the browser services did not have sufficient overlap with `Service`.
|
10
|
+
|
11
|
+
This is required for folks using more modern TypeScript in ember apps,
|
12
|
+
where the service-name argument is passed to the `@service` decorator.
|
13
|
+
|
14
|
+
Previously, an error would occur:
|
2
15
|
|
16
|
+
```
|
17
|
+
../ember-browser-services/dist/services/browser/document.d.ts:4:9 - error TS2411: Property ''browser/document'' of type 'typeof Service & Document' is not assignable to 'string' index type 'Service'.
|
18
|
+
|
19
|
+
4 'browser/document': typeof DocumentProxyService;
|
20
|
+
~~~~~~~~~~~~~~~~~~
|
21
|
+
```
|
22
|
+
|
23
|
+
The expected type of Services in the Service Registry is `Service`, not `typeof Service`.
|
24
|
+
|
25
|
+
## [4.0.3](https://github.com/CrowdStrike/ember-browser-services/compare/v4.0.2...v4.0.3) (2022-06-08)
|
3
26
|
|
4
27
|
### Bug Fixes
|
5
28
|
|
6
|
-
|
29
|
+
- **deps:** widen range for @embroider/addon-shim ([4db62b7](https://github.com/CrowdStrike/ember-browser-services/commit/4db62b7e738cf862eec5a0eccc549849017cb93b))
|
7
30
|
|
8
|
-
## [4.0.
|
31
|
+
## [4.0.2](https://github.com/CrowdStrike/ember-browser-services/compare/v4.0.1...v4.0.2) (2022-06-08)
|
9
32
|
|
33
|
+
### Bug Fixes
|
34
|
+
|
35
|
+
- **package:** app-re-exports included non-public file ([f2c7ef1](https://github.com/CrowdStrike/ember-browser-services/commit/f2c7ef11c13d2364c79cc0996b2ea0a54b2f6a02))
|
36
|
+
|
37
|
+
## [4.0.1](https://github.com/CrowdStrike/ember-browser-services/compare/v4.0.0...v4.0.1) (2022-06-07)
|
10
38
|
|
11
39
|
### Bug Fixes
|
12
40
|
|
13
|
-
|
14
|
-
|
15
|
-
|
41
|
+
- **package:** addon-main specified incorrect path ([61e99ab](https://github.com/CrowdStrike/ember-browser-services/commit/61e99abb11c1c3cede8c9beb916d60f7650fbc0d))
|
42
|
+
- **package:** exports field did not specify test-support ([83a303f](https://github.com/CrowdStrike/ember-browser-services/commit/83a303f56f7ccfa2db92c4dc1cfbec982235ab3d))
|
43
|
+
- **package:** typesVersions was woefully incorrect ([3538f00](https://github.com/CrowdStrike/ember-browser-services/commit/3538f0072272604aa3cf460fb7ca47bd2233a9e7))
|
16
44
|
|
17
45
|
# [4.0.0](https://github.com/CrowdStrike/ember-browser-services/compare/v3.0.5...v4.0.0) (2022-06-07)
|
18
46
|
|
19
|
-
|
20
47
|
### chore
|
21
48
|
|
22
|
-
|
23
|
-
|
49
|
+
- run `npx ember-addon-migrator` ([74bc722](https://github.com/CrowdStrike/ember-browser-services/commit/74bc722aca8fa0787b01b55be7bad58b9b873b9c))
|
24
50
|
|
25
51
|
### BREAKING CHANGES
|
26
52
|
|
27
|
-
|
53
|
+
- this addon now requires ember-auto-import@v2
|
28
54
|
|
29
55
|
## [3.0.5](https://github.com/CrowdStrike/ember-browser-services/compare/v3.0.4...v3.0.5) (2022-05-16)
|
30
56
|
|
31
|
-
|
32
57
|
### Bug Fixes
|
33
58
|
|
34
|
-
|
59
|
+
- **package:** opt in to which files to include on npm, instead of the inverse ([f0d2dd9](https://github.com/CrowdStrike/ember-browser-services/commit/f0d2dd917e1453fdd3b146b5741d70aa033431fb))
|
35
60
|
|
36
61
|
## [3.0.4](https://github.com/CrowdStrike/ember-browser-services/compare/v3.0.3...v3.0.4) (2022-04-21)
|
37
62
|
|
38
|
-
|
39
63
|
### Bug Fixes
|
40
64
|
|
41
|
-
|
65
|
+
- **deps:** update dependency ember-cli-typescript to ^5.1.0 ([d2dd804](https://github.com/CrowdStrike/ember-browser-services/commit/d2dd8047b1850568a942fa6799838316974ab762))
|
42
66
|
|
43
67
|
## [3.0.3](https://github.com/CrowdStrike/ember-browser-services/compare/v3.0.2...v3.0.3) (2022-02-18)
|
44
68
|
|
45
|
-
|
46
69
|
### Bug Fixes
|
47
70
|
|
48
|
-
|
71
|
+
- **deps:** update dependency ember-window-mock to ^0.8.1 ([19d60dc](https://github.com/CrowdStrike/ember-browser-services/commit/19d60dc40c6bef507d93b1f1195888e3274cf1f3))
|
49
72
|
|
50
73
|
## [3.0.2](https://github.com/CrowdStrike/ember-browser-services/compare/v3.0.1...v3.0.2) (2022-02-04)
|
51
74
|
|
52
|
-
|
53
75
|
### Bug Fixes
|
54
76
|
|
55
|
-
|
77
|
+
- **deps:** update dependency ember-cli-typescript to v5 ([c02ec71](https://github.com/CrowdStrike/ember-browser-services/commit/c02ec71729073af33ee2b8242cf764806c21396f))
|
56
78
|
|
57
79
|
## [3.0.1](https://github.com/CrowdStrike/ember-browser-services/compare/v3.0.0...v3.0.1) (2022-01-31)
|
58
80
|
|
59
|
-
|
60
81
|
### Bug Fixes
|
61
82
|
|
62
|
-
|
83
|
+
- **deps:** update dependency ember-window-mock to ^0.8.0 ([a717bde](https://github.com/CrowdStrike/ember-browser-services/commit/a717bdeb01674ba69c649ed807b851281af58a90))
|
63
84
|
|
64
85
|
# [3.0.0](https://github.com/CrowdStrike/ember-browser-services/compare/v2.1.4...v3.0.0) (2022-01-20)
|
65
86
|
|
66
|
-
|
67
87
|
### Bug Fixes
|
68
88
|
|
69
|
-
|
70
|
-
|
89
|
+
- **deps:** update dependency ember-cli-babel to ^7.26.11 ([5381024](https://github.com/CrowdStrike/ember-browser-services/commit/538102488b54da3db067bd56df2447249b29d5bd))
|
71
90
|
|
72
91
|
### chore
|
73
92
|
|
74
|
-
|
75
|
-
|
76
|
-
|
93
|
+
- drop support for classic ember ([353195f](https://github.com/CrowdStrike/ember-browser-services/commit/353195f4baff841392ec9f730fbf94ba131d5bed))
|
94
|
+
- drop support for node 12 ([05d3a3b](https://github.com/CrowdStrike/ember-browser-services/commit/05d3a3b0760aabb749c4c4a6fcf501028c3eac5f))
|
77
95
|
|
78
96
|
### BREAKING CHANGES
|
79
97
|
|
80
|
-
|
81
|
-
and is all that is supported.
|
82
|
-
classic ember, but it will not be tested against (to help
|
83
|
-
simplify this addon's C.I. configuration)
|
84
|
-
|
98
|
+
- ember octane is two years old
|
99
|
+
and is all that is supported. This addon may still work with
|
100
|
+
classic ember, but it will not be tested against (to help
|
101
|
+
simplify this addon's C.I. configuration)
|
102
|
+
- node 12 is no longer supported
|
85
103
|
|
86
104
|
## [2.1.4](https://github.com/CrowdStrike/ember-browser-services/compare/v2.1.3...v2.1.4) (2021-12-17)
|
87
105
|
|
88
|
-
|
89
106
|
### Bug Fixes
|
90
107
|
|
91
|
-
|
108
|
+
- **deps:** update dependency ember-cli-babel to ^7.26.10 ([3c2f6d6](https://github.com/CrowdStrike/ember-browser-services/commit/3c2f6d6f94ccf9f46a4cdd55653d38ceeb7e3018))
|
92
109
|
|
93
110
|
## [2.1.3](https://github.com/CrowdStrike/ember-browser-services/compare/v2.1.2...v2.1.3) (2021-12-16)
|
94
111
|
|
95
|
-
|
96
112
|
### Bug Fixes
|
97
113
|
|
98
|
-
|
114
|
+
- **deps:** update dependency ember-cli-babel to ^7.26.8 ([82d4fe6](https://github.com/CrowdStrike/ember-browser-services/commit/82d4fe6e2b3d19a78f06b54dece915364435f822))
|
99
115
|
|
100
116
|
## [2.1.2](https://github.com/CrowdStrike/ember-browser-services/compare/v2.1.1...v2.1.2) (2021-12-15)
|
101
117
|
|
102
|
-
|
103
118
|
### Bug Fixes
|
104
119
|
|
105
|
-
|
120
|
+
- **deps:** update dependency ember-cli-babel to ^7.26.7 ([1ba87de](https://github.com/CrowdStrike/ember-browser-services/commit/1ba87def8c8153e19ced80b335dfb000e3972a76))
|
106
121
|
|
107
122
|
## [2.1.1](https://github.com/CrowdStrike/ember-browser-services/compare/v2.1.0...v2.1.1) (2021-12-06)
|
108
123
|
|
109
|
-
|
110
124
|
### Bug Fixes
|
111
125
|
|
112
|
-
|
126
|
+
- **deps:** update dependency ember-cli-htmlbars to ^6.0.1 ([ee02fa1](https://github.com/CrowdStrike/ember-browser-services/commit/ee02fa1d7b190ed51ccc69fb12f87b7ac1f6717f))
|
113
127
|
|
114
128
|
# [2.1.0](https://github.com/CrowdStrike/ember-browser-services/compare/v2.0.2...v2.1.0) (2021-11-23)
|
115
129
|
|
116
|
-
|
117
130
|
### Features
|
118
131
|
|
119
|
-
|
132
|
+
- support session-storage ([ffaf626](https://github.com/CrowdStrike/ember-browser-services/commit/ffaf6263080546c2dab2f5c62db40166dfc6f3a1))
|
120
133
|
|
121
134
|
## [2.0.2](https://github.com/CrowdStrike/ember-browser-services/compare/v2.0.1...v2.0.2) (2021-11-18)
|
122
135
|
|
123
|
-
|
124
136
|
### Bug Fixes
|
125
137
|
|
126
|
-
|
138
|
+
- **deps:** update dependency ember-cli-htmlbars to v6 ([a3115e3](https://github.com/CrowdStrike/ember-browser-services/commit/a3115e396af97177ce4b3824718ea18648ee0c60))
|
127
139
|
|
128
140
|
## [2.0.1](https://github.com/CrowdStrike/ember-browser-services/compare/v2.0.0...v2.0.1) (2021-11-18)
|
129
141
|
|
130
|
-
|
131
142
|
### Bug Fixes
|
132
143
|
|
133
|
-
|
144
|
+
- **support:** expand and fix support ([dcd8dd6](https://github.com/CrowdStrike/ember-browser-services/commit/dcd8dd68b2c0170456e82e999513bea6beecbafa))
|
134
145
|
|
135
146
|
# [2.0.0](https://github.com/CrowdStrike/ember-browser-services/compare/v1.1.8...v2.0.0) (2021-09-09)
|
136
147
|
|
137
|
-
|
138
148
|
### Features
|
139
149
|
|
140
|
-
|
141
|
-
|
150
|
+
- utilize ember-window-mock for the underlying provider ([659f20f](https://github.com/CrowdStrike/ember-browser-services/commit/659f20f702873c942d6476301730107c71a566c4))
|
142
151
|
|
143
152
|
### BREAKING CHANGES
|
144
153
|
|
145
|
-
|
154
|
+
- invalid hrefs will throw an error
|
146
155
|
|
147
156
|
## [1.1.8](https://github.com/CrowdStrike/ember-browser-services/compare/v1.1.7...v1.1.8) (2021-08-31)
|
148
157
|
|
149
|
-
|
150
158
|
### Bug Fixes
|
151
159
|
|
152
|
-
|
160
|
+
- **npm:** remove unneeded files from npm package ([ee0914c](https://github.com/CrowdStrike/ember-browser-services/commit/ee0914cc9e35db88dbd42ba1f0abdc73faa8c733))
|
153
161
|
|
154
162
|
## [1.1.7](https://github.com/CrowdStrike/ember-browser-services/compare/v1.1.6...v1.1.7) (2021-08-31)
|
155
163
|
|
156
|
-
|
157
164
|
### Bug Fixes
|
158
165
|
|
159
|
-
|
160
|
-
|
166
|
+
- **deps:** update dependency ember-cli-babel to ^7.26.6 ([37cf27f](https://github.com/CrowdStrike/ember-browser-services/commit/37cf27ffb7322152d6c3c347f8ac7e41e6416ce9))
|
167
|
+
- **deps:** update dependency ember-cli-typescript to ^4.2.1 ([ab1ab86](https://github.com/CrowdStrike/ember-browser-services/commit/ab1ab869df805acaea7045d5af2cd925fc1a55c7))
|
161
168
|
|
162
169
|
## [1.1.6](https://github.com/CrowdStrike/ember-browser-services/compare/v1.1.5...v1.1.6) (2021-04-17)
|
163
170
|
|
164
|
-
|
165
171
|
### Bug Fixes
|
166
172
|
|
167
|
-
|
173
|
+
- **navigator:** add app re-export ([7a9db4d](https://github.com/CrowdStrike/ember-browser-services/commit/7a9db4dc9afa62f5b3a20754747897f53aadf746))
|
168
174
|
|
169
175
|
## [1.1.5](https://github.com/CrowdStrike/ember-browser-services/compare/v1.1.4...v1.1.5) (2021-04-17)
|
170
176
|
|
171
|
-
|
172
177
|
### Bug Fixes
|
173
178
|
|
174
|
-
|
179
|
+
- **deps:** update dependency ember-cli-htmlbars to ^5.7.1 ([f4062bf](https://github.com/CrowdStrike/ember-browser-services/commit/f4062bfc2b417ef524c2ce28ba82d81cbbdb6e83))
|
175
180
|
|
176
181
|
## [1.1.4](https://github.com/CrowdStrike/ember-browser-services/compare/v1.1.3...v1.1.4) (2021-03-15)
|
177
182
|
|
178
|
-
|
179
183
|
### Bug Fixes
|
180
184
|
|
181
|
-
|
185
|
+
- **deps:** update dependency ember-cli-htmlbars to ^5.6.5 ([f60cc89](https://github.com/CrowdStrike/ember-browser-services/commit/f60cc89ad048429ae0a58890030a9b488b096d49))
|
182
186
|
|
183
187
|
## [1.1.3](https://github.com/CrowdStrike/ember-browser-services/compare/v1.1.2...v1.1.3) (2021-03-09)
|
184
188
|
|
185
|
-
|
186
189
|
### Bug Fixes
|
187
190
|
|
188
|
-
|
191
|
+
- **deps:** update dependency ember-cli-htmlbars to ^5.6.4 ([35d3b07](https://github.com/CrowdStrike/ember-browser-services/commit/35d3b07a99e4dc69889d29d87f25816be0bb3570))
|
189
192
|
|
190
193
|
## [1.1.2](https://github.com/CrowdStrike/ember-browser-services/compare/v1.1.1...v1.1.2) (2021-02-27)
|
191
194
|
|
192
|
-
|
193
195
|
### Bug Fixes
|
194
196
|
|
195
|
-
|
197
|
+
- **deps:** update dependency ember-cli-htmlbars to ^5.6.2 ([60820b8](https://github.com/CrowdStrike/ember-browser-services/commit/60820b8c5e9ce2d07b24565518b322d3e89088eb))
|
196
198
|
|
197
199
|
## [1.1.1](https://github.com/CrowdStrike/ember-browser-services/compare/v1.1.0...v1.1.1) (2021-02-26)
|
198
200
|
|
199
|
-
|
200
201
|
### Bug Fixes
|
201
202
|
|
202
|
-
|
203
|
+
- **deps:** update dependency ember-cli-htmlbars to ^5.6.0 ([455b0b3](https://github.com/CrowdStrike/ember-browser-services/commit/455b0b351218da31322c3ad12f9aee384c115fb5))
|
203
204
|
|
204
205
|
# [1.1.0](https://github.com/CrowdStrike/ember-browser-services/compare/v1.0.2...v1.1.0) (2021-02-22)
|
205
206
|
|
206
|
-
|
207
207
|
### Features
|
208
208
|
|
209
|
-
|
210
|
-
|
209
|
+
- add normal object-style stubbing to the navigator ([3e50c60](https://github.com/CrowdStrike/ember-browser-services/commit/3e50c600dcce24ffeb9513b048dbfb42b464a9bf))
|
210
|
+
- add support for the navigator ([dc34355](https://github.com/CrowdStrike/ember-browser-services/commit/dc3435520823e4354daab32c6122b523d7a68697))
|
211
211
|
|
212
212
|
## [1.0.2](https://github.com/CrowdStrike/ember-browser-services/compare/v1.0.1...v1.0.2) (2021-02-16)
|
213
213
|
|
214
|
-
|
215
214
|
### Bug Fixes
|
216
215
|
|
217
|
-
|
216
|
+
- **deps:** update dependency ember-cli-babel to ^7.24.0 ([e84ab13](https://github.com/CrowdStrike/ember-browser-services/commit/e84ab13407e6b6b1832d57e4b606dccdbdac0513))
|
218
217
|
|
219
218
|
## [1.0.1](https://github.com/CrowdStrike/ember-browser-services/compare/v1.0.0...v1.0.1) (2021-02-13)
|
220
219
|
|
221
|
-
|
222
220
|
### Bug Fixes
|
223
221
|
|
224
|
-
|
222
|
+
- **ci:** disable persist-credentials option to actions/checkout ([c5fd21c](https://github.com/CrowdStrike/ember-browser-services/commit/c5fd21ce5a869828530dcad6216a6288c8c96662))
|
225
223
|
|
226
224
|
# 1.0.0 (2021-02-13)
|
227
225
|
|
228
|
-
|
229
226
|
### Bug Fixes
|
230
227
|
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
228
|
+
- package.json scripts ([acdb13c](https://github.com/CrowdStrike/ember-browser-services/commit/acdb13c5fdfc7037d9f9a735b7a63903cfe059da))
|
229
|
+
- specify 'main' for the release branch for semantic release ([02c533a](https://github.com/CrowdStrike/ember-browser-services/commit/02c533a3e1ef97e638b605829f50a03e9608653d))
|
230
|
+
- update workflow configuration to reference branch 'main' ([2bcdac9](https://github.com/CrowdStrike/ember-browser-services/commit/2bcdac9f3bc87aa96b6e6f39d8de2db6311175f5))
|
235
231
|
|
236
232
|
### chore
|
237
233
|
|
238
|
-
|
239
|
-
|
234
|
+
- drop support for node 10 ([e7a5550](https://github.com/CrowdStrike/ember-browser-services/commit/e7a55503f34affa76e9fa9111d3678f73c56f90c))
|
240
235
|
|
241
236
|
### Features
|
242
237
|
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
238
|
+
- automatic releases based on conventional commits ([c43a9f2](https://github.com/CrowdStrike/ember-browser-services/commit/c43a9f21a8a397d7f2ad331f883edafb194b4cc8))
|
239
|
+
- copy over files - initial implementation ([6b02e23](https://github.com/CrowdStrike/ember-browser-services/commit/6b02e23712ee505ee3c184a31accf9322328b602))
|
240
|
+
- support all properties on Location ([c5329bb](https://github.com/CrowdStrike/ember-browser-services/commit/c5329bbf80b913e29e6e71cb58d4ea1174ba7893))
|
247
241
|
|
248
242
|
### BREAKING CHANGES
|
249
243
|
|
250
|
-
|
244
|
+
- node 10 support dropped
|
package/LICENSE.md
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6
|
+
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
8
|
+
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -1 +1 @@
|
|
1
|
-
export { default } from "ember-browser-services/services/browser/document
|
1
|
+
export { default } from "ember-browser-services/services/browser/document";
|
@@ -1 +1 @@
|
|
1
|
-
export { default } from "ember-browser-services/services/browser/local-storage
|
1
|
+
export { default } from "ember-browser-services/services/browser/local-storage";
|
@@ -1 +1 @@
|
|
1
|
-
export { default } from "ember-browser-services/services/browser/navigator
|
1
|
+
export { default } from "ember-browser-services/services/browser/navigator";
|
@@ -1 +1 @@
|
|
1
|
-
export { default } from "ember-browser-services/services/browser/session-storage
|
1
|
+
export { default } from "ember-browser-services/services/browser/session-storage";
|
@@ -1 +1 @@
|
|
1
|
-
export { default } from "ember-browser-services/services/browser/window
|
1
|
+
export { default } from "ember-browser-services/services/browser/window";
|
package/dist/index.d.ts
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
export { DocumentService, LocalStorageService, NavigatorService, SessionStorageService, WindowService } from "./types";
|
1
|
+
export type { DocumentService, LocalStorageService, NavigatorService, SessionStorageService, WindowService } from "./types.js";
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,gGAMX,mBAAgB"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import Service from '@ember/service';
|
2
|
-
import { Class } from "../../types";
|
2
|
+
import { Class } from "../../types.js";
|
3
3
|
/**
|
4
4
|
* Allows Services to behave as Proxy objects for real objects, such as
|
5
5
|
* window, document, navigator, Worker, etc.
|
@@ -13,5 +13,5 @@ import { Class } from "../../types";
|
|
13
13
|
*
|
14
14
|
* @param {Object | Class} browserObject - the api to wrap a service around.
|
15
15
|
*/
|
16
|
-
declare function proxyService<BrowserAPI>(ObjectToProxy: BrowserAPI | Class<BrowserAPI>):
|
16
|
+
declare function proxyService<BrowserAPI>(ObjectToProxy: BrowserAPI | Class<BrowserAPI>): Service & BrowserAPI;
|
17
17
|
export { proxyService };
|
@@ -13,71 +13,58 @@ import Service from '@ember/service';
|
|
13
13
|
*
|
14
14
|
* @param {Object | Class} browserObject - the api to wrap a service around.
|
15
15
|
*/
|
16
|
-
|
17
16
|
function proxyService(ObjectToProxy) {
|
18
17
|
// extending the types for the static method create is too hard / impossible
|
19
18
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
20
19
|
let UnTypedService = Service;
|
21
|
-
|
22
20
|
function instanceHandlerFor(browserObject) {
|
23
21
|
return {
|
24
22
|
get(targetInstance, prop, receiver) {
|
25
23
|
if (prop in targetInstance) {
|
26
24
|
return Reflect.get(targetInstance, prop, receiver);
|
27
25
|
}
|
28
|
-
|
29
26
|
let value = browserObject[prop];
|
30
|
-
|
31
27
|
if (typeof value === 'function') {
|
32
28
|
// prevents the error "Illegal Invocation"
|
33
29
|
// which can sometimes happen due to losing the "this" depending on
|
34
30
|
// the invocation context at the call site
|
35
31
|
return value.bind(browserObject);
|
36
32
|
}
|
37
|
-
|
38
33
|
return value;
|
39
34
|
},
|
40
|
-
|
41
35
|
set(targetInstance, prop, value, receiver) {
|
42
36
|
if (prop in targetInstance) {
|
43
37
|
Reflect.set(targetInstance, prop, value, receiver);
|
44
38
|
}
|
45
|
-
|
46
39
|
browserObject[prop] = value;
|
47
40
|
return true;
|
48
41
|
}
|
49
|
-
|
50
42
|
};
|
51
43
|
}
|
52
|
-
|
53
44
|
function isConstructable(proxyTo) {
|
54
45
|
return typeof proxyTo === 'function';
|
55
|
-
}
|
46
|
+
}
|
47
|
+
|
48
|
+
// We have to untype the Service, because...
|
56
49
|
// this is nuts:
|
57
50
|
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/da0e5b5/types/ember__object/core.d.ts#L82-L94
|
58
51
|
//
|
59
52
|
// it's also all private, and the ember-TS team apparently didn't think people would want to do this :D
|
60
|
-
|
61
|
-
|
62
53
|
class ProxyCreator extends UnTypedService {
|
63
54
|
// https://github.com/emberjs/ember.js/blob/master/packages/%40ember/service/index.js#L66-L74
|
64
55
|
// https://github.com/emberjs/ember.js/blob/f85cefe9855b2521b02800d4bb2b68da7db2a214/packages/%40ember/service/index.js#L68-L72
|
65
56
|
static isServiceFactory = true;
|
66
|
-
|
67
57
|
static create(injections) {
|
68
58
|
let serviceInstance = class ProxiedService extends Service {}.create(injections);
|
69
59
|
let browserObject = isConstructable(ObjectToProxy) ? new ObjectToProxy() : ObjectToProxy;
|
70
60
|
serviceInstance.__browser_object__ = browserObject;
|
71
61
|
return new Proxy(serviceInstance, instanceHandlerFor(browserObject));
|
72
62
|
}
|
73
|
-
|
74
63
|
constructor(...args) {
|
75
64
|
super(...args);
|
76
65
|
throw new Error('ProxyCreator is not new-able');
|
77
66
|
}
|
78
|
-
|
79
67
|
}
|
80
|
-
|
81
68
|
return ProxyCreator;
|
82
69
|
}
|
83
70
|
|
@@ -1 +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):
|
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): 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>(\n targetInstance: Service,\n prop: K,\n receiver: unknown\n ) {\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(\n proxyTo: BrowserAPI | Class<BrowserAPI>\n ): 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(\n injections: Parameters<CreateMethod>\n ): 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)\n ? new ObjectToProxy()\n : 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 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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,YAAY,CAC1BC,aAA6C,EACvB;AAItB;AACA;EACA,IAAIC,cAAc,GAAGC,OAAc,CAAA;EAEnC,SAASC,kBAAkB,CAACC,aAAyB,EAAE;IACrD,OAAO;AACLC,MAAAA,GAAG,CACDC,cAAuB,EACvBC,IAAO,EACPC,QAAiB,EACjB;QACA,IAAID,IAAI,IAAID,cAAc,EAAE;UAC1B,OAAOG,OAAO,CAACJ,GAAG,CAACC,cAAc,EAAEC,IAAI,EAAEC,QAAQ,CAAC,CAAA;AACpD,SAAA;AAEA,QAAA,IAAIE,KAAK,GAAGN,aAAa,CAACG,IAAI,CAAC,CAAA;AAE/B,QAAA,IAAI,OAAOG,KAAK,KAAK,UAAU,EAAE;AAC/B;AACA;AACA;AACA,UAAA,OAAOA,KAAK,CAACC,IAAI,CAACP,aAAa,CAAC,CAAA;AAClC,SAAA;AAEA,QAAA,OAAOM,KAAK,CAAA;OACb;MACDE,GAAG,CACDN,cAAuB,EACvBC,IAAO,EACPG,KAAoB,EACpBF,QAAiB,EACjB;QACA,IAAID,IAAI,IAAID,cAAc,EAAE;UAC1BG,OAAO,CAACG,GAAG,CAACN,cAAc,EAAEC,IAAI,EAAEG,KAAK,EAAEF,QAAQ,CAAC,CAAA;AACpD,SAAA;AAEAJ,QAAAA,aAAa,CAACG,IAAI,CAAC,GAAGG,KAAK,CAAA;AAE3B,QAAA,OAAO,IAAI,CAAA;AACb,OAAA;KACD,CAAA;AACH,GAAA;EAEA,SAASG,eAAe,CACtBC,OAAuC,EACT;IAC9B,OAAO,OAAOA,OAAO,KAAK,UAAU,CAAA;AACtC,GAAA;;AAEA;AACA;AACA;AACA;AACA;EACA,MAAMC,YAAY,SAASd,cAAc,CAAC;AACxC;AACA;IACA,OAAOe,gBAAgB,GAAG,IAAI,CAAA;IAE9B,OAAOC,MAAM,CACXC,UAAoC,EACV;AAC1B,MAAA,IAAIC,eAAe,GAAG,MAAMC,cAAc,SAASlB,OAAO,CAAC,EAW1D,CAACe,MAAM,CAACC,UAAU,CAAC,CAAA;MAEpB,IAAId,aAAa,GAAGS,eAAe,CAACb,aAAa,CAAC,GAC9C,IAAIA,aAAa,EAAE,GACnBA,aAAa,CAAA;MAEjBmB,eAAe,CAACE,kBAAkB,GAAGjB,aAAa,CAAA;MAElD,OAAO,IAAIkB,KAAK,CAACH,eAAe,EAAEhB,kBAAkB,CAACC,aAAa,CAAC,CAAC,CAAA;AACtE,KAAA;IAEAmB,WAAW,CAAC,GAAGC,IAAe,EAAE;MAC9B,KAAK,CAAC,GAAGA,IAAI,CAAC,CAAA;AACd,MAAA,MAAM,IAAIC,KAAK,CAAC,8BAA8B,CAAC,CAAA;AACjD,KAAA;AACF,GAAA;AAEA,EAAA,OAAOV,YAAY,CAAA;AACrB;;;;"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
declare const DocumentProxyService:
|
1
|
+
declare const DocumentProxyService: import("@ember/service").default & Document;
|
2
2
|
declare module '@ember/service' {
|
3
3
|
interface Registry {
|
4
4
|
'browser/document': typeof DocumentProxyService;
|
@@ -1 +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,
|
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,QAAQ;;;;"}
|
@@ -6,7 +6,7 @@
|
|
6
6
|
* the browser APIs.
|
7
7
|
*
|
8
8
|
*/
|
9
|
-
declare const LocalStorageProxyService:
|
9
|
+
declare const LocalStorageProxyService: import("@ember/service").default & Storage;
|
10
10
|
declare module '@ember/service' {
|
11
11
|
interface Registry {
|
12
12
|
'browser/local-storage': typeof LocalStorageProxyService;
|
@@ -1 +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
|
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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,wBAAwB,GAAGC,YAAY,CAACC,YAAY;;;;"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
declare const NavigatorProxyService:
|
1
|
+
declare const NavigatorProxyService: import("@ember/service").default & Navigator;
|
2
2
|
declare module '@ember/service' {
|
3
3
|
interface Registry {
|
4
4
|
'browser/navigator': typeof NavigatorProxyService;
|
@@ -1 +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,
|
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,SAAS;;;;"}
|
@@ -6,7 +6,7 @@
|
|
6
6
|
* the browser APIs.
|
7
7
|
*
|
8
8
|
*/
|
9
|
-
declare const SessionStorageProxyService:
|
9
|
+
declare const SessionStorageProxyService: import("@ember/service").default & Storage;
|
10
10
|
declare module '@ember/service' {
|
11
11
|
interface Registry {
|
12
12
|
'browser/session-storage': typeof SessionStorageProxyService;
|
@@ -1 +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
|
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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,0BAA0B,GAAGC,YAAY,CAACC,cAAc;;;;"}
|
@@ -6,7 +6,7 @@
|
|
6
6
|
* the browser APIs.
|
7
7
|
*
|
8
8
|
*/
|
9
|
-
declare const WindowProxyService:
|
9
|
+
declare const WindowProxyService: import("@ember/service").default & Window & typeof globalThis;
|
10
10
|
declare global {
|
11
11
|
interface Window {
|
12
12
|
requirejs: (path: string) => {
|
@@ -1 +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
|
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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,kBAAkB,GAAGC,YAAY,CAACC,MAAM;;;;"}
|
@@ -4,29 +4,22 @@ import Service from '@ember/service';
|
|
4
4
|
* Mimics the Web Storage API, as used by localStorage and sessionStorage.
|
5
5
|
*
|
6
6
|
*/
|
7
|
-
|
8
7
|
class FakeWebStorageService extends Service {
|
9
8
|
fakeWebStorage = {};
|
10
|
-
|
11
9
|
setItem(key, value) {
|
12
10
|
// Everything in Web Storage is a string
|
13
11
|
this.fakeWebStorage[key] = `${value}`;
|
14
12
|
}
|
15
|
-
|
16
13
|
getItem(key) {
|
17
14
|
return this.fakeWebStorage[key] || null;
|
18
15
|
}
|
19
|
-
|
20
16
|
removeItem(key) {
|
21
17
|
delete this.fakeWebStorage[key];
|
22
18
|
}
|
23
|
-
|
24
19
|
clear() {
|
25
20
|
this.fakeWebStorage = {};
|
26
21
|
}
|
27
|
-
|
28
22
|
}
|
29
|
-
|
30
23
|
class FakeLocalStorageService extends FakeWebStorageService {}
|
31
24
|
class FakeSessionStorageService extends FakeWebStorageService {}
|
32
25
|
|
@@ -1 +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
|
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;AACA;AACA;AACA;AACA,MAAMA,qBAAqB,SAASC,OAAO,CAAC;EAC1CC,cAAc,GAAmB,EAAE,CAAA;AAEnCC,EAAAA,OAAO,CAACC,GAAW,EAAEC,KAAa,EAAQ;AACxC;IACA,IAAI,CAACH,cAAc,CAACE,GAAG,CAAC,GAAI,CAAA,EAAEC,KAAM,CAAC,CAAA,CAAA;AACvC,GAAA;EAEAC,OAAO,CAACF,GAAW,EAAiB;AAClC,IAAA,OAAO,IAAI,CAACF,cAAc,CAACE,GAAG,CAAC,IAAI,IAAI,CAAA;AACzC,GAAA;EAEAG,UAAU,CAACH,GAAW,EAAQ;AAC5B,IAAA,OAAO,IAAI,CAACF,cAAc,CAACE,GAAG,CAAC,CAAA;AACjC,GAAA;AAEAI,EAAAA,KAAK,GAAS;AACZ,IAAA,IAAI,CAACN,cAAc,GAAG,EAAE,CAAA;AAC1B,GAAA;AACF,CAAA;AAEO,MAAMO,uBAAuB,SAAST,qBAAqB,CAAC,EAAA;AAC5D,MAAMU,yBAAyB,SAASV,qBAAqB,CAAC;;;;"}
|
@@ -4,14 +4,19 @@ import { setupWindowMock } from 'ember-window-mock/test-support';
|
|
4
4
|
import { proxyService } from '../services/browser/-proxy-service.js';
|
5
5
|
import { FakeLocalStorageService, FakeSessionStorageService } from './-private/web-storage.js';
|
6
6
|
import { patchWindow } from './window-mock-augments.js';
|
7
|
-
import 'ember-window-mock/test-support/-private/mock/location';
|
8
7
|
|
9
8
|
function setupBrowserFakes(hooks, options) {
|
10
9
|
setupWindowMock(hooks);
|
10
|
+
|
11
|
+
// Switched to 'any' from 'TestContext' due to awkward migration period from
|
12
|
+
// DT to built-in-types.
|
13
|
+
// I don't know if it's possible to support both fake test-helper types and real ones
|
14
|
+
// (simultaneously)
|
15
|
+
//
|
16
|
+
// Additionally, these types have no bearing on end-user behavior, so this is low risk.
|
11
17
|
hooks.beforeEach(function () {
|
12
18
|
// the type for the owner keeps being wrong............
|
13
19
|
let owner = this.owner;
|
14
|
-
|
15
20
|
if (options.window) {
|
16
21
|
// default, can still be overwritten
|
17
22
|
// see: https://github.com/kaliber5/ember-window-mock/issues/175
|
@@ -19,55 +24,51 @@ function setupBrowserFakes(hooks, options) {
|
|
19
24
|
let service = maybeMake(options.window, patched);
|
20
25
|
owner.register('service:browser/window', service);
|
21
26
|
}
|
22
|
-
|
23
27
|
if (options.document) {
|
24
28
|
let service = maybeMake(options.document, window.document);
|
25
29
|
owner.register('service:browser/document', service);
|
26
30
|
}
|
27
|
-
|
28
31
|
if (options.localStorage) {
|
29
32
|
owner.register('service:browser/local-storage', FakeLocalStorageService);
|
30
33
|
}
|
31
|
-
|
32
34
|
if (options.sessionStorage) {
|
33
35
|
owner.register('service:browser/session-storage', FakeSessionStorageService);
|
34
36
|
}
|
35
|
-
|
36
37
|
if (options.navigator) {
|
37
38
|
let service = maybeMake(options.navigator, window.navigator);
|
38
39
|
owner.register('service:browser/navigator', service);
|
39
40
|
}
|
40
41
|
});
|
41
42
|
}
|
43
|
+
|
44
|
+
// this usage of any is correct, because it literally could be *any*thing
|
45
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
46
|
+
|
42
47
|
function maybeMake(maybeImplementation, target) {
|
43
48
|
if (maybeImplementation === true) {
|
44
49
|
return proxyService(target);
|
45
50
|
}
|
46
|
-
|
47
51
|
if (maybeImplementation.prototype instanceof Service) {
|
48
52
|
return target;
|
49
53
|
}
|
50
|
-
|
51
54
|
if (typeof maybeImplementation === 'object') {
|
52
55
|
applyStub(target, maybeImplementation);
|
53
56
|
return proxyService(target);
|
54
57
|
}
|
55
|
-
|
56
58
|
return proxyService(target);
|
57
|
-
}
|
59
|
+
}
|
60
|
+
|
61
|
+
// we are already using ember-window-mock, so the proxy internal to that package will
|
58
62
|
// "just handle" setting stuff on the window
|
59
63
|
//
|
60
64
|
// NOTE:
|
61
65
|
// - Location implementation is incomplete:
|
62
66
|
// https://github.com/kaliber5/ember-window-mock/blob/2b8fbf581fc65e7f5455cd291497a3fdc2efdaf5/addon-test-support/-private/mock/location.js#L23
|
63
67
|
// - does not allow setting "origin"
|
64
|
-
|
65
68
|
function applyStub(root, partial) {
|
66
69
|
if (!partial) return root;
|
67
|
-
|
68
70
|
for (let key of Object.keys(partial)) {
|
69
71
|
let value = partial[key];
|
70
|
-
|
71
72
|
if (Array.isArray(value)) {
|
72
73
|
root[key] = value;
|
73
74
|
} else if (typeof value === 'object') {
|
@@ -1 +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 {
|
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';\n\nimport { setupWindowMock } from 'ember-window-mock/test-support';\n\nimport { proxyService } from '../services/browser/-proxy-service';\nimport {\n FakeLocalStorageService,\n FakeSessionStorageService,\n} from './-private/web-storage';\nimport { patchWindow } from './window-mock-augments';\n\nimport type { RecursivePartial } from '../types';\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 // Switched to 'any' from 'TestContext' due to awkward migration period from\n // DT to built-in-types.\n // I don't know if it's possible to support both fake test-helper types and real ones\n // (simultaneously)\n //\n // Additionally, these types have no bearing on end-user behavior, so this is low risk.\n hooks.beforeEach(function (this: any) {\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(\n 'service:browser/session-storage',\n FakeSessionStorageService\n );\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<\n DefaultType extends UnknownObject,\n TestClass extends UnknownObject\n>(\n maybeImplementation:\n | true\n | typeof Service\n | TestClass\n | 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":";;;;;;;AAuBO,SAASA,iBAAiB,CAACC,KAAkB,EAAEC,OAAc,EAAQ;EAC1EC,eAAe,CAACF,KAAK,CAAC,CAAA;;AAEtB;AACA;AACA;AACA;AACA;AACA;EACAA,KAAK,CAACG,UAAU,CAAC,YAAqB;AACpC;AACA,IAAA,IAAIC,KAAK,GAAG,IAAI,CAACA,KAGhB,CAAA;IAED,IAAIH,OAAO,CAACI,MAAM,EAAE;AAClB;AACA;AACA,MAAA,IAAIC,OAAO,GAAGC,WAAW,CAACF,MAAM,CAAC,CAAA;MACjC,IAAIG,OAAO,GAAGC,SAAS,CAACR,OAAO,CAACI,MAAM,EAAEC,OAAO,CAAC,CAAA;AAEhDF,MAAAA,KAAK,CAACM,QAAQ,CAAC,wBAAwB,EAAEF,OAAO,CAAC,CAAA;AACnD,KAAA;IAEA,IAAIP,OAAO,CAACU,QAAQ,EAAE;MACpB,IAAIH,OAAO,GAAGC,SAAS,CAACR,OAAO,CAACU,QAAQ,EAAEN,MAAM,CAACM,QAAQ,CAAC,CAAA;AAE1DP,MAAAA,KAAK,CAACM,QAAQ,CAAC,0BAA0B,EAAEF,OAAO,CAAC,CAAA;AACrD,KAAA;IAEA,IAAIP,OAAO,CAACW,YAAY,EAAE;AACxBR,MAAAA,KAAK,CAACM,QAAQ,CAAC,+BAA+B,EAAEG,uBAAuB,CAAC,CAAA;AAC1E,KAAA;IAEA,IAAIZ,OAAO,CAACa,cAAc,EAAE;AAC1BV,MAAAA,KAAK,CAACM,QAAQ,CACZ,iCAAiC,EACjCK,yBAAyB,CAC1B,CAAA;AACH,KAAA;IAEA,IAAId,OAAO,CAACe,SAAS,EAAE;MACrB,IAAIR,OAAO,GAAGC,SAAS,CAACR,OAAO,CAACe,SAAS,EAAEX,MAAM,CAACW,SAAS,CAAC,CAAA;AAE5DZ,MAAAA,KAAK,CAACM,QAAQ,CAAC,2BAA2B,EAAEF,OAAO,CAAC,CAAA;AACtD,KAAA;AACF,GAAC,CAAC,CAAA;AACJ,CAAA;;AAEA;AACA;;AAGO,SAASC,SAAS,CAIvBQ,mBAIiC,EACjCC,MAAmB,EACN;EACb,IAAID,mBAAmB,KAAK,IAAI,EAAE;IAChC,OAAOE,YAAY,CAACD,MAAM,CAAC,CAAA;AAC7B,GAAA;AAEA,EAAA,IAAID,mBAAmB,CAACG,SAAS,YAAYC,OAAO,EAAE;AACpD,IAAA,OAAOH,MAAM,CAAA;AACf,GAAA;AAEA,EAAA,IAAI,OAAOD,mBAAmB,KAAK,QAAQ,EAAE;AAC3CK,IAAAA,SAAS,CAACJ,MAAM,EAAED,mBAAmB,CAAC,CAAA;IAEtC,OAAOE,YAAY,CAACD,MAAM,CAAC,CAAA;AAC7B,GAAA;EAEA,OAAOC,YAAY,CAACD,MAAM,CAAC,CAAA;AAC7B,CAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASI,SAAS,CAACC,IAAS,EAAEC,OAAa,EAAE;AAC3C,EAAA,IAAI,CAACA,OAAO,EAAE,OAAOD,IAAI,CAAA;EAEzB,KAAK,IAAIE,GAAG,IAAIC,MAAM,CAACC,IAAI,CAACH,OAAO,CAAC,EAAE;AACpC,IAAA,IAAII,KAAK,GAAGJ,OAAO,CAACC,GAAG,CAAC,CAAA;AAExB,IAAA,IAAII,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,EAAE;AACxBL,MAAAA,IAAI,CAACE,GAAG,CAAC,GAAGG,KAAK,CAAA;AACnB,KAAC,MAAM,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;AACpCN,MAAAA,SAAS,CAACC,IAAI,CAACE,GAAG,CAAC,EAAEG,KAAK,CAAC,CAAA;AAC7B,KAAC,MAAM;AACLL,MAAAA,IAAI,CAACE,GAAG,CAAC,GAAGG,KAAK,CAAA;AACnB,KAAA;AACF,GAAA;AACF;;;;"}
|
@@ -2,7 +2,6 @@ import window from 'ember-window-mock';
|
|
2
2
|
import locationFactory from 'ember-window-mock/test-support/-private/mock/location';
|
3
3
|
|
4
4
|
const AUGMENTS = ['origin'];
|
5
|
-
|
6
5
|
function createLocation(target) {
|
7
6
|
let initialHref = target?.location?.href ?? window.location.href;
|
8
7
|
let mockLocation = locationFactory(initialHref);
|
@@ -13,21 +12,16 @@ function createLocation(target) {
|
|
13
12
|
if (AUGMENTS.includes(key)) {
|
14
13
|
return values[key] ?? Reflect.get(target, key, receiver);
|
15
14
|
}
|
16
|
-
|
17
15
|
return Reflect.get(target, key, receiver);
|
18
16
|
},
|
19
|
-
|
20
17
|
set(target, key, value, receiver) {
|
21
18
|
if (AUGMENTS.includes(key)) {
|
22
19
|
return values[key] = value;
|
23
20
|
}
|
24
|
-
|
25
21
|
return Reflect.set(target, key, value, receiver);
|
26
22
|
}
|
27
|
-
|
28
23
|
});
|
29
24
|
}
|
30
|
-
|
31
25
|
function patchWindow(target) {
|
32
26
|
let location = createLocation(target);
|
33
27
|
let self = new Proxy(target, {
|
@@ -37,15 +31,12 @@ function patchWindow(target) {
|
|
37
31
|
if (key === 'top') return self;
|
38
32
|
return Reflect.get(target, key, receiver);
|
39
33
|
},
|
40
|
-
|
41
34
|
set(target, key, value, receiver) {
|
42
35
|
if (key === 'location') {
|
43
36
|
throw new Error(`location cannot be set on window`);
|
44
37
|
}
|
45
|
-
|
46
38
|
return Reflect.set(target, key, value, receiver);
|
47
39
|
}
|
48
|
-
|
49
40
|
});
|
50
41
|
return self;
|
51
42
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"window-mock-augments.js","sources":["../../src/test-support/window-mock-augments.ts"],"sourcesContent":["import window from 'ember-window-mock';\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-expect-error\nimport locationFactory from 'ember-window-mock/test-support/-private/mock/location';\n\nconst AUGMENTS: Array<string | symbol> = ['origin'];\n\nfunction createLocation(target?: Window) {\n let initialHref = target?.location?.href ?? window.location.href;\n let mockLocation = locationFactory(initialHref);\n let values: any = {};\n\n mockLocation.isPatchedLocation = true;\n\n return new Proxy(mockLocation, {\n get(target, key, receiver) {\n if (AUGMENTS.includes(key)) {\n return values[key] ?? Reflect.get(target, key, receiver);\n }\n\n return Reflect.get(target, key, receiver);\n },\n\n set(target, key, value, receiver) {\n if (AUGMENTS.includes(key)) {\n return (values[key] = value);\n }\n\n return Reflect.set(target, key, value, receiver);\n },\n });\n}\n\nexport function patchWindow(target: any) {\n let location = createLocation(target);\n\n let self: any = new Proxy(target, {\n get(target, key, receiver) {\n if (key === 'location') return location;\n if (key === 'parent') return self;\n if (key === 'top') return self;\n\n return Reflect.get(target, key, receiver);\n },\n set(target, key, value, receiver) {\n if (key === 'location') {\n throw new Error(`location cannot be set on window`);\n }\n\n return Reflect.set(target, key, value, receiver);\n },\n });\n\n return self;\n}\n"],"names":["AUGMENTS","createLocation","target","initialHref","location","href","window","mockLocation","locationFactory","values","isPatchedLocation","Proxy","get","key","receiver","includes","Reflect","set","value","patchWindow","self","Error"],"mappings":";;;
|
1
|
+
{"version":3,"file":"window-mock-augments.js","sources":["../../src/test-support/window-mock-augments.ts"],"sourcesContent":["import window from 'ember-window-mock';\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-expect-error\nimport locationFactory from 'ember-window-mock/test-support/-private/mock/location';\n\nconst AUGMENTS: Array<string | symbol> = ['origin'];\n\nfunction createLocation(target?: Window) {\n let initialHref = target?.location?.href ?? window.location.href;\n let mockLocation = locationFactory(initialHref);\n let values: any = {};\n\n mockLocation.isPatchedLocation = true;\n\n return new Proxy(mockLocation, {\n get(target, key, receiver) {\n if (AUGMENTS.includes(key)) {\n return values[key] ?? Reflect.get(target, key, receiver);\n }\n\n return Reflect.get(target, key, receiver);\n },\n\n set(target, key, value, receiver) {\n if (AUGMENTS.includes(key)) {\n return (values[key] = value);\n }\n\n return Reflect.set(target, key, value, receiver);\n },\n });\n}\n\nexport function patchWindow(target: any) {\n let location = createLocation(target);\n\n let self: any = new Proxy(target, {\n get(target, key, receiver) {\n if (key === 'location') return location;\n if (key === 'parent') return self;\n if (key === 'top') return self;\n\n return Reflect.get(target, key, receiver);\n },\n set(target, key, value, receiver) {\n if (key === 'location') {\n throw new Error(`location cannot be set on window`);\n }\n\n return Reflect.set(target, key, value, receiver);\n },\n });\n\n return self;\n}\n"],"names":["AUGMENTS","createLocation","target","initialHref","location","href","window","mockLocation","locationFactory","values","isPatchedLocation","Proxy","get","key","receiver","includes","Reflect","set","value","patchWindow","self","Error"],"mappings":";;;AAMA,MAAMA,QAAgC,GAAG,CAAC,QAAQ,CAAC,CAAA;AAEnD,SAASC,cAAc,CAACC,MAAe,EAAE;AACvC,EAAA,IAAIC,WAAW,GAAGD,MAAM,EAAEE,QAAQ,EAAEC,IAAI,IAAIC,MAAM,CAACF,QAAQ,CAACC,IAAI,CAAA;AAChE,EAAA,IAAIE,YAAY,GAAGC,eAAe,CAACL,WAAW,CAAC,CAAA;EAC/C,IAAIM,MAAW,GAAG,EAAE,CAAA;EAEpBF,YAAY,CAACG,iBAAiB,GAAG,IAAI,CAAA;AAErC,EAAA,OAAO,IAAIC,KAAK,CAACJ,YAAY,EAAE;AAC7BK,IAAAA,GAAG,CAACV,MAAM,EAAEW,GAAG,EAAEC,QAAQ,EAAE;AACzB,MAAA,IAAId,QAAQ,CAACe,QAAQ,CAACF,GAAG,CAAC,EAAE;AAC1B,QAAA,OAAOJ,MAAM,CAACI,GAAG,CAAC,IAAIG,OAAO,CAACJ,GAAG,CAACV,MAAM,EAAEW,GAAG,EAAEC,QAAQ,CAAC,CAAA;AAC1D,OAAA;MAEA,OAAOE,OAAO,CAACJ,GAAG,CAACV,MAAM,EAAEW,GAAG,EAAEC,QAAQ,CAAC,CAAA;KAC1C;IAEDG,GAAG,CAACf,MAAM,EAAEW,GAAG,EAAEK,KAAK,EAAEJ,QAAQ,EAAE;AAChC,MAAA,IAAId,QAAQ,CAACe,QAAQ,CAACF,GAAG,CAAC,EAAE;AAC1B,QAAA,OAAQJ,MAAM,CAACI,GAAG,CAAC,GAAGK,KAAK,CAAA;AAC7B,OAAA;MAEA,OAAOF,OAAO,CAACC,GAAG,CAACf,MAAM,EAAEW,GAAG,EAAEK,KAAK,EAAEJ,QAAQ,CAAC,CAAA;AAClD,KAAA;AACF,GAAC,CAAC,CAAA;AACJ,CAAA;AAEO,SAASK,WAAW,CAACjB,MAAW,EAAE;AACvC,EAAA,IAAIE,QAAQ,GAAGH,cAAc,CAACC,MAAM,CAAC,CAAA;AAErC,EAAA,IAAIkB,IAAS,GAAG,IAAIT,KAAK,CAACT,MAAM,EAAE;AAChCU,IAAAA,GAAG,CAACV,MAAM,EAAEW,GAAG,EAAEC,QAAQ,EAAE;AACzB,MAAA,IAAID,GAAG,KAAK,UAAU,EAAE,OAAOT,QAAQ,CAAA;AACvC,MAAA,IAAIS,GAAG,KAAK,QAAQ,EAAE,OAAOO,IAAI,CAAA;AACjC,MAAA,IAAIP,GAAG,KAAK,KAAK,EAAE,OAAOO,IAAI,CAAA;MAE9B,OAAOJ,OAAO,CAACJ,GAAG,CAACV,MAAM,EAAEW,GAAG,EAAEC,QAAQ,CAAC,CAAA;KAC1C;IACDG,GAAG,CAACf,MAAM,EAAEW,GAAG,EAAEK,KAAK,EAAEJ,QAAQ,EAAE;MAChC,IAAID,GAAG,KAAK,UAAU,EAAE;AACtB,QAAA,MAAM,IAAIQ,KAAK,CAAE,CAAA,gCAAA,CAAiC,CAAC,CAAA;AACrD,OAAA;MAEA,OAAOL,OAAO,CAACC,GAAG,CAACf,MAAM,EAAEW,GAAG,EAAEK,KAAK,EAAEJ,QAAQ,CAAC,CAAA;AAClD,KAAA;AACF,GAAC,CAAC,CAAA;AAEF,EAAA,OAAOM,IAAI,CAAA;AACb;;;;"}
|
package/dist/types.d.ts
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
import { default as _DocumentService } from "./services/browser/document";
|
2
|
-
import { default as _LocalStorageService } from "./services/browser/local-storage";
|
3
|
-
import { default as _NavigatorService } from "./services/browser/navigator";
|
4
|
-
import { default as _SessionStorageService } from "./services/browser/session-storage";
|
5
|
-
import { default as _WindowService } from "./services/browser/window";
|
1
|
+
import { default as _DocumentService } from "./services/browser/document.js";
|
2
|
+
import { default as _LocalStorageService } from "./services/browser/local-storage.js";
|
3
|
+
import { default as _NavigatorService } from "./services/browser/navigator.js";
|
4
|
+
import { default as _SessionStorageService } from "./services/browser/session-storage.js";
|
5
|
+
import { default as _WindowService } from "./services/browser/window.js";
|
6
6
|
type WindowService = typeof _WindowService;
|
7
7
|
type DocumentService = typeof _DocumentService;
|
8
8
|
type LocalStorageService = typeof _LocalStorageService;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "ember-browser-services",
|
3
|
-
"version": "4.0.
|
3
|
+
"version": "4.0.4",
|
4
4
|
"description": "Browser APIs as services for easier testing",
|
5
5
|
"repository": "https://github.com/CrowdStrike/ember-browser-services",
|
6
6
|
"license": "MIT",
|
@@ -33,56 +33,41 @@
|
|
33
33
|
"CHANGELOG.md",
|
34
34
|
"README.md"
|
35
35
|
],
|
36
|
-
"scripts": {
|
37
|
-
"start": "pnpm watch:js",
|
38
|
-
"build": "concurrently 'npm:build:*'",
|
39
|
-
"build:js": "rollup -c ./rollup.config.mjs",
|
40
|
-
"build:docs": "cp ../README.md ./README.md",
|
41
|
-
"watch:js": "rollup -c --watch --no-watch.clearScreen",
|
42
|
-
"lint": "concurrently 'npm:lint:js'",
|
43
|
-
"lint:fix": "concurrently 'npm:lint:js:fix'",
|
44
|
-
"lint:js": "eslint . --cache",
|
45
|
-
"lint:js:fix": "eslint . --fix",
|
46
|
-
"test": "echo 'Addon does not have tests, run tests in test-app'",
|
47
|
-
"prepublishOnly": "pnpm run build"
|
48
|
-
},
|
49
36
|
"dependencies": {
|
50
|
-
"@embroider/addon-shim": "1.3.0",
|
37
|
+
"@embroider/addon-shim": "^1.3.0",
|
51
38
|
"ember-window-mock": "^0.8.1"
|
52
39
|
},
|
53
40
|
"devDependencies": {
|
54
|
-
"@babel/core": "7.
|
55
|
-
"@babel/
|
56
|
-
"@babel/plugin-proposal-
|
57
|
-
"@babel/plugin-
|
58
|
-
"@babel/plugin-
|
59
|
-
"@babel/
|
60
|
-
"@
|
61
|
-
"@
|
62
|
-
"@
|
63
|
-
"@semantic-release/git": "^9.0.0",
|
41
|
+
"@babel/core": "7.20.12",
|
42
|
+
"@babel/eslint-parser": "^7.19.1",
|
43
|
+
"@babel/plugin-proposal-class-properties": "7.18.6",
|
44
|
+
"@babel/plugin-proposal-decorators": "7.20.13",
|
45
|
+
"@babel/plugin-syntax-decorators": "7.19.0",
|
46
|
+
"@babel/plugin-transform-typescript": "7.20.13",
|
47
|
+
"@babel/preset-typescript": "7.18.6",
|
48
|
+
"@embroider/addon-dev": "3.0.0",
|
49
|
+
"@nullvoxpopuli/eslint-configs": "3.1.1",
|
64
50
|
"@types/ember__application": "^4.0.0",
|
65
51
|
"@types/ember__engine": "^4.0.0",
|
66
52
|
"@types/ember__object": "^4.0.0",
|
67
53
|
"@types/ember__service": "^4.0.0",
|
68
|
-
"@types/ember__test-helpers": "^2.0.2",
|
69
54
|
"@types/qunit": "^2.11.3",
|
70
|
-
"
|
71
|
-
"
|
72
|
-
"
|
73
|
-
"
|
74
|
-
"eslint
|
75
|
-
"eslint-plugin-
|
76
|
-
"eslint-plugin-
|
55
|
+
"@typescript-eslint/eslint-plugin": "5.50.0",
|
56
|
+
"@typescript-eslint/parser": "^5.50.0",
|
57
|
+
"concurrently": "7.6.0",
|
58
|
+
"ember-source": "3.8.0",
|
59
|
+
"eslint": "^8.33.0",
|
60
|
+
"eslint-plugin-decorator-position": "5.0.2",
|
61
|
+
"eslint-plugin-ember": "11.4.5",
|
62
|
+
"eslint-plugin-import": "2.27.5",
|
77
63
|
"eslint-plugin-json": "3.1.0",
|
78
64
|
"eslint-plugin-node": "11.1.0",
|
79
|
-
"eslint-plugin-prettier": "4.0.0",
|
80
65
|
"eslint-plugin-simple-import-sort": "7.0.0",
|
81
|
-
"prettier": "^2.
|
82
|
-
"rollup": "
|
83
|
-
"rollup-plugin-
|
84
|
-
"
|
85
|
-
"typescript": "4.
|
66
|
+
"prettier": "^2.8.3",
|
67
|
+
"rollup": "3.12.1",
|
68
|
+
"rollup-plugin-copy": "^3.4.0",
|
69
|
+
"rollup-plugin-ts": "3.2.0",
|
70
|
+
"typescript": "4.9.5"
|
86
71
|
},
|
87
72
|
"publishConfig": {
|
88
73
|
"registry": "https://registry.npmjs.org"
|
@@ -102,24 +87,20 @@
|
|
102
87
|
"./services/browser/window.js": "./dist/_app_/services/browser/window.js"
|
103
88
|
}
|
104
89
|
},
|
105
|
-
"engines": {
|
106
|
-
"node": "12.* || >= 14"
|
107
|
-
},
|
108
90
|
"volta": {
|
109
91
|
"extends": "../package.json"
|
110
92
|
},
|
111
|
-
"
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
"
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
}
|
124
|
-
|
125
|
-
}
|
93
|
+
"types": "dist",
|
94
|
+
"scripts": {
|
95
|
+
"start": "pnpm watch:js",
|
96
|
+
"build": "rollup -c ./rollup.config.mjs",
|
97
|
+
"watch:js": "rollup -c --watch --no-watch.clearScreen",
|
98
|
+
"lint": "concurrently 'npm:lint:js'",
|
99
|
+
"lint:fix": "concurrently 'npm:lint:js:fix'",
|
100
|
+
"lint:js": "eslint . --cache",
|
101
|
+
"lint:js:fix": "eslint . --fix",
|
102
|
+
"test": "echo 'Addon does not have tests, run tests in test-app'",
|
103
|
+
"format:check": "prettier -c .",
|
104
|
+
"format": "prettier -w ."
|
105
|
+
}
|
106
|
+
}
|