New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

typescript.api

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typescript.api - npm Package Compare versions

Comparing version 0.4.3 to 0.4.4

decl/ecma.d.ts

2

package.json
{
"name": "typescript.api",
"version": "0.4.3",
"version": "0.4.4",
"description": "A compiler as a service api enabling nodejs developers to programatically resolve, compile, reflect and run typescript 0.9 source files.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -34,3 +34,9 @@ # typescript.api

* [compiler options](#options)
* [declarations](#declarations)
### objects
* [source unit](#source_unit)
* [compiled unit](#compiled_unit)
### methods

@@ -115,4 +121,75 @@

## reference
<a name="declarations" />
### declarations
It is important to note that the typescript.api does not automatically reference any declarations (such as lib.d.ts) for compilation.
Because of this, you will need to reference the appropriate *.d.ts required by your application for compilation. This is unlike the
tsc command line compiler which will, by default reference the lib.d.ts declaration if not stated otherwise. (see --nolib option).
In the context of nodejs, the dom declarations declared in lib.d.ts are unnessasary and dramatically slow compilation times. The
typescript.api splits these declarations out to provide suitable environment declarations that you can reference in your project.
The typescript.api comes bundled with following declarations:
```javascript
// ecma api + html dom declarations (suitable for browser development)
[node_modules]/typescript.api/decl/lib.d.ts
// ecma api + node.d.ts declarations (suitable for nodejs development)
[node_modules]/typescript.api/decl/node.d.ts
// ecma api only.
[node_modules]/typescript.api/decl/ecma.d.ts
```
It is recommended that developers copy the appropriate declarations suitable for their environment into their project structure and
reference them accordingly.
For other additional declarations, see https://github.com/borisyankov/DefinitelyTyped.
## objects
<a name="source_unit" />
### source unit
The typescript.api accepts source units for compilation. A source unit consists of the following properties:
```javascript
sourceUnit = {
path : string, // (public) the path of this source unit.
content : string, // (public) the typescript source of this unit.
remote : boolean, // (public) if this source file is loaded over http.
references : Function // (public) returns an array of references for this source unit.
diagnostics : [object], // (public) compilation errors for this unit. 0 length if none.
};
```
note: For manually creating source units, see [create](#create)
note: For loading source units from disk. see [resolve](#resolve)
<a name="compiled_unit" />
### compiled unit
A compiled unit is the output from a [compilation](#compile). A compiled unit consists of the following properties:
```javascript
compiledUnit = {
path : string, // (public) the path of this unit.
content : string, // (public) the javascript source of this unit.
references : Function // (public) returns an array of references for this unit.
diagnostics : [object], // (public) compilation errors for this unit. 0 length if none.
ast : object, // (public) AST for this unit.
declaration : string, // (public) The declaration source for this unit.
sourcemap : string, // (public) The sourcemap for this unit.
reflection : object, // (public) The units reflected members.
};
```
## methods
<a name="resolve" />

@@ -208,3 +285,3 @@ ### typescript.resolve (sources, callback)

var sourceUnit = typescript.create("temp.ts", "console.log('hello world');");
var sourceUnit = typescript.create("temp.ts", "export var message = 'hello world'");

@@ -215,3 +292,3 @@ typescript.compile([sourceUnit], function(compiled) {

// will output hello world..
console.log(context.message); // outputs hello world
});

@@ -218,0 +295,0 @@

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc