@@ -80,7 +80,8 @@ class WebDevFS {
8080 }) async {
8181 final mainPath = mainUri.toFilePath ();
8282 final outputDirectory = fileSystem.directory (
83- fileSystem.file (projectDirectory.resolve (mainPath)).parent.path);
83+ fileSystem.file (projectDirectory.resolve (mainPath)).parent.path,
84+ );
8485 final entryPoint = mainUri.toString ();
8586
8687 var prefix = '' ;
@@ -99,10 +100,9 @@ class WebDevFS {
99100 final bootstrap = '${prefix }main_module.bootstrap.js' ;
100101
101102 assetServer.writeFile (
102- entryPoint,
103- fileSystem
104- .file (projectDirectory.resolve (mainPath))
105- .readAsStringSync ());
103+ entryPoint,
104+ fileSystem.file (projectDirectory.resolve (mainPath)).readAsStringSync (),
105+ );
106106 assetServer.writeFile (stackMapper, stackTraceMapper.readAsStringSync ());
107107
108108 switch (ddcModuleFormat) {
@@ -118,27 +118,32 @@ class WebDevFS {
118118 );
119119 assetServer.writeFile (
120120 bootstrap,
121- generateMainModule (
122- entrypoint: entryPoint,
123- ),
121+ generateMainModule (entrypoint: entryPoint),
124122 );
125123 break ;
126124 case ModuleFormat .ddc:
127125 assetServer.writeFile (
128- ddcModuleLoader, ddcModuleLoaderJS.readAsStringSync ());
126+ ddcModuleLoader,
127+ ddcModuleLoaderJS.readAsStringSync (),
128+ );
129129 String bootstrapper;
130130 String mainModule;
131131 if (compilerOptions.canaryFeatures) {
132132 bootstrapper = generateDDCLibraryBundleBootstrapScript (
133- ddcModuleLoaderUrl: ddcModuleLoader,
134- mapperUrl: stackMapper,
135- entrypoint: entryPoint,
136- bootstrapUrl: bootstrap);
133+ ddcModuleLoaderUrl: ddcModuleLoader,
134+ mapperUrl: stackMapper,
135+ entrypoint: entryPoint,
136+ bootstrapUrl: bootstrap,
137+ );
137138 const onLoadEndBootstrap = 'on_load_end_bootstrap.js' ;
138- assetServer.writeFile (onLoadEndBootstrap,
139- generateDDCLibraryBundleOnLoadEndBootstrap ());
139+ assetServer.writeFile (
140+ onLoadEndBootstrap,
141+ generateDDCLibraryBundleOnLoadEndBootstrap (),
142+ );
140143 mainModule = generateDDCLibraryBundleMainModule (
141- entrypoint: entryPoint, onLoadEndBootstrap: onLoadEndBootstrap);
144+ entrypoint: entryPoint,
145+ onLoadEndBootstrap: onLoadEndBootstrap,
146+ );
142147 } else {
143148 bootstrapper = generateDDCBootstrapScript (
144149 ddcModuleLoaderUrl: ddcModuleLoader,
@@ -152,19 +157,16 @@ class WebDevFS {
152157 // removed, and special path elements like '/', '\', and '..' are
153158 // replaced with
154159 // '__'.
155- final exportedMainName =
156- pathToJSIdentifier (entryPoint.split ('.' )[0 ]);
160+ final exportedMainName = pathToJSIdentifier (
161+ entryPoint.split ('.' )[0 ],
162+ );
157163 mainModule = generateDDCMainModule (
158- entrypoint: entryPoint, exportedMain: exportedMainName);
164+ entrypoint: entryPoint,
165+ exportedMain: exportedMainName,
166+ );
159167 }
160- assetServer.writeFile (
161- main,
162- bootstrapper,
163- );
164- assetServer.writeFile (
165- bootstrap,
166- mainModule,
167- );
168+ assetServer.writeFile (main, bootstrapper);
169+ assetServer.writeFile (bootstrap, mainModule);
168170 break ;
169171 default :
170172 throw Exception ('Unsupported DDC module format $ddcModuleFormat .' );
@@ -198,16 +200,24 @@ class WebDevFS {
198200 File metadataFile;
199201 List <String > modules;
200202 try {
201- codeFile =
202- outputDirectory.childFile ('${compilerOutput .outputFilename }.sources' );
203- manifestFile =
204- outputDirectory.childFile ('${compilerOutput .outputFilename }.json' );
205- sourcemapFile =
206- outputDirectory.childFile ('${compilerOutput .outputFilename }.map' );
207- metadataFile = outputDirectory
208- .childFile ('${compilerOutput .outputFilename }.metadata' );
203+ codeFile = outputDirectory.childFile (
204+ '${compilerOutput .outputFilename }.sources' ,
205+ );
206+ manifestFile = outputDirectory.childFile (
207+ '${compilerOutput .outputFilename }.json' ,
208+ );
209+ sourcemapFile = outputDirectory.childFile (
210+ '${compilerOutput .outputFilename }.map' ,
211+ );
212+ metadataFile = outputDirectory.childFile (
213+ '${compilerOutput .outputFilename }.metadata' ,
214+ );
209215 modules = assetServer.write (
210- codeFile, manifestFile, sourcemapFile, metadataFile);
216+ codeFile,
217+ manifestFile,
218+ sourcemapFile,
219+ metadataFile,
220+ );
211221 } on FileSystemException catch (err) {
212222 throw Exception ('Failed to load recompiled sources:\n $err ' );
213223 }
@@ -252,34 +262,37 @@ class WebDevFS {
252262 final moduleToLibrary = < Map <String , Object >> [];
253263 for (final module in modules) {
254264 final metadata = ModuleMetadata .fromJson (
255- json.decode (utf8
256- .decode (assetServer.getMetadata ('$module .metadata' ).toList ()))
265+ json.decode (
266+ utf8.decode (assetServer.getMetadata ('$module .metadata' ).toList ()),
267+ )
257268 as Map <String , dynamic >,
258269 );
259270 final libraries = metadata.libraries.keys.toList ();
260271 moduleToLibrary.add (< String , Object > {
261272 'src' : '$fileServerUri /$module ' ,
262273 'module' : metadata.name,
263- 'libraries' : libraries
274+ 'libraries' : libraries,
264275 });
265276 }
266277 assetServer.writeFile (
267- reloadedSourcesFileName, json.encode (moduleToLibrary));
278+ reloadedSourcesFileName,
279+ json.encode (moduleToLibrary),
280+ );
268281 }
269282
270283 File get ddcModuleLoaderJS =>
271284 fileSystem.file (sdkLayout.ddcModuleLoaderJsPath);
272285 File get requireJS => fileSystem.file (sdkLayout.requireJsPath);
273286 File get dartSdk => fileSystem.file (switch (ddcModuleFormat) {
274- ModuleFormat .amd => sdkLayout.amdJsPath,
275- ModuleFormat .ddc => sdkLayout.ddcJsPath,
276- _ => throw Exception ('Unsupported DDC module format $ddcModuleFormat .' )
277- });
287+ ModuleFormat .amd => sdkLayout.amdJsPath,
288+ ModuleFormat .ddc => sdkLayout.ddcJsPath,
289+ _ => throw Exception ('Unsupported DDC module format $ddcModuleFormat .' ),
290+ });
278291 File get dartSdkSourcemap => fileSystem.file (switch (ddcModuleFormat) {
279- ModuleFormat .amd => sdkLayout.amdJsMapPath,
280- ModuleFormat .ddc => sdkLayout.ddcJsMapPath,
281- _ => throw Exception ('Unsupported DDC module format $ddcModuleFormat .' )
282- });
292+ ModuleFormat .amd => sdkLayout.amdJsMapPath,
293+ ModuleFormat .ddc => sdkLayout.ddcJsMapPath,
294+ _ => throw Exception ('Unsupported DDC module format $ddcModuleFormat .' ),
295+ });
283296 File get stackTraceMapper => fileSystem.file (sdkLayout.stackTraceMapperPath);
284297 ModuleFormat get ddcModuleFormat => compilerOptions.moduleFormat;
285298}
@@ -293,9 +306,9 @@ class UpdateFSReport {
293306 bool success = false ,
294307 int invalidatedSourcesCount = 0 ,
295308 int syncedBytes = 0 ,
296- }) : _success = success,
297- _invalidatedSourcesCount = invalidatedSourcesCount,
298- _syncedBytes = syncedBytes;
309+ }) : _success = success,
310+ _invalidatedSourcesCount = invalidatedSourcesCount,
311+ _syncedBytes = syncedBytes;
299312
300313 bool get success => _success;
301314 int get invalidatedSourcesCount => _invalidatedSourcesCount;
@@ -319,7 +332,7 @@ class InvalidationResult {
319332/// application to determine when they are dirty.
320333class ProjectFileInvalidator {
321334 ProjectFileInvalidator ({required FileSystem fileSystem})
322- : _fileSystem = fileSystem;
335+ : _fileSystem = fileSystem;
323336
324337 final FileSystem _fileSystem;
325338
@@ -349,8 +362,8 @@ class ProjectFileInvalidator {
349362 final updatedAt = uri.hasScheme && uri.scheme != 'file'
350363 ? _fileSystem.file (uri).statSync ().modified
351364 : _fileSystem
352- .statSync (uri.toFilePath (windows: Platform .isWindows))
353- .modified;
365+ .statSync (uri.toFilePath (windows: Platform .isWindows))
366+ .modified;
354367 if (updatedAt.isAfter (lastCompiled)) {
355368 invalidatedFiles.add (uri);
356369 }
0 commit comments