impiler

0.0.19 • Public • Published

Impiler

Impiler is an intermediate compiler which runs at compile time to intercept TypeScript before it is transpiled into JavaScript and generates a JSON schema that can be made available to any calling clients via a public API. When JSON is requested by a client during run-time, the data is put into a JSON schema wrapper which describes to the client how to renderthe JSON data into a JavaScript interpretation of the corresponding TypeScript entity. This allows for de/serialization from TypeScript into JSON (serialization) at compile-time and JSON into JavaScript (deserialization) at run-time.

Compile-time component

On the server, you respond to client data requests with JSON. Impiler allows you to"hook" into the TypeScript compilation process, which reads your TypeScript files and creates corresponding JSON schemas for any TypeScript entity adorned with a @Impile decorator.

Run-time Component

The client runs JavaScript. Because the explicit typing of your TypeScript objects are not available at run-time, we need some form of schema to describe the typing of our object in order for us to properly deserialize JSON into an object type of our choosing. By parsing the schema, we can re-construct and instantiate classes properly, according to how they were first defined in TypeScript.

Package Sidebar

Install

npm i impiler

Weekly Downloads

9

Version

0.0.19

License

MIT

Last publish

Collaborators

  • dannybullis