-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add __createBinding and __setModuleDefault helpers #89
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,7 +104,7 @@ export function __generator(thisArg, body) { | |
} | ||
|
||
export function __exportStar(m, exports) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
for (var p in m) if (!exports.hasOwnProperty(p)) __createBinding(exports, m, p); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should probably get in the habit of saving off intrinsics like this (i.e. That said, its up to @weswigham if he wants to take on that change for tslib right now, since it's out of scope for this change. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That said, we do call |
||
} | ||
|
||
export function __values(o) { | ||
|
@@ -188,8 +188,8 @@ 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]; | ||
result.default = mod; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
} | ||
|
||
|
@@ -211,3 +211,23 @@ export function __classPrivateFieldSet(receiver, privateMap, value) { | |
privateMap.set(receiver, value); | ||
return value; | ||
} | ||
|
||
export const __createBinding = (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { | ||
enumerable: true, | ||
get: function() { return m[k]; } | ||
}); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
|
||
export const __setModuleDefault = (Object.create ? (function(o, v) { | ||
weswigham marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Object.defineProperty(o, "default", { | ||
enumerable: true, | ||
value: v | ||
}); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); |
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -35,6 +35,8 @@ var __importStar; | |||
var __importDefault; | ||||
var __classPrivateFieldGet; | ||||
var __classPrivateFieldSet; | ||||
var __createBinding; | ||||
var __setModuleDefault; | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||
(function (factory) { | ||||
var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; | ||||
if (typeof define === "function" && define.amd) { | ||||
|
@@ -143,7 +145,7 @@ var __classPrivateFieldSet; | |||
}; | ||||
|
||||
__exportStar = function (m, exports) { | ||||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||||
for (var p in m) if (!exports.hasOwnProperty(p)) __createBinding(exports, m, p); | ||||
}; | ||||
|
||||
__values = function (o) { | ||||
|
@@ -227,8 +229,8 @@ var __classPrivateFieldSet; | |||
__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; | ||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||||
__setModuleDefault(result, mod); | ||||
return result; | ||||
}; | ||||
|
||||
|
@@ -251,6 +253,26 @@ var __classPrivateFieldSet; | |||
return value; | ||||
} | ||||
|
||||
__createBinding = (Object.create ? (function(o, m, k, k2) { | ||||
weswigham marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
if (k2 === undefined) k2 = k; | ||||
Object.defineProperty(o, k2, { | ||||
enumerable: true, | ||||
get: function() { return m[k]; } | ||||
}); | ||||
}) : (function(o, m, k, k2) { | ||||
if (k2 === undefined) k2 = k; | ||||
o[k2] = m[k]; | ||||
})); | ||||
|
||||
__setModuleDefault = (Object.create ? (function(o, v) { | ||||
weswigham marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
Object.defineProperty(o, "default", { | ||||
enumerable: true, | ||||
value: v | ||||
}); | ||||
}) : function(o, v) { | ||||
o["default"] = v; | ||||
}); | ||||
|
||||
exporter("__extends", __extends); | ||||
exporter("__assign", __assign); | ||||
exporter("__rest", __rest); | ||||
|
@@ -273,4 +295,6 @@ var __classPrivateFieldSet; | |||
exporter("__importDefault", __importDefault); | ||||
exporter("__classPrivateFieldGet", __classPrivateFieldGet); | ||||
exporter("__classPrivateFieldSet", __classPrivateFieldSet); | ||||
exporter("__createBinding", __createBinding); | ||||
exporter("__setModuleDefault", __setModuleDefault) | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure this actually needs to be exposed, since no TypeScript code will emit |
||||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be:
or