p-hatan/ mirror

pub repository

mirror.p-hatan.ir

code_transformers

0.2.7

Collection of utilities related to creating barback transformers.

This package is discontinued upstream.

Download archive

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.2.6

  • Added assetIdToUri to assets.dart.

0.2.5

  • Improvements to dartSdkDirectory so it has a better chance of success.
  • BuildLogger now accepts AggregateTransform or Transform. If passing in an AggregateTransform you must also pass in an AssetId to use as the primary input.

0.2.4

  • Added some basic string formatting options to testPhases to 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' Span class to source_span's SourceSpan class.

Installing

export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add code_transformers
pubspec.yaml
name: code_transformers
version: 0.2.7
author: "Dart Team <misc@dartlang.org>"
description: Collection of utilities related to creating barback transformers.
homepage: https://github.com/dart-lang/code-transformers
dependencies:
  analyzer: ">=0.15.6 <0.25.0"
  barback: ">=0.14.2 <0.16.0"
  cli_util: ">=0.0.1 <0.1.0"
  path: ">=0.9.0 <2.0.0"
  source_maps: ">=0.9.4 <0.11.0"
  source_span: ">=1.0.0 <2.0.0"
dev_dependencies:
  unittest: ">=0.10.1 <0.12.0"
environment:
  sdk: ">=1.0.0 <2.0.0"

Version history

