Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update dependency zx to v8.3.2 (main) #2623

Closed
wants to merge 1 commit into from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Feb 5, 2025

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
zx (source) 8.1.6 -> 8.3.2 age adoption passing confidence

Release Notes

google/zx (zx)

v8.3.2: – Clogged Drain

Compare Source

Restrics unsafe vals usage on dotenv.stringify #​1093 #​1094

v8.3.1: – Perfect Seal

Compare Source

The release essence: introduced full-featured .env support #​461#​1060 #​1052 #​1043 #​1037 #​1032 #​1030 #​1022

API

envapi is a tiny 100 LOC dotenv-inspired parser and serializer that we've integrated into zx.

import { dotenv, fs } from 'zx'

// parse
const env = dotenv.parse('A=A\nFOO=BAR') // { A: 'A', FOO: 'BAR' }

// serialize
const raw = dotenv.stringify(env) // A=A\nFOO=BAR
await fs.writeFile('.env', raw)

// load
dotenv.load('.env') // { A: 'A', FOO: 'BAR' }

// update the process.env
dotenv.config('.env')
process.env.A // A
CLI
zx --env .env script.mjs
zx --env-file .env script.mjs
QnA

— Why not use dotenv directly?
— 1) Size does matter 2) We'd like to avoid internal vaults.

— Why not load .env by default?
— 1) Explicit is better than implicit 2) Runtime itself (like bun) may provide the feature.

Chore

v8.3.0: – Pipes of Steel

Compare Source

A few weeks ago zx took a part in OSS Library Night 🎉
Many thanks to the organizers and contributors who have boosted the project with their pull requests!

Today we are releasing the zx with a huge bunch of new features and improvements.

Features

API
  • Implemented [Symbol.asyncIterator] API for ProcessPromise #​984 #​998 #​1000
    Now you can iterate over the process output using for await loop from any point of the process execution.
const process = $`sleep 0.1; echo Chunk1; sleep 0.1; echo Chunk2; sleep 0.2; echo Chunk3; sleep 0.1; echo Chunk4;`
const chunks = []

await new Promise((resolve) => setTimeout(resolve, 250))
for await (const chunk of process) {
  chunks.push(chunk)
}

chunks.length //  4
chunks[0]     // 'Chunk1'
chunks[3]     // 'Chunk4'
  • zx version is available via JS API #​986
import { version } from 'zx'
const [major] = (version || '').split('.').map(Number)
if (major < 6)
  throw new Error('zx >= 6 is required')
Pipes
  • Enabled stream picking for pipe() #​1023
const p = $`echo foo >&2; echo bar`
const o1 = (await p.pipe.stderr`cat`).toString()
const o2 = (await p.pipe.stdout`cat`).toString()

assert.equal(o1, 'foo\n')  // <- piped from stderr
assert.equal(o2, 'bar\n')  // <- stdout
  • Added signal handling on piping #​992
const ac = new AbortController()
const { signal } = ac
const p = $({ signal, nothrow: true })`echo test`.pipe`sleep 999`
setTimeout(() => ac.abort(), 50)

try {
  await p
} catch ({ message }) {
  message // The operation was aborted
}
  • Added direct piping to file shortcut #​1001
// before
await $`echo "Hello, stdout!"`.pipe(fs.createWriteStream('/tmp/output.txt'))

// after
await $`echo "Hello, stdout!"`.pipe('/tmp/output.txt')
CLI
  • Provided $.defaults setting via ZX_-prefixed environment variables #​988 #​998
ZX_VERBOSE=true ZX_SHELL='/bin/bash' zx script.mjs
zx --env=/path/to/some.env script
  • Landed installation registry customization #​994
zx --install --registry=https://registry.yarnpkg.com script.mjs

Fixes

Docs

Chores

Merry Christmas! 🎄🎅🎁

v8.2.4: – Leaky Faucet

Compare Source

  • Fixed bun async_hooks compatibility #​959

v8.2.3: – Golden Wrench

Compare Source

This release continues the work on pipe API enhancements:

const { stdout } = await $({ halt: true })`echo "hello"`
 .pipe`awk '{print $1" world"}'`
 .pipe`tr '[a-z]' '[A-Z]'`
 .run()

stdout // 'HELLO WORLD'
  • Let $ be piped directly from streams #​953
const getUpperCaseTransform = () =>
  new Transform({
    transform(chunk, encoding, callback) {
      callback(null, String(chunk).toUpperCase())
    },
  })

// $ > stream (promisified) > $ 
const o1 = await $`echo "hello"`
  .pipe(getUpperCaseTransform())
  .pipe($`cat`)

o1.stdout //  'HELLO\n'

// stream > $
const file = tempfile()
await fs.writeFile(file, 'test')
const o2 = await fs
  .createReadStream(file)
  .pipe(getUpperCaseTransform())
  .pipe($`cat`)

