From 81b9b6114a9a5d3c5ff35c637fb1a1c109cfb2c4 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Wed, 15 May 2024 16:39:26 -0400 Subject: [PATCH] Revert "Fix ESM build" --- dist/index.js | 82 +++++++++++++++++++++++++++++++++++-------- pnpm-lock.yaml | 95 ++++++++++++++++++++------------------------------ src/index.ts | 6 ++-- tsup.config.ts | 1 + 4 files changed, 109 insertions(+), 75 deletions(-) diff --git a/dist/index.js b/dist/index.js index c1076f7..c590610 100644 --- a/dist/index.js +++ b/dist/index.js @@ -71491,7 +71491,7 @@ const { staticPropertyDescriptors, readOperation, fireAProgressEvent -} = __nccwpck_require__(5579) +} = __nccwpck_require__(2882) const { kState, kError, @@ -71935,7 +71935,7 @@ module.exports = { /***/ }), -/***/ 5579: +/***/ 2882: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { @@ -89417,8 +89417,8 @@ function firstString() { } } -// EXTERNAL MODULE: external "node:process" -var external_node_process_ = __nccwpck_require__(7742); +// EXTERNAL MODULE: external "path" +var external_path_ = __nccwpck_require__(1017); // EXTERNAL MODULE: external "node:util" var external_node_util_ = __nccwpck_require__(7261); // EXTERNAL MODULE: external "os" @@ -90999,6 +90999,8 @@ class AbortError extends RequestError { } } +// EXTERNAL MODULE: external "node:process" +var external_node_process_ = __nccwpck_require__(7742); ;// CONCATENATED MODULE: external "node:buffer" const external_node_buffer_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:buffer"); // EXTERNAL MODULE: external "node:stream" @@ -96376,7 +96378,9 @@ const got = source_create(defaults); ;// CONCATENATED MODULE: external "node:stream/promises" const external_node_stream_promises_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:stream/promises"); -;// CONCATENATED MODULE: ./node_modules/.pnpm/github.com+DeterminateSystems+detsys-ts@cd38b227c4d6faca10aed591b1f8863ef7b93dce_nckxvs7jbq6qb4vr5xhgyxcrgy/node_modules/detsys-ts/dist/index.js +;// CONCATENATED MODULE: external "node:zlib" +const external_node_zlib_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:zlib"); +;// CONCATENATED MODULE: ./node_modules/.pnpm/github.com+DeterminateSystems+detsys-ts@2391ba1ef3d22027cd4d9ecce147007a88f63643_is35d24tynybsms6zejuqsabhi/node_modules/detsys-ts/dist/index.js var __defProp = Object.defineProperty; var __export = (target, all) => { for (var name in all) @@ -96722,22 +96726,30 @@ function getNixPlatform(archOs) { // src/inputs.ts var inputs_exports = {}; __export(inputs_exports, { + getArrayOfStrings: () => getArrayOfStrings, getBool: () => getBool, - getCommaSeparatedArrayOfStrings: () => getCommaSeparatedArrayOfStrings, getMultilineStringOrNull: () => getMultilineStringOrNull, getNumberOrNull: () => getNumberOrNull, getString: () => getString, getStringOrNull: () => getStringOrNull, - getStringOrUndefined: () => getStringOrUndefined + getStringOrUndefined: () => getStringOrUndefined, + handleString: () => handleString }); var getBool = (name) => { return core.getBooleanInput(name); }; -var getCommaSeparatedArrayOfStrings = (name, stripWhitespace) => { - const strip = stripWhitespace ?? false; +var getArrayOfStrings = (name, separator) => { const original = getString(name); - return (strip ? original.replace(/\s+/g, "") : original).split(","); + return handleString(original, separator); +}; +var handleString = (input, separator) => { + const sepChar = separator === "comma" ? "," : /\s+/; + const trimmed = input.trim(); + if (trimmed === "") { + return []; + } + return trimmed.split(sepChar).map((s) => s.trim()); }; var getMultilineStringOrNull = (name) => { const value = core.getMultilineInput(name); @@ -96818,18 +96830,24 @@ function constructSourceParameters(legacyPrefix) { + + var DEFAULT_IDS_HOST = "https://install.determinate.systems"; var IDS_HOST = process.env["IDS_HOST"] ?? DEFAULT_IDS_HOST; var EVENT_EXCEPTION = "exception"; var EVENT_ARTIFACT_CACHE_HIT = "artifact_cache_hit"; var EVENT_ARTIFACT_CACHE_MISS = "artifact_cache_miss"; +var EVENT_ARTIFACT_CACHE_PERSIST = "artifact_cache_persist"; var FACT_ENDED_WITH_EXCEPTION = "ended_with_exception"; var FACT_FINAL_EXCEPTION = "final_exception"; +var FACT_SOURCE_URL = "source_url"; +var FACT_SOURCE_URL_ETAG = "source_url_etag"; var IdsToolbox = class { constructor(actionOptions) { this.actionOptions = makeOptionsConfident(actionOptions); this.hookMain = void 0; this.hookPost = void 0; + this.exceptionAttachments = /* @__PURE__ */ new Map(); this.events = []; this.client = got_dist_source.extend({ retry: { @@ -96908,6 +96926,17 @@ var IdsToolbox = class { ); this.recordEvent(`begin_${this.executionPhase}`); } + /** + * Attach a file to the diagnostics data in error conditions. + * + * The file at `location` doesn't need to exist when stapleFile is called. + * + * If the file doesn't exist or is unreadable when trying to staple the attachments, the JS error will be stored in a context value at `staple_failure_{name}`. + * If the file is readable, the file's contents will be stored in a context value at `staple_value_{name}`. + */ + stapleFile(name, location) { + this.exceptionAttachments.set(name, location); + } onMain(callback) { this.hookMain = callback; } @@ -96920,6 +96949,9 @@ var IdsToolbox = class { process.exitCode = 1; }); } + stringifyError(error2) { + return error2 instanceof Error || typeof error2 == "string" ? error2.toString() : JSON.stringify(error2); + } async executeAsync() { try { process.env.DETSYS_CORRELATION = JSON.stringify( @@ -96937,14 +96969,31 @@ var IdsToolbox = class { this.addFact(FACT_ENDED_WITH_EXCEPTION, false); } catch (error2) { this.addFact(FACT_ENDED_WITH_EXCEPTION, true); - const reportable = error2 instanceof Error || typeof error2 == "string" ? error2.toString() : JSON.stringify(error2); + const reportable = this.stringifyError(error2); this.addFact(FACT_FINAL_EXCEPTION, reportable); if (this.executionPhase === "post") { core.warning(reportable); } else { core.setFailed(reportable); } - this.recordEvent(EVENT_EXCEPTION); + const do_gzip = (0,external_node_util_.promisify)(external_node_zlib_namespaceObject.gzip); + const exceptionContext = /* @__PURE__ */ new Map(); + for (const [attachmentLabel, filePath] of this.exceptionAttachments) { + try { + const logText = (0,external_node_fs_namespaceObject.readFileSync)(filePath); + const buf = await do_gzip(logText); + exceptionContext.set( + `staple_value_${attachmentLabel}`, + buf.toString("base64") + ); + } catch (e) { + exceptionContext.set( + `staple_failure_${attachmentLabel}`, + this.stringifyError(e) + ); + } + } + this.recordEvent(EVENT_EXCEPTION, Object.fromEntries(exceptionContext)); } finally { await this.complete(); } @@ -96986,6 +97035,7 @@ var IdsToolbox = class { const versionCheckup = await this.client.head(correlatedUrl); if (versionCheckup.headers.etag) { const v = versionCheckup.headers.etag; + this.addFact(FACT_SOURCE_URL_ETAG, v); core.debug( `Checking the tool cache for ${this.getUrl()} at ${v}` ); @@ -97034,6 +97084,7 @@ var IdsToolbox = class { getUrl() { const p = this.sourceParameters; if (p.url) { + this.addFact(FACT_SOURCE_URL, p.url); return new URL(p.url); } const fetchUrl = new URL(IDS_HOST); @@ -97050,6 +97101,7 @@ var IdsToolbox = class { fetchUrl.pathname += `/stable`; } fetchUrl.pathname += `/${this.architectureFetchSuffix}`; + this.addFact(FACT_SOURCE_URL, fetchUrl.toString()); return fetchUrl; } cacheKey(version2) { @@ -97097,7 +97149,7 @@ var IdsToolbox = class { void 0, true ); - this.recordEvent(EVENT_ARTIFACT_CACHE_HIT); + this.recordEvent(EVENT_ARTIFACT_CACHE_PERSIST); } finally { process.env.GITHUB_WORKSPACE = process.env.GITHUB_WORKSPACE_BACKUP; delete process.env.GITHUB_WORKSPACE_BACKUP; @@ -97699,8 +97751,8 @@ ${stderrBuffer}` "Configuring the Docker shim as the Nix Daemon's process supervisor" ); const images = { - X64: (0,external_node_path_namespaceObject.join)((0,external_node_process_.cwd)(), "/../docker-shim/amd64.tar.gz"), - ARM64: (0,external_node_path_namespaceObject.join)((0,external_node_process_.cwd)(), "/../docker-shim/arm64.tar.gz") + X64: __nccwpck_require__.ab + "amd64.tar.gz", + ARM64: __nccwpck_require__.ab + "arm64.tar.gz" }; const runnerArch = process.env["RUNNER_ARCH"]; let arch; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index addbe92..31a8bf6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -16,7 +16,7 @@ dependencies: version: 5.1.1 detsys-ts: specifier: github:DeterminateSystems/detsys-ts - version: github.com/DeterminateSystems/detsys-ts/cd38b227c4d6faca10aed591b1f8863ef7b93dce + version: github.com/DeterminateSystems/detsys-ts/2391ba1ef3d22027cd4d9ecce147007a88f63643 string-argv: specifier: ^0.3.2 version: 0.3.2 @@ -27,7 +27,7 @@ devDependencies: version: 4.3.0(prettier@3.2.5) "@types/node": specifier: ^20.12.11 - version: 20.12.12 + version: 20.12.11 "@types/uuid": specifier: ^9.0.8 version: 9.0.8 @@ -1327,14 +1327,14 @@ packages: integrity: sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g==, } dependencies: - "@types/node": 20.12.12 + "@types/node": 20.12.11 form-data: 4.0.0 dev: false - /@types/node@20.12.12: + /@types/node@20.12.11: resolution: { - integrity: sha512-eWLDGF/FOSPtAvEqeRAQ4C8LSA7M1I7i0ky1I8U7kD1J5ITyW3AsRhQrKVoWf5pFKZ2kILsEGJhsI9r93PYnOw==, + integrity: sha512-vDg9PZ/zi+Nqp6boSOT7plNuthRugEKixDv5sFTIpkE89MmNtEArAShI4mxuX2+UrLEe9pxC1vm2cjm9YlWbJw==, } dependencies: undici-types: 5.26.5 @@ -1352,7 +1352,7 @@ packages: integrity: sha512-sOUTGn6h1SfQ+gbgqC364jLFBw2lnFqkgF3q0WovEHRLMrVD1sd5aufqi/aJObLekJO+Aq5z646U4Oxy6shXMA==, } dependencies: - "@types/node": 20.12.12 + "@types/node": 20.12.11 dev: false /@types/uuid@9.0.8: @@ -1387,7 +1387,7 @@ packages: graphemer: 1.4.0 ignore: 5.3.1 natural-compare: 1.4.0 - semver: 7.6.0 + semver: 7.6.2 ts-api-utils: 1.3.0(typescript@5.4.5) typescript: 5.4.5 transitivePeerDependencies: @@ -1478,7 +1478,7 @@ packages: globby: 11.1.0 is-glob: 4.0.3 minimatch: 9.0.4 - semver: 7.6.0 + semver: 7.6.2 ts-api-utils: 1.3.0(typescript@5.4.5) typescript: 5.4.5 transitivePeerDependencies: @@ -1501,7 +1501,7 @@ packages: "@typescript-eslint/types": 7.8.0 "@typescript-eslint/typescript-estree": 7.8.0(typescript@5.4.5) eslint: 8.57.0 - semver: 7.6.0 + semver: 7.6.2 transitivePeerDependencies: - supports-color - typescript @@ -1843,10 +1843,10 @@ packages: engines: { node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7 } hasBin: true dependencies: - caniuse-lite: 1.0.30001615 - electron-to-chromium: 1.4.755 + caniuse-lite: 1.0.30001617 + electron-to-chromium: 1.4.761 node-releases: 2.0.14 - update-browserslist-db: 1.0.14(browserslist@4.23.0) + update-browserslist-db: 1.0.15(browserslist@4.23.0) dev: true /bundle-require@4.1.0(esbuild@0.19.12): @@ -1916,10 +1916,10 @@ packages: engines: { node: ">=6" } dev: true - /caniuse-lite@1.0.30001615: + /caniuse-lite@1.0.30001617: resolution: { - integrity: sha512-1IpazM5G3r38meiae0bHRnPhz+CBQ3ZLqbQMtrg+AsTPKAXgW38JNsXkyZ+v8waCsDmPq87lmfun5Q2AGysNEQ==, + integrity: sha512-mLyjzNI9I+Pix8zwcrpxEbGlfqOkF9kM3ptzmKNw5tizSyYwMe+nGLTqMK9cO+0E+Bh6TsBxNAaHWEM8xwSsmA==, } dev: true @@ -2214,10 +2214,10 @@ packages: } dev: true - /electron-to-chromium@1.4.755: + /electron-to-chromium@1.4.761: resolution: { - integrity: sha512-9nop+3jZxSHIxe1EzEUcjDXzK+3qOv3fY5w0sE88nIZUntbv1aXWmoxGWlklX5XSO4txCpLssWkUSh8RQPovBg==, + integrity: sha512-PIbxpiJGx6Bb8dQaonNc6CGTRlVntdLg/2nMa1YhnrwYOORY9a3ZgGN0UQYE6lAcj/lkyduJN7BPt/JiY+jAQQ==, } dev: true @@ -2235,10 +2235,10 @@ packages: } dev: true - /enhanced-resolve@5.16.0: + /enhanced-resolve@5.16.1: resolution: { - integrity: sha512-O+QWCviPNSSLAD9Ucn8Awv+poAkqn3T1XY5/N7kR7rQO9yfSGWkYZDwpJ+iKF7B8rxaQKWngSqACpgzeapSyoA==, + integrity: sha512-4U5pNsuDl0EhuZpq46M5xPslstkviJuhrdobaRDBk2Jy2KO37FDAJl4lb2KlNabxT0m4MTK2UHNrsAcphE8nyw==, } engines: { node: ">=10.13.0" } dependencies: @@ -2479,12 +2479,12 @@ packages: eslint-plugin-import: "*" dependencies: debug: 4.3.4 - enhanced-resolve: 5.16.0 + enhanced-resolve: 5.16.1 eslint: 8.57.0 eslint-module-utils: 2.8.1(@typescript-eslint/parser@7.8.0)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.57.0) eslint-plugin-import: 2.29.1(@typescript-eslint/parser@7.8.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.57.0) fast-glob: 3.3.2 - get-tsconfig: 4.7.3 + get-tsconfig: 4.7.5 is-core-module: 2.13.1 is-glob: 4.0.3 transitivePeerDependencies: @@ -3110,10 +3110,10 @@ packages: get-intrinsic: 1.2.4 dev: true - /get-tsconfig@4.7.3: + /get-tsconfig@4.7.5: resolution: { - integrity: sha512-ZvkrzoUA0PQZM6fy6+/Hce561s+faD1rsNwhnO5FelNjyy7EMGJ3Rz1AQ8GYDWjhRs/7dBLOEJvhK8MiEJOAFg==, + integrity: sha512-ZCuZCnlqNzjb4QprAzXKdpp/gh6KTxSJuw3IBsPnV/7fV4NxC9ckB+vPTt8w7fJA0TaSD7c55BR47JD6MEDyDw==, } dependencies: resolve-pkg-maps: 1.0.0 @@ -3139,10 +3139,10 @@ packages: is-glob: 4.0.3 dev: true - /glob@10.3.12: + /glob@10.3.14: resolution: { - integrity: sha512-TCNv8vJ+xz4QiqTpfOJA7HvYv+tNIRHKfUWw/q+v2jdgN4ebz+KY9tGx5J4rHP0o84mNP+ApH66HRX8us3Khqg==, + integrity: sha512-4fkAqu93xe9Mk7le9v0y3VrPDqLKHarNi2s4Pv7f2yOvfhWfhc7hRPHC/JyqMqb8B/Dt/eGS4n7ykwf3fOsl8g==, } engines: { node: ">=16 || 14 >=14.17" } hasBin: true @@ -3150,8 +3150,8 @@ packages: foreground-child: 3.1.1 jackspeak: 2.3.6 minimatch: 9.0.4 - minipass: 7.0.4 - path-scurry: 1.10.2 + minipass: 7.1.1 + path-scurry: 1.11.0 dev: true /glob@7.2.3: @@ -3940,16 +3940,6 @@ packages: engines: { node: 14 || >=16.14 } dev: true - /lru-cache@6.0.0: - resolution: - { - integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==, - } - engines: { node: ">=10" } - dependencies: - yallist: 4.0.0 - dev: true - /merge-stream@2.0.0: resolution: { @@ -4043,10 +4033,10 @@ packages: } dev: true - /minipass@7.0.4: + /minipass@7.1.1: resolution: { - integrity: sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==, + integrity: sha512-UZ7eQ+h8ywIRAW1hIEl2AqdwzJucU/Kp59+8kkZeSvafXhZjul247BvIJjEVFVeON6d7lM46XX1HXCduKAS8VA==, } engines: { node: ">=16 || 14 >=14.17" } dev: true @@ -4318,15 +4308,15 @@ packages: } dev: true - /path-scurry@1.10.2: + /path-scurry@1.11.0: resolution: { - integrity: sha512-7xTavNy5RQXnsjANvVvMkEjvloOinkAjv/Z6Ildz9v2RinZ4SBKTWFOVRbaF8p0vpHnyjV/UwNDdKuUv6M5qcA==, + integrity: sha512-LNHTaVkzaYaLGlO+0u3rQTz7QrHTFOuKyba9JMTQutkmtNew8dw8wOD7mTU/5fCPZzCWpfW0XnQKzY61P0aTaw==, } engines: { node: ">=16 || 14 >=14.17" } dependencies: lru-cache: 10.2.2 - minipass: 7.0.4 + minipass: 7.1.1 dev: true /path-type@4.0.0: @@ -4638,15 +4628,13 @@ packages: } hasBin: true - /semver@7.6.0: + /semver@7.6.2: resolution: { - integrity: sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==, + integrity: sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==, } engines: { node: ">=10" } hasBin: true - dependencies: - lru-cache: 6.0.0 dev: true /set-function-length@1.2.2: @@ -4871,7 +4859,7 @@ packages: dependencies: "@jridgewell/gen-mapping": 0.3.5 commander: 4.1.1 - glob: 10.3.12 + glob: 10.3.14 lines-and-columns: 1.2.4 mz: 2.7.0 pirates: 4.0.6 @@ -5212,10 +5200,10 @@ packages: } dev: false - /update-browserslist-db@1.0.14(browserslist@4.23.0): + /update-browserslist-db@1.0.15(browserslist@4.23.0): resolution: { - integrity: sha512-JixKH8GR2pWYshIPUg/NujK3JO7JiqEEUiNArE86NQyrgUuZeTlZQN3xuS/yiV5Kb48ev9K6RqNkaJjXsdg7Jw==, + integrity: sha512-K9HWH62x3/EalU1U6sjSZiylm9C8tgq2mSvshZpqc7QE69RaA2qjhkW2HlNA0tFpEbtyFz7HTqbSdN4MSwUodA==, } hasBin: true peerDependencies: @@ -5416,13 +5404,6 @@ packages: engines: { node: ">=4.0" } dev: false - /yallist@4.0.0: - resolution: - { - integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==, - } - dev: true - /yaml@2.4.2: resolution: { @@ -5440,10 +5421,10 @@ packages: engines: { node: ">=10" } dev: true - github.com/DeterminateSystems/detsys-ts/cd38b227c4d6faca10aed591b1f8863ef7b93dce: + github.com/DeterminateSystems/detsys-ts/2391ba1ef3d22027cd4d9ecce147007a88f63643: resolution: { - tarball: https://codeload.github.com/DeterminateSystems/detsys-ts/tar.gz/cd38b227c4d6faca10aed591b1f8863ef7b93dce, + tarball: https://codeload.github.com/DeterminateSystems/detsys-ts/tar.gz/2391ba1ef3d22027cd4d9ecce147007a88f63643, } name: detsys-ts version: 1.0.0 diff --git a/src/index.ts b/src/index.ts index 2221c77..5b8a326 100644 --- a/src/index.ts +++ b/src/index.ts @@ -6,7 +6,7 @@ import { join } from "node:path"; import fs from "node:fs"; import { userInfo } from "node:os"; import stringArgv from "string-argv"; -import { cwd } from "node:process"; +import * as path from "path"; import { IdsToolbox, inputs, platform } from "detsys-ts"; import { randomUUID } from "node:crypto"; @@ -559,8 +559,8 @@ class NixInstallerAction { ); const images: { [key: string]: string } = { - X64: join(cwd(), "/../docker-shim/amd64.tar.gz"), - ARM64: join(cwd(), "/../docker-shim/arm64.tar.gz"), + X64: path.join(__dirname, "/../docker-shim/amd64.tar.gz"), + ARM64: path.join(__dirname, "/../docker-shim/arm64.tar.gz"), }; const runnerArch = process.env["RUNNER_ARCH"]; diff --git a/tsup.config.ts b/tsup.config.ts index e047197..e374aaf 100644 --- a/tsup.config.ts +++ b/tsup.config.ts @@ -8,6 +8,7 @@ export default defineConfig({ target: "node20", bundle: true, splitting: false, + clean: true, dts: { resolve: true, },