github google/zx 8.1.3

latest releases: 8.2.2, 8.2.1, 8.2.0...
4 months ago

Nothing special today. We just keep improving the implementation.

Features

  • ESM support is now available for Node.js v12 (previously was cjs only):

    #824, #827, #828
import {$} from 'zx'
  • zx/cli exports its inners to allow more advanced usage.
    Imagine, your own CLI tool that uses zx as a base:

    #828
#!/usr/bin/env node

import './index.mjs'
import {main} from 'zx/cli'

main()
  • Provide intermediate store configuration for fine-grained control of memory usage.

    #650, #849
const getFixedSizeArray = (size) => {
  const arr = []
  return new Proxy(arr, {
    get: (target, prop) =>
      prop === 'push' && arr.length >= size
        ? () => {}
        : target[prop],
  })
}
const store = {
  stdout: getFixedSizeArray(1),
  stderr: getFixedSizeArray(1),
  stdall: getFixedSizeArray(0),
}

const p = await $({ store })`echo foo`

p.stdout.trim() //  'foo'
p.toString()    // ''
  • Introduced sync methods for ps:

    #840
import { ps } from 'zx'

const list1 = await ps()
const list2 = await tree()

// new methods
const list3 = ps.sync()
const list4 = tree.sync()

Chore

  • $.log accepts kind: 'custom' #834
  • Describe $.verbose and $.quiet modes internals #835
  • Mention quotePowerShell in docs #851
  • Finally fixed the annoying flaky problem of the process end detection in Bun #839, coderef
  • Suppress async_hooks.createHook warning on bun #848
  • Remove node-abort-controller in favor of built-in node-fetch polyfill #842
  • Add missing global types #853

Don't miss a new zx release

NewReleases is sending notifications on new releases.