Commit 65e361e

Anton Golub <antongolub@antongolub.com>
2025-08-07 17:04:27
chore(deps): chalk 5.5.0, fs-extra 11.3.1, yaml 2.8.1 (#1309)
* chore(deps): chalk 5.5.0, fs-extra 11.3.1, yaml 2.8.1 * test: reuse fake http server
1 parent 6398320
build/3rd-party-licenses
@@ -30,7 +30,7 @@ braces@3.0.3
   micromatch/braces
   MIT
 
-chalk@5.4.1
+chalk@5.5.0
   <unknown>
   chalk/chalk
   MIT
@@ -60,7 +60,7 @@ fill-range@7.1.1
   jonschlinkert/fill-range
   MIT
 
-fs-extra@11.3.0
+fs-extra@11.3.1
   JP Richardson <jprichardson@gmail.com>
   https://github.com/jprichardson/node-fs-extra
   MIT
@@ -140,7 +140,7 @@ which@5.0.0
   git+https://github.com/npm/node-which.git
   ISC
 
-yaml@2.8.0
+yaml@2.8.1
   Eemeli Aro <eemeli@gmail.com>
   github:eemeli/yaml
   ISC
build/index.cjs
@@ -54,16 +54,16 @@ var import_vendor = require("./vendor.cjs");
 // src/versions.ts
 var versions = {
   zx: "8.8.0",
-  chalk: "5.4.1",
+  chalk: "5.5.0",
   depseek: "0.4.1",
   dotenv: "0.2.3",
   fetch: "1.6.7",
-  fs: "11.3.0",
+  fs: "11.3.1",
   glob: "14.1.0",
   minimist: "1.2.8",
   ps: "0.1.4",
   which: "5.0.0",
-  yaml: "2.8.0"
+  yaml: "2.8.1"
 };
 
 // src/goods.ts
build/vendor-core.cjs
@@ -551,6 +551,9 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
   if (env.TERM === "xterm-kitty") {
     return 3;
   }
+  if (env.TERM === "xterm-ghostty") {
+    return 3;
+  }
   if ("TERM_PROGRAM" in env) {
     const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
     switch (env.TERM_PROGRAM) {
build/vendor-extra.cjs
@@ -7127,7 +7127,7 @@ var require_stat = __commonJS({
       return checkParentPathsSync(src, srcStat, destParent, funcName);
     }
     function areIdentical(srcStat, destStat) {
-      return destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev;
+      return destStat.ino !== void 0 && destStat.dev !== void 0 && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev;
     }
     function isSrcSubdir(src, dest) {
       const srcArr = path3.resolve(src).split(path3.sep).filter((i) => i);
@@ -13986,7 +13986,7 @@ try {
 }
 function blockString({ comment, type, value }, ctx, onComment, onChompKeep) {
   const { blockQuote, commentString, lineWidth } = ctx.options;
-  if (!blockQuote || /\n[\t ]+$/.test(value) || /^\s*$/.test(value)) {
+  if (!blockQuote || /\n[\t ]+$/.test(value)) {
     return quotedString(value, ctx);
   }
   const indent = ctx.indent || (ctx.forceBlockIndent || containsDocumentMarker(value) ? "  " : "");
src/versions.ts
@@ -14,14 +14,14 @@
 
 export const versions: Record<string, string> = {
   zx: '8.8.0',
-  chalk: '5.4.1',
+  chalk: '5.5.0',
   depseek: '0.4.1',
   dotenv: '0.2.3',
   fetch: '1.6.7',
-  fs: '11.3.0',
+  fs: '11.3.1',
   glob: '14.1.0',
   minimist: '1.2.8',
   ps: '0.1.4',
   which: '5.0.0',
-  yaml: '2.8.0',
+  yaml: '2.8.1',
 }
test/fixtures/server.mjs
@@ -0,0 +1,34 @@
+// Copyright 2025 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import net from 'node:net'
+
+export const fakeServer = (data = []) => {
+  const server = net.createServer()
+  server.on('connection', (conn) => {
+    conn.on('data', () => {
+      const d = data.shift() || 'pong'
+      const _d = typeof d === 'string' ? d.replace(/\r?\n/gm, '\r\n') : d
+      conn.write(_d)
+    })
+  })
+  server.stop = () => new Promise((resolve) => server.close(() => resolve()))
+  server.start = async (port) => {
+    const p = port || (await (await import('get-port')).getPort())
+    server.url = `http://127.0.0.1:${p}`
+    return new Promise((resolve) => server.listen(p, () => resolve(server)))
+  }
+
+  return server
+}
test/smoke/node.test.cjs
@@ -26,6 +26,6 @@ require('zx/globals')
     const p = await $({ nothrow: true })`echo foo; exit 3`
     assert.match(p.message, /exit code: 3/)
   }
-})()
 
-console.log('smoke cjs: ok')
+  console.log('smoke cjs: ok')
+})()
test/smoke/node.test.mjs
@@ -93,12 +93,24 @@ import 'zx/globals'
 
   // fetch()
   {
-    const url = 'https://httpbin.org/get'
+    const server = (await import('../fixtures/server.mjs')).fakeServer([
+      `HTTP/1.1 200 OK
+Content-Type: application/json
+Content-Length: 13
+Server: netcat!
+
+{"foo":"bar"}
+`,
+    ])
+
+    const { url } = await server.start(8081)
     const res = await fetch(url)
     const json = await res.json()
     assert.equal(res.status, 200)
-    assert.equal(json.url, url)
+    assert.equal(json.foo, 'bar')
+
+    await server.stop()
   }
-})()
 
