pub repository
mirror.p-hatan.ircode_transformers
0.5.1+5Collection of utilities related to creating barback transformers.
This package is discontinued upstream.
Readme
Code Transformers
This package exposes various tools to help in the creation and testing of barback transformers, as well as an interface for logging messages with constant ids for documentation purposes.
Messages and logging
This package exposes a BuildLogger class as well as Message,
MessageTemplate, and MessageId classes. These work together to provide
stable error messages with ids that can be referenced in documentation.
MessageId
A MessageId is a constant definition of a message in a package. These are
used to group messages with the same id or link to sections in a document.
const myId = const MessageId('myPackage', 0);
These ids should typically never change or disappear throughout the entire lifetime of a package.
Message
A Message is a const object which has a MessageId and snippet.
const myMessage = const Message(myId, 'my message');
MessageTemplate
TODO(jakemac): Docs on this, see https://github.com/dart-lang/code-transformers/blob/master/lib/messages/messages.dart
BuildLogger
The BuildLogger class just wraps a normal TransformLogger to provide some
additional functionality. You use it in the same way as a TransformLogger
except that the log methods can accept a String or a Message. This should
usually be created in the first step of your transformers apply function:
apply(Transform transform) {
// If detailsUri is passed, then a link will be output with each log
// message that follows this format
// `$detailsUri#${msg.id.package}_${msg.id.id}`.
var logger = new BuildLogger(transform, detailsUri: 'http://foo.com');
}
You can optionally dump out a file containing all the logs found in JSON
format by calling the writeOutput method on the logger when you are done.
The output file will have the same file path as the primary input of the
transformer, with an extension matching this pattern ._buildLogs.$i. The
i increments starting at 0 each time that logs are output (if multiple
transformers run on the same file for instance). These can all be combined
into a single file later on by calling the static
combineLogFiles(Transform transform) function.
Testing Transformers
TODO(jakemac): Docs on this, see testPhases in
https://github.com/dart-lang/code-transformers/blob/master/lib/tests.dart
Using the Analyzer in Transformers
This package exposes a Resolver class which helps out when using the
analyzer in a transform.
TODO(jakemac): Docs on this, see https://github.com/dart-lang/code-transformers/blob/master/lib/src/resolver.dart
Barback AssetIds and Uris
This package also provides some helpers to convert AssetIds to and from Uris
relative to a source asset.
TODO(jakemac): Docs on this, see uriToAssetId & assetIdToUri in
https://github.com/dart-lang/code-transformers/blob/master/lib/assets.dart
Changelog
0.5.1+5
- Support the latest
analyzerpackage.
0.5.1+4
- Support the latest
analyzerpackage.
0.5.1+3
- Support the latest
cli_utilpackage.
0.5.1+2
- Support the latest
analyzerpackage.
0.5.1+1
- Updated mock SDK sources to include FutureOr (and fixed a syntax error)
0.5.1
- Resolver has a new method which can check whether an Asset is a Dart library source
0.5.0+2
- Resolver no longer returns a partial LibraryElement for assets which are not libraries
0.5.0+1
- Stop using deprecated analyzer apis.
0.5.0
- Always use a single
Resolverinstance. Fixes an issue where running with the 'build' package in file watching mode would treat some files as never changing. - Breaking Change: remove the
useSharedSourcesargument to Resolvers ctor since sources are always shared.
0.4.2+4
- Update to work with analyzer 0.29.x and transform_test 0.2.x
0.4.2+3
- Update to work with analyzer 0.28.x.
0.4.2+2
- Update to work with analyzer 0.23.x.
0.4.2+1
- Contains a fix for the
useSharedSourcesoption that could result in null library elements when running on multiple entry points.
0.4.2
- Use Strong Mode, fixes #38.
0.4.1
- Added a fix for #24890.
- All constants in all libraries will once again be resolved by default.
- Added a new
resolveAllLibrariesoption toResolver#resolveandResolvers#get. Iffalseis passed then constants will not be resolved in non entry points. This saves significant time if constants are not needed.
- Added a
useSharedSourcesoption toResolvers. This gives a significant speed increase, but must be used carefully.- If used, then all
Resolverinstances created from the sameResolversinstance will share the same sources cache. - This should be generally safe to use if the
Resolversinstance is created in the constructor of yourTransformer. - This option should probably not be used with a static or shared
Resolversinstance.
- If used, then all
0.4.0
- Remove dependency on
test, and move all test related apis to a newtransformer_testpackage which is now a dev dependency.
0.3.1
- Update to analyzer
>=0.27.0 <0.28.0.
0.3.0+1
- Upgrade
testto a real dependency.
0.3.0
- Re-release
0.2.10release as0.3.0.
0.2.11
- Revert
0.2.10release, will be re-released as0.3.0since it is actually a breaking change.
0.2.10
- Update to use the
testpackage instead of theunittestpackage.
0.2.9+4
- Republish 0.2.9+2 under new version.
0.2.9+3
- Republish of 0.2.9 to ensure nobody gets 0.2.9+1 in the future.
0.2.9+2
- Update to analyzer '>=0.26.0 <0.27.0'
0.2.9+1
- Update to analyzer '<0.27.0'
- This version will be reverted as it wasn't compatible with <0.26.0.
0.2.9
- Update to analyzer
<=0.26.0.
0.2.8
- Add
benchmarks.dartfile which exposes aTransformerBenchmark. This can be used to implement simple benchmarks of transformer code.
0.2.7+2
- Fix
assetIdToUrion windows, 41
0.2.7+1
- Fixes for missing overrides after upgrade to analzyer 0.24.0
0.2.7
- Added default set of mockSdkSources and upgraded to analyzer 0.24.0
0.2.6
- Added
assetIdToUrito assets.dart.
0.2.5
- Improvements to
dartSdkDirectoryso it has a better chance of success. BuildLoggernow acceptsAggregateTransformorTransform. If passing in anAggregateTransformyou must also pass in anAssetIdto use as the primary input.
0.2.4
- Added some basic string formatting options to
testPhasesto make it a bit less strict if desired.
0.2.3+2
- Added logic to discover the location of the dart SDK when the dart binary is a symlink.
0.2.3
- Added support for logging stable error messages from transformers.
0.2.2
- Added two transformers, 'delete_file' and 'remove_sourcemap_comment'.
0.2.0+3
- Raise the lower bound on the source_maps constraint to exclude incompatible versions.
0.2.0+2
- Widen the constraint on source_maps.
0.2.0+1
- Widen the constraint on barback.
0.2.0
- Switch from
source_maps'Spanclass tosource_span'sSourceSpanclass.
Installing
export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add code_transformerspubspec.yaml
name: code_transformers
version: 0.5.1+5
author: Dart Team <misc@dartlang.org>
description: Collection of utilities related to creating barback transformers.
homepage: https://github.com/dart-lang/code-transformers
environment:
sdk: '>=1.0.0 <2.0.0'
dependencies:
analyzer: '>=0.28.0 <0.33.0'
barback: '>=0.14.2 <0.16.0'
cli_util: '>=0.1.0 <0.2.0'
path: '>=0.9.0 <2.0.0'
source_maps: '>=0.9.4 <0.11.0'
source_span: '>=1.4.0 <2.0.0'
dev_dependencies:
test: '>=0.12.1 <0.13.0'
transformer_test: '>=0.1.0 <0.3.0'
Version history
| Version | Published | Archive | SHA-256 |
|---|---|---|---|
| 0.0.1-dev | 2014-02-24T20:15:56.046190Z | Download | b5c8261089730defd962064023c5b95d8c572c201424b438c7f4e1743ec2dae9 |
| 0.0.1-dev.1 | 2014-03-01T00:17:50.091940Z | Download | 3ae3b930a0cf7dd061460d974cc04a35a4f4bd07f26c32e36bb7392fea740b1d |
| 0.0.1-dev.2 | 2014-03-01T00:41:24.280420Z | Download | cd1d5a2084338bebbece3486fa4565cd06fcf02cb08ca5784c35ef8970a284d3 |
| 0.0.1-dev.3 | 2014-03-18T20:57:31.955110Z | Download | 677e402f1cdfc336a33195441db4bb27c4125ebc28e4ab4ecbed53eb46bdc27d |
| 0.0.1-dev.4 | 2014-03-18T22:36:31.339510Z | Download | c88021fce8eff0073e5d4b73de9f11d4e7ca558983722bd55a2065b3d7d86694 |
| 0.1.0 | 2014-03-20T19:26:53.142150Z | Download | 694129d12a472211e8dca5f6352da55cea334d8482223554d5cbe4c8a7a69ff6 |
| 0.1.0+1 | 2014-03-27T01:09:06.174500Z | Download | 07b4956434cca6dd845f91407348738f3874db771e2f6d677682d714cd074a23 |
| 0.1.1 | 2014-03-28T23:41:43.187440Z | Download | 47a1912bd53979b91bc683fbdf6483285f58f3a3b2869174159c50b5827cb8d4 |
| 0.1.1+1 | 2014-04-02T22:50:00.576960Z | Download | 03e0a88523d9f675a239fca1fd97118ac1bd007510f78ad4d2893963d884dedd |
| 0.1.2 | 2014-04-11T16:17:48.183540Z | Download | e2e4a24aef4b3f4538ca7dcb92924bbd27e28bfb6ed3c370af403d892552324b |
| 0.1.3 | 2014-04-11T18:00:06.075080Z | Download | 0b4d69c0e417659dc681cb56fba6998ac28bd7eed1b0c47d8a3c7648254886eb |
| 0.1.3+1 | 2014-05-20T22:09:01.006060Z | Download | 23dab7fbd482f2e838c2e7a08056f49a122214baf37789d2abd5464be0845c4a |
| 0.1.4 | 2014-06-05T02:30:27.179930Z | Download | 520060af13525058ee66662e221449eb4d21cb67f69ec2ad74f9527efdfc3e72 |
| 0.1.4+1 | 2014-06-05T18:24:10.952060Z | Download | 7641ae028331fbdc73acc46e7bceb86f7b80ca9a88a11147823c44267e5424f9 |
| 0.1.4+2 | 2014-06-06T02:06:37.816630Z | Download | e9f8c6bfc67d32d2ded30d22d09e83179d84aba85c4d173d172a8a0cd80fe107 |
| 0.1.5 | 2014-07-15T23:29:03.254760Z | Download | bc83401ffb7ca319022485511c909819fde54b88f1fa3ea9be9197a4d39eadf0 |
| 0.1.6 | 2014-07-29T23:31:25.784950Z | Download | 18a1b9ab37261ac59505df6ae207d066e4ce68b1690d56a8919ab900fd7fc5f2 |
| 0.2.0+3 | 2014-08-01T00:44:19.398650Z | Download | 6c25558b9a59e50b393b6d68a95427b209f299abbc445e096c1faf644a6d8752 |
| 0.2.1 | 2014-08-08T20:28:35.124380Z | Download | 6a033d3a2130ad44a3ba73f88fb1f056488e644dde6a1b38c05ae79acf19e176 |
| 0.2.2 | 2014-09-03T22:38:18.155790Z | Download | e0a4970d8209a140dceb65f1ed26becfb2f1978f88bf67d5faaa97e9bdb67fe9 |
| 0.2.3 | 2014-09-08T20:13:52.005410Z | Download | 8899674508a438ced085f574bfbcf09431137b29a27a446ee303c3b5cd2bda93 |
| 0.2.3+1 | 2014-09-22T16:10:35.667590Z | Download | c8d0cee30acdfc2da30c0a87ba499a539e109767a46cc1d9231d20e2e563f96a |
| 0.2.3+2 | 2014-12-11T20:54:28.825550Z | Download | ee4dc39aeec50d5a30c5a06b58d1759e1a2d144c973f79ea0438b9db12bfb4e7 |
| 0.2.4 | 2015-02-03T15:03:42.548850Z | Download | 4e747e1ff4ebce2b3f086f5aec1dc079bcff6534c00f435b5dfcd1ab21ece73c |
| 0.2.5 | 2015-02-06T18:30:45.428080Z | Download | bea9ad9f59d5ddec1806a7ccf0ef3aff1f5e46a2ac4ea4e151510c6c4e47121c |
| 0.2.6 | 2015-03-09T20:13:43.106760Z | Download | 4c05d936a6a2356c00da69359ba2d814f1b84fa199b5434fe871425ce2cf4cac |
| 0.2.7 | 2015-03-11T21:57:04.707140Z | Download | f6a048b50a6b64297d38523394366dfb1eca7f14e5d526243ab6b2ba83c32f02 |
| 0.2.7+1 | 2015-03-12T16:24:58.254240Z | Download | e3568f81d03cc844e56ef0de7dfb31079fa801697a749b8c248a9be572641e42 |
| 0.2.7+2 | 2015-03-31T14:15:27.852750Z | Download | 87ba97f00de53661dc9b2fc707a236cbf1d1a66edd436ca84dc838a863290377 |
| 0.2.8 | 2015-04-14T17:19:13.661480Z | Download | 71a2750fd534dfe344d1f0dd32d2d29af28cfdfe7962a826a5dad956d7837d34 |
| 0.2.9 | 2015-04-30T15:38:45.997600Z | Download | 71cde4a76a6dfdd042a9165d88725de35279df42eaaf71e988be124531c51845 |
| 0.2.9+2 | 2015-08-20T15:49:56.925Z | Download | ce46bc3a5ce115337701c60c461bdc7333e5b0539ad5228762e3f0ec9ab52c5a |
| 0.2.9+3 | 2015-08-20T19:41:58.357Z | Download | 78095e84b6b1f15d31fe35911929e7d00f20d87361c1c2f66ba32b1142042db8 |
| 0.2.9+4 | 2015-08-20T19:45:48.725Z | Download | b643f8b7e95a48c96c52024217302a8dba84439d0f9f8994dcb8d6901019825b |
| 0.2.10 | 2015-12-07T22:28:30.621Z | Download | c939677d4eb6029c2e1401854ce9e38d1a8e1fb6d35b113dbc65953840b2963a |
| 0.2.11 | 2015-12-08T17:18:54.621Z | Download | c0b37fe1bd0e512242bd726130b815d16eacd783510dbee96885224c8a126c70 |
| 0.3.0 | 2015-12-08T17:20:24.390Z | Download | 4259571f8c8f1247fa377c1a278bab77b012ee29726a4fbf0ee134781fac03e9 |
| 0.3.0+1 | 2015-12-08T17:24:37.365Z | Download | 6e2b51edfe38ae541282374fd218e3218d2ace410cb2a178429cfad99ace9e70 |
| 0.3.1 | 2015-12-10T18:46:21.732Z | Download | 3a4ac21e1ed4b2a47e6d88d65c733e131e66b2ba1238ce09ec1c6e1527f105db |
| 0.4.0 | 2016-01-19T22:02:53.915Z | Download | ebb91973fe18e0f9de45d0363980f7082b0144ca27f0eba064d81cc0265d6004 |
| 0.4.1 | 2016-03-04T17:48:01.987Z | Download | e3c7925a959bb0efdfcb5f8123594fa952b18fcdc5babe693b8b5bffe906fb8d |
| 0.4.2 | 2016-03-25T00:49:56.070Z | Download | 13d2a12e5a5cddee3945e159889290e2e207425dd82f42c95010d97fb92cf489 |
| 0.4.2+1 | 2016-03-29T19:44:27.578Z | Download | e5fbab9992b5f5ba8fb1549ec1c48f816a00c2c5b24fd55e441d6eb79d549ca4 |
| 0.4.2+2 | 2016-04-08T15:47:08.585Z | Download | b71e4c311c8471587ab24d70ae62b683e11d7fb3840812d84e7be4b0c043aba5 |
| 0.4.2+3 | 2016-09-01T13:52:54.243Z | Download | c1ab44c51e1a822c032b47a49da08231b417b36e6db4f2b639219aac7ac8e3c8 |
| 0.4.2+4 | 2016-10-14T19:24:58.737Z | Download | 579b49dfec77d81d151f5dce6e521c0c0467a955bcdf183bff0c9da0470ee089 |
| 0.5.0 | 2016-10-17T22:25:31.996Z | Download | 3cc66fadd8998303d8ba31b9894199bb9862a0136044e4bdd85bca06865b5a04 |
| 0.5.0+1 | 2016-11-15T18:30:13.988Z | Download | afffa804152b06a7efbfee193c0d161580b3f07a4928ed180137b7c227b73d63 |
| 0.5.0+2 | 2017-01-10T21:41:38.051Z | Download | 95bff2d183e434a50e8a0d52219f28871039e650407460a7a86f9e2dbd6892a8 |
| 0.5.1 | 2017-01-27T18:57:18.472Z | Download | 58364b56fd2e3255684f213b1aaef20b9a77d53844b590af6d718543cf9826c2 |
| 0.5.1+2 | 2017-05-03T22:58:55.663801Z | Download | 20be493ac2d1636458305578da9a079c8b878f9f8e5f4127425a91612080efcf |
| 0.5.1+3 | 2017-05-18T01:04:14.603105Z | Download | b352f70c199d5bf328cba3cd2efce6bbdc429080d35078301129065ffd477ed9 |
| 0.5.1+4 | 2018-02-02T23:43:30.708529Z | Download | c752e8933fcec287892eb1ba7402fea393b786cd9ee209dc9037595f45f08a49 |
| 0.5.1+5 | 2018-05-14T22:33:31.736321Z | Download | b01169f4524ee60eab318d2dc91af96e6843b7809166972e13ab74afdb6082bb |
Dependencies
analyzer "\u003e=0.28.0 \u003c0.33.0"
barback "\u003e=0.14.2 \u003c0.16.0"
cli_util "\u003e=0.1.0 \u003c0.2.0"
path "\u003e=0.9.0 \u003c2.0.0"
source_maps "\u003e=0.9.4 \u003c0.11.0"
source_span "\u003e=1.4.0 \u003c2.0.0"