p-hatan/ mirror

pub repository

mirror.p-hatan.ir

smoke

0.2.1

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.

This package is discontinued upstream.

Download archive

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

changelog

This file contains highlights of what changes on each version of this package.

Pub version 0.2.0+3

  • Widen the constraint on analyzer.

Pub version 0.2.0+2

  • Widen the constraint on barback.

Pub version 0.2.0+1

  • Switch from source_maps' Span class to source_span's SourceSpan class.

Pub version 0.2.0

  • Static configuration can be modified, so code generators can split the static configuration in pieces.
  • breaking change: for codegen call writeStaticConfiguration instead of writeInitCall.

Pub version 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 smoke
pubspec.yaml
name: smoke
version: 0.2.1
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

VersionPublishedArchiveSHA-256
0.1.0-pre.02014-02-28T23:05:45.749140ZDownloada21e2318962e02a205c2e6c0beac5900cacd0f0b595dddda6e98a0935234df89
0.1.0-pre.12014-03-19T17:56:47.403220ZDownload561939fba1c28b673c904963d4f3efcff173def3a9dd40d859c7ab1e8e6d9700
0.1.0-pre.22014-03-28T23:39:36.901600ZDownload75c79055f190e81ee4c6a9854b31eb631db03df83b873780f4657ddbd74448ee
0.1.0-pre.32014-04-11T16:18:18.429830ZDownload85c0808e85b8ed37b2eef9883abab45666f4d6c50f14e09d465d2679887ee58d
0.1.0-pre.42014-05-01T22:37:44.248380ZDownload217731fc191aa253b731189f84d5c1a5c075d589e1b692b6ee8d72b9ba79164e
0.1.0-pre.52014-05-12T19:22:53.911560ZDownload943ff68131b632b709f8e5fb68092cab7f06210c33a9e6c5b7793eeb2878d35e
0.1.02014-05-31T00:47:07.611610ZDownloadff13685c6ed1fc631ae8d7a9d5c1618f97d18659d28a40287207f1f3461b1512
0.1.0+12014-06-06T02:07:07.085590ZDownload4e7acb7d3ca8434f1750293b7428ab33d08a615176bfbd3d45e5cbeb7e14e11c
0.2.02014-07-30T15:18:49.085780ZDownload37bc98de34a34a84f4eb5329472a9d05744d576e6de94c6f9f42d70348879885
0.2.0+12014-07-30T21:38:22.747340ZDownloade0f8eee638e5d0bf7229cc6cf7db664c2717249575f7f850a3259b246288bba5
0.2.0+22014-07-30T23:39:43.495150ZDownloadd7e5117776dc3357f59413a8b065c00d5a5a816444c47b116ed44c73cb0f1b1a
0.2.0+32014-08-02T00:12:37.292200ZDownload00de209c7288f8cfe1bccbd86aaca0b282fb42ff8b89dae3fa5374de51a24478
0.2.12014-08-08T20:28:43.442590ZDownload12698a04c5dee72ae015aa8cda179b9e19bded7343f50a081e6e3144f0ea991a
0.2.1+12014-09-18T22:04:01.088670ZDownloadd49aab4729fb5e685e2cada6b5fbbec2b1c47f4e9b3afe571e9df59dd57cb057
0.3.02015-01-15T18:25:09.989620ZDownload2c689b7c84ea6d7e634cf9f6a70ce1a8a5175257918a8e8d3db17110907502d6
0.3.12015-01-20T17:47:16.498940ZDownload6299ca6ded961d78de9d3fac473d8e01218ffd9bff53fdaae5fa7586f5d458c7
0.3.1+12015-03-18T15:39:59.711850ZDownloaddbcffa713abb51efd0bb36b562fb7e64dbc44705649ea3825159103e511f79d1
0.3.22015-03-25T22:04:20.226320ZDownload1fe1d1e30e1f9995aa1c4b89e87cd358938c8daec38b5d6c52ce900293613fc7
0.3.32015-04-30T15:40:58.507ZDownloadb0aa052caccae50a198fe3199bd48c98837b4b97380aab1773ea4a96a6c5990e
0.3.3+12015-05-11T19:16:03.648360ZDownload6d8b43e3cf4898c38141bf91c7121ec9a14a3b00a3c6edd1e33437a60af8fdb2
0.3.42015-07-08T17:46:43.847ZDownload092657cc928fd630ed751d28ab1fdbcc8dead7ce9c7e06892a64958995dc945e
0.3.52015-08-19T21:20:20.828ZDownload9769ed02cadb9ca2e5936ea8a85f35f9b5b692e0049885ef56fe042ffa9eb903
0.3.62015-12-11T15:25:14.897ZDownload94d8196b4fa276d697b9c8df1d41dcffc75292194dc8b477679a592e727a2795
0.3.6+12016-03-18T16:09:47.799ZDownload79fadca9cfe5c7153d0e0425bb4a50bebb0c2e9e354c08095fdf77b0af109cb1
0.3.6+22016-03-29T21:34:58.145ZDownload0aeafb30caf43a2302834fc0f4a02a132add6bbb169169c468ffda0131fc871c
0.3.6+32017-05-02T22:07:06.865244ZDownload7828b1bfcdea2ddfcc43e3bbb031e4cd6711b736208fb288e65ed54934db20fe

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"