UNPKG

@autorest/modelerfour

Version:
1,237 lines (1,168 loc) 1.57 MB
/******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ "../../../common/temp/node_modules/.pnpm/@azure-tools+async-io@3.0.254/node_modules/@azure-tools/async-io/dist/file-io.js": /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.rmFile = exports.rmdir = exports.isFile = exports.readBinaryFile = exports.readFile = exports.mkdir = exports.isDirectory = exports.lstat = exports.writeFile = exports.close = exports.readdir = exports.exists = exports.filePath = exports.UnableToMakeDirectoryException = exports.UnableToRemoveException = exports.PathIsNotDirectoryException = exports.PathIsNotFileException = exports.PathNotFoundException = void 0; const tasks_1 = __webpack_require__("../../../common/temp/node_modules/.pnpm/@azure-tools+tasks@3.0.255/node_modules/@azure-tools/tasks/dist/main.js"); const fs = __webpack_require__("fs"); const path = __webpack_require__("path"); const url_1 = __webpack_require__("url"); class PathNotFoundException extends tasks_1.Exception { constructor(path, exitCode = 1) { super(`File '${path}' not found.`, exitCode); this.exitCode = exitCode; Object.setPrototypeOf(this, PathNotFoundException.prototype); } } exports.PathNotFoundException = PathNotFoundException; class PathIsNotFileException extends tasks_1.Exception { constructor(path, exitCode = 1) { super(`File '${path}' is not a file.`, exitCode); this.exitCode = exitCode; Object.setPrototypeOf(this, PathIsNotFileException.prototype); } } exports.PathIsNotFileException = PathIsNotFileException; class PathIsNotDirectoryException extends tasks_1.Exception { constructor(path, exitCode = 1) { super(`File '${path}' is not a directory.`, exitCode); this.exitCode = exitCode; Object.setPrototypeOf(this, PathIsNotFileException.prototype); } } exports.PathIsNotDirectoryException = PathIsNotDirectoryException; class UnableToRemoveException extends tasks_1.Exception { constructor(path, exitCode = 1) { super(`Unable to remove '${path}'.`, exitCode); this.exitCode = exitCode; Object.setPrototypeOf(this, UnableToRemoveException.prototype); } } exports.UnableToRemoveException = UnableToRemoveException; class UnableToMakeDirectoryException extends tasks_1.Exception { constructor(path, exitCode = 1) { super(`Unable to create directory '${path}'.`, exitCode); this.exitCode = exitCode; Object.setPrototypeOf(this, UnableToMakeDirectoryException.prototype); } } exports.UnableToMakeDirectoryException = UnableToMakeDirectoryException; function filePath(path) { path = path.toString(); return path.startsWith('file:///') ? url_1.fileURLToPath(path) : path; } exports.filePath = filePath; exports.exists = tasks_1.promisify(fs.exists); exports.readdir = tasks_1.promisify(fs.readdir); exports.close = tasks_1.promisify(fs.close); exports.writeFile = tasks_1.promisify(fs.writeFile); exports.lstat = tasks_1.promisify(fs.lstat); const rmdirInternal = tasks_1.promisify(fs.rmdir); const unlinkInternal = tasks_1.promisify(fs.unlink); const mkdirInternal = tasks_1.promisify(fs.mkdir); const openInternal = tasks_1.promisify(fs.open); const closeInternal = tasks_1.promisify(fs.close); async function isDirectory(dirPath) { try { if (await exports.exists(dirPath)) { return (await exports.lstat(dirPath)).isDirectory(); } } catch (e) { // don't throw! } return false; } exports.isDirectory = isDirectory; async function mkdir(dirPath) { if (!await isDirectory(dirPath)) { const p = path.normalize(dirPath + '/'); const parent = path.dirname(dirPath); if (!await isDirectory(parent)) { if (p != parent) { await mkdir(parent); } } try { await mkdirInternal(p); } catch (e) { if (!await isDirectory(p)) { throw new UnableToMakeDirectoryException(p); } } } } exports.mkdir = mkdir; const readFileInternal = tasks_1.promisify(fs.readFile); async function readFile(filename) { return readFileInternal(filename, 'utf-8'); } exports.readFile = readFile; async function readBinaryFile(filename) { return readFileInternal(filename, 'base64'); } exports.readBinaryFile = readBinaryFile; async function isFile(filePath) { try { return await exports.exists(filePath) && !await isDirectory(filePath); } catch (e) { // don't throw! } return false; } exports.isFile = isFile; async function rmdir(dirPath, exceptions) { // if it's not there, do nothing. if (!await exports.exists(dirPath)) { return; } exceptions = exceptions || new Set(); // if it's not a directory, that's bad. if (!await isDirectory(dirPath)) { throw new PathIsNotDirectoryException(dirPath); } // make sure this isn't the current directory. if (process.cwd() === path.normalize(dirPath)) { process.chdir(`${dirPath}/..`); } // make sure the folder is empty first. const files = await exports.readdir(dirPath); if (files.length) { const awaiter = new tasks_1.OutstandingTaskAwaiter(); try { for (const file of files) { try { const p = path.join(dirPath, file); if (exceptions.has(p.toLowerCase())) { continue; } if (await isDirectory(p)) { // folders are recursively rmdir'd awaiter.Await(rmdir(p, exceptions)); } else { // files and symlinks are unlink'd awaiter.Await(unlinkInternal(p).catch(() => { })); } } catch (e) { // uh... can't.. ok. } } } finally { // after all the entries are done await awaiter.Wait(); } } try { // if this fails for some reason, check if it's important. await rmdirInternal(dirPath); } catch (e) { // is it gone? that's all we really care about. if (await isDirectory(dirPath)) { // directory did not delete //throw new UnableToRemoveException(dirPath); } } } exports.rmdir = rmdir; async function rmFile(filePath) { // not there? no problem if (!exports.exists(filePath)) { return; } // not a file? that's not cool. if (await isDirectory(filePath)) { throw new PathIsNotFileException(filePath); } try { // files and symlinks are unlink'd await unlinkInternal(filePath); } catch (e) { // is it gone? that's all we really care about. if (await exports.exists(filePath)) { // directory did not delete throw new UnableToRemoveException(filePath); } } } exports.rmFile = rmFile; //# sourceMappingURL=file-io.js.map /***/ }), /***/ "../../../common/temp/node_modules/.pnpm/@azure-tools+async-io@3.0.254/node_modules/@azure-tools/async-io/dist/lock.js": /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Lock = exports.UnableToReadLockException = void 0; const tasks_1 = __webpack_require__("../../../common/temp/node_modules/.pnpm/@azure-tools+tasks@3.0.255/node_modules/@azure-tools/tasks/dist/main.js"); const fs = __webpack_require__("fs"); const file_io_1 = __webpack_require__("../../../common/temp/node_modules/.pnpm/@azure-tools+async-io@3.0.254/node_modules/@azure-tools/async-io/dist/file-io.js"); /* eslint-disable */ // special case const { lock, check, } = __webpack_require__("../../../common/temp/node_modules/.pnpm/proper-lockfile@2.0.1/node_modules/proper-lockfile/index.js"); const openInternal = tasks_1.promisify(fs.open); class UnableToReadLockException extends tasks_1.Exception { constructor(path, exitCode = 1) { super(`Unable to create read lock on '${path}'.`, exitCode); this.exitCode = exitCode; Object.setPrototypeOf(this, UnableToReadLockException.prototype); } } exports.UnableToReadLockException = UnableToReadLockException; class Lock { static async exclusive(path, options) { return tasks_1.promisify(await this._exclusive(path, options)); } static async waitForExclusive(path, timeout = 5 * 60 * 1000) { let result = null; const expire = Date.now() + timeout; do { try { result = await this.exclusive(path); } catch (e) { // no worries. Just wait a few seconds and see if we can get it. await tasks_1.Delay(3000); } } while (result == null && expire > Date.now()); return result; } static async read(path, options) { // first try to create the file // it's ok if it fails options = options || {}; options.delay = options.delay || 2000; options.retries = options.retries || 4; const p = `${path}.lock`; try { fs.writeFileSync(p, 'lockfile'); } catch (e) { // no worries. } // try to open the file for read try { if (await file_io_1.isFile(p)) { const fd = await openInternal(p, 'r'); return async () => { fs.close(fd, (err) => { }); try { fs.unlinkSync(p); } catch (_a) { // ignore errors } }; } } catch (_a) { // ignore errors } if (options.retries) { await tasks_1.Delay(options.delay); options.retries--; return this.read(path, options); } throw new UnableToReadLockException(path); } } exports.Lock = Lock; Lock._exclusive = tasks_1.promisify(lock); Lock.check = tasks_1.promisify(check); //# sourceMappingURL=lock.js.map /***/ }), /***/ "../../../common/temp/node_modules/.pnpm/@azure-tools+async-io@3.0.254/node_modules/@azure-tools/async-io/dist/main.js": /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; var __createBinding = (this && this.__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]; })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", ({ value: true })); /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ __exportStar(__webpack_require__("../../../common/temp/node_modules/.pnpm/@azure-tools+async-io@3.0.254/node_modules/@azure-tools/async-io/dist/file-io.js"), exports); __exportStar(__webpack_require__("../../../common/temp/node_modules/.pnpm/@azure-tools+async-io@3.0.254/node_modules/@azure-tools/async-io/dist/lock.js"), exports); //# sourceMappingURL=main.js.map /***/ }), /***/ "../../../common/temp/node_modules/.pnpm/@azure-tools+tasks@3.0.255/node_modules/@azure-tools/tasks/dist/lib/exception.js": /***/ ((__unused_webpack_module, exports) => { "use strict"; /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.SharedLockUnavailableException = exports.ExclusiveLockUnavailableException = exports.AggregateException = exports.OperationAbortedException = exports.OutstandingTaskAlreadyCompletedException = exports.OperationCanceledException = exports.TypeException = exports.Exception = void 0; class Exception extends Error { constructor(message, exitCode = 1) { super(message); this.exitCode = exitCode; Object.setPrototypeOf(this, Exception.prototype); } } exports.Exception = Exception; class TypeException extends Exception { constructor(code, name, expectedType, instance) { super(instance ? `${code} - '${name}' is not expected type '${expectedType}' (instance: '${instance}') .` : `${code} - '${name}' is not expected type '${expectedType}'.`, 1); Object.setPrototypeOf(this, TypeException.prototype); } } exports.TypeException = TypeException; class OperationCanceledException extends Exception { constructor(message = 'Cancelation Requested', exitCode = 1) { super(message, exitCode); this.exitCode = exitCode; Object.setPrototypeOf(this, OperationCanceledException.prototype); } } exports.OperationCanceledException = OperationCanceledException; class OutstandingTaskAlreadyCompletedException extends Exception { constructor() { super('The OutstandingTaskAwaiter is already completed, may not Enter() again.', 1); Object.setPrototypeOf(this, OutstandingTaskAlreadyCompletedException.prototype); } } exports.OutstandingTaskAlreadyCompletedException = OutstandingTaskAlreadyCompletedException; class OperationAbortedException extends Exception { constructor() { super('Error occurred. Exiting.', 1); Object.setPrototypeOf(this, OperationAbortedException.prototype); } } exports.OperationAbortedException = OperationAbortedException; class AggregateException extends Exception { constructor(errors) { super('Multiple Exceptions caught.', 1); this.errors = errors; Object.setPrototypeOf(this, AggregateException.prototype); } } exports.AggregateException = AggregateException; class ExclusiveLockUnavailableException extends Exception { constructor(resource, timeout) { super(`Unable to acquire exclusive lock on '${resource}' before timeout ${timeout} msec.`, 1); Object.setPrototypeOf(this, ExclusiveLockUnavailableException.prototype); } } exports.ExclusiveLockUnavailableException = ExclusiveLockUnavailableException; class SharedLockUnavailableException extends Exception { constructor(resource, timeout) { super(`Unable to acquire shared lock on '${resource}' before timeout ${timeout} msec.`, 1); Object.setPrototypeOf(this, SharedLockUnavailableException.prototype); } } exports.SharedLockUnavailableException = SharedLockUnavailableException; //# sourceMappingURL=exception.js.map /***/ }), /***/ "../../../common/temp/node_modules/.pnpm/@azure-tools+tasks@3.0.255/node_modules/@azure-tools/tasks/dist/lib/exclusive-locks.js": /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.SharedLock = exports.CriticalSection = exports.Mutex = void 0; const net_1 = __webpack_require__("net"); const manual_promise_1 = __webpack_require__("../../../common/temp/node_modules/.pnpm/@azure-tools+tasks@3.0.255/node_modules/@azure-tools/tasks/dist/lib/manual-promise.js"); const task_functions_1 = __webpack_require__("../../../common/temp/node_modules/.pnpm/@azure-tools+tasks@3.0.255/node_modules/@azure-tools/tasks/dist/lib/task-functions.js"); const exception_1 = __webpack_require__("../../../common/temp/node_modules/.pnpm/@azure-tools+tasks@3.0.255/node_modules/@azure-tools/tasks/dist/lib/exception.js"); const node_promisify_1 = __webpack_require__("../../../common/temp/node_modules/.pnpm/@azure-tools+tasks@3.0.255/node_modules/@azure-tools/tasks/dist/lib/node-promisify.js"); const os_1 = __webpack_require__("os"); const fs_1 = __webpack_require__("fs"); const crypto_1 = __webpack_require__("crypto"); const unlink = node_promisify_1.promisify(fs_1.unlink); const readFile = node_promisify_1.promisify(fs_1.readFile); const writeFile = node_promisify_1.promisify(fs_1.writeFile); /* eslint-disable */ function sanitize(input, replacement = '_') { const illegalCharacters = /[\/\?<>\\:\*\|":]/g; const controlCharacters = /[\x00-\x1f\x80-\x9f]/g; const reservedCharacters = /^\.+$/; const reservedNames = /^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i; const trailingSpaces = /[\. ]+$/; return input .replace(illegalCharacters, replacement) .replace(controlCharacters, replacement) .replace(reservedCharacters, replacement) .replace(reservedNames, replacement) .replace(trailingSpaces, replacement); } function distill(content) { const hash = crypto_1.createHash('sha256').update(JSON.stringify(content)).digest(); const port = hash.readUInt16BE(2) | 4096; // 4096+ let host = `${(hash.readUInt16BE(4) | 0x10) + 0x7f000000}`; if (process.platform === 'darwin') { host = `${0x7f000001}`; } return { port, host }; } /** * An system-wide Exclusive lock for a named resource. * * This is implemented using an exclusive named pipe. */ class Mutex { /** * * @param name - the resource name to create a Mutex for. Multiple instances (across processes) using the same name are operating on the same lock. */ constructor(name) { this.name = name; if (process.platform === 'win32') { this.pipe = `\\\\.\\pipe\\${sanitize(name)}`; this.options = { path: this.pipe, exclusive: true }; } else { const pretendName = `${os_1.tmpdir()}/pipe_${sanitize(name)}`; this.options = { ...distill(pretendName), exclusive: true }; this.pipe = `${os_1.tmpdir()}/pipe_${sanitize(name)}:${this.options.port}`; } } /** * Asynchronously acquires the lock. Will wait for up {@link timeoutMS} milliseconds * @throws ExclusiveLockUnavailableException - if the timeout is reached before the lock can be acquired. * @param timeoutMS - the length of time in miliiseconds to wait for a lock. * @param delayMS - the length of time in milliseconds to retry the lock. * @returns - the release function to release the lock. */ async acquire(timeoutMS = 20000, delayMS = 100) { const fail = Date.now() + timeoutMS; do { try { // try to get the lock to the pipe const server = new net_1.Server(); // possible events after listen const completed = task_functions_1.When(server, 'listening', 'error'); // listening will trigger when we've acquired the pipe handle server.listen(this.options); // don't let this keep the process alive. server.unref(); // wait to see if we can listen to the pipe or fail trying. await completed; // yes, we did, setup the release function const closedServer = new manual_promise_1.ManualPromise(); // the release function is returned to the consumer return async () => { // ensure that releasing twice isn't harmful. if (!closedServer.isCompleted) { server.close(() => closedServer.resolve()); await closedServer; } }; } catch (_a) { // not really releavent why it failed. Pause for a moment. await task_functions_1.Delay(delayMS); } // check if we're past the allowable time. } while (fail > Date.now()); // we were unable to get the lock before the timeout. throw new exception_1.ExclusiveLockUnavailableException(this.name, timeoutMS); } } exports.Mutex = Mutex; /** * A process-local exclusive lock, bound to the object instance. */ class CriticalSection { /** * @constructor - Creates an instance of a CriticalSection * * @param name - a cosmetic name for the 'resource'. Note: multiple CriticalSection instances with the same do not offer exclusivity, it's tied to the object instance. */ constructor(name = 'unnamed') { this.name = name; } /** * Asynchronously acquires the lock. Will wait for up {@link timeoutMS} milliseconds * @throws ExclusiveLockUnavailableException - if the timeout is reached before the lock can be acquired. * @param timeoutMS - the length of time in miliiseconds to wait for a lock. * @param delayMS - unused. * @returns - the release function to release the lock. */ async acquire(timeoutMS = 20000, delayMS = 100) { // delayMS isn't really relavent in this case, since all aqui const fail = Date.now() + timeoutMS; if (this.promise) { do { // wait for its release, or we use up what's left of the timeout. // since multiple consumers can be waiting for the promise to fulfil, // the previous promise holder can resolve, someone else can take it's place // before we get a chance to act. await Promise.race([this.promise, task_functions_1.Delay(fail - Date.now())]); } while (this.promise && fail > Date.now()); } // check to see if the promise is still around, which indicates // that we must have timed out. if (this.promise) { throw new exception_1.ExclusiveLockUnavailableException(this.name, timeoutMS); } // there is no outstanding promise now, we can create one const myPromise = new manual_promise_1.ManualPromise(); this.promise = myPromise; // the release function is returned to the consumer return async () => { // ensure that releasing twice isn't harmful. if (!myPromise.isCompleted) { this.promise = undefined; myPromise.resolve(); } }; } } exports.CriticalSection = CriticalSection; /** * Offers a lock where many consumers can acquire, but an exclusive lock can only be gained if * the consumer is the only one who has a shared lock. */ class SharedLock { constructor(name) { this.name = name; this.exclusiveLock = new Mutex(`${sanitize(name)}.exclusive-lock`); this.busyLock = new Mutex(`${sanitize(name)}.busy-lock`); this.personalLock = new Mutex(`${sanitize(name)}.${Math.random() * 10000}.personal-lock`); this.file = `${os_1.tmpdir()}/${sanitize(name)}.lock`; } async readConnections() { // get the list of names. let connections = new Array(); try { const list = JSON.parse(await readFile(this.file, 'utf8')); for (const each of list) { if (await this.isLocked(each)) { connections.push(each); } } } catch (_a) { } return connections; } async writeConnections(connections) { // write the list of names. if (connections && connections.length > 0) { // write the list of names into the file. await writeFile(this.file, JSON.stringify(connections, null, 2)); } else { try { // no names in list, file should be deleted await unlink(this.file); } catch (_a) { // shh! } } } async isLocked(options) { const server = new net_1.Server(); try { // possible events after listen const completed = task_functions_1.When(server, 'listening', 'error'); // listening will trigger when we've acquired the pipe handle server.listen(options); // wait to see if we can listen to the pipe or fail trying. await completed; // the pipe opened! It's not locked await server.close(); return false; } catch (_a) { server.close(); } // the pipe is locked return true; } /** * Asynchronously acquires a shared lock. Will wait for up {@link timeoutMS} milliseconds * @throws SharedLockUnavailableException - if the timeout is reached before the lock can be acquired. * @param timeoutMS - the length of time in miliiseconds to wait for a lock. * @param delayMS - the polling interval for the exclusive lock during initialization. * @returns - the release function to release the shared lock. */ async acquire(timeoutMS = 20000, delayMS = 100) { // ensure we're the only one that can muck with things for now. const releaseBusy = await this.busyLock.acquire(timeoutMS, delayMS); try { // get our personal lock const releasePersonal = await this.personalLock.acquire(); const activeLocks = await this.readConnections(); activeLocks.push(this.personalLock.options); await this.writeConnections(activeLocks); await releaseBusy(); return async () => { // release our personal lock await releasePersonal(); // try to remove our name from the list try { const releaseBusy = await this.busyLock.acquire(timeoutMS, delayMS); try { await this.writeConnections(await this.readConnections()); } finally { // regardless, release the busy lock! await releaseBusy(); } } catch (_a) { // if it fails no, worry, someone else can clean it up. } }; } catch (e) { throw new exception_1.SharedLockUnavailableException(this.name, timeoutMS); } finally { // release the busy lock! await releaseBusy(); } } get activeLockCount() { return (async () => { return (await this.readConnections()).length; })(); } get isExclusiveLocked() { return (async () => { try { // try to lock it const release = (await this.exclusive(0)); await release(); return false; } catch (_a) { } return true; })(); } /** * Asynchronously acquires an exclusive lock. Will wait for up {@link timeoutMS} milliseconds * * Will only permit a lock if there are no other shared locks * * @throws ExclusibveLockUnavailableException - if the timeout is reached before the lock can be acquired. * @param timeoutMS - the length of time in miliiseconds to wait for a lock. * @param delayMS - the polling interval for the exclusive lock during initialization. * @returns - the release function to release the exclusive lock. */ async exclusive(timeoutMS = 20000, delayMS = 100) { const busyRelease = await this.busyLock.acquire(timeoutMS, delayMS); // ensure we're the only one that can muck with things for now. const exclusiveRelease = await this.exclusiveLock.acquire(timeoutMS, delayMS); try { // make sure we're the only one who has an shared lock const activeLocks = await this.readConnections(); if (activeLocks.length === 0 || (activeLocks.length === 1 && JSON.stringify(activeLocks[0]) === JSON.stringify(this.personalLock.options))) { return async () => { await exclusiveRelease(); await busyRelease(); }; } } catch (_a) { } // we didn't return the exclusive Lock, // release it and throw... await exclusiveRelease(); await busyRelease(); throw new exception_1.ExclusiveLockUnavailableException(this.name, timeoutMS); } } exports.SharedLock = SharedLock; //# sourceMappingURL=exclusive-locks.js.map /***/ }), /***/ "../../../common/temp/node_modules/.pnpm/@azure-tools+tasks@3.0.255/node_modules/@azure-tools/tasks/dist/lib/lazy-promise.js": /***/ ((__unused_webpack_module, exports) => { "use strict"; /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.LazyPromise = void 0; class LazyPromise { constructor(factory) { this.factory = factory; this.promise = null; } finally(onfinally) { return this.getValue().finally(onfinally); } getValue() { if (this.promise === null) { this.promise = this.factory(); } return this.promise; } get [Symbol.toStringTag]() { return this.getValue()[Symbol.toStringTag]; } then(onfulfilled, onrejected) { return this.getValue().then(onfulfilled, onrejected); } catch(onrejected) { return this.getValue().catch(onrejected); } } exports.LazyPromise = LazyPromise; //# sourceMappingURL=lazy-promise.js.map /***/ }), /***/ "../../../common/temp/node_modules/.pnpm/@azure-tools+tasks@3.0.255/node_modules/@azure-tools/tasks/dist/lib/lazy.js": /***/ ((__unused_webpack_module, exports) => { "use strict"; /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Lazy = void 0; class Lazy { constructor(factory) { this.factory = factory; this.promise = null; } get Value() { if (this.promise === null) { this.promise = { obj: this.factory() }; } return this.promise.obj; } } exports.Lazy = Lazy; //# sourceMappingURL=lazy.js.map /***/ }), /***/ "../../../common/temp/node_modules/.pnpm/@azure-tools+tasks@3.0.255/node_modules/@azure-tools/tasks/dist/lib/manual-promise.js": /***/ ((__unused_webpack_module, exports) => { "use strict"; /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.ManualPromise = void 0; /** * A manually (or externally) controlled asynchronous Promise implementation */ class ManualPromise { constructor() { /** * A method to manually resolve the Promise. */ this.resolve = (v) => { }; /** * A method to manually reject the Promise */ this.reject = (e) => { }; this.state = 'pending'; this.p = new Promise((r, j) => { this.resolve = (v) => { this.state = 'resolved'; r(v); }; this.reject = (e) => { this.state = 'rejected'; j(e); }; }); } /** * Attaches callbacks for the resolution and/or rejection of the Promise. * @param onfulfilled The callback to execute when the Promise is resolved. * @param onrejected The callback to execute when the Promise is rejected. * @returns A Promise for the completion of which ever callback is executed. */ then(onfulfilled, onrejected) { return this.p.then(onfulfilled, onrejected); } /** * Attaches a callback for only the rejection of the Promise. * @param onrejected The callback to execute when the Promise is rejected. * @returns A Promise for the completion of the callback. */ catch(onrejected) { return this.p.catch(onrejected); } finally(onfinally) { return this.p.finally(onfinally); } /** * Returns true of the Promise has been Resolved or Rejected */ get isCompleted() { return this.state !== 'pending'; } /** * Returns true if the Promise has been Resolved. */ get isResolved() { return this.state === 'resolved'; } /** * Returns true if the Promise has been Rejected. */ get isRejected() { return this.state === 'rejected'; } } exports.ManualPromise = ManualPromise; //# sourceMappingURL=manual-promise.js.map /***/ }), /***/ "../../../common/temp/node_modules/.pnpm/@azure-tools+tasks@3.0.255/node_modules/@azure-tools/tasks/dist/lib/node-promisify.js": /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.promisify = void 0; const util_1 = __webpack_require__("util"); const exception_1 = __webpack_require__("../../../common/temp/node_modules/.pnpm/@azure-tools+tasks@3.0.255/node_modules/@azure-tools/tasks/dist/lib/exception.js"); const manual_promise_1 = __webpack_require__("../../../common/temp/node_modules/.pnpm/@azure-tools+tasks@3.0.255/node_modules/@azure-tools/tasks/dist/lib/manual-promise.js"); const kCustomPromisifiedSymbol = Symbol('util.promisify.custom'); const kCustomPromisifyArgsSymbol = Symbol('customPromisifyArgs'); /* eslint-disable */ /** * Add polyfill for Object.getOwnPropertyDescriptors * * Origin: https://github.com/tc39/proposal-object-getownpropertydescriptors */ if (!Object.hasOwnProperty('getOwnPropertyDescriptors')) { Object.defineProperty(Object, 'getOwnPropertyDescriptors', { configurable: true, writable: true, value: function getOwnPropertyDescriptors(object) { return Reflect.ownKeys(object).reduce((descriptors, key) => { return Object.defineProperty(descriptors, key, { configurable: true, enumerable: true, writable: true, value: Object.getOwnPropertyDescriptor(object, key) }); }, {}); } }); } /** * Promisify Implementation acquired from node8 and adapted to node7/typescript * * @param original original method declaration */ function _promisify(original) { if (typeof original !== 'function') { throw new exception_1.TypeException('ERR_INVALID_ARG_TYPE', 'original', 'Function'); } if (original[kCustomPromisifiedSymbol]) { const fn = original[kCustomPromisifiedSymbol]; if (typeof fn !== 'function') { throw new exception_1.TypeException('ERR_INVALID_ARG_TYPE', 'util.promisify.custom', 'Function', fn); } Object.defineProperty(fn, kCustomPromisifiedSymbol, { value: fn, enumerable: false, writable: false, configurable: true }); return fn; } // Names to create an object from in case the callback receives multiple // arguments, e.g. ['stdout', 'stderr'] for child_process.exec. const argumentNames = original[kCustomPromisifyArgsSymbol]; function fn(...args) { const promise = new manual_promise_1.ManualPromise(); try { original.call(this, ...args, (err, ...values) => { if (err) { promise.reject(err); } else if (argumentNames !== undefined && values.length > 1) { const obj = {}; for (let i = 0; i < argumentNames.length; i++) { obj[argumentNames[i]] = values[i]; } promise.resolve(obj); } else { promise.resolve(values[0]); } }); } catch (err) { promise.reject(err); } return promise; } Object.setPrototypeOf(fn, Object.getPrototypeOf(original)); Object.defineProperty(fn, kCustomPromisifiedSymbol, { value: fn, enumerable: false, writable: false, configurable: true }); return Object.defineProperties(fn, Object.getOwnPropertyDescriptors(original)); } _promisify.custom = kCustomPromisifiedSymbol; /** * Promisify implementation, will use built-in version in node if available, falls back to local implementation borrowed from node8. */ exports.promisify = util_1.promisify || _promisify; //# sourceMappingURL=node-promisify.js.map /***/ }), /***/ "../../../common/temp/node_modules/.pnpm/@azure-tools+tasks@3.0.255/node_modules/@azure-tools/tasks/dist/lib/outstanding-task-awaiter.js": /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.OutstandingTaskAwaiter = void 0; const exception_1 = __webpack_require__("../../../common/temp/node_modules/.pnpm/@azure-tools+tasks@3.0.255/node_modules/@azure-tools/tasks/dist/lib/exception.js"); class OutstandingTaskAwaiter { constructor() { this.locked = false; this.outstandingTasks = []; this.errors = []; } async Wait() { this.locked = true; await Promise.all(this.outstandingTasks); if (this.errors.length) { if (this.errors.length == 1) { throw this.errors[0]; } throw new exception_1.AggregateException(this.errors); } } async Await(task) { if (this.locked) { throw new exception_1.OutstandingTaskAlreadyCompletedException(); } this.outstandingTasks.push(task.catch((e) => { // console.error("Yes. errors in the await.") this.errors.push(e); })); return task; } } exports.OutstandingTaskAwaiter = OutstandingTaskAwaiter; //# sourceMappingURL=outstanding-task-awaiter.js.map /***/ }), /***/ "../../../common/temp/node_modules/.pnpm/@azure-tools+tasks@3.0.255/node_modules/@azure-tools/tasks/dist/lib/polyfill.js": /***/ ((__unused_webpack_module, exports) => { "use strict"; /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.shallowCopy = void 0; /** * Creates a shallow copy of a given object by copying the properties to a new object * Note: this does not copy the method prototypes, so it's a shallow data copy only. * * @param {input} any javascript object * @param {filter} Array<string> of properties to filter out from the copy. */ function shallowCopy(input, ...filter) { if (!input) { return input; } const keys = input.Keys ? input.Keys : Object.getOwnPropertyNames(input); const result = {}; for (const key of keys) { if (filter.indexOf(key) == -1) { const value = input[key]; if (value !== undefined) { result[key] = value; } } } return result; } exports.shallowCopy = shallowCopy; //# sourceMappingURL=polyfill.js.map /***/ }), /***/ "../../../common/temp/node_modules/.pnpm/@azure-tools+tasks@3.0.255/node_modules/@azure-tools/tasks/dist/lib/task-functions.js": /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Timeout = exports.Async = exports.When = exports.Until = exports.While = exports.YieldCPU = exports.Delay = void 0; const manual_promise_1 = __webpack_require__("../../../common/temp/node_modules/.pnpm/@azure-tools+tasks@3.0.255/node_modules/@azure-tools/tasks/dist/lib/manual-promise.js"); /** * Creates a promise that resolves after a delay * * @param delayMS the length of time to delay in milliseconds. */ function Delay(delayMS) { return new Promise(res => setTimeout(res, delayMS)); } exports.Delay = Delay; function YieldCPU() { if (process._getActiveHandles().length > 2) { return new Promise(res => setImmediate(res)); } return undefined; } exports.YieldCPU = YieldCPU; /** * Asynchronously waits for the predicate condition to turn false, with a delay between checks * @param predicate - a fn that returns a boolean * @param delay - number of milliseconds to async delay between checks. */ async function While(predicate, delay = 50) { while (predicate()) { await Delay(delay); } } exports.While = While; /** * Asynchronously waits for the predicate condition to turn true, with a delay between checks * @param predicate - a fn that returns a boolean * @param delay - number of milliseconds to async delay between checks. */ async function Until(predicate, delay = 50) { while (predicate()) { await Delay(delay); } } exports.Until = Until; /** * An async wrapper for waiting for an event to trigger once * @param emitter - an event emitter * @param event - the name of the event to wait for. */ function When(emitter, successEvent, errorEvent) { const result = new manual_promise_1.ManualPromise(); if (errorEvent) { // errors after a previous completion are ignored. emitter.once(errorEvent, (e) => { if (!result.isCompleted) { result.reject(e); } }); } if (successEvent) { // success after a previous completion is ignored. emitter.once(successEvent, (v) => { if (!result.isCompleted) { result.resolve(v); } }); } return result; } exports.When = When; function Async(fn, msec = 1) { return new Promise((r, j) => setTimeout(() => { try { r(fn()); } catch (E) { j(E); } }, msec)); } exports.Async = Async; async function Timeout(p, msec) { let enabled = false; const value = await Promise.race([p, Async(() => { if (enabled) throw new Error('timed out'); }, msec)]); enabled = false; return value; } exports.Timeout = Timeout; //# sourceMappingURL=task-functions.js.map /***/ }), /***/ "../../../common/temp/node_modules/.pnpm/@azure-tools+tasks@3.0.255/node_modules/@azure-tools/tasks/dist/main.js": /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ var __createBinding = (this && this.__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]; })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", ({ value: true })); __exportStar(__webpack_require__("../../../common/temp/node_modules/.pnpm/@azure-tools+tasks@3.0.255/node_modules/@azure-tools/tasks/dist/lib/exception.js"), exports); __exportStar(__webpack_require__("../../../common/temp/node_modules/.pnpm/@azure-tools+tasks@3.0.255/node_modules/@azure-tools/tasks/dist/lib/outstanding-task-awaiter.js"), exports); __exportStar(__webpack_require__("../../../common/temp/node_modules/.pnpm/@azure-tools+tasks@3.0.255/node_modules/@azure-tools/tasks/dist/lib/lazy-promise.js"), exports); __exportStar(__webpack_require__("../../../common/temp/node_modules/.pnpm/@azure-tools+tasks@3.0.255/node_modules/@azure-tools/tasks/dist/lib/lazy.js"), exports); __exportStar(__webpack_require__("../../../common/temp/node_modules/.pnpm/@azure-tools+tasks@3.0.255/node_modules/@azure-tools/tasks/dist/lib/manual-promise.js"), exports); __exportStar(__webpack_require__("../../../common/temp/node_modules/.pnpm/@azure-tools+tasks@3.0.255/node_modules/@azure-tools/tasks/dist/lib/exclusive-locks.js"), exports); __exportStar(__webpack_require__("../../../common/temp/node_modules/.pnpm/@azure-tools+tasks@3.0.255/node_modules/@azure-tools/tasks/dist/lib/task-functions.js"), exports); __exportStar(__webpack_require__("../../../common/temp/node_modules/.pnpm/@azure-tools+tasks@3.0.255/node_modules/@azure-tools/tasks/dist/lib/polyfill.js"), exports); __exportStar(__webpack_require__("../../../common/temp/node_modules/.pnpm/@azure-tools+tasks@3.0.255/node_modules/@azure-tools/tasks/dist/lib/node-promisify.js"), exports); //# sourceMappingURL=main.js.map /***/ }), /***/ "../../../common/temp/node_modules/.pnpm/buffer-from@1.1.2/node_modules/buffer-from/index.js": /***/ ((module) => { /* eslint-disable node/no-deprecated-api */ var toString = Object.prototype.toString var isModern = ( typeof Buffer !== 'undefined' && typeof Buffer.alloc === 'function' && typeof Buffer.allocUnsafe === 'function' && typeof Buffer.from === 'function' ) function isArrayBuffer (input) { return toString.call(input).slice(8, -1) === 'ArrayBuffer' } function fromArrayBuffer (obj, byteOffset, length) { byteOffset >>>= 0 var maxLength = obj.byteLength - byteOffset if (maxLength < 0) { throw new RangeError("'offset' is out of bounds") } if (length === undefined) { length = maxLength } else { length >>>= 0 if (length > maxLength) { throw new RangeError("'length' is out of bounds") } } return isModern ? Buffer.from(obj.slice(byteOffset, byteOffset + length)) : new Buffer(new Uint8Array(obj.slice(byteOffset, byteOffset + length))) } function fromString (string, encoding) { if (typeof encoding !== 'string' || encoding === '') { encoding = 'utf8' } if (!Buffer.isEncoding(encoding)) { throw new TypeError('"encoding" must be a valid string encoding') } return isModern ? Buffer.from(string, encoding) : new Buffer(string, encoding) } function bufferFrom (value, encodingOrOffset, length) { if (typeof value === 'number') { throw new TypeError('"value" argument must not be a number') } if (isArrayBuffer(value)) { return fromArrayBuffer(value, encodingOrOffset, length) } if (typeof value === 'string') { return fromString(