@@ -28,35 +28,20 @@ class BuildWebCommand extends BuildSubCommand {
28
28
usesBuildNameOption ();
29
29
addBuildModeFlags (verboseHelp: verboseHelp, excludeDebug: true );
30
30
usesDartDefineOption ();
31
- usesWebRendererOption ();
32
31
addEnableExperimentation (hide: ! verboseHelp);
33
32
addNullSafetyModeOptions (hide: ! verboseHelp);
34
33
addNativeNullAssertions ();
35
- argParser.addFlag ('csp' ,
36
- negatable: false ,
37
- help: 'Disable dynamic generation of code in the generated output. '
38
- 'This is necessary to satisfy CSP restrictions (see http://www.w3.org/TR/CSP/).'
39
- );
40
- argParser.addFlag (
41
- 'source-maps' ,
42
- help: 'Generate a sourcemap file. These can be used by browsers '
43
- 'to view and debug the original source code of a compiled and minified Dart '
44
- 'application.'
45
- );
46
-
47
- if (featureFlags.isFlutterWebWasmEnabled) {
48
- argParser.addFlag (
49
- 'wasm' ,
50
- help: 'Compile to WebAssembly rather than JavaScript (experimental).' ,
51
- );
52
- } else {
53
- // Add the flag as hidden. Will give a helpful error message in [runCommand] below.
54
- argParser.addFlag (
55
- 'wasm' ,
56
- hide: true ,
57
- );
58
- }
59
34
35
+ //
36
+ // Flutter web-specific options
37
+ //
38
+ argParser.addSeparator ('Flutter web options' );
39
+ argParser.addOption ('base-href' ,
40
+ help: 'Overrides the href attribute of the <base> tag in web/index.html. '
41
+ 'No change is done to web/index.html file if this flag is not provided. '
42
+ 'The value has to start and end with a slash "/". '
43
+ 'For more information: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base'
44
+ );
60
45
argParser.addOption ('pwa-strategy' ,
61
46
defaultsTo: kOfflineFirst,
62
47
help: 'The caching strategy to be used by the PWA service worker.' ,
@@ -74,11 +59,22 @@ class BuildWebCommand extends BuildSubCommand {
74
59
'is not desirable' ,
75
60
},
76
61
);
77
- argParser.addOption ('base-href' ,
78
- help: 'Overrides the href attribute of the <base> tag in web/index.html. '
79
- 'No change is done to web/index.html file if this flag is not provided. '
80
- 'The value has to start and end with a slash "/". '
81
- 'For more information: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base'
62
+ usesWebRendererOption ();
63
+
64
+ //
65
+ // JavaScript compilation options
66
+ //
67
+ argParser.addSeparator ('JavaScript compilation options' );
68
+ argParser.addFlag ('csp' ,
69
+ negatable: false ,
70
+ help: 'Disable dynamic generation of code in the generated output. '
71
+ 'This is necessary to satisfy CSP restrictions (see http://www.w3.org/TR/CSP/).'
72
+ );
73
+ argParser.addFlag (
74
+ 'source-maps' ,
75
+ help: 'Generate a sourcemap file. These can be used by browsers '
76
+ 'to view and debug the original source code of a compiled and minified Dart '
77
+ 'application.'
82
78
);
83
79
argParser.addOption ('dart2js-optimization' ,
84
80
help: 'Sets the optimization level used for Dart compilation to JavaScript. '
@@ -93,6 +89,24 @@ class BuildWebCommand extends BuildSubCommand {
93
89
help: 'Disables the frequency based minifier. '
94
90
'Useful for comparing the output between builds.'
95
91
);
92
+
93
+ //
94
+ // Experimental options
95
+ //
96
+ if (featureFlags.isFlutterWebWasmEnabled) {
97
+ argParser.addSeparator ('Experimental options' );
98
+ argParser.addFlag (
99
+ 'wasm' ,
100
+ help: 'Compile to WebAssembly rather than JavaScript.' ,
101
+ negatable: false ,
102
+ );
103
+ } else {
104
+ // Add the flag as hidden. Will give a helpful error message in [runCommand] below.
105
+ argParser.addFlag (
106
+ 'wasm' ,
107
+ hide: true ,
108
+ );
109
+ }
96
110
}
97
111
98
112
final FileSystem _fileSystem;
0 commit comments