diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..c2e39cf --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,3 @@ +## 0.1.0 + +- Initial Commit diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..82e9b52 --- /dev/null +++ b/LICENSE @@ -0,0 +1,26 @@ +Copyright 2016, the Dart project authors. All rights reserved. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..01129e1 --- /dev/null +++ b/README.md @@ -0,0 +1,26 @@ +# source_transformer + +_NOTE: This project is **not** an official Google or dart-lang project_ + +**This package is currently in development** + +Not to be confused with `code_transformers` or `source_gen`, +`source_transformer` is a library for building and applying +modifications to existing files, primarily `.dart` source files, and to +commit the results of those changes. + +Example uses: + +* Writing tools to automatically upgrade deprecated APIs +* Writing tools to perform mass refactorings +* Writing tools to perform macros as part of writing new code + +An example of creating a binary that removes duplicate imports/exports: + +```dart +import 'package:source_transformer/source_transformer.dart'; + +main(List paths) async { + await runTransformer(const DeduplicateDirectives(), paths); +} +``` diff --git a/bin/deduplicate.dart b/bin/deduplicate.dart index 17d5ed9..1b79284 100644 --- a/bin/deduplicate.dart +++ b/bin/deduplicate.dart @@ -1,3 +1,7 @@ +// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file +// 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 'package:source_transformer/source_transformer.dart'; /// Remove all duplicate imports and exports in a set of files. diff --git a/lib/source_transformer.dart b/lib/source_transformer.dart index 2206598..4bb41ff 100644 --- a/lib/source_transformer.dart +++ b/lib/source_transformer.dart @@ -1,3 +1,7 @@ +// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file +// 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. + export 'package:source_transformer/src/cli.dart' show runTransformer; export 'package:source_transformer/src/dart/directives.dart' show diff --git a/lib/src/dart/directives.dart b/lib/src/dart/directives.dart index 6c64f82..284e30c 100644 --- a/lib/src/dart/directives.dart +++ b/lib/src/dart/directives.dart @@ -1,6 +1,7 @@ // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file // 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. + library source_transformer.src.dart.directives; import 'package:analyzer/analyzer.dart'; diff --git a/lib/src/dart/directives/equality.dart b/lib/src/dart/directives/equality.dart index b4207a3..711d8f9 100644 --- a/lib/src/dart/directives/equality.dart +++ b/lib/src/dart/directives/equality.dart @@ -1,6 +1,7 @@ // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file // 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. + part of source_transformer.src.dart.directives; class DirectiveEquality implements Equality { diff --git a/lib/src/dart/directives/transformer.dart b/lib/src/dart/directives/transformer.dart index 8f80930..28d0816 100644 --- a/lib/src/dart/directives/transformer.dart +++ b/lib/src/dart/directives/transformer.dart @@ -1,6 +1,7 @@ // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file // 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. + part of source_transformer.src.dart.directives; /// A high-level transformer for manipulating `import` and `export` directives. diff --git a/pubspec.yaml b/pubspec.yaml index b1e974e..b18436d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,11 +1,18 @@ name: source_transformer +author: Dart Team +version: 0.1.0 +description: Patterns for easily re-writing source code +homepage: https://www.github.com/google/source_transformer.dart + +environment: + sdk: ">=1.8.0 <2.0.0" dependencies: - analyzer: - collection: - meta: - quiver: - source_span: + analyzer: '>=0.29.1 <0.30.0' + collection: '^1.11.0' + meta: '^1.0.3' + quiver: '>=0.22.0 <0.30.0' + source_span: '^1.0.0' dev_dependencies: - test: + test: '^0.12.17' diff --git a/test/dart/directives/deduplicate_test.dart b/test/dart/directives/deduplicate_test.dart index c6924d0..8d903f0 100644 --- a/test/dart/directives/deduplicate_test.dart +++ b/test/dart/directives/deduplicate_test.dart @@ -1,3 +1,7 @@ +// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file +// 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 'package:source_span/source_span.dart'; import 'package:source_transformer/src/dart/directives.dart'; import 'package:test/test.dart'; diff --git a/test/dart/directives/equality_test.dart b/test/dart/directives/equality_test.dart index f6180ea..8848b2b 100644 --- a/test/dart/directives/equality_test.dart +++ b/test/dart/directives/equality_test.dart @@ -1,3 +1,7 @@ +// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file +// 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 'package:analyzer/analyzer.dart'; import 'package:source_transformer/src/dart/directives.dart'; import 'package:test/test.dart'; diff --git a/test/dart/directives/remove_test.dart b/test/dart/directives/remove_test.dart index a596015..e9c8cd1 100644 --- a/test/dart/directives/remove_test.dart +++ b/test/dart/directives/remove_test.dart @@ -1,3 +1,7 @@ +// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file +// 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 'package:source_span/source_span.dart'; import 'package:source_transformer/src/dart/directives.dart'; import 'package:test/test.dart'; diff --git a/test/dart/directives/replace_test.dart b/test/dart/directives/replace_test.dart index 04b70b0..12701ea 100644 --- a/test/dart/directives/replace_test.dart +++ b/test/dart/directives/replace_test.dart @@ -1,3 +1,7 @@ +// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file +// 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 'package:source_span/source_span.dart'; import 'package:source_transformer/src/dart/directives.dart'; import 'package:test/test.dart';