workflow_launcher/node_modules/temp-file/out/main.js.map
2024-03-12 12:57:14 +01:00

1 line
11 KiB
Plaintext

{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;;AAAA,uCAA6F;AAC7F,2BAAyB;AACzB,6BAA4B;AAE5B,IAAI,cAAc,GAAG,CAAC,CAAA;AACtB,MAAM,cAAc,GAAG,IAAI,GAAG,EAAU,CAAA;AAExC,uCAAuC;AACvC,MAAM,aAAa,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAA;AAE9E,SAAgB,WAAW,CAAC,MAAkC;IAC5D,OAAO,GAAG,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,MAAM,GAAG,GAAG,aAAa,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAA;AACnG,CAAC;AAFD,kCAEC;AAED,IAAI,cAAsC,CAAA;AAC1C,IAAI,WAA0B,CAAA;AAE9B,SAAS,cAAc;IACrB,IAAI,cAAc,IAAI,IAAI,EAAE;QAC1B,OAAO,cAAc,CAAA;KACtB;IAED,IAAI,WAAW,IAAI,IAAI,EAAE;QACvB,OAAO,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;KACpC;IAED,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,WAAM,EAAE,CAAA;IAChE,MAAM,qBAAqB,GAAG,OAAO,CAAC,GAAG,CAAC,sCAAsC,KAAK,OAAO,CAAA;IAC5F,cAAc,GAAG,kBAAO,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;SACpD,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,mBAAQ,CAAC,EAAE,CAAC,CAAC;SACxB,IAAI,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AAC,CAAA;QACN,CAAC,CAAC,CAAC,CAAA;IACL,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,SAAS,CAAA;IACvB,CAAC;CACF;AA9GD,wBA8GC;AAED,SAAS,OAAO,CAAC,CAAiB;IAChC,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;AAC/C,CAAC","sourcesContent":["import {ensureDir, mkdtemp, realpath, remove, removeSync, unlink, unlinkSync} from \"fs-extra\"\nimport {tmpdir} from \"os\"\nimport * as path from \"path\"\n\nlet tmpFileCounter = 0\nconst tmpDirManagers = new Set<TmpDir>()\n\n// add date to avoid use stale temp dir\nconst tempDirPrefix = `${process.pid.toString(36)}-${Date.now().toString(36)}`\n\nexport function getTempName(prefix?: string | null | undefined): string {\n return `${prefix == null ? \"\" : `${prefix}-`}${tempDirPrefix}-${(tmpFileCounter++).toString(36)}`\n}\n\nlet tempDirPromise: Promise<string> | null\nlet tempBaseDir: string | null\n\nfunction getBaseTempDir(): Promise<string> {\n if (tempDirPromise != null) {\n return tempDirPromise\n }\n\n if (tempBaseDir != null) {\n return Promise.resolve(tempBaseDir)\n }\n\n const systemTmpDir = process.env.APP_BUILDER_TMP_DIR || tmpdir()\n const isEnsureRemovedOnExit = process.env.TMP_DIR_MANAGER_ENSURE_REMOVED_ON_EXIT !== \"false\"\n tempDirPromise = mkdtemp(path.join(systemTmpDir, \"t-\"))\n .then(it => realpath(it))\n .then(dir => {\n if (isEnsureRemovedOnExit) {\n addExitHook(dir)\n }\n tempBaseDir = dir\n return dir\n })\n return tempDirPromise\n}\n\nfunction addExitHook(dir: string) {\n require(\"async-exit-hook\")((callback: (() => void) | null) => {\n const managers = Array.from(tmpDirManagers)\n tmpDirManagers.clear()\n\n if (callback == null) {\n for (const manager of managers) {\n manager.cleanupSync()\n }\n\n try {\n removeSync(dir)\n }\n catch (e) {\n handleError(e, dir)\n }\n return\n }\n\n Promise.all(managers.map(it => it.cleanup()))\n .then(() => remove(dir))\n .then(() => callback())\n .catch(e => {\n try {\n handleError(e, dir)\n }\n finally {\n callback()\n }\n })\n })\n}\n\nfunction handleError(e: any, file: string) {\n if (e.code !== \"EPERM\" && e.code !== \"ENOENT\") {\n // use only console.* instead of our warn on exit (otherwise nodeEmoji can be required on request)\n console.warn(`Cannot delete temporary \"${file}\": ${(e.stack || e).toString()}`)\n }\n}\n\ninterface TempFileInfo {\n isDir: boolean\n path: string\n disposer?: ((file: string) => Promise<void>) | null\n}\n\nexport interface GetTempFileOptions {\n prefix?: string | null\n suffix?: string | null\n\n disposer?: ((file: string) => Promise<void>) | null\n}\n\nexport class TmpDir {\n private tempFiles: Array<TempFileInfo> = []\n private registered = false\n\n constructor(private readonly debugName: string = \"\") {\n }\n\n // noinspection JSMethodCanBeStatic,JSUnusedGlobalSymbols\n get rootTempDir(): Promise<string> {\n return getBaseTempDir()\n }\n\n getTempDir(options?: GetTempFileOptions): Promise<string> {\n return this.getTempFile(options, true)\n }\n\n createTempDir(options?: GetTempFileOptions): Promise<string> {\n return this.getTempFile(options, true)\n .then(it => ensureDir(it).then(() => it))\n }\n\n getTempFile(options?: GetTempFileOptions, isDir = false): Promise<string> {\n return getBaseTempDir()\n .then(baseTempDir => {\n if (!this.registered) {\n this.registered = true\n tmpDirManagers.add(this)\n }\n\n const prefix = nullize(options == null ? null : options.prefix)\n const suffix = nullize(options == null ? null : options.suffix)\n const namePrefix = prefix == null ? \"\" : `${prefix}-`\n const nameSuffix = suffix == null ? \"\" : (suffix.startsWith(\".\") ? suffix : `-${suffix}`)\n const result = `${baseTempDir}${path.sep}${namePrefix}${(tmpFileCounter++).toString(36)}${nameSuffix}`\n this.tempFiles.push({\n path: result,\n isDir,\n disposer: options == null ? null : options.disposer,\n })\n return result\n })\n }\n\n cleanupSync() {\n const tempFiles = this.tempFiles\n tmpDirManagers.delete(this)\n this.registered = false\n if (tempFiles.length === 0) {\n return\n }\n\n this.tempFiles = []\n\n for (const file of tempFiles) {\n if (file.disposer != null) {\n // noinspection JSIgnoredPromiseFromCall\n file.disposer(file.path)\n continue\n }\n\n try {\n if (file.isDir) {\n removeSync(file.path)\n }\n else {\n unlinkSync(file.path)\n }\n }\n catch (e) {\n handleError(e, file.path)\n }\n }\n }\n\n cleanup(): Promise<any> {\n const tempFiles = this.tempFiles\n tmpDirManagers.delete(this)\n\n this.registered = false\n if (tempFiles.length === 0) {\n return Promise.resolve()\n }\n this.tempFiles = []\n\n if (tmpDirManagers.size === 0) {\n const dir = tempBaseDir\n if (dir == null) {\n return Promise.resolve()\n }\n\n tempBaseDir = null\n tempDirPromise = null\n return remove(dir)\n }\n\n return Promise.all(tempFiles.map(it => {\n if (it.disposer != null) {\n return it.disposer(it.path)\n }\n\n return (it.isDir ? remove(it.path) : unlink(it.path))\n .catch(e => {\n handleError(e, it.path)\n })\n }))\n }\n\n toString() {\n return this.debugName\n }\n}\n\nfunction nullize(s?: string | null) {\n return s == null || s.length === 0 ? null : s\n}"]}