VersionPublishedArchiveSHA-256
0.0.1-dev2014-02-24T20:15:56.046190ZDownloadb5c8261089730defd962064023c5b95d8c572c201424b438c7f4e1743ec2dae9
0.0.1-dev.12014-03-01T00:17:50.091940ZDownload3ae3b930a0cf7dd061460d974cc04a35a4f4bd07f26c32e36bb7392fea740b1d
0.0.1-dev.22014-03-01T00:41:24.280420ZDownloadcd1d5a2084338bebbece3486fa4565cd06fcf02cb08ca5784c35ef8970a284d3
0.0.1-dev.32014-03-18T20:57:31.955110ZDownload677e402f1cdfc336a33195441db4bb27c4125ebc28e4ab4ecbed53eb46bdc27d
0.0.1-dev.42014-03-18T22:36:31.339510ZDownloadc88021fce8eff0073e5d4b73de9f11d4e7ca558983722bd55a2065b3d7d86694
0.1.02014-03-20T19:26:53.142150ZDownload694129d12a472211e8dca5f6352da55cea334d8482223554d5cbe4c8a7a69ff6
0.1.0+12014-03-27T01:09:06.174500ZDownload07b4956434cca6dd845f91407348738f3874db771e2f6d677682d714cd074a23
0.1.12014-03-28T23:41:43.187440ZDownload47a1912bd53979b91bc683fbdf6483285f58f3a3b2869174159c50b5827cb8d4
0.1.1+12014-04-02T22:50:00.576960ZDownload03e0a88523d9f675a239fca1fd97118ac1bd007510f78ad4d2893963d884dedd
0.1.22014-04-11T16:17:48.183540ZDownloade2e4a24aef4b3f4538ca7dcb92924bbd27e28bfb6ed3c370af403d892552324b
0.1.32014-04-11T18:00:06.075080ZDownload0b4d69c0e417659dc681cb56fba6998ac28bd7eed1b0c47d8a3c7648254886eb
0.1.3+12014-05-20T22:09:01.006060ZDownload23dab7fbd482f2e838c2e7a08056f49a122214baf37789d2abd5464be0845c4a
0.1.42014-06-05T02:30:27.179930ZDownload520060af13525058ee66662e221449eb4d21cb67f69ec2ad74f9527efdfc3e72
0.1.4+12014-06-05T18:24:10.952060ZDownload7641ae028331fbdc73acc46e7bceb86f7b80ca9a88a11147823c44267e5424f9
0.1.4+22014-06-06T02:06:37.816630ZDownloade9f8c6bfc67d32d2ded30d22d09e83179d84aba85c4d173d172a8a0cd80fe107
0.1.52014-07-15T23:29:03.254760ZDownloadbc83401ffb7ca319022485511c909819fde54b88f1fa3ea9be9197a4d39eadf0
0.1.62014-07-29T23:31:25.784950ZDownload18a1b9ab37261ac59505df6ae207d066e4ce68b1690d56a8919ab900fd7fc5f2
0.2.0+32014-08-01T00:44:19.398650ZDownload6c25558b9a59e50b393b6d68a95427b209f299abbc445e096c1faf644a6d8752
0.2.12014-08-08T20:28:35.124380ZDownload6a033d3a2130ad44a3ba73f88fb1f056488e644dde6a1b38c05ae79acf19e176
0.2.22014-09-03T22:38:18.155790ZDownloade0a4970d8209a140dceb65f1ed26becfb2f1978f88bf67d5faaa97e9bdb67fe9
0.2.32014-09-08T20:13:52.005410ZDownload8899674508a438ced085f574bfbcf09431137b29a27a446ee303c3b5cd2bda93
0.2.3+12014-09-22T16:10:35.667590ZDownloadc8d0cee30acdfc2da30c0a87ba499a539e109767a46cc1d9231d20e2e563f96a
0.2.3+22014-12-11T20:54:28.825550ZDownloadee4dc39aeec50d5a30c5a06b58d1759e1a2d144c973f79ea0438b9db12bfb4e7
0.2.42015-02-03T15:03:42.548850ZDownload4e747e1ff4ebce2b3f086f5aec1dc079bcff6534c00f435b5dfcd1ab21ece73c
0.2.52015-02-06T18:30:45.428080ZDownloadbea9ad9f59d5ddec1806a7ccf0ef3aff1f5e46a2ac4ea4e151510c6c4e47121c
0.2.62015-03-09T20:13:43.106760ZDownload4c05d936a6a2356c00da69359ba2d814f1b84fa199b5434fe871425ce2cf4cac
0.2.72015-03-11T21:57:04.707140ZDownloadf6a048b50a6b64297d38523394366dfb1eca7f14e5d526243ab6b2ba83c32f02
0.2.7+12015-03-12T16:24:58.254240ZDownloade3568f81d03cc844e56ef0de7dfb31079fa801697a749b8c248a9be572641e42
0.2.7+22015-03-31T14:15:27.852750ZDownload87ba97f00de53661dc9b2fc707a236cbf1d1a66edd436ca84dc838a863290377
0.2.82015-04-14T17:19:13.661480ZDownload71a2750fd534dfe344d1f0dd32d2d29af28cfdfe7962a826a5dad956d7837d34
0.2.92015-04-30T15:38:45.997600ZDownload71cde4a76a6dfdd042a9165d88725de35279df42eaaf71e988be124531c51845
0.2.9+22015-08-20T15:49:56.925ZDownloadce46bc3a5ce115337701c60c461bdc7333e5b0539ad5228762e3f0ec9ab52c5a
0.2.9+32015-08-20T19:41:58.357ZDownload78095e84b6b1f15d31fe35911929e7d00f20d87361c1c2f66ba32b1142042db8
0.2.9+42015-08-20T19:45:48.725ZDownloadb643f8b7e95a48c96c52024217302a8dba84439d0f9f8994dcb8d6901019825b
0.2.102015-12-07T22:28:30.621ZDownloadc939677d4eb6029c2e1401854ce9e38d1a8e1fb6d35b113dbc65953840b2963a
0.2.112015-12-08T17:18:54.621ZDownloadc0b37fe1bd0e512242bd726130b815d16eacd783510dbee96885224c8a126c70
0.3.02015-12-08T17:20:24.390ZDownload4259571f8c8f1247fa377c1a278bab77b012ee29726a4fbf0ee134781fac03e9
0.3.0+12015-12-08T17:24:37.365ZDownload6e2b51edfe38ae541282374fd218e3218d2ace410cb2a178429cfad99ace9e70
0.3.12015-12-10T18:46:21.732ZDownload3a4ac21e1ed4b2a47e6d88d65c733e131e66b2ba1238ce09ec1c6e1527f105db
0.4.02016-01-19T22:02:53.915ZDownloadebb91973fe18e0f9de45d0363980f7082b0144ca27f0eba064d81cc0265d6004
0.4.12016-03-04T17:48:01.987ZDownloade3c7925a959bb0efdfcb5f8123594fa952b18fcdc5babe693b8b5bffe906fb8d
0.4.22016-03-25T00:49:56.070ZDownload13d2a12e5a5cddee3945e159889290e2e207425dd82f42c95010d97fb92cf489
0.4.2+12016-03-29T19:44:27.578ZDownloade5fbab9992b5f5ba8fb1549ec1c48f816a00c2c5b24fd55e441d6eb79d549ca4
0.4.2+22016-04-08T15:47:08.585ZDownloadb71e4c311c8471587ab24d70ae62b683e11d7fb3840812d84e7be4b0c043aba5
0.4.2+32016-09-01T13:52:54.243ZDownloadc1ab44c51e1a822c032b47a49da08231b417b36e6db4f2b639219aac7ac8e3c8
0.4.2+42016-10-14T19:24:58.737ZDownload579b49dfec77d81d151f5dce6e521c0c0467a955bcdf183bff0c9da0470ee089
0.5.02016-10-17T22:25:31.996ZDownload3cc66fadd8998303d8ba31b9894199bb9862a0136044e4bdd85bca06865b5a04
0.5.0+12016-11-15T18:30:13.988ZDownloadafffa804152b06a7efbfee193c0d161580b3f07a4928ed180137b7c227b73d63
0.5.0+22017-01-10T21:41:38.051ZDownload95bff2d183e434a50e8a0d52219f28871039e650407460a7a86f9e2dbd6892a8
0.5.12017-01-27T18:57:18.472ZDownload58364b56fd2e3255684f213b1aaef20b9a77d53844b590af6d718543cf9826c2
0.5.1+22017-05-03T22:58:55.663801ZDownload20be493ac2d1636458305578da9a079c8b878f9f8e5f4127425a91612080efcf
0.5.1+32017-05-18T01:04:14.603105ZDownloadb352f70c199d5bf328cba3cd2efce6bbdc429080d35078301129065ffd477ed9
0.5.1+42018-02-02T23:43:30.708529ZDownloadc752e8933fcec287892eb1ba7402fea393b786cd9ee209dc9037595f45f08a49
0.5.1+52018-05-14T22:33:31.736321ZDownloadb01169f4524ee60eab318d2dc91af96e6843b7809166972e13ab74afdb6082bb

Dependencies

analyzer "\u003e=0.15.6 \u003c0.25.0"

barback "\u003e=0.14.2 \u003c0.16.0"

cli_util "\u003e=0.0.1 \u003c0.1.0"

path "\u003e=0.9.0 \u003c2.0.0"

source_maps "\u003e=0.9.4 \u003c0.11.0"

source_span "\u003e=1.0.0 \u003c2.0.0"