-console.log('smoke mjs: ok')
+  console.log('smoke mjs: ok')
+})()
test/cli.test.js
@@ -19,23 +19,12 @@ import net from 'node:net'
 import getPort from 'get-port'
 import { $, path, tmpfile, tmpdir, fs } from '../build/index.js'
 import { isMain, normalizeExt } from '../build/cli.js'
+import { fakeServer } from './fixtures/server.mjs'
 
 const __filename = fileURLToPath(import.meta.url)
 const spawn = $.spawn
 const nodeMajor = +process.versions?.node?.split('.')[0]
 const test22 = nodeMajor >= 22 ? test : test.skip
-const getServer = (resp = [], log = console.log) => {
-  const server = net.createServer()
-  server.on('connection', (conn) => {
-    conn.on('data', (d) => {
-      conn.write(resp.shift() || 'pong')
-    })
-  })
-  server.stop = () => new Promise((resolve) => server.close(() => resolve()))
-  server.start = (port) =>
-    new Promise((resolve) => server.listen(port, () => resolve(server)))
-  return server
-}
 
 describe('cli', () => {
   // Helps to detect unresolved ProcessPromise.
@@ -213,7 +202,7 @@ console.log(a);
   test('scripts from https 200', async () => {
     const resp = await fs.readFile(path.resolve('test/fixtures/echo.http'))
     const port = await getPort()
-    const server = await getServer([resp]).start(port)
+    const server = await fakeServer([resp]).start(port)
     const out =
       await $`node build/cli.js --verbose http://127.0.0.1:${port}/script.mjs`
     assert.match(out.stderr, /test/)
@@ -222,7 +211,7 @@ console.log(a);
 
   test('scripts from https 500', async () => {
     const port = await getPort()
-    const server = await getServer(['HTTP/1.1 500\n\n']).listen(port)
+    const server = await fakeServer(['HTTP/1.1 500\n\n']).listen(port)
     const out = await $`node build/cli.js http://127.0.0.1:${port}`.nothrow()
     assert.match(out.stderr, /Error: Can't get/)
     await server.stop()
@@ -231,7 +220,7 @@ console.log(a);
   test('scripts (md) from https', async () => {
     const resp = await fs.readFile(path.resolve('test/fixtures/md.http'))
     const port = await getPort()
-    const server = await getServer([resp]).start(port)
+    const server = await fakeServer([resp]).start(port)
     const out =
       await $`node build/cli.js --verbose http://127.0.0.1:${port}/script.md`
     assert.match(out.stderr, /md/)
.size-limit.json
@@ -15,7 +15,7 @@
       "README.md",
       "LICENSE"
     ],
-    "limit": "124.85 kB",
+    "limit": "124.90 kB",
     "brotli": false,
     "gzip": false
   },
@@ -29,7 +29,7 @@
       "build/globals.js",
       "build/deno.js"
     ],
-    "limit": "814.95 kB",
+    "limit": "815.00 kB",
     "brotli": false,
     "gzip": false
   },
@@ -43,7 +43,7 @@
   {
     "name": "vendor",
     "path": "build/vendor-*.{cjs,d.ts}",
-    "limit": "766.45 kB",
+    "limit": "766.47 kB",
     "brotli": false,
     "gzip": false
   },
@@ -62,7 +62,7 @@
       "README.md",
       "LICENSE"
     ],
-    "limit": "872.25 kB",
+    "limit": "872.30 kB",
     "brotli": false,
     "gzip": false
   }
package-lock.json
@@ -17,12 +17,12 @@
         "@size-limit/file": "11.2.0",
         "@types/fs-extra": "11.0.4",
         "@types/minimist": "1.2.5",
-        "@types/node": "24.1.0",
+        "@types/node": "24.2.0",
         "@types/which": "3.0.4",
         "@webpod/ingrid": "1.1.1",
         "@webpod/ps": "0.1.4",
         "c8": "10.1.3",
-        "chalk": "5.4.1",
+        "chalk": "5.5.0",
         "create-require": "1.1.1",
         "cronometro": "5.3.0",
         "depseek": "0.4.1",
@@ -36,7 +36,7 @@
         "esbuild-plugin-resolve": "2.0.0",
         "esbuild-plugin-transform-hook": "0.2.0",
         "esbuild-plugin-utils": "0.1.0",
-        "fs-extra": "11.3.0",
+        "fs-extra": "11.3.1",
         "get-port": "7.1.0",
         "globby": "14.1.0",
         "jsr": "0.13.5",
@@ -47,12 +47,12 @@
         "prettier": "3.6.2",
         "size-limit": "11.2.0",
         "ts-node": "10.9.2",
-        "tsd": "0.32.0",
+        "tsd": "0.33.0",
         "tsx": "4.20.3",
         "typescript": "5.9.2",
-        "vitepress": "1.6.3",
+        "vitepress": "1.6.4",
         "which": "5.0.0",
-        "yaml": "2.8.0",
+        "yaml": "2.8.1",
         "zurk": "0.11.4"
       },
       "engines": {
@@ -2001,9 +2001,9 @@
       "license": "MIT"
     },
     "node_modules/@tsd/typescript": {
-      "version": "5.8.3",
-      "resolved": "https://registry.npmjs.org/@tsd/typescript/-/typescript-5.8.3.tgz",
-      "integrity": "sha512-oKarNCN1QUhG148M88mtZdOlBZWWGcInquef+U8QL7gwJkRuNo5WS45Fjsd+3hM9cDJWGpqSZ4Oo097KDx4IWA==",
+      "version": "5.9.2",
+      "resolved": "https://registry.npmjs.org/@tsd/typescript/-/typescript-5.9.2.tgz",
+      "integrity": "sha512-mSMM0QtEPdMd+rdMDd17yCUYD4yI3pKHap89+jEZrZ3KIO5PhDofBjER0OtgHdvOXF74KMLO3fyD6k3Hz0v03A==",
       "dev": true,
       "license": "MIT",
       "engines": {
@@ -2126,13 +2126,13 @@
       "license": "MIT"
     },
     "node_modules/@types/node": {
-      "version": "24.1.0",
-      "resolved": "https://registry.npmjs.org/@types/node/-/node-24.1.0.tgz",
-      "integrity": "sha512-ut5FthK5moxFKH2T1CUOC6ctR67rQRvvHdFLCD2Ql6KXmMuCrjsSsRI9UsLCm9M18BMwClv4pn327UvB7eeO1w==",
+      "version": "24.2.0",
+      "resolved": "https://registry.npmjs.org/@types/node/-/node-24.2.0.tgz",
+      "integrity": "sha512-3xyG3pMCq3oYCNg7/ZP+E1ooTaGB4cG8JWRsqqOYQdbWNY4zbaV0Ennrd7stjiJEFZCaybcIgpTjJWHRfBSIDw==",
       "dev": true,
       "license": "MIT",
       "dependencies": {
-        "undici-types": "~7.8.0"
+        "undici-types": "~7.10.0"
       }
     },
     "node_modules/@types/normalize-package-data": {
@@ -2873,9 +2873,9 @@
       }
     },
     "node_modules/chalk": {
-      "version": "5.4.1",
-      "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.4.1.tgz",
-      "integrity": "sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w==",
+      "version": "5.5.0",
+      "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.5.0.tgz",
+      "integrity": "sha512-1tm8DTaJhPBG3bIkVeZt1iZM9GfSX2lzOeDVZH9R9ffRHpmHvxZ/QhgQH/aDTkswQVt+YHdXAdS/In/30OjCbg==",
       "dev": true,
       "license": "MIT",
       "engines": {
@@ -4183,9 +4183,9 @@
       }
     },
     "node_modules/fs-extra": {
-      "version": "11.3.0",
-      "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.0.tgz",
-      "integrity": "sha512-Z4XaCL6dUDHfP/jT25jJKMmtxvuwbkrD1vNSMFlo9lNLY2c5FHYSQgHPRZUjAB26TpDEoW9HCOgplrdbaPV/ew==",
+      "version": "11.3.1",
+      "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.1.tgz",
+      "integrity": "sha512-eXvGGwZ5CL17ZSwHWd3bbgk7UUpF6IFHtP57NYYakPvHOs8GDgDe5KJI36jIJzDkJ6eJjuzRA8eBQb6SkKue0g==",
       "dev": true,
       "license": "MIT",
       "dependencies": {
@@ -7624,13 +7624,13 @@
       }
     },
     "node_modules/tsd": {
-      "version": "0.32.0",
-      "resolved": "https://registry.npmjs.org/tsd/-/tsd-0.32.0.tgz",
-      "integrity": "sha512-R5lBZCbxGBowOcW0gpQaiIjGYrG5NmU+PfFDKcc3zbtzWjML1o/zAwzdDnS2ZheSlPu9GW51azpFqEPUBq9DoQ==",
+      "version": "0.33.0",
+      "resolved": "https://registry.npmjs.org/tsd/-/tsd-0.33.0.tgz",
+      "integrity": "sha512-/PQtykJFVw90QICG7zyPDMIyueOXKL7jOJVoX5pILnb3Ux+7QqynOxfVvarE+K+yi7BZyOSY4r+OZNWSWRiEwQ==",
       "dev": true,
       "license": "MIT",
       "dependencies": {
-        "@tsd/typescript": "~5.8.3",
+        "@tsd/typescript": "^5.9.2",
         "eslint-formatter-pretty": "^4.1.0",
         "globby": "^11.0.1",
         "jest-diff": "^29.0.3",
@@ -7734,9 +7734,9 @@
       }
     },
     "node_modules/undici-types": {
-      "version": "7.8.0",
-      "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.8.0.tgz",
-      "integrity": "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw==",
+      "version": "7.10.0",
+      "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.10.0.tgz",
+      "integrity": "sha512-t5Fy/nfn+14LuOc2KNYg75vZqClpAiqscVvMygNnlsHBFpSXdJaYtXMcdNLpl/Qvc3P2cB3s6lOV51nqsFq4ag==",
       "dev": true,
       "license": "MIT"
     },
@@ -7978,9 +7978,9 @@
       }
     },
     "node_modules/vitepress": {
-      "version": "1.6.3",
-      "resolved": "https://registry.npmjs.org/vitepress/-/vitepress-1.6.3.tgz",
-      "integrity": "sha512-fCkfdOk8yRZT8GD9BFqusW3+GggWYZ/rYncOfmgcDtP3ualNHCAg+Robxp2/6xfH1WwPHtGpPwv7mbA3qomtBw==",
+      "version": "1.6.4",
+      "resolved": "https://registry.npmjs.org/vitepress/-/vitepress-1.6.4.tgz",
+      "integrity": "sha512-+2ym1/+0VVrbhNyRoFFesVvBvHAVMZMK0rw60E3X/5349M1GuVdKeazuksqopEdvkKwKGs21Q729jX81/bkBJg==",
       "dev": true,
       "license": "MIT",
       "dependencies": {
@@ -8139,9 +8139,9 @@
       "license": "ISC"
     },
     "node_modules/yaml": {
-      "version": "2.8.0",
-      "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.0.tgz",
-      "integrity": "sha512-4lLa/EcQCB0cJkyts+FpIRx5G/llPxfP6VQU5KByHEhLxY3IJCH0f0Hy1MHI8sClTvsIb8qwRJ6R/ZdlDJ/leQ==",
+      "version": "2.8.1",
+      "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.1.tgz",
+      "integrity": "sha512-lcYcMxX2PO9XMGvAJkJ3OsNMw+/7FKes7/hgerGUYWIoWu5j/+YQqcZr5JnPZWzOsEBgMbSbiSTn/dv/69Mkpw==",
       "dev": true,
       "license": "ISC",
       "bin": {
package.json
@@ -110,12 +110,12 @@
     "@size-limit/file": "11.2.0",
     "@types/fs-extra": "11.0.4",
     "@types/minimist": "1.2.5",
-    "@types/node": "24.1.0",
+    "@types/node": "24.2.0",
     "@types/which": "3.0.4",
     "@webpod/ingrid": "1.1.1",
     "@webpod/ps": "0.1.4",
     "c8": "10.1.3",
-    "chalk": "5.4.1",
+    "chalk": "5.5.0",
     "create-require": "1.1.1",
     "cronometro": "5.3.0",
     "depseek": "0.4.1",
@@ -129,7 +129,7 @@
     "esbuild-plugin-resolve": "2.0.0",
     "esbuild-plugin-transform-hook": "0.2.0",
     "esbuild-plugin-utils": "0.1.0",
-    "fs-extra": "11.3.0",
+    "fs-extra": "11.3.1",
     "get-port": "7.1.0",
     "globby": "14.1.0",
     "jsr": "0.13.5",
@@ -140,12 +140,12 @@
     "prettier": "3.6.2",
     "size-limit": "11.2.0",
     "ts-node": "10.9.2",
-    "tsd": "0.32.0",
+    "tsd": "0.33.0",
     "tsx": "4.20.3",
     "typescript": "5.9.2",
-    "vitepress": "1.6.3",
+    "vitepress": "1.6.4",
     "which": "5.0.0",
-    "yaml": "2.8.0",
+    "yaml": "2.8.1",
     "zurk": "0.11.4"
   },
   "overrides": {