1
1
/* eslint-env node */
2
2
'use strict' ;
3
3
4
- const fs = require ( 'fs' ) ;
5
- const fmt = require ( 'util' ) . format ;
6
- const uniq = require ( 'ember-cli-lodash-subset' ) . uniq ;
7
- const merge = require ( 'ember-cli-lodash-subset' ) . merge ;
8
- const md5Hex = require ( 'md5-hex' ) ;
9
- const path = require ( 'path' ) ;
10
- const Plugin = require ( 'broccoli-plugin' ) ;
11
-
4
+ const fs = require ( 'fs' ) ;
5
+ const fmt = require ( 'util' ) . format ;
6
+ const uniq = require ( 'ember-cli-lodash-subset' ) . uniq ;
7
+ const merge = require ( 'ember-cli-lodash-subset' ) . merge ;
8
+ const md5Hex = require ( 'md5-hex' ) ;
9
+ const path = require ( 'path' ) ;
10
+ const Plugin = require ( 'broccoli-plugin' ) ;
12
11
const stringify = require ( 'json-stable-stringify' ) ;
13
12
14
13
const LATEST_SCHEMA_VERSION = 3 ;
@@ -50,7 +49,7 @@ module.exports = class FastBootConfig extends Plugin {
50
49
this . buildConfig ( ) ;
51
50
this . buildDependencies ( ) ;
52
51
this . buildManifest ( ) ;
53
- this . buildHostAllowlist ( ) ;
52
+ this . buildHostAllowList ( ) ;
54
53
55
54
let outputPath = path . join ( this . outputPath , 'package.json' ) ;
56
55
this . writeFileIfContentChanged ( outputPath , this . toJSONString ( ) ) ;
@@ -160,9 +159,12 @@ module.exports = class FastBootConfig extends Plugin {
160
159
this . manifest = this . updateFastBootManifest ( manifest ) ;
161
160
}
162
161
163
- buildHostAllowlist ( ) {
162
+ buildHostAllowList ( ) {
164
163
if ( this . fastbootAppConfig ) {
165
- this . hostAllowlist = this . fastbootAppConfig . hostAllowlist ;
164
+ if ( 'hostWhitelist' in this . fastbootAppConfig ) {
165
+ this . ui . writeLine ( 'Please update your fastboot config to use `hostAllowList` of the deprecated `hostWhitelist`' ) ;
166
+ }
167
+ this . hostAllowList = this . fastbootAppConfig . hostAllowList || this . fastbootAppConfig . hostWhitelist
166
168
}
167
169
}
168
170
@@ -173,19 +175,19 @@ module.exports = class FastBootConfig extends Plugin {
173
175
moduleAllowlist : this . moduleAllowlist ,
174
176
schemaVersion : LATEST_SCHEMA_VERSION ,
175
177
manifest : this . manifest ,
176
- hostAllowlist : this . normalizeHostAllowlist ( ) ,
178
+ hostAllowList : this . normalizeHostAllowList ( ) ,
177
179
config : this . fastbootConfig ,
178
180
appName : this . appName ,
179
181
}
180
182
} , null , 2 ) ;
181
183
}
182
184
183
- normalizeHostAllowlist ( ) {
184
- if ( ! this . hostAllowlist ) {
185
+ normalizeHostAllowList ( ) {
186
+ if ( ! this . hostAllowList ) {
185
187
return ;
186
188
}
187
189
188
- return this . hostAllowlist . map ( function ( entry ) {
190
+ return this . hostAllowList . map ( function ( entry ) {
189
191
// Is a regex
190
192
if ( entry . source ) {
191
193
return '/' + entry . source + '/' ;
0 commit comments