UNPKG

@jameslnewell/buildkite-pipelines

Version:
92 lines (91 loc) 3.07 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "Plugin", { enumerable: true, get: function() { return Plugin; } }); function _check_private_redeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } } function _class_apply_descriptor_get(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; } function _class_apply_descriptor_set(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } } function _class_extract_field_descriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); } function _class_private_field_get(receiver, privateMap) { var descriptor = _class_extract_field_descriptor(receiver, privateMap, "get"); return _class_apply_descriptor_get(receiver, descriptor); } function _class_private_field_init(obj, privateMap, value) { _check_private_redeclaration(obj, privateMap); privateMap.set(obj, value); } function _class_private_field_set(receiver, privateMap, value) { var descriptor = _class_extract_field_descriptor(receiver, privateMap, "set"); _class_apply_descriptor_set(receiver, descriptor, value); return value; } var _name = /*#__PURE__*/ new WeakMap(), _options = /*#__PURE__*/ new WeakMap(); class Plugin { setName(name) { _class_private_field_set(this, _name, name); return this; } options(options) { if (options) { _class_private_field_set(this, _options, options); return this; } else { return _class_private_field_get(this, _options); } } setOptions(options) { _class_private_field_set(this, _options, options); return this; } build() { if (!_class_private_field_get(this, _name)) throw new Error('Plugin must have a name'); return { [_class_private_field_get(this, _name)]: _class_private_field_get(this, _options) }; } /** * @param name This parameter is deprecated * @param options This parameter is deprecated */ constructor(name = '', options){ _class_private_field_init(this, _name, { writable: true, value: void 0 }); _class_private_field_init(this, _options, { writable: true, value: null }); _class_private_field_set(this, _name, name); _class_private_field_set(this, _options, options !== null && options !== void 0 ? options : null); } } //# sourceMappingURL=Plugin.js.map