From 255f8ad5df97503472b23ed8be4134b0cb76e9e8 Mon Sep 17 00:00:00 2001 From: Joe Hildebrand Date: Tue, 31 Oct 2023 16:08:04 -0600 Subject: [PATCH] Update dependencies --- .eslintrc.cjs | 2 +- .github/workflows/node.js.yml | 2 +- bin/linewrap.js | 66 ++-- package-lock.json | 657 ++++++++++++++++++---------------- package.json | 12 +- test/bin.test.js | 148 ++++---- test/harness.js | 72 ++-- 7 files changed, 505 insertions(+), 454 deletions(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 95a73e1..02868ef 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -35,4 +35,4 @@ module.exports = { }, }, ], -} +}; diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 1859693..c770754 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: - node-version: [16.x, 18.x, 20.x] + node-version: [16.x, 18.x, 20.x, 21.x] os: [ubuntu-latest] runs-on: ${{ matrix.os }} diff --git a/bin/linewrap.js b/bin/linewrap.js index 75de35d..f2ee002 100755 --- a/bin/linewrap.js +++ b/bin/linewrap.js @@ -1,12 +1,12 @@ #!/usr/bin/env node /* eslint-disable no-console */ -import {inspect, promisify} from 'util' -import {LineWrap} from '@cto.af/linewrap' -import {fileURLToPath} from 'url' -import fs from 'fs' -import os from 'os' -import {parseArgsWithHelp} from 'minus-h' +import {inspect, promisify} from 'util'; +import {LineWrap} from '@cto.af/linewrap'; +import {fileURLToPath} from 'url'; +import fs from 'fs'; +import os from 'os'; +import {parseArgsWithHelp} from 'minus-h'; /** * @type {Parameters[0]} @@ -131,7 +131,7 @@ const config = { argumentName: '...file', argumentDescription: 'files to wrap and concatenate. Use "-" for stdin. Default: "-"', description: 'Wrap some text, either from file, stdin, or given on the command line. Each chunk of text is wrapped independently from one another, and streamed to stdout (or an outFile, if given). Command line arguments with -t/--text are processed before files.', -} +}; /** * Read stdin to completion with the configured encoding. @@ -140,13 +140,13 @@ const config = { */ function readStdin(opts, stream) { // Below, d will be a string - stream.setEncoding(opts.encoding) + stream.setEncoding(opts.encoding); return new Promise((resolve, reject) => { - let s = '' - stream.on('data', d => (s += d)) - stream.on('end', () => resolve(s)) - stream.on('error', reject) - }) + let s = ''; + stream.on('data', d => (s += d)); + stream.on('end', () => resolve(s)); + stream.on('error', reject); + }); } const ESCAPES = { @@ -156,7 +156,7 @@ const ESCAPES = { '"': '"', "'": ''', '\xA0': ' ', -} +}; /** * Escape HTML @@ -166,12 +166,12 @@ const ESCAPES = { * @private */ function htmlEscape(str) { - return str.replace(/[&<>\xA0]/g, m => ESCAPES[m]) + return str.replace(/[&<>\xA0]/g, m => ESCAPES[m]); } const { exit, stdin, stdout, stderr, -} = process +} = process; export async function main( extraConfig, @@ -184,10 +184,10 @@ export async function main( }, { width: config.options.width.default, ...options, - }) + }); if ((values.text.length === 0) && (positionals.length === 0)) { - positionals.push('-') + positionals.push('-'); } // Always a valid string, due to choices enforcement @@ -196,11 +196,11 @@ export async function main( visible: LineWrap.OVERFLOW_VISIBLE, clip: LineWrap.OVERFLOW_CLIP, anywhere: LineWrap.OVERFLOW_ANYWHERE, - }[values.overflow] + }[values.overflow]; const outstream = values.outFile ? fs.createWriteStream(values.outFile, values.encoding) : - process.stdout // Don't set encoding, will confuse terminal. + process.stdout; // Don't set encoding, will confuse terminal. /** @type {ConstructorParameters[0]} */ const opts = { @@ -220,39 +220,39 @@ export async function main( trim: !values.noTrim, verbose: values.verbose, width: parseInt(values.width, 10), - } + }; if (typeof values.isNewline === 'string') { opts.isNewline = (values.isNewline.length === 0) ? null : - new RegExp(values.isNewline, 'gu') + new RegExp(values.isNewline, 'gu'); } if (values.verbose) { - process.stdout.write(inspect(opts)) + process.stdout.write(inspect(opts)); } - const w = new LineWrap(opts) + const w = new LineWrap(opts); for (const t of values.text) { - outstream.write(w.wrap(t)) - outstream.write(values.newline) + outstream.write(w.wrap(t)); + outstream.write(values.newline); } for (const f of positionals) { const t = f === '-' ? await readStdin(values, process.stdin) : - await fs.promises.readFile(f, values.encoding) + await fs.promises.readFile(f, values.encoding); - outstream.write(w.wrap(t)) - outstream.write(values.newline) + outstream.write(w.wrap(t)); + outstream.write(values.newline); } // Be careful to wait for the file to close, to ensure tests run // correctly. - await promisify(outstream.end.bind(outstream))() + await promisify(outstream.end.bind(outstream))(); } if (fileURLToPath(import.meta.url) === process.argv[1]) { main().catch(e => { - console.error(e) - process.exit(1) - }) + console.error(e); + process.exit(1); + }); } diff --git a/package-lock.json b/package-lock.json index b62f272..de322b3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,23 +9,32 @@ "version": "1.0.1", "license": "MIT", "dependencies": { - "@cto.af/linewrap": "1.0.4", - "minus-h": "1.1.1" + "@cto.af/linewrap": "1.1.0", + "minus-h": "1.2.0" }, "bin": { "linewrap": "bin/linewrap.js" }, "devDependencies": { - "@cto.af/eslint-config": "1.1.2", - "@types/node": "20.3.1", - "c8": "8.0.0", - "eslint": "8.43.0", + "@cto.af/eslint-config": "3.0.2", + "@types/node": "20.8.10", + "c8": "8.0.1", + "eslint": "8.52.0", "mocha": "10.2.0" }, "engines": { "node": ">= 16" } }, + "node_modules/@aashutoshrathi/word-wrap": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", + "integrity": "sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/@bcoe/v8-coverage": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", @@ -33,19 +42,19 @@ "dev": true }, "node_modules/@cto.af/eslint-config": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@cto.af/eslint-config/-/eslint-config-1.1.2.tgz", - "integrity": "sha512-BafuloAI6AHOywDWMKAdNf634RD91me+O+bs0G9tcA267qPThAOtalL2xVuZoNcy7o67kSQnt64eSVTcTqw2kQ==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@cto.af/eslint-config/-/eslint-config-3.0.2.tgz", + "integrity": "sha512-lNwMLdZWjKXJY2KfzIKuYC5XsLRvJMl+FeOjlira23mRqSqNikirtXYKrUyQuSH+iJHm1n0sl0d17/WsDGwLWg==", "dev": true, "engines": { "node": ">=16" }, "peerDependencies": { - "@typescript-eslint/eslint-plugin": "~5", - "@typescript-eslint/parser": "~5", + "@typescript-eslint/eslint-plugin": "~6", + "@typescript-eslint/parser": "~6", "eslint-plugin-ava": "~14", - "eslint-plugin-jsdoc": "~44", - "eslint-plugin-node": "~11", + "eslint-plugin-jsdoc": "~46", + "eslint-plugin-n": "~16", "typescript": "~5" }, "peerDependenciesMeta": { @@ -67,76 +76,44 @@ } }, "node_modules/@cto.af/linebreak": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@cto.af/linebreak/-/linebreak-1.1.0.tgz", - "integrity": "sha512-BH5BCdOW1WoDkb4mg4wWQcaF7V7C70kCGbOCJq/VqYcbFFiyapgXIpeCUCIJ5uYz+Y3j5G695nv70ffI80McFg==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@cto.af/linebreak/-/linebreak-1.2.1.tgz", + "integrity": "sha512-Nj4DfbtKSZDSeWc7MSXZJHWt6gvUJH1bpqK671uvlM+sopwe2JV5TXRlBwo2GDFJmYLcpaitxWdISQ0t/OB4QA==", "dependencies": { - "@cto.af/unicode-trie": "1.1.0" + "@cto.af/unicode-trie": "1.2.2" }, "engines": { "node": ">=16" } }, "node_modules/@cto.af/linewrap": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@cto.af/linewrap/-/linewrap-1.0.4.tgz", - "integrity": "sha512-xHxI2/z8K6Oy2IIa/J5LZBU23nf6u3kHZ4XsKN7rc0n8jD/EglwuWX+e0PnljFPgiV/iosghKm353GFkT4efKw==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@cto.af/linewrap/-/linewrap-1.1.0.tgz", + "integrity": "sha512-esw9JeMZLnMQthbGMLCjbe79UeZcBQUaIOm2RKh+HHOngcfxxtPcA9Sn7ZsmmXApwsaV3tj5SZuwslA9PtQt4g==", "dependencies": { - "@cto.af/linebreak": "1.1.1", - "@cto.af/string-width": "2.0.0" + "@cto.af/linebreak": "1.2.1", + "@cto.af/string-width": "2.1.0" }, "engines": { "node": ">= 16" } }, - "node_modules/@cto.af/linewrap/node_modules/@cto.af/linebreak": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@cto.af/linebreak/-/linebreak-1.1.1.tgz", - "integrity": "sha512-U8VyZ3olaKgtoBQrYbRxSNYGytt8tt1TG32laOEZOrWtvRYOV05lE8uahHQiHu7PzQsNKwQAny0M3i0XmmJAxw==", - "dependencies": { - "@cto.af/unicode-trie": "1.2.0" - }, - "engines": { - "node": ">=16" - } - }, - "node_modules/@cto.af/linewrap/node_modules/@cto.af/unicode-trie": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@cto.af/unicode-trie/-/unicode-trie-1.2.0.tgz", - "integrity": "sha512-iJIKJ8eTkiexKllSUBSIgaKvi+Q2JsvDkNpOOra9lSl0m/06X9x/mMLmZ0PfNYxWrbrpSxlkO2GxdOAfLl70sA==", - "engines": { - "node": ">=16" - } - }, "node_modules/@cto.af/string-width": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@cto.af/string-width/-/string-width-2.0.0.tgz", - "integrity": "sha512-CbxKyoDo0AiEK5Kx9usqCERMvSUtZihTpT0/eCb3Gi8xCKo8vyIhaL+KdC5fYOtsCzjeyw5mpvPK2JrGVyeykw==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@cto.af/string-width/-/string-width-2.1.0.tgz", + "integrity": "sha512-PJVi6ImWD8u+aAOEX5Zrh558EphTEJih4FWgH1vkDHGH0z1YJ8M1dBV8/NRwX7+dSDJdGYuf09G4+E48+zdZ4A==", "dependencies": { - "@cto.af/unicode-trie": "1.2.0", - "emoji-regex": "10.2.1" + "@cto.af/unicode-trie": "1.2.2", + "emoji-regex": "10.3.0" }, "engines": { "node": ">= 16" } }, - "node_modules/@cto.af/string-width/node_modules/@cto.af/unicode-trie": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@cto.af/unicode-trie/-/unicode-trie-1.2.0.tgz", - "integrity": "sha512-iJIKJ8eTkiexKllSUBSIgaKvi+Q2JsvDkNpOOra9lSl0m/06X9x/mMLmZ0PfNYxWrbrpSxlkO2GxdOAfLl70sA==", - "engines": { - "node": ">=16" - } - }, - "node_modules/@cto.af/string-width/node_modules/emoji-regex": { - "version": "10.2.1", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.2.1.tgz", - "integrity": "sha512-97g6QgOk8zlDRdgq1WxwgTMgEWGVAQvB5Fdpgc1MkNy56la5SKP9GsMXKDOdqwn90/41a8yPwIGk1Y6WVbeMQA==" - }, "node_modules/@cto.af/unicode-trie": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@cto.af/unicode-trie/-/unicode-trie-1.1.0.tgz", - "integrity": "sha512-Ik3vhCWLIyhItlS3cn9WwL5ewCqeFOhrw5rOiRmJgWnl3l+bnzznRJlRrPuhLHDdUTzr8LKR3yban1iQ8kX+Aw==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@cto.af/unicode-trie/-/unicode-trie-1.2.2.tgz", + "integrity": "sha512-crofDXdfx/yjrCK/es6PVjZIi76m9EaJY2WqMPJxjAOGYY63QAH0fqtapLtX+6p6A41mm1LKfgMS4LnItnGdVg==", "engines": { "node": ">=16" } @@ -157,23 +134,23 @@ } }, "node_modules/@eslint-community/regexpp": { - "version": "4.5.1", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.5.1.tgz", - "integrity": "sha512-Z5ba73P98O1KUYCCJTUeVpja9RcGoMdncZ6T49FCUl2lN38JtCJ+3WgIDBv0AuY4WChU5PmtJmOCTlN6FZTFKQ==", + "version": "4.10.0", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.10.0.tgz", + "integrity": "sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==", "dev": true, "engines": { "node": "^12.0.0 || ^14.0.0 || >=16.0.0" } }, "node_modules/@eslint/eslintrc": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.0.3.tgz", - "integrity": "sha512-+5gy6OQfk+xx3q0d6jGZZC3f3KzAkXc/IanVxd1is/VIIziRqqt3ongQz0FiTUXqTk0c7aDB3OaFuKnuSoJicQ==", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.2.tgz", + "integrity": "sha512-+wvgpDsrB1YqAMdEUCcnTlpfVBH7Vqn6A/NT3D8WVXFIaKMlErPIZT3oCIAVCOtarRpMtelZLqJeU3t7WY6X6g==", "dev": true, "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", - "espree": "^9.5.2", + "espree": "^9.6.0", "globals": "^13.19.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", @@ -189,21 +166,21 @@ } }, "node_modules/@eslint/js": { - "version": "8.43.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.43.0.tgz", - "integrity": "sha512-s2UHCoiXfxMvmfzqoN+vrQ84ahUSYde9qNO1MdxmoEhyHWsfmwOpFlwYV+ePJEVc7gFnATGUi376WowX1N7tFg==", + "version": "8.52.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.52.0.tgz", + "integrity": "sha512-mjZVbpaeMZludF2fsWLD0Z9gCref1Tk4i9+wddjRvpUNqqcndPkBD09N/Mapey0b3jaXbLm2kICwFv2E64QinA==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, "node_modules/@humanwhocodes/config-array": { - "version": "0.11.10", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.10.tgz", - "integrity": "sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ==", + "version": "0.11.13", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.13.tgz", + "integrity": "sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ==", "dev": true, "dependencies": { - "@humanwhocodes/object-schema": "^1.2.1", + "@humanwhocodes/object-schema": "^2.0.1", "debug": "^4.1.1", "minimatch": "^3.0.5" }, @@ -225,9 +202,9 @@ } }, "node_modules/@humanwhocodes/object-schema": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", - "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz", + "integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==", "dev": true }, "node_modules/@istanbuljs/schema": { @@ -240,28 +217,28 @@ } }, "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", - "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", + "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", "dev": true, "engines": { "node": ">=6.0.0" } }, "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.4.14", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", - "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", "dev": true }, "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.18", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz", - "integrity": "sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA==", + "version": "0.3.20", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz", + "integrity": "sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==", "dev": true, "dependencies": { - "@jridgewell/resolve-uri": "3.1.0", - "@jridgewell/sourcemap-codec": "1.4.14" + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" } }, "node_modules/@nodelib/fs.scandir": { @@ -300,21 +277,30 @@ } }, "node_modules/@types/istanbul-lib-coverage": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", - "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.5.tgz", + "integrity": "sha512-zONci81DZYCZjiLe0r6equvZut0b+dBRPBN5kBDjsONnutYNtJMoWQ9uR2RkL1gLG9NMTzvf+29e5RFfPbeKhQ==", "dev": true }, "node_modules/@types/node": { - "version": "20.3.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.3.1.tgz", - "integrity": "sha512-EhcH/wvidPy1WeML3TtYFGR83UzjxeWRen9V402T8aUGYsCHOmfoisV3ZSg03gAFIbLq8TnWOJ0f4cALtnSEUg==", + "version": "20.8.10", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.10.tgz", + "integrity": "sha512-TlgT8JntpcbmKUFzjhsyhGfP2fsiz1Mv56im6enJ905xG1DAYesxJaeSbGqQmAw8OWPdhyJGhGSQGKRNJ45u9w==", + "dev": true, + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/@ungap/structured-clone": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", + "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", "dev": true }, "node_modules/acorn": { - "version": "8.8.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", - "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", + "version": "8.11.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz", + "integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -443,10 +429,20 @@ "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", "dev": true }, + "node_modules/builtins": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/builtins/-/builtins-5.0.1.tgz", + "integrity": "sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==", + "dev": true, + "peer": true, + "dependencies": { + "semver": "^7.0.0" + } + }, "node_modules/c8": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/c8/-/c8-8.0.0.tgz", - "integrity": "sha512-XHA5vSfCLglAc0Xt8eLBZMv19lgiBSjnb1FLAQgnwkuhJYEonpilhEB4Ea3jPAbm0FhD6VVJrc0z73jPe7JyGQ==", + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/c8/-/c8-8.0.1.tgz", + "integrity": "sha512-EINpopxZNH1mETuI0DzRA4MZpAUH+IFiRhnmFD3vFr3vdrgxqi3VfE3KL0AIL+zDq8rC9bZqwM/VDmmoe04y7w==", "dev": true, "dependencies": { "@bcoe/v8-coverage": "^0.2.3", @@ -454,13 +450,13 @@ "find-up": "^5.0.0", "foreground-child": "^2.0.0", "istanbul-lib-coverage": "^3.2.0", - "istanbul-lib-report": "^3.0.0", - "istanbul-reports": "^3.1.4", + "istanbul-lib-report": "^3.0.1", + "istanbul-reports": "^3.1.6", "rimraf": "^3.0.2", "test-exclude": "^6.0.0", "v8-to-istanbul": "^9.0.0", - "yargs": "^16.2.0", - "yargs-parser": "^20.2.9" + "yargs": "^17.7.2", + "yargs-parser": "^21.1.1" }, "bin": { "c8": "bin/c8.js" @@ -546,14 +542,17 @@ } }, "node_modules/cliui": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", - "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", "dev": true, "dependencies": { "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", + "strip-ansi": "^6.0.1", "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" } }, "node_modules/color-convert": { @@ -581,9 +580,9 @@ "dev": true }, "node_modules/convert-source-map": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", - "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", "dev": true }, "node_modules/cross-spawn": { @@ -657,10 +656,9 @@ } }, "node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.3.0.tgz", + "integrity": "sha512-QpLs9D9v9kArv4lfDEgg1X/gN5XLnf/A6l9cs8SPZLRZR3ZkY9+kwIQTxm+fsSej5UMYGE8fdoaZVIBlqG0XTw==" }, "node_modules/escalade": { "version": "3.1.1", @@ -684,27 +682,28 @@ } }, "node_modules/eslint": { - "version": "8.43.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.43.0.tgz", - "integrity": "sha512-aaCpf2JqqKesMFGgmRPessmVKjcGXqdlAYLLC3THM8t5nBRZRQ+st5WM/hoJXkdioEXLLbXgclUpM0TXo5HX5Q==", + "version": "8.52.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.52.0.tgz", + "integrity": "sha512-zh/JHnaixqHZsolRB/w9/02akBk9EPrOs9JwcTP2ek7yL5bVvXuRariiaAjjoJ5DvuwQ1WAE/HsMz+w17YgBCg==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", - "@eslint-community/regexpp": "^4.4.0", - "@eslint/eslintrc": "^2.0.3", - "@eslint/js": "8.43.0", - "@humanwhocodes/config-array": "^0.11.10", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^2.1.2", + "@eslint/js": "8.52.0", + "@humanwhocodes/config-array": "^0.11.13", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", - "ajv": "^6.10.0", + "@ungap/structured-clone": "^1.2.0", + "ajv": "^6.12.4", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", "debug": "^4.3.2", "doctrine": "^3.0.0", "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.2.0", - "eslint-visitor-keys": "^3.4.1", - "espree": "^9.5.2", + "eslint-scope": "^7.2.2", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", "esquery": "^1.4.2", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", @@ -714,7 +713,6 @@ "globals": "^13.19.0", "graphemer": "^1.4.0", "ignore": "^5.2.0", - "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "is-path-inside": "^3.0.3", @@ -724,9 +722,8 @@ "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", - "optionator": "^0.9.1", + "optionator": "^0.9.3", "strip-ansi": "^6.0.1", - "strip-json-comments": "^3.1.0", "text-table": "^0.2.0" }, "bin": { @@ -739,51 +736,57 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/eslint-plugin-es": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-3.0.1.tgz", - "integrity": "sha512-GUmAsJaN4Fc7Gbtl8uOBlayo2DqhwWvEzykMHSCZHU3XdJ+NSzzZcVhXh3VxX5icqQ+oQdIEawXX8xkR3mIFmQ==", + "node_modules/eslint-plugin-es-x": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-es-x/-/eslint-plugin-es-x-7.2.0.tgz", + "integrity": "sha512-9dvv5CcvNjSJPqnS5uZkqb3xmbeqRLnvXKK7iI5+oK/yTusyc46zbBZKENGsOfojm/mKfszyZb+wNqNPAPeGXA==", "dev": true, "peer": true, "dependencies": { - "eslint-utils": "^2.0.0", - "regexpp": "^3.0.0" + "@eslint-community/eslint-utils": "^4.1.2", + "@eslint-community/regexpp": "^4.6.0" }, "engines": { - "node": ">=8.10.0" + "node": "^14.18.0 || >=16.0.0" }, "funding": { - "url": "https://github.com/sponsors/mysticatea" + "url": "https://github.com/sponsors/ota-meshi" }, "peerDependencies": { - "eslint": ">=4.19.1" + "eslint": ">=8" } }, - "node_modules/eslint-plugin-node": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz", - "integrity": "sha512-oUwtPJ1W0SKD0Tr+wqu92c5xuCeQqB3hSCHasn/ZgjFdA9iDGNkNf2Zi9ztY7X+hNuMib23LNGRm6+uN+KLE3g==", + "node_modules/eslint-plugin-n": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-16.2.0.tgz", + "integrity": "sha512-AQER2jEyQOt1LG6JkGJCCIFotzmlcCZFur2wdKrp1JX2cNotC7Ae0BcD/4lLv3lUAArM9uNS8z/fsvXTd0L71g==", "dev": true, "peer": true, "dependencies": { - "eslint-plugin-es": "^3.0.0", - "eslint-utils": "^2.0.0", - "ignore": "^5.1.1", - "minimatch": "^3.0.4", - "resolve": "^1.10.1", - "semver": "^6.1.0" + "@eslint-community/eslint-utils": "^4.4.0", + "builtins": "^5.0.1", + "eslint-plugin-es-x": "^7.1.0", + "get-tsconfig": "^4.7.0", + "ignore": "^5.2.4", + "is-core-module": "^2.12.1", + "minimatch": "^3.1.2", + "resolve": "^1.22.2", + "semver": "^7.5.3" }, "engines": { - "node": ">=8.10.0" + "node": ">=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" }, "peerDependencies": { - "eslint": ">=5.16.0" + "eslint": ">=7.0.0" } }, "node_modules/eslint-scope": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.0.tgz", - "integrity": "sha512-DYj5deGlHBfMt15J7rdtyKNq/Nqlv5KfU4iodrQ019XESsRnwXH9KAE0y3cwtUHDo2ob7CypAnCqefh6vioWRw==", + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", + "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", "dev": true, "dependencies": { "esrecurse": "^4.3.0", @@ -796,36 +799,10 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/eslint-utils": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", - "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", - "dev": true, - "peer": true, - "dependencies": { - "eslint-visitor-keys": "^1.1.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/mysticatea" - } - }, - "node_modules/eslint-utils/node_modules/eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", - "dev": true, - "peer": true, - "engines": { - "node": ">=4" - } - }, "node_modules/eslint-visitor-keys": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz", - "integrity": "sha512-pZnmmLwYzf+kWaM/Qgrvpen51upAktaaiI01nsJD/Yr3lMOdNtq0cxkrrg16w64VtisN6okbs7Q8AfGqj4c9fA==", + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -835,12 +812,12 @@ } }, "node_modules/espree": { - "version": "9.5.2", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.5.2.tgz", - "integrity": "sha512-7OASN1Wma5fum5SrNhFMAMJxOUAbhyfQ8dQ//PJaJbNw0URTPWqIghHWt1MmAANKhHZIYOHruW4Kw4ruUWOdGw==", + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", + "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", "dev": true, "dependencies": { - "acorn": "^8.8.0", + "acorn": "^8.9.0", "acorn-jsx": "^5.3.2", "eslint-visitor-keys": "^3.4.1" }, @@ -970,22 +947,23 @@ } }, "node_modules/flat-cache": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", - "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.1.1.tgz", + "integrity": "sha512-/qM2b3LUIaIgviBQovTLvijfyOQXPtSRnRK26ksj2J7rzPIecePUIpJsZ4T02Qg+xiAEKIs5K8dsHEd+VaKa/Q==", "dev": true, "dependencies": { - "flatted": "^3.1.0", + "flatted": "^3.2.9", + "keyv": "^4.5.3", "rimraf": "^3.0.2" }, "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": ">=12.0.0" } }, "node_modules/flatted": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", - "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", + "version": "3.2.9", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.9.tgz", + "integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==", "dev": true }, "node_modules/foreground-child": { @@ -1008,9 +986,9 @@ "dev": true }, "node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", "dev": true, "hasInstallScript": true, "optional": true, @@ -1022,11 +1000,14 @@ } }, "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", "dev": true, - "peer": true + "peer": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/get-caller-file": { "version": "2.0.5", @@ -1037,6 +1018,19 @@ "node": "6.* || 8.* || >= 10.*" } }, + "node_modules/get-tsconfig": { + "version": "4.7.2", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.7.2.tgz", + "integrity": "sha512-wuMsz4leaj5hbGgg4IvDU0bqJagpftG5l5cXIAvo8uZrqn0NJqwtfupTN00VnkQJPcIRrxYrm1Ue24btpCha2A==", + "dev": true, + "peer": true, + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, "node_modules/glob": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", @@ -1070,9 +1064,9 @@ } }, "node_modules/globals": { - "version": "13.20.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", - "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", + "version": "13.23.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.23.0.tgz", + "integrity": "sha512-XAmF0RjlrjY23MA51q3HltdlGxUpXPvg0GioKiD9X6HD28iMjo2dKC8Vqwm7lne4GNr78+RHTfliktR6ZH09wA==", "dev": true, "dependencies": { "type-fest": "^0.20.2" @@ -1090,19 +1084,6 @@ "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", "dev": true }, - "node_modules/has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, - "peer": true, - "dependencies": { - "function-bind": "^1.1.1" - }, - "engines": { - "node": ">= 0.4.0" - } - }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -1112,6 +1093,19 @@ "node": ">=8" } }, + "node_modules/hasown": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", + "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==", + "dev": true, + "peer": true, + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/he": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", @@ -1190,13 +1184,13 @@ } }, "node_modules/is-core-module": { - "version": "2.12.1", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.1.tgz", - "integrity": "sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg==", + "version": "2.13.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", + "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", "dev": true, "peer": true, "dependencies": { - "has": "^1.0.3" + "hasown": "^2.0.0" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -1287,23 +1281,23 @@ } }, "node_modules/istanbul-lib-report": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", - "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", + "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", "dev": true, "dependencies": { "istanbul-lib-coverage": "^3.0.0", - "make-dir": "^3.0.0", + "make-dir": "^4.0.0", "supports-color": "^7.1.0" }, "engines": { - "node": ">=8" + "node": ">=10" } }, "node_modules/istanbul-reports": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.5.tgz", - "integrity": "sha512-nUsEMa9pBt/NOHqbcbeJEgqIlY/K7rVWUX6Lql2orY5e9roQOthbR3vtY4zzf2orPELg80fnxxk9zUyPlgwD1w==", + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.6.tgz", + "integrity": "sha512-TLgnMkKg3iTDsQ9PbPTdpfAK2DzjF9mqUG7RMgcQl8oFjad8ob4laGxv5XV5U9MAfx8D6tSJiUyuAwzLicaxlg==", "dev": true, "dependencies": { "html-escaper": "^2.0.0", @@ -1325,6 +1319,12 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true + }, "node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -1337,6 +1337,15 @@ "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", "dev": true }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "dependencies": { + "json-buffer": "3.0.1" + } + }, "node_modules/levn": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", @@ -1387,16 +1396,28 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/make-dir": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", - "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", + "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", "dev": true, "dependencies": { - "semver": "^6.0.0" + "semver": "^7.5.3" }, "engines": { - "node": ">=8" + "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -1415,27 +1436,16 @@ } }, "node_modules/minus-h": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/minus-h/-/minus-h-1.1.1.tgz", - "integrity": "sha512-EdNqQuTHussyWAg8S+wfrMfbnfAHkVZysm2taU4uUdk6gQwtWV40+YvwLrdE/dSGNKA1xMOMTHYkMwbBHT3U6A==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minus-h/-/minus-h-1.2.0.tgz", + "integrity": "sha512-6YUMrOoNkSoXmLZelWPKx5tSbSmlEDn9xuFp3d7tehUK1EZykG2d9kHi9f7Jmv6LD6hhNA3TFzftRRfotbB6HA==", "dependencies": { - "@cto.af/linewrap": "1.0.2" + "@cto.af/linewrap": "1.1.0" }, "engines": { "node": ">=16" } }, - "node_modules/minus-h/node_modules/@cto.af/linewrap": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@cto.af/linewrap/-/linewrap-1.0.2.tgz", - "integrity": "sha512-9qgYYaenVHO2ESBEPbAr1D4q/qxrvR4MbnuauSYe+RebJpTuZcJPpwF16Anz+Tsd+wJuYWN8k3kaUho/UTbMlQ==", - "dependencies": { - "@cto.af/linebreak": "1.1.0" - }, - "engines": { - "node": ">= 16" - } - }, "node_modules/mocha": { "version": "10.2.0", "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.2.0.tgz", @@ -1485,6 +1495,17 @@ "balanced-match": "^1.0.0" } }, + "node_modules/mocha/node_modules/cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, "node_modules/mocha/node_modules/minimatch": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", @@ -1518,6 +1539,24 @@ "url": "https://github.com/chalk/supports-color?sponsor=1" } }, + "node_modules/mocha/node_modules/yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dev": true, + "dependencies": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/mocha/node_modules/yargs-parser": { "version": "20.2.4", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", @@ -1570,17 +1609,17 @@ } }, "node_modules/optionator": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", - "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", + "integrity": "sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==", "dev": true, "dependencies": { + "@aashutoshrathi/word-wrap": "^1.2.3", "deep-is": "^0.1.3", "fast-levenshtein": "^2.0.6", "levn": "^0.4.1", "prelude-ls": "^1.2.1", - "type-check": "^0.4.0", - "word-wrap": "^1.2.3" + "type-check": "^0.4.0" }, "engines": { "node": ">= 0.8.0" @@ -1684,9 +1723,9 @@ } }, "node_modules/punycode": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", - "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", "dev": true, "engines": { "node": ">=6" @@ -1733,19 +1772,6 @@ "node": ">=8.10.0" } }, - "node_modules/regexpp": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", - "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", - "dev": true, - "peer": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/mysticatea" - } - }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -1756,13 +1782,13 @@ } }, "node_modules/resolve": { - "version": "1.22.2", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", - "integrity": "sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==", + "version": "1.22.8", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", + "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", "dev": true, "peer": true, "dependencies": { - "is-core-module": "^2.11.0", + "is-core-module": "^2.13.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, @@ -1782,6 +1808,16 @@ "node": ">=4" } }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, + "peer": true, + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, "node_modules/reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", @@ -1851,12 +1887,18 @@ ] }, "node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, "bin": { "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" } }, "node_modules/serialize-javascript": { @@ -1909,6 +1951,12 @@ "node": ">=8" } }, + "node_modules/string-width/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, "node_modules/strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", @@ -2014,6 +2062,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true + }, "node_modules/uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", @@ -2024,14 +2078,14 @@ } }, "node_modules/v8-to-istanbul": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.1.0.tgz", - "integrity": "sha512-6z3GW9x8G1gd+JIIgQQQxXuiJtCXeAjp6RaPEPLv62mH3iPHPxV6W3robxtCzNErRo6ZwTmzWhsbNvjyEBKzKA==", + "version": "9.1.3", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.1.3.tgz", + "integrity": "sha512-9lDD+EVI2fjFsMWXc6dy5JJzBsVTcQ2fVkfBvncZ6xJWG9wtBhOldG+mHkSL0+V1K/xgZz0JDO5UT5hFwHUghg==", "dev": true, "dependencies": { "@jridgewell/trace-mapping": "^0.3.12", "@types/istanbul-lib-coverage": "^2.0.1", - "convert-source-map": "^1.6.0" + "convert-source-map": "^2.0.0" }, "engines": { "node": ">=10.12.0" @@ -2052,15 +2106,6 @@ "node": ">= 8" } }, - "node_modules/word-wrap": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/workerpool": { "version": "6.2.1", "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz", @@ -2099,31 +2144,37 @@ "node": ">=10" } }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, "node_modules/yargs": { - "version": "16.2.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", - "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", "dev": true, "dependencies": { - "cliui": "^7.0.2", + "cliui": "^8.0.1", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "require-directory": "^2.1.1", - "string-width": "^4.2.0", + "string-width": "^4.2.3", "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" + "yargs-parser": "^21.1.1" }, "engines": { - "node": ">=10" + "node": ">=12" } }, "node_modules/yargs-parser": { - "version": "20.2.9", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", - "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", "dev": true, "engines": { - "node": ">=10" + "node": ">=12" } }, "node_modules/yargs-unparser": { diff --git a/package.json b/package.json index e04957a..d91d5f5 100644 --- a/package.json +++ b/package.json @@ -26,14 +26,14 @@ "license": "MIT", "repository": "cto-af/linewrap-cli", "dependencies": { - "@cto.af/linewrap": "1.0.4", - "minus-h": "1.1.1" + "@cto.af/linewrap": "1.1.0", + "minus-h": "1.2.0" }, "devDependencies": { - "@cto.af/eslint-config": "1.1.2", - "@types/node": "20.3.1", - "c8": "8.0.0", - "eslint": "8.43.0", + "@cto.af/eslint-config": "3.0.2", + "@types/node": "20.8.10", + "c8": "8.0.1", + "eslint": "8.52.0", "mocha": "10.2.0" }, "engines": { diff --git a/test/bin.test.js b/test/bin.test.js index 2100ca3..7ec4a1c 100644 --- a/test/bin.test.js +++ b/test/bin.test.js @@ -1,13 +1,13 @@ -import {exec, spawn} from './harness.js' -import {Buffer} from 'buffer' -import {EOL} from 'os' -import assert from 'assert/strict' -import {fileURLToPath} from 'url' -import fs from 'fs/promises' -import {main} from '../bin/linewrap.js' -import path from 'path' - -let tmpDir = null +import {exec, spawn} from './harness.js'; +import {Buffer} from 'buffer'; +import {EOL} from 'os'; +import assert from 'assert/strict'; +import {fileURLToPath} from 'url'; +import fs from 'fs/promises'; +import {main} from '../bin/linewrap.js'; +import path from 'path'; + +let tmpDir = null; const HELP = [ 'Usage: linewrap [options] [...file]', '', @@ -70,134 +70,134 @@ const HELP = [ ' for anything but debugging underlying libraries', ' -w,--width maximum line length Default: "80"', '', -].join(EOL) +].join(EOL); -let argv1 = null +let argv1 = null; before('create tempdir', async() => { - const prefix = new URL('ctoaf-linewrap-', import.meta.url) - tmpDir = await fs.mkdtemp(fileURLToPath(prefix)) + const prefix = new URL('ctoaf-linewrap-', import.meta.url); + tmpDir = await fs.mkdtemp(fileURLToPath(prefix)); // eslint-disable-next-line prefer-destructuring - argv1 = process.argv[1] - process.argv[1] = 'linewrap.js' -}) + argv1 = process.argv[1]; + process.argv[1] = 'linewrap.js'; +}); describe('cli', () => { it('generates help', async() => { - const res = await exec({main, code: 64}, '-h') - assert.equal(res.stderr, HELP) - }) + const res = await exec({main, code: 64}, '-h'); + assert.equal(res.stderr, HELP); + }); it('reads stdin', async() => { - const res = await exec({main, stdin: 'foo bar'}, '-w', '4') + const res = await exec({main, stdin: 'foo bar'}, '-w', '4'); assert.equal(res.stdout, [ 'foo', 'bar', '', - ].join(EOL)) - }) + ].join(EOL)); + }); it('html escapes', async() => { - const res = await exec({main, stdin: 'foo bar'}, '-w', '11', '--html') + const res = await exec({main, stdin: 'foo bar'}, '-w', '11', '--html'); assert.equal(res.stdout, [ 'foo', '<b>bar</b>', // Longer than 11! '', - ].join(EOL)) - }) + ].join(EOL)); + }); it('deals with bad overflow types', async() => { - await exec({main, code: 64}, '--overflow', 'foo') - }) + await exec({main, code: 64}, '--overflow', 'foo'); + }); it('reads and writes files', async() => { - const outFile = path.join(tmpDir, 'rwFiles') - await exec({main, stdin: 'foo bar'}, '-w', '4', '-o', outFile) - const contents = await fs.readFile(outFile, 'utf8') + const outFile = path.join(tmpDir, 'rwFiles'); + await exec({main, stdin: 'foo bar'}, '-w', '4', '-o', outFile); + const contents = await fs.readFile(outFile, 'utf8'); assert.equal(contents, [ 'foo', 'bar', '', - ].join(EOL)) + ].join(EOL)); - const readRes = await exec({main}, '-w', '2', '--overflow', 'clip', outFile) + const readRes = await exec({main}, '-w', '2', '--overflow', 'clip', outFile); assert.equal(readRes.stdout, [ 'f\u{2026}', 'b\u{2026}', '', - ].join(EOL)) - }) + ].join(EOL)); + }); it('handles inputs on the cli', async() => { - const res = await exec({main}, '-w', '4', '-t', 'foo bar') + const res = await exec({main}, '-w', '4', '-t', 'foo bar'); assert.equal(res.stdout, [ 'foo', 'bar', '', - ].join(EOL)) - }) + ].join(EOL)); + }); it('has all of the options hooked up', async() => { - const outFile = path.join(tmpDir, 'options') + const outFile = path.join(tmpDir, 'options'); // --encoding - await exec({main, stdin: Buffer.from('foo bar', 'utf16le')}, '-w', '4', '-e', 'utf16le', '-o', outFile) - const contents = await fs.readFile(outFile, 'utf16le') + await exec({main, stdin: Buffer.from('foo bar', 'utf16le')}, '-w', '4', '-e', 'utf16le', '-o', outFile); + const contents = await fs.readFile(outFile, 'utf16le'); assert.equal(contents, [ 'foo', 'bar', '', - ].join(EOL)) + ].join(EOL)); // --ellipsis let res = await exec( {main, stdin: 'foo'}, '--ellipsis', '=', '--overflow', 'clip', '--width', '2' - ) - assert.equal(res.stdout, 'f=\n') + ); + assert.equal(res.stdout, 'f=\n'); // --example7 // × C694 × 002E × 0020 ÷ 0041 × 002E ÷ 0034 × 0020 ÷ BABB ÷ res = await exec( {main, stdin: '\uC694\u002e\u0020\u0041\u002e\u0034\u0020\uBABB'}, '-w', '1', '-7' - ) + ); // Fails without -7. - assert.equal(res.stdout, '\uC694\u002e\n\u0041\u002e\n\u0034\n\uBABB\n') + assert.equal(res.stdout, '\uC694\u002e\n\u0041\u002e\n\u0034\n\uBABB\n'); // --firstCol // --indent // --outdentFirst res = await exec( {main, stdin: 'foo bar baz'}, '-w', '7', '-i', '2', '--outdentFirst', '-c', '0' - ) - assert.equal(res.stdout, 'foo bar\n baz\n') + ); + assert.equal(res.stdout, 'foo bar\n baz\n'); // --hyphen res = await exec( {main, stdin: 'foo'}, '--hyphen', '=', '--overflow', 'anywhere', '--width', '2' - ) - assert.equal(res.stdout, 'f=\no=\no\n') + ); + assert.equal(res.stdout, 'f=\no=\no\n'); // --indentChar res = await exec( {main, stdin: 'foo bar baz'}, '-w', '8', '-i', '2', '--indentChar', '12' - ) - assert.equal(res.stdout, '1212foo\n1212bar\n1212baz\n') + ); + assert.equal(res.stdout, '1212foo\n1212bar\n1212baz\n'); // --indentEmpty res = await exec( {main, stdin: ''}, '-i', '2', '--indentEmpty' - ) - assert.equal(res.stdout, ' \n') + ); + assert.equal(res.stdout, ' \n'); // --isNewline // --newlineReplacement res = await exec( {main, stdin: 'foobar'}, '--isNewline', 'o+', '--newlineReplacement', ' 99 ', '-w', '1' - ) - assert.equal(res.stdout, 'f\n99\nbar\n') + ); + assert.equal(res.stdout, 'f\n99\nbar\n'); res = await exec( {main, stdin: 'foo\nbar'}, '--isNewline', '' - ) - assert.equal(res.stdout, 'foo\nbar\n') + ); + assert.equal(res.stdout, 'foo\nbar\n'); // --locale // After reading UAX #29 again, I still don't think this changes @@ -206,30 +206,30 @@ describe('cli', () => { // --newline res = await exec( {main, stdin: 'foo bar'}, '--newline', '=', '-w', '1' - ) - assert.equal(res.stdout, 'foo=bar=') + ); + assert.equal(res.stdout, 'foo=bar='); // --verbose - res = await exec({main}, '-t', '', '-v') - assert.notEqual('res.stdout', 'foo\n') - }) + res = await exec({main}, '-t', '', '-v'); + assert.notEqual('res.stdout', 'foo\n'); + }); it('spawns', async() => { - const mainJs = fileURLToPath(new URL('../bin/linewrap.js', import.meta.url)) - const res = await spawn({main: mainJs, code: 64}, '-h') - assert.equal(res.stderr, HELP) + const mainJs = fileURLToPath(new URL('../bin/linewrap.js', import.meta.url)); + const res = await spawn({main: mainJs, code: 64}, '-h'); + assert.equal(res.stderr, HELP); - const invalidInputFile = path.join(tmpDir, 'DOES_NOT_EXIST') - const res2 = await spawn({main: mainJs, code: 1}, invalidInputFile) - assert.match(res2.stderr, /ENOENT/) - }) -}) + const invalidInputFile = path.join(tmpDir, 'DOES_NOT_EXIST'); + const res2 = await spawn({main: mainJs, code: 1}, invalidInputFile); + assert.match(res2.stderr, /ENOENT/); + }); +}); after('remove tempdir', async() => { - process.argv[1] = argv1 + process.argv[1] = argv1; if (tmpDir) { await fs.rm(tmpDir, { recursive: true, - }) + }); } -}) +}); diff --git a/test/harness.js b/test/harness.js index 7e272f3..e52d48d 100644 --- a/test/harness.js +++ b/test/harness.js @@ -1,14 +1,14 @@ -import {Transform} from 'stream' -import assert from 'assert/strict' -import {spawn as spwn} from 'child_process' +import {Transform} from 'stream'; +import assert from 'assert/strict'; +import {spawn as spwn} from 'child_process'; // This is pulled out so that it can eventually be a separate project, once // I figure out a better API for how to call main() class ExitError extends Error { constructor(code) { - super(`Exit: ${code}`) - this.code = code + super(`Exit: ${code}`); + this.code = code; } } @@ -16,7 +16,7 @@ class ExitError extends Error { class Record extends Transform { // eslint-disable-next-line class-methods-use-this _transform(chunk, encoding, callback) { - callback(null, chunk) + callback(null, chunk); } } @@ -28,67 +28,67 @@ export async function exec({main, stdin, code = 0}, ...args) { code: 0, error: null, exit(c) { - throw new ExitError(c) + throw new ExitError(c); }, - } + }; - stdin ??= '' - res.stdin.end(stdin) - res.stdout.setEncoding('utf8') - res.stderr.setEncoding('utf8') + stdin ??= ''; + res.stdin.end(stdin); + res.stdout.setEncoding('utf8'); + res.stderr.setEncoding('utf8'); try { await main({ args, outputStream: res.stderr, exit: res.exit, - }, {width: 80}, res) + }, {width: 80}, res); } catch (e) { if (e.code) { - res.code = e.code + res.code = e.code; } else { - res.error = e + res.error = e; } } - res.stdin = stdin - res.stdout = res.stdout.read() - res.stderr = res.stderr.read() + res.stdin = stdin; + res.stdout = res.stdout.read(); + res.stderr = res.stderr.read(); if (code != null) { - assert.equal(res.code, code) + assert.equal(res.code, code); } - return res + return res; } export function spawn({main, stdin, code = 0}, ...args) { return new Promise((resolve, reject) => { - stdin ??= '' + stdin ??= ''; const res = { stdin, stdout: new Record(), stderr: new Record(), code: 0, error: null, - } + }; const child = spwn(process.argv0, [main, ...args], { stdio: 'pipe', env: { ...process.env, COLUMNS: 80, }, - }) - child.on('error', reject) + }); + child.on('error', reject); child.on('close', cd => { - res.stdout = res.stdout.read() - res.stderr = res.stderr.read() - res.code = cd - assert.equal(cd, code) - resolve(res) - }) - res.stdout.setEncoding('utf8') - child.stdout.pipe(res.stdout) - res.stderr.setEncoding('utf8') - child.stderr.pipe(res.stderr) - child.stdin.end(stdin) - }) + res.stdout = res.stdout.read(); + res.stderr = res.stderr.read(); + res.code = cd; + assert.equal(cd, code); + resolve(res); + }); + res.stdout.setEncoding('utf8'); + child.stdout.pipe(res.stdout); + res.stderr.setEncoding('utf8'); + child.stderr.pipe(res.stderr); + child.stdin.end(stdin); + }); }