o2.stdout //  'TEST'
const file = tempfile()
const fileStream = fs.createWriteStream(file)
const p = $`echo "hello"`
  .pipe(getUpperCaseTransform())
  .pipe(fileStream)
const o = await p

p instanceof WriteStream             // true
o instanceof WriteStream             // true
o.stdout                             // 'hello\n'
o.exitCode;                          // 0
(await fs.readFile(file)).toString() // 'HELLO\n'

We've also slightly tweaked up dist contents for better compatibility with bundlers #​957

v8.2.2

Compare Source

What's Changed

Full Changelog: google/zx@8.2.1...8.2.2

v8.2.1

Compare Source

  • #​936 fixes endless streams piping
  • #​930 enables custom extensions support

v8.2.0

Compare Source

Pipes supercharge today! 🚀

Features

  • Delayed piping. You can fill dependent streams at any time during the origin process lifecycle (even when finished) without losing data. #​914
const result = $`echo 1; sleep 1; echo 2; sleep 1; echo 3`
const piped1 = result.pipe`cat`
let piped2

setTimeout(() => {
  piped2 = result.pipe`cat`
}, 1500)

await piped1
assert.equal((await piped1).toString(), '1\n2\n3\n')
assert.equal((await piped2).toString(), '1\n2\n3\n')
const file = tempfile()
const fileStream = fs.createWriteStream(file)
const p = $`echo "hello"`
  .pipe(
    new Transform({
      transform(chunk, encoding, callback) {
        callback(null, String(chunk).toUpperCase())
      },
    })
  )
  .pipe(fileStream)

p instanceof WriteStream             // true
await p === fileStream               // true
(await fs.readFile(file)).toString() // 'HELLO\n'

Chore

v8.1.9

Compare Source

Today's release is a minor update that includes:

Enhancements

  • We have replaced ProcessOutput fields with lazy getters to reduce mem consumption #​903, #​908
  • Reduced ReDos risks for codeblock patterns #​906
  • Kept argv reference on update #​916
  • Strengthened Shell interface to properly handle sync mode #​915:
expectType<ProcessPromise>($`cmd`)
expectType<ProcessPromise>($({ sync: false })`cmd`)
expectType<ProcessOutput>($({ sync: true })`cmd`)
expectType<ProcessOutput>($.sync`cmd`)

Fixes

v8.1.8

Compare Source

  • Apply the proper TeplateStringArray detection #​904, #​905
  • PromiseProcess got lazy getters to optimize mem usage #​903

v8.1.7

Compare Source

Step by step on the road to improvements

Fixes

Finally, we've fixed the issue with piped process rejection #​640 #​899:

const p1 = $`exit 1`.pipe($`echo hello`)
try {
  await p1
} catch (e) {
  assert.equal(e.exitCode, 1)
}

const p2 = await $({ nothrow: true })`echo hello && exit 1`.pipe($`cat`)
assert.equal(p2.exitCode, 0)
assert.equal(p2.stdout.trim(), 'hello')

Enhancements

Added cmd display to ProcessPromise #​891:

const foo = 'bar'
const p = $`echo ${foo}`

p.cmd // 'echo bar'

and duration field to ProcessOutput #​892:

const p = $`sleep 1`.nothrow()
const o = await p

o.duration // ~1000 (in ms)

Enabled zurk-like pipe string literals #​900:

const p = await $`echo foo`.pipe`cat`
p.stdout.trim() // 'foo'

Configuration

📅 Schedule: Branch creation - "before 3am on the first day of the month" (UTC), Automerge - At any time (no schedule defined).

🚦 Automerge: Enabled.

Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate using a curated preset maintained by Sanity. View repository job log here

@renovate renovate bot requested a review from a team as a code owner February 5, 2025 08:36
@renovate renovate bot enabled auto-merge (squash) February 5, 2025 08:36
Copy link

vercel bot commented Feb 5, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
live-visual-editing-next ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 5, 2025 9:03am
visual-editing-astro ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 5, 2025 9:03am
visual-editing-next ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 5, 2025 9:03am
visual-editing-next-with-i18n ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 5, 2025 9:03am
visual-editing-nuxt ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 5, 2025 9:03am
visual-editing-page-builder-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 5, 2025 9:03am
visual-editing-remix ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 5, 2025 9:03am
visual-editing-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 5, 2025 9:03am
visual-editing-studio ✅ Ready (Inspect) Visit Preview Feb 5, 2025 9:03am
visual-editing-svelte ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 5, 2025 9:03am

Copy link

socket-security bot commented Feb 5, 2025

Updated dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/[email protected] 🔁 npm/[email protected] None 0 862 kB google-wombot

View full report↗︎

Copy link
Contributor Author

renovate bot commented Feb 5, 2025

Renovate Ignore Notification

Because you closed this PR without merging, Renovate will ignore this update (8.3.2). You will get a PR once a newer version is released. To ignore this dependency forever, add it to the ignoreDeps array of your Renovate config.

If you accidentally closed this PR, or if you changed your mind: rename this PR to get a fresh replacement PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant