nodejs_interop 0.8.0

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 79

Node.js Interop for Dart

Dart Node.js Release License Coverage Build

This package provides Node.js interoperability for Dart.

Requirements

If you plan to play with the sources, you will also need the latest Grinder version.

Installing via Pub

1. Depend on it

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

dependencies:
  nodejs_interop: *

2. Install it

Install this package and its dependencies from a command prompt:

$ pub get

3. Import it

Now in your Dart code, you can use:

// Dart abstractions for I/O support.
import 'package:nodejs_interop/io.dart';

// JavaScript and Node.js interoperability.
import 'package:nodejs_interop/js.dart' as js;
import 'package:nodejs_interop/node.dart' as node;

Usage

  • I/O support: file, socket, HTTP, and other I/O support for Node.js applications.
  • JavaScript: support for interoperating with JavaScript APIs.
  • Node.js: support for interoperating with Node.js APIs.
  • npm packages: support for interoperating with a predefined set of npm packages.
  • Pub transformer: automate the addition of a Node.js preamble to build assets.

Examples

The following projects use this library to provide cross-platform features:

Unit tests

In order to run the tests, you must install the Node.js test dependencies by running the following command:

$ npm install

Then, you can launch the test runner from the command prompt:

$ pub run test

See also

License

Node.js Interop for Dart is distributed under the MIT License.

Changelog

This file contains highlights of what changes on each version of the Node.js Interop for Dart library.

Version 0.8.0

  • Breaking change: removed most classes of the nodejs_interop.js library (JSObject, Json, Reflect, TypedArray and Uint8Array).
  • Breaking change: removed the instance methods of the Buffer class, as this class is casted to the Uint8List class by the Dart runtime.
  • Breaking change: renamed the convertToFuture() function to asFuture().
  • Breaking change: renamed the convertToStream() function to asStream().
  • Breaking change: renamed the DeleteOptions class to DelOptions.
  • Breaking change: renamed the NodeProcess class to Process.
  • Breaking change: renamed the NodeRelease class to Release.
  • Breaking change: renamed the ReadStream class to FSReadStream.
  • Breaking change: renamed the WriteStream class to FSWriteStream.
  • Breaking change: the FileStat.fromStats() constructor is now private.
  • Added the tty module.
  • Added utility functions for converting functions following the Node.js callback style to a Future (e.g. fn1cb0ToFuture(), fn3cb2ToFuture(), ...).
  • Added the RandomAccessFile and SystemEncoding classes.
  • Added the asPromise(), deleteProperty() and getProperties() functions.
  • Added the Promise.JS$catch() method.
  • Added new unit tests.
  • Fixed the implementation of the FileStat class.
  • The nodejs_interop.js library exports the functions from the dart:js_util library.
  • Updated the Node.js dependencies.

Version 0.7.0

  • Breaking change: renamed the convertToDart() function to dartify().
  • Breaking change: renamed the ReaddirEnhancedModule class to ReaddirModule.
  • Breaking change: the nodejs_interop.io, nodejs_interop.js, nodejs_interop.node and nodejs_interop.npm libraries are no longer exported individually.
  • Added the exit() and sleep() functions.
  • Added the exitCode and pid properties.
  • Added the Buffer.BYTES_PER_ELEMENT static property.
  • Added the InternetAddress, InternetAddressType, JSObject, NetworkInterface, ProcessInfo and Reflect classes.
  • Added the minify option to the Pub transformer.
  • Added new methods to the Console and Uint8Array classes.
  • Added new unit tests.
  • Fixed the implementation of the dns module.

Version 0.6.0

  • Breaking change: renamed the Path class to PathObject.
  • Breaking change: renamed the ReadOptions class to ReadFileOptions.
  • Breaking change: renamed the ResolveOptions class to ResolveFunctionOptions.
  • Breaking change: renamed the WarningOptions class to EmitWarningOptions.
  • Breaking change: renamed the WriteOptions class to WriteFileOptions.
  • Added setters to properties of all @anonymous classes.
  • Added the dns module.
  • Added the querystring module.
  • Added the string_decoder module.
  • Added the url module.
  • Added a partial implementation of the process manager API.
  • Added a Pub transformer.
  • Finished the implementation of the util module.

Version 0.5.0

  • Breaking change: removed the FileStat.toJson() method.
  • Breaking change: renamed the Process class to NodeProcess.
  • Added the child_process module.
  • Added the cluster module.
  • Added the stream module.
  • Added the vm module.
  • Added the BufferEncoding.fromEncoding() method.
  • Added the current and systemTemp static properties to the Directory class.
  • Finished the implementation of the fs module.

