Skip to content

Commit 5063a95

Browse files
committed
change naming of unsafe compile option
1 parent 28d1217 commit 5063a95

File tree

5 files changed

+27
-28
lines changed

5 files changed

+27
-28
lines changed

build_web_compilers/lib/src/dart2js_bootstrap.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Future<void> bootstrapDart2Js(
2929
required bool onlyCompiler,
3030
String entrypointExtension = jsEntrypointExtension,
3131
String? librariesPath,
32-
bool silenceUnsupportedModulesWarnings = false,
32+
bool unsafeAllowUnsupportedModules = false,
3333
}) => _resourcePool.withResource(
3434
() => _bootstrapDart2Js(
3535
buildStep,
@@ -38,7 +38,7 @@ Future<void> bootstrapDart2Js(
3838
onlyCompiler: onlyCompiler,
3939
entrypointExtension: entrypointExtension,
4040
librariesPath: librariesPath,
41-
silenceUnsupportedModulesWarnings: silenceUnsupportedModulesWarnings,
41+
unsafeAllowUnsupportedModules: unsafeAllowUnsupportedModules,
4242
),
4343
);
4444

@@ -49,7 +49,7 @@ Future<void> _bootstrapDart2Js(
4949
required bool onlyCompiler,
5050
required String entrypointExtension,
5151
String? librariesPath,
52-
bool silenceUnsupportedModulesWarnings = false,
52+
bool unsafeAllowUnsupportedModules = false,
5353
}) async {
5454
final dartEntrypointId = buildStep.inputId;
5555
final moduleId = dartEntrypointId.changeExtension(
@@ -65,7 +65,7 @@ Future<void> _bootstrapDart2Js(
6565
try {
6666
allDeps = (await module.computeTransitiveDependencies(
6767
buildStep,
68-
throwIfUnsupported: !silenceUnsupportedModulesWarnings,
68+
throwIfUnsupported: !unsafeAllowUnsupportedModules,
6969
))..add(module);
7070
} on UnsupportedModules catch (e) {
7171
final librariesString = (await e.exactLibraries(buildStep).toList())

build_web_compilers/lib/src/dart2wasm_bootstrap.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ Future<Dart2WasmBootstrapResult> bootstrapDart2Wasm(
4646
BuildStep buildStep,
4747
List<String> additionalArguments,
4848
String javaScriptModuleExtension, {
49-
bool silenceUnsupportedModulesWarnings = false,
49+
bool unsafeAllowUnsupportedModules = false,
5050
}) async {
5151
return await _resourcePool.withResource(
5252
() => _bootstrapDart2Wasm(
5353
buildStep,
5454
additionalArguments,
5555
javaScriptModuleExtension,
56-
silenceUnsupportedModulesWarnings: silenceUnsupportedModulesWarnings,
56+
unsafeAllowUnsupportedModules: unsafeAllowUnsupportedModules,
5757
),
5858
);
5959
}
@@ -62,7 +62,7 @@ Future<Dart2WasmBootstrapResult> _bootstrapDart2Wasm(
6262
BuildStep buildStep,
6363
List<String> additionalArguments,
6464
String javaScriptModuleExtension, {
65-
bool silenceUnsupportedModulesWarnings = false,
65+
bool unsafeAllowUnsupportedModules = false,
6666
}) async {
6767
final dartEntrypointId = buildStep.inputId;
6868
final moduleId = dartEntrypointId.changeExtension(
@@ -78,7 +78,7 @@ Future<Dart2WasmBootstrapResult> _bootstrapDart2Wasm(
7878
try {
7979
allDeps = (await module.computeTransitiveDependencies(
8080
buildStep,
81-
throwIfUnsupported: !silenceUnsupportedModulesWarnings,
81+
throwIfUnsupported: !unsafeAllowUnsupportedModules,
8282
))..add(module);
8383
} on UnsupportedModules catch (e) {
8484
final librariesString = (await e.exactLibraries(buildStep).toList())

build_web_compilers/lib/src/dev_compiler_bootstrap.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Future<void> bootstrapDdc(
3737
String entrypointExtension = jsEntrypointExtension,
3838
required bool? nativeNullAssertions,
3939
bool usesWebHotReload = false,
40-
bool silenceUnsupportedModulesWarnings = false,
40+
bool unsafeAllowUnsupportedModules = false,
4141
}) async {
4242
// Ensures that the sdk resources are built and available.
4343
await _ensureResources(buildStep, requiredAssets);
@@ -57,7 +57,7 @@ Future<void> bootstrapDdc(
5757
module,
5858
buildStep,
5959
computeStronglyConnectedComponents: !usesWebHotReload,
60-
throwIfUnsupported: !silenceUnsupportedModulesWarnings,
60+
throwIfUnsupported: !unsafeAllowUnsupportedModules,
6161
);
6262
} on UnsupportedModules catch (e) {
6363
final librariesString = (await e.exactLibraries(buildStep).toList())

build_web_compilers/lib/src/web_entrypoint_builder.dart

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -134,19 +134,19 @@ final class EntrypointBuilderOptions {
134134
/// If not provided, defaults to "lib/libraries.json" in the sdk directory.
135135
final String? librariesPath;
136136

137-
/// Whether or not to silence unsupported modules warnings.
137+
/// Whether or not to allow unsupported modules.
138138
///
139139
/// If `true` then native core library imports that are not officially
140140
/// supported by the current platform will be silently allowed.
141-
final bool silenceUnsupportedModulesWarnings;
141+
final bool unsafeAllowUnsupportedModules;
142142

143143
EntrypointBuilderOptions({
144144
required this.compilers,
145145
this.nativeNullAssertions,
146146
this.loaderExtension,
147147
this.usesWebHotReload = false,
148148
this.librariesPath,
149-
this.silenceUnsupportedModulesWarnings = false,
149+
this.unsafeAllowUnsupportedModules = false,
150150
});
151151

152152
factory EntrypointBuilderOptions.fromOptions(BuilderOptions options) {
@@ -160,8 +160,8 @@ final class EntrypointBuilderOptions {
160160
const loaderOption = 'loader';
161161
const webHotReloadOption = 'web-hot-reload';
162162
const librariesPathOption = 'libraries_path';
163-
const silenceUnsupportedModulesWarningsOption =
164-
'silence_unsupported_modules_warnings';
163+
const unsafeAllowUnsupportedModulesOption =
164+
'unsafe_allow_unsupported_modules';
165165
String? defaultLoaderOption;
166166

167167
const supportedOptions = [
@@ -173,7 +173,7 @@ final class EntrypointBuilderOptions {
173173
loaderOption,
174174
webHotReloadOption,
175175
librariesPathOption,
176-
silenceUnsupportedModulesWarningsOption,
176+
unsafeAllowUnsupportedModulesOption,
177177
'use-ui-libraries',
178178
];
179179

@@ -182,8 +182,8 @@ final class EntrypointBuilderOptions {
182182
options.config[nativeNullAssertionsOption] as bool?;
183183
final usesWebHotReload = options.config[webHotReloadOption] as bool?;
184184
final librariesPath = options.config[librariesPathOption] as String?;
185-
final silenceUnsupportedModulesWarnings =
186-
options.config[silenceUnsupportedModulesWarningsOption] as bool?;
185+
final unsafeAllowUnsupportedModules =
186+
options.config[unsafeAllowUnsupportedModulesOption] as bool?;
187187
final compilers = <EnabledEntrypointCompiler>[];
188188

189189
validateOptions(
@@ -272,8 +272,7 @@ final class EntrypointBuilderOptions {
272272
: defaultLoaderOption,
273273
usesWebHotReload: usesWebHotReload ?? false,
274274
librariesPath: librariesPath,
275-
silenceUnsupportedModulesWarnings:
276-
silenceUnsupportedModulesWarnings ?? false,
275+
unsafeAllowUnsupportedModules: unsafeAllowUnsupportedModules ?? false,
277276
);
278277
}
279278

@@ -363,8 +362,8 @@ class WebEntrypointBuilder implements Builder {
363362
? _ddcLibraryBundleSdkResources
364363
: _ddcSdkResources,
365364
usesWebHotReload: usesWebHotReload,
366-
silenceUnsupportedModulesWarnings:
367-
options.silenceUnsupportedModulesWarnings,
365+
unsafeAllowUnsupportedModules:
366+
options.unsafeAllowUnsupportedModules,
368367
);
369368
} on MissingModulesException catch (e) {
370369
log.severe('$e');
@@ -380,8 +379,8 @@ class WebEntrypointBuilder implements Builder {
380379
onlyCompiler: options.compilers.length == 1,
381380
entrypointExtension: compiler.extension,
382381
librariesPath: options.librariesPath,
383-
silenceUnsupportedModulesWarnings:
384-
options.silenceUnsupportedModulesWarnings,
382+
unsafeAllowUnsupportedModules:
383+
options.unsafeAllowUnsupportedModules,
385384
),
386385
);
387386
case WebCompiler.Dart2Wasm:
@@ -391,8 +390,8 @@ class WebEntrypointBuilder implements Builder {
391390
buildStep,
392391
compiler.compilerArguments,
393392
compiler.extension,
394-
silenceUnsupportedModulesWarnings:
395-
options.silenceUnsupportedModulesWarnings,
393+
unsafeAllowUnsupportedModules:
394+
options.unsafeAllowUnsupportedModules,
396395
);
397396
}),
398397
);

build_web_compilers/test/dart2js_bootstrap_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ void main() {
194194
});
195195

196196
test(
197-
'ignores unsupported platform library imports when silence flag is set',
197+
'ignores unsupported platform library imports when allow flag is set',
198198
() async {
199199
final assets = {
200200
'a|lib/index.dart': '''
@@ -223,7 +223,7 @@ void main() {
223223
const BuilderOptions({
224224
'compiler': 'dart2js',
225225
'native_null_assertions': false,
226-
'silence_unsupported_modules_warnings': true,
226+
'unsafe_allow_unsupported_modules': true,
227227
}),
228228
),
229229
],

0 commit comments

Comments
 (0)