Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
flutter
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
ExcellentOSS
flutter
Commits
a7f9ebcc
Unverified
Commit
a7f9ebcc
authored
2 years ago
by
Kevin Moore
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Reorganize CLI flags for `build web` (#121837)
Reorganize CLI flags for `build web`
parent
9cb7a151
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
packages/flutter_tools/lib/src/commands/build_web.dart
+44
-30
44 additions, 30 deletions
packages/flutter_tools/lib/src/commands/build_web.dart
with
44 additions
and
30 deletions
packages/flutter_tools/lib/src/commands/build_web.dart
+
44
−
30
View file @
a7f9ebcc
...
...
@@ -28,35 +28,20 @@ class BuildWebCommand extends BuildSubCommand {
usesBuildNameOption
();
addBuildModeFlags
(
verboseHelp:
verboseHelp
,
excludeDebug:
true
);
usesDartDefineOption
();
usesWebRendererOption
();
addEnableExperimentation
(
hide:
!
verboseHelp
);
addNullSafetyModeOptions
(
hide:
!
verboseHelp
);
addNativeNullAssertions
();
argParser
.
addFlag
(
'csp'
,
negatable:
false
,
help:
'Disable dynamic generation of code in the generated output. '
'This is necessary to satisfy CSP restrictions (see http://www.w3.org/TR/CSP/).'
);
argParser
.
addFlag
(
'source-maps'
,
help:
'Generate a sourcemap file. These can be used by browsers '
'to view and debug the original source code of a compiled and minified Dart '
'application.'
);
if
(
featureFlags
.
isFlutterWebWasmEnabled
)
{
argParser
.
addFlag
(
'wasm'
,
help:
'Compile to WebAssembly rather than JavaScript (experimental).'
,
);
}
else
{
// Add the flag as hidden. Will give a helpful error message in [runCommand] below.
argParser
.
addFlag
(
'wasm'
,
hide:
true
,
);
}
//
// Flutter web-specific options
//
argParser
.
addSeparator
(
'Flutter web options'
);
argParser
.
addOption
(
'base-href'
,
help:
'Overrides the href attribute of the <base> tag in web/index.html. '
'No change is done to web/index.html file if this flag is not provided. '
'The value has to start and end with a slash "/". '
'For more information: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base'
);
argParser
.
addOption
(
'pwa-strategy'
,
defaultsTo:
kOfflineFirst
,
help:
'The caching strategy to be used by the PWA service worker.'
,
...
...
@@ -74,11 +59,22 @@ class BuildWebCommand extends BuildSubCommand {
'is not desirable'
,
},
);
argParser
.
addOption
(
'base-href'
,
help:
'Overrides the href attribute of the <base> tag in web/index.html. '
'No change is done to web/index.html file if this flag is not provided. '
'The value has to start and end with a slash "/". '
'For more information: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base'
usesWebRendererOption
();
//
// JavaScript compilation options
//
argParser
.
addSeparator
(
'JavaScript compilation options'
);
argParser
.
addFlag
(
'csp'
,
negatable:
false
,
help:
'Disable dynamic generation of code in the generated output. '
'This is necessary to satisfy CSP restrictions (see http://www.w3.org/TR/CSP/).'
);
argParser
.
addFlag
(
'source-maps'
,
help:
'Generate a sourcemap file. These can be used by browsers '
'to view and debug the original source code of a compiled and minified Dart '
'application.'
);
argParser
.
addOption
(
'dart2js-optimization'
,
help:
'Sets the optimization level used for Dart compilation to JavaScript. '
...
...
@@ -93,6 +89,24 @@ class BuildWebCommand extends BuildSubCommand {
help:
'Disables the frequency based minifier. '
'Useful for comparing the output between builds.'
);
//
// Experimental options
//
if
(
featureFlags
.
isFlutterWebWasmEnabled
)
{
argParser
.
addSeparator
(
'Experimental options'
);
argParser
.
addFlag
(
'wasm'
,
help:
'Compile to WebAssembly rather than JavaScript.'
,
negatable:
false
,
);
}
else
{
// Add the flag as hidden. Will give a helpful error message in [runCommand] below.
argParser
.
addFlag
(
'wasm'
,
hide:
true
,
);
}
}
final
FileSystem
_fileSystem
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment