Git Product home page Git Product logo

js_facade_gen's Introduction

Build Status

Generates package:js JavaScript interop facades for arbitrary TypeScript libraries.

Installation

  • Install Node.js
    • We depend on Node.js so that we can analyze TypeScript files using the TypeScript Compiler API in the TypeScript package. This ensures we parse d.ts consistently with other tools.
  • Execute npm install -g dart_js_facade_gen to install.

Usage

Basic

dart_js_facade_gen <input d.ts file>
Dart interop facade file is written to stdout.

Advanced

dart_js_facade_gen --destination=<destination-dir> --base-path=<input d.ts file directory> <input d.ts file> <input d.ts file> ...

Flags

--destination=<destination-dir>: Output generated code to destination-dir.
--base-path=<input d.ts file directory>: Specify the directory that contains the input d.ts files.
--skip-formatting: Skips running dart-format on the output. This is useful for large files (like dom.d.ts) since the node package version of dart-format is significantly slower than the version in the SDK.
--generate-html: Generate facades for dart:html types rather than importing them.
--rename-conflicting-types: Rename types to avoid conflicts in cases where a variable and a type have the exact same name, but it is not clear if they are related or not.
--explicit-static: Disables default assumption that properties declared on the anonymous types of top level variable declarations are static.
--trust-js-types: Emits @anonymous tags on classes that have neither constructors nor static members. This prevents the Dart Dev Compiler from checking whether or not objects are truly instances of those classes. This flag should be used if the input JS/TS library has structural types, or is otherwise claiming that types match in cases where the correct JS prototype is not there for DDC to check against.

Example

dart_js_facade_gen --destination=/usr/foo/tmp/chartjs/lib --base-path=/usr/foo/git/DefinitelyTyped/chartjs /usr/foo/git/DefinitelyTyped/chartjs/chart.d.ts

Gulp tasks

  • gulp watch executes the unit tests in watch mode (use gulp test.unit for a single run),
  • gulp test.check-format checks the source code formatting using clang-format,
  • gulp test runs unit tests and checks the source code formatting.

Publish

  • npm run prepublish
  • npm publish

js_facade_gen's People

Contributors

derekxu16 avatar ditman avatar jacob314 avatar kevmoo avatar srujzs avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.