Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: gulp generate-runtime-helpers
- Loading branch information
Showing
1 changed file
with
29 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,36 @@ | ||
/* | ||
* This file is auto-generated! Do not modify it directly. | ||
* To re-generate run 'make build' | ||
* To re-generate run 'yarn gulp generate-runtime-helpers' | ||
*/ | ||
|
||
import template from "@babel/template"; | ||
|
||
export const asyncIterator = { | ||
minVersion: "7.15.9", | ||
ast: () => | ||
template.program.ast( | ||
'export default function _asyncIterator(iterable){var method,async,sync,retry=2;if(typeof Symbol!=="undefined"){async=Symbol.asyncIterator;sync=Symbol.iterator}\nwhile(retry--){if(async&&(method=iterable[async])!=null){return method.call(iterable)}\nif(sync&&(method=iterable[sync])!=null){return new AsyncFromSyncIterator(method.call(iterable))}\nasync="@@asyncIterator";sync="@@iterator"}\nthrow new TypeError("Object is not async iterable")}\nfunction AsyncFromSyncIterator(s){AsyncFromSyncIterator=function(s){this.s=s;this.n=s.next};AsyncFromSyncIterator.prototype={s:null,n:null,next:function(){return AsyncFromSyncIteratorContinuation(this.n.apply(this.s,arguments))},return:function(value){var ret=this.s.return;if(ret===undefined){return Promise.resolve({value:value,done:true})}\nreturn AsyncFromSyncIteratorContinuation(ret.apply(this.s,arguments))},throw:function(value){var thr=this.s.return;if(thr===undefined)return Promise.reject(value);return AsyncFromSyncIteratorContinuation(thr.apply(this.s,arguments))}};function AsyncFromSyncIteratorContinuation(r){if(Object(r)!==r){return Promise.reject(new TypeError(r+" is not an object."))}\nvar done=r.done;return Promise.resolve(r.value).then(function(value){return{value:value,done:done}})}\nreturn new AsyncFromSyncIterator(s)}', | ||
), | ||
}; | ||
function helper(minVersion, source) { | ||
return Object.freeze({ | ||
minVersion, | ||
ast: () => template.program.ast(source), | ||
}); | ||
} | ||
|
||
export const jsx = { | ||
minVersion: "7.0.0-beta.0", | ||
ast: () => | ||
template.program.ast( | ||
'var REACT_ELEMENT_TYPE;export default function _createRawReactElement(type,props,key,children){if(!REACT_ELEMENT_TYPE){REACT_ELEMENT_TYPE=\n(typeof Symbol==="function"&&Symbol["for"]&&Symbol["for"]("react.element"))||0xeac7}\nvar defaultProps=type&&type.defaultProps;var childrenLength=arguments.length-3;if(!props&&childrenLength!==0){props={children:void 0}}\nif(childrenLength===1){props.children=children}else if(childrenLength>1){var childArray=new Array(childrenLength);for(var i=0;i<childrenLength;i++){childArray[i]=arguments[i+3]}\nprops.children=childArray}\nif(props&&defaultProps){for(var propName in defaultProps){if(props[propName]===void 0){props[propName]=defaultProps[propName]}}}else if(!props){props=defaultProps||{}}\nreturn{$$typeof:REACT_ELEMENT_TYPE,type:type,key:key===undefined?null:""+key,ref:null,props:props,_owner:null}}', | ||
), | ||
}; | ||
|
||
export const objectSpread2 = { | ||
minVersion: "7.5.0", | ||
ast: () => | ||
template.program.ast( | ||
'import defineProperty from"defineProperty";function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})}\nkeys.push.apply(keys,symbols)}\nreturn keys}\nexport default function _objectSpread2(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};if(i%2){ownKeys(Object(source),true).forEach(function(key){defineProperty(target,key,source[key])})}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}}\nreturn target}', | ||
), | ||
}; | ||
|
||
export { _typeof as typeof }; | ||
const _typeof = { | ||
minVersion: "7.0.0-beta.0", | ||
ast: () => | ||
template.program.ast( | ||
'export default function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function(obj){return typeof obj}}else{_typeof=function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj}}\nreturn _typeof(obj)}', | ||
), | ||
}; | ||
|
||
export const wrapRegExp = { | ||
minVersion: "7.2.6", | ||
ast: () => | ||
template.program.ast( | ||
'import setPrototypeOf from"setPrototypeOf";import inherits from"inherits";export default function _wrapRegExp(){_wrapRegExp=function(re,groups){return new BabelRegExp(re,undefined,groups)};var _super=RegExp.prototype;var _groups=new WeakMap();function BabelRegExp(re,flags,groups){var _this=new RegExp(re,flags);_groups.set(_this,groups||_groups.get(re));return setPrototypeOf(_this,BabelRegExp.prototype)}\ninherits(BabelRegExp,RegExp);BabelRegExp.prototype.exec=function(str){var result=_super.exec.call(this,str);if(result)result.groups=buildGroups(result,this);return result};BabelRegExp.prototype[Symbol.replace]=function(str,substitution){if(typeof substitution==="string"){var groups=_groups.get(this);return _super[Symbol.replace].call(this,str,substitution.replace(/\\$<([^>]+)>/g,function(_,name){return"$"+groups[name]}))}else if(typeof substitution==="function"){var _this=this;return _super[Symbol.replace].call(this,str,function(){var args=arguments;if(typeof args[args.length-1]!=="object"){args=[].slice.call(args);args.push(buildGroups(args,_this))}\nreturn substitution.apply(this,args)})}else{return _super[Symbol.replace].call(this,str,substitution)}};function buildGroups(result,re){var g=_groups.get(re);return Object.keys(g).reduce(function(groups,name){groups[name]=result[g[name]];return groups},Object.create(null))}\nreturn _wrapRegExp.apply(this,arguments)}', | ||
), | ||
}; | ||
export default Object.freeze({ | ||
asyncIterator: helper( | ||
"7.15.9", | ||
'export default function _asyncIterator(iterable){var method,async,sync,retry=2;if(typeof Symbol!=="undefined"){async=Symbol.asyncIterator;sync=Symbol.iterator}\nwhile(retry--){if(async&&(method=iterable[async])!=null){return method.call(iterable)}\nif(sync&&(method=iterable[sync])!=null){return new AsyncFromSyncIterator(method.call(iterable))}\nasync="@@asyncIterator";sync="@@iterator"}\nthrow new TypeError("Object is not async iterable")}\nfunction AsyncFromSyncIterator(s){AsyncFromSyncIterator=function(s){this.s=s;this.n=s.next};AsyncFromSyncIterator.prototype={s:null,n:null,next:function(){return AsyncFromSyncIteratorContinuation(this.n.apply(this.s,arguments))},return:function(value){var ret=this.s.return;if(ret===undefined){return Promise.resolve({value:value,done:true})}\nreturn AsyncFromSyncIteratorContinuation(ret.apply(this.s,arguments))},throw:function(value){var thr=this.s.return;if(thr===undefined)return Promise.reject(value);return AsyncFromSyncIteratorContinuation(thr.apply(this.s,arguments))}};function AsyncFromSyncIteratorContinuation(r){if(Object(r)!==r){return Promise.reject(new TypeError(r+" is not an object."))}\nvar done=r.done;return Promise.resolve(r.value).then(function(value){return{value:value,done:done}})}\nreturn new AsyncFromSyncIterator(s)}', | ||
), | ||
jsx: helper( | ||
"7.0.0-beta.0", | ||
'var REACT_ELEMENT_TYPE;export default function _createRawReactElement(type,props,key,children){if(!REACT_ELEMENT_TYPE){REACT_ELEMENT_TYPE=\n(typeof Symbol==="function"&&Symbol["for"]&&Symbol["for"]("react.element"))||0xeac7}\nvar defaultProps=type&&type.defaultProps;var childrenLength=arguments.length-3;if(!props&&childrenLength!==0){props={children:void 0}}\nif(childrenLength===1){props.children=children}else if(childrenLength>1){var childArray=new Array(childrenLength);for(var i=0;i<childrenLength;i++){childArray[i]=arguments[i+3]}\nprops.children=childArray}\nif(props&&defaultProps){for(var propName in defaultProps){if(props[propName]===void 0){props[propName]=defaultProps[propName]}}}else if(!props){props=defaultProps||{}}\nreturn{$$typeof:REACT_ELEMENT_TYPE,type:type,key:key===undefined?null:""+key,ref:null,props:props,_owner:null}}', | ||
), | ||
objectSpread2: helper( | ||
"7.5.0", | ||
'import defineProperty from"defineProperty";function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})}\nkeys.push.apply(keys,symbols)}\nreturn keys}\nexport default function _objectSpread2(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};if(i%2){ownKeys(Object(source),true).forEach(function(key){defineProperty(target,key,source[key])})}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}}\nreturn target}', | ||
), | ||
typeof: helper( | ||
"7.0.0-beta.0", | ||
'export default function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function(obj){return typeof obj}}else{_typeof=function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj}}\nreturn _typeof(obj)}', | ||
), | ||
wrapRegExp: helper( | ||
"7.2.6", | ||
'import setPrototypeOf from"setPrototypeOf";import inherits from"inherits";export default function _wrapRegExp(){_wrapRegExp=function(re,groups){return new BabelRegExp(re,undefined,groups)};var _super=RegExp.prototype;var _groups=new WeakMap();function BabelRegExp(re,flags,groups){var _this=new RegExp(re,flags);_groups.set(_this,groups||_groups.get(re));return setPrototypeOf(_this,BabelRegExp.prototype)}\ninherits(BabelRegExp,RegExp);BabelRegExp.prototype.exec=function(str){var result=_super.exec.call(this,str);if(result)result.groups=buildGroups(result,this);return result};BabelRegExp.prototype[Symbol.replace]=function(str,substitution){if(typeof substitution==="string"){var groups=_groups.get(this);return _super[Symbol.replace].call(this,str,substitution.replace(/\\$<([^>]+)>/g,function(_,name){return"$"+groups[name]}))}else if(typeof substitution==="function"){var _this=this;return _super[Symbol.replace].call(this,str,function(){var args=arguments;if(typeof args[args.length-1]!=="object"){args=[].slice.call(args);args.push(buildGroups(args,_this))}\nreturn substitution.apply(this,args)})}else{return _super[Symbol.replace].call(this,str,substitution)}};function buildGroups(result,re){var g=_groups.get(re);return Object.keys(g).reduce(function(groups,name){groups[name]=result[g[name]];return groups},Object.create(null))}\nreturn _wrapRegExp.apply(this,arguments)}', | ||
), | ||
}); |