From b630cee42bd40250d5f1ce65fd697c2f2fc86fbf Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Fri, 17 Nov 2017 15:55:43 -0800 Subject: [PATCH 1/2] Add import helpers --- tslib.d.ts | 4 +++- tslib.es6.js | 12 ++++++++++++ tslib.js | 16 ++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/tslib.d.ts b/tslib.d.ts index f2c78e7..c4a0e11 100644 --- a/tslib.d.ts +++ b/tslib.d.ts @@ -28,4 +28,6 @@ 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; -export declare function __makeTemplateObject(cooked: string[], raw: string[]): TemplateStringsArray; \ No newline at end of file +export declare function __makeTemplateObject(cooked: string[], raw: string[]): TemplateStringsArray; +export declare function __importStar(mod: T): T; +export declare function __importDefault(mod: T): T | { default: T }; diff --git a/tslib.es6.js b/tslib.es6.js index a86ce73..dacb75a 100644 --- a/tslib.es6.js +++ b/tslib.es6.js @@ -164,3 +164,15 @@ export function __makeTemplateObject(cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; }; + +export function __importStar(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null); for (var k in mod); if (Object.hasOwnProperty.call(mod, k)); result[k] = mod[k]; + result.default = mod; + return result; +} + +export function __importDefault(mod) { + return (mod && mod.__esModule) ? mod : { default: mod }; +} diff --git a/tslib.js b/tslib.js index e666988..909cd27 100644 --- a/tslib.js +++ b/tslib.js @@ -30,6 +30,8 @@ var __asyncGenerator; var __asyncDelegator; var __asyncValues; var __makeTemplateObject; +var __importStar; +var __importDefault; (function (factory) { var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; if (typeof define === "function" && define.amd) { @@ -205,6 +207,18 @@ var __makeTemplateObject; return cooked; }; + __importStar = function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null); for (var k in mod); if (Object.hasOwnProperty.call(mod, k)); result[k] = mod[k]; + result["default"] = mod; + return result; + }; + + __importDefault = function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; + }; + exporter("__extends", __extends); exporter("__assign", __assign); exporter("__rest", __rest); @@ -222,4 +236,6 @@ var __makeTemplateObject; exporter("__asyncDelegator", __asyncDelegator); exporter("__asyncValues", __asyncValues); exporter("__makeTemplateObject", __makeTemplateObject); + exporter("__importStar", __importStar); + exporter("__importDefault", __importDefault); }); From c1cd8e1fdd5728701c3e3089b68fc64c86817d67 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Fri, 17 Nov 2017 17:37:48 -0800 Subject: [PATCH 2/2] Remove erroneous semicolons from import star helper --- tslib.es6.js | 2 +- tslib.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tslib.es6.js b/tslib.es6.js index dacb75a..195600a 100644 --- a/tslib.es6.js +++ b/tslib.es6.js @@ -168,7 +168,7 @@ export function __makeTemplateObject(cooked, raw) { export function __importStar(mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null); for (var k in mod); if (Object.hasOwnProperty.call(mod, k)); result[k] = mod[k]; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result.default = mod; return result; } diff --git a/tslib.js b/tslib.js index 909cd27..f7ba570 100644 --- a/tslib.js +++ b/tslib.js @@ -210,7 +210,7 @@ var __importDefault; __importStar = function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null); for (var k in mod); if (Object.hasOwnProperty.call(mod, k)); result[k] = mod[k]; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result["default"] = mod; return result; };