aboutsummaryrefslogtreecommitdiff
path: root/node_modules/tslib
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/tslib')
-rw-r--r--node_modules/tslib/README.md45
-rw-r--r--node_modules/tslib/bower.json2
-rw-r--r--node_modules/tslib/package.json2
-rw-r--r--node_modules/tslib/tslib.d.ts3
-rw-r--r--node_modules/tslib/tslib.es6.js9
-rw-r--r--node_modules/tslib/tslib.js17
6 files changed, 64 insertions, 14 deletions
diff --git a/node_modules/tslib/README.md b/node_modules/tslib/README.md
index 86559d9cf..b44cba07d 100644
--- a/node_modules/tslib/README.md
+++ b/node_modules/tslib/README.md
@@ -1,19 +1,47 @@
-# Runtime
+# tslib
This is a runtime library for [TypeScript](http://www.typescriptlang.org/) that contains all of the TypeScript helper functions.
+This library is primarily used by the `--importHelpers` flag in TypeScript.
+When using `--importHelpers`, a module that uses helper functions like `__extends` and `__assign` in the following emitted file:
+
+```ts
+var __assign = (this && this.__assign) || Object.assign || function(t) {
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
+ s = arguments[i];
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
+ t[p] = s[p];
+ }
+ return t;
+};
+exports.x = {};
+exports.y = __assign({}, exports.x);
+
+```
+
+will instead be emitted as something like the following:
+
+```ts
+var tslib_1 = require("tslib");
+exports.x = {};
+exports.y = tslib_1.__assign({}, exports.x);
+```
+
+Because this can avoid duplicate declarations of things like `__extends`, `__assign`, etc., this means delivering users smaller files on average, as well as less runtime overhead.
+For optimized bundles with TypeScript, you should absolutely consider using `tslib` and `--importHelpers`.
+
# Installing
-For the latest stable version:
+For the latest stable version, run:
## npm
```sh
# TypeScript 2.3.3 or later
-npm install tslib
+npm install --save tslib
# TypeScript 2.3.2 or earlier
-npm install tslib@1.6.1
+npm install --save tslib@1.6.1
```
## bower
@@ -30,10 +58,10 @@ bower install tslib@1.6.1
```sh
# TypeScript 2.3.3 or later
-jspm install npm:tslib
+jspm install tslib
# TypeScript 2.3.2 or earlier
-jspm install npm:tslib@1.6.1
+jspm install tslib@1.6.1
```
# Usage
@@ -76,11 +104,11 @@ For JSPM users:
```json
{
"compilerOptions": {
- "module": "System",
+ "module": "system",
"importHelpers": true,
"baseUrl": "./",
"paths": {
- "tslib" : ["jspm_packages/npm/tslib@1.7.0/tslib.d.ts"]
+ "tslib" : ["jspm_packages/npm/tslib@1.8.1/tslib.d.ts"]
}
}
}
@@ -90,6 +118,7 @@ For JSPM users:
# Contribute
There are many ways to [contribute](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md) to TypeScript.
+
* [Submit bugs](https://github.com/Microsoft/TypeScript/issues) and help us verify fixes as they are checked in.
* Review the [source code changes](https://github.com/Microsoft/TypeScript/pulls).
* Engage with other TypeScript users and developers on [StackOverflow](http://stackoverflow.com/questions/tagged/typescript).
diff --git a/node_modules/tslib/bower.json b/node_modules/tslib/bower.json
index 5300c530e..b9bcf5d3e 100644
--- a/node_modules/tslib/bower.json
+++ b/node_modules/tslib/bower.json
@@ -4,7 +4,7 @@
"Microsoft Corp."
],
"homepage": "http://typescriptlang.org/",
- "version": "1.7.1",
+ "version": "1.8.1",
"license": "Apache-2.0",
"description": "Runtime library for TypeScript helper functions",
"keywords": [
diff --git a/node_modules/tslib/package.json b/node_modules/tslib/package.json
index cbee2e202..1f8529595 100644
--- a/node_modules/tslib/package.json
+++ b/node_modules/tslib/package.json
@@ -2,7 +2,7 @@
"name": "tslib",
"author": "Microsoft Corp.",
"homepage": "http://typescriptlang.org/",
- "version": "1.7.1",
+ "version": "1.8.1",
"license": "Apache-2.0",
"description": "Runtime library for TypeScript helper functions",
"keywords": [
diff --git a/node_modules/tslib/tslib.d.ts b/node_modules/tslib/tslib.d.ts
index 08217ba6f..f2c78e759 100644
--- a/node_modules/tslib/tslib.d.ts
+++ b/node_modules/tslib/tslib.d.ts
@@ -27,4 +27,5 @@ export declare function __spread(...args: any[]): any[];
export declare function __await(v: any): any;
export declare function __asyncGenerator(thisArg: any, _arguments: any, generator: Function): any;
export declare function __asyncDelegator(o: any): any;
-export declare function __asyncValues(o: any): any; \ No newline at end of file
+export declare function __asyncValues(o: any): any;
+export declare function __makeTemplateObject(cooked: string[], raw: string[]): TemplateStringsArray; \ No newline at end of file
diff --git a/node_modules/tslib/tslib.es6.js b/node_modules/tslib/tslib.es6.js
index 220224994..a86ce73c6 100644
--- a/node_modules/tslib/tslib.es6.js
+++ b/node_modules/tslib/tslib.es6.js
@@ -60,7 +60,7 @@ export function __metadata(metadataKey, metadataValue) {
export function __awaiter(thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
- function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
@@ -158,4 +158,9 @@ export function __asyncValues(o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator];
return m ? m.call(o) : typeof __values === "function" ? __values(o) : o[Symbol.iterator]();
-} \ No newline at end of file
+}
+
+export function __makeTemplateObject(cooked, raw) {
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
+ return cooked;
+};
diff --git a/node_modules/tslib/tslib.js b/node_modules/tslib/tslib.js
index f8c5d0e08..e666988bb 100644
--- a/node_modules/tslib/tslib.js
+++ b/node_modules/tslib/tslib.js
@@ -29,6 +29,7 @@ var __await;
var __asyncGenerator;
var __asyncDelegator;
var __asyncValues;
+var __makeTemplateObject;
(function (factory) {
var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {};
if (typeof define === "function" && define.amd) {
@@ -41,6 +42,14 @@ var __asyncValues;
factory(createExporter(root));
}
function createExporter(exports, previous) {
+ if (exports !== root) {
+ if (typeof Object.create === "function") {
+ Object.defineProperty(exports, "__esModule", { value: true });
+ }
+ else {
+ exports.__esModule = true;
+ }
+ }
return function (id, v) { return exports[id] = previous ? previous(id, v) : v; };
}
})
@@ -191,6 +200,11 @@ var __asyncValues;
return m ? m.call(o) : typeof __values === "function" ? __values(o) : o[Symbol.iterator]();
};
+ __makeTemplateObject = function (cooked, raw) {
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
+ return cooked;
+ };
+
exporter("__extends", __extends);
exporter("__assign", __assign);
exporter("__rest", __rest);
@@ -207,4 +221,5 @@ var __asyncValues;
exporter("__asyncGenerator", __asyncGenerator);
exporter("__asyncDelegator", __asyncDelegator);
exporter("__asyncValues", __asyncValues);
-}); \ No newline at end of file
+ exporter("__makeTemplateObject", __makeTemplateObject);
+});