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 . buildHostWhitelist ( ) ;
52
+ this . buildHostAllowList ( ) ;
54
53
55
54
let outputPath = path . join ( this . outputPath , 'package.json' ) ;
56
55
this . writeFileIfContentChanged ( outputPath , this . toJSONString ( ) ) ;
@@ -85,7 +84,7 @@ module.exports = class FastBootConfig extends Plugin {
85
84
86
85
buildDependencies ( ) {
87
86
let dependencies = { } ;
88
- let moduleWhitelist = [ ] ;
87
+ let moduleAllowlist = [ ] ;
89
88
let ui = this . ui ;
90
89
91
90
eachAddonPackage ( this . project , pkg => {
@@ -101,7 +100,7 @@ module.exports = class FastBootConfig extends Plugin {
101
100
return ;
102
101
}
103
102
104
- moduleWhitelist . push ( dep ) ;
103
+ moduleAllowlist . push ( dep ) ;
105
104
106
105
if ( version ) {
107
106
dependencies [ dep ] = version ;
@@ -115,7 +114,7 @@ module.exports = class FastBootConfig extends Plugin {
115
114
116
115
if ( projectDeps ) {
117
116
projectDeps . forEach ( dep => {
118
- moduleWhitelist . push ( dep ) ;
117
+ moduleAllowlist . push ( dep ) ;
119
118
120
119
let version = pkg . dependencies && pkg . dependencies [ dep ] ;
121
120
if ( version ) {
@@ -125,7 +124,7 @@ module.exports = class FastBootConfig extends Plugin {
125
124
}
126
125
127
126
this . dependencies = dependencies ;
128
- this . moduleWhitelist = uniq ( moduleWhitelist ) ;
127
+ this . moduleAllowlist = uniq ( moduleAllowlist ) ;
129
128
}
130
129
131
130
updateFastBootManifest ( manifest ) {
@@ -160,32 +159,35 @@ module.exports = class FastBootConfig extends Plugin {
160
159
this . manifest = this . updateFastBootManifest ( manifest ) ;
161
160
}
162
161
163
- buildHostWhitelist ( ) {
162
+ buildHostAllowList ( ) {
164
163
if ( this . fastbootAppConfig ) {
165
- this . hostWhitelist = this . fastbootAppConfig . hostWhitelist ;
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
169
171
toJSONString ( ) {
170
172
return stringify ( {
171
173
dependencies : this . dependencies ,
172
174
fastboot : {
173
- moduleWhitelist : this . moduleWhitelist ,
175
+ moduleAllowlist : this . moduleAllowlist ,
174
176
schemaVersion : LATEST_SCHEMA_VERSION ,
175
177
manifest : this . manifest ,
176
- hostWhitelist : this . normalizeHostWhitelist ( ) ,
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
- normalizeHostWhitelist ( ) {
184
- if ( ! this . hostWhitelist ) {
185
+ normalizeHostAllowList ( ) {
186
+ if ( ! this . hostAllowList ) {
185
187
return ;
186
188
}
187
189
188
- return this . hostWhitelist . 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