From a2ab8eba0111ccae6706db1cfdbd4108a75f3a55 Mon Sep 17 00:00:00 2001 From: Rodrigo Fernandes Date: Tue, 1 Dec 2026 10:15:11 +0000 Subject: [PATCH 1/4] cli: support Node 12 with CommonJS runtime Signed-off-by: Rodrigo Fernandes --- README.md | 5 + bin/diff2html.js | 5 +- jest.config.ts | 15 +- package.json | 28 +- src/__tests__/cli-tests.ts | 115 +++++-- src/__tests__/http-utils-tests.ts | 48 +++ src/__tests__/main-tests.ts | 66 ++-- src/__tests__/utils-tests.ts | 7 +- src/cli.ts | 7 +- src/configuration.ts | 5 +- tsconfig.json | 11 +- yarn.lock | 508 ++++++++++++++++++------------ 12 files changed, 521 insertions(+), 299 deletions(-) create mode 100644 src/__tests__/http-utils-tests.ts diff --git a/README.md b/README.md index a6698ce..9414f44 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,8 @@ Diff to Html generates pretty HTML diffs from unified and git diff output in you ## Setup +The installed CLI requires Node.js 12 or later. Use a maintained version of Node.js when possible. + ```sh npm install -g diff2html-cli ``` @@ -176,6 +178,9 @@ your changes following the guidelines described in `CONTRIBUTING.md`. I will try ## Developing +Use a modern Node.js version from CI and Yarn Classic (1.x) for development. The Node.js 12 minimum applies to the +installed CLI, not the development tools. + Make some changes, `yarn build` and then `./bin/diff2html` 😉 ## License diff --git a/bin/diff2html.js b/bin/diff2html.js index 860eff8..15627fc 100755 --- a/bin/diff2html.js +++ b/bin/diff2html.js @@ -1,5 +1,6 @@ #!/usr/bin/env node -// eslint-disable-next-line import/no-unresolved -import { main } from '../lib/main.js'; +// The build creates lib/main.js after lint runs. +// eslint-disable-next-line @typescript-eslint/no-var-requires, node/no-missing-require +const { main } = require('../lib/main.js'); main(); diff --git a/jest.config.ts b/jest.config.ts index e90e315..fe7bf56 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -1,23 +1,10 @@ import type { JestConfigWithTsJest } from 'ts-jest'; const jestConfig: JestConfigWithTsJest = { - preset: 'ts-jest/presets/default-esm', + preset: 'ts-jest', moduleNameMapper: { '^(\\.{1,2}/.*)\\.js$': '$1', }, - moduleFileExtensions: ['js', 'json', 'jsx', 'node', 'ts', 'tsx'], - transform: { - // '^.+\\.tsx?$' to process ts with `ts-jest` - // '^.+\\.[tj]sx?$' to process js/ts with `ts-jest` - // '^.+\\.m?[tj]sx?$' to process js/ts/mjs/mts with `ts-jest` - '^.+\\.m?[tj]sx?$': [ - 'ts-jest', - { - useESM: true, - }, - ], - }, - extensionsToTreatAsEsm: ['.ts'], verbose: true, testEnvironment: 'node', coverageDirectory: './coverage', diff --git a/package.json b/package.json index 20c0f7e..7193f2e 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "url": "https://github.com/rtfpessoa/diff2html-cli/issues" }, "engines": { - "node": ">=16" + "node": ">=12" }, "preferGlobal": true, "scripts": { @@ -51,9 +51,9 @@ "gen:toc-base": "markdown-toc --maxdepth 3 --bullets='-' -i", "gen:toc": "yarn run gen:toc-base README.md", "test": "is-ci 'test:coverage' 'test:watch'", - "test:coverage": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js --coverage", - "test:watch": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js --watch", - "test:debug": "node --experimental-vm-modules --inspect-brk ./node_modules/jest/bin/jest.js --runInBand --watch", + "test:coverage": "jest --coverage", + "test:watch": "jest --watch", + "test:debug": "node --inspect-brk ./node_modules/jest/bin/jest.js --runInBand --watch", "coverage:open": "yarn run test:coverage && open ./coverage/index.html", "validate": "yarn run format:check && yarn run lint:check && yarn run build && yarn run test:coverage", "fix": "yarn run format:fix && yarn run lint:fix", @@ -61,12 +61,9 @@ "version": "git add -A package.json", "prepare": "husky install" }, - "type": "module", "bin": { "diff2html": "./bin/diff2html.js" }, - "main": "./lib/diff2html.js", - "types": "./lib/diff2html.d.ts", "lint-staged": { "**/*.+(js|jsx|ts|tsx|json)": [ "prettier --write", @@ -80,22 +77,21 @@ ] }, "dependencies": { - "clipboardy": "^4.0.0", - "diff2html": "^3.4.47", - "node-fetch": "^3.3.2", - "open": "^10.0.3", - "yargs": "^17.6.0" + "clipboardy": "2.3.0", + "diff2html": "3.5.0", + "node-fetch": "2.7.0", + "open": "8.4.2", + "yargs": "17.7.3" }, "devDependencies": { "@babel/core": "^7.23.7", "@babel/preset-env": "^7.23.8", "@babel/preset-typescript": "^7.23.3", "@jest/globals": "^29.7.0", - "@types/hogan.js": "^3.0.5", "@types/jest": "^29.5.11", - "@types/node": "20.11.0", - "@types/node-fetch": "^2.6.10", - "@types/request": "2.48.12", + "@types/node": "12.20.55", + "@types/node-fetch": "2.6.13", + "@types/yargs": "17.0.35", "@typescript-eslint/eslint-plugin": "6.18.1", "@typescript-eslint/parser": "6.18.1", "babel-jest": "^29.7.0", diff --git a/src/__tests__/cli-tests.ts b/src/__tests__/cli-tests.ts index 21a0bbd..dc0c168 100644 --- a/src/__tests__/cli-tests.ts +++ b/src/__tests__/cli-tests.ts @@ -1,33 +1,31 @@ +import os from 'os'; +import path from 'path'; import { jest } from '@jest/globals'; - -let cli: typeof import('../cli'); - -const readFileSpy: jest.Mock<() => string> = jest.fn(); -const readStdinSpy: jest.Mock<() => Promise> = jest.fn(); -const writeFileSpy: jest.Mock<(filePath: string, content: string) => void> = jest.fn(); -const executeSpy: jest.Mock<(executable: string, args: string[]) => string> = jest.fn(); -jest.unstable_mockModule('../utils', async () => ({ - readFile: readFileSpy, - readStdin: readStdinSpy, - execute: executeSpy, - writeFile: writeFileSpy, -})); - -const putSpy: jest.Mock<(url: string, payload: object) => Promise> = jest.fn(); -jest.unstable_mockModule('../http-utils', async () => ({ - put: putSpy, -})); - -beforeEach(async () => { - cli = await import('../cli'); -}); +import { writeSync } from 'clipboardy'; +import open from 'open'; + +import * as cli from '../cli'; +import { parseArgv } from '../configuration'; +import { put } from '../http-utils'; +import * as utils from '../utils'; +import { setup } from '../yargs'; + +jest.mock('clipboardy', () => ({ writeSync: jest.fn() })); +jest.mock('open', () => jest.fn()); +jest.mock('../utils'); +jest.mock('../http-utils', () => ({ put: jest.fn() })); +jest.mock('../logger', () => ({ print: jest.fn() })); + +const readFileSpy = jest.mocked(utils.readFile); +const readStdinSpy = jest.mocked(utils.readStdin); +const writeFileSpy = jest.mocked(utils.writeFile); +const executeSpy = jest.mocked(utils.execute); +const putSpy = jest.mocked(put); afterEach(() => { - jest.clearAllMocks(); + jest.resetAllMocks(); }); -process.argv = ['node', 'diff2html.js', '-i', 'stdin', '--', 'test']; - describe('cli', () => { describe('getInput', () => { test('should readFile when inputType is `file`', async () => { @@ -114,24 +112,77 @@ describe('cli', () => { }); }); - describe('preview', () => { - test('should call `utils.writeFile`', async () => { - writeFileSpy.mockReturnValue(); + describe('getOutput', () => { + test('should fail with exit code 4 if the template does not exist', async () => { + const argv = process.argv; + const exitCode = process.exitCode; + const template = path.join(__filename, 'missing-template.html'); + try { + process.argv = ['node', 'diff2html.js', '--hwt', template]; + const [options, config] = parseArgv(await setup()); + + expect(() => cli.getOutput(options, config, 'input')).toThrow(`Template ('${template}') not found!`); + expect(process.exitCode).toBe(4); + } finally { + process.argv = argv; + process.exitCode = exitCode; + } + }); + }); - cli.preview('a', 'b'); + describe('preview', () => { + test('should write the preview file and pass its path to the opener', () => { + cli.preview('output', 'html'); + const filePath = path.resolve(os.tmpdir(), 'diff.html'); expect(writeFileSpy).toHaveBeenCalledTimes(1); + expect(writeFileSpy).toHaveBeenCalledWith(filePath, 'output'); + expect(open).toHaveBeenCalledWith(filePath, { wait: false }); }); }); describe('postToDiffy', () => { - test('should call `http.put`', async () => { - putSpy.mockReturnValue(Promise.resolve({ id: 'foo' })); + const diffUrl = 'https://diffy.org/diff/foo'; + + test('should request a link without opening it or copying it in print mode', async () => { + putSpy.mockResolvedValue({ id: 'foo' }); - await cli.postToDiffy('a', 'print'); + await expect(cli.postToDiffy('a', 'print')).resolves.toBe(diffUrl); expect(putSpy).toHaveBeenCalledTimes(1); expect(putSpy).toHaveBeenCalledWith('https://diffy.org/api/diff/', { diff: 'a' }); + expect(open).not.toHaveBeenCalled(); + expect(writeSync).not.toHaveBeenCalled(); + }); + + test('should pass the generated link to the opener in browser mode', async () => { + putSpy.mockResolvedValue({ id: 'foo' }); + + await cli.postToDiffy('a', 'browser'); + + expect(open).toHaveBeenCalledWith(diffUrl); + expect(writeSync).not.toHaveBeenCalled(); + }); + + test('should pass the generated link to the clipboard adapter in pbcopy mode', async () => { + putSpy.mockResolvedValue({ id: 'foo' }); + + await cli.postToDiffy('a', 'pbcopy'); + + expect(writeSync).toHaveBeenCalledWith(diffUrl); + expect(open).not.toHaveBeenCalled(); + }); + + test('should report an API error response', async () => { + putSpy.mockResolvedValue({ error: 'Upload failed' }); + + await expect(cli.postToDiffy('a', 'print')).rejects.toThrow('Upload failed'); + }); + + test('should reject a response without an id or an API error', async () => { + putSpy.mockResolvedValue({}); + + await expect(cli.postToDiffy('a', 'print')).rejects.toThrow("Could not find 'id'"); }); }); }); diff --git a/src/__tests__/http-utils-tests.ts b/src/__tests__/http-utils-tests.ts new file mode 100644 index 0000000..212e4d6 --- /dev/null +++ b/src/__tests__/http-utils-tests.ts @@ -0,0 +1,48 @@ +import { createServer } from 'http'; +import { AddressInfo } from 'net'; +import { jest } from '@jest/globals'; + +import { put } from '../http-utils'; + +const requestSpy = jest.fn(); +const server = createServer((request, response) => { + let body = ''; + request.setEncoding('utf8'); + request.on('data', chunk => { + body += chunk; + }); + request.on('end', () => { + requestSpy(request.method, request.url, request.headers.accept, request.headers['content-type'], body); + response.end(request.url === '/diff' ? '{"id":"local"}' : 'not JSON'); + }); +}); + +let origin: string; + +beforeAll(async () => { + await new Promise((resolve, reject) => { + server.once('error', reject); + server.listen(0, '127.0.0.1', resolve); + }); + origin = `http://127.0.0.1:${(server.address() as AddressInfo).port}`; +}); + +afterAll(async () => { + await new Promise((resolve, reject) => { + server.close(error => (error ? reject(error) : resolve())); + }); +}); + +describe('put', () => { + test('should send the JSON payload as a PUT and read the response', async () => { + await expect(put(`${origin}/diff`, { diff: 'input' })).resolves.toEqual({ id: 'local' }); + + expect(requestSpy).toHaveBeenCalledWith('PUT', '/diff', 'application/json', 'application/json', '{"diff":"input"}'); + }); + + test('should report invalid JSON with the response body', async () => { + await expect(put(`${origin}/invalid`, { diff: 'input' })).rejects.toThrow( + 'Failed to parse response json.\nBody:\n\nnot JSON', + ); + }); +}); diff --git a/src/__tests__/main-tests.ts b/src/__tests__/main-tests.ts index e910906..4b1f220 100644 --- a/src/__tests__/main-tests.ts +++ b/src/__tests__/main-tests.ts @@ -1,36 +1,36 @@ -import { fileURLToPath } from 'url'; +import { resolve } from 'path'; import { jest, expect } from '@jest/globals'; -import { Configuration, InputType } from '../types'; -import { Diff2HtmlConfig } from 'diff2html'; +import * as cli from '../cli'; +import * as log from '../logger'; +import * as command from '../main'; -let command: typeof import('../main'); - -const getInputSpy: jest.Mock<(inputType: InputType, inputArgs: string[], ignore: string[]) => Promise> = - jest.fn(); -const getOutputSpy: jest.Mock<(options: Diff2HtmlConfig, config: Configuration, input: string) => string> = jest.fn(); -const previewSpy: jest.Mock<(content: string, format: string) => void> = jest.fn(); -jest.unstable_mockModule('../cli', async () => ({ - getInput: getInputSpy, - getOutput: getOutputSpy, - preview: previewSpy, +jest.mock('../cli', () => ({ + getInput: jest.fn(), + getOutput: jest.fn(), + preview: jest.fn(), })); +jest.mock('../logger', () => ({ error: jest.fn() })); + +const getInputSpy = jest.mocked(cli.getInput); +const getOutputSpy = jest.mocked(cli.getOutput); +const previewSpy = jest.mocked(cli.preview); +const { argv, exitCode } = process; -beforeEach(async () => { - command = await import('../main'); +beforeEach(() => { + process.argv = ['node', 'diff2html.js', '-i', 'file', '--', 'test']; }); afterEach(() => { - jest.clearAllMocks(); + process.argv = argv; + process.exitCode = exitCode; + jest.resetAllMocks(); }); -process.argv = ['node', 'diff2html.js', '-i', 'file', '--', 'test']; - -describe('cli', () => { +describe('main', () => { test('should parse input and run', async () => { - getInputSpy.mockReturnValue(Promise.resolve('input')); + getInputSpy.mockResolvedValue('input'); getOutputSpy.mockReturnValue('output'); - previewSpy.mockReturnValue(); await command.main(); @@ -58,7 +58,7 @@ describe('cli', () => { fileContentToggle: true, formatType: 'html', highlightCode: true, - htmlWrapperTemplate: fileURLToPath(new URL('../../template.html', import.meta.url)), + htmlWrapperTemplate: resolve(__dirname, '../../template.html'), ignore: [], inputSource: 'file', outputDestinationFile: undefined, @@ -70,5 +70,27 @@ describe('cli', () => { }, 'input', ); + expect(previewSpy).toHaveBeenCalledWith('output', 'html'); + }); + + test('should report an empty input and exit with code 3', async () => { + getInputSpy.mockResolvedValue(''); + + await command.main(); + + expect(process.exitCode).toBe(3); + expect(log.error).toHaveBeenCalledWith('The input is empty. Try again.'); + expect(getOutputSpy).not.toHaveBeenCalled(); + }); + + test('should report an input error and exit with code 1', async () => { + const error = new Error('Could not read input'); + getInputSpy.mockRejectedValue(error); + + await command.main(); + + expect(process.exitCode).toBe(1); + expect(log.error).toHaveBeenCalledWith(error); + expect(getOutputSpy).not.toHaveBeenCalled(); }); }); diff --git a/src/__tests__/utils-tests.ts b/src/__tests__/utils-tests.ts index 1221dca..d67d781 100644 --- a/src/__tests__/utils-tests.ts +++ b/src/__tests__/utils-tests.ts @@ -1,4 +1,4 @@ -import { mkdtempSync, rmSync } from 'fs'; +import { existsSync, mkdtempSync, rmdirSync, unlinkSync } from 'fs'; import { tmpdir } from 'os'; import { join } from 'path'; @@ -9,15 +9,16 @@ const stringToCompare = 'This is a rand0m preTTy string to write and read a file describe('utils', () => { test('should write and read file synchronously', () => { const fixtureDir = mkdtempSync(join(tmpdir(), 'diff2html-cli-test-')); + const filePath = join(fixtureDir, 'file.test'); try { - const filePath = join(fixtureDir, 'file.test'); utils.writeFile(filePath, stringToCompare); const contentRead = utils.readFile(filePath); expect(stringToCompare).toBe(contentRead); } finally { - rmSync(fixtureDir, { recursive: true, force: true }); + if (existsSync(filePath)) unlinkSync(filePath); + rmdirSync(fixtureDir); } }); diff --git a/src/cli.ts b/src/cli.ts index ade22a8..25e7d0e 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -1,11 +1,8 @@ -import { createRequire } from 'node:module'; -const require = createRequire(import.meta.url); - import fs from 'fs'; import os from 'os'; import path from 'path'; -import clipboardy from 'clipboardy'; +import { writeSync } from 'clipboardy'; import open from 'open'; import { parse, html, Diff2HtmlConfig } from 'diff2html'; @@ -217,7 +214,7 @@ export async function postToDiffy(diff: string, diffyOutput: DiffyType): Promise if (diffyOutput === 'browser') { open(url); } else if (diffyOutput === 'pbcopy') { - clipboardy.writeSync(url); + writeSync(url); } return url; diff --git a/src/configuration.ts b/src/configuration.ts index ba0e646..ad9d053 100644 --- a/src/configuration.ts +++ b/src/configuration.ts @@ -1,7 +1,4 @@ -import { dirname, resolve } from 'path'; -import { fileURLToPath } from 'url'; - -const __dirname = dirname(fileURLToPath(import.meta.url)); +import { resolve } from 'path'; import { Configuration } from './types.js'; import { Argv } from './yargs.js'; diff --git a/tsconfig.json b/tsconfig.json index 3eaa6b8..1fd1c80 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,15 +2,14 @@ "include": ["*env.d.ts", "src/**/*"], "exclude": ["node_modules", "src/__tests__/**"], "compilerOptions": { - "moduleResolution": "NodeNext", - "target": "ESNext", - "module": "NodeNext", - "lib": ["ESNext"], + "moduleResolution": "Node", + "target": "ES2019", + "module": "CommonJS", + "lib": ["ES2019"], "jsx": "preserve", "rootDir": "src", "outDir": "lib", "allowJs": true, - "importHelpers": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true, "strict": true, @@ -20,8 +19,6 @@ "noFallthroughCasesInSwitch": true, "skipLibCheck": true, "resolveJsonModule": true, - "declaration": true, - "declarationMap": true, "sourceMap": true, "checkJs": true, "noEmit": false, diff --git a/yarn.lock b/yarn.lock index 0d1f8de..11c2acf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1537,6 +1537,13 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" +"@profoundlogic/hogan@^3.0.4": + version "3.0.4" + resolved "https://registry.yarnpkg.com/@profoundlogic/hogan/-/hogan-3.0.4.tgz#30032a0172a911471965bca77772a95f71989d01" + integrity sha512-pmNVGuooS30Mm7YbZd5T7E5zYVO6D5Ct91sn4T39mUvMUc3sCGridcnhAufL1/Bz2QzAtzEn0agNrdk3+5yWzw== + dependencies: + nopt "1.0.10" + "@sinclair/typebox@^0.27.8": version "0.27.8" resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e" @@ -1609,11 +1616,6 @@ dependencies: "@babel/types" "^7.20.7" -"@types/caseless@*": - version "0.12.2" - resolved "https://registry.yarnpkg.com/@types/caseless/-/caseless-0.12.2.tgz#f65d3d6389e01eeb458bd54dc8f52b95a9463bc8" - integrity sha512-6ckxMjBBD8URvjB6J3NcnuAn5Pkl7t3TizAg+xdlzzQGSPSmBcXf8KoIH0ua/i+tio+ZRUHEXp0HEmvaR4kt0w== - "@types/graceful-fs@^4.1.3": version "4.1.6" resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.6.tgz#e14b2576a1c25026b7f02ede1de3b84c3a1efeae" @@ -1621,11 +1623,6 @@ dependencies: "@types/node" "*" -"@types/hogan.js@^3.0.5": - version "3.0.5" - resolved "https://registry.yarnpkg.com/@types/hogan.js/-/hogan.js-3.0.5.tgz#09f5b916ad88e1975b093ab7a25a37ffc0418be5" - integrity sha512-/uRaY3HGPWyLqOyhgvW9Aa43BNnLZrNeQxl2p8wqId4UHMfPKolSB+U7BlZyO1ng7MkLnyEAItsBzCG0SDhqrA== - "@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1": version "2.0.4" resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz#8467d4b3c087805d63580480890791277ce35c44" @@ -1663,35 +1660,23 @@ resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ== -"@types/node-fetch@^2.6.10": - version "2.6.10" - resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.10.tgz#ff5c1ceacab782f2b7ce69957d38c1c27b0dc469" - integrity sha512-PPpPK6F9ALFTn59Ka3BaL+qGuipRfxNE8qVgkp0bVixeiR2c2/L+IVOiBdu9JhhT22sWnQEp6YyHGI2b2+CMcA== +"@types/node-fetch@2.6.13": + version "2.6.13" + resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.13.tgz#e0c9b7b5edbdb1b50ce32c127e85e880872d56ee" + integrity sha512-QGpRVpzSaUs30JBSGPjOg4Uveu384erbHBoT1zeONvyCfwQxIkUshLAOqN/k9EjGviPRmWTTe6aH2qySWKTVSw== dependencies: "@types/node" "*" - form-data "^4.0.0" + form-data "^4.0.4" "@types/node@*": version "20.4.8" resolved "https://registry.yarnpkg.com/@types/node/-/node-20.4.8.tgz#b5dda19adaa473a9bf0ab5cbd8f30ec7d43f5c85" integrity sha512-0mHckf6D2DiIAzh8fM8f3HQCvMKDpK94YQ0DSVkfWTG9BZleYIWudw9cJxX8oCk9bM+vAkDyujDV6dmKHbvQpg== -"@types/node@20.11.0": - version "20.11.0" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.11.0.tgz#8e0b99e70c0c1ade1a86c4a282f7b7ef87c9552f" - integrity sha512-o9bjXmDNcF7GbM4CNQpmi+TutCgap/K3w1JyKgxAjqx41zp9qlIAVFi0IhCNsJcXolEqLWhbFbEeL0PvYm4pcQ== - dependencies: - undici-types "~5.26.4" - -"@types/request@2.48.12": - version "2.48.12" - resolved "https://registry.yarnpkg.com/@types/request/-/request-2.48.12.tgz#0f590f615a10f87da18e9790ac94c29ec4c5ef30" - integrity sha512-G3sY+NpsA9jnwm0ixhAFQSJ3Q9JkpLZpJbI3GMv0mIAT0y3mRabYeINzal5WOChIiaTEGQYlHOKgkaM9EisWHw== - dependencies: - "@types/caseless" "*" - "@types/node" "*" - "@types/tough-cookie" "*" - form-data "^2.5.0" +"@types/node@12.20.55": + version "12.20.55" + resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.55.tgz#c329cbd434c42164f846b909bd6f85b5537f6240" + integrity sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ== "@types/semver@^7.3.12", "@types/semver@^7.5.0": version "7.5.0" @@ -1703,16 +1688,18 @@ resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.1.tgz#20f18294f797f2209b5f65c8e3b5c8e8261d127c" integrity sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw== -"@types/tough-cookie@*": - version "4.0.2" - resolved "https://registry.yarnpkg.com/@types/tough-cookie/-/tough-cookie-4.0.2.tgz#6286b4c7228d58ab7866d19716f3696e03a09397" - integrity sha512-Q5vtl1W5ue16D+nIaW8JWebSSraJVlK+EthKn7e7UcD4KWsaSJ8BqGPXNaPghgtcn/fhvrN17Tv8ksUsQpiplw== - "@types/yargs-parser@*": version "21.0.0" resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.0.tgz#0c60e537fa790f5f9472ed2776c2b71ec117351b" integrity sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA== +"@types/yargs@17.0.35": + version "17.0.35" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.35.tgz#07013e46aa4d7d7d50a49e15604c1c5340d4eb24" + integrity sha512-qUHkeCyQFxMXg79wQfTtfndEC+N9ZZg76HJftDJp+qH2tV7Gj4OJi7l+PiWwJ+pWtW8GwSmqsDj/oymhrTWXjg== + dependencies: + "@types/yargs-parser" "*" + "@types/yargs@^17.0.8": version "17.0.24" resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.24.tgz#b3ef8d50ad4aa6aecf6ddc97c580a00f5aa11902" @@ -1957,6 +1944,11 @@ anymatch@^3.0.3: normalize-path "^3.0.0" picomatch "^2.0.4" +arch@^2.1.1: + version "2.2.0" + resolved "https://registry.yarnpkg.com/arch/-/arch-2.2.0.tgz#1bc47818f305764f23ab3306b0bfc086c5a29d11" + integrity sha512-Of/R0wqp83cgHozfIYLbBMnej79U/SVGOOyuB3VVFv1NRM/PSFMK12x9KVtiYzJqmnU5WR2qp0Z5rHb7sWGnFQ== + arg@^4.1.0: version "4.1.3" resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" @@ -2209,12 +2201,13 @@ buffer-from@^1.0.0: resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== -bundle-name@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/bundle-name/-/bundle-name-4.1.0.tgz#f3b96b34160d6431a19d7688135af7cfb8797889" - integrity sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q== +call-bind-apply-helpers@^1.0.1, call-bind-apply-helpers@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz#4b5428c222be985d79c3d82657479dbe0b59b2d6" + integrity sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ== dependencies: - run-applescript "^7.0.0" + es-errors "^1.3.0" + function-bind "^1.1.2" call-bind@^1.0.0, call-bind@^1.0.2: version "1.0.2" @@ -2315,14 +2308,14 @@ cli-truncate@^4.0.0: slice-ansi "^5.0.0" string-width "^7.0.0" -clipboardy@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/clipboardy/-/clipboardy-4.0.0.tgz#e73ced93a76d19dd379ebf1f297565426dffdca1" - integrity sha512-5mOlNS0mhX0707P2I0aZ2V/cmHUEO/fL7VFLqszkhUsxt7RwnmrInf/eEQKlf5GzvYeHIjT+Ov1HRfNmymlG0w== +clipboardy@2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/clipboardy/-/clipboardy-2.3.0.tgz#3c2903650c68e46a91b388985bc2774287dba290" + integrity sha512-mKhiIL2DrQIsuXMgBgnfEHOZOryC7kY7YO//TN6c63wlEm3NG5tz+YgY5rVi29KCmq/QQjKYvM7a19+MDOTHOQ== dependencies: - execa "^8.0.1" - is-wsl "^3.1.0" - is64bit "^2.0.0" + arch "^2.1.1" + execa "^1.0.0" + is-wsl "^2.1.1" cliui@^8.0.1: version "8.0.1" @@ -2377,7 +2370,7 @@ colorette@^2.0.20: resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.20.tgz#9eb793e6833067f7235902fcd3b09917a000a95a" integrity sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w== -combined-stream@^1.0.6, combined-stream@^1.0.8: +combined-stream@^1.0.8: version "1.0.8" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== @@ -2458,6 +2451,17 @@ create-require@^1.1.0: resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== +cross-spawn@^6.0.0: + version "6.0.10" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.10.tgz#6e6b54f1a344b0f098b853cd61341266f935b5ec" + integrity sha512-mnRI2snHxN8nPvnqtsrVOngbIkcUnyary9aVcA7+tlvMDPRMo0Uo5zqrQl6AvuIdzlbiXGyOTvQ+meGTYaTi4A== + dependencies: + nice-try "^1.0.4" + path-key "^2.0.1" + semver "^5.5.0" + shebang-command "^1.2.0" + which "^1.2.9" + cross-spawn@^7.0.0, cross-spawn@^7.0.2, cross-spawn@^7.0.3: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" @@ -2467,11 +2471,6 @@ cross-spawn@^7.0.0, cross-spawn@^7.0.2, cross-spawn@^7.0.3: shebang-command "^2.0.0" which "^2.0.1" -data-uri-to-buffer@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz#d8feb2b2881e6a4f58c2e08acfd0e2834e26222e" - integrity sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A== - debug@4.3.4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" @@ -2501,19 +2500,6 @@ deepmerge@^4.2.2: resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.3.1.tgz#44b5f2147cd3b00d4b56137685966f26fd25dd4a" integrity sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A== -default-browser-id@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/default-browser-id/-/default-browser-id-5.0.0.tgz#a1d98bf960c15082d8a3fa69e83150ccccc3af26" - integrity sha512-A6p/pu/6fyBcA1TRz/GqWYPViplrftcW2gZC9q79ngNCKAeR/X3gcEdXQHl4KNXV+3wgIJ1CPkJQ3IHM6lcsyA== - -default-browser@^5.2.1: - version "5.2.1" - resolved "https://registry.yarnpkg.com/default-browser/-/default-browser-5.2.1.tgz#7b7ba61204ff3e425b556869ae6d3e9d9f1712cf" - integrity sha512-WY/3TUME0x3KPYdRRxEJJvXRHV4PyPoUsxtZa78lwItwRQRHhd2U9xOscaT/YTf8uCXIAjeJOFBVEh/7FtD8Xg== - dependencies: - bundle-name "^4.1.0" - default-browser-id "^5.0.0" - define-data-property@^1.0.1, define-data-property@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/define-data-property/-/define-data-property-1.1.1.tgz#c35f7cd0ab09883480d12ac5cb213715587800b3" @@ -2523,10 +2509,10 @@ define-data-property@^1.0.1, define-data-property@^1.1.1: gopd "^1.0.1" has-property-descriptors "^1.0.0" -define-lazy-prop@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz#dbb19adfb746d7fc6d734a06b72f4a00d021255f" - integrity sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg== +define-lazy-prop@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz#3f7ae421129bcaaac9bc74905c98a0009ec9ee7f" + integrity sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og== define-properties@^1.1.3, define-properties@^1.1.4, define-properties@^1.2.0: version "1.2.0" @@ -2561,26 +2547,26 @@ diff-sequences@^29.6.3: resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.6.3.tgz#4deaf894d11407c51efc8418012f9e70b84ea921" integrity sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q== -diff2html@^3.4.47: - version "3.4.47" - resolved "https://registry.yarnpkg.com/diff2html/-/diff2html-3.4.47.tgz#a9d33bb63815031981fac682eeb2a5d74a931109" - integrity sha512-2llDp8750FRUJl8n7apM0tlcqZYxbDHTw7qhzv/kGddByHRpn3Xg/sWHHIy34h492aGSpStEULydxqrITYpuoA== +diff2html@3.5.0: + version "3.5.0" + resolved "https://registry.yarnpkg.com/diff2html/-/diff2html-3.5.0.tgz#38509520547b9a94e00b3230840e86097f1e8b19" + integrity sha512-02PG+1vLbrKHWMHb1/wcQiq3tF1tx2p6FZgH35ZYYZTSg6w9NJuyi+TZbFvlFmH8bAuMr/xJk5uSAKwfOhn9eg== dependencies: - diff "5.1.0" - hogan.js "3.0.2" + "@profoundlogic/hogan" "^3.0.4" + diff "^9.0.0" optionalDependencies: - highlight.js "11.9.0" - -diff@5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/diff/-/diff-5.1.0.tgz#bc52d298c5ea8df9194800224445ed43ffc87e40" - integrity sha512-D+mk+qE8VC/PAUrlAU34N+VfXev0ghe5ywmpqrawphmVZc1bEfn56uo9qpyGp1p4xpzOHkSW4ztBd6L7Xx4ACw== + highlight.js "11.12.0" diff@^4.0.1: version "4.0.2" resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== +diff@^9.0.0: + version "9.0.0" + resolved "https://registry.yarnpkg.com/diff/-/diff-9.0.0.tgz#297c31cd7c280f13dfe335791ec2063bd4a73a6f" + integrity sha512-svtcdpS8CgJyqAjEQIXdb3OjhFVVYjzGAPO8WGCmRbrml64SPw/jJD4GoE98aR7r25A0XcgrK3F02yw9R/vhQw== + dir-glob@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" @@ -2602,6 +2588,15 @@ doctrine@^3.0.0: dependencies: esutils "^2.0.2" +dunder-proto@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/dunder-proto/-/dunder-proto-1.0.1.tgz#d7ae667e1dc83482f8b70fd0f6eefc50da30f58a" + integrity sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A== + dependencies: + call-bind-apply-helpers "^1.0.1" + es-errors "^1.3.0" + gopd "^1.2.0" + electron-to-chromium@^1.4.477: version "1.4.485" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.485.tgz#fde3ee9ee8112a3414c0dfa545385ad08ec43408" @@ -2627,6 +2622,13 @@ emoji-regex@^8.0.0: resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== +end-of-stream@^1.1.0: + version "1.4.5" + resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.5.tgz#7344d711dea40e0b74abc2ed49778743ccedb08c" + integrity sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg== + dependencies: + once "^1.4.0" + enhanced-resolve@^5.12.0: version "5.15.0" resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.15.0.tgz#1af946c7d93603eb88e9896cee4904dc012e9c35" @@ -2687,6 +2689,23 @@ es-abstract@^1.22.1: unbox-primitive "^1.0.2" which-typed-array "^1.1.13" +es-define-property@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/es-define-property/-/es-define-property-1.0.1.tgz#983eb2f9a6724e9303f61addf011c72e09e0b0fa" + integrity sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g== + +es-errors@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f" + integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== + +es-object-atoms@^1.0.0, es-object-atoms@^1.1.1: + version "1.1.2" + resolved "https://registry.yarnpkg.com/es-object-atoms/-/es-object-atoms-1.1.2.tgz#a2d0b373205724dfa525d23b0c3e1b1ca582c99b" + integrity sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw== + dependencies: + es-errors "^1.3.0" + es-set-tostringtag@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/es-set-tostringtag/-/es-set-tostringtag-2.0.1.tgz#338d502f6f674301d710b80c8592de8a15f09cd8" @@ -2696,6 +2715,16 @@ es-set-tostringtag@^2.0.1: has "^1.0.3" has-tostringtag "^1.0.0" +es-set-tostringtag@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz#f31dbbe0c183b00a6d26eb6325c810c0fd18bd4d" + integrity sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA== + dependencies: + es-errors "^1.3.0" + get-intrinsic "^1.2.6" + has-tostringtag "^1.0.2" + hasown "^2.0.2" + es-shim-unscopables@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/es-shim-unscopables/-/es-shim-unscopables-1.0.0.tgz#702e632193201e3edf8713635d083d378e510241" @@ -2971,7 +3000,7 @@ eventemitter3@^5.0.1: resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-5.0.1.tgz#53f5ffd0a492ac800721bb42c66b841de96423c4" integrity sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA== -execa@8.0.1, execa@^8.0.1: +execa@8.0.1: version "8.0.1" resolved "https://registry.yarnpkg.com/execa/-/execa-8.0.1.tgz#51f6a5943b580f963c3ca9c6321796db8cc39b8c" integrity sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg== @@ -2986,6 +3015,19 @@ execa@8.0.1, execa@^8.0.1: signal-exit "^4.1.0" strip-final-newline "^3.0.0" +execa@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-1.0.0.tgz#c6236a5bb4df6d6f15e88e7f017798216749ddd8" + integrity sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA== + dependencies: + cross-spawn "^6.0.0" + get-stream "^4.0.0" + is-stream "^1.1.0" + npm-run-path "^2.0.0" + p-finally "^1.0.0" + signal-exit "^3.0.0" + strip-eof "^1.0.0" + execa@^5.0.0: version "5.1.1" resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" @@ -3094,14 +3136,6 @@ fb-watchman@^2.0.0: dependencies: bser "2.1.1" -fetch-blob@^3.1.2, fetch-blob@^3.1.4: - version "3.2.0" - resolved "https://registry.yarnpkg.com/fetch-blob/-/fetch-blob-3.2.0.tgz#f09b8d4bbd45adc6f0c20b7e787e793e309dcce9" - integrity sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ== - dependencies: - node-domexception "^1.0.0" - web-streams-polyfill "^3.0.3" - file-entry-cache@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" @@ -3168,30 +3202,16 @@ for-in@^1.0.2: resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" integrity sha512-7EwmXrOjyL+ChxMhmG5lnW9MPt1aIeZEwKhQzoBUdTV0N3zuwWDZYVJatDvZ2OyzPUvdIAZDsCetk3coyMfcnQ== -form-data@^2.5.0: - version "2.5.1" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.5.1.tgz#f2cbec57b5e59e23716e128fe44d4e5dd23895f4" - integrity sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA== - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.6" - mime-types "^2.1.12" - -form-data@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" - integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww== +form-data@^4.0.4: + version "4.0.6" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.6.tgz#28e864e1b786dbebb68db1f452f9635278665827" + integrity sha512-vKatAh4SlVfgbv+YtmhiRjhEMJsYpsG1Y2rMQtR+SVSbytsSD1YGzDIcrAJmdFec88u/+VoGmxnl+80gL1tRCQ== dependencies: asynckit "^0.4.0" combined-stream "^1.0.8" - mime-types "^2.1.12" - -formdata-polyfill@^4.0.10: - version "4.0.10" - resolved "https://registry.yarnpkg.com/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz#24807c31c9d402e002ab3d8c720144ceb8848423" - integrity sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g== - dependencies: - fetch-blob "^3.1.2" + es-set-tostringtag "^2.1.0" + hasown "^2.0.4" + mime-types "^2.1.35" fs.realpath@^1.0.0: version "1.0.0" @@ -3263,11 +3283,42 @@ get-intrinsic@^1.2.2: has-symbols "^1.0.3" hasown "^2.0.0" +get-intrinsic@^1.2.6: + version "1.3.0" + resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.3.0.tgz#743f0e3b6964a93a5491ed1bffaae054d7f98d01" + integrity sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ== + dependencies: + call-bind-apply-helpers "^1.0.2" + es-define-property "^1.0.1" + es-errors "^1.3.0" + es-object-atoms "^1.1.1" + function-bind "^1.1.2" + get-proto "^1.0.1" + gopd "^1.2.0" + has-symbols "^1.1.0" + hasown "^2.0.2" + math-intrinsics "^1.1.0" + get-package-type@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/get-package-type/-/get-package-type-0.1.0.tgz#8de2d803cff44df3bc6c456e6668b36c3926e11a" integrity sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q== +get-proto@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/get-proto/-/get-proto-1.0.1.tgz#150b3f2743869ef3e851ec0c49d15b1d14d00ee1" + integrity sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g== + dependencies: + dunder-proto "^1.0.1" + es-object-atoms "^1.0.0" + +get-stream@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-4.1.0.tgz#c1b255575f3dc21d59bfc79cd3d2b46b1c3a54b5" + integrity sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w== + dependencies: + pump "^3.0.0" + get-stream@^6.0.0: version "6.0.1" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" @@ -3357,6 +3408,11 @@ gopd@^1.0.1: dependencies: get-intrinsic "^1.1.3" +gopd@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.2.0.tgz#89f56b8217bdbc8802bd299df6d7f1081d7e51a1" + integrity sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg== + graceful-fs@^4.2.4, graceful-fs@^4.2.9: version "4.2.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" @@ -3419,6 +3475,11 @@ has-symbols@^1.0.2, has-symbols@^1.0.3: resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.3.tgz#bb7b2c4349251dce87b125f7bdf874aa7c8b39f8" integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A== +has-symbols@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.1.0.tgz#fc9c6a783a084951d0b971fe1018de813707a338" + integrity sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ== + has-tostringtag@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-tostringtag/-/has-tostringtag-1.0.0.tgz#7e133818a7d394734f941e73c3d3f9291e658b25" @@ -3426,6 +3487,13 @@ has-tostringtag@^1.0.0: dependencies: has-symbols "^1.0.2" +has-tostringtag@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/has-tostringtag/-/has-tostringtag-1.0.2.tgz#2cdc42d40bef2e5b4eeab7c01a73c54ce7ab5abc" + integrity sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw== + dependencies: + has-symbols "^1.0.3" + has@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" @@ -3440,18 +3508,17 @@ hasown@^2.0.0: dependencies: function-bind "^1.1.2" -highlight.js@11.9.0: - version "11.9.0" - resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-11.9.0.tgz#04ab9ee43b52a41a047432c8103e2158a1b8b5b0" - integrity sha512-fJ7cW7fQGCYAkgv4CPfwFHrfd/cLS4Hau96JuJ+ZTOWhjnhoeN1ub1tFmALm/+lW5z4WCAuAV9bm05AP0mS6Gw== - -hogan.js@3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/hogan.js/-/hogan.js-3.0.2.tgz#4cd9e1abd4294146e7679e41d7898732b02c7bfd" - integrity sha512-RqGs4wavGYJWE07t35JQccByczmNUXQT0E12ZYV1VKYu5UiAU9lsos/yBAcf840+zrUQQxgVduCR5/B8nNtibg== +hasown@^2.0.2, hasown@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.4.tgz#8c62d8cb90beb2aad5d0a5b67581ad9854c3f003" + integrity sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A== dependencies: - mkdirp "0.3.0" - nopt "1.0.10" + function-bind "^1.1.2" + +highlight.js@11.12.0: + version "11.12.0" + resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-11.12.0.tgz#470d918fd556a76debc40fe5e4b540b6b9cb9890" + integrity sha512-nbfWpyRMcMrPMmDwJB+dhX/eiaPKtc2RB+0QZskqJ3WjRA/FDS0e9hZrx8EC/lbEv8gXy98FcDbNa/dspAaJMg== html-escaper@^2.0.0: version "2.0.2" @@ -3596,10 +3663,10 @@ is-date-object@^1.0.1: dependencies: has-tostringtag "^1.0.0" -is-docker@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-3.0.0.tgz#90093aa3106277d8a77a5910dbae71747e15a200" - integrity sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ== +is-docker@^2.0.0, is-docker@^2.1.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-2.2.1.tgz#33eeabe23cfe86f14bde4408a02c0cfb853acdaa" + integrity sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ== is-extendable@^0.1.0: version "0.1.1" @@ -3647,13 +3714,6 @@ is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3: dependencies: is-extglob "^2.1.1" -is-inside-container@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-inside-container/-/is-inside-container-1.0.0.tgz#e81fba699662eb31dbdaf26766a61d4814717ea4" - integrity sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA== - dependencies: - is-docker "^3.0.0" - is-negative-zero@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/is-negative-zero/-/is-negative-zero-2.0.2.tgz#7bf6f03a28003b8b3965de3ac26f664d765f3150" @@ -3710,6 +3770,11 @@ is-shared-array-buffer@^1.0.2: dependencies: call-bind "^1.0.2" +is-stream@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" + integrity sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ== + is-stream@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" @@ -3748,19 +3813,12 @@ is-weakref@^1.0.2: dependencies: call-bind "^1.0.2" -is-wsl@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-3.1.0.tgz#e1c657e39c10090afcbedec61720f6b924c3cbd2" - integrity sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw== - dependencies: - is-inside-container "^1.0.0" - -is64bit@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is64bit/-/is64bit-2.0.0.tgz#198c627cbcb198bbec402251f88e5e1a51236c07" - integrity sha512-jv+8jaWCl0g2lSBkNSVXdzfBA0npK1HGC2KtWM9FumFRoGS94g3NbCCLVnCYHLjp4GrW2KZeeSTMo5ddtznmGw== +is-wsl@^2.1.1, is-wsl@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-2.2.0.tgz#74a4c76e77ca9fd3f932f290c17ea326cd157271" + integrity sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww== dependencies: - system-architecture "^0.1.0" + is-docker "^2.0.0" isarray@1.0.0, isarray@~1.0.0: version "1.0.0" @@ -4520,6 +4578,11 @@ markdown-toc@^1.2.0: repeat-string "^1.6.1" strip-color "^0.1.0" +math-intrinsics@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz#a0dd74be81e2aa5c2f27e65ce283605ee4e2b7f9" + integrity sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g== + math-random@^1.0.1: version "1.0.4" resolved "https://registry.yarnpkg.com/math-random/-/math-random-1.0.4.tgz#5dd6943c938548267016d4e34f057583080c514c" @@ -4548,7 +4611,7 @@ mime-db@1.52.0: resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== -mime-types@^2.1.12: +mime-types@^2.1.35: version "2.1.35" resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== @@ -4592,11 +4655,6 @@ mixin-deep@^1.1.3: for-in "^1.0.2" is-extendable "^1.0.1" -mkdirp@0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.3.0.tgz#1bbf5ab1ba827af23575143490426455f481fe1e" - integrity sha512-OHsdUcVAQ6pOtg5JYWpCBo9W/GySVuwvP9hueRMW7UqshC0tbfzLv8wjySTPm3tfUZ/21CE9E1pJagOA91Pxew== - ms@2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" @@ -4612,19 +4670,17 @@ natural-compare@^1.4.0: resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== -node-domexception@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5" - integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ== +nice-try@^1.0.4: + version "1.0.5" + resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" + integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== -node-fetch@^3.3.2: - version "3.3.2" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-3.3.2.tgz#d1e889bacdf733b4ff3b2b243eb7a12866a0b78b" - integrity sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA== +node-fetch@2.7.0: + version "2.7.0" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" + integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== dependencies: - data-uri-to-buffer "^4.0.0" - fetch-blob "^3.1.4" - formdata-polyfill "^4.0.10" + whatwg-url "^5.0.0" node-int64@^0.4.0: version "0.4.0" @@ -4653,6 +4709,13 @@ normalize-path@^3.0.0: resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== +npm-run-path@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" + integrity sha512-lJxZYlT4DW/bRUtFh1MQIWqmLwQfAxnqWG4HhEdjMlkrJYnJn0Jrr2u3mgxqaWsdiBc76TYkTG/mhrnYTuzfHw== + dependencies: + path-key "^2.0.0" + npm-run-path@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" @@ -4727,7 +4790,7 @@ object.values@^1.1.7: define-properties "^1.2.0" es-abstract "^1.22.1" -once@^1.3.0: +once@^1.3.0, once@^1.3.1, once@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== @@ -4748,15 +4811,14 @@ onetime@^6.0.0: dependencies: mimic-fn "^4.0.0" -open@^10.0.3: - version "10.0.3" - resolved "https://registry.yarnpkg.com/open/-/open-10.0.3.tgz#f60d8db49fa126c50aec751957fb5d7de3308d4f" - integrity sha512-dtbI5oW7987hwC9qjJTyABldTaa19SuyJse1QboWv3b0qCcrrLNVDqBx1XgELAjh9QTVQaP/C5b1nhQebd1H2A== +open@8.4.2: + version "8.4.2" + resolved "https://registry.yarnpkg.com/open/-/open-8.4.2.tgz#5b5ffe2a8f793dcd2aad73e550cb87b59cb084f9" + integrity sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ== dependencies: - default-browser "^5.2.1" - define-lazy-prop "^3.0.0" - is-inside-container "^1.0.0" - is-wsl "^3.1.0" + define-lazy-prop "^2.0.0" + is-docker "^2.1.1" + is-wsl "^2.2.0" optionator@^0.9.3: version "0.9.3" @@ -4770,6 +4832,11 @@ optionator@^0.9.3: prelude-ls "^1.2.1" type-check "^0.4.0" +p-finally@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" + integrity sha512-LICb2p9CB7FS+0eR1oqWnHhp0FljGLZCWBE9aix0Uye9W8LTQPwMTYVGWQWIw9RdQiDg4+epXQODwIYJtSJaow== + p-limit@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" @@ -4830,6 +4897,11 @@ path-is-absolute@^1.0.0: resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg== +path-key@^2.0.0, path-key@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" + integrity sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw== + path-key@^3.0.0, path-key@^3.1.0: version "3.1.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" @@ -4918,6 +4990,14 @@ prompts@^2.0.1: kleur "^3.0.3" sisteransi "^1.0.5" +pump@^3.0.0: + version "3.0.4" + resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.4.tgz#1f313430527fa8b905622ebd22fe1444e757ab3c" + integrity sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA== + dependencies: + end-of-stream "^1.1.0" + once "^1.3.1" + punycode@^2.1.0: version "2.3.0" resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.0.tgz#f67fa67c94da8f4d0cfff981aee4118064199b8f" @@ -5106,11 +5186,6 @@ rimraf@^3.0.2: dependencies: glob "^7.1.3" -run-applescript@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/run-applescript/-/run-applescript-7.0.0.tgz#e5a553c2bffd620e169d276c1cd8f1b64778fbeb" - integrity sha512-9by4Ij99JUr/MCFBUkDKLWK3G9HVXmabKz9U5MlIAIuvuzkiOicRYs8XJLxX+xahD+mLiiCYDqF9dKAgtzKP1A== - run-parallel@^1.1.9: version "1.2.0" resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" @@ -5142,6 +5217,11 @@ safe-regex-test@^1.0.0: get-intrinsic "^1.1.3" is-regex "^1.1.4" +semver@^5.5.0: + version "5.7.3" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.3.tgz#cfc74be3a9b2c95aa6e62aa0b2fbaa325f3ed329" + integrity sha512-kM18BPOqTi0+TB68703/GJRpAML5Me+IDQsR1J26YB3EFKKNEyHIVZuWDX7+WKQB3tHwDwgk24BfhdpWUbytvQ== + semver@^6.1.0, semver@^6.3.0, semver@^6.3.1: version "6.3.1" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" @@ -5180,6 +5260,13 @@ set-getter@^0.1.0: dependencies: to-object-path "^0.3.0" +shebang-command@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" + integrity sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg== + dependencies: + shebang-regex "^1.0.0" + shebang-command@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" @@ -5187,6 +5274,11 @@ shebang-command@^2.0.0: dependencies: shebang-regex "^3.0.0" +shebang-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" + integrity sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ== + shebang-regex@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" @@ -5201,7 +5293,7 @@ side-channel@^1.0.4: get-intrinsic "^1.0.2" object-inspect "^1.9.0" -signal-exit@^3.0.2, signal-exit@^3.0.3, signal-exit@^3.0.7: +signal-exit@^3.0.0, signal-exit@^3.0.2, signal-exit@^3.0.3, signal-exit@^3.0.7: version "3.0.7" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== @@ -5356,6 +5448,11 @@ strip-color@^0.1.0: resolved "https://registry.yarnpkg.com/strip-color/-/strip-color-0.1.0.tgz#106f65d3d3e6a2d9401cac0eb0ce8b8a702b4f7b" integrity sha512-p9LsUieSjWNNAxVCXLeilaDlmuUOrDS5/dF9znM1nZc7EGX5+zEFC0bEevsNIaldjlks+2jns5Siz6F9iK6jwA== +strip-eof@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" + integrity sha512-7FCwGGmx8mD5xQd3RPUvnSpUXHM3BWuzjtpD4TXsfcZ9EL4azvVVUscFYwD9nx8Kh+uCBC00XBtAykoMHwTh8Q== + strip-final-newline@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" @@ -5397,11 +5494,6 @@ supports-preserve-symlinks-flag@^1.0.0: resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== -system-architecture@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/system-architecture/-/system-architecture-0.1.0.tgz#71012b3ac141427d97c67c56bc7921af6bff122d" - integrity sha512-ulAk51I9UVUyJgxlv9M6lFot2WP3e7t8Kz9+IS6D4rVba1tR9kON+Ey69f+1R4Q8cd45Lod6a4IcJIxnzGc/zA== - tapable@^2.2.0: version "2.2.1" resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.1.tgz#1967a73ef4060a82f12ab96af86d52fdb76eeca0" @@ -5458,6 +5550,11 @@ toml@^2.3.2: resolved "https://registry.yarnpkg.com/toml/-/toml-2.3.6.tgz#25b0866483a9722474895559088b436fd11f861b" integrity sha512-gVweAectJU3ebq//Ferr2JUY4WKSDe5N+z0FvjDncLGyHmIDoxgY/2Ie4qfEIDm4IS7OA6Rmdm7pdEEdMcV/xQ== +tr46@~0.0.3: + version "0.0.3" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" + integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== + ts-api-utils@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.0.1.tgz#8144e811d44c749cd65b2da305a032510774452d" @@ -5604,11 +5701,6 @@ unbox-primitive@^1.0.2: has-symbols "^1.0.3" which-boxed-primitive "^1.0.2" -undici-types@~5.26.4: - version "5.26.5" - resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" - integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== - unicode-canonical-property-names-ecmascript@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz#301acdc525631670d39f6146e0e77ff6bbdebddc" @@ -5712,10 +5804,18 @@ walker@^1.0.8: dependencies: makeerror "1.0.12" -web-streams-polyfill@^3.0.3: - version "3.2.1" - resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz#71c2718c52b45fd49dbeee88634b3a60ceab42a6" - integrity sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q== +webidl-conversions@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" + integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== + +whatwg-url@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" + integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw== + dependencies: + tr46 "~0.0.3" + webidl-conversions "^3.0.0" which-boxed-primitive@^1.0.2: version "1.0.2" @@ -5750,6 +5850,13 @@ which-typed-array@^1.1.13: gopd "^1.0.1" has-tostringtag "^1.0.0" +which@^1.2.9: + version "1.3.1" + resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" + integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ== + dependencies: + isexe "^2.0.0" + which@^2.0.1: version "2.0.2" resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" @@ -5818,7 +5925,20 @@ yargs-parser@^21.0.1, yargs-parser@^21.1.1: resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== -yargs@^17.3.1, yargs@^17.6.0: +yargs@17.7.3: + version "17.7.3" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.3.tgz#779dffe6bcafec596a7172e983289a588647faaa" + integrity sha512-GZtjxm/J/4TSxuL3FNYjCmLktBTnIw/rVmKSIyKeYAZpmJB2ig9VauCC5xsa82GNKVKDAqpOn3KVzNt0zmrU0g== + dependencies: + cliui "^8.0.1" + escalade "^3.1.1" + get-caller-file "^2.0.5" + require-directory "^2.1.1" + string-width "^4.2.3" + y18n "^5.0.5" + yargs-parser "^21.1.1" + +yargs@^17.3.1: version "17.7.2" resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w== From 73320c421c6dbf52051d9cf80d17baa19277764a Mon Sep 17 00:00:00 2001 From: Rodrigo Fernandes Date: Tue, 1 Dec 2026 10:24:56 +0000 Subject: [PATCH 2/4] cli: load clipboard support only for pbcopy Signed-off-by: Rodrigo Fernandes --- README.md | 5 +++++ src/__tests__/cli-startup-tests.ts | 9 +++++++++ src/cli.ts | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 src/__tests__/cli-startup-tests.ts diff --git a/README.md b/README.md index 9414f44..5cf14cf 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,11 @@ Usage: diff2html [ flags and/or options ] -- [git diff passthrough flags and opt | -v | --version | Show version number | | | | -h | --help | Show help | | | +On Linux, `-u pbcopy` requires `getconf` on `PATH` when Node.js is not x64. + +In Podman containers on WSL2, browser preview and clipboard integration may try to use Windows helpers. Use `-o stdout` +to print the rendered diff or `-u print` to print the Diffy link without opening or copying it. + ### Exit Status Codes - :tada: 0: Success diff --git a/src/__tests__/cli-startup-tests.ts b/src/__tests__/cli-startup-tests.ts new file mode 100644 index 0000000..e5a4ac5 --- /dev/null +++ b/src/__tests__/cli-startup-tests.ts @@ -0,0 +1,9 @@ +import { jest } from '@jest/globals'; + +jest.mock('clipboardy', () => { + throw new Error('Clipboard adapter could not initialize'); +}); + +test('loads the CLI when the clipboard adapter cannot initialize', async () => { + await expect(import('../cli')).resolves.toHaveProperty('getInput'); +}); diff --git a/src/cli.ts b/src/cli.ts index 25e7d0e..6a5a256 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -2,7 +2,6 @@ import fs from 'fs'; import os from 'os'; import path from 'path'; -import { writeSync } from 'clipboardy'; import open from 'open'; import { parse, html, Diff2HtmlConfig } from 'diff2html'; @@ -214,6 +213,7 @@ export async function postToDiffy(diff: string, diffyOutput: DiffyType): Promise if (diffyOutput === 'browser') { open(url); } else if (diffyOutput === 'pbcopy') { + const { writeSync } = await import('clipboardy'); writeSync(url); } From 40510dc21835a7881ceac0fb6fe2e473b7b1b834 Mon Sep 17 00:00:00 2001 From: Rodrigo Fernandes Date: Tue, 1 Dec 2026 10:36:22 +0000 Subject: [PATCH 3/4] cli: keep Podman desktop helpers on Linux Keep preview and clipboard dispatch inside Podman on WSL2. Signed-off-by: Rodrigo Fernandes --- README.md | 5 +- src/__tests__/cli-podman-tests.ts | 78 +++++++++++++++++++++++++++++++ src/__tests__/cli-tests.ts | 2 +- src/cli.ts | 39 ++++++++++++++-- 4 files changed, 117 insertions(+), 7 deletions(-) create mode 100644 src/__tests__/cli-podman-tests.ts diff --git a/README.md b/README.md index 5cf14cf..cd94663 100644 --- a/README.md +++ b/README.md @@ -100,8 +100,9 @@ Usage: diff2html [ flags and/or options ] -- [git diff passthrough flags and opt On Linux, `-u pbcopy` requires `getconf` on `PATH` when Node.js is not x64. -In Podman containers on WSL2, browser preview and clipboard integration may try to use Windows helpers. Use `-o stdout` -to print the rendered diff or `-u print` to print the Diffy link without opening or copying it. +In Podman containers on WSL2, browser preview and clipboard integration use the container's Linux helpers. If the +container has no desktop or clipboard access, use `-o stdout` to print the rendered diff or `-u print` to print the +Diffy link. ### Exit Status Codes diff --git a/src/__tests__/cli-podman-tests.ts b/src/__tests__/cli-podman-tests.ts new file mode 100644 index 0000000..aed4ee9 --- /dev/null +++ b/src/__tests__/cli-podman-tests.ts @@ -0,0 +1,78 @@ +import childProcess from 'child_process'; +import fs from 'fs'; +import os from 'os'; +import path from 'path'; +import { jest } from '@jest/globals'; + +import { put } from '../http-utils'; + +jest.mock('child_process'); +jest.mock('../http-utils', () => ({ put: jest.fn() })); +jest.mock('../logger', () => ({ print: jest.fn() })); +jest.mock('../utils', () => ({ writeFile: jest.fn() })); + +const originalPlatform = process.platform; +const originalArch = process.arch; +const spawn = jest.mocked(childProcess.spawn); +const spawnSync = jest.mocked(childProcess.spawnSync); +const url = 'https://diffy.org/diff/test'; +const xselArgs = ['--clipboard', '--input']; + +beforeEach(() => { + Object.defineProperty(process, 'platform', { value: 'linux' }); + Object.defineProperty(process, 'arch', { value: 'x64' }); + jest.spyOn(os, 'release').mockReturnValue('5.15.153.1-microsoft-standard-WSL2'); + const { existsSync, statSync, readFileSync } = fs; + const { access } = fs.promises; + jest.spyOn(fs, 'existsSync').mockImplementation(file => file === '/run/.containerenv' || existsSync(file)); + jest.spyOn(fs, 'statSync').mockImplementation((file, options) => { + if (file === '/.dockerenv') throw new Error('No Docker marker'); + return statSync(file, options); + }); + jest.spyOn(fs, 'readFileSync').mockImplementation((file, options) => { + return file === '/proc/self/cgroup' ? '0::/libpod-fixture' : readFileSync(file, options); + }); + jest.spyOn(fs.promises, 'access').mockImplementation((file, mode) => { + return file === '/etc/wsl.conf' ? Promise.reject(new Error('No WSL config')) : access(file, mode); + }); + + jest.mocked(put).mockResolvedValue({ id: 'test' }); +}); + +afterEach(() => { + Object.defineProperty(process, 'platform', { value: originalPlatform }); + Object.defineProperty(process, 'arch', { value: originalArch }); + jest.restoreAllMocks(); + jest.resetAllMocks(); +}); + +test('uses Linux desktop helpers in Podman on WSL2', async () => { + spawn.mockReturnValue({ unref: jest.fn() } as unknown as childProcess.ChildProcess); + spawnSync.mockReturnValue({ pid: 1, output: [], status: 0, signal: null, stdout: '', stderr: '' }); + + const cli = await import('../cli'); + const filePath = path.resolve(os.tmpdir(), 'diff.html'); + cli.preview('output', 'html'); + await cli.postToDiffy('input', 'browser'); + await cli.postToDiffy('input', 'pbcopy'); + + expect(spawn.mock.calls.map(([command, args]) => [path.basename(command), args])).toEqual([ + ['xdg-open', [filePath]], + ['xdg-open', [url]], + ]); + expect(spawnSync).toHaveBeenCalledTimes(1); + expect(spawnSync).toHaveBeenCalledWith('xsel', xselArgs, expect.objectContaining({ input: url })); +}); + +test('tries bundled xsel without falling back to Windows if the Linux clipboard fails', async () => { + spawnSync.mockReturnValue({ pid: 1, output: [], status: 1, signal: null, stdout: '', stderr: '' }); + + const cli = await import('../cli'); + await expect(cli.postToDiffy('input', 'pbcopy')).rejects.toThrow('xsel failed (exit 1)'); + const bundledXsel = path.resolve(path.dirname(require.resolve('clipboardy')), 'fallbacks', 'linux', 'xsel'); + expect(spawnSync.mock.calls.map(([command, args]) => [command, args])).toEqual([ + ['xsel', xselArgs], + [bundledXsel, xselArgs], + ]); + expect(spawn).not.toHaveBeenCalled(); +}); diff --git a/src/__tests__/cli-tests.ts b/src/__tests__/cli-tests.ts index dc0c168..c50c62e 100644 --- a/src/__tests__/cli-tests.ts +++ b/src/__tests__/cli-tests.ts @@ -160,7 +160,7 @@ describe('cli', () => { await cli.postToDiffy('a', 'browser'); - expect(open).toHaveBeenCalledWith(diffUrl); + expect(open).toHaveBeenCalledWith(diffUrl, { wait: false }); expect(writeSync).not.toHaveBeenCalled(); }); diff --git a/src/cli.ts b/src/cli.ts index 6a5a256..b082e2b 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -1,3 +1,4 @@ +import childProcess from 'child_process'; import fs from 'fs'; import os from 'os'; import path from 'path'; @@ -173,11 +174,42 @@ export function getOutput(options: Diff2HtmlConfig, config: Configuration, input } } +function isPodman(): boolean { + return process.platform === 'linux' && fs.existsSync('/run/.containerenv'); +} + +function openTarget(target: string): void { + // open@8 misses the Podman marker and can otherwise dispatch to Windows under WSL2. + const app = isPodman() ? { name: require.resolve('open/xdg-open') } : undefined; + open(target, { wait: false, ...(app && { app }) }); +} + +async function copyToClipboard(text: string): Promise { + if (!isPodman()) { + const { writeSync } = await import('clipboardy'); + writeSync(text); + return; + } + + // clipboardy@2 also mistakes Podman on WSL2 for the Windows host. Keep its Linux helper order. + const args = ['--clipboard', '--input']; + const options = { input: text }; + if (childProcess.spawnSync('xsel', args, options).status === 0) return; + + const bundledXsel = path.resolve(path.dirname(require.resolve('clipboardy')), 'fallbacks', 'linux', 'xsel'); + const result = childProcess.spawnSync(bundledXsel, args, options); + if (result.error) throw result.error; + if (result.status !== 0) { + const reason = result.signal ?? `exit ${result.status}`; + throw new Error(`xsel failed (${reason})`); + } +} + export function preview(content: string, format: string): void { const filename = `diff.${format}`; const filePath: string = path.resolve(os.tmpdir(), filename); utils.writeFile(filePath, content); - open(filePath, { wait: false }); + openTarget(filePath); } type CreateDiffResponse = { id: string }; @@ -211,10 +243,9 @@ export async function postToDiffy(diff: string, diffyOutput: DiffyType): Promise log.print(url); if (diffyOutput === 'browser') { - open(url); + openTarget(url); } else if (diffyOutput === 'pbcopy') { - const { writeSync } = await import('clipboardy'); - writeSync(url); + await copyToClipboard(url); } return url; From 43ada553c18126c427e45f5a65219bdc5037b4fb Mon Sep 17 00:00:00 2001 From: Rodrigo Fernandes Date: Tue, 1 Dec 2026 10:47:06 +0000 Subject: [PATCH 4/4] cli: restore Podman opener fallback Choose an executable Linux opener and isolate desktop helpers in tests; clarify where pbcopy needs getconf. Signed-off-by: Rodrigo Fernandes --- README.md | 2 +- src/__tests__/cli-podman-tests.ts | 29 +++++++++++++++++++++++++---- src/__tests__/cli-tests.ts | 8 ++++++++ src/cli.ts | 12 +++++++++++- 4 files changed, 45 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index cd94663..a40b903 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,7 @@ Usage: diff2html [ flags and/or options ] -- [git diff passthrough flags and opt | -v | --version | Show version number | | | | -h | --help | Show help | | | -On Linux, `-u pbcopy` requires `getconf` on `PATH` when Node.js is not x64. +On Linux outside Podman containers, `-u pbcopy` requires `getconf` on `PATH` when Node.js is not x64. In Podman containers on WSL2, browser preview and clipboard integration use the container's Linux helpers. If the container has no desktop or clipboard access, use `-o stdout` to print the rendered diff or `-u print` to print the diff --git a/src/__tests__/cli-podman-tests.ts b/src/__tests__/cli-podman-tests.ts index aed4ee9..949a848 100644 --- a/src/__tests__/cli-podman-tests.ts +++ b/src/__tests__/cli-podman-tests.ts @@ -7,6 +7,9 @@ import { jest } from '@jest/globals'; import { put } from '../http-utils'; jest.mock('child_process'); +jest.mock('clipboardy', () => { + throw new Error('Podman should not load the clipboard adapter'); +}); jest.mock('../http-utils', () => ({ put: jest.fn() })); jest.mock('../logger', () => ({ print: jest.fn() })); jest.mock('../utils', () => ({ writeFile: jest.fn() })); @@ -15,6 +18,7 @@ const originalPlatform = process.platform; const originalArch = process.arch; const spawn = jest.mocked(childProcess.spawn); const spawnSync = jest.mocked(childProcess.spawnSync); +const bundledOpener = require.resolve('open/xdg-open'); const url = 'https://diffy.org/diff/test'; const xselArgs = ['--clipboard', '--input']; @@ -25,6 +29,7 @@ beforeEach(() => { const { existsSync, statSync, readFileSync } = fs; const { access } = fs.promises; jest.spyOn(fs, 'existsSync').mockImplementation(file => file === '/run/.containerenv' || existsSync(file)); + jest.spyOn(fs, 'accessSync').mockReturnValue(undefined); jest.spyOn(fs, 'statSync').mockImplementation((file, options) => { if (file === '/.dockerenv') throw new Error('No Docker marker'); return statSync(file, options); @@ -46,7 +51,7 @@ afterEach(() => { jest.resetAllMocks(); }); -test('uses Linux desktop helpers in Podman on WSL2', async () => { +test('uses the executable bundled opener and system xsel in Podman on WSL2', async () => { spawn.mockReturnValue({ unref: jest.fn() } as unknown as childProcess.ChildProcess); spawnSync.mockReturnValue({ pid: 1, output: [], status: 0, signal: null, stdout: '', stderr: '' }); @@ -56,14 +61,30 @@ test('uses Linux desktop helpers in Podman on WSL2', async () => { await cli.postToDiffy('input', 'browser'); await cli.postToDiffy('input', 'pbcopy'); - expect(spawn.mock.calls.map(([command, args]) => [path.basename(command), args])).toEqual([ - ['xdg-open', [filePath]], - ['xdg-open', [url]], + expect(fs.accessSync).toHaveBeenCalledWith(bundledOpener, fs.constants.X_OK); + expect(spawn.mock.calls.map(([command, args]) => [command, args])).toEqual([ + [bundledOpener, [filePath]], + [bundledOpener, [url]], ]); expect(spawnSync).toHaveBeenCalledTimes(1); expect(spawnSync).toHaveBeenCalledWith('xsel', xselArgs, expect.objectContaining({ input: url })); }); +test('uses system xdg-open when the bundled opener is not executable in Podman on WSL2', async () => { + spawn.mockReturnValue({ unref: jest.fn() } as unknown as childProcess.ChildProcess); + jest.mocked(fs.accessSync).mockImplementation(() => { + throw Object.assign(new Error('Bundled opener is not executable'), { code: 'EACCES' }); + }); + + const cli = await import('../cli'); + const filePath = path.resolve(os.tmpdir(), 'diff.html'); + cli.preview('output', 'html'); + + expect(fs.accessSync).toHaveBeenCalledWith(bundledOpener, fs.constants.X_OK); + expect(spawn).toHaveBeenCalledTimes(1); + expect(spawn).toHaveBeenCalledWith('xdg-open', [filePath], { detached: true, stdio: 'ignore' }); +}); + test('tries bundled xsel without falling back to Windows if the Linux clipboard fails', async () => { spawnSync.mockReturnValue({ pid: 1, output: [], status: 1, signal: null, stdout: '', stderr: '' }); diff --git a/src/__tests__/cli-tests.ts b/src/__tests__/cli-tests.ts index c50c62e..f9b96eb 100644 --- a/src/__tests__/cli-tests.ts +++ b/src/__tests__/cli-tests.ts @@ -1,3 +1,4 @@ +import fs from 'fs'; import os from 'os'; import path from 'path'; import { jest } from '@jest/globals'; @@ -10,6 +11,7 @@ import { put } from '../http-utils'; import * as utils from '../utils'; import { setup } from '../yargs'; +jest.mock('child_process'); jest.mock('clipboardy', () => ({ writeSync: jest.fn() })); jest.mock('open', () => jest.fn()); jest.mock('../utils'); @@ -22,7 +24,13 @@ const writeFileSpy = jest.mocked(utils.writeFile); const executeSpy = jest.mocked(utils.execute); const putSpy = jest.mocked(put); +beforeEach(() => { + const { existsSync } = fs; + jest.spyOn(fs, 'existsSync').mockImplementation(file => file !== '/run/.containerenv' && existsSync(file)); +}); + afterEach(() => { + jest.restoreAllMocks(); jest.resetAllMocks(); }); diff --git a/src/cli.ts b/src/cli.ts index b082e2b..32487b4 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -178,9 +178,19 @@ function isPodman(): boolean { return process.platform === 'linux' && fs.existsSync('/run/.containerenv'); } +function podmanOpener(): string { + try { + const bundledOpener = require.resolve('open/xdg-open'); + fs.accessSync(bundledOpener, fs.constants.X_OK); + return bundledOpener; + } catch { + return 'xdg-open'; + } +} + function openTarget(target: string): void { // open@8 misses the Podman marker and can otherwise dispatch to Windows under WSL2. - const app = isPodman() ? { name: require.resolve('open/xdg-open') } : undefined; + const app = isPodman() ? { name: podmanOpener() } : undefined; open(target, { wait: false, ...(app && { app }) }); }