Version 0.4.0

  • Breaking change: renamed the Js prefix to JS for JavaScript errors.
  • Breaking change: renamed the NodejsPlatform class to Platform.
  • Added bindings for a predefined set of npm packages.
  • Added the buffer module.
  • Added the console module.
  • Added the convertToStream() and loadLibrary() functions.
  • Added the Json, Module and Writable classes.
  • Added a partial implementation of the fs module.
  • Added a partial implementation of the util module.
  • Added a partial implementation of the file system API.
  • Finished the implementation of the Process class.
  • Finished the implementation of the require() function.
  • Splitted the library in modules: io, js, node and npm.

Version 0.3.0

  • Added the os module.
  • Added the convertToDart() and convertToFuture() functions.
  • Added the CpuUsage, NodejsPlatform and Promise classes.
  • Added a partial implementation of the Process class.

Version 0.2.0

  • Breaking change: renamed the PathObject class to Path.
  • Added the assert module.
  • Added the errors module.
  • Added the events module.

Version 0.1.0

  • Initial release: provides the require() function and the path module.

1. Depend on it

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


dependencies:
  nodejs_interop: "^0.8.0"

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:nodejs_interop/io.dart';

import 'package:nodejs_interop/js.dart';

import 'package:nodejs_interop/node.dart';

import 'package:nodejs_interop/npm.dart';

import 'package:nodejs_interop/transformer.dart';
        
Version Uploaded Documentation Archive
0.8.0 Jan 6, 2018 Go to the documentation of nodejs_interop 0.8.0 Download nodejs_interop 0.8.0 archive
0.7.0 Dec 17, 2017 Go to the documentation of nodejs_interop 0.7.0 Download nodejs_interop 0.7.0 archive
0.6.0 Dec 5, 2017 Go to the documentation of nodejs_interop 0.6.0 Download nodejs_interop 0.6.0 archive
0.5.0 Nov 23, 2017 Go to the documentation of nodejs_interop 0.5.0 Download nodejs_interop 0.5.0 archive
0.4.0 Nov 21, 2017 Go to the documentation of nodejs_interop 0.4.0 Download nodejs_interop 0.4.0 archive
0.3.0 Nov 14, 2017 Go to the documentation of nodejs_interop 0.3.0 Download nodejs_interop 0.3.0 archive
0.2.0 Nov 13, 2017 Go to the documentation of nodejs_interop 0.2.0 Download nodejs_interop 0.2.0 archive
0.1.0 Nov 10, 2017 Go to the documentation of nodejs_interop 0.1.0 Download nodejs_interop 0.1.0 archive

Analysis

This feature is new.
We welcome feedback.
More details: scoring.

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

  • tool failures on Jan 21, 2018
  • Dart: 2.0.0-dev.15.0
  • pana: 0.10.0

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
62 / 100
Health:
Code health derived from static analysis. [more]
98 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
95 / 100
Overall score:
Weighted score of the above. [more]
79

Platforms

Detected platforms: web, other

Multiple platform identified in libraries.

Suggestions

  • Fix lib/src/io/socket/network_interface.dart.

    Strong-mode analysis of lib/src/io/socket/network_interface.dart failed with the following error:

    line: 49 col: 3
    Invalid override. The type of 'NetworkInterface.index' ('() → String') isn't a subtype of 'NetworkInterface.index' ('() → int').

  • Fix issues reported by dartanalyzer.

    dartanalyzer reported 1 error(s) and 0 warning(s).

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use nodejs_interop.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.24.0 <2.0.0
barback ^0.15.2 0.15.2+14
collection ^1.14.3 1.14.5
file ^2.3.5 2.3.5
http ^0.11.3 0.11.3+16
js ^0.6.1 0.6.1
node_preamble ^1.4.0 1.4.0
path ^1.5.1 1.5.1
platform ^2.1.1 2.1.1
process ^2.0.7 2.0.7
tuple ^1.0.1 1.0.1
Transitive dependencies
async 2.0.3
charcode 1.1.1
http_parser 3.1.1
intl 0.15.2
meta 1.1.2
pool 1.3.4
quiver_hashcode 1.0.0
source_span 1.4.0
stack_trace 1.9.1
string_scanner 1.0.2
typed_data 1.1.5
Dev dependencies
grinder ^0.8.1
pub_semver ^1.3.2
test ^0.12.30