From e82a5a2ff34d9fec3cfdaf5ac46654e40f31379b Mon Sep 17 00:00:00 2001 From: Joshua Litt Date: Wed, 3 May 2023 16:45:32 +0000 Subject: [PATCH] [dart2wasm] Move entrypoint into the `lib` directory. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This CL will make it easier to consume `dart2wasm` as a library. Specifically, users can import `package:dart2wasm/dart2wasm.dart`, and call `main` from Dart libraries. Change-Id: I9f5d5ab539677af2604df9d4b0e1e2d82db7485f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/300780 Commit-Queue: Joshua Litt Reviewed-by: Ömer Ağacan --- pkg/dart2wasm/bin/dart2wasm.dart | 143 +----------------------------- pkg/dart2wasm/lib/dart2wasm.dart | 146 +++++++++++++++++++++++++++++++ 2 files changed, 148 insertions(+), 141 deletions(-) create mode 100644 pkg/dart2wasm/lib/dart2wasm.dart diff --git a/pkg/dart2wasm/bin/dart2wasm.dart b/pkg/dart2wasm/bin/dart2wasm.dart index 842cae3977f..26b4ce86002 100644 --- a/pkg/dart2wasm/bin/dart2wasm.dart +++ b/pkg/dart2wasm/bin/dart2wasm.dart @@ -2,145 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'dart:io'; +import 'package:dart2wasm/dart2wasm.dart' as dart2wasm; -import 'package:args/args.dart' as args; -import 'package:front_end/src/api_unstable/vm.dart' - show printDiagnosticMessage, resolveInputUri; -import 'package:front_end/src/api_unstable/vm.dart' as fe; - -import 'package:dart2wasm/compile.dart'; -import 'package:dart2wasm/compiler_options.dart'; -import 'package:dart2wasm/option.dart'; - -// Used to allow us to keep defaults on their respective option structs. -final CompilerOptions _d = CompilerOptions.defaultOptions(); - -final List