pub repository
mirror.p-hatan.irsmoke
0.3.0A restricted reflective system that uses mirrors at development time, but that can be replaced with non-reflective calls using code generation. See README.md for mode details.
This package is discontinued upstream.
Readme
Smoke (and mirrors)
Smoke is a package that exposes a reduced reflective system API. This API includes accessing objects in a dynamic fashion (read properties, write properties, and call methods), inspecting types (for example, whether a method exists), and symbol/string convertion.
The package provides a default implementation of this API that uses the system's mirrors, but additionally provides mechanisms for statically generating code that can replace the mirror-based implementation.
The intention of this package is to allow frameworks to use mirrors in a way that will not impose on their users. The idea is that users will not worry about how to preserve symbols when compiling with dart2js (for instance, using the MirrorsUsed annotation). Instead, this package provides the building blocks to autogenerate whatever is needed for dart2js to be happy and to generate reasonable code.
Note this package alone doesn't know how to generate everything, but it provides a simple API that different frameworks can use to define what needs to be generated.
Smoke reflective API
Use package:smoke/smoke.dart in your framework to read and write objects and
to inspect type information. Read the Dart-docs for more details.
Code Generation
Use package:smoke/codegen/generator.dart and
package:smoke/codegen/recorder.dart in your transformer to create a static
initialization that can be used by smoke. The test under
test/codegen/end_to_end_test.dart is a good illustrating example to learn how
to use these APIs.
Changelog
0.3.0
- Change SUPPORTED_ARGS limit for minArgs and maxArgs method from 3 to 15.
0.2.1+1
- Fix toString calls on Type instances.
0.2.0+3
- Widen the constraint on analyzer.
0.2.0+2
- Widen the constraint on barback.
0.2.0+1
- Switch from
source_maps'Spanclass tosource_span'sSourceSpanclass.
0.2.0
- Static configuration can be modified, so code generators can split the static configuration in pieces.
- breaking change: for codegen call
writeStaticConfigurationinstead ofwriteInitCall.
0.1.0
- Initial release: introduces the smoke API, a mirror based implementation, a statically configured implementation that can be declared by hand or be generated by tools, and libraries that help generate the static configurations.
Installing
export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add smokepubspec.yaml
name: smoke
version: 0.3.0
author: Polymer.dart Authors <web-ui-dev@dartlang.org>
homepage: "https://api.dartlang.org/apidocs/channels/be/#smoke"
description: >
A restricted reflective system that uses mirrors at development time, but that
can be replaced with non-reflective calls using code generation. See README.md
for mode details.
dependencies:
barback: ">=0.9.0 <0.16.0"
logging: ">=0.9.0 <0.10.0"
analyzer: ">=0.13.0 <0.23.0"
# TODO(sigmund): once we have some easier way to do global app-level
# transformers, we might want to remove this transformer here and only apply it
# in apps that need it.
transformers:
- smoke/src/default_transformer:
$include: lib/src/implementation.dart
dev_dependencies:
unittest: ">=0.10.0 <0.11.0"
path: ">=1.0.0 <2.0.0"
code_transformers: ">=0.2.0 <0.3.0"
environment:
sdk: ">=1.3.0-dev.7.9 <2.0.0"
Version history
| Version | Published | Archive | SHA-256 |
|---|---|---|---|
| 0.1.0-pre.0 | 2014-02-28T23:05:45.749140Z | Download | a21e2318962e02a205c2e6c0beac5900cacd0f0b595dddda6e98a0935234df89 |
| 0.1.0-pre.1 | 2014-03-19T17:56:47.403220Z | Download | 561939fba1c28b673c904963d4f3efcff173def3a9dd40d859c7ab1e8e6d9700 |
| 0.1.0-pre.2 | 2014-03-28T23:39:36.901600Z | Download | 75c79055f190e81ee4c6a9854b31eb631db03df83b873780f4657ddbd74448ee |
| 0.1.0-pre.3 | 2014-04-11T16:18:18.429830Z | Download | 85c0808e85b8ed37b2eef9883abab45666f4d6c50f14e09d465d2679887ee58d |
| 0.1.0-pre.4 | 2014-05-01T22:37:44.248380Z | Download | 217731fc191aa253b731189f84d5c1a5c075d589e1b692b6ee8d72b9ba79164e |
| 0.1.0-pre.5 | 2014-05-12T19:22:53.911560Z | Download | 943ff68131b632b709f8e5fb68092cab7f06210c33a9e6c5b7793eeb2878d35e |
| 0.1.0 | 2014-05-31T00:47:07.611610Z | Download | ff13685c6ed1fc631ae8d7a9d5c1618f97d18659d28a40287207f1f3461b1512 |
| 0.1.0+1 | 2014-06-06T02:07:07.085590Z | Download | 4e7acb7d3ca8434f1750293b7428ab33d08a615176bfbd3d45e5cbeb7e14e11c |
| 0.2.0 | 2014-07-30T15:18:49.085780Z | Download | 37bc98de34a34a84f4eb5329472a9d05744d576e6de94c6f9f42d70348879885 |
| 0.2.0+1 | 2014-07-30T21:38:22.747340Z | Download | e0f8eee638e5d0bf7229cc6cf7db664c2717249575f7f850a3259b246288bba5 |
| 0.2.0+2 | 2014-07-30T23:39:43.495150Z | Download | d7e5117776dc3357f59413a8b065c00d5a5a816444c47b116ed44c73cb0f1b1a |
| 0.2.0+3 | 2014-08-02T00:12:37.292200Z | Download | 00de209c7288f8cfe1bccbd86aaca0b282fb42ff8b89dae3fa5374de51a24478 |
| 0.2.1 | 2014-08-08T20:28:43.442590Z | Download | 12698a04c5dee72ae015aa8cda179b9e19bded7343f50a081e6e3144f0ea991a |
| 0.2.1+1 | 2014-09-18T22:04:01.088670Z | Download | d49aab4729fb5e685e2cada6b5fbbec2b1c47f4e9b3afe571e9df59dd57cb057 |
| 0.3.0 | 2015-01-15T18:25:09.989620Z | Download | 2c689b7c84ea6d7e634cf9f6a70ce1a8a5175257918a8e8d3db17110907502d6 |
| 0.3.1 | 2015-01-20T17:47:16.498940Z | Download | 6299ca6ded961d78de9d3fac473d8e01218ffd9bff53fdaae5fa7586f5d458c7 |
| 0.3.1+1 | 2015-03-18T15:39:59.711850Z | Download | dbcffa713abb51efd0bb36b562fb7e64dbc44705649ea3825159103e511f79d1 |
| 0.3.2 | 2015-03-25T22:04:20.226320Z | Download | 1fe1d1e30e1f9995aa1c4b89e87cd358938c8daec38b5d6c52ce900293613fc7 |
| 0.3.3 | 2015-04-30T15:40:58.507Z | Download | b0aa052caccae50a198fe3199bd48c98837b4b97380aab1773ea4a96a6c5990e |
| 0.3.3+1 | 2015-05-11T19:16:03.648360Z | Download | 6d8b43e3cf4898c38141bf91c7121ec9a14a3b00a3c6edd1e33437a60af8fdb2 |
| 0.3.4 | 2015-07-08T17:46:43.847Z | Download | 092657cc928fd630ed751d28ab1fdbcc8dead7ce9c7e06892a64958995dc945e |
| 0.3.5 | 2015-08-19T21:20:20.828Z | Download | 9769ed02cadb9ca2e5936ea8a85f35f9b5b692e0049885ef56fe042ffa9eb903 |
| 0.3.6 | 2015-12-11T15:25:14.897Z | Download | 94d8196b4fa276d697b9c8df1d41dcffc75292194dc8b477679a592e727a2795 |
| 0.3.6+1 | 2016-03-18T16:09:47.799Z | Download | 79fadca9cfe5c7153d0e0425bb4a50bebb0c2e9e354c08095fdf77b0af109cb1 |
| 0.3.6+2 | 2016-03-29T21:34:58.145Z | Download | 0aeafb30caf43a2302834fc0f4a02a132add6bbb169169c468ffda0131fc871c |
| 0.3.6+3 | 2017-05-02T22:07:06.865244Z | Download | 7828b1bfcdea2ddfcc43e3bbb031e4cd6711b736208fb288e65ed54934db20fe |
Dependencies
analyzer "\u003e=0.13.0 \u003c0.23.0"
barback "\u003e=0.9.0 \u003c0.16.0"
logging "\u003e=0.9.0 \u003c0.10.0"