1
1
import { tags } from "@angular-devkit/core" ;
2
2
import { createTypescriptContext , transformTypescript } from "@ngtools/webpack/src/transformers" ;
3
3
import { nsReplaceBootstrap } from './ns-replace-bootstrap' ;
4
- import { nsSupportHmrNg , getHandleHmrOptionsCode , getAcceptMainModuleCode , GeneratedDynamicAppOptions } from "./ns-support-hmr-ng" ;
4
+ import { nsSupportHmrNg , getHmrOptionsCode , getAcceptMainModuleCode , GeneratedDynamicAppOptions } from "./ns-support-hmr-ng" ;
5
5
import { AngularCompilerPlugin } from "@ngtools/webpack" ;
6
6
7
7
describe ( "@ngtools/webpack transformers" , ( ) => {
@@ -14,282 +14,321 @@ describe("@ngtools/webpack transformers", () => {
14
14
const handleHmrOptionsDeclaration = `var ${ GeneratedDynamicAppOptions } = {};` ;
15
15
const nsStaticPlatformCall = `nativescript_angular_platform_Generated.platformNativeScript` ;
16
16
const nsDynamicPlatformCall = `nativescript_angular_platform_Generated.platformNativeScriptDynamic` ;
17
- const handleHmrOptionsCode = getHandleHmrOptionsCode ( "AppModule" , "./app/app.module" ) ;
17
+ const handleHmrOptionsCode = getHmrOptionsCode ( "AppModule" , "./app/app.module" ) ;
18
18
const acceptMainModuleCode = getAcceptMainModuleCode ( "./app/app.module" ) ;
19
- const handleHmrOptionsAotCode = getHandleHmrOptionsCode ( "AppModuleNgFactory" , "./test-file.ts.ngfactory" ) ;
19
+ const handleHmrOptionsAotCode = getHmrOptionsCode ( "AppModuleNgFactory" , "./test-file.ts.ngfactory" ) ;
20
20
const acceptMainModuleAotCode = getAcceptMainModuleCode ( "./test-file.ts.ngfactory" ) ;
21
+ const getAppOptions = ( currentAppOptionsString ?: string ) => {
22
+ return `Object.assign(${ currentAppOptionsString || "{}" } , ${ GeneratedDynamicAppOptions } )`
23
+ } ;
24
+ const defaultAppOptions = getAppOptions ( ) ;
21
25
const testCases = [ {
22
26
name : "should handle HMR when platformNativeScriptDynamic is called without arguments" ,
23
27
rawFile : `
24
- import { platformNativeScriptDynamic } from "nativescript-angular/platform";
25
- import { AppModule } from "./app/app.module";
26
- platformNativeScriptDynamic().bootstrapModule(AppModule);
27
- ` ,
28
+ import { platformNativeScriptDynamic } from "nativescript-angular/platform";
29
+ import { AppModule } from "./app/app.module";
30
+ platformNativeScriptDynamic().bootstrapModule(AppModule);
31
+ ` ,
28
32
transformedFile : `
29
- ${ handleHmrPlatformDynamicImport }
30
- import { AppModule } from "./app/app.module";
33
+ ${ handleHmrPlatformDynamicImport }
34
+ import { AppModule } from "./app/app.module";
31
35
32
- ${ handleHmrOptionsDeclaration }
33
- ${ handleHmrOptionsCode }
34
- ${ acceptMainModuleCode }
36
+ ${ handleHmrOptionsDeclaration }
37
+ ${ handleHmrOptionsCode }
38
+ ${ acceptMainModuleCode }
35
39
36
- ${ nsDynamicPlatformCall } (${ GeneratedDynamicAppOptions } ).bootstrapModule(AppModule);
37
- ` ,
40
+ ${ nsDynamicPlatformCall } (${ defaultAppOptions } ).bootstrapModule(AppModule);
41
+ ` ,
38
42
transformedFileWithAot : `
39
- ${ handleHmrPlatformStaticImport }
40
- ${ handleAotPlatformStaticImport }
41
- ${ handleAotNgFactoryImport }
43
+ ${ handleHmrPlatformStaticImport }
44
+ ${ handleAotPlatformStaticImport }
45
+ ${ handleAotNgFactoryImport }
42
46
43
- ${ handleHmrOptionsDeclaration }
44
- ${ handleHmrOptionsAotCode }
45
- ${ acceptMainModuleAotCode }
47
+ ${ handleHmrOptionsDeclaration }
48
+ ${ handleHmrOptionsAotCode }
49
+ ${ acceptMainModuleAotCode }
46
50
47
- ${ nsStaticPlatformCall } (${ GeneratedDynamicAppOptions } ).bootstrapModuleFactory(${ nsFactoryImportName } .AppModuleNgFactory);
48
- `
51
+ ${ nsStaticPlatformCall } (${ defaultAppOptions } ).bootstrapModuleFactory(${ nsFactoryImportName } .AppModuleNgFactory);
52
+ `
49
53
} ,
50
54
{
51
55
name : "should not handle HMR when the AppModule import cannot be found" ,
52
56
rawFile : `
53
- import { platformNativeScriptDynamic } from "nativescript-angular/platform";
54
- platformNativeScriptDynamic().bootstrapModule(SyntaxErrorModule);
55
- ` ,
57
+ import { platformNativeScriptDynamic } from "nativescript-angular/platform";
58
+ platformNativeScriptDynamic().bootstrapModule(SyntaxErrorModule);
59
+ ` ,
56
60
transformedFile : `
57
- import { platformNativeScriptDynamic } from "nativescript-angular/platform";
58
- platformNativeScriptDynamic().bootstrapModule(SyntaxErrorModule);
59
- ` ,
61
+ import { platformNativeScriptDynamic } from "nativescript-angular/platform";
62
+ platformNativeScriptDynamic().bootstrapModule(SyntaxErrorModule);
63
+ ` ,
60
64
transformedFileWithAot : `
61
- import { platformNativeScriptDynamic } from "nativescript-angular/platform";
62
- platformNativeScriptDynamic().bootstrapModule(SyntaxErrorModule);
63
- `
65
+ import { platformNativeScriptDynamic } from "nativescript-angular/platform";
66
+ platformNativeScriptDynamic().bootstrapModule(SyntaxErrorModule);
67
+ `
64
68
} ,
65
69
{
66
70
name : "(known limitation) should not handle HMR when the platformNativeScriptDynamic method is renamed" ,
67
71
rawFile : `
68
- import { platformNativeScriptDynamic as x } from "nativescript-angular/platform";
69
- x().bootstrapModule(SyntaxErrorModule);
70
- ` ,
72
+ import { platformNativeScriptDynamic as x } from "nativescript-angular/platform";
73
+ x().bootstrapModule(SyntaxErrorModule);
74
+ ` ,
71
75
transformedFile : `
72
- import { platformNativeScriptDynamic as x } from "nativescript-angular/platform";
73
- x().bootstrapModule(SyntaxErrorModule);
74
- ` ,
76
+ import { platformNativeScriptDynamic as x } from "nativescript-angular/platform";
77
+ x().bootstrapModule(SyntaxErrorModule);
78
+ ` ,
75
79
transformedFileWithAot : `
76
- import { platformNativeScriptDynamic as x } from "nativescript-angular/platform";
77
- x().bootstrapModule(SyntaxErrorModule);
78
- `
80
+ import { platformNativeScriptDynamic as x } from "nativescript-angular/platform";
81
+ x().bootstrapModule(SyntaxErrorModule);
82
+ `
79
83
} ,
80
84
{
81
85
name : "(known limitation) should not handle HMR when the bootstrapModule method is renamed" ,
82
86
rawFile : `
83
- import { platformNativeScriptDynamic } from "nativescript-angular/platform";
87
+ import { platformNativeScriptDynamic } from "nativescript-angular/platform";
84
88
85
- const x = platformNativeScriptDynamic().bootstrapModule;
86
- x(SyntaxErrorModule);
87
- ` ,
89
+ const x = platformNativeScriptDynamic().bootstrapModule;
90
+ x(SyntaxErrorModule);
91
+ ` ,
88
92
transformedFile : `
89
- import { platformNativeScriptDynamic } from "nativescript-angular/platform";
93
+ import { platformNativeScriptDynamic } from "nativescript-angular/platform";
90
94
91
- const x = platformNativeScriptDynamic().bootstrapModule;
92
- x(SyntaxErrorModule);
93
- ` ,
95
+ const x = platformNativeScriptDynamic().bootstrapModule;
96
+ x(SyntaxErrorModule);
97
+ ` ,
94
98
transformedFileWithAot : `
95
- import { platformNativeScriptDynamic } from "nativescript-angular/platform";
99
+ import { platformNativeScriptDynamic } from "nativescript-angular/platform";
96
100
97
- const x = platformNativeScriptDynamic().bootstrapModule;
98
- x(SyntaxErrorModule);
99
- `
101
+ const x = platformNativeScriptDynamic().bootstrapModule;
102
+ x(SyntaxErrorModule);
103
+ `
100
104
} ,
101
105
{
102
106
name : "should handle HMR when AOT is manually configured" ,
103
107
rawFile : `
104
- import { platformNativeScript } from "nativescript-angular/platform-static";
105
- import { AppModuleNgFactory } from "./app/app.module.ngfactory";
106
- platformNativeScript().bootstrapModuleFactory(AppModuleNgFactory);
107
- ` ,
108
+ import { platformNativeScript } from "nativescript-angular/platform-static";
109
+ import { AppModuleNgFactory } from "./app/app.module.ngfactory";
110
+ platformNativeScript().bootstrapModuleFactory(AppModuleNgFactory);
111
+ ` ,
108
112
transformedFile : `
109
- ${ handleHmrPlatformStaticImport }
110
- import { AppModuleNgFactory } from "./app/app.module.ngfactory";
113
+ ${ handleHmrPlatformStaticImport }
114
+ import { AppModuleNgFactory } from "./app/app.module.ngfactory";
111
115
112
- ${ handleHmrOptionsDeclaration }
113
- ${ getHandleHmrOptionsCode ( "AppModuleNgFactory" , "./app/app.module.ngfactory" ) }
114
- ${ getAcceptMainModuleCode ( "./app/app.module.ngfactory" ) }
116
+ ${ handleHmrOptionsDeclaration }
117
+ ${ getHmrOptionsCode ( "AppModuleNgFactory" , "./app/app.module.ngfactory" ) }
118
+ ${ getAcceptMainModuleCode ( "./app/app.module.ngfactory" ) }
115
119
116
- ${ nsStaticPlatformCall } (${ GeneratedDynamicAppOptions } ).bootstrapModuleFactory(AppModuleNgFactory);
117
- ` ,
120
+ ${ nsStaticPlatformCall } (${ defaultAppOptions } ).bootstrapModuleFactory(AppModuleNgFactory);
121
+ ` ,
118
122
transformedFileWithAot : `
119
- ${ handleHmrPlatformStaticImport }
120
- import { AppModuleNgFactory } from "./app/app.module.ngfactory";
123
+ ${ handleHmrPlatformStaticImport }
124
+ import { AppModuleNgFactory } from "./app/app.module.ngfactory";
121
125
122
- ${ handleHmrOptionsDeclaration }
123
- ${ getHandleHmrOptionsCode ( "AppModuleNgFactory" , "./app/app.module.ngfactory" ) }
124
- ${ getAcceptMainModuleCode ( "./app/app.module.ngfactory" ) }
126
+ ${ handleHmrOptionsDeclaration }
127
+ ${ getHmrOptionsCode ( "AppModuleNgFactory" , "./app/app.module.ngfactory" ) }
128
+ ${ getAcceptMainModuleCode ( "./app/app.module.ngfactory" ) }
125
129
126
- ${ nsStaticPlatformCall } (${ GeneratedDynamicAppOptions } ).bootstrapModuleFactory(AppModuleNgFactory);
127
- `
130
+ ${ nsStaticPlatformCall } (${ defaultAppOptions } ).bootstrapModuleFactory(AppModuleNgFactory);
131
+ `
128
132
} ,
129
133
{
130
134
name : "should handle HMR when platformNativeScriptDynamic is called without arguments and non default app module" ,
131
135
customAppModuleName : "CustomModule" ,
132
136
rawFile : `
133
- import { platformNativeScriptDynamic } from "nativescript-angular/platform";
134
- import { CustomModule } from "./custom/custom.module";
135
- platformNativeScriptDynamic().bootstrapModule(CustomModule);
136
- ` ,
137
+ import { platformNativeScriptDynamic } from "nativescript-angular/platform";
138
+ import { CustomModule } from "./custom/custom.module";
139
+ platformNativeScriptDynamic().bootstrapModule(CustomModule);
140
+ ` ,
137
141
transformedFile : `
138
- ${ handleHmrPlatformDynamicImport }
139
- import { CustomModule } from "./custom/custom.module";
142
+ ${ handleHmrPlatformDynamicImport }
143
+ import { CustomModule } from "./custom/custom.module";
140
144
141
- ${ handleHmrOptionsDeclaration }
142
- ${ getHandleHmrOptionsCode ( "CustomModule" , "./custom/custom.module" ) }
143
- ${ getAcceptMainModuleCode ( "./custom/custom.module" ) }
145
+ ${ handleHmrOptionsDeclaration }
146
+ ${ getHmrOptionsCode ( "CustomModule" , "./custom/custom.module" ) }
147
+ ${ getAcceptMainModuleCode ( "./custom/custom.module" ) }
144
148
145
- ${ nsDynamicPlatformCall } (${ GeneratedDynamicAppOptions } ).bootstrapModule(CustomModule);
146
- ` ,
149
+ ${ nsDynamicPlatformCall } (${ defaultAppOptions } ).bootstrapModule(CustomModule);
150
+ ` ,
147
151
transformedFileWithAot : `
148
- ${ handleHmrPlatformStaticImport }
149
- ${ handleAotPlatformStaticImport }
150
- ${ handleAotNgFactoryImport }
152
+ ${ handleHmrPlatformStaticImport }
153
+ ${ handleAotPlatformStaticImport }
154
+ ${ handleAotNgFactoryImport }
151
155
152
- ${ handleHmrOptionsDeclaration }
153
- ${ getHandleHmrOptionsCode ( "CustomModuleNgFactory" , "./test-file.ts.ngfactory" ) }
154
- ${ getAcceptMainModuleCode ( "./test-file.ts.ngfactory" ) }
156
+ ${ handleHmrOptionsDeclaration }
157
+ ${ getHmrOptionsCode ( "CustomModuleNgFactory" , "./test-file.ts.ngfactory" ) }
158
+ ${ getAcceptMainModuleCode ( "./test-file.ts.ngfactory" ) }
155
159
156
- ${ nsStaticPlatformCall } (${ GeneratedDynamicAppOptions } ).bootstrapModuleFactory(${ nsFactoryImportName } .CustomModuleNgFactory);
157
- `
160
+ ${ nsStaticPlatformCall } (${ defaultAppOptions } ).bootstrapModuleFactory(${ nsFactoryImportName } .CustomModuleNgFactory);
161
+ `
158
162
} ,
159
163
{
160
164
name : "should handle HMR when platformNativeScriptDynamic is called from * import" ,
161
165
rawFile : `
162
- import * as nsNgPlatform from "nativescript-angular/platform";
163
- import { AppModule } from "./app/app.module";
164
- nsNgPlatform.platformNativeScriptDynamic().bootstrapModule(AppModule);
165
- ` ,
166
+ import * as nsNgPlatform from "nativescript-angular/platform";
167
+ import { AppModule } from "./app/app.module";
168
+ nsNgPlatform.platformNativeScriptDynamic().bootstrapModule(AppModule);
169
+ ` ,
166
170
transformedFile : `
167
- ${ handleHmrPlatformDynamicImport }
168
- import { AppModule } from "./app/app.module";
171
+ ${ handleHmrPlatformDynamicImport }
172
+ import { AppModule } from "./app/app.module";
169
173
170
- ${ handleHmrOptionsDeclaration }
171
- ${ handleHmrOptionsCode }
172
- ${ acceptMainModuleCode }
174
+ ${ handleHmrOptionsDeclaration }
175
+ ${ handleHmrOptionsCode }
176
+ ${ acceptMainModuleCode }
173
177
174
- ${ nsDynamicPlatformCall } (${ GeneratedDynamicAppOptions } ).bootstrapModule(AppModule);
175
- ` ,
178
+ ${ nsDynamicPlatformCall } (${ defaultAppOptions } ).bootstrapModule(AppModule);
179
+ ` ,
176
180
transformedFileWithAot : `
177
- ${ handleHmrPlatformStaticImport }
178
- ${ handleAotPlatformStaticImport }
179
- ${ handleAotNgFactoryImport }
181
+ ${ handleHmrPlatformStaticImport }
182
+ ${ handleAotPlatformStaticImport }
183
+ ${ handleAotNgFactoryImport }
180
184
181
- ${ handleHmrOptionsDeclaration }
182
- ${ handleHmrOptionsAotCode }
183
- ${ acceptMainModuleAotCode }
185
+ ${ handleHmrOptionsDeclaration }
186
+ ${ handleHmrOptionsAotCode }
187
+ ${ acceptMainModuleAotCode }
184
188
185
- ${ nsStaticPlatformCall } (${ GeneratedDynamicAppOptions } ).bootstrapModuleFactory(${ nsFactoryImportName } .AppModuleNgFactory);
186
- `
189
+ ${ nsStaticPlatformCall } (${ defaultAppOptions } ).bootstrapModuleFactory(${ nsFactoryImportName } .AppModuleNgFactory);
190
+ `
187
191
} ,
188
192
{
189
193
name : "should handle HMR when platformNativeScriptDynamic is called with inline appOptions" ,
190
194
rawFile : `
191
- import { platformNativeScriptDynamic } from "nativescript-angular/platform";
192
- import { AppModule } from "./app/app.module";
193
- platformNativeScriptDynamic({ bootInExistingPage: true }).bootstrapModule(AppModule);
194
- ` ,
195
+ import { platformNativeScriptDynamic } from "nativescript-angular/platform";
196
+ import { AppModule } from "./app/app.module";
197
+ platformNativeScriptDynamic({ bootInExistingPage: true }).bootstrapModule(AppModule);
198
+ ` ,
195
199
transformedFile : `
196
- ${ handleHmrPlatformDynamicImport }
197
- import { AppModule } from "./app/app.module";
200
+ ${ handleHmrPlatformDynamicImport }
201
+ import { AppModule } from "./app/app.module";
198
202
199
- var ${ GeneratedDynamicAppOptions } = { bootInExistingPage: true };
200
- ${ handleHmrOptionsCode }
201
- ${ acceptMainModuleCode }
203
+ ${ handleHmrOptionsDeclaration }
204
+ ${ handleHmrOptionsCode }
205
+ ${ acceptMainModuleCode }
202
206
203
- ${ nsDynamicPlatformCall } (${ GeneratedDynamicAppOptions } ).bootstrapModule(AppModule);
204
- ` ,
207
+ ${ nsDynamicPlatformCall } (${ getAppOptions ( "{ bootInExistingPage: true }" ) } ).bootstrapModule(AppModule);
208
+ ` ,
205
209
transformedFileWithAot : `
206
- ${ handleHmrPlatformStaticImport }
207
- ${ handleAotPlatformStaticImport }
208
- ${ handleAotNgFactoryImport }
210
+ ${ handleHmrPlatformStaticImport }
211
+ ${ handleAotPlatformStaticImport }
212
+ ${ handleAotNgFactoryImport }
209
213
210
- var ${ GeneratedDynamicAppOptions } = { bootInExistingPage: true };
211
- ${ handleHmrOptionsAotCode }
212
- ${ acceptMainModuleAotCode }
214
+ ${ handleHmrOptionsDeclaration }
215
+ ${ handleHmrOptionsAotCode }
216
+ ${ acceptMainModuleAotCode }
213
217
214
- ${ nsStaticPlatformCall } (${ GeneratedDynamicAppOptions } ).bootstrapModuleFactory(${ nsFactoryImportName } .AppModuleNgFactory);
215
- `
218
+ ${ nsStaticPlatformCall } (${ getAppOptions ( "{ bootInExistingPage: true }" ) } ).bootstrapModuleFactory(${ nsFactoryImportName } .AppModuleNgFactory);
219
+ `
216
220
} ,
221
+ {
222
+ name : "should handle HMR when platformNativeScriptDynamic is called with appOptions variable" ,
223
+ rawFile : `
224
+ import { platformNativeScriptDynamic } from "nativescript-angular/platform";
225
+ import { AppModule } from "./app/app.module";
226
+ const appOptions = { bootInExistingPage: true };
227
+ platformNativeScriptDynamic(appOptions).bootstrapModule(AppModule);
228
+ ` ,
229
+ transformedFile : `
230
+ ${ handleHmrPlatformDynamicImport }
231
+ import { AppModule } from "./app/app.module";
232
+
233
+ var ${ GeneratedDynamicAppOptions } = {};
234
+ ${ handleHmrOptionsCode }
235
+ ${ acceptMainModuleCode }
236
+
237
+ const appOptions = { bootInExistingPage: true };
238
+
239
+ ${ nsDynamicPlatformCall } (${ getAppOptions ( "appOptions" ) } ).bootstrapModule(AppModule);
240
+ ` ,
241
+ transformedFileWithAot : `
242
+ ${ handleHmrPlatformStaticImport }
243
+ ${ handleAotPlatformStaticImport }
244
+ ${ handleAotNgFactoryImport }
245
+
246
+ var ${ GeneratedDynamicAppOptions } = {};
247
+ ${ handleHmrOptionsAotCode }
248
+ ${ acceptMainModuleAotCode }
249
+
250
+ const appOptions = { bootInExistingPage: true };
251
+
252
+ ${ nsStaticPlatformCall } (${ getAppOptions ( "appOptions" ) } ).bootstrapModuleFactory(${ nsFactoryImportName } .AppModuleNgFactory);
253
+ `
254
+ } ,
255
+
217
256
{
218
257
name : "should handle HMR when platformNativeScriptDynamic is called with multiple arguments" ,
219
258
rawFile : `
220
- import { platformNativeScriptDynamic } from "nativescript-angular/platform";
221
- import { AppModule } from "./app/app.module";
222
- platformNativeScriptDynamic({ bootInExistingPage: true }, ["provider1", "provider2"]).bootstrapModule(AppModule);
223
- ` ,
259
+ import { platformNativeScriptDynamic } from "nativescript-angular/platform";
260
+ import { AppModule } from "./app/app.module";
261
+ platformNativeScriptDynamic({ bootInExistingPage: true }, ["provider1", "provider2"]).bootstrapModule(AppModule);
262
+ ` ,
224
263
transformedFile : `
225
- ${ handleHmrPlatformDynamicImport }
226
- import { AppModule } from "./app/app.module";
264
+ ${ handleHmrPlatformDynamicImport }
265
+ import { AppModule } from "./app/app.module";
227
266
228
- var ${ GeneratedDynamicAppOptions } = { bootInExistingPage: true };
229
- ${ handleHmrOptionsCode }
230
- ${ acceptMainModuleCode }
267
+ ${ handleHmrOptionsDeclaration }
268
+ ${ handleHmrOptionsCode }
269
+ ${ acceptMainModuleCode }
231
270
232
- ${ nsDynamicPlatformCall } (${ GeneratedDynamicAppOptions } , ["provider1", "provider2"]).bootstrapModule(AppModule);
233
- ` ,
271
+ ${ nsDynamicPlatformCall } (${ getAppOptions ( "{ bootInExistingPage: true }" ) } , ["provider1", "provider2"]).bootstrapModule(AppModule);
272
+ ` ,
234
273
transformedFileWithAot : `
235
- ${ handleHmrPlatformStaticImport }
236
- ${ handleAotPlatformStaticImport }
237
- ${ handleAotNgFactoryImport }
274
+ ${ handleHmrPlatformStaticImport }
275
+ ${ handleAotPlatformStaticImport }
276
+ ${ handleAotNgFactoryImport }
238
277
239
- var ${ GeneratedDynamicAppOptions } = { bootInExistingPage: true };
240
- ${ handleHmrOptionsAotCode }
241
- ${ acceptMainModuleAotCode }
278
+ ${ handleHmrOptionsDeclaration }
279
+ ${ handleHmrOptionsAotCode }
280
+ ${ acceptMainModuleAotCode }
242
281
243
- ${ nsStaticPlatformCall } (${ GeneratedDynamicAppOptions } , ["provider1", "provider2"]).bootstrapModuleFactory(${ nsFactoryImportName } .AppModuleNgFactory);
244
- `
282
+ ${ nsStaticPlatformCall } (${ getAppOptions ( "{ bootInExistingPage: true }" ) } , ["provider1", "provider2"]).bootstrapModuleFactory(${ nsFactoryImportName } .AppModuleNgFactory);
283
+ `
245
284
} ,
246
285
{
247
286
name : "should accept HMR before the user when custom handling is in place" ,
248
287
rawFile : `
249
- import { platformNativeScriptDynamic } from "nativescript-angular/platform";
250
- import { AppModule } from "./app/app.module";
288
+ import { platformNativeScriptDynamic } from "nativescript-angular/platform";
289
+ import { AppModule } from "./app/app.module";
251
290
252
- if (module["hot"]) {
253
- module["hot"].accept(["./app/app.module"], function () {
254
- // customHandling
255
- });
256
- }
291
+ if (module["hot"]) {
292
+ module["hot"].accept(["./app/app.module"], function () {
293
+ // customHandling
294
+ });
295
+ }
257
296
258
- platformNativeScriptDynamic().bootstrapModule(AppModule);
259
- ` ,
297
+ platformNativeScriptDynamic().bootstrapModule(AppModule);
298
+ ` ,
260
299
transformedFile : `
261
- ${ handleHmrPlatformDynamicImport }
262
- import { AppModule } from "./app/app.module";
300
+ ${ handleHmrPlatformDynamicImport }
301
+ import { AppModule } from "./app/app.module";
263
302
264
- ${ handleHmrOptionsDeclaration }
265
- ${ handleHmrOptionsCode }
266
- ${ acceptMainModuleCode }
303
+ ${ handleHmrOptionsDeclaration }
304
+ ${ handleHmrOptionsCode }
305
+ ${ acceptMainModuleCode }
267
306
268
- if (module["hot"]) {
269
- module["hot"].accept(["./app/app.module"], function () {
270
- // customHandling
271
- });
272
- }
307
+ if (module["hot"]) {
308
+ module["hot"].accept(["./app/app.module"], function () {
309
+ // customHandling
310
+ });
311
+ }
273
312
274
- ${ nsDynamicPlatformCall } (${ GeneratedDynamicAppOptions } ).bootstrapModule(AppModule);
275
- ` ,
313
+ ${ nsDynamicPlatformCall } (${ defaultAppOptions } ).bootstrapModule(AppModule);
314
+ ` ,
276
315
transformedFileWithAot : `
277
- ${ handleHmrPlatformStaticImport }
278
- ${ handleAotPlatformStaticImport }
279
- ${ handleAotNgFactoryImport }
280
-
281
- ${ handleHmrOptionsDeclaration }
282
- ${ handleHmrOptionsAotCode }
283
- ${ acceptMainModuleAotCode }
284
-
285
- if (module["hot"]) {
286
- module["hot"].accept(["./app/app.module"], function () {
287
- // customHandling
288
- });
289
- }
290
-
291
- ${ nsStaticPlatformCall } (${ GeneratedDynamicAppOptions } ).bootstrapModuleFactory(${ nsFactoryImportName } .AppModuleNgFactory);
292
- `
316
+ ${ handleHmrPlatformStaticImport }
317
+ ${ handleAotPlatformStaticImport }
318
+ ${ handleAotNgFactoryImport }
319
+
320
+ ${ handleHmrOptionsDeclaration }
321
+ ${ handleHmrOptionsAotCode }
322
+ ${ acceptMainModuleAotCode }
323
+
324
+ if (module["hot"]) {
325
+ module["hot"].accept(["./app/app.module"], function () {
326
+ // customHandling
327
+ });
328
+ }
329
+
330
+ ${ nsStaticPlatformCall } (${ defaultAppOptions } ).bootstrapModuleFactory(${ nsFactoryImportName } .AppModuleNgFactory);
331
+ `
293
332
}
294
333
] ;
295
334
testCases . forEach ( ( testCase : any ) => {
0 commit comments