update
This commit is contained in:
+25
-7
@@ -4,22 +4,40 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.declare = declare;
|
||||
exports.declarePreset = void 0;
|
||||
|
||||
function declare(builder) {
|
||||
return (api, options, dirname) => {
|
||||
if (!api.assertVersion) {
|
||||
api = Object.assign(copyApiObject(api), {
|
||||
assertVersion(range) {
|
||||
throwVersionError(range, api.version);
|
||||
}
|
||||
var _clonedApi2;
|
||||
|
||||
});
|
||||
let clonedApi;
|
||||
|
||||
for (const name of Object.keys(apiPolyfills)) {
|
||||
var _clonedApi;
|
||||
|
||||
if (api[name]) continue;
|
||||
clonedApi = (_clonedApi = clonedApi) != null ? _clonedApi : copyApiObject(api);
|
||||
clonedApi[name] = apiPolyfills[name](clonedApi);
|
||||
}
|
||||
|
||||
return builder(api, options || {}, dirname);
|
||||
return builder((_clonedApi2 = clonedApi) != null ? _clonedApi2 : api, options || {}, dirname);
|
||||
};
|
||||
}
|
||||
|
||||
const declarePreset = declare;
|
||||
exports.declarePreset = declarePreset;
|
||||
const apiPolyfills = {
|
||||
assertVersion: api => range => {
|
||||
throwVersionError(range, api.version);
|
||||
},
|
||||
targets: () => () => {
|
||||
return {};
|
||||
},
|
||||
assumption: () => () => {
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
|
||||
function copyApiObject(api) {
|
||||
let proto = null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user