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.2.5 to 0.2.6

8

index.js

@@ -91,6 +91,10 @@

var api = load_typescript_api();
var sorted = api.Resolve.UnitTopology.sort(sourceUnits);
return sorted;
return api.Resolve.Topology.sort(sourceUnits);
}
exports.sort = sort;
function graph(sourceUnits) {
var api = load_typescript_api();
return api.Resolve.Topology.graph(sourceUnits);
}
exports.graph = graph;
function compile(sourceUnits, callback) {

@@ -97,0 +101,0 @@ var api = load_typescript_api();

{
"name": "typescript.api",
"version": "0.2.5",
"version": "0.2.6",
"description": "A compiler as a service api enabling nodejs developers to resolve, compile, reflect and run typescript 0.9 source files.",

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

@@ -178,2 +178,58 @@ # typescript.api

### typescript.sort ( units )
Will attempt to sort source units in order of dependency. If cyclic referencing
occurs, the sort will return the units in order in which they are received.
__arguments__
* units - An array of source units to be sorted.
* returns - the sorted units in order of dependency.
__example__
The following will create a series of source units which reference each other
as in the following graph. The units are first randomized and then sorted. The
resulting sort will be the order of a, b, c, d, e, f.
```javascript
/*
[a]
/ \
[b] [c]
/ \ / \
[d] [e] [f]
*/
function shuffle(o) {
for(var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
return o;
};
var units = [
typescript.create("a.ts", ""),
typescript.create("b.ts", "/// <reference path='a.ts' />"),
typescript.create("c.ts", "/// <reference path='a.ts' />"),
typescript.create("d.ts", "/// <reference path='b.ts' />"),
typescript.create("e.ts", "/// <reference path='b.ts' />\n/// <reference path='c.ts' />\n"),
typescript.create("f.ts", "/// <reference path='c.ts' />"),
];
// shuffle
units = shuffle(units);
// sort
units = typescript.sort(units);
// display
for (var n in units) {
console.log(units[n].path);
}
```
### typescript.compile ( units, callback )

@@ -180,0 +236,0 @@

@@ -116,5 +116,13 @@ declare module TypeScript.Api.Units {

declare module TypeScript.Api.Resolve {
class UnitTopology {
class Node {
public path: string;
public references: string[];
constructor();
}
class Topology {
static graph(units: Units.SourceUnit[]): Node[];
static sort(units: Units.SourceUnit[]): Units.SourceUnit[];
}
}
declare module TypeScript.Api.Resolve {
class LoadParameter {

@@ -121,0 +129,0 @@ public parent_filename: string;

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