smoke 0.3.3+1

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 45

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.

0.3.3+1

  • Update logging package to <0.12.0.

0.3.3

  • Update to analyzer <0.26.0.

0.3.2

  • Work around an issue running Dart analyzer on the generated code, if the dynamic type appeared in the output. Smoke will now use Object instead.

0.3.1+1

  • Updated dependency versions.

0.3.1

  • Add canAcceptNArgs method.

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' Span class to source_span's SourceSpan class.

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.

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.

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  smoke: "^0.3.3+1"

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:smoke/smoke.dart';
        
Version Uploaded Documentation Archive
0.3.6+3 May 2, 2017 Go to the documentation of smoke 0.3.6+3 Download smoke 0.3.6+3 archive
0.3.6+2 Mar 29, 2016 Go to the documentation of smoke 0.3.6+2 Download smoke 0.3.6+2 archive
0.3.6+1 Mar 18, 2016 Go to the documentation of smoke 0.3.6+1 Download smoke 0.3.6+1 archive
0.3.6 Dec 11, 2015 Go to the documentation of smoke 0.3.6 Download smoke 0.3.6 archive
0.3.5 Aug 19, 2015 Go to the documentation of smoke 0.3.5 Download smoke 0.3.5 archive
0.3.4 Jul 8, 2015 Go to the documentation of smoke 0.3.4 Download smoke 0.3.4 archive
0.3.3+1 May 11, 2015 Go to the documentation of smoke 0.3.3+1 Download smoke 0.3.3+1 archive
0.3.3 Apr 30, 2015 Go to the documentation of smoke 0.3.3 Download smoke 0.3.3 archive
0.3.2 Mar 25, 2015 Go to the documentation of smoke 0.3.2 Download smoke 0.3.2 archive
0.3.1+1 Mar 18, 2015 Go to the documentation of smoke 0.3.1+1 Download smoke 0.3.1+1 archive

All 26 versions...

Analysis

This feature is new.
We welcome feedback.

We analyzed this package, and provided a score, details, and suggestions below.

  • tool failures on Dec 7, 2017
  • Dart: 2.0.0-dev.8.0
  • pana: 0.7.3+1

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
54
Health:
Code health derived from static analysis. [more]
60
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
0
Overall score:
Weighted score of the above. [more]
45

Platforms

Detected platforms:

Error(s) in lib/codegen/recorder.dart: The getter 'metadata' isn't defined for the class 'AstNode'.

Suggestions

  • Fix lib/codegen/recorder.dart.

    Strong-mode analysis of lib/codegen/recorder.dart failed with the following error:

    line: 260 col: 17
    The getter 'metadata' isn't defined for the class 'AstNode'.

  • Fix lib/mirrors.dart.

    Strong-mode analysis of lib/mirrors.dart failed with the following error:

    line: 78 col: 30
    The getter 'declarations' isn't defined for the class 'TypeMirror'.

  • Fix further 1 Dart files.

    Similar analysis of the following files failed:

    • lib/src/default_transformer.dart

Dependencies

Package Constraint Resolved Available
Direct dependencies
analyzer >=0.13.0 <0.26.0 0.25.2+1 0.30.0+4
barback >=0.9.0 <0.16.0 0.15.2+13
logging >=0.9.0 <0.12.0 0.11.3+1
Transitive dependencies
args 0.13.7 1.2.0
async 1.13.3 2.0.1
charcode 1.1.1
collection 1.14.3
csslib 0.13.7+1 0.14.1
html 0.12.2+2 0.13.2
package_config 0.1.5 1.0.3
plugin 0.1.0 0.2.0+2
pool 1.3.3
source_span 1.4.0
stack_trace 1.9.1
string_scanner 1.0.2
utf 0.9.0+3
watcher 0.9.7+4
yaml 2.1.13
Dev dependencies
code_transformers >=0.2.0 <0.3.0
path >=1.0.0 <2.0.0 1.5.1
unittest >=0.10.0 <0.12.0