Skip to content

Instantly share code, notes, and snippets.

Proposed module resolution strategy

Proposed set of rules is an extension to baseUrl based mechanics used by RequireJS or SystemJS.

Core elements of the system are baseUrl and path mappings. Resolution process describes how they are used together.

BaseUrl

All non-rooted paths are computed relative to baseUrl. Value of baseUrl is determined as either:

var process = ...
var timeout = ...
var tcs = new TaskCompletionSource<object>();
process.Exited += delegate {
tcs.SetResult(null);
};
if (await Task.WhenAny(tcs.Task, Task.Delay(timeout)) != tcs.Task)
{
process.Kill();
}
@vladima
vladima / output.txt
Created February 23, 2017 18:16
Compiling TypeScript language service
vladima@vladima-HP:~/Sources/git/TypeScript$ node --version
v7.6.0
vladima@vladima-HP:~/Sources/git/TypeScript$ node -e "console.log(process.versions.v8)"
5.5.372.40
vladima@vladima-HP:~/Sources/git/TypeScript$ node built/local/tsc.js -p src/server/ --noEmit --diagnostics
Files: 99
Lines: 120541
Nodes: 579310
Identifiers: 213907
Symbols: 118481
function foo(t: any) {
var $isMobile = t.mobile() !== null;
if (
// Apple iOS 3.2-5.1 - Tested on the original iPad (4.3 / 5.0), iPad 2 (4.3), iPad 3 (5.1), original iPhone (3.1), iPhone 3 (3.2), 3GS (4.3), 4 (4.3 / 5.0), and 4S (5.1)
t.os('iOS') && t.version('iPad')>=4.3 ||
t.os('iOS') && t.version('iPhone')>=3.1 ||
t.os('iOS') && t.version('iPod')>=3.1 ||
// Android 2.1-2.3 - Tested on the HTC Incredible (2.2), original Droid (2.2), HTC Aria (2.1), Google Nexus S (2.3). Functional on 1.5 & 1.6 but performance may be sluggish, tested on Google G1 (1.5)
// Android 3.1 (Honeycomb) - Tested on the Samsung Galaxy Tab 10.1 and Motorola XOOM
class UnmanagedMemoryWriter: Stream
{
private static T NotImplemented<T>()
{
throw new NotImplementedException();
}
private UnmanagedMemoryWriter()
{
}
declare function defineCore(name: string, deps: string[], f: (require, exports,...deps: string[]) => void);
function define(name: string, deps: string[], f: (require, exports,...deps: string[]) => void) {
defineCore(name, deps, (require, exports, deps) => {
require(name);
f(require, exports, deps);
})
}
define(["require", "exports"], function (require, exports) {
"use strict";
exports.x = 12;
require("./a");
});
import * as ts from "typescript";
const fileName = "test.ts";
const program = ts.createProgram([fileName], {});
const typeChecker = program.getTypeChecker();
const file = program.getSourceFile(fileName);
// use getSignatureFromDeclaration
{
const ctorDecl = ts.forEachChild(file, function find(n) {
import * as ts from "typescript";
// Note: this uses ts.formatting which is part of the typescript 1.4 package but is not currently
// exposed in the public typescript.d.ts. The typings should be exposed in the next release.
function format(text: string) {
let options = getDefaultOptions();
// Parse the source text
let sourceFile = ts.createSourceFile("file.ts", text, ts.ScriptTarget.Latest, /*setParentPointers*/ true);
"use strict";
var ts = require('typescript');
console.log(ts.SyntaxKind.CallExpression);